diff options
| author | Teddy Wing | 2018-07-28 08:21:52 +0200 |
|---|---|---|
| committer | Teddy Wing | 2018-07-28 08:21:52 +0200 |
| commit | 2b0a82f1a21a719f82413d00c4757f02a0fe03e1 (patch) | |
| tree | 6249bf0f6637a88417591ffdcc2fed42aca56105 | |
| parent | 5326827cd415728d4fa60592d830e35c35362b9a (diff) | |
| download | youtube-turn-off-annotations-2b0a82f1a21a719f82413d00c4757f02a0fe03e1.tar.bz2 | |
Use an interval to try to wait for the element's presence
Still not finding the annotation menu element.
| -rw-r--r-- | youtube-turn-off-annotations.user.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/youtube-turn-off-annotations.user.js b/youtube-turn-off-annotations.user.js index c4d3106..eaaf889 100644 --- a/youtube-turn-off-annotations.user.js +++ b/youtube-turn-off-annotations.user.js @@ -21,6 +21,22 @@ var annotations_menu_item = document.evaluate( null ); -if (annotations_menu_item) { - annotations_menu_item.singleNodeValue.click(); -} +// if (annotations_menu_item) { +// annotations_menu_item.singleNodeValue.click(); +// } + +window.setInterval(function() { +var annotations = 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.singleNodeValue); +}, 1000); |
