|
|
@ -1006,13 +1006,55 @@ var RC_LEFT = 37; |
|
|
|
RC_BACK = 10009; |
|
|
|
RC_BACK = 10009; |
|
|
|
RC_EXIT = 10182; |
|
|
|
RC_EXIT = 10182; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//support a and button
|
|
|
|
var getNextSibling = function(el, way) { |
|
|
|
var getNextSibling = function(el, way) { |
|
|
|
var next = null; |
|
|
|
var next = null; |
|
|
|
var tagName = el.tagName.toLowerCase(); |
|
|
|
var tagName = el.tagName.toLowerCase(); |
|
|
|
if (way == 'right') { |
|
|
|
if (way == 'right' && $(el).parents('.img_main').length > 0) { |
|
|
|
next = tagName == 'a' ? $(el).parent().next() : $(el).next(); |
|
|
|
next = tagName == 'a' ? $(el).parent().next() : $(el).next(); |
|
|
|
}else if (way == 'left') { |
|
|
|
}else if (way == 'right' && $(el).parents('.navbar-fixed-left').length > 0) { |
|
|
|
|
|
|
|
next = $('.img_main li a').first(); |
|
|
|
|
|
|
|
if (next.length > 0) { |
|
|
|
|
|
|
|
next.focus(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else if (way == 'right' && $(el).parents('.pagination-con').length > 0) { |
|
|
|
|
|
|
|
next = $(el).parent().nextAll('li:not(.disabled)').not('.active').first(); |
|
|
|
|
|
|
|
}else if (way == 'left' && $(el).parents('.pagination-con').length > 0) { |
|
|
|
|
|
|
|
next = $(el).parent().prevAll('li:not(.disabled)').not('.active').first(); |
|
|
|
|
|
|
|
}else if (way == 'up' && $(el).parents('.pagination-con').length > 0) { |
|
|
|
|
|
|
|
next = $('.img_main .im_item').last(); |
|
|
|
|
|
|
|
}else if (way == 'left' && $(el).parents('.img_main').length > 0) { |
|
|
|
next = tagName == 'a' ? $(el).parent().prev() : $(el).prev(); |
|
|
|
next = tagName == 'a' ? $(el).parent().prev() : $(el).prev(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (next.length == 0) { |
|
|
|
|
|
|
|
next = $('.navbar-fixed-left li.active a').first(); |
|
|
|
|
|
|
|
if (next.length > 0) { |
|
|
|
|
|
|
|
next.focus(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else if (way == 'up' && $(el).parents('.navbar-fixed-left').length > 0) { |
|
|
|
|
|
|
|
next = tagName == 'a' ? $(el).parent().prevAll('li:not(.menu-title)').first() : $(el).prev(); |
|
|
|
|
|
|
|
}else if (way == 'up' && $(el).parents('.img_main').length > 0) { |
|
|
|
|
|
|
|
if ($(el).parent('li').length > 0) { |
|
|
|
|
|
|
|
next = $(el).parents('ul').prevAll('.nav').find('li').first(); |
|
|
|
|
|
|
|
}else if ($(el).parent('div').length > 0) { |
|
|
|
|
|
|
|
next = $(el).parent('div').prevAll('ul').first().find('li').first(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else if (way == 'down' && $(el).parents('.navbar-fixed-left').length > 0) { |
|
|
|
|
|
|
|
next = tagName == 'a' ? $(el).parent().nextAll('li:not(.menu-title)').first() : $(el).next(); |
|
|
|
|
|
|
|
}else if (way == 'down' && $(el).parents('.img_main').length > 0) { |
|
|
|
|
|
|
|
if ($(el).parent('li').length > 0) { |
|
|
|
|
|
|
|
next = $(el).parents('ul').nextAll('.nav').find('li').first(); |
|
|
|
|
|
|
|
if (next.length == 0) { |
|
|
|
|
|
|
|
if ($(el).parents('.im_mainl').length > 0) { |
|
|
|
|
|
|
|
next = $(el).parents('ul').first().nextAll('.im_item').first(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
next = $(el).parents('ul').first().nextAll('.im_mainl').find('.im_item').first(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else if ($(el).parent('.im_item').length > 0) { |
|
|
|
|
|
|
|
next = $('div.pagination-con').find('li.active').next(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (next && next.length > 0) { |
|
|
|
if (next && next.length > 0) { |
|
|
@ -1024,6 +1066,20 @@ var getNextSibling = function(el, way) { |
|
|
|
|
|
|
|
|
|
|
|
var keyPress = function(way) { |
|
|
|
var keyPress = function(way) { |
|
|
|
var focusedEl = $(':focus'); |
|
|
|
var focusedEl = $(':focus'); |
|
|
|
|
|
|
|
if (focusedEl.length == 0) { |
|
|
|
|
|
|
|
//get img el first
|
|
|
|
|
|
|
|
focusedEl = $('.im_item a').first(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//get nav item second
|
|
|
|
|
|
|
|
if (focusedEl.length == 0) { |
|
|
|
|
|
|
|
focusedEl = $('.img_main li.active a').first(); |
|
|
|
|
|
|
|
focusedEl.focus(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
focusedEl.focus(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (focusedEl.length > 0) { |
|
|
|
if (focusedEl.length > 0) { |
|
|
|
var next = getNextSibling(focusedEl.get(0), way); |
|
|
|
var next = getNextSibling(focusedEl.get(0), way); |
|
|
|
if (next) { |
|
|
|
if (next) { |
|
|
@ -1044,5 +1100,12 @@ $(document.body).on('keydown', function(e) { |
|
|
|
keyPress('right'); |
|
|
|
keyPress('right'); |
|
|
|
}else if (e.keyCode == RC_LEFT) { |
|
|
|
}else if (e.keyCode == RC_LEFT) { |
|
|
|
keyPress('left'); |
|
|
|
keyPress('left'); |
|
|
|
|
|
|
|
}else if (e.keyCode == RC_UP) { |
|
|
|
|
|
|
|
keyPress('up'); |
|
|
|
|
|
|
|
}else if (e.keyCode == RC_DOWN) { |
|
|
|
|
|
|
|
keyPress('down'); |
|
|
|
|
|
|
|
}else if (e.keyCode == RC_ENTER) { |
|
|
|
|
|
|
|
//play images
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |