Files
Cloudreve/static/js/share_dir.js
T
2018-02-04 12:58:07 +08:00

77 lines
2.9 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
$.material.init();
angular.module('FileManagerApp').config(['fileManagerConfigProvider', function(config) {
var defaults = config.$get();
config.set({
appName: 'angular-filemanager',
defaultLang: 'zh_cn',
sidebar: false,
pickCallback: function(item) {
var msg = 'Picked %s "%s" for external use'
.replace('%s', item.type)
.replace('%s', item.fullPath());
window.alert(msg);
},
allowedActions: angular.extend(defaults.allowedActions, {
pickFiles: false,
pickFolders: false,
changePermissions: false,
upload: false,
shareFile: false,
}),
});
}]);
previewLoad = 0;
var openPhotoSwipe = function(items) {
var pswpElement = document.querySelectorAll('.pswp')[0];
var options = {
history: false,
focus: false,
showAnimationDuration: 5,
hideAnimationDuration: 0,
bgOpacity: 0.8,
closeOnScroll: 0,
};
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.init();
};
jQuery.ajaxSetup({
cache: true
});
var loadPreview = function(t) {
if (!previewLoad) {
toastr["info"]("加载预览组件...");
$.getScript("/static/js/photoswipe.min.js").done(function() {
$.getScript("/static/js/photoswipe-ui-default.js").done(function() {
openPhotoSwipe(t);
toastr.clear();
previewLoad = 1;
})
})
} else {
openPhotoSwipe(t);
}
}
function mobileBind(){
if($(window).width()<768){
$('a[ng-click|="selectOrUnselect(item, $event)"]').click(function(event){
var menu = $("#context-menu");
if (event.pageX >= window.innerWidth - menu.width()) {
event.pageX -= menu.width();
}
if (event.pageY >= window.innerHeight - menu.height()) {
event.pageY -= menu.height();
}
$("#context-menu").css({
"left": event.pageX,
"top": event.pageY
});
  $(this).contextmenu();
return false;
})
}
}