add 'Expand videos' setting

This commit is contained in:
ccd0 2014-04-07 21:17:19 -07:00
parent f490aab2ab
commit be50e4b1f4
4 changed files with 15 additions and 6 deletions

View File

@ -245,6 +245,7 @@
'Fit width': [false, ''], 'Fit width': [false, ''],
'Fit height': [false, ''], 'Fit height': [false, ''],
'Expand spoilers': [true, 'Expand all images along with spoilers.'], 'Expand spoilers': [true, 'Expand all images along with spoilers.'],
'Expand videos': [false, 'Expand all images also expands videos (no autoplay).'],
'Expand from here': [false, 'Expand all images only from current position to thread end.'], 'Expand from here': [false, 'Expand all images only from current position to thread end.'],
'Advance on contract': [false, 'Advance to next post when contracting an expanded image.'] 'Advance on contract': [false, 'Advance to next post when contracting an expanded image.']
}, },
@ -7613,7 +7614,7 @@
return ImageExpand.startVideo(clone); return ImageExpand.startVideo(clone);
}); });
} }
} else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler)) { } else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) {
return ImageExpand.expand(this, null, true); return ImageExpand.expand(this, null, true);
} }
}, },
@ -7639,7 +7640,7 @@
if (!(file && (file.isImage || file.isVideo) && doc.contains(post.nodes.root))) { if (!(file && (file.isImage || file.isVideo) && doc.contains(post.nodes.root))) {
return; return;
} }
if (ImageExpand.on && (!Conf['Expand spoilers'] && file.isSpoiler || Conf['Expand from here'] && Header.getTopOf(file.thumb) < 0)) { if (ImageExpand.on && (!Conf['Expand spoilers'] && file.isSpoiler || !Conf['Expand videos'] && file.isVideo || Conf['Expand from here'] && Header.getTopOf(file.thumb) < 0)) {
return; return;
} }
return $.queueTask(func, post); return $.queueTask(func, post);

View File

@ -221,6 +221,7 @@
'Fit width': [false, ''], 'Fit width': [false, ''],
'Fit height': [false, ''], 'Fit height': [false, ''],
'Expand spoilers': [true, 'Expand all images along with spoilers.'], 'Expand spoilers': [true, 'Expand all images along with spoilers.'],
'Expand videos': [false, 'Expand all images also expands videos (no autoplay).'],
'Expand from here': [false, 'Expand all images only from current position to thread end.'], 'Expand from here': [false, 'Expand all images only from current position to thread end.'],
'Advance on contract': [false, 'Advance to next post when contracting an expanded image.'] 'Advance on contract': [false, 'Advance to next post when contracting an expanded image.']
}, },
@ -7632,7 +7633,7 @@
return ImageExpand.startVideo(clone); return ImageExpand.startVideo(clone);
}); });
} }
} else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler)) { } else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) {
return ImageExpand.expand(this, null, true); return ImageExpand.expand(this, null, true);
} }
}, },
@ -7658,7 +7659,7 @@
if (!(file && (file.isImage || file.isVideo) && doc.contains(post.nodes.root))) { if (!(file && (file.isImage || file.isVideo) && doc.contains(post.nodes.root))) {
return; return;
} }
if (ImageExpand.on && (!Conf['Expand spoilers'] && file.isSpoiler || Conf['Expand from here'] && Header.getTopOf(file.thumb) < 0)) { if (ImageExpand.on && (!Conf['Expand spoilers'] && file.isSpoiler || !Conf['Expand videos'] && file.isVideo || Conf['Expand from here'] && Header.getTopOf(file.thumb) < 0)) {
return; return;
} }
return $.queueTask(func, post); return $.queueTask(func, post);

View File

@ -413,6 +413,10 @@ Config =
true true
'Expand all images along with spoilers.' 'Expand all images along with spoilers.'
] ]
'Expand videos': [
false
'Expand all images also expands videos (no autoplay).'
]
'Expand from here': [ 'Expand from here': [
false false
'Expand all images only from current position to thread end.' 'Expand all images only from current position to thread end.'

View File

@ -27,8 +27,10 @@ ImageExpand =
ImageExpand.setupVideoControls clone ImageExpand.setupVideoControls clone
unless clone.origin.file.fullImage.paused unless clone.origin.file.fullImage.paused
$.queueTask -> ImageExpand.startVideo clone $.queueTask -> ImageExpand.startVideo clone
else if ImageExpand.on and !@isHidden and (Conf['Expand spoilers'] or !@file.isSpoiler) else if ImageExpand.on and !@isHidden and
ImageExpand.expand @, null, true (Conf['Expand spoilers'] or !@file.isSpoiler) and
(Conf['Expand videos'] or !@file.isVideo)
ImageExpand.expand @, null, true
cb: cb:
toggle: (e) -> toggle: (e) ->
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0 return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
@ -44,6 +46,7 @@ ImageExpand =
return unless file and (file.isImage or file.isVideo) and doc.contains post.nodes.root return unless file and (file.isImage or file.isVideo) and doc.contains post.nodes.root
if ImageExpand.on and if ImageExpand.on and
(!Conf['Expand spoilers'] and file.isSpoiler or (!Conf['Expand spoilers'] and file.isSpoiler or
!Conf['Expand videos'] and file.isVideo or
Conf['Expand from here'] and Header.getTopOf(file.thumb) < 0) Conf['Expand from here'] and Header.getTopOf(file.thumb) < 0)
return return
$.queueTask func, post $.queueTask func, post