adding to gitea repo
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
// ==UserScript==
|
||||
// @name New post
|
||||
// @namespace Violentmonkey Scripts
|
||||
// @match https://teams.microsoft.com/*
|
||||
// @grant none
|
||||
// @version 1.0
|
||||
// @author -
|
||||
// @description 12/22/2023, 9:45:49 AM
|
||||
// @require https://cdn.jsdelivr.net/npm/@violentmonkey/shortcut@1
|
||||
// ==/UserScript==
|
||||
|
||||
//disable teams overriding right click menus
|
||||
document.addEventListener("contextmenu", (e)=>e.stopPropagation(), true);
|
||||
|
||||
|
||||
VM.shortcut.register('a-i', () => {
|
||||
document.querySelector("[id='new-post-button']").click();
|
||||
});
|
||||
VM.shortcut.register('c-i', () => {
|
||||
//window.alert("mario")
|
||||
document.querySelector("[data-tid='compose-start-post']").click();
|
||||
focusElement('[data-tid="ckeditor"]');
|
||||
});
|
||||
VM.shortcut.register('c-r', () => {
|
||||
document.querySelector("[data-tid='ckeditor']").focus();
|
||||
});
|
||||
VM.shortcut.register('a-c-`', () => { // Click "teams" button
|
||||
document.title = "Switching to Teams...";
|
||||
document.querySelector("[data-tid='2a84919f-59d8-4441-a975-2a8c2643b741']").click();
|
||||
});
|
||||
VM.shortcut.register('a-s-~', () => { // Click "teams" button
|
||||
document.title = "Switching to Chat...";
|
||||
document.querySelector("[data-tid='86fcd49b-61a2-4701-b771-54728cd291fb']").click();
|
||||
});
|
||||
VM.shortcut.register('a-s-(', () => {
|
||||
chatSwitch("Corey Luckett", "[aria-label='Corey Luckett']", "SD General", "[data-tid='channel-list-item-text-19:17d0f18bbe38444585becef3f654c859@thread.skype']");
|
||||
});
|
||||
VM.shortcut.register('a-9', () => {
|
||||
chatSwitch("Support Agents and Alumni", "[aria-label='Support Agents and Alumni']", "Alpha Pod", "[data-tid='channel-list-item-text-19:7a5705aa5f5e4189998a90a6f89c136f@thread.skype']");
|
||||
});
|
||||
VM.shortcut.register('a-0', () => {
|
||||
chatSwitch("Sierra Alpha Only", "[aria-label='Sierra Alpha Only']", "Charlie Pod", "[data-tid='channel-list-item-text-19:95c6eb80937a44d4a6540b9e6fdfc6c5@thread.skype']");
|
||||
});
|
||||
VM.shortcut.register('a--', () => {
|
||||
chatSwitch("Sigma Pod", "[aria-label='Sigma Pod']", "Gamma Pod", "[data-tid='channel-list-item-text-19:83b2a5bf12d94019840d1d5687c49107@thread.skype']");
|
||||
});
|
||||
VM.shortcut.register('a-=', () => {
|
||||
toggleTeams()
|
||||
});
|
||||
function toggleTeams(){
|
||||
var chatButton = document.querySelector("[data-tid='86fcd49b-61a2-4701-b771-54728cd291fb']")
|
||||
if(chatButton.getAttribute('aria-pressed') == "true"){
|
||||
//chat is pressed! :D
|
||||
document.title = "Switching to Teams...";
|
||||
document.querySelector("[data-tid='2a84919f-59d8-4441-a975-2a8c2643b741']").click();
|
||||
}
|
||||
else{
|
||||
//window.alert("chat is not pressed! D:");
|
||||
document.title = "Switching to Chat...";
|
||||
document.querySelector("[data-tid='86fcd49b-61a2-4701-b771-54728cd291fb']").click();
|
||||
}
|
||||
}
|
||||
function chatSwitch(chatChatName, chatChatAttribute, teamsChatName, teamsChatAttribute){
|
||||
var chatButton = document.querySelector("[data-tid='86fcd49b-61a2-4701-b771-54728cd291fb']")
|
||||
//if(document.querySelector("[data-tid='86fcd49b-61a2-4701-b771-54728cd291fb']").getAttribute('aria-pressed') == "true"){
|
||||
if(chatButton.getAttribute('aria-pressed') == "true"){
|
||||
//chat is pressed! :D
|
||||
document.title = "Switching to "+chatChatName+"...";
|
||||
document.querySelector(chatChatAttribute).click();
|
||||
}
|
||||
else{
|
||||
//window.alert("chat is not pressed! D:");
|
||||
document.title = "Switching to "+teamsChatName+"...";
|
||||
document.querySelector(teamsChatAttribute).click();
|
||||
}
|
||||
}
|
||||
function focusElement(query){
|
||||
var intv = setInterval(function() {
|
||||
var elems = document.querySelectorAll(query);
|
||||
if(elems.length < 1){
|
||||
return false;
|
||||
}
|
||||
//when element is found, clear the interval.
|
||||
clearInterval(intv);
|
||||
for (var i = 0, len = elems.length; i < len; i++){
|
||||
elems[i].value = "";
|
||||
console.log("loop!")
|
||||
}
|
||||
document.querySelector(query).focus();
|
||||
}, 100);
|
||||
};
|
||||
Reference in New Issue
Block a user