diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 36d913beb..ad598a043 100755 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -103,7 +103,7 @@ Config = ] 'Disable Autoplaying Sounds': [ false - 'Prevent sounds on the page from autoplaying.' + 'Stop autoplaying sounds and other annoyances.' ] 'Linkification': diff --git a/src/General/css/style.css b/src/General/css/style.css index a4c4f7307..0c4777a96 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -113,6 +113,9 @@ audio.controls-added { height: auto; text-align: center; } +:root.anti-autoplay marquee { + visibility: hidden; +} /* fixed, z-index */ #overlay, diff --git a/src/Miscellaneous/AntiAutoplay.coffee b/src/Miscellaneous/AntiAutoplay.coffee index f9b0d491b..263d2ab2c 100644 --- a/src/Miscellaneous/AntiAutoplay.coffee +++ b/src/Miscellaneous/AntiAutoplay.coffee @@ -7,7 +7,7 @@ AntiAutoplay = Post.callbacks.push name: 'Disable Autoplaying Sounds' cb: @node - $.ready => @stopYoutube d.body + $.ready => @process d.body stop: (audio) -> return unless audio.autoplay @@ -18,8 +18,12 @@ AntiAutoplay = $.addClass audio, 'controls-added' node: -> - AntiAutoplay.stopYoutube @nodes.root + AntiAutoplay.process @nodes.root - stopYoutube: (root) -> + process: (root) -> for iframe in $$ 'iframe[src*="youtube"][src*="autoplay=1"]', root iframe.src = iframe.src.replace(/\?autoplay=1&?/, '?').replace('&autoplay=1', '') + for marquee in $$ 'marquee', root + span = $.el 'span', className: 'removed-marquee' + $.replace marquee, span + $.add span, [marquee.childNodes...]