diff --git a/CHANGELOG.md b/CHANGELOG.md index 87723507f..b340f61c0 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,12 @@ The links to individual versions below are to copies of the script with the upda - Fix some scrolling bugs when images are contracted. +### v1.9.13.5 +*2014-12-04* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.13.5/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.13.5/builds/4chan-X-noupdate.crx "Chromium version")] + +**ccd0** +- Add `Disable Autoplaying Sounds` option (off by default). + ### v1.9.13.4 *2014-11-26* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.13.4/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.13.4/builds/4chan-X-noupdate.crx "Chromium version")] diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 4b2479d19..a52bee23c 100755 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -101,6 +101,10 @@ Config = true 'Rewrite the URL of the current page, removing stubs and changing /res/ to /thread/.' ] + 'Disable Autoplaying Sounds': [ + false + 'Prevent sounds on the page from autoplaying.' + ] 'Linkification': 'Linkify': [ diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 360819b26..41b6fe6f9 100755 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -286,6 +286,7 @@ Main = ['Catalog Links', CatalogLinks] ['Settings', Settings] ['Index Generator', Index] + ['Disable Autoplay', AntiAutoplay] ['Announcement Hiding', PSAHiding] ['Fourchan thingies', Fourchan] ['Color User IDs', IDColor] diff --git a/src/General/css/style.css b/src/General/css/style.css index 64af98308..2ee7d0739 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -99,10 +99,14 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { unicode-bidi: -moz-isolate; unicode-bidi: -webkit-isolate; } -/* party hats */ .thread > img:first-child { + /* party hats */ pointer-events: none; } +.center > audio { + display: block; + margin: auto; +} /* fixed, z-index */ #overlay, diff --git a/src/Miscellaneous/AntiAutoplay.coffee b/src/Miscellaneous/AntiAutoplay.coffee new file mode 100644 index 000000000..d7d602d89 --- /dev/null +++ b/src/Miscellaneous/AntiAutoplay.coffee @@ -0,0 +1,10 @@ +AntiAutoplay = + init: -> + return if !Conf['Disable Autoplaying Sounds'] + $.ready @ready + + ready: -> + for audio in $$ 'audio[autoplay]' + audio.pause() + audio.autoplay = false + audio.controls = true