Expand all images and Media download list
This commit is contained in:
parent
d0a524dfc8
commit
3d1688e99e
|
@ -134,7 +134,9 @@ var _messages = {
|
|||
refreshCaptcha: 'Refresh captcha',
|
||||
showCaptcha: 'Show captcha',
|
||||
captchaExpired: 'Captcha has expired.',
|
||||
mod_: 'Mod.'
|
||||
mod_: 'Mod.',
|
||||
expandAllImages: 'Expand all images',
|
||||
getDownloadList: 'Get media download list'
|
||||
},
|
||||
ru: {
|
||||
noLocalStorage: "localStorage не поддерживается браузером",
|
||||
|
@ -263,7 +265,9 @@ var _messages = {
|
|||
refreshCaptcha: 'Обновить капчу',
|
||||
showCaptcha: 'Показать капчу',
|
||||
captchaExpired: 'Капча протухла.',
|
||||
mod_: 'Мод.'
|
||||
mod_: 'Мод.',
|
||||
expandAllImages: 'Развернуть все картинки',
|
||||
getDownloadList: 'Список медиа для скачивания'
|
||||
}
|
||||
}
|
||||
var _l = (typeof locale !== 'undefined' && _messages.hasOwnProperty(locale)) ? _messages[locale] : _messages.ru;
|
||||
|
@ -2442,7 +2446,6 @@ function expandimg_old(postnum, imgurl, thumburl, imgw, imgh, thumbw, thumbh) {
|
|||
, $postbody = $element.parents('.postbody')
|
||||
, $fc_filename = $element.parents('figure').find('.fc-filename')
|
||||
, fc_width
|
||||
if(typeof event !== 'undefined' && event.which === 2) return true;
|
||||
if (element.getElementsByTagName('img')[0].getAttribute('alt').substring(0,4)!='full') {
|
||||
$element.html('<img src="'+imgurl+'" alt="full'+postnum+'" class="thumb" height="'+imgh+'" width="'+imgw+'">');
|
||||
if (! Settings.expandImgFull()) {
|
||||
|
@ -2495,6 +2498,21 @@ function expandimg(postnum, imgurl, thumburl, imgw, imgh, thumbw, thumbh) {
|
|||
return false
|
||||
}
|
||||
|
||||
function expandAllImages() {
|
||||
document.querySelectorAll('a[onclick^="javascript:return expandimg"]').forEach(a => {
|
||||
if (a.querySelector('img')?.alt?.indexOf('full') == -1) {
|
||||
expandimg_old(...MediaViewer.parseImg(a))
|
||||
}
|
||||
})
|
||||
// expanding videos is is pointless as they won't preload ()
|
||||
// document.querySelectorAll('.movie').forEach(mov => expandVideo_old($(mov), ''))
|
||||
}
|
||||
|
||||
function getDownloadList() {
|
||||
let newWindow = window.open()
|
||||
newWindow.document.body.innerHTML = [].map.call(document.querySelectorAll('.filesize a'), a=>a.href).join('<br>')
|
||||
}
|
||||
|
||||
// YOBA previews
|
||||
var PostPreviews = {
|
||||
zindex: 3,
|
||||
|
@ -2855,6 +2873,10 @@ function readyset() {
|
|||
|
||||
$('#js_settings').prepend(_l.captchalang+': <a href="javascript:setCaptchaLang(\'ru\');">Cyrillic</a> | <a href="javascript:setCaptchaLang(\'en\');">Latin</a> | <a href="javascript:setCaptchaLang(\'num\');">Numeral</a><br />');
|
||||
|
||||
$('#js_settings').append(`
|
||||
<a href="javascript:expandAllImages()">${_l.expandAllImages}</a><br>
|
||||
<a href="javascript:getDownloadList()">${_l.getDownloadList}</a><br>`)
|
||||
|
||||
if(Styles.$cancelLink)
|
||||
$('#js_settings').prepend(Styles.$cancelLink)
|
||||
|
||||
|
@ -3902,11 +3924,10 @@ else {
|
|||
}
|
||||
}
|
||||
|
||||
function expandVideo_old($mov, ev) {
|
||||
function expandVideo_old($mov, autoplay='autoplay') {
|
||||
//good luck understanding this shitcode :^)
|
||||
let $reply = $mov.parents('.reply')
|
||||
if($mov.data('expanded') !== '1') {
|
||||
ev.preventDefault();
|
||||
var movieurl = $mov.attr('href'), imgh = $mov.data('height'), imgw = $mov.data('width'), dt = $mov.data('thumb'), postnum = $mov.data('id');
|
||||
var uid = '_vframe_'+randomString(5)+(new Date().getTime());
|
||||
$mov.replaceWith(function() {
|
||||
|
@ -3916,7 +3937,7 @@ function expandVideo_old($mov, ev) {
|
|||
$mov.find('img').hide();
|
||||
var video = $mov.find('video').show(), notice = '';
|
||||
if(!video.length) {
|
||||
$mov.find('.playable-thumb').append('<video class="thumb" src="'+movieurl+'" controls loop autoplay height="'+imgh+'" width="'+imgw+'"></video>').promise().done(function() {
|
||||
$mov.find('.playable-thumb').append(`<video class="thumb" src="${movieurl}" controls loop ${autoplay} preload="" height="${imgh}" width="${imgw}"></video>`).promise().done(function() {
|
||||
video = $mov.find('video');
|
||||
});
|
||||
video[0].volume = localStorage['mediaVolume'] || 1
|
||||
|
@ -3924,7 +3945,10 @@ function expandVideo_old($mov, ev) {
|
|||
localStorage['mediaVolume'] = this.muted ? 0 : this.volume
|
||||
}
|
||||
}
|
||||
else video.get(0).play();
|
||||
else {
|
||||
if (!autoplay)
|
||||
video.get(0).pause()
|
||||
}
|
||||
if(!Settings.expandImgFull()) {
|
||||
var offset = 50, offset_el = video[0];
|
||||
var max_w = document.documentElement?document.documentElement.clientWidth : document.body.clientWidth;
|
||||
|
@ -3977,7 +4001,7 @@ function expandVideo($mov, ev) {
|
|||
mv.onCollapse = () => mv = null
|
||||
}
|
||||
else {
|
||||
expandVideo_old($mov, ev)
|
||||
expandVideo_old($mov)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue