|
|
|
@ -603,6 +603,79 @@ if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') {
@@ -603,6 +603,79 @@ if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//加载更多视频
|
|
|
|
|
if ($('.othervideos').length > 0) { |
|
|
|
|
var videoId = $('.othervideos').attr('data-id'), |
|
|
|
|
cateId = $('.othervideos').attr('data-pid'), |
|
|
|
|
cacheId = $('.othervideos').attr('data-cid'), |
|
|
|
|
currentPage = $('.othervideos').attr('data-page'); |
|
|
|
|
var api = '/list/', |
|
|
|
|
params = { |
|
|
|
|
id: cateId, |
|
|
|
|
cid: cacheId, |
|
|
|
|
show: 'video', |
|
|
|
|
dataType: 'video', |
|
|
|
|
page: currentPage |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var getVideoUrl = function(videoId, videoPath) { |
|
|
|
|
var url = new URL(location.href); |
|
|
|
|
var api = url.origin + url.pathname; |
|
|
|
|
|
|
|
|
|
var newParas = []; |
|
|
|
|
for (var key of url.searchParams.keys()) { |
|
|
|
|
if (key != 'id' && key != 'url' && key != 'other') { |
|
|
|
|
newParas.push(key + '=' + url.searchParams.get(key)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
newParas.push('id=' + videoId); |
|
|
|
|
newParas.push('url=' + encodeURIComponent(videoPath)); |
|
|
|
|
|
|
|
|
|
return api + '?other=1&' + newParas.join('&'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var renderVideos = function(ignoreId, videos) { |
|
|
|
|
var template = $('#template_video_item').html(), |
|
|
|
|
html = '', tmp = ''; |
|
|
|
|
|
|
|
|
|
for (var index in videos) { |
|
|
|
|
if (videos[index].id == ignoreId) {continue;} |
|
|
|
|
tmp = template.replace('{videoUrl}', getVideoUrl(videos[index].id, videos[index].path)); |
|
|
|
|
tmp = tmp.replaceAll('{title}', videos[index].filename); |
|
|
|
|
tmp = tmp.replaceAll('{videoId}', videos[index].id); |
|
|
|
|
tmp = tmp.replaceAll('{videoPath}', videos[index].path); |
|
|
|
|
|
|
|
|
|
html += tmp; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return html; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
|
url: api, |
|
|
|
|
method: 'GET', |
|
|
|
|
dataType: 'json', |
|
|
|
|
data: params |
|
|
|
|
}).done(function(data) { |
|
|
|
|
//console.log('more videos', data);
|
|
|
|
|
if (typeof(data.videos) != 'undefined' && data.videos.length > 0) { |
|
|
|
|
$('.othervideos').html(renderVideos(videoId, data.videos)); |
|
|
|
|
setTimeout(function() { |
|
|
|
|
$('.othervideos .video-poster').each(function(index, el) { |
|
|
|
|
var videoId = $(el).attr('data-video-id'), |
|
|
|
|
videoUrl = $(el).attr('data-video-url'); |
|
|
|
|
getVideoMetaAndShowIt(videoId, videoUrl); |
|
|
|
|
}); |
|
|
|
|
}, 50); |
|
|
|
|
}else { |
|
|
|
|
//_noMoreData = true;
|
|
|
|
|
console.warn('获取更多视频数据出错啦', data.msg); |
|
|
|
|
} |
|
|
|
|
}).fail(function(jqXHR, textStatus, errorThrown) { |
|
|
|
|
console.error('获取更多视频数据失败,错误信息:' + errorThrown); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//目录收拢、展开
|
|
|
|
|
$('.btn-dir-ext').click(function(evt) { |
|
|
|
|