Created
May 29, 2019 14:20
-
-
Save reduardo7/8d65fa079250775a6517b01d87d77dfd to your computer and use it in GitHub Desktop.
Userscripts for Greasemonkey/Tampermonkey
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 MeetSub | |
// @namespace https://about.me/eduardo.cuomo.ar | |
// @version 1.0 | |
// @description Google Meet Subtitles | |
// @author Eduardo Daniel Cuomo <[email protected] | [email protected]> | |
// @match https://meet.google.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var subtitleDiv = null; | |
function getSubtitleDiv() { | |
//subtitleDiv = document.querySelector('div > div > div:nth-child(3) > div:nth-child(2) > div.QiOq5b'); | |
subtitleDiv = document.querySelector('div > div > div:nth-child(3) > div:nth-child(2) > div:nth-child(5)'); | |
return subtitleDiv; | |
} | |
function apply() { | |
subtitleDiv.style.position = 'absolute'; | |
subtitleDiv.style.top = '0'; | |
subtitleDiv.style.background = '#00000022'; | |
subtitleDiv.style['text-shadow'] = '0 0 5px #000000'; | |
// Watcher | |
if (window._resizeInterval) { | |
clearInterval(window._resizeInterval); | |
} | |
window._resizeInterval = setInterval(() => { | |
var participantsDiv = document.querySelector('div > div > div:nth-child(3) > div:nth-child(2) > div:nth-child(1) > div > div'); | |
participantsDiv.style.top = subtitleDiv.offsetHeight + 'px'; | |
participantsDiv.style.bottom = '100px'; | |
}, 100); | |
} | |
function init() { | |
// Wait for subtitle div | |
if (getSubtitleDiv()) { | |
// Found, apply reformat | |
apply(); | |
} else { | |
// Not found, retry... | |
setTimeout(init, 1000); | |
} | |
} | |
init(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment