|
@@ -26,39 +26,39 @@ function listFolders(folder = ""){
|
|
|
$('#CurFolder').text("");
|
|
|
toggleRemoveLinks(true);
|
|
|
getAllFolders();
|
|
|
-
|
|
|
+
|
|
|
if(folder != "" && folder != "." && folder != ".."){
|
|
|
$("#selectfolders").val(folder);
|
|
|
}
|
|
|
else{
|
|
|
$("#selectfolders").val(".");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
url: "../server/folders/" + folder,
|
|
|
dataType: "json",
|
|
|
success: function(data) {
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
if(folder != "" && folder != "." && folder != ".."){
|
|
|
var clone = document.importNode(document.querySelector('#cpyFolder').content,true);
|
|
|
$('[data-class=text]',clone).text("..");
|
|
|
- $('[data-class=link]',clone).attr('onclick','listFolders("' + folder.substr(0, folder.lastIndexOf("/")) + '")');
|
|
|
+ $('[data-class=link]',clone).attr('onclick','listFolders("' + folder.substr(0, folder.lastIndexOf("/")) + '")');
|
|
|
// dont show remove link on .. folder
|
|
|
$('[data-class=removefolder]',clone).remove()
|
|
|
$('#Folders').append(clone);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$.each( data, function( key, value ) {
|
|
|
var clone = document.importNode(document.querySelector('#cpyFolder').content,true);
|
|
|
-
|
|
|
+
|
|
|
//remove /
|
|
|
value = value.slice(0,-1)
|
|
|
$('[data-class=text]',clone).text(value);
|
|
|
-
|
|
|
+
|
|
|
if(folder == ""){
|
|
|
$('[data-class=link]',clone).attr('onclick','listFolders("' + value + '")');
|
|
|
$('[data-class=removefolder]',clone).attr('onclick','deleteFolder("' + value + '")');
|
|
@@ -69,7 +69,7 @@ function listFolders(folder = ""){
|
|
|
}
|
|
|
$('#Folders').append(clone);
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
//new Folder
|
|
|
var clone = document.importNode(document.querySelector('#cpyFolderNew').content,true);
|
|
|
$('[data-class=text]',clone).text("+");
|
|
@@ -77,7 +77,7 @@ function listFolders(folder = ""){
|
|
|
$('#Folders').append(clone);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
listData(folder)
|
|
|
}
|
|
|
|
|
@@ -92,7 +92,7 @@ function createFolder(folder = ""){
|
|
|
listFolders(folder)
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function deleteFolder(datalink) {
|
|
@@ -102,7 +102,7 @@ function deleteFolder(datalink) {
|
|
|
url: "../server/folders/" + datalink,
|
|
|
success: function(res) {
|
|
|
listFolders(datalink.substr(0, datalink.lastIndexOf("/")))
|
|
|
- }
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -113,14 +113,14 @@ function listData(folder = "", anzahl = 100){
|
|
|
const imageext = ["png", "jpg", "svg", "JPG", "PNG", "SVG"]
|
|
|
const movieext = ["mp4"]
|
|
|
$('#imgUpload').attr("action", "../server/data/" + folder);
|
|
|
-
|
|
|
+
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
url: "../server/images/" + folder + "?anzahl=" + anzahl,
|
|
|
dataType: "json",
|
|
|
success: function(data) {
|
|
|
$.each( data, function( key, value ) {
|
|
|
-
|
|
|
+
|
|
|
var ext = value.substr(value.lastIndexOf('.') + 1);
|
|
|
if(folder == ""){
|
|
|
fullfolder = value
|
|
@@ -128,11 +128,11 @@ function listData(folder = "", anzahl = 100){
|
|
|
else{
|
|
|
fullfolder = folder + "/" + value;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
var clone = document.importNode(document.querySelector('#DataItem').content,true);
|
|
|
$('[data-class=name]',clone).text(value);
|
|
|
$('[data-class=name]',clone).attr('title', value);
|
|
|
-
|
|
|
+
|
|
|
//Image
|
|
|
if(imageext.includes(ext)){
|
|
|
$('[data-class=image]',clone).append("<img src='./../storage/"+ fullfolder + "' alt=''>")
|
|
@@ -143,36 +143,36 @@ function listData(folder = "", anzahl = 100){
|
|
|
else{
|
|
|
$('[data-class=image]',clone).append("<div class='imageAlternative'>🗎</div>")
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$('[data-class=image]',clone).attr('onclick',"overlayOn('" + fullfolder + "')");
|
|
|
-
|
|
|
+
|
|
|
$('[data-class=inspect]',clone).attr('href','../storage/' + fullfolder + '');
|
|
|
$('[data-class=delete]',clone).attr('href','javascript:deleteData("' + fullfolder + '");');
|
|
|
$('[data-class=multiRemovelink]',clone).attr('name', fullfolder );
|
|
|
-
|
|
|
+
|
|
|
$('[data-class=getLink]',clone).attr('href','javascript:copy2Clipboard("' + fullfolder + '");');
|
|
|
-
|
|
|
+
|
|
|
$('[data-class=rename]',clone).attr('href','javascript:rename("' + fullfolder + '", "' + value.slice(0, - (ext.length +1)) +'");');
|
|
|
-
|
|
|
+
|
|
|
$('[data-class=createSymlink]',clone).attr('href','javascript:createSymlink("' + fullfolder + '", "' + value.slice(0, - (ext.length +1)) +'");');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
var queryString = window.location.search;
|
|
|
var urlParams = new URLSearchParams(queryString);
|
|
|
-
|
|
|
+
|
|
|
if(urlParams.has('iframe')){
|
|
|
$('[data-class=eventTrigger]',clone).css("visibility", "visible")
|
|
|
$('[data-class=eventTrigger]',clone).attr('href','javascript:triggerEvent("' + fullfolder + '");');
|
|
|
-
|
|
|
+
|
|
|
console.log("I am an Iframe")
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$('#Data').append(clone);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
if(folder != "" && folder != "." && folder != ".."){
|
|
|
$('#RemoveFolder').css("display", "block")
|
|
|
$('#removeFolderLink').attr('href','javascript:deleteFolder("' + folder + '");');
|
|
@@ -184,7 +184,7 @@ function listData(folder = "", anzahl = 100){
|
|
|
function triggerEvent(data) {
|
|
|
//get url
|
|
|
var datalink = new URL("../storage/" + data, document.baseURI).href;
|
|
|
-
|
|
|
+
|
|
|
ref = $(test);
|
|
|
setTimeout(function(){
|
|
|
ref.triggerHandler('getUrl', {"url": datalink});
|
|
@@ -197,9 +197,9 @@ function overlayOn(data) {
|
|
|
const imageext = ["png", "jpg", "svg", "PNG", "JPG", "SVG"]
|
|
|
const movieext = ["mp4"]
|
|
|
var ext = url.substr(url.lastIndexOf('.') + 1);
|
|
|
-
|
|
|
+
|
|
|
if(imageext.includes(ext)){
|
|
|
- $('#overlaycontentsize').append("<img id='overlaycontent' src=" + url + "></img>");
|
|
|
+ $('#overlaycontentsize').append("<img id='overlaycontent' src=" + url + "></img>");
|
|
|
}
|
|
|
else if(movieext.includes(ext)){
|
|
|
$('#overlaycontentsize').append("<video id='overlaycontent' controls> <source src=" + url + " type=\"video/mp4\">Your browser does not support the video tag.</video>");
|
|
@@ -227,7 +227,7 @@ function toggleRemoveLinks(setoff = false) {
|
|
|
|
|
|
|
|
|
function selectRemoveItems() {
|
|
|
- toggleRemoveLinks()
|
|
|
+ toggleRemoveLinks()
|
|
|
}
|
|
|
|
|
|
function unselectAll(){
|
|
@@ -252,13 +252,13 @@ function removeSelectedItems(){
|
|
|
$("#Data input[type=checkbox]:checked").each(function(index, data){
|
|
|
removedItems.push($(data).attr("name"));
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
if (confirm('Deleting: ' + removedItems)) {
|
|
|
$("#Data input[type=checkbox]:checked").each(function(index, data){
|
|
|
//only refresh item list when last item is removed
|
|
|
deleteDataItem($(data).attr("name"), index === ($("#Data input[type=checkbox]:checked").length -1))
|
|
|
});
|
|
|
- toggleRemoveLinks()
|
|
|
+ toggleRemoveLinks()
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -275,7 +275,7 @@ function deleteDataItem(datalink, refresh = true) {
|
|
|
success: function(res) {
|
|
|
if(refresh)
|
|
|
listFolders(datalink.substr(0, datalink.lastIndexOf("/")))
|
|
|
- }
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -294,11 +294,11 @@ function copy2Clipboard(datalink) {
|
|
|
function createSymlink(datalink, oldfilename) {
|
|
|
|
|
|
var filename = prompt("Please enter symlink filename");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (filename != null && filename != "") {
|
|
|
- var sendfilename = {"filename": filename, "oldfilename": oldfilename}
|
|
|
+ var sendfilename = {"filename": filename, "oldfilename": oldfilename}
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
data: JSON.stringify(sendfilename),
|
|
@@ -312,13 +312,13 @@ function createSymlink(datalink, oldfilename) {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function rename(datalink, oldfilename) {
|
|
|
var filename = prompt("Please enter new filename, without file extension.", oldfilename);
|
|
|
-
|
|
|
+
|
|
|
if (filename != null && filename != "") {
|
|
|
var sendfilename = {"link": datalink, "oldfilename": oldfilename, "newfilename": filename}
|
|
|
$.ajax({
|
|
@@ -335,8 +335,8 @@ function rename(datalink, oldfilename) {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -351,7 +351,7 @@ function getAllFolders(folder = ""){ //Get DB 2 HTML //has to be synchronus in o
|
|
|
success: function(data) {
|
|
|
$.each( data, function( key, value ) {
|
|
|
$('#selectfolders').append("<option>" + value.slice(0,-1) +"</option>")
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -371,7 +371,7 @@ function saveexternalfolder(folder = ""){
|
|
|
success: function(res) {
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function listExternalFolders(folder = ""){
|
|
@@ -381,10 +381,10 @@ function listExternalFolders(folder = ""){
|
|
|
type: "GET",
|
|
|
url: "../server/externalFolder",
|
|
|
dataType: "json",
|
|
|
- success: function(data) {
|
|
|
- $.each( data, function( key, value ) {
|
|
|
+ success: function(data) {
|
|
|
+ $.each( data, function( key, value ) {
|
|
|
var clone = document.importNode(document.querySelector('#cpyFolder').content,true);
|
|
|
-
|
|
|
+
|
|
|
//remove /
|
|
|
value = value.slice(0,-1)
|
|
|
$('[data-class=text]',clone).text(value);
|
|
@@ -396,24 +396,24 @@ function listExternalFolders(folder = ""){
|
|
|
}
|
|
|
else{
|
|
|
$('#Folders').text("");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//alert($.get(folder));
|
|
|
-
|
|
|
+
|
|
|
/*
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
url: folder,
|
|
|
crossDomain: true,
|
|
|
- success: function(data) {
|
|
|
+ success: function(data) {
|
|
|
alert(data);
|
|
|
}
|
|
|
});
|
|
|
*/
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//listData(folder)
|
|
|
}
|
|
|
|
|
@@ -437,14 +437,9 @@ var getUrlParameter = function getUrlParameter(sParam) {
|
|
|
$(document).ready(function() {
|
|
|
var path = getUrlParameter('path');
|
|
|
if(!path){
|
|
|
- path = "";
|
|
|
+ path = "";
|
|
|
}
|
|
|
listFolders(path);
|
|
|
//listExternalFolders();
|
|
|
getAllFolders(path);
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|