global sound option

This commit is contained in:
ccd0 2014-04-04 15:35:16 -07:00
parent 9ca9360ffd
commit 07d5b9eeb8
5 changed files with 14 additions and 8 deletions

View File

@ -182,7 +182,8 @@
'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*'], 'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*'],
'Werk Tyme': [false, 'Hide all post images.'], 'Werk Tyme': [false, 'Hide all post images.'],
'Autoplay': [true, 'Videos begin playing immediately when opened inline.'], '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': {
'Menu': [true, 'Add a drop-down menu to posts.'], 'Menu': [true, 'Add a drop-down menu to posts.'],
@ -7732,7 +7733,7 @@
file = post.file; file = post.file;
video = file.fullImage; video = file.fullImage;
file.videoControls = []; file.videoControls = [];
video.muted = true; video.muted = !Conf['Allow Sound'];
if (video.controls) { if (video.controls) {
contract = $.el('a', { contract = $.el('a', {
textContent: 'contract', textContent: 'contract',
@ -7907,7 +7908,7 @@
if (isVideo) { if (isVideo) {
el.loop = true; el.loop = true;
el.controls = false; el.controls = false;
el.muted = true; el.muted = !Conf['Allow Sound'];
if (Conf['Autoplay']) { if (Conf['Autoplay']) {
el.play(); el.play();
} }

View File

@ -158,7 +158,8 @@
'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*'], 'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*'],
'Werk Tyme': [false, 'Hide all post images.'], 'Werk Tyme': [false, 'Hide all post images.'],
'Autoplay': [true, 'Videos begin playing immediately when opened inline.'], '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': {
'Menu': [true, 'Add a drop-down menu to posts.'], 'Menu': [true, 'Add a drop-down menu to posts.'],
@ -7751,7 +7752,7 @@
file = post.file; file = post.file;
video = file.fullImage; video = file.fullImage;
file.videoControls = []; file.videoControls = [];
video.muted = true; video.muted = !Conf['Allow Sound'];
if (video.controls) { if (video.controls) {
contract = $.el('a', { contract = $.el('a', {
textContent: 'contract', textContent: 'contract',
@ -7915,7 +7916,7 @@
if (isVideo) { if (isVideo) {
el.loop = true; el.loop = true;
el.controls = false; el.controls = false;
el.muted = true; el.muted = !Conf['Allow Sound'];
if (Conf['Autoplay']) { if (Conf['Autoplay']) {
el.play(); el.play();
} }

View File

@ -191,6 +191,10 @@ Config =
true true
'Show native seek and volume controls on videos. Contract videos when dragged to the left.' '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':
'Menu': [ 'Menu': [

View File

@ -144,7 +144,7 @@ ImageExpand =
{file} = post {file} = post
video = file.fullImage video = file.fullImage
file.videoControls = [] file.videoControls = []
video.muted = true video.muted = not Conf['Allow Sound']
if video.controls if video.controls
# contract link in file info # contract link in file info
contract = $.el 'a', contract = $.el 'a',

View File

@ -26,7 +26,7 @@ ImageHover =
if isVideo if isVideo
el.loop = true el.loop = true
el.controls = false el.controls = false
el.muted = true el.muted = not Conf['Allow Sound']
el.play() if Conf['Autoplay'] el.play() if Conf['Autoplay']
naturalHeight = if post.file.isVideo then 'videoHeight' else 'naturalHeight' naturalHeight = if post.file.isVideo then 'videoHeight' else 'naturalHeight'
UI.hover UI.hover