From 07d5b9eeb8463d6b8360eeb2b8ec94464a3642f9 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 4 Apr 2014 15:35:16 -0700 Subject: [PATCH] global sound option --- builds/4chan-X.user.js | 7 ++++--- builds/crx/script.js | 7 ++++--- src/General/Config.coffee | 4 ++++ src/Images/ImageExpand.coffee | 2 +- src/Images/ImageHover.coffee | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 12d007e1a..8982e1ecd 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -182,7 +182,8 @@ 'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*'], 'Werk Tyme': [false, 'Hide all post images.'], 'Autoplay': [true, 'Videos begin playing immediately when opened inline.'], - 'Show Controls': [true, 'Show native seek and volume controls on videos. Contract videos when dragged to the left.'] + 'Show Controls': [true, 'Show native seek and volume controls on videos. Contract videos when dragged to the left.'], + 'Allow Sound': [true, 'Allow sound in inline videos.'] }, 'Menu': { 'Menu': [true, 'Add a drop-down menu to posts.'], @@ -7732,7 +7733,7 @@ file = post.file; video = file.fullImage; file.videoControls = []; - video.muted = true; + video.muted = !Conf['Allow Sound']; if (video.controls) { contract = $.el('a', { textContent: 'contract', @@ -7907,7 +7908,7 @@ if (isVideo) { el.loop = true; el.controls = false; - el.muted = true; + el.muted = !Conf['Allow Sound']; if (Conf['Autoplay']) { el.play(); } diff --git a/builds/crx/script.js b/builds/crx/script.js index 6c6512288..ce72e54c7 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -158,7 +158,8 @@ 'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*'], 'Werk Tyme': [false, 'Hide all post images.'], 'Autoplay': [true, 'Videos begin playing immediately when opened inline.'], - 'Show Controls': [true, 'Show native seek and volume controls on videos. Contract videos when dragged to the left.'] + 'Show Controls': [true, 'Show native seek and volume controls on videos. Contract videos when dragged to the left.'], + 'Allow Sound': [true, 'Allow sound in inline videos.'] }, 'Menu': { 'Menu': [true, 'Add a drop-down menu to posts.'], @@ -7751,7 +7752,7 @@ file = post.file; video = file.fullImage; file.videoControls = []; - video.muted = true; + video.muted = !Conf['Allow Sound']; if (video.controls) { contract = $.el('a', { textContent: 'contract', @@ -7915,7 +7916,7 @@ if (isVideo) { el.loop = true; el.controls = false; - el.muted = true; + el.muted = !Conf['Allow Sound']; if (Conf['Autoplay']) { el.play(); } diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 10f5fba81..cc0db76c5 100755 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -191,6 +191,10 @@ Config = true 'Show native seek and volume controls on videos. Contract videos when dragged to the left.' ] + 'Allow Sound': [ + true + 'Allow sound in inline videos.' + ] 'Menu': 'Menu': [ diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index a5cb99d95..4d51451f6 100755 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -144,7 +144,7 @@ ImageExpand = {file} = post video = file.fullImage file.videoControls = [] - video.muted = true + video.muted = not Conf['Allow Sound'] if video.controls # contract link in file info contract = $.el 'a', diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index a768c488c..794e1cbb8 100755 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -26,7 +26,7 @@ ImageHover = if isVideo el.loop = true el.controls = false - el.muted = true + el.muted = not Conf['Allow Sound'] el.play() if Conf['Autoplay'] naturalHeight = if post.file.isVideo then 'videoHeight' else 'naturalHeight' UI.hover