$(function() {
if (!('ontouchstart' in window)) {
var screenlistTimer;
$('body')
.on('mouseenter', '.k2s-preview', function() {
if (!$('iframe', this)[0]) {
if (!$('.screenlist', this)[0]) {
$('.poster', this).after('
' + Array(16).join('') + '
')
}
var preview = $(this);
var thumbs = $('.thumbs div', this);
var urlParts = preview.next()[0].dataset.url.slice(8).split('/');
function loadThumbs(next) {
var offset = thumbs.parent().position().left;
var start = Math.ceil((1 - thumbs.width() - offset) / thumbs.outerWidth(true));
var end = Math.ceil((preview.width() - offset) / thumbs.outerWidth(true) + 0.5);
thumbs.each(function(index) {
if (index <= end) {
index = (index - start + 10) % 10 + start;
if (next ? index + 1 == end || index == end : index <= end) {
this.style.backgroundImage = '';
this.style.backgroundImage = 'url("https://static-cache.' + urlParts[0] + '/thumbnail/' + urlParts[2] + '/w320h240/' + index % 10 + '.jpeg")'
}
}
})
}
screenlistTimer = setTimeout(function() {
loadThumbs();
screenlistTimer = setInterval(loadThumbs, 2000, true)
}, 2000);
loadThumbs()
}
})
.on('mouseleave', '.k2s-preview', function() {
clearInterval(screenlistTimer)
})
}
})