Last active
March 13, 2021 01:21
-
-
Save kishorepv/2b71b2ed149fa319226be5139e76b81b to your computer and use it in GitHub Desktop.
Ends Skype Web calls after X minutes. Tested on Chrome.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name EndWebSkypeCallsAfter5Mins | |
// @namespace http://tampermonkey.net/ | |
// @version 0.3 | |
// @description Ends Skype Web calls after 5 mins | |
// @author K | |
// @match *://*.web.skype.com | |
// @match *://web.skype.com | |
// @grant none | |
// @run-at document-end | |
// @updateURL https://gist.github.com/kishorepv/2b71b2ed149fa319226be5139e76b81b/raw/ | |
// @downloadURL https://gist.github.com/kishorepv/2b71b2ed149fa319226be5139e76b81b/raw/ | |
// @supportURL https://gist.github.com/kishorepv/2b71b2ed149fa319226be5139e76b81b | |
// @source https://gist.github.com/kishorepv/2b71b2ed149fa319226be5139e76b81b | |
// ==/UserScript== | |
var DEBUG = false; | |
var EVERY_X_SECS = 20; | |
var CUTOFF_MINS = 3; | |
function check_for_element() { | |
var st_numeric = `div[data-text-as-pseudo-element^='${CUTOFF_MINS}:']`; | |
var st_minutes = `div[aria-label^='${CUTOFF_MINS} minutes']`; | |
var st_endcall = "button[aria-label='End Call']"; | |
var els = document.querySelectorAll(st_numeric); | |
var btns0 = document.querySelectorAll(st_endcall); | |
if (DEBUG) { | |
var els20 = document.querySelectorAll(st_minutes); | |
console.log(els.length, els20.length, btns0.length); | |
} | |
if (els.length >= 1) { | |
var btns = document.querySelectorAll(st_endcall); | |
var els2 = document.querySelectorAll(st_minutes); | |
if (btns.length == 1 && els2.length == 1) { | |
console.log(`Matching timer elements: ${els.length} and ${els2.length}, Matching 'End Call' buttons: ${btns.length}`); | |
console.log(els, els2, btns); | |
btns[0].click(); | |
} | |
} | |
} | |
(function() { | |
'use strict'; | |
console.log("Started 'EndWebSkypeCallsAfter5Mins.js (v0.2)' ... "); | |
setInterval(check_for_element, EVERY_X_SECS * 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment