From a0b4028c71a89d4d6f1737eac1962c5ce565ccb9 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 4 Jul 2020 15:26:17 +0100 Subject: [PATCH] Separate thisFileFolderLink and type away from tab --- assets/js/icecoder.js | 38 +++++++++++++++----------------------- classes/File.php | 2 +- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/assets/js/icecoder.js b/assets/js/icecoder.js index 4e0cf5d..f691a62 100644 --- a/assets/js/icecoder.js +++ b/assets/js/icecoder.js @@ -1799,9 +1799,9 @@ var ICEcoder = { this.fmDragBoxStartY = this.mouseY; this.fmDragSelectFirst = ""; this.fmDragSelectLast = ""; - this.thisFileFolderType = ""; - this.thisFileFolderLink = ""; - this.deselectAllFiles(); + if ("" === this.thisFileFolderLink) { + this.deselectAllFiles(); + } } // On mouse drag, state we're dragging, set the box size and position properties and select files @@ -1890,21 +1890,19 @@ var ICEcoder = { flSplit = this.returnFileAndLine(fileLink); fileLink = flSplit[0]; line = flSplit[1]; + } else { + fileLink = this.thisFileFolderLink; } - if (fileLink) { - this.thisFileFolderLink = fileLink; - this.thisFileFolderType = "file"; - } - if ("/[NEW]" !== this.thisFileFolderLink && false !== this.isOpen(this.thisFileFolderLink)) { - this.switchTab(this.isOpen(this.thisFileFolderLink) + 1); + if ("/[NEW]" !== fileLink && false !== this.isOpen(fileLink)) { + this.switchTab(this.isOpen(fileLink) + 1); if (1 < line){ this.goToLine(line); } - } else if ("" !== this.thisFileFolderLink && "file" === this.thisFileFolderType) { + } else if ("" !== fileLink) { // work out a shortened URL for the file - shortURL = this.thisFileFolderLink.replace(/\|/g, "/"); + shortURL = fileLink.replace(/\|/g, "/"); // No reason why we can't open a file (so far) canOpenFile = true; // Limit to 100 files open at a time @@ -1918,8 +1916,8 @@ var ICEcoder = { this.shortURL = shortURL; if ("/[NEW]" !== shortURL) { - this.thisFileFolderLink = this.thisFileFolderLink.replace(/\//g, "|"); - this.serverQueue("add", iceLoc + "/lib/file-control.php?action=load&file=" + encodeURIComponent(this.thisFileFolderLink) + "&csrf=" + this.csrf + "&lineNumber=" + line); + fileLink = fileLink.replace(/\//g, "|"); + this.serverQueue("add", iceLoc + "/lib/file-control.php?action=load&file=" + encodeURIComponent(fileLink) + "&csrf=" + this.csrf + "&lineNumber=" + line); this.serverMessage('' + t['Opening File'] + '
' + this.shortURL); } else { this.createNewTab('new'); @@ -1932,9 +1930,7 @@ var ICEcoder = { // Open selected files openFilesFromList: function(fileList) { for (let i = 0; i < fileList.length; i++) { - this.thisFileFolderLink = fileList[i].replace('|', '/'); - this.thisFileFolderType = 'file'; - this.openFile(); + this.openFile(fileList[i].replace('|', '/')); } }, @@ -3405,7 +3401,7 @@ var ICEcoder = { for (var i=0; i"+previousFiles[i].replace(/\|/g,"/")+"\n"; + newFile = "
  • "+previousFiles[i].replace(/\|/g,"/")+"
  • \n"; // Get DOM elem for last 10 files last10Files = this.content.contentWindow.document.getElementById('last10Files'); @@ -3432,9 +3428,7 @@ var ICEcoder = { autoOpenFiles: function() { if (this.previousFiles.length>0 && this.ask(t['Open previous files']+'\n\n'+this.previousFiles.length+' files:\n'+this.previousFiles.join('\n').replace(/\|/g,"/").replace(new RegExp(docRoot+iceRoot,'gi'),""))) { for (var i=0;i