()
| 49 | |
| 50 | |
| 51 | function callStarts() { |
| 52 | const subtitleDiv = document.querySelector("div[jscontroller='TEjq6e']"); |
| 53 | MEET_CODE = window.location.pathname; |
| 54 | MEET_CODE = MEET_CODE.substr(1, MEET_CODE.length - 1); |
| 55 | chrome.storage.sync.get(["meet_code", "script"], function (result) { |
| 56 | |
| 57 | if (result.meet_code && result.meet_code == MEET_CODE) { |
| 58 | script = result.script; |
| 59 | } |
| 60 | chrome.storage.sync.set({ |
| 61 | script: script |
| 62 | }) |
| 63 | }) |
| 64 | // To notify the first time |
| 65 | IS_SUBTITLE_ON = subtitleDiv.style.display === "none" ? false : true; |
| 66 | if (IS_SUBTITLE_ON) whenSubtitleOn(); |
| 67 | else whenSubtitleOff(); |
| 68 | |
| 69 | const subtitleOnOff = new MutationObserver(() => { |
| 70 | IS_SUBTITLE_ON = subtitleDiv.style.display === "none" ? false : true; |
| 71 | if (IS_SUBTITLE_ON) whenSubtitleOn(); |
| 72 | else whenSubtitleOff(); |
| 73 | }); |
| 74 | |
| 75 | subtitleOnOff.observe(subtitleDiv, { |
| 76 | attributes: true, |
| 77 | attributeOldValue: true, |
| 78 | attributeFilter: ["style"], |
| 79 | }); |
| 80 | }; |
| 81 | |
| 82 | |
| 83 | function whenSubtitleOn() { |
no test coverage detected