Implement 'Disable Autoplaying Sounds' option.

This commit is contained in:
ccd0 2014-12-04 13:46:20 -08:00
parent 7c476cc4c6
commit a70e273597
4 changed files with 20 additions and 1 deletions

View File

@ -101,6 +101,10 @@ Config =
true true
'Rewrite the URL of the current page, removing stubs and changing /res/ to /thread/.' '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': 'Linkification':
'Linkify': [ 'Linkify': [

View File

@ -285,6 +285,7 @@ Main =
['Catalog Links', CatalogLinks] ['Catalog Links', CatalogLinks]
['Settings', Settings] ['Settings', Settings]
['Index Generator', Index] ['Index Generator', Index]
['Disable Autoplay', AntiAutoplay]
['Announcement Hiding', PSAHiding] ['Announcement Hiding', PSAHiding]
['Fourchan thingies', Fourchan] ['Fourchan thingies', Fourchan]
['Color User IDs', IDColor] ['Color User IDs', IDColor]

View File

@ -99,10 +99,14 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) {
unicode-bidi: -moz-isolate; unicode-bidi: -moz-isolate;
unicode-bidi: -webkit-isolate; unicode-bidi: -webkit-isolate;
} }
/* party hats */
.thread > img:first-child { .thread > img:first-child {
/* party hats */
pointer-events: none; pointer-events: none;
} }
.center > audio {
display: block;
margin: auto;
}
/* fixed, z-index */ /* fixed, z-index */
#overlay, #overlay,

View File

@ -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