diff options
| author | Teddy Wing | 2018-07-28 08:27:24 +0200 |
|---|---|---|
| committer | Teddy Wing | 2018-07-28 08:27:24 +0200 |
| commit | 65edb92a57994b4654160460ac3823cdd2a9d5b4 (patch) | |
| tree | 5f981b5d2ca527d784015f10385dfcbde6f53a5d /youtube-turn-off-annotations.user.js | |
| parent | ac1fe4a89b63eebca21538779e4113d792e481e9 (diff) | |
| download | youtube-turn-off-annotations-65edb92a57994b4654160460ac3823cdd2a9d5b4.tar.bz2 | |
Click the "settings" gear icon to populate settings menu
It turns out the settings pop-up menu isn't populated at page load. Now
that I think about it, this makes sense because different videos are
going to have different options available. I think.
We can force the settings menu to load by clicking the gear icon twice,
opening then closing the settings pop-up menu.
Following this, the annotation menu item element will exist and we can
click it to disable annotations. We don't even need the interval any
more.
Diffstat (limited to 'youtube-turn-off-annotations.user.js')
| -rw-r--r-- | youtube-turn-off-annotations.user.js | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/youtube-turn-off-annotations.user.js b/youtube-turn-off-annotations.user.js index 6691df6..16c4104 100644 --- a/youtube-turn-off-annotations.user.js +++ b/youtube-turn-off-annotations.user.js @@ -6,21 +6,27 @@ // ==/UserScript== -var find_annotations_interval = window.setInterval(function() { - var annotations_is_present = document.evaluate( - "//div[contains(@class, 'ytp-settings-menu')] \ - //div[ \ - contains(@class, 'ytp-menuitem-label') and \ - contains(., 'Annotations') \ - ]", - document, - null, - XPathResult.FIRST_ORDERED_NODE_TYPE, - null - ); +var settings_button = document.querySelector('.ytp-settings-button'); - console.log(annotations_is_present); - if (annotations_is_present) { +// Load annotations menu item by activating & deactivating the settings menu +settings_button.click(); +settings_button.click(); + +// var find_annotations_interval = window.setInterval(function() { + // var annotations_is_present = document.evaluate( + // "//div[contains(@class, 'ytp-settings-menu')] \ + // //div[ \ + // contains(@class, 'ytp-menuitem-label') and \ + // contains(., 'Annotations') \ + // ]", + // document, + // null, + // XPathResult.FIRST_ORDERED_NODE_TYPE, + // null + // ); + // + // console.log(annotations_is_present); + // if (annotations_is_present) { var annotations_menu_item = document.evaluate( "//div[contains(@class, 'ytp-settings-menu')] \ //div[ \ @@ -42,5 +48,5 @@ var find_annotations_interval = window.setInterval(function() { } // window.clearInterval(find_annotations_interval); - } -}, 1000); +// } +// }, 1000); |
