|
|
@ -45,8 +45,10 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return fmt;
|
|
|
|
return fmt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function audioPause() {
|
|
|
|
function audioPause() {
|
|
|
|
document.getElementById('preview-target').pause();
|
|
|
|
document.getElementById('preview-target').pause();
|
|
|
|
|
|
|
|
dp.pause();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$("#size").html(getSize(shareInfo.fileSize));
|
|
|
|
$("#size").html(getSize(shareInfo.fileSize));
|
|
|
|
$("#down_num").html(shareInfo.downloadNum);
|
|
|
|
$("#down_num").html(shareInfo.downloadNum);
|
|
|
@ -64,15 +66,54 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
vplayderLoad = false;
|
|
|
|
|
|
|
|
function includeCss(filename) {
|
|
|
|
|
|
|
|
var head = document.getElementsByTagName('head')[0];
|
|
|
|
|
|
|
|
var link = document.createElement('link');
|
|
|
|
|
|
|
|
link.href = filename;
|
|
|
|
|
|
|
|
link.rel = 'stylesheet';
|
|
|
|
|
|
|
|
link.type = 'text/css';
|
|
|
|
|
|
|
|
head.appendChild(link)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var loadDPlayer = function(url){
|
|
|
|
|
|
|
|
if (!vplayderLoad) {
|
|
|
|
|
|
|
|
toastr["info"]("加载预览组件...");
|
|
|
|
|
|
|
|
includeCss("/static/css/DPlayer.min.css");
|
|
|
|
|
|
|
|
$.getScript("/static/js/DPlayer.min.js").done(function() {
|
|
|
|
|
|
|
|
toastr.clear();
|
|
|
|
|
|
|
|
vplayderLoad = 1;
|
|
|
|
|
|
|
|
playVideo(url);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
playVideo(url);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var playVideo = function(url){
|
|
|
|
|
|
|
|
dp = new DPlayer({
|
|
|
|
|
|
|
|
container: document.getElementById("preview-target"),
|
|
|
|
|
|
|
|
screenshot: true,
|
|
|
|
|
|
|
|
video: {
|
|
|
|
|
|
|
|
url: url
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
dp.on("fullscreen", function(){
|
|
|
|
|
|
|
|
$(".modal-backdrop").hide();
|
|
|
|
|
|
|
|
$("#side").hide();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
dp.on("fullscreen_cancel", function(){
|
|
|
|
|
|
|
|
$(".modal-backdrop").show();
|
|
|
|
|
|
|
|
$("#side").show();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
var openPhotoSwipe = function(pic, ww, hh) {
|
|
|
|
var openPhotoSwipe = function(pic, ww, hh) {
|
|
|
|
var pswpElement = document.querySelectorAll('.pswp')[0];
|
|
|
|
var pswpElement = document.querySelectorAll('.pswp')[0];
|
|
|
|
items= [
|
|
|
|
items = [{
|
|
|
|
{
|
|
|
|
|
|
|
|
src: pic,
|
|
|
|
src: pic,
|
|
|
|
w: ww,
|
|
|
|
w: ww,
|
|
|
|
h: hh
|
|
|
|
h: hh
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
];
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
var options = {
|
|
|
|
history: false,
|
|
|
|
history: false,
|
|
|
|
focus: false,
|
|
|
|
focus: false,
|
|
|
@ -86,6 +127,7 @@
|
|
|
|
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
|
|
|
|
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
|
|
|
|
gallery.init();
|
|
|
|
gallery.init();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (/\.(gif|jpg|jpeg|png|svg|SVG|GIF|JPG|PNG)$/.test(shareInfo.fileName)) {
|
|
|
|
if (/\.(gif|jpg|jpeg|png|svg|SVG|GIF|JPG|PNG)$/.test(shareInfo.fileName)) {
|
|
|
|
$.getScript("/static/js/photoswipe.min.js").done(function() {
|
|
|
|
$.getScript("/static/js/photoswipe.min.js").done(function() {
|
|
|
|
$.getScript("/static/js/photoswipe-ui-default.js").done(function() {
|
|
|
|
$.getScript("/static/js/photoswipe-ui-default.js").done(function() {
|
|
|
@ -106,14 +148,14 @@
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-movie-o" aria-hidden="true"></i>')
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-movie-o" aria-hidden="true"></i>')
|
|
|
|
$("#previewButton").click(function() {
|
|
|
|
$("#previewButton").click(function() {
|
|
|
|
if (shareInfo.allowPreview) {
|
|
|
|
if (shareInfo.allowPreview) {
|
|
|
|
$(".previewContent").html('<video id="preview-target" style="width: 100%;object-fit: fill" controls="controls" class="preview" src="/Share/Preview/'+shareInfo.shareId+'" ></video>');
|
|
|
|
$(".previewContent").html('<div id="preview-target" style="width: 100%;object-fit: fill" class="preview"></div>');
|
|
|
|
$('#previewModal').modal();
|
|
|
|
$('#previewModal').modal();
|
|
|
|
|
|
|
|
loadDPlayer('/Share/Preview/' + shareInfo.shareId);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
toastr["error"]("请先登录")
|
|
|
|
toastr["error"]("请先登录")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
} else if (/\.(MP3|mp3|wav|WAV|ogg|OGG)$/.test(shareInfo.fileName)) {
|
|
|
|
else if(/\.(MP3|mp3|wav|WAV|ogg|OGG)$/.test(shareInfo.fileName)){
|
|
|
|
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-audio-o" aria-hidden="true"></i>');
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-audio-o" aria-hidden="true"></i>');
|
|
|
|
$("#previewButton").click(function() {
|
|
|
|
$("#previewButton").click(function() {
|
|
|
|
if (shareInfo.allowPreview) {
|
|
|
|
if (shareInfo.allowPreview) {
|
|
|
@ -133,8 +175,7 @@
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-powerpoint-o" aria-hidden="true"></i>');
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-powerpoint-o" aria-hidden="true"></i>');
|
|
|
|
} else if (/\.(pdf|PDF)$/.test(shareInfo.fileName)) {
|
|
|
|
} else if (/\.(pdf|PDF)$/.test(shareInfo.fileName)) {
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-pdf-o" aria-hidden="true"></i>');
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-pdf-o" aria-hidden="true"></i>');
|
|
|
|
}
|
|
|
|
} else if (/\.(zip|ZIP|RAR|rar|7z|7Z)$/.test(shareInfo.fileName)) {
|
|
|
|
else if(/\.(zip|ZIP|RAR|rar|7z|7Z)$/.test(shareInfo.fileName)){
|
|
|
|
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-archive-o" aria-hidden="true"></i>');
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-archive-o" aria-hidden="true"></i>');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-text" aria-hidden="true"></i>');
|
|
|
|
$(".file-sign").html('<i class="fa fa-file-text" aria-hidden="true"></i>');
|
|
|
|