Browse Source

fancybox handle for tv control

master
filesite 5 days ago
parent
commit
f9cca3c2c6
  1. 40
      www/js/beauty.js

40
www/js/beauty.js

@ -168,6 +168,12 @@ if ($('#image_site').get(0)) {
}, },
endSlideshow: function(fancybox) { endSlideshow: function(fancybox) {
refreshFancyBoxStatus = 'off'; refreshFancyBoxStatus = 'off';
},
keydown: function(fancybox, eventName) {
console.log(`Fancybox eventName: ${eventName}`);
if (eventName == 'ArrowDown') {
return false;
}
} }
} }
}); });
@ -1001,10 +1007,8 @@ var RC_LEFT = 37;
RC_ENTER = 13; RC_ENTER = 13;
//tv only //tv only
RC_NEXT_CHANNEL = 10007, //TODO: 待确认 RC_PLAY = 415,
RC_PRV_CHANNEL = 10008, RC_STOP = 413;
RC_BACK = 10009;
RC_EXIT = 10182;
//support a and button //support a and button
var getNextSibling = function(el, way) { var getNextSibling = function(el, way) {
@ -1038,7 +1042,12 @@ var getNextSibling = function(el, way) {
if ($(el).parent('li').length > 0) { if ($(el).parent('li').length > 0) {
next = $(el).parents('ul').prevAll('.nav').find('li').first(); next = $(el).parents('ul').prevAll('.nav').find('li').first();
if (next.length == 0) { if (next.length == 0) {
next = $(el).parents('ul').prev('.im_mainl').find('.im_item').first(); //next = $(el).parents('ul').prev('.im_mainl').find('.im_item').first();
if ($(el).parents('.im_mainl').length > 0) {
next = $(el).parents('ul').first().prevAll('.im_item').first();
}else {
next = $(el).parents('ul').first().prevAll('.im_mainl').find('.im_item').first();
}
} }
}else if ($(el).parent('.im_item').length > 0) { }else if ($(el).parent('.im_item').length > 0) {
next = $(el).parent().prevAll('.im_item'); //6 images in one row next = $(el).parent().prevAll('.im_item'); //6 images in one row
@ -1051,7 +1060,7 @@ var getNextSibling = function(el, way) {
if (!next) { if (!next) {
next = $(el).parent('.im_item').prevAll('ul').first().find('li').first(); next = $(el).parent('.im_item').prevAll('ul').first().find('li').first();
if (next.length == 0) { if (next.length == 0) {
next = $(el).parents('.im_mainl').prev('.nav').find('li.active'); next = $(el).parents('.im_mainl').prevAll('.nav').first().find('li.active');
} }
} }
} }
@ -1079,8 +1088,8 @@ var getNextSibling = function(el, way) {
next = null; next = null;
} }
if (!next && $(el).parents('.im_mainl').next('.nav').length > 0) { if (!next && $(el).parents('.im_mainl').nextAll('.nav').length > 0) {
next = $(el).parents('.im_mainl').next('.nav').find('li.active'); next = $(el).parents('.im_mainl').nextAll('.nav').first().find('li.active');
}else if (!next && $('div.pagination-con').length > 0) { }else if (!next && $('div.pagination-con').length > 0) {
next = $('div.pagination-con').find('li.active').next(); next = $('div.pagination-con').find('li.active').next();
} }
@ -1137,8 +1146,19 @@ $(document.body).on('keydown', function(e) {
keyPress('up'); keyPress('up');
}else if (e.keyCode == RC_DOWN) { }else if (e.keyCode == RC_DOWN) {
keyPress('down'); keyPress('down');
}else if (e.keyCode == RC_ENTER) { }else if (e.keyCode == RC_PLAY) {
//play images //play images
var fancybox = Fancybox.getInstance();
if (fancybox) {
var autoplay = fancybox.plugins.Slideshow.ref;
autoplay.start();
}
}else if (e.keyCode == RC_STOP) {
//stop play images
var fancybox = Fancybox.getInstance();
if (fancybox) {
var autoplay = fancybox.plugins.Slideshow.ref;
autoplay.stop();
}
} }
}); });
Loading…
Cancel
Save