|
|
|
@ -5,6 +5,71 @@
@@ -5,6 +5,71 @@
|
|
|
|
|
//关闭videojs的ga统计
|
|
|
|
|
window.HELP_IMPROVE_VIDEOJS = false; |
|
|
|
|
|
|
|
|
|
//fancybox自定义显示原图按钮
|
|
|
|
|
var customToolbar_show1to1 = { |
|
|
|
|
tpl: $('#btn_show1to1_tmp').html(), |
|
|
|
|
click: function() { |
|
|
|
|
var fancybox = this.instance; |
|
|
|
|
var slide = fancybox.getSlide(); |
|
|
|
|
|
|
|
|
|
if (slide.src == slide.downloadSrc) { |
|
|
|
|
slide.panzoom.toggleZoom(); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fancybox.showLoading(slide); |
|
|
|
|
//如果没有自动显示loading图标,主动加上
|
|
|
|
|
if ($(slide.el).find('.fancybox-spinner').length == 0) { |
|
|
|
|
var spinner = '<div class="f-spinner fancybox-spinner"><svg viewBox="0 0 50 50"><circle cx="25" cy="25" r="20"></circle><circle cx="25" cy="25" r="20"></circle></svg></div>'; |
|
|
|
|
$(spinner).insertBefore(slide.contentEl); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$(slide.imageEl).one('load', function() { |
|
|
|
|
//console.log('image loaded');
|
|
|
|
|
fancybox.hideLoading(slide); |
|
|
|
|
$(slide.el).find('.fancybox-spinner').remove(); |
|
|
|
|
slide.panzoom.toggleZoom(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
slide.src = slide.downloadSrc; |
|
|
|
|
slide.imageEl.src = slide.downloadSrc; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
var fancyboxToolbar = { |
|
|
|
|
items: {'show1to1': customToolbar_show1to1}, |
|
|
|
|
display: { |
|
|
|
|
left: ["infobar"], |
|
|
|
|
middle: [ |
|
|
|
|
"zoomIn", |
|
|
|
|
"zoomOut", |
|
|
|
|
"show1to1", |
|
|
|
|
"rotateCCW", |
|
|
|
|
"rotateCW", |
|
|
|
|
"flipX", |
|
|
|
|
"flipY", |
|
|
|
|
"fitX", |
|
|
|
|
"fitY", |
|
|
|
|
"reset" |
|
|
|
|
], |
|
|
|
|
right: ["slideshow", "fullscreen", "thumbs", "download", "close"], |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
if ($(window).width() < 640) { //小屏幕只显示部分按钮
|
|
|
|
|
fancyboxToolbar = { |
|
|
|
|
items: {'show1to1': customToolbar_show1to1}, |
|
|
|
|
display: { |
|
|
|
|
left: ["infobar"], |
|
|
|
|
middle: [ |
|
|
|
|
"zoomIn", |
|
|
|
|
"zoomOut", |
|
|
|
|
"show1to1", |
|
|
|
|
"rotateCW" |
|
|
|
|
], |
|
|
|
|
right: ["download", "close"] |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($('#image_site').get(0)) { |
|
|
|
|
|
|
|
|
|
//获取下一页图片/视频json数据
|
|
|
|
@ -85,72 +150,7 @@ if ($('#image_site').get(0)) {
@@ -85,72 +150,7 @@ if ($('#image_site').get(0)) {
|
|
|
|
|
}, 1000); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//自定义显示原图按钮
|
|
|
|
|
var customToolbar_show1to1 = { |
|
|
|
|
tpl: $('#btn_show1to1_tmp').html(), |
|
|
|
|
click: function() { |
|
|
|
|
var fancybox = this.instance; |
|
|
|
|
var slide = fancybox.getSlide(); |
|
|
|
|
|
|
|
|
|
if (slide.src == slide.downloadSrc) { |
|
|
|
|
slide.panzoom.toggleZoom(); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fancybox.showLoading(slide); |
|
|
|
|
//如果没有自动显示loading图标,主动加上
|
|
|
|
|
if ($(slide.el).find('.fancybox-spinner').length == 0) { |
|
|
|
|
var spinner = '<div class="f-spinner fancybox-spinner"><svg viewBox="0 0 50 50"><circle cx="25" cy="25" r="20"></circle><circle cx="25" cy="25" r="20"></circle></svg></div>'; |
|
|
|
|
$(spinner).insertBefore(slide.contentEl); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$(slide.imageEl).one('load', function() { |
|
|
|
|
console.log('image loaded'); |
|
|
|
|
fancybox.hideLoading(slide); |
|
|
|
|
$(slide.el).find('.fancybox-spinner').remove(); |
|
|
|
|
slide.panzoom.toggleZoom(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
slide.src = slide.downloadSrc; |
|
|
|
|
slide.imageEl.src = slide.downloadSrc; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 图片浏览
|
|
|
|
|
var fancyboxToolbar = { |
|
|
|
|
items: {'show1to1': customToolbar_show1to1}, |
|
|
|
|
display: { |
|
|
|
|
left: ["infobar"], |
|
|
|
|
middle: [ |
|
|
|
|
"zoomIn", |
|
|
|
|
"zoomOut", |
|
|
|
|
"show1to1", |
|
|
|
|
"rotateCCW", |
|
|
|
|
"rotateCW", |
|
|
|
|
"flipX", |
|
|
|
|
"flipY", |
|
|
|
|
"fitX", |
|
|
|
|
"fitY", |
|
|
|
|
"reset" |
|
|
|
|
], |
|
|
|
|
right: ["slideshow", "fullscreen", "thumbs", "download", "close"], |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
if ($(window).width() < 640) { //小屏幕只显示部分按钮
|
|
|
|
|
fancyboxToolbar = { |
|
|
|
|
items: {'show1to1': customToolbar_show1to1}, |
|
|
|
|
display: { |
|
|
|
|
left: ["infobar"], |
|
|
|
|
middle: [ |
|
|
|
|
"zoomIn", |
|
|
|
|
"zoomOut", |
|
|
|
|
"show1to1", |
|
|
|
|
"rotateCW" |
|
|
|
|
], |
|
|
|
|
right: ["download", "close"] |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
Fancybox.bind('[data-fancybox]', { |
|
|
|
|
Toolbar: fancyboxToolbar, |
|
|
|
|
loop: true, |
|
|
|
@ -168,12 +168,6 @@ if ($('#image_site').get(0)) {
@@ -168,12 +168,6 @@ if ($('#image_site').get(0)) {
|
|
|
|
|
}, |
|
|
|
|
endSlideshow: function(fancybox) { |
|
|
|
|
refreshFancyBoxStatus = 'off'; |
|
|
|
|
}, |
|
|
|
|
keydown: function(fancybox, eventName) { |
|
|
|
|
console.log(`Fancybox eventName: ${eventName}`); |
|
|
|
|
if (eventName == 'ArrowDown') { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -1006,10 +1000,14 @@ var RC_LEFT = 37;
@@ -1006,10 +1000,14 @@ var RC_LEFT = 37;
|
|
|
|
|
RC_DOWN = 40; |
|
|
|
|
RC_ENTER = 13; |
|
|
|
|
|
|
|
|
|
RC_PLAY_PC = 80, //Key p
|
|
|
|
|
RC_STOP_PC = 83, //Key s
|
|
|
|
|
|
|
|
|
|
//tv only
|
|
|
|
|
RC_PLAY = 415, |
|
|
|
|
RC_STOP = 413; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//support a and button
|
|
|
|
|
var getNextSibling = function(el, way) { |
|
|
|
|
var next = null; |
|
|
|
@ -1136,7 +1134,7 @@ var keyPress = function(way) {
@@ -1136,7 +1134,7 @@ var keyPress = function(way) {
|
|
|
|
|
|
|
|
|
|
//handle key press
|
|
|
|
|
$(document.body).on('keydown', function(e) { |
|
|
|
|
console.log('Key pressed', e.keyCode); |
|
|
|
|
//console.log('Key pressed', e.keyCode);
|
|
|
|
|
|
|
|
|
|
if (e.keyCode == RC_RIGHT) { |
|
|
|
|
keyPress('right'); |
|
|
|
@ -1146,30 +1144,24 @@ $(document.body).on('keydown', function(e) {
@@ -1146,30 +1144,24 @@ $(document.body).on('keydown', function(e) {
|
|
|
|
|
keyPress('up'); |
|
|
|
|
}else if (e.keyCode == RC_DOWN) { |
|
|
|
|
keyPress('down'); |
|
|
|
|
}else if (e.keyCode == RC_PLAY) { |
|
|
|
|
}else if (e.keyCode == RC_PLAY || e.keyCode == RC_PLAY_PC) { |
|
|
|
|
//play images
|
|
|
|
|
var fancybox = Fancybox.getInstance(); |
|
|
|
|
if (fancybox) { |
|
|
|
|
var autoplay = fancybox.plugins.Slideshow.ref; |
|
|
|
|
autoplay.start(); |
|
|
|
|
//}else {
|
|
|
|
|
//Fancybox.fromSelector('[data-fancybox]');
|
|
|
|
|
} |
|
|
|
|
}else if (e.keyCode == RC_STOP) { |
|
|
|
|
}else if (e.keyCode == RC_STOP || e.keyCode == RC_STOP_PC) { |
|
|
|
|
//stop play images
|
|
|
|
|
var fancybox = Fancybox.getInstance(); |
|
|
|
|
if (fancybox) { |
|
|
|
|
var autoplay = fancybox.plugins.Slideshow.ref; |
|
|
|
|
autoplay.stop(); |
|
|
|
|
if (e.keyCode == RC_STOP) { |
|
|
|
|
fancybox.close(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//TODO: handle fancybox show for tv browser
|
|
|
|
|
/* |
|
|
|
|
$('a[data-fancybox]').on('dblclick', function(e) { |
|
|
|
|
alert('double click'); |
|
|
|
|
var fancybox = Fancybox.getInstance(); |
|
|
|
|
if (fancybox) { |
|
|
|
|
fancybox.show(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
*/ |