|
@@ -2266,6 +2266,10 @@
|
|
|
}
|
|
|
|
|
|
function scrollToFileLocation(DOMElement){
|
|
|
+ if (DOMElement === undefined || $(DOMElement).offset() == undefined){
|
|
|
+ //DOM Element no longer exists
|
|
|
+ return;
|
|
|
+ }
|
|
|
//Trying to vertically align the directory from its parent list
|
|
|
let topPos = $("#folderView").scrollTop() + $(DOMElement).offset().top - $("#folderView").height()/2 - $(DOMElement).height()/2 - 28;
|
|
|
window.debug = $(DOMElement);
|
|
@@ -2416,11 +2420,11 @@
|
|
|
callbackFunction: `callRefresh("${currentPath}")`
|
|
|
}
|
|
|
var configHash = encodeURIComponent(JSON.stringify(oprConfig));
|
|
|
- var title = "Zipping " + zippingFiles.length;
|
|
|
+ var title = applocale.getString("opr/zip/zipping","Zipping ") + zippingFiles.length;
|
|
|
if (fileList.length > 1){
|
|
|
- title += " files";
|
|
|
+ title += applocale.getString("opr/zip/files", " files");
|
|
|
}else{
|
|
|
- title += " file";
|
|
|
+ title += applocale.getString("opr/zip/file"," file");
|
|
|
}
|
|
|
parent.newFloatWindow({
|
|
|
url: "SystemAO/file_system/file_operation.html#" + configHash,
|
|
@@ -3042,7 +3046,7 @@
|
|
|
var fileList = [];
|
|
|
if ($(".fileObject.selected").length == 1 && $(".fileObject.selected").attr("type") == "file"){
|
|
|
//One file. Download directly.
|
|
|
- var downloadURL = "/media?file=" + encodeURIComponent($(".fileObject.selected").attr("filepath")) + "&download=true";
|
|
|
+ var downloadURL = "../../media?file=" + encodeURIComponent($(".fileObject.selected").attr("filepath")) + "&download=true";
|
|
|
var filename = $(".fileObject.selected").attr("filename");
|
|
|
generateDownloadFromURL(downloadURL,escape(filename));
|
|
|
}else if ($(".fileObject.selected").length > 1 || ($(".fileObject.selected").length == 1 && $(".fileObject.selected").attr("type") == "folder")){
|
|
@@ -3055,10 +3059,10 @@
|
|
|
//Add a display for file compression
|
|
|
var fileCount = $(".fileObject.selected").length;
|
|
|
|
|
|
- var displayString = "Zipping " + fileCount + " files";
|
|
|
+ var displayString = applocale.getString("opr/zip/zipping", "Zipping ") + fileCount + applocale.getString("opr/zip/files", " files");
|
|
|
if (fileCount == 1){
|
|
|
//Use the filename as task name
|
|
|
- displayString = "Zipping " + $(".fileObject.selected").attr("filename");
|
|
|
+ displayString = applocale.getString("opr/zip/zipping", "Zipping ") + $(".fileObject.selected").attr("filename");
|
|
|
}
|
|
|
|
|
|
var taskUUID = appendUploadFileItem(displayString, -1);
|
|
@@ -3964,6 +3968,9 @@
|
|
|
//Enter key
|
|
|
if ($(".fileObject.selected").length > 0){
|
|
|
openViaButton();
|
|
|
+ }else if ($(".fileObject.hotSearchHighlight").length > 0 && $(".fileObject.selected").length == 0){
|
|
|
+ //Hot search selection mode
|
|
|
+
|
|
|
}
|
|
|
}else if (event.which == 27){
|
|
|
//Esc key
|
|
@@ -3976,11 +3983,7 @@
|
|
|
}
|
|
|
$(".fileObject.selected").removeClass("selected");
|
|
|
hotSearchTimer = setTimeout(function(){
|
|
|
- hotSearchBuffer = "";
|
|
|
- hotSearchTimer = null;
|
|
|
- //Move the file to "selected" mode
|
|
|
- $(".hotSearchHighlight").addClass("selected");
|
|
|
- $(".hotSearchHighlight").removeClass("hotSearchHighlight");
|
|
|
+ existHotSearch();
|
|
|
}, 1000);
|
|
|
|
|
|
if (hotSearchBuffer.length > 0 && event.key == hotSearchBuffer.substr(hotSearchBuffer.length - 1, 1)){
|
|
@@ -4875,12 +4878,21 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function exitHotSearch(){
|
|
|
+ hotSearchBuffer = "";
|
|
|
+ hotSearchTimer = null;
|
|
|
+ //Move the file to "selected" mode
|
|
|
+ $(".hotSearchHighlight").addClass("selected");
|
|
|
+ $(".hotSearchHighlight").removeClass("hotSearchHighlight");
|
|
|
+ }
|
|
|
+
|
|
|
function handleHotSearch(starting, offset){
|
|
|
if (offset < 0){
|
|
|
offset = 0;
|
|
|
}
|
|
|
|
|
|
starting = starting.toLowerCase();
|
|
|
+ console.log(starting);
|
|
|
$(".hotSearchHighlight").removeClass("hotSearchHighlight");
|
|
|
let files = $(".fileObject");
|
|
|
let matchingFiles = [];
|
|
@@ -4971,7 +4983,7 @@
|
|
|
var newuuid = uuidv4();
|
|
|
var humanReadableFilesize = 0;
|
|
|
if (filesize < 0){
|
|
|
- humanReadableFilesize = "Unknown Size"
|
|
|
+ humanReadableFilesize = applocale.getString("message/unknownSize", "Unknown Size")
|
|
|
}else{
|
|
|
humanReadableFilesize = bytesToSize(filesize);
|
|
|
}
|
|
@@ -5018,7 +5030,7 @@
|
|
|
}
|
|
|
|
|
|
function bytesToSize(bytes) {
|
|
|
- var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
|
+ var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
|
|
|
if (bytes == 0) return '0 Byte';
|
|
|
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
|
|
return Math.round(bytes / Math.pow(1024, i) * 100, 2) / 100 + ' ' + sizes[i];
|
|
@@ -5031,124 +5043,124 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- function dropToFolder(event){
|
|
|
- event.preventDefault();
|
|
|
- event.stopImmediatePropagation();
|
|
|
- console.log("Drop to folder detected");
|
|
|
+ function dropToFolder(event){
|
|
|
+ event.preventDefault();
|
|
|
+ event.stopImmediatePropagation();
|
|
|
+ console.log("Drop to folder detected");
|
|
|
|
|
|
- //Extract target folder path from object
|
|
|
- var targetPath = $(event.target).attr("filepath");
|
|
|
- if (targetPath == ""){
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- //Check if this is upload or file move drag
|
|
|
- var files = event.dataTransfer.files;
|
|
|
- if (files.length > 0){
|
|
|
- //Upload mode. Extract the target folder basename from path
|
|
|
- if (targetPath.substr(targetPath.length -1,1) == "/"){
|
|
|
- targetPath = targetPath.substr(0, targetPath.length-1);
|
|
|
+ //Extract target folder path from object
|
|
|
+ var targetPath = $(event.target).attr("filepath");
|
|
|
+ if (targetPath == ""){
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //Check if this is upload or file move drag
|
|
|
+ var files = event.dataTransfer.files;
|
|
|
+ if (files.length > 0){
|
|
|
+ //Upload mode. Extract the target folder basename from path
|
|
|
+ if (targetPath.substr(targetPath.length -1,1) == "/"){
|
|
|
+ targetPath = targetPath.substr(0, targetPath.length-1);
|
|
|
+ }
|
|
|
+ var folderBase = targetPath.split("/").pop() + "/";
|
|
|
+ var items = event.dataTransfer.items;
|
|
|
+ for (let i=0; i<items.length; i++) {
|
|
|
+ let item = items[i].webkitGetAsEntry();
|
|
|
+ if (item) {
|
|
|
+ recursiveScanFilesUpload(item, folderBase, folderBase);
|
|
|
}
|
|
|
- var folderBase = targetPath.split("/").pop() + "/";
|
|
|
- var items = event.dataTransfer.items;
|
|
|
- for (let i=0; i<items.length; i++) {
|
|
|
- let item = items[i].webkitGetAsEntry();
|
|
|
- if (item) {
|
|
|
- recursiveScanFilesUpload(item, folderBase, folderBase);
|
|
|
- }
|
|
|
+ }
|
|
|
+ }else if (event.dataTransfer.getData("filedata") != ""){
|
|
|
+ var targetVroot = targetPath.split(":/").shift();
|
|
|
+ //Get the source files
|
|
|
+ var filelist = JSON.parse(event.dataTransfer.getData("filedata"));
|
|
|
+ if (filelist.length > 0){
|
|
|
+ var srcVroot = filelist[0].filepath.split(":/").shift();
|
|
|
+ if (srcVroot == targetVroot){
|
|
|
+ //Use move mode
|
|
|
+ cutMode = true;
|
|
|
+
|
|
|
+ }else{
|
|
|
+ //Use copy mode
|
|
|
+ cutMode = false;
|
|
|
}
|
|
|
- }else if (event.dataTransfer.getData("filedata") != ""){
|
|
|
- var targetVroot = targetPath.split(":/").shift();
|
|
|
- //Get the source files
|
|
|
- var filelist = JSON.parse(event.dataTransfer.getData("filedata"));
|
|
|
- if (filelist.length > 0){
|
|
|
- var srcVroot = filelist[0].filepath.split(":/").shift();
|
|
|
- if (srcVroot == targetVroot){
|
|
|
- //Use move mode
|
|
|
- cutMode = true;
|
|
|
-
|
|
|
- }else{
|
|
|
- //Use copy mode
|
|
|
- cutMode = false;
|
|
|
- }
|
|
|
|
|
|
- //Parse the filelist
|
|
|
- clipboard = [];
|
|
|
- filelist.forEach(file=>{
|
|
|
- clipboard.push(file.filepath);
|
|
|
- });
|
|
|
- if (useLocalstorage){
|
|
|
- localStorage.setItem("ao/file_system/clipboard",JSON.stringify(clipboard));
|
|
|
- localStorage.setItem("ao/file_system/cutmode","true");
|
|
|
- }
|
|
|
-
|
|
|
- //Perform operations
|
|
|
- paste(targetPath, false)
|
|
|
+ //Parse the filelist
|
|
|
+ clipboard = [];
|
|
|
+ filelist.forEach(file=>{
|
|
|
+ clipboard.push(file.filepath);
|
|
|
+ });
|
|
|
+ if (useLocalstorage){
|
|
|
+ localStorage.setItem("ao/file_system/clipboard",JSON.stringify(clipboard));
|
|
|
+ localStorage.setItem("ao/file_system/cutmode","true");
|
|
|
}
|
|
|
+
|
|
|
+ //Perform operations
|
|
|
+ paste(targetPath, false)
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- function allowDrop(event){
|
|
|
- event.preventDefault();
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- $(".popupWrapper").on("click",function(){
|
|
|
- hideAllPopupWindows();
|
|
|
- });
|
|
|
+ function allowDrop(event){
|
|
|
+ event.preventDefault();
|
|
|
+ }
|
|
|
|
|
|
- function hideAllPopupWindows(){
|
|
|
- $(".popup").fadeOut(100);
|
|
|
- $(".popupWrapper").fadeOut(100);
|
|
|
- $('body').css("overflow","");
|
|
|
- }
|
|
|
+ $(".popupWrapper").on("click",function(){
|
|
|
+ hideAllPopupWindows();
|
|
|
+ });
|
|
|
|
|
|
- function showPopupWrapper(){
|
|
|
- $(".popupWrapper").fadeIn('fast');
|
|
|
- $('body').css("overflow","hidden");
|
|
|
- }
|
|
|
+ function hideAllPopupWindows(){
|
|
|
+ $(".popup").fadeOut(100);
|
|
|
+ $(".popupWrapper").fadeOut(100);
|
|
|
+ $('body').css("overflow","");
|
|
|
+ }
|
|
|
|
|
|
- //Handle keydown of enter on certain input boxes
|
|
|
- function handleEnterKeyDown(event, handler){
|
|
|
- if (event.which == 13){
|
|
|
- handler();
|
|
|
- }
|
|
|
- }
|
|
|
+ function showPopupWrapper(){
|
|
|
+ $(".popupWrapper").fadeIn('fast');
|
|
|
+ $('body').css("overflow","hidden");
|
|
|
+ }
|
|
|
|
|
|
- //Generate a download link and press it
|
|
|
- function generateDownloadFromURL(url, filename){
|
|
|
- let a = document.createElement('a')
|
|
|
- a.href = url;
|
|
|
- a.download = filename;
|
|
|
- document.body.appendChild(a)
|
|
|
- a.click()
|
|
|
- document.body.removeChild(a)
|
|
|
+ //Handle keydown of enter on certain input boxes
|
|
|
+ function handleEnterKeyDown(event, handler){
|
|
|
+ if (event.which == 13){
|
|
|
+ handler();
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- //Update sorting method for file listing
|
|
|
- function updateSortingMethods(){
|
|
|
- var method = $("#sortingMethodSelector").val();
|
|
|
- sortMode = method;
|
|
|
+ //Generate a download link and press it
|
|
|
+ function generateDownloadFromURL(url, filename){
|
|
|
+ let a = document.createElement('a')
|
|
|
+ a.href = url;
|
|
|
+ a.download = filename;
|
|
|
+ document.body.appendChild(a)
|
|
|
+ a.click()
|
|
|
+ document.body.removeChild(a)
|
|
|
+ }
|
|
|
|
|
|
- //Save it to server side
|
|
|
- $.ajax({
|
|
|
- url: "../../system/file_system/sortMode",
|
|
|
- method: "POST",
|
|
|
- data: {opr: "set", folder: currentPath, mode: sortMode},
|
|
|
- success: function(data){
|
|
|
- //console.log("Sort mode saved: " + data)
|
|
|
- refreshList();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ //Update sorting method for file listing
|
|
|
+ function updateSortingMethods(){
|
|
|
+ var method = $("#sortingMethodSelector").val();
|
|
|
+ sortMode = method;
|
|
|
|
|
|
- function requestCSRFToken(callback){
|
|
|
- $.ajax({
|
|
|
- url: "../../system/csrf/new",
|
|
|
- success: function(token){
|
|
|
- callback(token);
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ //Save it to server side
|
|
|
+ $.ajax({
|
|
|
+ url: "../../system/file_system/sortMode",
|
|
|
+ method: "POST",
|
|
|
+ data: {opr: "set", folder: currentPath, mode: sortMode},
|
|
|
+ success: function(data){
|
|
|
+ //console.log("Sort mode saved: " + data)
|
|
|
+ refreshList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function requestCSRFToken(callback){
|
|
|
+ $.ajax({
|
|
|
+ url: "../../system/csrf/new",
|
|
|
+ success: function(token){
|
|
|
+ callback(token);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
</script>
|
|
|
</body>
|