From 3d37561dc76f530dbb8c6e93ca940a66f8ef55ad Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:01:10 +0000 Subject: [PATCH 001/231] top. removed --- lib/login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/login.php b/lib/login.php index 11833ae..710fbfa 100644 --- a/lib/login.php +++ b/lib/login.php @@ -78,7 +78,7 @@ echo $ICEcoder["password"] == "" && !$ICEcoder["multiUser"] ? "Setup" : "Login"; "; + echo ""; } // Work out what plugins we'll need to set on a setInterval $onLoadExtras = ""; for ($i=0;$i Date: Fri, 28 Feb 2020 17:10:47 +0000 Subject: [PATCH 003/231] Remove top. from settings files, add parent. --- lib/settings-common.php | 2 +- lib/settings-save-current-files.php | 6 +++--- lib/settings-screen.php | 12 ++++++------ lib/settings-update.php | 8 ++++---- lib/settings.php | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/settings-common.php b/lib/settings-common.php index 27853fa..88bed0e 100644 --- a/lib/settings-common.php +++ b/lib/settings-common.php @@ -252,7 +252,7 @@ function toUTF8noBOM($string,$message=false) { if (!$strictUTF8 && strlen($teststringConverted) == strlen($teststringBroken)) { $string = utf8_encode($string); if ($message) { - echo "top.ICEcoder.message('".$t['Your document does...'].".');"; + echo "ICEcoder.message('".$t['Your document does...'].".');"; } } } diff --git a/lib/settings-save-current-files.php b/lib/settings-save-current-files.php index 1bc88b7..ef147d7 100644 --- a/lib/settings-save-current-files.php +++ b/lib/settings-save-current-files.php @@ -31,7 +31,7 @@ if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) { fwrite($fh, $settingsContents); fclose($fh); } else { - echo ""; + echo ""; } // Update our last10Files var? @@ -50,10 +50,10 @@ if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) { fwrite($fh, $settingsContents); fclose($fh); } else { - echo ""; + echo ""; } } } } - echo ''; + echo ''; } diff --git a/lib/settings-screen.php b/lib/settings-screen.php index 5466389..8091693 100644 --- a/lib/settings-screen.php +++ b/lib/settings-screen.php @@ -356,10 +356,10 @@ function findSequence(goal) { -
">update
+
">update
"> diff --git a/lib/settings-update.php b/lib/settings-update.php index 61e9f1d..71bd3be 100644 --- a/lib/settings-update.php +++ b/lib/settings-update.php @@ -79,7 +79,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset fwrite($fh, $settingsContents); fclose($fh); } else { - echo ""; + echo ""; } // OK, now the config file has been updated, update our current session with new arrays @@ -110,18 +110,18 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset fwrite($fConfigSettings, $generalSettingsContents); fclose($fConfigSettings); } else { - echo ""; + echo ""; } $githubAuthTokenSet = $ICEcoder["githubAuthToken"] != "" ? "true" : "false"; // If we've changed langugage, reload ICEcoder now if ($languageUserChanged) { - echo ''; + echo ''; die('Reloading ICEcoder after language change'); } // With all that worked out, we can now hide the settings screen and apply the new settings $jsBugFilePaths = "['".str_replace(",","','",str_replace(" ","",$_POST['bugFilePaths']))."']"; - echo ""; + echo ""; } diff --git a/lib/settings.php b/lib/settings.php index d2f5c13..be23575 100644 --- a/lib/settings.php +++ b/lib/settings.php @@ -139,7 +139,7 @@ $serverType = stristr($_SERVER['SERVER_SOFTWARE'], "win") ? "Windows" : "Linux"; $docRoot = rtrim(str_replace("\\","/",$ICEcoder['docRoot'])); $iceRoot = rtrim(str_replace("\\","/",$ICEcoder["root"])); if ($_SESSION['loggedIn'] && basename($_SERVER['SCRIPT_NAME']) == "index.php") { - echo ""; + echo ""; } // Establish the dir ICEcoders running from From 3f673f9a87a2164b3c8c806d8584c5fb8a43ce8d Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:11:51 +0000 Subject: [PATCH 004/231] Remove top. from refs --- lib/plugins-manager.php | 8 ++++---- lib/properties.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/plugins-manager.php b/lib/plugins-manager.php index 1301960..fe822b1 100644 --- a/lib/plugins-manager.php +++ b/lib/plugins-manager.php @@ -138,14 +138,14 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset fclose($fh); // Finally, reload ICEcoder itself if plugin requires it or just the iFrame screen for the user if it doesn't if ($_GET['action']=="install" && $pluginsData[$_GET['plugin']]['reload'] == "true") { - echo ""; + echo ""; } else { header("Location: plugins-manager.php?updatedPlugins&csrf=".$_SESSION["csrf"]); - echo ""; + echo ""; } die("".$t['saving plugins'].""); } else { - echo ""; + echo ""; } } @@ -184,7 +184,7 @@ function deletePlugin($dir) {

-','writingPlugins')" style="position: absolute; top: 26px; right: 20px">
+','writingPlugins')" style="position: absolute; top: 26px; right: 20px">
7) { canUpdate = false; } - if (canUpdate) {top.ICEcoder.chmod('',permText)}; + if (canUpdate) {ICEcoder.chmod('',permText)}; } From 47f5c436b956995983cb2229ad14e589cb4d1d41 Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:12:54 +0000 Subject: [PATCH 005/231] Remove top. from processes --- processes/on-editor-load.php | 57 ++++++++++++++++++------------------ processes/on-file-save.php | 4 +-- processes/on-load.php | 2 +- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/processes/on-editor-load.php b/processes/on-editor-load.php index e7919e7..2db6fc2 100644 --- a/processes/on-editor-load.php +++ b/processes/on-editor-load.php @@ -8,8 +8,9 @@ Purpose: This file is run when ICEcoder editor has loaded Langs: Anything - PHP, JS etc //--> diff --git a/processes/on-file-save.php b/processes/on-file-save.php index e772e37..700a15b 100644 --- a/processes/on-file-save.php +++ b/processes/on-file-save.php @@ -31,7 +31,7 @@ if (strtolower($fileExt) == "scss" && file_exists(dirname(__FILE__)."/../plugins fwrite($fh, $scssContent); fclose($fh); } catch (Exception $e) { - echo ";top.ICEcoder.message('Couldn\'t compile your Sass, error info below:\\n\\n".$e->getMessage()."');"; + echo ";ICEcoder.message('Couldn\'t compile your Sass, error info below:\\n\\n".$e->getMessage()."');"; } } @@ -48,7 +48,7 @@ if (strtolower($fileExt) == "less" && file_exists(dirname(__FILE__)."/../plugins try { $less->checkedCompile($file, substr($file, 0, -4)."css"); // Note: Only recompiles if changed } catch (Exception $e) { - echo ";top.ICEcoder.message('Couldn\'t compile your LESS, error info below:\\n\\n".$e->getMessage()."');"; + echo ";ICEcoder.message('Couldn\'t compile your LESS, error info below:\\n\\n".$e->getMessage()."');"; } } diff --git a/processes/on-load.php b/processes/on-load.php index 9520ad1..2cc0379 100644 --- a/processes/on-load.php +++ b/processes/on-load.php @@ -9,6 +9,6 @@ Langs: Anything - PHP, JS etc Example: //--> \ No newline at end of file From c7f20a61be7beacf98d9fd4b7c777f4868ab8ffa Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:13:27 +0000 Subject: [PATCH 006/231] top. removed from terminal --- terminal.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/terminal.php b/terminal.php index b8453fa..ba99fca 100644 --- a/terminal.php +++ b/terminal.php @@ -9,7 +9,7 @@ include("lib/settings.php"); - + - +

@@ -43,22 +44,22 @@ if(isset($_GET['selectedFiles'])) { var resultsDisplay = ""; var foundArray = []; foundInSelected = false; -userTarget = top.document.findAndReplace.target.value; -findText = top.findAndReplace.find.value; +userTarget = document.findAndReplace.target.value; +findText = findAndReplace.find.value; -var startTab = top.ICEcoder.selectedTab; +var startTab = ICEcoder.selectedTab; var rExp = new RegExp(findText,"gi"); -for (var i=1;i<=top.ICEcoder.openFiles.length;i++) { - top.ICEcoder.switchTab(i); - var cM = top.ICEcoder.getcMInstance(); +for (var i=1;i<=ICEcoder.openFiles.length;i++) { + ICEcoder.switchTab(i); + var cM = ICEcoder.getcMInstance(); var content = cM.getValue(); if (content.match(rExp)) { - resultsDisplay += ''+ top.ICEcoder.openFiles[i-1]+ '
'+content.match(rExp).length+'
'; + resultsDisplay += ''+ ICEcoder.openFiles[i-1]+ '
'+content.match(rExp).length+'
'; resultsDisplay += '
'; @@ -66,8 +67,8 @@ for (var i=1;i<=top.ICEcoder.openFiles.length;i++) { foundArray.push(i); } } -if (startTab!=top.ICEcoder.selectedTab) { - top.ICEcoder.switchTab(startTab); +if (startTab!=ICEcoder.selectedTab) { + ICEcoder.switchTab(startTab); } 0) { $targetName = $t['file folder']; ?> - var spansArray = top.ICEcoder.filesFrame.contentWindow.document.getElementsByTagName('span'); + var spansArray = ICEcoder.filesFrame.contentWindow.document.getElementsByTagName('span'); for (var i=0;i targetURL.lastIndexOf("/") && targetURL.indexOf(findText.toLowerCase())>-1 && targetURL.indexOf('_perms')>-1) { if (userTarget.indexOf("selected")>-1) { - for (var j=0;j top.ICEcoder.selectedFiles[j].replace(/\|/g,"/").split("/").length && targetURL.charAt(top.ICEcoder.selectedFiles[j].length)=="/"))) { + (targetURL.replace(/\|/g,"/").split("/").length > ICEcoder.selectedFiles[j].replace(/\|/g,"/").split("/").length && targetURL.charAt(ICEcoder.selectedFiles[j].length)=="/"))) { foundInSelected = true; } } } if (userTarget.indexOf("all")>-1 || (userTarget.indexOf("selected")>-1 && foundInSelected)) { - resultsDisplay += ''+targetURL.replace(/\|/g,"/").replace(/_perms/g,"")+'\')},20);top.ICEcoder.showHide(\'hide\',top.get(\'blackMask\'))">'; + resultsDisplay += ''+targetURL.replace(/\|/g,"/").replace(/_perms/g,"")+'\')},20);ICEcoder.showHide(\'hide\',get(\'blackMask\'))">'; resultsDisplay += targetURL.replace(/\|/g,"/").replace(/_perms/g,"").replace(//g,""+findText.toLowerCase()+""); resultsDisplay += '
'; @@ -146,7 +147,7 @@ if (startTab!=top.ICEcoder.selectedTab) { } } if (!$bFile && (count($selectedFiles)==0 || count($selectedFiles)>0 && $foundInSelFile)) { - $ret .= ""; + $ret .= ""; $ret .= str_replace($base,"",$fullPath)."
".$t['Found']." ".substr_count(strtolower(toUTF8noBOM(getData($fullPath),false)),$q)." ".$t['times']."
"; if (isset($_GET['replace'])) { $ret .= "
".$t['replace']."
"; @@ -168,8 +169,8 @@ if (startTab!=top.ICEcoder.selectedTab) { } ?> showHide = foundArray.length==0 ? "hide" : "show"; -top.ICEcoder.showHide(showHide,top.get('blackMask')); -if (foundArray.length==0) {top.ICEcoder.message('')}; +ICEcoder.showHide(showHide,get('blackMask')); +if (foundArray.length==0) {ICEcoder.message('')}; if (foundArray.length!=0) {document.getElementById('replaceAll').style.opacity = 1}; @@ -180,15 +181,15 @@ document.getElementById('title').innerHTML = findText.replace(/&/g,"&").repl document.getElementById('results').innerHTML = resultsDisplay; var gotoTab = function(tab) { - top.ICEcoder.switchTab(tab); - top.ICEcoder.showHide('hide',top.get('blackMask')); + ICEcoder.switchTab(tab); + ICEcoder.showHide('hide',get('blackMask')); } var replaceSingle = function(tab) { - top.ICEcoder.switchTab(tab); - cM = top.ICEcoder.getcMInstance(); + ICEcoder.switchTab(tab); + cM = ICEcoder.getcMInstance(); content = cM.getValue(); - cM.setValue(cM.getValue().replace(rExp,top.get('replace').value)); + cM.setValue(cM.getValue().replace(rExp,get('replace').value)); document.getElementById('foundCount'+tab).innerHTML = document.getElementById('foundCount'+tab).innerHTML.replace('',''); } @@ -196,42 +197,42 @@ var replaceAll = function() { for (var i=0;i<=foundArray.length-1;i++) { replaceSingle(foundArray[i]); } - top.ICEcoder.showHide('hide',top.get('blackMask')); + ICEcoder.showHide('hide',get('blackMask')); } var replaceInFileSingle = function(fileRef) { - top.ICEcoder.replaceInFile(fileRef,findText,''); + ICEcoder.replaceInFile(fileRef,findText,''); } var replaceInFilesAll = function() { for (var i=0;i<=foundArray.length-1;i++) { replaceInFileSingle(foundArray[i]); } - top.ICEcoder.showHide('hide',top.get('blackMask')); + ICEcoder.showHide('hide',get('blackMask')); } var renameSingle = function(arrayRef) { fileRef = spansArray[arrayRef].id.replace(/\|/g,"/").replace(/_perms/g,""); newName = spansArray[arrayRef].id.replace(/\|/g,"/").replace(/_perms/g,"").replace(find,""); - top.ICEcoder.renameFile(fileRef,newName); + ICEcoder.renameFile(fileRef,newName); } var renameAll = function() { for (var i=0;i<=foundArray.length-1;i++) { renameSingle(foundArray[i]); } - top.ICEcoder.showHide('hide',top.get('blackMask')); + ICEcoder.showHide('hide',get('blackMask')); } var goFindAfterOpen = function(fileName) { - if (top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] == fileName.replace(top.docRoot,"") && !top.ICEcoder.loadingFile) { + if (ICEcoder.openFiles[ICEcoder.selectedTab-1] == fileName.replace(docRoot,"") && !ICEcoder.loadingFile) { // Change options back to finding only in this document - top.document.findAndReplace.connector.selectedIndex = 0; - top.ICEcoder.findReplaceOptions(); - top.document.findAndReplace.target.selectedIndex = 0; + document.findAndReplace.connector.selectedIndex = 0; + ICEcoder.findReplaceOptions(); + document.findAndReplace.target.selectedIndex = 0; // Submit to select first instance - top.document.findAndReplace.submit.click(); - clearInterval(top.ICEcoder.goFindAfterOpenInt); + document.findAndReplace.submit.click(); + clearInterval(ICEcoder.goFindAfterOpenInt); } } From 86967a57f8d78a50277d656b305deef38fb676de Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:15:30 +0000 Subject: [PATCH 008/231] top. removed from backup-versions and download --- lib/backup-versions.php | 38 +++++++++++++++++++------------------- lib/download.php | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/backup-versions.php b/lib/backup-versions.php index 55264c9..134c6a0 100644 --- a/lib/backup-versions.php +++ b/lib/backup-versions.php @@ -113,18 +113,18 @@ include(dirname(__FILE__)."/language-modes-partial.js"); var editor = CodeMirror.fromTextArea(document.getElementById("code"), { mode: mode, - lineNumbers: top.ICEcoder.lineNumbers, + lineNumbers: ICEcoder.lineNumbers, gutters: ["CodeMirror-foldgutter","CodeMirror-lint-markers","CodeMirror-linenumbers"], foldGutter: {gutter: "CodeMirror-foldgutter"}, foldOptions: {minFoldSize: 1}, - lineWrapping: top.ICEcoder.lineWrapping, - indentWithTabs: top.ICEcoder.indentWithTabs, - indentUnit: top.ICEcoder.indentSize, - tabSize: top.ICEcoder.indentSize, - matchBrackets: top.ICEcoder.matchBrackets, + lineWrapping: ICEcoder.lineWrapping, + indentWithTabs: ICEcoder.indentWithTabs, + indentUnit: ICEcoder.indentSize, + tabSize: ICEcoder.indentSize, + matchBrackets: ICEcoder.matchBrackets, electricChars: false, highlightSelectionMatches: true, - showTrailingSpace: top.ICEcoder.showTrailingSpace, + showTrailingSpace: ICEcoder.showTrailingSpace, lint: false, readOnly: "nocursor", theme: "" @@ -134,31 +134,31 @@ editor.setSize("480px","500px"); var openNew = function() { var cM; - top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')) - top.ICEcoder.newTab(); - cM = top.ICEcoder.getcMInstance(); + ICEcoder.showHide('hide',document.getElementById('blackMask')) + ICEcoder.newTab(); + cM = ICEcoder.getcMInstance(); cM.setValue(editor.getValue()); } var openDiff = function() { var cMDiff; - top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')) - top.ICEcoder.setSplitPane('on'); - cMDiff = top.ICEcoder.getcMdiffInstance(); - top.ICEcoder.focus('diff'); + ICEcoder.showHide('hide',document.getElementById('blackMask')) + ICEcoder.setSplitPane('on'); + cMDiff = ICEcoder.getcMdiffInstance(); + ICEcoder.focus('diff'); cMDiff.setValue(editor.getValue()); } var restoreVersion = function() { var cM; - if (top.ICEcoder.ask("To confirm - this will paste the displayed backup content to your current tab and save, OK?")) { - top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')) - cM = top.ICEcoder.getcMInstance(); - top.ICEcoder.focus(); + if (ICEcoder.ask("To confirm - this will paste the displayed backup content to your current tab and save, OK?")) { + ICEcoder.showHide('hide',document.getElementById('blackMask')) + cM = ICEcoder.getcMInstance(); + ICEcoder.focus(); cM.setValue(editor.getValue()); - top.ICEcoder.saveFile(); + ICEcoder.saveFile(); } } diff --git a/lib/download.php b/lib/download.php index 831b60d..fe9bcb0 100644 --- a/lib/download.php +++ b/lib/download.php @@ -6,7 +6,7 @@ include("settings.php"); $file = realpath($docRoot.$iceRoot.str_replace("|","/",$_GET['file'])); // If it doesn't exist, or doesn't start with the $docRoot, stop here if (!file_exists($file) || strpos(str_replace("\\","/",$file),$docRoot) !== 0) { - die(""); + die(""); } if (file_exists($file)) { From a5898f9fc4183806f59b42cab4639df4c60b2e50 Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:16:33 +0000 Subject: [PATCH 009/231] top. and parent. revised in file-control-xhr.php --- lib/file-control-xhr.php | 188 +++++++++++++++++++-------------------- 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/lib/file-control-xhr.php b/lib/file-control-xhr.php index b49bd84..117c54d 100644 --- a/lib/file-control-xhr.php +++ b/lib/file-control-xhr.php @@ -103,7 +103,7 @@ if (isset($ftpSite)) { ftpStart(); // Show user warning if no good connection if (!$ftpConn || !$ftpLogin) { - $doNext .= 'top.ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");'; + $doNext .= 'ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");'; } } @@ -186,24 +186,24 @@ if (!$error && $_GET['action']=="save") { $fileMDTURLPart = isset($_GET["fileMDT"]) && $_GET["fileMDT"]!="undefined" ? "&fileMDT=".numClean($_GET['fileMDT']) : ""; $fileVersionURLPart = isset($_GET["fileVersion"]) && $_GET["fileVersion"]!="undefined" ? "&fileVersion=".numClean($_GET['fileVersion']) : ""; $doNext .= ' - top.ICEcoder.serverMessage(); + ICEcoder.serverMessage(); fileLoc = "'.$fileLoc.'"; overwriteOK = false; noConflictSave = false; - newFileName = top.ICEcoder.getInput("'.$t['Enter filename to...'].' "+(fileLoc!="" ? fileLoc : "/"),""); + newFileName = ICEcoder.getInput("'.$t['Enter filename to...'].' "+(fileLoc!="" ? fileLoc : "/"),""); if (newFileName) { if (newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName}; newFileName = fileLoc + newFileName; /* Check if file/dir exists */ - top.ICEcoder.lastFileDirCheckStatusObj = false; - top.ICEcoder.checkExists(newFileName); + ICEcoder.lastFileDirCheckStatusObj = false; + ICEcoder.checkExists(newFileName); var thisInt = setInterval(function() { - if (top.ICEcoder.lastFileDirCheckStatusObj != false) { + if (ICEcoder.lastFileDirCheckStatusObj != false) { clearInterval(thisInt); - if (top.ICEcoder.lastFileDirCheckStatusObj.file && top.ICEcoder.lastFileDirCheckStatusObj.file.exists) { - overwriteOK = top.ICEcoder.ask("'.$t['That file exists...'].'"); + if (ICEcoder.lastFileDirCheckStatusObj.file && ICEcoder.lastFileDirCheckStatusObj.file.exists) { + overwriteOK = ICEcoder.ask("'.$t['That file exists...'].'"); } else { noConflictSave = true; }; @@ -213,7 +213,7 @@ if (!$error && $_GET['action']=="save") { newFileName = "'.(isset($ftpSite) ? "" : $docRoot).'" + newFileName; saveURL = "lib/file-control-xhr.php?action=save'.$fileMDTURLPart.$fileVersionURLPart.'&csrf='.$_GET["csrf"].'"; - var xhr = top.ICEcoder.xhrObj(); + var xhr = ICEcoder.xhrObj(); xhr.onreadystatechange=function() { if (xhr.readyState==4 && xhr.status==200) { @@ -225,7 +225,7 @@ if (!$error && $_GET['action']=="save") { /* console.log(statusObj); */ if (statusObj.status.error) { - top.ICEcoder.message(statusObj.status.errorMsg); + ICEcoder.message(statusObj.status.errorMsg); } else { eval(statusObj.action.doNext); } @@ -237,8 +237,8 @@ if (!$error && $_GET['action']=="save") { /* console.log(\'Calling \'+saveURL+\' via XHR\'); */ xhr.open("POST",saveURL,true); xhr.setRequestHeader(\'Content-type\', \'application/x-www-form-urlencoded\'); - xhr.send(\'timeStart='.numClean($_POST["timeStart"]).'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(top.ICEcoder.saveAsContent)); - top.ICEcoder.serverMessage("'.$t['Saving'].'
" + "'.($finalAction == "Save" ? "newFileName" : "'".$fileName."'").'"); + xhr.send(\'timeStart='.numClean($_POST["timeStart"]).'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(ICEcoder.saveAsContent)); + ICEcoder.serverMessage("'.$t['Saving'].'
" + "'.($finalAction == "Save" ? "newFileName" : "'".$fileName."'").'"); } } },10); @@ -246,8 +246,8 @@ if (!$error && $_GET['action']=="save") { /* UI dialog cancelling and saving contents for save as looparound */ if (!newFileName || newFileName && !overwriteOK) { - top.ICEcoder.saveAsContent = top.document.getElementById(\'saveTemp1\').value; - top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0); + ICEcoder.saveAsContent = document.getElementById(\'saveTemp1\').value; + ICEcoder.serverMessage();ICEcoder.serverQueue("del",0); }'; // =================== @@ -311,10 +311,10 @@ if (!$error && $_GET['action']=="save") { } // Write our file contents if (!ftpWriteFile($ftpConn, $ftpFilepath, $contents, $ftpMode)) { - $doNext .= 'top.ICEcoder.message("Sorry, could not write '.$ftpFilepath.' at '.$ftpHost.'");'; + $doNext .= 'ICEcoder.message("Sorry, could not write '.$ftpFilepath.' at '.$ftpHost.'");'; } else { - $doNext .= 'top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.$filemtime.'";'; - $doNext .= '(function() {var x=top.ICEcoder.openFileVersions; var y=top.ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();top.ICEcoder.updateVersionsDisplay();'; + $doNext .= 'ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]="'.$filemtime.'";'; + $doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();ICEcoder.updateVersionsDisplay();'; } // Local saving } else { @@ -357,8 +357,8 @@ if (!$error && $_GET['action']=="save") { } clearstatcache(); $filemtime = $serverType=="Linux" ? filemtime($file) : "1000000"; - $doNext .= 'top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.$filemtime.'";'; - $doNext .= '(function() {var x=top.ICEcoder.openFileVersions; var y=top.ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();top.ICEcoder.updateVersionsDisplay();'; + $doNext .= 'ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]="'.$filemtime.'";'; + $doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();ICEcoder.updateVersionsDisplay();'; } // Save a version controlled backup source of the file @@ -447,30 +447,30 @@ if (!$error && $_GET['action']=="save") { // Reload file manager, rename tab & remove old file highlighting if it was a new file if (isset($_POST['newFileName']) && $_POST['newFileName']!="") { - $doNext .= 'top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'file\');'; - $doNext .= 'top.ICEcoder.renameTab(top.ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'file\');'; + $doNext .= 'ICEcoder.renameTab(ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');'; if (!strpos($_REQUEST['file'],"[NEW]")) { // We're saving as a new file, so unhighlight the old name in the file manager if visible - $doNext .= "fileLink = top.ICEcoder.filesFrame.contentWindow.document.getElementById('".str_replace("/","|",$fileLoc)."|".basename($_REQUEST['file'])."');"; - $doNext .= "if (fileLink) {fileLink.style.backgroundColor = top.ICEcoder.tabBGnormal; fileLink.style.color = top.ICEcoder.tabFGnormalFile};"; + $doNext .= "fileLink = ICEcoder.filesFrame.contentWindow.document.getElementById('".str_replace("/","|",$fileLoc)."|".basename($_REQUEST['file'])."');"; + $doNext .= "if (fileLink) {fileLink.style.backgroundColor = ICEcoder.tabBGnormal; fileLink.style.color = ICEcoder.tabFGnormalFile};"; } } // Reload previewWindow window if not a Markdown file // In doing this, we check on an interval for the page to be complete and if we last saw it loading - // When we are done loading, so set the loading status to false and load plugins ontop... - $doNext .= 'if (top.ICEcoder.previewWindow.location && top.ICEcoder.previewWindow.location.pathname && top.ICEcoder.previewWindow.location.pathname.indexOf(".md")==-1) { - top.ICEcoder.previewWindowLoading = false; - top.ICEcoder.previewWindow.location.reload(true); + // When we are done loading, so set the loading status to false and load plugins on.. + $doNext .= 'if (ICEcoder.previewWindow.location && ICEcoder.previewWindow.location.pathname && ICEcoder.previewWindow.location.pathname.indexOf(".md")==-1) { + ICEcoder.previewWindowLoading = false; + ICEcoder.previewWindow.location.reload(true); - top.ICEcoder.checkPreviewWindowLoadingInt = setInterval(function() { - if (top.ICEcoder.previewWindow.document.readyState != "loading" && top.ICEcoder.previewWindowLoading) { - top.ICEcoder.previewWindowLoading = false; - try {top.ICEcoder.doPesticide();} catch(err) {}; - try {top.ICEcoder.doStatsJS(\'save\');} catch(err) {}; - try {top.ICEcoder.doResponsive();} catch(err) {}; - clearInterval(top.ICEcoder.checkPreviewWindowLoadingInt); + ICEcoder.checkPreviewWindowLoadingInt = setInterval(function() { + if (ICEcoder.previewWindow.document.readyState != "loading" && ICEcoder.previewWindowLoading) { + ICEcoder.previewWindowLoading = false; + try {ICEcoder.doPesticide();} catch(err) {}; + try {ICEcoder.doStatsJS(\'save\');} catch(err) {}; + try {ICEcoder.doResponsive();} catch(err) {}; + clearInterval(ICEcoder.checkPreviewWindowLoadingInt); } else { - top.ICEcoder.previewWindowLoading = top.ICEcoder.previewWindow.document.readyState == "loading" ? true : false; + ICEcoder.previewWindowLoading = ICEcoder.previewWindow.document.readyState == "loading" ? true : false; } },4); @@ -478,20 +478,20 @@ if (!$error && $_GET['action']=="save") { // Copy over content to diff pane if we have that setting on $doNext .= ' - cM = top.ICEcoder.getcMInstance(); - cMdiff = top.ICEcoder.getcMdiffInstance(); - if (top.ICEcoder.updateDiffOnSave) { + cM = ICEcoder.getcMInstance(); + cMdiff = ICEcoder.getcMdiffInstance(); + if (ICEcoder.updateDiffOnSave) { cMdiff.setValue(cM.getValue()); }; '; // Finally, set previous files, indicate changes, set saved points and redo tabs $doNext .= ' - top.ICEcoder.setPreviousFiles(); - setTimeout(function(){top.ICEcoder.indicateChanges()},4); - top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1] = cM.changeGeneration(); - top.ICEcoder.savedContents[top.ICEcoder.selectedTab-1] = cM.getValue(); - top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);'; + ICEcoder.setPreviousFiles(); + setTimeout(function(){ICEcoder.indicateChanges()},4); + ICEcoder.savedPoints[ICEcoder.selectedTab-1] = cM.changeGeneration(); + ICEcoder.savedContents[ICEcoder.selectedTab-1] = cM.getValue(); + ICEcoder.redoTabHighlight(ICEcoder.selectedTab);'; // Run our custom processes include_once("../processes/on-file-save.php"); @@ -507,21 +507,21 @@ if (!$error && $_GET['action']=="save") { $doNext .= ' var loadedFile = document.createElement("textarea"); loadedFile.value = "'.str_replace('"','\\\"',str_replace("\r","\\\\r",str_replace("\n","\\\\n",str_replace("","",$loadedFile)))).'"; - var refreshFile = top.ICEcoder.ask("'.$t['Sorry, this file...'].'\\\n'.$file.'\\\n\\\n'.$t['Reload this file...'].'"); + var refreshFile = ICEcoder.ask("'.$t['Sorry, this file...'].'\\\n'.$file.'\\\n\\\n'.$t['Reload this file...'].'"); if (refreshFile) { - var cM = top.ICEcoder.getcMInstance(); - var thisTab = top.ICEcoder.selectedTab; + var cM = ICEcoder.getcMInstance(); + var thisTab = ICEcoder.selectedTab; var userVersionFile = cM.getValue(); /* Revert back to original */ cM.setValue(loadedFile.value); - top.ICEcoder.savedPoints[thisTab-1] = cM.changeGeneration(); - top.ICEcoder.savedContents[thisTab-1] = cM.getValue(); - top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1] = "'.$filemtime.'"; - top.ICEcoder.openFileVersions[top.ICEcoder.selectedTab-1] = "'.$fileCountInfo['count'].'"; + ICEcoder.savedPoints[thisTab-1] = cM.changeGeneration(); + ICEcoder.savedContents[thisTab-1] = cM.getValue(); + ICEcoder.openFileMDTs[ICEcoder.selectedTab-1] = "'.$filemtime.'"; + ICEcoder.openFileVersions[ICEcoder.selectedTab-1] = "'.$fileCountInfo['count'].'"; cM.clearHistory(); /* Now for the new version in the diff pane */ - top.ICEcoder.setSplitPane(\'on\'); - var cMdiff = top.ICEcoder.getcMdiffInstance(); + ICEcoder.setSplitPane(\'on\'); + var cMdiff = ICEcoder.getcMdiffInstance(); cMdiff.setValue(userVersionFile); };'; $finalAction = "nothing"; @@ -533,9 +533,9 @@ if (!$error && $_GET['action']=="save") { } else { $finalAction = "nothing"; - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot save']."\\\\n".$file."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot save']."\\\\n".$file."');"; } - $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; } }; @@ -550,7 +550,7 @@ if (!$error && $_GET['action']=="newFolder") { if (isset($ftpSite)) { $ftpFilepath = ltrim($fileLoc."/".$fileName,"/"); if (!ftpMkDir($ftpConn, octdec($ICEcoder['newDirPerms']), $ftpFilepath)) { - $doNext .= 'top.ICEcoder.message("Sorry, could not create dir '.$ftpFilepath.' at '.$ftpHost.'");'; + $doNext .= 'ICEcoder.message("Sorry, could not create dir '.$ftpFilepath.' at '.$ftpHost.'");'; } else { $updateFM = true; } @@ -562,16 +562,16 @@ if (!$error && $_GET['action']=="newFolder") { } // Update file manager on success if ($updateFM) { - $doNext .= 'top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'folder\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'folder\');'; } $finalAction = "newFolder"; // Run our custom processes include_once("../processes/on-new-dir.php"); } else { - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot create...']."\\\\n".$fileLoc."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot create...']."\\\\n".$fileLoc."');"; $finalAction = "nothing"; } - $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ================ @@ -592,7 +592,7 @@ if (!$error && $_GET['action']=="move") { // FTP if (isset($ftpSite)) { if (!ftpRename($ftpConn, $srcDir, $tgtDir)) { - $doNext .= 'top.ICEcoder.message("Sorry, could not rename '.$srcDir.' to '.$tgtDir.'");'; + $doNext .= 'ICEcoder.message("Sorry, could not rename '.$srcDir.' to '.$tgtDir.'");'; } else { $ftpFileDirInfo = ftpGetFileInfo($ftpConn, ltrim($fileLoc,"/"), $fileName); $fileOrFolder = $ftpFileDirInfo['type'] == "directory" ? "folder" : "file"; @@ -608,20 +608,20 @@ if (!$error && $_GET['action']=="move") { } // Update file manager on success if ($updateFM) { - $doNext .= 'top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'move\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",str_replace("|","/",$_GET['oldFileName'])).'\',false,\''.$fileOrFolder.'\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'move\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",str_replace("|","/",$_GET['oldFileName'])).'\',false,\''.$fileOrFolder.'\');'; } $finalAction = "move"; // Run our custom processes include_once("../processes/on-file-dir-move.php"); } else { - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot move']."\\\\n".str_replace("|","/",$_GET['oldFileName'])."\\\\n\\\\n".$t['Maybe public write...']."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot move']."\\\\n".str_replace("|","/",$_GET['oldFileName'])."\\\\n\\\\n".$t['Maybe public write...']."');"; $finalAction = "nothing"; } } else { $doNext .= ""; $finalAction = "nothing"; } - $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ================== @@ -635,7 +635,7 @@ if (!$error && $_GET['action']=="rename") { if (isset($ftpSite)) { $ftpFilepath = ltrim($fileLoc."/".$fileName,"/"); if (!ftpRename($ftpConn, ltrim($_GET['oldFileName'],"/"), $ftpFilepath)) { - $doNext .= 'top.ICEcoder.message("Sorry, could not rename '.ltrim($_GET['oldFileName'],"/").' to '.$ftpFilepath.'");'; + $doNext .= 'ICEcoder.message("Sorry, could not rename '.ltrim($_GET['oldFileName'],"/").' to '.$ftpFilepath.'");'; } else { $updateFM = true; } @@ -646,16 +646,16 @@ if (!$error && $_GET['action']=="rename") { } // Update file manager on success if ($updateFM) { - $doNext .= 'top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",$_GET['oldFileName']).'\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",$_GET['oldFileName']).'\');'; } $finalAction = "rename"; // Run our custom processes include_once("../processes/on-file-dir-rename.php"); } else { - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot rename']."\\\\n".$_GET['oldFileName']."\\\\n\\\\n".$t['Maybe public write...']."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot rename']."\\\\n".$_GET['oldFileName']."\\\\n\\\\n".$t['Maybe public write...']."');"; $finalAction = "nothing"; } - $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ================= @@ -704,15 +704,15 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="paste") { } } // Reload file manager - $doNext .= 'top.ICEcoder.updateFileManagerList(\'add\',\''.str_replace("|","/",$_GET['location']).'\',\''.basename($dest).'\',false,false,false,\''.$fileOrFolder.'\');'; + $doNext .= 'ICEcoder.updateFileManagerList(\'add\',\''.str_replace("|","/",$_GET['location']).'\',\''.basename($dest).'\',false,false,false,\''.$fileOrFolder.'\');'; $finalAction = "pasteFile"; // Run our custom processes include_once("../processes/on-file-dir-paste.php"); } else { - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot copy']." \\\\n".str_replace($docRoot,"",$source)."\\\\n ".$t['into']." \\\\n".str_replace($docRoot,"",$dest)."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot copy']." \\\\n".str_replace($docRoot,"",$source)."\\\\n ".$t['into']." \\\\n".str_replace($docRoot,"",$dest)."');"; $finalAction = "nothing"; } - $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ============== @@ -736,10 +736,10 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="upload") { $setPerms = $ICEcoder['newFilePerms']; } if ($this->upload($current,$this->uploadFile,$setPerms)) { - $doNext .= 'top.ICEcoder.updateFileManagerList(\'add\',top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,\'/\'),\''.str_replace("'","\'",$fileName).'\',false,false,true,\'file\'); top.ICEcoder.serverMessage("'.$t['Uploaded file(s) OK'].'");setTimeout(function(){top.ICEcoder.serverMessage();},2000);'; + $doNext .= 'ICEcoder.updateFileManagerList(\'add\',ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,\'/\'),\''.str_replace("'","\'",$fileName).'\',false,false,true,\'file\'); ICEcoder.serverMessage("'.$t['Uploaded file(s) OK'].'");setTimeout(function(){ICEcoder.serverMessage();},2000);'; $finalAction = "upload"; } else { - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot upload']." \\\\n".$fileName."\\\\n ".$t['into']." \\\\n'+top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,'/'));"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot upload']." \\\\n".$fileName."\\\\n ".$t['into']." \\\\n'+ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,'/'));"; $finalAction = "nothing"; } } @@ -770,11 +770,11 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="upload") { // Run our custom processes include_once("../processes/on-file-upload.php"); } else { - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot upload...']."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot upload...']."');"; $finalAction = "nothing"; } - $doNext .= "top.ICEcoder.hideFileMenu();top.document.getElementById('fileInput').value='';top.ICEcoder.showHide('hide',top.document.getElementById('loadingMask'));"; + $doNext .= "ICEcoder.hideFileMenu();document.getElementById('fileInput').value='';ICEcoder.showHide('hide',document.getElementById('loadingMask'));"; // Upload is not handled by XHR methods, but form post, so we need to manually trigger $doNext in a script tag echo ""; @@ -795,16 +795,16 @@ if (!$error && $_GET['action']=="delete") { if (!$demoMode && ftpDelete($ftpConn,$itemType,$itemPath)) { if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";}; // Reload file manager - $doNext .= 'top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; $finalAction = "delete"; // Run our custom processes include_once("../processes/on-file-dir-delete.php"); } else { - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".$fileLoc."/".$fileName."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".$fileLoc."/".$fileName."');"; $finalAction = "nothing"; } } else { - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot delete more...']."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete more...']."');"; $finalAction = "nothing"; } // Local @@ -815,7 +815,7 @@ if (!$error && $_GET['action']=="delete") { $fullPath = $docRoot.$iceRoot.$fullPath; if (rtrim($fullPath,"/") == rtrim($docRoot,"/")) { - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot delete...']."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete...']."');"; } else if (!$demoMode && is_writable($fullPath)) { if (is_dir($fullPath)) { rrmdir($fullPath); @@ -829,17 +829,17 @@ if (!$error && $_GET['action']=="delete") { $fileLoc = dirname(str_replace($docRoot,"",$fullPath)); if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";}; // Reload file manager - $doNext .= 'top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; $finalAction = "delete"; // Run our custom processes include_once("../processes/on-file-dir-delete.php"); } else { - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".str_replace($docRoot,"",$fullPath)."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".str_replace($docRoot,"",$fullPath)."');"; $finalAction = "nothing"; } } } - $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // The function to recursively remove folders & files @@ -881,10 +881,10 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="replaceText") { // Run our custom processes include_once("../processes/on-file-replace-text.php"); } else { - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot replace...']."\\\\n".$file."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot replace...']."\\\\n".$file."');"; $finalAction = "nothing"; } - $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ========================== @@ -898,17 +898,17 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="getRemoteFile") { $remoteFile = str_replace("\r\n", $ICEcoder["lineEnding"], $remoteFile); $remoteFile = str_replace("\r", $ICEcoder["lineEnding"], $remoteFile); $remoteFile = str_replace("\n", $ICEcoder["lineEnding"], $remoteFile); - $doNext .= 'top.ICEcoder.newTab();'; - $doNext .= 'top.ICEcoder.getcMInstance().setValue(\''.str_replace("\r","",str_replace("\t","\\\\t",str_replace("\n","\\\\n",str_replace("'","\\\\'",str_replace("\\","\\\\",preg_quote($remoteFile)))))).'\');'; - $doNext .= 'top.ICEcoder.goToLine('.$lineNumber.');'; + $doNext .= 'ICEcoder.newTab();'; + $doNext .= 'ICEcoder.getcMInstance().setValue(\''.str_replace("\r","",str_replace("\t","\\\\t",str_replace("\n","\\\\n",str_replace("'","\\\\'",str_replace("\\","\\\\",preg_quote($remoteFile)))))).'\');'; + $doNext .= 'ICEcoder.goToLine('.$lineNumber.');'; $finalAction = "getRemoteFile"; // Run our custom processes include_once("../processes/on-get-remote-file.php"); } else { $finalAction = "nothing"; - $doNext .= 'top.ICEcoder.message(\''.$t['Sorry, could not...'].' '.$file.'\');'; + $doNext .= 'ICEcoder.message(\''.$t['Sorry, could not...'].' '.$file.'\');'; } - $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ======================= @@ -922,7 +922,7 @@ if (!$error && $_GET['action']=="perms") { if (isset($ftpSite)) { $ftpFilepath = ltrim($fileLoc."/".$fileName,"/"); if (!ftpPerms($ftpConn, octdec(numClean($_GET['perms'])), $ftpFilepath)) { - $doNext .= 'top.ICEcoder.message("Sorry, could not set perms on '.$ftpFilepath.' at '.$ftpHost.'");'; + $doNext .= 'ICEcoder.message("Sorry, could not set perms on '.$ftpFilepath.' at '.$ftpHost.'");'; } else { $updateFM = true; } @@ -934,16 +934,16 @@ if (!$error && $_GET['action']=="perms") { } // Update file manager on success if ($updateFM) { - $doNext .= 'top.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');'; + $doNext .= 'ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');'; } $finalAction = "perms"; // Run our custom processes include_once("../processes/on-file-dir-perms.php"); } else { $finalAction = "nothing"; - $doNext .= "top.ICEcoder.message('".$t['Sorry, cannot change...']." \\n".$file."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot change...']." \\n".$file."');"; } - $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ==================== @@ -951,10 +951,10 @@ if (!$error && $_GET['action']=="perms") { // ==================== if (!isset($ftpSite) && !$error && $_GET['action']=="checkExists") { - // This action is called under seperate AJAX call and the responseText object stored in top.ICEcoder.lastFileDirCheckStatusObj + // This action is called under seperate AJAX call and the responseText object stored in ICEcoder.lastFileDirCheckStatusObj // Nothing really done here though, we do something with the responseText $finalAction = "checkExists"; - $doNext .= 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // =================== @@ -1012,7 +1012,7 @@ echo '{ "timeEnd": 0, "timeTaken": 0, "csrf": "'.xssClean($_GET['csrf'],"html").'", - "doNext" : "'.preg_replace('/\r|\n/','',str_replace(' ','',str_replace('"','\"',$doNext))).'top.ICEcoder.switchMode();" + "doNext" : "'.preg_replace('/\r|\n/','',str_replace(' ','',str_replace('"','\"',$doNext))).'ICEcoder.switchMode();" }, "status": { "error" : '.($error ? 'true' : 'false').', From 33065f4b07137981a0a81442b58b5a6eafe79f43 Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:16:53 +0000 Subject: [PATCH 010/231] top. and parent. revised in file-control.php --- lib/file-control.php | 85 ++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/lib/file-control.php b/lib/file-control.php index be8bdfe..b25fbc6 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -4,6 +4,7 @@ include("settings.php"); include("ftp-control.php"); $t = $text['file-control']; ?> + @@ -59,7 +60,7 @@ for ($i=0; $i"); + die("ICEcoder.message('Sorry! - problem with file requested');"); }; } @@ -74,7 +75,7 @@ if ($_GET['action']=="load") { } if (!$canOpen) { - echo 'fileType="nothing"; top.ICEcoder.message(\''.$t['Sorry, could not...'].' '.$fileLoc."/".$fileName.'\');'; + echo 'fileType="nothing"; ICEcoder.message(\''.$t['Sorry, could not...'].' '.$fileLoc."/".$fileName.'\');'; } elseif (isset($ftpSite) || file_exists($file)) { $finfo = "text"; // Determine what to do based on mime type @@ -90,14 +91,14 @@ if ($_GET['action']=="load") { } if (strpos($finfo,"text")===0 || strpos($finfo, "application/xml")===0 || strpos($finfo,"empty")!==false) { echo 'fileType="text";'; - echo 'top.ICEcoder.shortURL = top.ICEcoder.thisFileFolderLink = "'.$fileLoc."/".$fileName.'";'; + echo 'ICEcoder.shortURL = ICEcoder.thisFileFolderLink = "'.$fileLoc."/".$fileName.'";'; // Get file over FTP? if (isset($ftpSite)) { ftpStart(); // Show user warning if no good connection if (!$ftpConn || !$ftpLogin) { - die('top.ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'); + die('ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'); exit; } // Get our file contents and close the FTP connection @@ -125,7 +126,7 @@ if ($_GET['action']=="load") { echo 'fileType="other";window.open(\'http://'.$_SERVER['SERVER_NAME'].$fileLoc."/".$fileName.'\');'; }; } else { - echo 'fileType="nothing"; top.ICEcoder.message(\''.$t['Sorry'].', '.$fileLoc."/".$fileName.' '.$t['does not seem...'].'\');'; + echo 'fileType="nothing"; ICEcoder.message(\''.$t['Sorry'].', '.$fileLoc."/".$fileName.' '.$t['does not seem...'].'\');'; } }; @@ -135,26 +136,26 @@ if ($_GET['action']=="load") { if (action=="load") { if (fileType=="text") { setTimeout(function() { - if (!top.ICEcoder.content.contentWindow.createNewCMInstance) { + if (!ICEcoder.content.contentWindow.createNewCMInstance) { console.log(''); window.location.reload(true); } else { - top.ICEcoder.loadingFile = true; + ICEcoder.loadingFile = true; // Reset the various states back to their initial setting - selectedTab = top.ICEcoder.openFiles.length; // The tab that's currently selected + selectedTab = ICEcoder.openFiles.length; // The tab that's currently selected // Finally, store all data, show tabs etc - top.ICEcoder.createNewTab(); - top.ICEcoder.cMInstances.push(top.ICEcoder.nextcMInstance); - top.ICEcoder.setLayout(); - top.ICEcoder.content.contentWindow.createNewCMInstance(top.ICEcoder.nextcMInstance); + ICEcoder.createNewTab(); + ICEcoder.cMInstances.push(ICEcoder.nextcMInstance); + ICEcoder.setLayout(); + ICEcoder.content.contentWindow.createNewCMInstance(ICEcoder.nextcMInstance); // If we're in GitHub diff mode and have a split pane display, get the content for the diff pane - if (top.ICEcoder.githubDiff && top.ICEcoder.splitPane) { + if (ICEcoder.githubDiff && ICEcoder.splitPane) { - top.ICEcoder.filesFrame.contentWindow.frames['processControl'].location.href = "github.php?action=read&repo=&filePath=&csrf="+top.ICEcoder.csrf; + ICEcoder.filesFrame.contentWindow.frames['processControl'].location.href = "github.php?action=read&repo=&filePath=&csrf="+ICEcoder.csrf; } // Set the value & innerHTML of the code textarea to that of our loaded file plus make it visible (it's hidden on ICEcoder's load) - top.ICEcoder.switchMode(); - cM = top.ICEcoder.getcMInstance(); + ICEcoder.switchMode(); + cM = ICEcoder.getcMInstance(); cM.setValue(document.getElementById('loadedFile').value); - top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1] = cM.changeGeneration(); - top.ICEcoder.savedContents[top.ICEcoder.selectedTab-1] = cM.getValue(); - top.document.getElementById('content').style.visibility='visible'; - top.ICEcoder.switchTab(top.ICEcoder.selectedTab,'noFocus'); - setTimeout(function(){top.ICEcoder.filesFrame.contentWindow.focus();},0); + ICEcoder.savedPoints[ICEcoder.selectedTab-1] = cM.changeGeneration(); + ICEcoder.savedContents[ICEcoder.selectedTab-1] = cM.getValue(); + parent.parent.document.getElementById('content').style.visibility='visible'; + ICEcoder.switchTab(ICEcoder.selectedTab,'noFocus'); + setTimeout(function(){ICEcoder.filesFrame.contentWindow.focus();},0); // Then clean it up, set the text cursor, update the display and get the character data - top.ICEcoder.contentCleanUp(); - top.ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].removeLineClass(top.ICEcoder['cMActiveLinecM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]], "background"); - top.ICEcoder['cMActiveLinecM'+top.ICEcoder.selectedTab] = top.ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].addLineClass(0, "background", "cm-s-activeLine"); - top.ICEcoder.nextcMInstance++; - top.ICEcoder.openFileMDTs.push(''); - top.ICEcoder.openFileVersions.push('); + ICEcoder.openFileVersions.push(); - top.ICEcoder.updateVersionsDisplay(); + ICEcoder.updateVersionsDisplay(); - top.ICEcoder.goToLine(); - top.ICEcoder.loadingFile = false; + ICEcoder.goToLine(); + ICEcoder.loadingFile = false; @@ -215,26 +216,26 @@ if (action=="load") { } if (fileType=="image") { - top.document.getElementById('blackMask').style.visibility = "visible"; - top.document.getElementById('mediaContainer').innerHTML = - "" + - " 700 || this.naturalHeight > 500) ? ', ' + this.width + ' x ' + this.height : ''; document.getElementById('imgInfo').innerHTML += ' (' + this.naturalWidth + ' x ' + this.naturalHeight + reducedImgMsg + ')'; top.ICEcoder.initCanvasImage(this); top.ICEcoder.interactCanvasImage(this)\">
" + - "
" + + parent.parent.document.getElementById('blackMask').style.visibility = "visible"; + parent.parent.document.getElementById('mediaContainer').innerHTML = + "" + + " 700 || this.naturalHeight > 500) ? ', ' + this.width + ' x ' + this.height : ''; document.getElementById('imgInfo').innerHTML += ' (' + this.naturalWidth + ' x ' + this.naturalHeight + reducedImgMsg + ')'; ICEcoder.initCanvasImage(this); ICEcoder.interactCanvasImage(this)\">
" + + "
" + "" + "

" + "
"+ - "" + - "" + - "" + - ""+ + "" + + "" + + "" + + ""+ "
"+ "
CORS not enabled on resource site
"; - top.document.getElementById('floatingContainer').style.background = "#fff url('') no-repeat 0 0"; + parent.parent.document.getElementById('floatingContainer').style.background = "#fff url('') no-repeat 0 0"; } - top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0); + ICEcoder.serverMessage();ICEcoder.serverQueue("del",0); } // Finally, switch mode in case we have saved, renamed file etc -top.ICEcoder.switchMode(); +ICEcoder.switchMode(); From 697f48497879ff61743e5aa21b6e09746f533f20 Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:17:52 +0000 Subject: [PATCH 011/231] top. and parent. revised in github and manager --- lib/github-manager.php | 10 +++---- lib/github.php | 68 ++++++++++++++++++++++-------------------- 2 files changed, 41 insertions(+), 37 deletions(-) diff --git a/lib/github-manager.php b/lib/github-manager.php index d553300..4815b82 100644 --- a/lib/github-manager.php +++ b/lib/github-manager.php @@ -27,7 +27,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset if (is_writable($docRoot)) { mkdir($docRoot.$chosenLocal, octdec($ICEcoder['newDirPerms'])); } else { - echo ""; + echo ""; } } @@ -57,9 +57,9 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset $_SESSION['ftpSiteRef'] = false; // Hide this popup and reload file manager - echo ""; + echo ""; } else { - echo ""; + echo ""; } } @@ -157,10 +157,10 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset fclose($fh); // Finally, reload the iFrame screen for the user header("Location: github-manager.php?updatedGithubPaths&csrf=".$_SESSION["csrf"]); - echo ""; + echo ""; die($t['saving github paths']); } else { - echo ""; + echo ""; } } } diff --git a/lib/github.php b/lib/github.php index cf82347..3c2bd57 100644 --- a/lib/github.php +++ b/lib/github.php @@ -8,7 +8,7 @@ $wrappers = stream_get_wrappers(); $sslAvail = true; if (!extension_loaded('openssl') || !in_array('https', $wrappers)) { $sslAvail = false; - echo ""; + echo ""; die(); } @@ -26,13 +26,14 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset @@ -43,7 +44,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset // READ // ==== if ($_GET['action']=="read") { - + echo ' @@ -51,6 +52,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset "; + echo ""; } else { - echo ""; + echo ""; } } @@ -164,7 +166,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset Message:
-
Commit
+
Commit


@@ -188,25 +190,26 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset $loadedFile = getData($file); echo '

'.PHP_EOL.PHP_EOL; } else { - die(""); + die(""); } } ?> Date: Fri, 28 Feb 2020 17:19:03 +0000 Subject: [PATCH 012/231] top. removed in ftp and localhost --- lib/ftp-manager.php | 8 ++++---- lib/go-localhost-root.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ftp-manager.php b/lib/ftp-manager.php index 13a2a45..c9c9be0 100644 --- a/lib/ftp-manager.php +++ b/lib/ftp-manager.php @@ -18,7 +18,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset // Set the site ref in session, hide the popup and reload the file manager $_SESSION['ftpSiteRef'] = numClean($_GET['ftpSiteRef']); // Hide this popup and reload file manager - echo ""; + echo ""; } else { // Start creating a new chunk for the FTP sites $settingsNew = '"ftpSites" => array( @@ -109,10 +109,10 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset fclose($fh); // Finally, reload the iFrame screen for the user header("Location: ftp-manager.php?updatedFTPSites&csrf=".$_SESSION["csrf"]); - echo ""; + echo ""; die($t['Saving FTP sites']); } else { - echo ""; + echo ""; } } } @@ -147,7 +147,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset echo ''.$ftpSites[$i]['site'].''; echo ''.$ftpSites[$i]['host'].''; echo 'Edit'; - echo 'Delete'; + echo 'Delete'; echo '
'.$t['Choose'].'
'; echo ''; } diff --git a/lib/go-localhost-root.php b/lib/go-localhost-root.php index 70ea595..242976a 100644 --- a/lib/go-localhost-root.php +++ b/lib/go-localhost-root.php @@ -27,9 +27,9 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn']) { $_SESSION['ftpSiteRef'] = false; // Now we've reset the root path to localhost root, refresh the file manager to show it - echo ""; + echo ""; } else { - echo ""; + echo ""; } ?> Date: Fri, 28 Feb 2020 17:19:51 +0000 Subject: [PATCH 013/231] top. removed from ice-coder.js --- lib/ice-coder.js | 2333 +++++++++++++++++++++++----------------------- 1 file changed, 1168 insertions(+), 1165 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 2761d8a..995a62b 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1,8 +1,11 @@ // Get any elem by ID var get = function(elem) { - return top.document.getElementById(elem); + return document.getElementById(elem); }; +var iceLoc = window.location.pathname; +// var iceDir = iceLoc.substring(0, iceLoc.lastIndexOf('/')); + // Main ICEcoder object var ICEcoder = { @@ -77,7 +80,7 @@ var ICEcoder = { // Create our ID aliases for (var i=0;i
" + "\n"; - top.get("git").innerHTML = gitDiffList + "

"; + get("git").innerHTML = gitDiffList + "

"; } }, // Update preview window content updatePreviewWindow: function(thisCM,filepath,filename,fileExt) { - if (top.ICEcoder.previewWindow.location.pathname==filepath) { + if (ICEcoder.previewWindow.location.pathname==filepath) { if (["htm","html","txt"].indexOf(fileExt) > -1) { - top.ICEcoder.previewWindow.document.documentElement.innerHTML = thisCM.getValue(); + ICEcoder.previewWindow.document.documentElement.innerHTML = thisCM.getValue(); } else if (["md"].indexOf(fileExt) > -1) { - top.ICEcoder.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()); + ICEcoder.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()); } } else if (["css"].indexOf(fileExt) > -1) { - if (top.ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(filename) > -1) { + if (ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(filename) > -1) { var css = thisCM.getValue(); var style = document.createElement('style'); style.type = 'text/css'; @@ -1085,18 +1088,18 @@ var ICEcoder = { } else { style.appendChild(document.createTextNode(css)); } - if (top.ICEcoder.previewWindow.document.getElementById(style.id)) { - top.ICEcoder.previewWindow.document.documentElement.removeChild(top.ICEcoder.previewWindow.document.getElementById(style.id)); + if (ICEcoder.previewWindow.document.getElementById(style.id)) { + ICEcoder.previewWindow.document.documentElement.removeChild(ICEcoder.previewWindow.document.getElementById(style.id)); } - top.ICEcoder.previewWindow.document.documentElement.appendChild(style); + ICEcoder.previewWindow.document.documentElement.appendChild(style); } } // Do the pesticide plugin if it exists - try {top.ICEcoder.doPesticide();} catch(err) {}; + try {ICEcoder.doPesticide();} catch(err) {}; // Do the stats.js plugin if it exists - try {top.ICEcoder.doStatsJS('update');} catch(err) {}; + try {ICEcoder.doStatsJS('update');} catch(err) {}; // Do the responsive plugin if it exists - try {top.ICEcoder.doResponsive();} catch(err) {}; + try {ICEcoder.doResponsive();} catch(err) {}; }, // Clean up our loaded code @@ -1106,15 +1109,15 @@ var ICEcoder = { // Replace any temp /textarea value cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; content = thisCM.getValue(); content = content.replace(//g,'<\/textarea>'); // Then set the content in the editor & clear the history thisCM.setValue(content); thisCM.clearHistory(); - top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1] = thisCM.changeGeneration(); - top.ICEcoder.savedContents[top.ICEcoder.selectedTab-1] = thisCM.getValue(); + ICEcoder.savedPoints[ICEcoder.selectedTab-1] = thisCM.changeGeneration(); + ICEcoder.savedContents[ICEcoder.selectedTab-1] = thisCM.getValue(); }, // Undo last change @@ -1123,7 +1126,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; thisCM.undo(); }, @@ -1133,7 +1136,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; thisCM.redo(); }, @@ -1143,11 +1146,11 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (moreLess=="more") { - top.ICEcoder.content.contentWindow.CodeMirror.commands.indentMore(thisCM); + ICEcoder.content.contentWindow.CodeMirror.commands.indentMore(thisCM); } else { - top.ICEcoder.content.contentWindow.CodeMirror.commands.indentLess(thisCM); + ICEcoder.content.contentWindow.CodeMirror.commands.indentLess(thisCM); } }, @@ -1155,9 +1158,9 @@ var ICEcoder = { moveLines: function(dir) { var cM, cMdiff, thisCM, lineStart, lineEnd, swapLineNo, swapLine; - cM = top.ICEcoder.getcMInstance(); - cMdiff = top.ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = ICEcoder.getcMInstance(); + cMdiff = ICEcoder.getcMdiffInstance(); + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; // Get start & end lines plus the line we'll swap with lineStart = thisCM.getCursor('start'); @@ -1196,9 +1199,9 @@ var ICEcoder = { highlightLine: function(line) { var cM, cMdiff, thisCM; - cM = top.ICEcoder.getcMInstance(); - cMdiff = top.ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = ICEcoder.getcMInstance(); + cMdiff = ICEcoder.getcMdiffInstance(); + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; thisCM.setSelection({line:line,ch:0}, {line:line,ch:thisCM.lineInfo(line).text.length}); }, @@ -1207,8 +1210,8 @@ var ICEcoder = { var cM, cMdiff, thisCM; if (!(/iPhone|iPad|iPod/i.test(navigator.userAgent))) { - cM = top.ICEcoder.getcMInstance(); - cMdiff = top.ICEcoder.getcMdiffInstance(); + cM = ICEcoder.getcMInstance(); + cMdiff = ICEcoder.getcMdiffInstance(); thisCM = diff ? cMdiff : cM; if (thisCM) { thisCM.focus(); @@ -1220,34 +1223,34 @@ var ICEcoder = { goToLine: function(lineNo, charNo, noFocus) { var cM, cMdiff, thisCM; - lineNo = lineNo ? lineNo-1 : top.get('goToLineNo').value-1; + lineNo = lineNo ? lineNo-1 : get('goToLineNo').value-1; charNo = charNo ? charNo : 0; cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - top.ICEcoder.scrollingOnLine = thisCM.getCursor().line; + ICEcoder.scrollingOnLine = thisCM.getCursor().line; // Scroll cursor into middle of view - if ("undefined" != typeof top.ICEcoder.scrollInt) { - clearInterval(top.ICEcoder.scrollInt); + if ("undefined" != typeof ICEcoder.scrollInt) { + clearInterval(ICEcoder.scrollInt); } - top.ICEcoder.scrollInt = setInterval(function() { - top.ICEcoder.scrollingOnLine = top.ICEcoder.scrollingOnLine+((lineNo-top.ICEcoder.scrollingOnLine)/5); - thisCM.scrollTo(0,(thisCM.defaultTextHeight()*top.ICEcoder.scrollingOnLine)-(thisCM.getScrollInfo().clientHeight/10)); - top.ICEcoder.setMinimapLayout(thisCM); - if (Math.round(top.ICEcoder.scrollingOnLine) == lineNo) { - clearInterval(top.ICEcoder.scrollInt); + ICEcoder.scrollInt = setInterval(function() { + ICEcoder.scrollingOnLine = ICEcoder.scrollingOnLine+((lineNo-ICEcoder.scrollingOnLine)/5); + thisCM.scrollTo(0,(thisCM.defaultTextHeight()*ICEcoder.scrollingOnLine)-(thisCM.getScrollInfo().clientHeight/10)); + ICEcoder.setMinimapLayout(thisCM); + if (Math.round(ICEcoder.scrollingOnLine) == lineNo) { + clearInterval(ICEcoder.scrollInt); } },10); thisCM.setCursor(lineNo, charNo); if (!noFocus) { - top.ICEcoder.focus(); + ICEcoder.focus(); // Also do this after a 0ms tickover incase DOM wasn't ready - setTimeout(function(){top.ICEcoder.focus();},0); + setTimeout(function(){ICEcoder.focus();},0); } return false; }, @@ -1258,7 +1261,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; cursorPos = thisCM.getCursor().ch; linePos = thisCM.getCursor().line; @@ -1274,7 +1277,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; tagStart = tag; tagEnd = tag; if (tag=='div') { @@ -1309,7 +1312,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (!line) {line = thisCM.getCursor().line}; thisCM.replaceRange(thisCM.getLine(line)+"
",{line:line,ch:0},{line:line,ch:1000000}); }, @@ -1320,7 +1323,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (!line) {line = thisCM.getCursor().line}; thisCM.operation(function() { thisCM.replaceRange("\n"+thisCM.getLine(line),{line:line,ch:0},{line:line,ch:1000000}); @@ -1335,7 +1338,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (!line) {line = thisCM.getCursor().line}; thisCM.operation(function() { thisCM.replaceRange(thisCM.getLine(line)+"\n",{line:line,ch:0},{line:line,ch:1000000}); @@ -1349,7 +1352,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (!line && thisCM.somethingSelected()) { userSelStart = thisCM.getCursor('start'); userSelEnd = thisCM.getCursor('end'); @@ -1370,7 +1373,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (!line && thisCM.somethingSelected()) { thisCM.replaceSelection("","end"); } else { @@ -1387,13 +1390,13 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; tokenString = thisCM.getTokenAt(thisCM.getCursor()).string; - if (thisCM.somethingSelected() && top.ICEcoder.origCurorPos) { - thisCM.setCursor(top.ICEcoder.origCurorPos); + if (thisCM.somethingSelected() && ICEcoder.origCurorPos) { + thisCM.setCursor(ICEcoder.origCurorPos); } else { - top.ICEcoder.origCurorPos = thisCM.getCursor(); + ICEcoder.origCurorPos = thisCM.getCursor(); defVars = [ "var "+tokenString, "function "+tokenString, @@ -1405,7 +1408,7 @@ var ICEcoder = { "def "+tokenString, "class "+tokenString]; for (var i=0; i'+top.ICEcoder.functionClassList[i]['name']+'
'+top.ICEcoder.functionClassList[i]['params']+'
'; + for (var i=0; i'+ICEcoder.functionClassList[i]['name']+'
'+ICEcoder.functionClassList[i]['params']+'
'; } } // Update our list @@ -1456,7 +1459,7 @@ var ICEcoder = { // Push items into array if (functionClassText[0] != "") { - top.ICEcoder.functionClassList.push({ + ICEcoder.functionClassList.push({ line: cM.getLineNumber(handle), name: functionClassText[0], params: "("+(functionClassText[1] ? functionClassText[1].replace(/[,]/g,", ") : ""), @@ -1467,9 +1470,9 @@ var ICEcoder = { // If we're defining a function/class if (!handle.styles || (handle.styles && handle.styles.indexOf('def') > -1 && cM.getLineNumber(handle))) { // Find our item in the array and mark it as verified - for (var i=0; i< top.ICEcoder.functionClassList.length; i++) { - if (top.ICEcoder.functionClassList[i]['line'] == cM.getLineNumber(handle)) { - top.ICEcoder.functionClassList[i]['verified'] = true; + for (var i=0; i< ICEcoder.functionClassList.length; i++) { + if (ICEcoder.functionClassList[i]['line'] == cM.getLineNumber(handle)) { + ICEcoder.functionClassList[i]['verified'] = true; } }; } @@ -1485,15 +1488,15 @@ var ICEcoder = { if(cM) { // Get syntax formatted content and output to miniMapContent - top.ICEcoder.content.contentWindow.CodeMirror.runMode(cM.getValue(),cM.getOption('mode'),get('miniMapContent')); + ICEcoder.content.contentWindow.CodeMirror.runMode(cM.getValue(),cM.getOption('mode'),get('miniMapContent')); // white-space: pre vs pre-wrap depending on line wrapping - get('miniMapContent').innerHTML = '
'+get('miniMapContent').innerHTML+'
'; + get('miniMapContent').innerHTML = '
'+get('miniMapContent').innerHTML+'
'; get('miniMapContent').innerHTML = get('miniMapContent').innerHTML.replace(/\'; + ICEcoder.miniMapBoxHeight+'px; background: rgba(0,198,255,0.1); z-index: 1; cursor: pointer" id="miniMapBox">'; var elem = get('miniMapBox'); var draggie = new Draggabilly( elem, { @@ -1506,18 +1509,18 @@ var ICEcoder = { maxHeight = parseInt(get('docExplorer').style.height,10) <= parseInt(get('miniMapContent').getBoundingClientRect().height,10) ? parseInt(get('docExplorer').style.height,10) : parseInt(get('miniMapContent').getBoundingClientRect().height,10); - newPerc = (this.position.y/(maxHeight-top.ICEcoder.miniMapBoxHeight)); + newPerc = (this.position.y/(maxHeight-ICEcoder.miniMapBoxHeight)); yPos = (cM.getScrollInfo().height-cM.getScrollInfo().clientHeight)*newPerc; cM.scrollTo(0,yPos); // this.position.y }); draggie.on( 'pointerDown', function( event, pointer ) { - top.ICEcoder.mouseDownMinimap = true; + ICEcoder.mouseDownMinimap = true; }); draggie.on( 'pointerUp', function( event, pointer ) { - top.ICEcoder.mouseDownMinimap = false; + ICEcoder.mouseDownMinimap = false; }); - top.ICEcoder.setMinimapLayout(cM); + ICEcoder.setMinimapLayout(cM); get('docExplorer').style.right = "-220px"; } @@ -1530,7 +1533,7 @@ var ICEcoder = { if (get('miniMapBox') && thisCM) { // Get CM instance and percentage through document - cM = top.ICEcoder.getcMInstance(); + cM = ICEcoder.getcMInstance(); percThru = thisCM.getScrollInfo().top/(thisCM.getScrollInfo().height-thisCM.getScrollInfo().clientHeight); // If content to display has a greater height than docExplorer @@ -1538,10 +1541,10 @@ var ICEcoder = { // Set the minimap container to same height get('miniMapContainer').style.height = parseInt(get('docExplorer').style.height,10)+"px"; // Set box height relative to font height - top.ICEcoder.miniMapBoxHeight = (parseInt(get('docExplorer').style.height,10)/cM.defaultTextHeight()*2); - get('miniMapBox').style.height = top.ICEcoder.miniMapBoxHeight + "px"; + ICEcoder.miniMapBoxHeight = (parseInt(get('docExplorer').style.height,10)/cM.defaultTextHeight()*2); + get('miniMapBox').style.height = ICEcoder.miniMapBoxHeight + "px"; // Set top position of it according to percentage through document and account for height of nav box - top.ICEcoder.miniMapBoxTop = (percThru*parseInt(get('docExplorer').style.height,10)) - (percThru*top.ICEcoder.miniMapBoxHeight); + ICEcoder.miniMapBoxTop = (percThru*parseInt(get('docExplorer').style.height,10)) - (percThru*ICEcoder.miniMapBoxHeight); // Set the minimap position according to scroll position (used if we move cursor in document) get('miniMapContent').style.marginTop = (-(parseInt(get('miniMapContent').getBoundingClientRect().height,10) - parseInt(get('docExplorer').style.height,10))*percThru) + "px"; // If less than the docExplorer height @@ -1549,16 +1552,16 @@ var ICEcoder = { // Set height of container to that of the content get('miniMapContainer').style.height = parseInt(get('miniMapContent').getBoundingClientRect().height,10)+"px"; // Set box height relative to font height - top.ICEcoder.miniMapBoxHeight = (parseInt(get('docExplorer').style.height,10)/cM.defaultTextHeight()*2); - get('miniMapBox').style.height = top.ICEcoder.miniMapBoxHeight + "px"; + ICEcoder.miniMapBoxHeight = (parseInt(get('docExplorer').style.height,10)/cM.defaultTextHeight()*2); + get('miniMapBox').style.height = ICEcoder.miniMapBoxHeight + "px"; // Set top position of it according to percentage through minimap and account for height of nav box - top.ICEcoder.miniMapBoxTop = (percThru*parseInt(get('miniMapContainer').getBoundingClientRect().height,10)) - (percThru*top.ICEcoder.miniMapBoxHeight); + ICEcoder.miniMapBoxTop = (percThru*parseInt(get('miniMapContainer').getBoundingClientRect().height,10)) - (percThru*ICEcoder.miniMapBoxHeight); // Set the minimap position to 0 get('miniMapContent').style.marginTop = 0; } // Can set the Minimap nav position if not dragging it (let Draggabilly handle that) - if (!top.ICEcoder.mouseDownMinimap) { - get('miniMapBox').style.top = top.ICEcoder.miniMapBoxTop + "px"; + if (!ICEcoder.mouseDownMinimap) { + get('miniMapBox').style.top = ICEcoder.miniMapBoxTop + "px"; } } }, @@ -1569,18 +1572,18 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - top.ICEcoder.content.contentWindow.CodeMirror.commands.autocomplete(thisCM); + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + ICEcoder.content.contentWindow.CodeMirror.commands.autocomplete(thisCM); }, // Paste a URL, locally or absolutely if CTRL/Cmd key down pasteURL: function(url) { var cM, cMdiff, thisCM; - cM = top.ICEcoder.getcMInstance(); - cMdiff = top.ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if(top.ICEcoder.draggingWithKey == "CTRL") { + cM = ICEcoder.getcMInstance(); + cMdiff = ICEcoder.getcMdiffInstance(); + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if(ICEcoder.draggingWithKey == "CTRL") { url = window.location.protocol + "//" + window.location.hostname + url; } thisCM.replaceSelection(url,"around"); @@ -1590,18 +1593,18 @@ var ICEcoder = { searchForSelected: function() { var cM, cMdiff, thisCM; - cM = top.ICEcoder.getcMInstance(); - cMdiff = top.ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (top.ICEcoder.caretLocType) { + cM = ICEcoder.getcMInstance(); + cMdiff = ICEcoder.getcMdiffInstance(); + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if (ICEcoder.caretLocType) { if (thisCM.getSelection() != "") { - var searchPrefix = top.ICEcoder.caretLocType.toLowerCase()+" "; - if (top.ICEcoder.caretLocType=="Content") { + var searchPrefix = ICEcoder.caretLocType.toLowerCase()+" "; + if (ICEcoder.caretLocType=="Content") { searchPrefix = ""; } window.open("http://www.google.com/#output=search&q="+searchPrefix+thisCM.getSelection()); } else { - top.ICEcoder.message(top.t['No text selected...']); + ICEcoder.message(t['No text selected...']); } } }, @@ -1615,7 +1618,7 @@ var ICEcoder = { var selElem, sPN, fileFolder, goElem, // Get selected elem, the parent node of that, if it's a file/folder and set elem to go to next - selElem = top.get('filesFrame').contentWindow.document.getElementById(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1]+"_perms").parentNode; + selElem = get('filesFrame').contentWindow.document.getElementById(ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1]+"_perms").parentNode; sPN = selElem.parentNode; fileFolder = selElem.onmouseover.toString().indexOf("'folder'") > -1 ? "folder" : "file"; goElem = false; @@ -1643,17 +1646,17 @@ var ICEcoder = { } if (action == "left") { if (fileFolder == "folder" && sPN.parentNode.previousSibling) { - top.ICEcoder.openCloseDir(selElem,false); // contract dir + ICEcoder.openCloseDir(selElem,false); // contract dir } } if (action == "right" || action == "enter") { fileFolder == "folder" - ? top.ICEcoder.openCloseDir(selElem,true) // expand dir - : top.ICEcoder.openFile(selElem.childNodes[1].id.replace(/\|/g,"/")); // open file + ? ICEcoder.openCloseDir(selElem,true) // expand dir + : ICEcoder.openFile(selElem.childNodes[1].id.replace(/\|/g,"/")); // open file } if (goElem && goElem.childNodes[1]) { - top.ICEcoder.overFileFolder(fileFolder, goElem.childNodes[1].id); // If we have an elem to go to, select it - top.ICEcoder.selectFileFolder(evt); + ICEcoder.overFileFolder(fileFolder, goElem.childNodes[1].id); // If we have an elem to go to, select it + ICEcoder.selectFileFolder(evt); } }, @@ -1662,8 +1665,8 @@ var ICEcoder = { var node, d; dir.onclick = function(event) { - if(!event.ctrlKey && !top.ICEcoder.cmdKey) { - top.ICEcoder.openCloseDir(this,!load); + if(!event.ctrlKey && !ICEcoder.cmdKey) { + ICEcoder.openCloseDir(this,!load); } }; node = dir.parentNode; @@ -1674,7 +1677,7 @@ var ICEcoder = { dir.parentNode.className = dir.className = d ? "pft-directory dirOpen" : "pft-directory"; } if (load) { - top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = "lib/get-branch.php?location="+dir.childNodes[1].id+"&csrf="+top.ICEcoder.csrf; + ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/get-branch.php?location="+dir.childNodes[1].id+"&csrf="+ICEcoder.csrf; } else if(node.tagName == "UL") { node.parentNode.removeChild(node); } @@ -1691,7 +1694,7 @@ var ICEcoder = { isFileFolder: function(ref) { var domElem; - domElem = top.get('filesFrame').contentWindow.document.getElementById(ref.replace(top.iceRoot,"").replace(/\/$/, "").replace(/\//g,"|")); + domElem = get('filesFrame').contentWindow.document.getElementById(ref.replace(iceRoot,"").replace(/\/$/, "").replace(/\//g,"|")); if (domElem) { return domElem.parentNode.parentNode.className.indexOf("directory") > -1 ? "folder" @@ -1706,30 +1709,30 @@ var ICEcoder = { var tgtFile, shortURL, selecting, dirList, lastFileClicked, startFile, endFile, thisFileObj; // If we've clicked somewhere other than a file/folder - if (top.ICEcoder.thisFileFolderLink=="") { - if (!ctrlSim && !evt.ctrlKey && !top.ICEcoder.cmdKey) { - top.ICEcoder.deselectAllFiles(); + if (ICEcoder.thisFileFolderLink=="") { + if (!ctrlSim && !evt.ctrlKey && !ICEcoder.cmdKey) { + ICEcoder.deselectAllFiles(); } - } else if (top.ICEcoder.thisFileFolderLink) { + } else if (ICEcoder.thisFileFolderLink) { // Get file URL, with pipes instead of slashes & target DOM elem - shortURL = top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"); - tgtFile = top.ICEcoder.filesFrame.contentWindow.document.getElementById(shortURL); + shortURL = ICEcoder.thisFileFolderLink.replace(/\//g,"|"); + tgtFile = ICEcoder.filesFrame.contentWindow.document.getElementById(shortURL); // If we have the CTRL/Cmd key down - if (ctrlSim || evt.ctrlKey || top.ICEcoder.cmdKey) { + if (ctrlSim || evt.ctrlKey || ICEcoder.cmdKey) { // Deselect or select file - if (top.ICEcoder.selectedFiles.indexOf(shortURL)>-1) { + if (ICEcoder.selectedFiles.indexOf(shortURL)>-1) { ICEcoder.selectDeselectFile('deselect',tgtFile); - top.ICEcoder.selectedFiles.splice(top.ICEcoder.selectedFiles.indexOf(shortURL),1); + ICEcoder.selectedFiles.splice(ICEcoder.selectedFiles.indexOf(shortURL),1); } else { ICEcoder.selectDeselectFile('select',tgtFile); - top.ICEcoder.selectedFiles.push(shortURL); + ICEcoder.selectedFiles.push(shortURL); } // Select from last click to this one } else if (shiftSim || evt.shiftKey) { selecting = false; dirList = tgtFile.parentNode.parentNode.parentNode; - lastFileClicked = top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1]; + lastFileClicked = ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1]; // Prefix numbers with up to 20 leading zeros // This is so we can have some kind of natural comparison on the regex below @@ -1740,16 +1743,16 @@ var ICEcoder = { startFile = shortURL.replace(/\d+/g, prefixer) < lastFileClicked.replace(/\d+/g, prefixer) ? shortURL : lastFileClicked; endFile = shortURL.replace(/\d+/g, prefixer) > lastFileClicked.replace(/\d+/g, prefixer) ? shortURL : lastFileClicked; - if (top.ICEcoder.selectedFiles.length > 0 && startFile.substr(0,startFile.lastIndexOf("|")) == endFile.substr(0,endFile.lastIndexOf("|"))) { + if (ICEcoder.selectedFiles.length > 0 && startFile.substr(0,startFile.lastIndexOf("|")) == endFile.substr(0,endFile.lastIndexOf("|"))) { for (var i=0; i<1000000; i+=2) { if(dirList.childNodes[i].nodeName != "LI") {i++;}; thisFileObj = dirList.childNodes[i].childNodes[0].childNodes[1]; if (thisFileObj.id == startFile) { selecting = true; } - if (selecting==true && top.ICEcoder.selectedFiles.indexOf(thisFileObj.id)==-1) { + if (selecting==true && ICEcoder.selectedFiles.indexOf(thisFileObj.id)==-1) { ICEcoder.selectDeselectFile('select',thisFileObj); - top.ICEcoder.selectedFiles.push(thisFileObj.id); + ICEcoder.selectedFiles.push(thisFileObj.id); } if (thisFileObj.id == endFile) { break; @@ -1757,45 +1760,45 @@ var ICEcoder = { } } else { ICEcoder.selectDeselectFile('select',tgtFile); - top.ICEcoder.selectedFiles.push(shortURL); + ICEcoder.selectedFiles.push(shortURL); } // We are single clicking } else { - top.ICEcoder.deselectAllFiles(); + ICEcoder.deselectAllFiles(); // Add our URL and highlight the file ICEcoder.selectDeselectFile('select',tgtFile); - top.ICEcoder.selectedFiles.push(shortURL); + ICEcoder.selectedFiles.push(shortURL); } } // If in GitHub mode, update the selected count and button colours - if (top.ICEcoder.githubDiff) { - top.get('githubNavSelectedCount').innerHTML = "Selected: " + top.ICEcoder.selectedFiles.length; - top.get('githubNavCommit').style.color = top.ICEcoder.selectedFiles.length > 0 ? "#fff" : "#333"; - top.get('githubNavCommit').style.background = top.ICEcoder.selectedFiles.length > 0 ? "#2187e7" : "#555"; - top.get('githubNavSelectedCount').style.color = top.ICEcoder.selectedFiles.length > 0 ? "#fff" : "#333"; - top.get('githubNavPull').style.color = top.ICEcoder.selectedFiles.length > 0 ? "#fff" : "#333"; - top.get('githubNavPull').style.background = top.ICEcoder.selectedFiles.length > 0 ? "#2187e7" : "#555"; + if (ICEcoder.githubDiff) { + get('githubNavSelectedCount').innerHTML = "Selected: " + ICEcoder.selectedFiles.length; + get('githubNavCommit').style.color = ICEcoder.selectedFiles.length > 0 ? "#fff" : "#333"; + get('githubNavCommit').style.background = ICEcoder.selectedFiles.length > 0 ? "#2187e7" : "#555"; + get('githubNavSelectedCount').style.color = ICEcoder.selectedFiles.length > 0 ? "#fff" : "#333"; + get('githubNavPull').style.color = ICEcoder.selectedFiles.length > 0 ? "#fff" : "#333"; + get('githubNavPull').style.background = ICEcoder.selectedFiles.length > 0 ? "#2187e7" : "#555"; } // Adjust the file & replace select dropdown values accordingly - document.findAndReplace.target[2].innerHTML = !top.ICEcoder.selectedFiles[0] ? top.t['all files'] : top.t['selected files']; - document.findAndReplace.target[3].innerHTML = !top.ICEcoder.selectedFiles[0] ? top.t['all filenames'] : top.t['selected filenames']; + document.findAndReplace.target[2].innerHTML = !ICEcoder.selectedFiles[0] ? t['all files'] : t['selected files']; + document.findAndReplace.target[3].innerHTML = !ICEcoder.selectedFiles[0] ? t['all filenames'] : t['selected filenames']; // Hide the file menu incase it's showing - top.ICEcoder.hideFileMenu(); + ICEcoder.hideFileMenu(); }, // Deselect all files deselectAllFiles: function() { var tgtFile; - for (var i=0;i -1 ? true : false; + isOpen = ICEcoder.openFiles.indexOf(file.id.replace(/\|/g,"/")) > -1 ? true : false; - if (top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] == file.id.replace(/\|/g,"/")) { + if (ICEcoder.openFiles[ICEcoder.selectedTab-1] == file.id.replace(/\|/g,"/")) { file.style.backgroundColor = action=="select" - ? top.ICEcoder.tabBGselected : top.ICEcoder.tabBGcurrent; + ? ICEcoder.tabBGselected : ICEcoder.tabBGcurrent; } else { file.style.backgroundColor = action=="select" - ? top.ICEcoder.tabBGselected : file.style.backgroundColor = isOpen - ? top.ICEcoder.tabBGopen : top.ICEcoder.tabBGnormal; + ? ICEcoder.tabBGselected : file.style.backgroundColor = isOpen + ? ICEcoder.tabBGopen : ICEcoder.tabBGnormal; } - file.style.color = action=="select" ? top.ICEcoder.tabFGselected : top.ICEcoder.tabFGnormalFile; + file.style.color = action=="select" ? ICEcoder.tabFGselected : ICEcoder.tabFGnormalFile; } }, @@ -1821,40 +1824,40 @@ var ICEcoder = { boxSelect: function(evt, mouseAction) { var fmDragBox, positive; - fmDragBox = top.ICEcoder.filesFrame.contentWindow.document.getElementById('fmDragBox'); + fmDragBox = ICEcoder.filesFrame.contentWindow.document.getElementById('fmDragBox'); // On mouse down, set start X & Y and reset first and last items in box area select if (mouseAction == "down") { - top.ICEcoder.fmDragBoxStartX = top.ICEcoder.mouseX; - top.ICEcoder.fmDragBoxStartY = top.ICEcoder.mouseY; - top.ICEcoder.fmDragSelectFirst = ""; - top.ICEcoder.fmDragSelectLast = ""; + ICEcoder.fmDragBoxStartX = ICEcoder.mouseX; + ICEcoder.fmDragBoxStartY = ICEcoder.mouseY; + ICEcoder.fmDragSelectFirst = ""; + ICEcoder.fmDragSelectLast = ""; } // On mouse drag, state we're dragging, set the box size and position properties and select files - if(top.ICEcoder.mouseDown && !top.ICEcoder.mouseDownInCM && mouseAction == "drag") { - top.ICEcoder.fmDraggedBox = true; + if(ICEcoder.mouseDown && !ICEcoder.mouseDownInCM && mouseAction == "drag") { + ICEcoder.fmDraggedBox = true; // Handle X-axis properties - positive = top.ICEcoder.mouseX-top.ICEcoder.fmDragBoxStartX > 0; - fmDragBox.style.left = (positive ? top.ICEcoder.fmDragBoxStartX : top.ICEcoder.mouseX) + "px"; - fmDragBox.style.width = Math.abs(top.ICEcoder.mouseX-top.ICEcoder.fmDragBoxStartX) + "px"; + positive = ICEcoder.mouseX-ICEcoder.fmDragBoxStartX > 0; + fmDragBox.style.left = (positive ? ICEcoder.fmDragBoxStartX : ICEcoder.mouseX) + "px"; + fmDragBox.style.width = Math.abs(ICEcoder.mouseX-ICEcoder.fmDragBoxStartX) + "px"; // Handle Y-axis properties - positive = top.ICEcoder.mouseY-top.ICEcoder.fmDragBoxStartY > 0; - fmDragBox.style.top = (positive ? top.ICEcoder.fmDragBoxStartY-70 : top.ICEcoder.mouseY-70) + "px"; - fmDragBox.style.height = Math.abs(top.ICEcoder.mouseY-top.ICEcoder.fmDragBoxStartY) + "px"; + positive = ICEcoder.mouseY-ICEcoder.fmDragBoxStartY > 0; + fmDragBox.style.top = (positive ? ICEcoder.fmDragBoxStartY-70 : ICEcoder.mouseY-70) + "px"; + fmDragBox.style.height = Math.abs(ICEcoder.mouseY-ICEcoder.fmDragBoxStartY) + "px"; // Select the files - if (top.ICEcoder.thisFileFolderLink != "") { - if (top.ICEcoder.fmDragSelectFirst == "") { - top.ICEcoder.fmDragSelectFirst = top.ICEcoder.thisFileFolderLink; - top.ICEcoder.overFileFolder(top.ICEcoder.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', top.ICEcoder.fmDragSelectFirst); - top.ICEcoder.selectFileFolder(evt); + if (ICEcoder.thisFileFolderLink != "") { + if (ICEcoder.fmDragSelectFirst == "") { + ICEcoder.fmDragSelectFirst = ICEcoder.thisFileFolderLink; + ICEcoder.overFileFolder(ICEcoder.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', ICEcoder.fmDragSelectFirst); + ICEcoder.selectFileFolder(evt); } else { - top.ICEcoder.fmDragSelectLast = top.ICEcoder.thisFileFolderLink; - top.ICEcoder.overFileFolder(top.ICEcoder.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', top.ICEcoder.fmDragSelectLast); - top.ICEcoder.selectFileFolder(evt,false,'shiftSim'); + ICEcoder.fmDragSelectLast = ICEcoder.thisFileFolderLink; + ICEcoder.overFileFolder(ICEcoder.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', ICEcoder.fmDragSelectLast); + ICEcoder.selectFileFolder(evt,false,'shiftSim'); } } } @@ -1868,19 +1871,19 @@ var ICEcoder = { // Create a new file (start & instant save) newFile: function() { - top.ICEcoder.newTab('alsoSave'); + ICEcoder.newTab('alsoSave'); }, // Create a new folder newFolder: function() { var shortURL, newFolder; - shortURL = top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); - newFolder = top.ICEcoder.getInput('Enter new folder name at '+shortURL,''); + shortURL = ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); + newFolder = ICEcoder.getInput('Enter new folder name at '+shortURL,''); if (newFolder) { newFolder = (shortURL + "/" + newFolder).replace(/\/\//,"/"); - top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=newFolder&csrf="+top.ICEcoder.csrf,encodeURIComponent(newFolder.replace(/\//g,"|"))); - top.ICEcoder.serverMessage(''+top.t['Creating Folder']+'
'+newFolder); + ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=newFolder&csrf="+ICEcoder.csrf,encodeURIComponent(newFolder.replace(/\//g,"|"))); + ICEcoder.serverMessage(''+t['Creating Folder']+'
'+newFolder); } }, @@ -1914,44 +1917,44 @@ var ICEcoder = { var flSplit, line, shortURL, canOpenFile; if ("undefined" != typeof fileLink) { - flSplit = top.ICEcoder.returnFileAndLine(fileLink); + flSplit = ICEcoder.returnFileAndLine(fileLink); fileLink = flSplit[0]; line = flSplit[1]; } if (fileLink) { - top.ICEcoder.thisFileFolderLink=fileLink; - top.ICEcoder.thisFileFolderType="file"; + ICEcoder.thisFileFolderLink=fileLink; + ICEcoder.thisFileFolderType="file"; } - if (top.ICEcoder.thisFileFolderLink != "/[NEW]" && top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)!==false) { - top.ICEcoder.switchTab(top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)+1); + if (ICEcoder.thisFileFolderLink != "/[NEW]" && ICEcoder.isOpen(ICEcoder.thisFileFolderLink)!==false) { + ICEcoder.switchTab(ICEcoder.isOpen(ICEcoder.thisFileFolderLink)+1); if (line > 1){ - top.ICEcoder.goToLine(line); + ICEcoder.goToLine(line); } - } else if (top.ICEcoder.thisFileFolderLink!="" && top.ICEcoder.thisFileFolderType=="file") { + } else if (ICEcoder.thisFileFolderLink!="" && ICEcoder.thisFileFolderType=="file") { // work out a shortened URL for the file - shortURL = top.ICEcoder.thisFileFolderLink.replace(/\|/g,"/"); + shortURL = ICEcoder.thisFileFolderLink.replace(/\|/g,"/"); // No reason why we can't open a file (so far) canOpenFile = true; // Limit to 100 files open at a time - if (top.ICEcoder.openFiles.length>=100) { - top.ICEcoder.message(top.t['Sorry you can...']); + if (ICEcoder.openFiles.length>=100) { + ICEcoder.message(t['Sorry you can...']); canOpenFile = false; } // if we're still OK to open it... if (canOpenFile) { - top.ICEcoder.shortURL = shortURL; + ICEcoder.shortURL = shortURL; if (shortURL!="/[NEW]") { - top.ICEcoder.thisFileFolderLink = top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"); - top.ICEcoder.serverQueue("add","lib/file-control.php?action=load&file="+encodeURIComponent(top.ICEcoder.thisFileFolderLink)+"&csrf="+top.ICEcoder.csrf+"&lineNumber="+line); - top.ICEcoder.serverMessage(''+top.t['Opening File']+'
'+top.ICEcoder.shortURL); + ICEcoder.thisFileFolderLink = ICEcoder.thisFileFolderLink.replace(/\//g,"|"); + ICEcoder.serverQueue("add",iceLoc+"/lib/file-control.php?action=load&file="+encodeURIComponent(ICEcoder.thisFileFolderLink)+"&csrf="+ICEcoder.csrf+"&lineNumber="+line); + ICEcoder.serverMessage(''+t['Opening File']+'
'+ICEcoder.shortURL); } else { - top.ICEcoder.createNewTab('new'); + ICEcoder.createNewTab('new'); } - top.ICEcoder.fMIconVis('fMView',1); + ICEcoder.fMIconVis('fMView',1); } } }, @@ -1959,9 +1962,9 @@ var ICEcoder = { // Open selected files openFilesFromList: function(fileList) { for (var i=0;i-1 - ? top.ICEcoder.getRemoteFile(fileLink) - : top.ICEcoder.openFile(fileLink); + ? ICEcoder.getRemoteFile(fileLink) + : ICEcoder.openFile(fileLink); } }, @@ -1981,23 +1984,23 @@ var ICEcoder = { var flSplit, line; if ("undefined" != typeof remoteFile) { - flSplit = top.ICEcoder.returnFileAndLine(remoteFile); + flSplit = ICEcoder.returnFileAndLine(remoteFile); remoteFile = flSplit[0]; line = flSplit[1]; } - top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=getRemoteFile&csrf="+top.ICEcoder.csrf+"&lineNumber="+line,encodeURIComponent(remoteFile)); - top.ICEcoder.serverMessage(''+top.t['Getting']+'
'+remoteFile); + ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=getRemoteFile&csrf="+ICEcoder.csrf+"&lineNumber="+line,encodeURIComponent(remoteFile)); + ICEcoder.serverMessage(''+t['Getting']+'
'+remoteFile); }, // Get changes to save (used when simply saving, gets diff changes between current and last known version) getChangesToSave: function() { var cM, savedText, newText, sm, opcodes; - cM = top.ICEcoder.getcMInstance(); + cM = ICEcoder.getcMInstance(); // Get the last known saved version of file from array - savedText = top.ICEcoder.savedContents[top.ICEcoder.selectedTab-1]; + savedText = ICEcoder.savedContents[ICEcoder.selectedTab-1]; // Get the text values and split it into lines newText = difflib.stringAsLines(cM.getValue()); @@ -2037,20 +2040,20 @@ var ICEcoder = { // If we're not 'saving as', establish changes between current and known saved version from array if (!saveAs) { - changes = top.ICEcoder.getChangesToSave(); + changes = ICEcoder.getChangesToSave(); } saveType = saveAs ? "saveAs" : "save"; - filePath = ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|"); - if (filePath=="|[NEW]" && top.ICEcoder.selectedFiles.length>0) { - pathPrefix = top.ICEcoder.selectedFiles[0]; + filePath = ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(iceRoot,"").replace(/\//g,"|"); + if (filePath=="|[NEW]" && ICEcoder.selectedFiles.length>0) { + pathPrefix = ICEcoder.selectedFiles[0]; filePath = pathPrefix.lastIndexOf(".") == -1 || pathPrefix.lastIndexOf(".") < pathPrefix.lastIndexOf("|") ? pathPrefix+filePath : "|[NEW]"; } filePath = filePath.replace("||","|"); - top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=save&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&fileVersion="+ICEcoder.openFileVersions[ICEcoder.selectedTab-1]+"&saveType="+saveType+"&csrf="+top.ICEcoder.csrf,encodeURIComponent(filePath),changes); - top.ICEcoder.serverMessage(''+top.t['Saving']+'
'+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"")); + ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=save&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&fileVersion="+ICEcoder.openFileVersions[ICEcoder.selectedTab-1]+"&saveType="+saveType+"&csrf="+ICEcoder.csrf,encodeURIComponent(filePath),changes); + ICEcoder.serverMessage(''+t['Saving']+'
'+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(iceRoot,"")); }, // Prompt a rename dialog @@ -2058,28 +2061,28 @@ var ICEcoder = { var shortURL, fileName, i; if (!oldName) { - shortURL = top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); - oldName = top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); + shortURL = ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); + oldName = ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); } else { shortURL = oldName.replace(/\|/g,"/"); } if (!newName) { - newName = top.ICEcoder.getInput(top.t['Please enter the...'],shortURL); + newName = ICEcoder.getInput(t['Please enter the...'],shortURL); } if (newName) { - i = top.ICEcoder.openFiles.indexOf(shortURL.replace(/\|/g,"/")); + i = ICEcoder.openFiles.indexOf(shortURL.replace(/\|/g,"/")); if(i>-1) { // rename array item and the tab - top.ICEcoder.openFiles[i] = newName; - closeTabLink = ''; - fileName = top.ICEcoder.openFiles[i]; - top.get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); - top.get('tab'+(i+1)).title = newName; + ICEcoder.openFiles[i] = newName; + closeTabLink = ''; + fileName = ICEcoder.openFiles[i]; + get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); + get('tab'+(i+1)).title = newName; } - top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=rename&oldFileName="+encodeURIComponent(oldName.replace(/\|/g,"/"))+"&csrf="+top.ICEcoder.csrf,encodeURIComponent(newName)); - top.ICEcoder.serverMessage(''+top.t['Renaming to']+'
'+newName); + ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=rename&oldFileName="+encodeURIComponent(oldName.replace(/\|/g,"/"))+"&csrf="+ICEcoder.csrf,encodeURIComponent(newName)); + ICEcoder.serverMessage(''+t['Renaming to']+'
'+newName); - top.ICEcoder.setPreviousFiles(); + ICEcoder.setPreviousFiles(); } }, @@ -2088,21 +2091,21 @@ var ICEcoder = { var fileName, i; if (newName && newName != oldName) { - i = top.ICEcoder.openFiles.indexOf(oldName.replace(/\|/g,"/")); + i = ICEcoder.openFiles.indexOf(oldName.replace(/\|/g,"/")); if(i>-1) { // rename array item and the tab - top.ICEcoder.openFiles[i] = newName; - closeTabLink = ''; - fileName = top.ICEcoder.openFiles[i]; - top.get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); - top.get('tab'+(i+1)).title = newName; + ICEcoder.openFiles[i] = newName; + closeTabLink = ''; + fileName = ICEcoder.openFiles[i]; + get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); + get('tab'+(i+1)).title = newName; } - if (top.ICEcoder.ask("Are you sure you want to move file " + oldName + " to " + newName + " ?")){ - top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=move&oldFileName="+encodeURIComponent(oldName.replace(/\//g,"|"))+"&csrf="+top.ICEcoder.csrf,encodeURIComponent(newName.replace(/\//g,"|"))); - top.ICEcoder.serverMessage(''+top.t['Moving to']+'
'+newName); + if (ICEcoder.ask("Are you sure you want to move file " + oldName + " to " + newName + " ?")){ + ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=move&oldFileName="+encodeURIComponent(oldName.replace(/\//g,"|"))+"&csrf="+ICEcoder.csrf,encodeURIComponent(newName.replace(/\//g,"|"))); + ICEcoder.serverMessage(''+t['Moving to']+'
'+newName); } - top.ICEcoder.setPreviousFiles(); + ICEcoder.setPreviousFiles(); } }, @@ -2110,41 +2113,41 @@ var ICEcoder = { deleteFiles: function(fileList) { var tgtFiles, tgtListDisplay; - tgtFiles = fileList ? fileList : top.ICEcoder.selectedFiles; + tgtFiles = fileList ? fileList : ICEcoder.selectedFiles; tgtListDisplay = tgtFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n"); - if (tgtFiles.length>0 && top.ICEcoder.ask('Delete:\n\n'+tgtListDisplay+'?')) { - top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=delete&&csrf="+top.ICEcoder.csrf,encodeURIComponent(tgtFiles.join(";"))); - top.ICEcoder.serverMessage(''+top.t['Deleting File']+'
'+tgtListDisplay); + if (tgtFiles.length>0 && ICEcoder.ask('Delete:\n\n'+tgtListDisplay+'?')) { + ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=delete&&csrf="+ICEcoder.csrf,encodeURIComponent(tgtFiles.join(";"))); + ICEcoder.serverMessage(''+t['Deleting File']+'
'+tgtListDisplay); }; }, // Copy files copyFiles: function(fileList,dontShowPaste,dontHide) { - top.ICEcoder.copiedFiles = []; + ICEcoder.copiedFiles = []; for (var i=0; i'+top.t['Pasting File']+'
'+top.ICEcoder.copiedFiles[i].toString().replace(/\|/g,"/").replace(/,/g,"\n")); + if (ICEcoder.copiedFiles) { + for (var i=0; i'+t['Pasting File']+'
'+ICEcoder.copiedFiles[i].toString().replace(/\|/g,"/").replace(/,/g,"\n")); } else { - top.ICEcoder.message(top.t['Sorry cannot paste...']); + ICEcoder.message(t['Sorry cannot paste...']); } } } else { - top.ICEcoder.message(top.t['Nothing to paste...']); + ICEcoder.message(t['Nothing to paste...']); } }, @@ -2153,29 +2156,29 @@ var ICEcoder = { var copiedFiles, location; // Take a snapshot of copied files - if (top.ICEcoder.copiedFiles) { - copiedFiles = top.ICEcoder.copiedFiles; + if (ICEcoder.copiedFiles) { + copiedFiles = ICEcoder.copiedFiles; } - top.ICEcoder.copyFiles(fileList,'dontShowPaste','dontHide'); + ICEcoder.copyFiles(fileList,'dontShowPaste','dontHide'); location = fileList[0].substr(0,fileList[0].lastIndexOf("|")); - top.ICEcoder.pasteFiles(location); + ICEcoder.pasteFiles(location); // Restore copied files back to the snapshot if ("undefined" != typeof copiedFiles) { - top.ICEcoder.copiedFiles = copiedFiles; + ICEcoder.copiedFiles = copiedFiles; } }, // Upload file(s) - select & submit uploadFilesSelect: function(location) { - top.get('uploadDir').value = location; - top.get("fileInput").click(); + get('uploadDir').value = location; + get("fileInput").click(); }, uploadFilesSubmit: function(obj) { - if (top.get('fileInput').value!="") { - top.ICEcoder.showHide('show',top.get('loadingMask')); - top.get('uploadFilesForm').submit(); + if (get('fileInput').value!="") { + ICEcoder.showHide('show',get('loadingMask')); + get('uploadFilesForm').submit(); event.preventDefault(); } }, @@ -2186,14 +2189,14 @@ var ICEcoder = { if (vis=="hide") { fileNavInt = setTimeout(function() { for (var i=0; i= 0) { + if (["raw","both"].indexOf(ICEcoder.fileDirResOutput) >= 0) { console.log(xhr.responseText); } // User wanted object (or both) output of the response? - if (["object","both"].indexOf(top.ICEcoder.fileDirResOutput) >= 0) { + if (["object","both"].indexOf(ICEcoder.fileDirResOutput) >= 0) { console.log(statusObj); } // Also store the statusObj - top.ICEcoder.lastFileDirCheckStatusObj = statusObj; + ICEcoder.lastFileDirCheckStatusObj = statusObj; // If error, show that, otherwise do whatever we're required to do next if (statusObj.status.error) { - top.ICEcoder.message(statusObj.status.errorMsg); + ICEcoder.message(statusObj.status.errorMsg); console.log("ICEcoder error info for your request..."); console.log(statusObj); - top.ICEcoder.serverMessage(); - top.ICEcoder.serverQueue('del',0); + ICEcoder.serverMessage(); + ICEcoder.serverQueue('del',0); } else { eval(statusObj.action.doNext); } // Some other response? Display a message about that } else { - top.ICEcoder.message(top.t['Sorry there was...']); + ICEcoder.message(t['Sorry there was...']); console.log("ICEcoder error info for your request..."); console.log(statusObj); - top.ICEcoder.serverMessage(); - top.ICEcoder.serverQueue('del',0); + ICEcoder.serverMessage(); + ICEcoder.serverQueue('del',0); } } }; - xhr.open("POST","lib/file-control-xhr.php?action=checkExists&csrf="+top.ICEcoder.csrf,true); + xhr.open("POST",iceLoc+"/lib/file-control-xhr.php?action=checkExists&csrf="+ICEcoder.csrf,true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); timeStart = new Date().getTime(); xhr.send('timeStart='+timeStart+'&file='+encodeURIComponent(path)); @@ -2298,48 +2301,48 @@ var ICEcoder = { showMenu: function(evt) { var menuType, menuHeight, winH, fmYPos; - if ( top.ICEcoder.selectedFiles.length == 0 || - top.ICEcoder.selectedFiles.indexOf(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\//g,"|")) == -1) { - top.ICEcoder.selectFileFolder(evt); + if ( ICEcoder.selectedFiles.length == 0 || + ICEcoder.selectedFiles.indexOf(ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\//g,"|")) == -1) { + ICEcoder.selectFileFolder(evt); } menuHeight = 124+5; // general options height in px plus 5px space winH = window.innerHeight; - if ("undefined" != typeof top.ICEcoder.thisFileFolderLink && top.ICEcoder.thisFileFolderLink!="") { - menuType = this.isPathFolder(top.ICEcoder.selectedFiles[0]) ? "folder" : "file"; - top.get('folderMenuItems').style.display = menuType == "folder" && top.ICEcoder.selectedFiles.length == 1 ? "block" : "none"; - if (menuType == "folder" && top.ICEcoder.selectedFiles.length == 1) { + if ("undefined" != typeof ICEcoder.thisFileFolderLink && ICEcoder.thisFileFolderLink!="") { + menuType = this.isPathFolder(ICEcoder.selectedFiles[0]) ? "folder" : "file"; + get('folderMenuItems').style.display = menuType == "folder" && ICEcoder.selectedFiles.length == 1 ? "block" : "none"; + if (menuType == "folder" && ICEcoder.selectedFiles.length == 1) { menuHeight += 20+20+1+23+1+2; // new file, new folder, hr, upload files(s), hr, padding - if (top.get('fmMenuPasteOption').style.display == "block") { + if (get('fmMenuPasteOption').style.display == "block") { menuHeight += 19; } } - top.get('singleFileMenuItems').style.display = top.ICEcoder.selectedFiles.length > 1 ? "none" : "block"; - if (top.ICEcoder.selectedFiles.length == 1) { + get('singleFileMenuItems').style.display = ICEcoder.selectedFiles.length > 1 ? "none" : "block"; + if (ICEcoder.selectedFiles.length == 1) { menuHeight += 43; } - top.get('fileMenu').style.display = "inline-block"; - setTimeout(function() {top.get('fileMenu').style.opacity = "1"},4); - top.get('fileMenu').style.left = (top.ICEcoder.mouseX+20) + "px"; - fmYPos = top.ICEcoder.mouseY-top.ICEcoder.filesFrame.contentWindow.document.body.scrollTop-10; + get('fileMenu').style.display = "inline-block"; + setTimeout(function() {get('fileMenu').style.opacity = "1"},4); + get('fileMenu').style.left = (ICEcoder.mouseX+20) + "px"; + fmYPos = ICEcoder.mouseY-ICEcoder.filesFrame.contentWindow.document.body.scrollTop-10; if (fmYPos+menuHeight > winH) { fmYPos -= (fmYPos+menuHeight-winH); } - top.get('fileMenu').style.top = fmYPos + "px"; + get('fileMenu').style.top = fmYPos + "px"; } return false; }, // Continue to show the file manager showFileMenu: function() { - top.get('fileMenu').style.display='inline-block'; - setTimeout(function() {top.get('fileMenu').style.opacity = "1"},4); + get('fileMenu').style.display='inline-block'; + setTimeout(function() {get('fileMenu').style.opacity = "1"},4); }, // Hide the file manager hideFileMenu: function() { - top.get('fileMenu').style.display='none'; - top.get('fileMenu').style.opacity = "0"; + get('fileMenu').style.display='none'; + get('fileMenu').style.opacity = "0"; }, // Update the file manager tree list on demand @@ -2347,29 +2350,29 @@ var ICEcoder = { var actionElemType, cssStyle, perms, targetElem, locNest, newText, innerLI, permColors, newUL, newLI, elemType, nameLI, shortURL, newMouseOver; // Adding files - if (action=="add" && !top.get('filesFrame').contentWindow.document.getElementById(location.replace(top.iceRoot,"").replace(/\/$/, "").replace(/\//g,"|")+"|"+file)) { + if (action=="add" && !get('filesFrame').contentWindow.document.getElementById(location.replace(iceRoot,"").replace(/\/$/, "").replace(/\//g,"|")+"|"+file)) { // Is this is a file or folder and based on that, set the CSS styling & link actionElemType = fileOrFolder; cssStyle = actionElemType=="file" ? "pft-file ext-" + file.substr(file.indexOf(".")+1) : "pft-directory"; - perms = actionElemType=="file" ? top.ICEcoder.newFilePerms : top.ICEcoder.newDirPerms; + perms = actionElemType=="file" ? ICEcoder.newFilePerms : ICEcoder.newDirPerms; // Identify our target element & the first child element in it's location if (!location) {location="/"} - location = location.replace(top.iceRoot,"/"); + location = location.replace(iceRoot,"/"); location = location.replace("//","/"); - targetElem = top.get('filesFrame').contentWindow.document.getElementById(location.replace(/\//g,"|")); + targetElem = get('filesFrame').contentWindow.document.getElementById(location.replace(/\//g,"|")); locNest = targetElem.parentNode.parentNode.nextSibling; newText = document.createTextNode("\n"); permColors = perms == 777 ? 'background: #800; color: #eee' : 'color: #888'; - innerLI = '        '+file+' '+perms+''; + ' if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {ICEcoder.openFile()}}" style="position: relative; left:-22px">        '+file+' '+perms+''; // If we don't have a locNest or at least 3 DOM items in there, it's an empty folder if(!locNest || locNest.childNodes.length<3) { @@ -2382,10 +2385,10 @@ var ICEcoder = { newLI = document.createElement("li"); newLI.className = cssStyle; newLI.draggable = false; - newLI.ondragstart = function(event) {top.ICEcoder.addDefaultDragData(this,event)}; - newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);if(top.ICEcoder.getcMInstance()){top.ICEcoder.editorFocusInstance.indexOf('diff') == -1 ? top.ICEcoder.getcMInstance().focus() : top.ICEcoder.getcMdiffInstance().focus()}}; - newLI.ondragover = function(event) {top.ICEcoder.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; - newLI.ondragend = function() {top.ICEcoder.dropFile(this)}; + newLI.ondragstart = function(event) {ICEcoder.addDefaultDragData(this,event)}; + newLI.ondrag = function(event) {ICEcoder.draggingWithKeyTest(event);if(ICEcoder.getcMInstance()){ICEcoder.editorFocusInstance.indexOf('diff') == -1 ? ICEcoder.getcMInstance().focus() : ICEcoder.getcMdiffInstance().focus()}}; + newLI.ondragover = function(event) {ICEcoder.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; + newLI.ondragend = function() {ICEcoder.dropFile(this)}; newLI.innerHTML = innerLI locNest.nextSibling.appendChild(newLI); locNest.nextSibling.appendChild(newText); @@ -2405,10 +2408,10 @@ var ICEcoder = { newLI = document.createElement("li"); newLI.className = cssStyle; newLI.draggable = false; - newLI.ondragstart = function(event) {top.ICEcoder.addDefaultDragData(this,event)}; - newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);if(top.ICEcoder.getcMInstance()){top.ICEcoder.editorFocusInstance.indexOf('diff') == -1 ? top.ICEcoder.getcMInstance().focus() : top.ICEcoder.getcMdiffInstance().focus()}}; - newLI.ondragover = function(event) {top.ICEcoder.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; - newLI.ondragend = function() {top.ICEcoder.dropFile(this)}; + newLI.ondragstart = function(event) {ICEcoder.addDefaultDragData(this,event)}; + newLI.ondrag = function(event) {ICEcoder.draggingWithKeyTest(event);if(ICEcoder.getcMInstance()){ICEcoder.editorFocusInstance.indexOf('diff') == -1 ? ICEcoder.getcMInstance().focus() : ICEcoder.getcMdiffInstance().focus()}}; + newLI.ondragover = function(event) {ICEcoder.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; + newLI.ondragend = function() {ICEcoder.dropFile(this)}; newLI.innerHTML = innerLI; // Append or insert depending on which of the above if statements is true if (i==locNest.childNodes.length-1) { @@ -2425,7 +2428,7 @@ var ICEcoder = { } // If we added a new file, we've saved it under a new filename, so set that if (actionElemType=="file" && !uploaded) { - top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]=location+file; + ICEcoder.openFiles[ICEcoder.selectedTab-1]=location+file; } } @@ -2433,29 +2436,29 @@ var ICEcoder = { if (action=="rename") { // Get short URL of our right clicked file and get target elem based on this shortURL = oldName.replace(/\//g,"|"); - targetElem = top.get('filesFrame').contentWindow.document.getElementById(shortURL); + targetElem = get('filesFrame').contentWindow.document.getElementById(shortURL); // Set the name to be as per our new file/folder name targetElem.innerHTML = file; // Update the ID of the target & set a new title and perms ID targetElem.id = location.replace(/\//g,"|") + "|" + file; targetElem.parentNode.title = targetElem.id.replace(/\|/g,"/"); - targetElemPerms = top.get('filesFrame').contentWindow.document.getElementById(shortURL+"_perms"); + targetElemPerms = get('filesFrame').contentWindow.document.getElementById(shortURL+"_perms"); targetElemPerms.id = location.replace(/\//g,"|") + "|" + file + "_perms"; // Finally, rename also within any children - top.ICEcoder.renameInChildren(targetElem, oldName, location, file); + ICEcoder.renameInChildren(targetElem, oldName, location, file); } // Moving files if (action=="move") { - top.ICEcoder.updateFileManagerList("add",location,file,false,false,false,fileOrFolder); - top.ICEcoder.updateFileManagerList("delete",oldName.substr(0,oldName.lastIndexOf("/")),file); + ICEcoder.updateFileManagerList("add",location,file,false,false,false,fileOrFolder); + ICEcoder.updateFileManagerList("delete",oldName.substr(0,oldName.lastIndexOf("/")),file); } // Chmod on files if (action=="chmod") { // Get short URL for our file and get our target elem based on this - shortURL = top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); - targetElem = top.get('filesFrame').contentWindow.document.getElementById(shortURL.replace(/\//g,"|")+"_perms"); + shortURL = ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); + targetElem = get('filesFrame').contentWindow.document.getElementById(shortURL.replace(/\//g,"|")+"_perms"); // Set the color for the perms targetElem.style.background = perms == 777 ? '#800' : 'none'; targetElem.style.color = perms == 777 ? '#eee' : '#888'; @@ -2466,12 +2469,12 @@ var ICEcoder = { // Deleting files if (action=="delete") { if (!location) {location=""} - location = location.replace(top.iceRoot,"/"); + location = location.replace(iceRoot,"/"); location = location.replace("//","/"); location = location.replace(/\/$/, "").replace(/\//g,"|"); targetElem = (location +"|"+file).replace("||","|"); - targetElem = top.get('filesFrame').contentWindow.document.getElementById(targetElem).parentNode.parentNode; - top.ICEcoder.openCloseDir(targetElem.childNodes[0],false); + targetElem = get('filesFrame').contentWindow.document.getElementById(targetElem).parentNode.parentNode; + ICEcoder.openCloseDir(targetElem.childNodes[0],false); targetElem.parentNode.removeChild(targetElem); } }, @@ -2493,10 +2496,10 @@ var ICEcoder = { targetElem.id = targetElem.id.replace(oldName.replace(/\//g,"|"),location.replace(/\//g,"|")+"|"+file); targetElem.parentNode.title = targetElem.id.replace(/\|/g,"/"); // Also update the perms ID - targetElemPerms = top.get('filesFrame').contentWindow.document.getElementById(targetElem.id).nextSibling.nextSibling; + targetElemPerms = get('filesFrame').contentWindow.document.getElementById(targetElem.id).nextSibling.nextSibling; targetElemPerms.id = targetElem.id + "_perms"; // Finally, test this node for ULs next to it also, incase it's a dir - top.ICEcoder.renameInChildren(targetElem, oldName, location, file); + ICEcoder.renameInChildren(targetElem, oldName, location, file); } } } @@ -2504,12 +2507,12 @@ var ICEcoder = { // Refresh file manager refreshFileManager: function() { - top.ICEcoder.showHide('show',top.get('loadingMask')); - top.ICEcoder.filesFrame.contentWindow.location.reload(true); - top.ICEcoder.filesFrame.style.opacity="0"; - top.ICEcoder.filesFrame.onload = function() { - top.ICEcoder.filesFrame.style.opacity="1"; - top.ICEcoder.showHide('hide',top.get('loadingMask')); + ICEcoder.showHide('show',get('loadingMask')); + ICEcoder.filesFrame.contentWindow.location.reload(true); + ICEcoder.filesFrame.style.opacity="0"; + ICEcoder.filesFrame.onload = function() { + ICEcoder.filesFrame.style.opacity="1"; + ICEcoder.showHide('hide',get('loadingMask')); } }, @@ -2521,10 +2524,10 @@ var ICEcoder = { // Mac command key handling (224 = Moz, 91/93 = Webkit Left/Right Apple) if (key==224 || key==91 || key==93) { - top.ICEcoder.cmdKey = true; + ICEcoder.cmdKey = true; } - top.ICEcoder.draggingWithKey = evt.ctrlKey||top.ICEcoder.cmdKey ? "CTRL" : false; + ICEcoder.draggingWithKey = evt.ctrlKey||ICEcoder.cmdKey ? "CTRL" : false; }, // Add default drag data (dragging in Firefox on DOM elems not possible otherwise) @@ -2538,15 +2541,15 @@ var ICEcoder = { // Prevent the default and establish if CTRL key is down evt.preventDefault(); - top.ICEcoder.draggingWithKeyTest(evt); + ICEcoder.draggingWithKeyTest(evt); // Establish the cursor to show cursorIcon = dropType == "editor" - ? top.ICEcoder.draggingWithKey == "CTRL" + ? ICEcoder.draggingWithKey == "CTRL" ? "copy" : "link" : dropType == "folder" - ? top.ICEcoder.draggingWithKey == "CTRL" + ? ICEcoder.draggingWithKey == "CTRL" ? "copy" : "move" : "none"; @@ -2560,22 +2563,22 @@ var ICEcoder = { filePath = elem.childNodes[0].childNodes[1].id.replace(/\|/g,"/"); fileName = filePath.substr(filePath.lastIndexOf("/")+1); - if (top.ICEcoder.area=='editor') { - top.ICEcoder.pasteURL(filePath); + if (ICEcoder.area=='editor') { + ICEcoder.pasteURL(filePath); }; - if (top.ICEcoder.area=='files') { + if (ICEcoder.area=='files') { setTimeout(function() { tgtPath = ICEcoder.thisFileFolderType == "folder" ? ICEcoder.thisFileFolderLink : ICEcoder.thisFileFolderLink.substr(0,ICEcoder.thisFileFolderLink.lastIndexOf("|")); - if(top.ICEcoder.draggingWithKey == "CTRL") { - top.ICEcoder.copyFiles(top.ICEcoder.selectedFiles); - top.ICEcoder.pasteFiles(tgtPath); + if(ICEcoder.draggingWithKey == "CTRL") { + ICEcoder.copyFiles(ICEcoder.selectedFiles); + ICEcoder.pasteFiles(tgtPath); } else { - top.ICEcoder.moveFile(filePath,tgtPath.replace(/\|/g,"/") + "/" + fileName); + ICEcoder.moveFile(filePath,tgtPath.replace(/\|/g,"/") + "/" + fileName); } },4); }; - top.ICEcoder.mouseDown=false; - top.ICEcoder.mouseDownInCM=false; + ICEcoder.mouseDown=false; + ICEcoder.mouseDownInCM=false; }, // ============== @@ -2584,10 +2587,10 @@ var ICEcoder = { // Update find & replace options based on user selection findReplaceOptions: function() { - top.get('rText').style.display = - top.get('replace').style.display = - top.get('rTarget').style.display = - document.findAndReplace.connector.value==top.t['and'] + get('rText').style.display = + get('replace').style.display = + get('rTarget').style.display = + document.findAndReplace.connector.value==t['and'] ? "inline-block" : "none"; }, @@ -2597,8 +2600,8 @@ var ICEcoder = { if (isCancel){ // Deselect by setting value to itself, then focus on editor - top.get('find').value = top.get('find').value; - top.ICEcoder.focus(); + get('find').value = get('find').value; + ICEcoder.focus(); return; } // Set findPrevious to false if not passed in @@ -2608,20 +2611,20 @@ var ICEcoder = { // Determine our find & replace strings and results display find = findString.toLowerCase(); - replace = top.get('replace').value; - results = top.get('results'); + replace = get('replace').value; + results = get('results'); // If we have something to find in currrent document cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (thisCM && find.length>0 && document.findAndReplace.target.value==top.t['this document']) { + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if (thisCM && find.length>0 && document.findAndReplace.target.value==t['this document']) { content = thisCM.getValue().toLowerCase(); // Find & replace the next instance, or all? - if (document.findAndReplace.connector.value==top.t['and'] && buttonClick) { - if (document.findAndReplace.replaceAction.value==top.t['replace'] && thisCM.getSelection().toLowerCase()==find) { + if (document.findAndReplace.connector.value==t['and'] && buttonClick) { + if (document.findAndReplace.replaceAction.value==t['replace'] && thisCM.getSelection().toLowerCase()==find) { thisCM.replaceSelection(replace,"around"); - } else if (document.findAndReplace.replaceAction.value==top.t['replace all']) { + } else if (document.findAndReplace.replaceAction.value==t['replace all']) { var rExp = new RegExp(find,"gi"); thisCM.setValue(thisCM.getValue().replace(rExp,replace)); } @@ -2629,7 +2632,7 @@ var ICEcoder = { // Get the content again, as it might of changed content = thisCM.getValue().toLowerCase(); - if (!top.ICEcoder.findMode||find!=top.ICEcoder.lastsearch) { + if (!ICEcoder.findMode||find!=ICEcoder.lastsearch) { ICEcoder.results = []; ICEcoder.resultsLines = []; @@ -2711,28 +2714,28 @@ var ICEcoder = { } // Finally, highlight our selection thisCM.setSelection(cursor.from(), cursor.to()); - top.ICEcoder.focus(); - top.ICEcoder.findMode = true; + ICEcoder.focus(); + ICEcoder.findMode = true; } // Display the find results bar // The avg block is either line height or fraction of space available - avgBlockH = !top.ICEcoder.scrollBarVisible ? thisCM.defaultTextHeight() : parseInt(top.ICEcoder.content.style.height,10)/thisCM.lineCount(); + avgBlockH = !ICEcoder.scrollBarVisible ? thisCM.defaultTextHeight() : parseInt(ICEcoder.content.style.height,10)/thisCM.lineCount(); // Need to add padding if there's no scrollbar, so current line highlighting lines up with it - addPadding = !top.ICEcoder.scrollBarVisible ? thisCM.heightAtLine(0) : 0; + addPadding = !ICEcoder.scrollBarVisible ? thisCM.heightAtLine(0) : 0; rBlocks = ""; for (var i=1; i<=thisCM.lineCount(); i++) { blockColor = ICEcoder.resultsLines.indexOf(i)>-1 ? thisCM.getCursor().line+1 == i ? "#b00" : "#888" : "transparent" rBlocks += '
'; } - top.ICEcoder.content.contentWindow.document.getElementById('resultsBar').innerHTML = rBlocks; - top.ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.display = "inline-block"; + ICEcoder.content.contentWindow.document.getElementById('resultsBar').innerHTML = rBlocks; + ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.display = "inline-block"; return true; } else { results.innerHTML = "No results"; - top.ICEcoder.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; - top.ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; + ICEcoder.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; + ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; return false; } } else { @@ -2741,32 +2744,32 @@ var ICEcoder = { replaceQS = ""; targetQS = ""; filesQS = ""; - if (document.findAndReplace.connector.value==top.t['and']) { + if (document.findAndReplace.connector.value==t['and']) { replaceQS = "&replace="+replace; } - if (document.findAndReplace.target.value.indexOf(top.t['file'])>=0) { + if (document.findAndReplace.target.value.indexOf(t['file'])>=0) { targetQS = "&target="+document.findAndReplace.target.value.replace(/ /g,"-"); } - if (document.findAndReplace.target.value==top.t['selected files']) { - filesQS = "&selectedFiles="+top.ICEcoder.selectedFiles.join(":"); + if (document.findAndReplace.target.value==t['selected files']) { + filesQS = "&selectedFiles="+ICEcoder.selectedFiles.join(":"); } find = find.replace(/\'/g, '\''); find != encodeURIComponent(find) ? find = 'ICEcoder:'+encodeURIComponent(find) : find; - top.ICEcoder.showHide('show',top.get('loadingMask')); - top.get('mediaContainer').innerHTML = ''; + ICEcoder.showHide('show',get('loadingMask')); + get('mediaContainer').innerHTML = ''; // We have nothing to search for, blank it all out } else { results.innerHTML = "No results"; - top.ICEcoder.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; - top.ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; + ICEcoder.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; + ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; } } }, // Replace text in a file replaceInFile: function(fileRef,find,replace) { - top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=replaceText&find="+find+"&replace="+replace+"&csrf="+top.ICEcoder.csrf,encodeURIComponent(fileRef.replace(/\//g,"|"))); - top.ICEcoder.serverMessage(''+top.t['Replacing text in']+'
'+fileRef); + ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=replaceText&find="+find+"&replace="+replace+"&csrf="+ICEcoder.csrf,encodeURIComponent(fileRef.replace(/\//g,"|"))); + ICEcoder.serverMessage(''+t['Replacing text in']+'
'+fileRef); }, // ============== @@ -2779,7 +2782,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; line = thisCM.getCursor().line; ch = thisCM.getCursor().ch; @@ -2796,17 +2799,17 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; ICEcoder.caretLocationType(); ICEcoder.charDisplay.innerHTML = ICEcoder.caretLocType + ", Line: " + (thisCM.getCursor().line+1) + ", Char: " + thisCM.getCursor().ch; }, // Update version display updateVersionsDisplay: function() { - var versionsCount = top.ICEcoder.openFileVersions[ICEcoder.selectedTab-1]; + var versionsCount = ICEcoder.openFileVersions[ICEcoder.selectedTab-1]; get('versionsDisplay').innerHTML = "undefined" != typeof versionsCount - ? top.ICEcoder.openFileVersions[ICEcoder.selectedTab-1] + " backup" + + ? ICEcoder.openFileVersions[ICEcoder.selectedTab-1] + " backup" + (versionsCount != 1 ? "s" : "") : ""; }, @@ -2817,14 +2820,14 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; ICEcoder.byteDisplay.innerHTML = thisCM.getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " bytes"; }, // Toggle the char/byte display showDisplay: function(show) { - top.ICEcoder.byteDisplay.style.display = show == "byte" ? "inline-block" : "none"; - top.ICEcoder.charDisplay.style.display = show == "char" ? "inline-block" : "none"; + ICEcoder.byteDisplay.style.display = show == "byte" ? "inline-block" : "none"; + ICEcoder.charDisplay.style.display = show == "char" ? "inline-block" : "none"; }, // Show & hide target element @@ -2834,7 +2837,7 @@ var ICEcoder = { // Determine the CodeMirror instance we're using getcMInstance: function(tab) { - return top.ICEcoder.content.contentWindow[ + return ICEcoder.content.contentWindow[ // target specific tab !isNaN(tab) ? 'cM'+ICEcoder.cMInstances[tab-1] @@ -2848,7 +2851,7 @@ var ICEcoder = { // Determine the CodeMirror instance we're using getcMdiffInstance: function(tab) { - return top.ICEcoder.content.contentWindow[ + return ICEcoder.content.contentWindow[ (// target specific tab !isNaN(tab) ? 'cM'+ICEcoder.cMInstances[tab-1] @@ -2865,18 +2868,18 @@ var ICEcoder = { getMouseXY: function(e,area) { var tempX, tempY; - top.ICEcoder.mouseX = e.pageX ? e.pageX : e.clientX + document.body.scrollLeft; - top.ICEcoder.mouseY = e.pageY ? e.pageY : e.clientY + document.body.scrollTop; + ICEcoder.mouseX = e.pageX ? e.pageX : e.clientX + document.body.scrollLeft; + ICEcoder.mouseY = e.pageY ? e.pageY : e.clientY + document.body.scrollTop; - top.ICEcoder.area = area; + ICEcoder.area = area; if (area!="top") { - top.ICEcoder.mouseY += 25 + 45; + ICEcoder.mouseY += 25 + 45; } if (area=="editor") { - top.ICEcoder.mouseX += top.ICEcoder.filesW; + ICEcoder.mouseX += ICEcoder.filesW; } - top.ICEcoder.dragCursorTest(); - if (top.ICEcoder.mouseY>62) {top.ICEcoder.setTabWidths();}; + ICEcoder.dragCursorTest(); + if (ICEcoder.mouseY>62) {ICEcoder.setTabWidths();}; }, // Test if we need to show a drag cursor or not @@ -2884,26 +2887,26 @@ var ICEcoder = { var diffX, winH, cursorName, zone; // Dragging tabs, started after dragging for 10px from origin - diffX = top.ICEcoder.mouseX - top.ICEcoder.diffStartX; - if (top.ICEcoder.draggingTab!==false && top.ICEcoder.diffStartX && (diffX <= -10 || diffX >= 10)) { - if (top.ICEcoder.mouseX > parseInt(top.ICEcoder.files.style.width,10)) { - top.ICEcoder.tabDragMouseX = top.ICEcoder.mouseX - parseInt(top.ICEcoder.files.style.width,10) - top.ICEcoder.tabDragMouseXStart; - top.ICEcoder.tabDragMove(); + diffX = ICEcoder.mouseX - ICEcoder.diffStartX; + if (ICEcoder.draggingTab!==false && ICEcoder.diffStartX && (diffX <= -10 || diffX >= 10)) { + if (ICEcoder.mouseX > parseInt(ICEcoder.files.style.width,10)) { + ICEcoder.tabDragMouseX = ICEcoder.mouseX - parseInt(ICEcoder.files.style.width,10) - ICEcoder.tabDragMouseXStart; + ICEcoder.tabDragMove(); } } // Dragging file manager, possible within 7px of file manager edge - if (top.ICEcoder.ready) { + if (ICEcoder.ready) { winH = window.innerHeight; - if (!top.ICEcoder.mouseDown) {top.ICEcoder.draggingFilesW = false}; + if (!ICEcoder.mouseDown) {ICEcoder.draggingFilesW = false}; - cursorName = (!ICEcoder.draggingTab && ((top.ICEcoder.mouseX > top.ICEcoder.filesW-7 && top.ICEcoder.mouseX < top.ICEcoder.filesW+7) || top.ICEcoder.draggingFilesW)) + cursorName = (!ICEcoder.draggingTab && ((ICEcoder.mouseX > ICEcoder.filesW-7 && ICEcoder.mouseX < ICEcoder.filesW+7) || ICEcoder.draggingFilesW)) ? "w-resize" : "auto"; - if (top.ICEcoder.content.contentWindow.document && top.ICEcoder.filesFrame.contentWindow) { - top.document.body.style.cursor = cursorName; - if (zone = top.ICEcoder.content.contentWindow.document.body) {zone.style.cursor = cursorName}; - if (zone = top.ICEcoder.filesFrame.contentWindow.document.body) {zone.style.cursor = cursorName}; + if (ICEcoder.content.contentWindow.document && ICEcoder.filesFrame.contentWindow) { + document.body.style.cursor = cursorName; + if (zone = ICEcoder.content.contentWindow.document.body) {zone.style.cursor = cursorName}; + if (zone = ICEcoder.filesFrame.contentWindow.document.body) {zone.style.cursor = cursorName}; } } }, @@ -2912,9 +2915,9 @@ var ICEcoder = { serverMessage: function(message) { var serverMessage; - serverMessage = top.get('serverMessage'); + serverMessage = get('serverMessage'); if (message) { - serverMessage.innerHTML = top.ICEcoder.xssClean(message).replace(/\<b\>/g,"").replace(/\<\/b\>/g,"").replace(/\<br\>/g,"
"); + serverMessage.innerHTML = ICEcoder.xssClean(message).replace(/\<b\>/g,"").replace(/\<\/b\>/g,"").replace(/\<br\>/g,"
"); serverMessage.style.left = "0"; } else { setTimeout(function() {serverMessage.style.left = "2000px";},200); @@ -2928,7 +2931,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (thisCM) { string = thisCM.getLine(thisCM.getCursor().line); @@ -2936,10 +2939,10 @@ var ICEcoder = { while((match = rx.exec(string)) && thisCM.getCursor().ch > match.index+match[0].length); - oldBlock = top.get('content').contentWindow.document.getElementById('cssColor'); + oldBlock = get('content').contentWindow.document.getElementById('cssColor'); if (oldBlock) {oldBlock.parentNode.removeChild(oldBlock)}; - if (top.ICEcoder.codeAssist && top.ICEcoder.caretLocType=="CSS") { - newBlock = top.document.createElement("div"); + if (ICEcoder.codeAssist && ICEcoder.caretLocType=="CSS") { + newBlock = document.createElement("div"); newBlock.id = "cssColor"; newBlock.style.position = "absolute"; newBlock.style.display = "block"; @@ -2947,25 +2950,25 @@ var ICEcoder = { newBlock.style.zIndex = "1000"; newBlock.style.background = match ? match[0] : ''; newBlock.style.cursor = "pointer"; - newBlock.onclick = function() {top.ICEcoder.showColorPicker(match[0])}; + newBlock.onclick = function() {ICEcoder.showColorPicker(match[0])}; if (newBlock.style.backgroundColor=="") {newBlock.style.display = "none"}; - top.get('header').appendChild(newBlock); - thisCM.addWidget(thisCM.getCursor(), top.get('cssColor'), true); + get('header').appendChild(newBlock); + thisCM.addWidget(thisCM.getCursor(), get('cssColor'), true); } } }, // Show color picker showColorPicker: function(color) { - top.get('blackMask').style.visibility = "visible"; - top.get('mediaContainer').innerHTML = '


'+ + get('blackMask').style.visibility = "visible"; + get('mediaContainer').innerHTML = '


'+ ''+ - '
'+ + '
'+ ''+ - ''; + ''; farbtastic('picker','color'); if (color) { - top.get('picker').farbtastic.setColor(color); + get('picker').farbtastic.setColor(color); } }, @@ -2973,7 +2976,7 @@ var ICEcoder = { initCanvasImage: function (imgThis) { var canvas, img; - canvas = top.get('canvasPicker').getContext('2d'); + canvas = get('canvasPicker').getContext('2d'); img = new Image(); img.crossOrigin = "Anonymous"; @@ -2989,8 +2992,8 @@ var ICEcoder = { // On image load img.onload = function() { // Get width and height and draw this image into the canvas - top.get('canvasPicker').width = imgThis.width; - top.get('canvasPicker').height = imgThis.height; + get('canvasPicker').width = imgThis.width; + get('canvasPicker').height = imgThis.height; canvas.drawImage(img,0,0,imgThis.width,imgThis.height); // Display color picker info and hide CORS message @@ -2998,26 +3001,26 @@ var ICEcoder = { get('canvasPickerCORSInfo').style.display = "none"; // Show image preview box on mouse over - top.get('canvasPicker').onmouseover = function(event) { + get('canvasPicker').onmouseover = function(event) { get('floatingContainer').style.visibility = "visible"; }; // Hide image preview box on mouse out - top.get('canvasPicker').onmouseout = function(event) { + get('canvasPicker').onmouseout = function(event) { get('floatingContainer').style.visibility = "hidden"; }; } - top.document.getElementById('floatingContainer').style.backgroundSize = (imgThis.naturalWidth*5)+"px "+(imgThis.naturalHeight*5)+"px"; + document.getElementById('floatingContainer').style.backgroundSize = (imgThis.naturalWidth*5)+"px "+(imgThis.naturalHeight*5)+"px"; }, // Interact with the canvas image interactCanvasImage: function (imgThis) { var canvas, x, y, imgData, R, G, B, rgb, hex, textColor, fcElem, fcBGX, fcBGY; - canvas = top.get('canvasPicker').getContext('2d'); + canvas = get('canvasPicker').getContext('2d'); // Show pointer colors on mouse move over canvas - top.get('canvasPicker').onmousemove = function(event) { + get('canvasPicker').onmousemove = function(event) { // get mouse x & y x = event.pageX - this.offsetLeft; y = event.pageY - this.offsetTop; @@ -3028,18 +3031,18 @@ var ICEcoder = { B = imgData[2]; rgb = R+','+G+','+B; // Get hex from RGB value - hex = top.ICEcoder.rgbToHex(R,G,B); + hex = ICEcoder.rgbToHex(R,G,B); // set the values & BG colours of the input boxes - top.get('rgbMouseXY').value = rgb; - top.get('hexMouseXY').value = '#' + hex; - top.get('hexMouseXY').style.backgroundColor = top.get('rgbMouseXY').style.backgroundColor = '#' + hex; + get('rgbMouseXY').value = rgb; + get('hexMouseXY').value = '#' + hex; + get('hexMouseXY').style.backgroundColor = get('rgbMouseXY').style.backgroundColor = '#' + hex; textColor = R<128 || G<128 || B<128 && (R<200 && G<200 && B>50) ? '#fff' : '#000'; - top.get('hexMouseXY').style.color = top.get('rgbMouseXY').style.color = textColor; + get('hexMouseXY').style.color = get('rgbMouseXY').style.color = textColor; // Move the floating container to follow mouse pointer fcElem = get('floatingContainer'); - fcElem.style.left = top.ICEcoder.mouseX+20 + "px"; - fcElem.style.top = top.ICEcoder.mouseY + "px"; + fcElem.style.left = ICEcoder.mouseX+20 + "px"; + fcElem.style.top = ICEcoder.mouseY + "px"; // Move the background image for the container to match also // 5 x zoom, account for scaling down of large images and shift 25px of the hover div size // (55px is the 11x11 grid of pixels), minus 5px for centre row/col @@ -3049,17 +3052,17 @@ var ICEcoder = { }; // Set pointer colors on clicking canvas - top.get('canvasPicker').onclick = function() { - top.get('rgb').value = top.get('rgbMouseXY').value; - top.get('hex').value = top.get('hexMouseXY').value; - top.get('hex').style.backgroundColor = top.get('rgb').style.backgroundColor = top.get('hex').value; - top.get('hex').style.color = top.get('rgb').style.color = textColor; + get('canvasPicker').onclick = function() { + get('rgb').value = get('rgbMouseXY').value; + get('hex').value = get('hexMouseXY').value; + get('hex').style.backgroundColor = get('rgb').style.backgroundColor = get('hex').value; + get('hex').style.color = get('rgb').style.color = textColor; } }, // Convert RGB values to Hex rgbToHex: function(R,G,B) { - return top.ICEcoder.toHex(R)+top.ICEcoder.toHex(G)+top.ICEcoder.toHex(B); + return ICEcoder.toHex(R)+ICEcoder.toHex(G)+ICEcoder.toHex(B); }, // Return numbers as hex equivalent @@ -3076,7 +3079,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; cursor = thisCM.getTokenAt(thisCM.getCursor()); thisCM.replaceRange(color,{line:thisCM.getCursor().line,ch:cursor.start},{line:thisCM.getCursor().line,ch:1000000}); }, @@ -3085,7 +3088,7 @@ var ICEcoder = { fMIconVis: function(icon, vis) { var i; - if (i = top.get(icon)) { + if (i = get(icon)) { i.style.opacity = vis; } }, @@ -3094,8 +3097,8 @@ var ICEcoder = { isOpen: function(file) { var i; - file = file.replace(/\|/g, "/").replace(top.docRoot+top.iceRoot,""); - i = top.ICEcoder.openFiles.indexOf(file); + file = file.replace(/\|/g, "/").replace(docRoot+iceRoot,""); + i = ICEcoder.openFiles.indexOf(file); // return the array position or false return i!=-1 ? i : false; }, @@ -3108,41 +3111,41 @@ var ICEcoder = { startPluginIntervals: function(plugRef,plugURL,plugTarget,plugTimer) { // Add CSRF to URL if it has QS params if (plugURL.indexOf("?") > -1) { - plugURL = plugURL+"&csrf="+top.ICEcoder.csrf; + plugURL = plugURL+"&csrf="+ICEcoder.csrf; } - top.ICEcoder['plugTimer'+plugRef] = + ICEcoder['plugTimer'+plugRef] = // This window instances ["_parent","_top","_self",""].indexOf(plugTarget) > -1 - ? top.ICEcoder['plugTimer'+plugRef] = setInterval('window.location=\''+plugURL+'\'',plugTimer*1000*60) + ? ICEcoder['plugTimer'+plugRef] = setInterval('window.location=\''+plugURL+'\'',plugTimer*1000*60) // fileControl iframe instances : plugTarget.indexOf("fileControl") == 0 - ? top.ICEcoder['plugTimer'+plugRef] = setInterval(function() { - top.ICEcoder.serverQueue("add",plugURL);top.ICEcoder.serverMessage(plugTarget.split(":")[1]); + ? ICEcoder['plugTimer'+plugRef] = setInterval(function() { + ICEcoder.serverQueue("add",plugURL);ICEcoder.serverMessage(plugTarget.split(":")[1]); },plugTimer*1000*60) // _blank or named target window instances - : top.ICEcoder['plugTimer'+plugRef] = setInterval('window.open(\''+plugURL+'\',\''+plugTarget+'\')',plugTimer*1000*60); + : ICEcoder['plugTimer'+plugRef] = setInterval('window.open(\''+plugURL+'\',\''+plugTarget+'\')',plugTimer*1000*60); // push the plugin ref into our array - top.ICEcoder.pluginIntervalRefs.push(plugRef); + ICEcoder.pluginIntervalRefs.push(plugRef); }, // Turning on/off the Code Assist codeAssistToggle: function() { var cM, cMdiff, fileName, fileExt; - top.ICEcoder.codeAssist = !top.ICEcoder.codeAssist; - top.get('codeAssistDisplay').style.backgroundPosition = top.ICEcoder.codeAssist ? "0 0" : "-16px 0"; - top.ICEcoder.cssColorPreview(); - top.ICEcoder.focus(top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? 'diff' : false); + ICEcoder.codeAssist = !ICEcoder.codeAssist; + get('codeAssistDisplay').style.backgroundPosition = ICEcoder.codeAssist ? "0 0" : "-16px 0"; + ICEcoder.cssColorPreview(); + ICEcoder.focus(ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? 'diff' : false); - for (i=0;i0 || item.indexOf('fileVersion=undefined')>0) { - top.get('saveTemp'+nextSaveID).value = cM.getValue(); + get('saveTemp'+nextSaveID).value = cM.getValue(); // Else we can save the JSON version of the changes to implement } else { - top.get('saveTemp'+nextSaveID).value = changes; + get('saveTemp'+nextSaveID).value = changes; } } } else if (action=="del") { if (ICEcoder.serverQueueItems[0] && ICEcoder.serverQueueItems[0].indexOf('action=save')>0) { topSaveID = nextSaveID-1; for (var i=1;i=1 || ICEcoder.serverQueueItems.length==1) { // If we have an item, we're not saving previous file refs and not loading if (item && (item.indexOf('saveFiles=')==-1 && item.indexOf('action=load')==-1)) { - xhr = top.ICEcoder.xhrObj(); + xhr = ICEcoder.xhrObj(); xhr.onreadystatechange=function() { if (xhr.readyState==4) { // OK reponse? @@ -3222,30 +3225,30 @@ var ICEcoder = { statusObj.action.timeTaken = statusObj.action.timeEnd - statusObj.action.timeStart; // User wanted raw (or both) output of the response? - if (["raw","both"].indexOf(top.ICEcoder.fileDirResOutput) >= 0) { + if (["raw","both"].indexOf(ICEcoder.fileDirResOutput) >= 0) { console.log(xhr.responseText); } // User wanted object (or both) output of the response? - if (["object","both"].indexOf(top.ICEcoder.fileDirResOutput) >= 0) { + if (["object","both"].indexOf(ICEcoder.fileDirResOutput) >= 0) { console.log(statusObj); } // If error, show that, otherwise do whatever we're required to do next if (statusObj.status.error) { - top.ICEcoder.message(statusObj.status.errorMsg); + ICEcoder.message(statusObj.status.errorMsg); console.log("ICEcoder error info for your request..."); console.log(statusObj); - top.ICEcoder.serverMessage(); - top.ICEcoder.serverQueue('del',0); + ICEcoder.serverMessage(); + ICEcoder.serverQueue('del',0); } else { eval(statusObj.action.doNext); } // Some other response? Display a message about that } else { - top.ICEcoder.message(top.t['Sorry there was...']); + ICEcoder.message(t['Sorry there was...']); console.log("ICEcoder error info for your request..."); console.log(statusObj); - top.ICEcoder.serverMessage(); - top.ICEcoder.serverQueue('del',0); + ICEcoder.serverMessage(); + ICEcoder.serverQueue('del',0); } } }; @@ -3255,10 +3258,10 @@ var ICEcoder = { // Save as events need to send all contents if (item.indexOf('action=saveAs')>0) { - xhr.send('timeStart='+timeStart+'&file='+file+'&contents='+encodeURIComponent(top.document.getElementById('saveTemp1').value)); + xhr.send('timeStart='+timeStart+'&file='+file+'&contents='+encodeURIComponent(document.getElementById('saveTemp1').value)); // Save evens can just sent the changes } else if (item.indexOf('action=save')>0) { - xhr.send('timeStart='+timeStart+'&file='+file+'&changes='+encodeURIComponent(top.document.getElementById('saveTemp1').value)); + xhr.send('timeStart='+timeStart+'&file='+file+'&changes='+encodeURIComponent(document.getElementById('saveTemp1').value)); // Another type of event } else { xhr.send('timeStart='+timeStart+'&file='+file); @@ -3267,7 +3270,7 @@ var ICEcoder = { setTimeout(function() { if ("undefined" != typeof ICEcoder.serverQueueItems[0]) { - top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href=ICEcoder.serverQueueItems[0]; + ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href=ICEcoder.serverQueueItems[0]; } },1); @@ -3282,20 +3285,20 @@ var ICEcoder = { if (ICEcoder.serverQueueItems.length>0) { ICEcoder.serverQueueItems.splice(1,ICEcoder.serverQueueItems.length); } - top.ICEcoder.showHide('hide',top.get('loadingMask')); - top.ICEcoder.serverMessage(''+top.t['Cancelled tasks']+''); - setTimeout(function() {top.ICEcoder.serverMessage();},2000); + ICEcoder.showHide('hide',get('loadingMask')); + ICEcoder.serverMessage(''+t['Cancelled tasks']+''); + setTimeout(function() {ICEcoder.serverMessage();},2000); }, // Set the current previousFiles in the settings file setPreviousFiles: function() { var previousFiles; - previousFiles = top.ICEcoder.openFiles.join(',').replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,""); + previousFiles = ICEcoder.openFiles.join(',').replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,""); if (previousFiles=="") {previousFiles="CLEAR"}; // Then send through to the settings page to update setting - top.ICEcoder.serverQueue("add","lib/settings.php?saveFiles="+encodeURIComponent(previousFiles)+"&csrf="+top.ICEcoder.csrf); - top.ICEcoder.updateLast10List(previousFiles); + ICEcoder.serverQueue("add",iceLoc+"/lib/settings.php?saveFiles="+encodeURIComponent(previousFiles)+"&csrf="+ICEcoder.csrf); + ICEcoder.updateLast10List(previousFiles); }, // Update the list of 10 previous files in browser @@ -3308,10 +3311,10 @@ 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 = top.ICEcoder.content.contentWindow.document.getElementById('last10Files'); + last10Files = ICEcoder.content.contentWindow.document.getElementById('last10Files'); // If the innerHTML of that doesn't contain our new item, we can insert it if(last10Files.innerHTML.indexOf(newFile) == -1) { @@ -3333,11 +3336,11 @@ var ICEcoder = { // Opens the last files we had open autoOpenFiles: function() { - if (top.ICEcoder.previousFiles.length>0 && top.ICEcoder.ask(top.t['Open previous files']+'\n\n'+top.ICEcoder.previousFiles.length+' files:\n'+top.ICEcoder.previousFiles.join('\n').replace(/\|/g,"/").replace(new RegExp(top.docRoot+top.iceRoot,'gi'),""))) { - for (var i=0;i0 && ICEcoder.ask(t['Open previous files']+'\n\n'+ICEcoder.previousFiles.length+' files:\n'+ICEcoder.previousFiles.join('\n').replace(/\|/g,"/").replace(new RegExp(docRoot+iceRoot,'gi'),""))) { + for (var i=0;i'; } - top.ICEcoder.showHide(hide?'hide':'show',top.get('blackMask')); + ICEcoder.showHide(hide?'hide':'show',get('blackMask')); }, // Show the help screen helpScreen: function() { - top.get('mediaContainer').innerHTML = ''; - top.ICEcoder.showHide('show',top.get('blackMask')); + get('mediaContainer').innerHTML = ''; + ICEcoder.showHide('show',get('blackMask')); }, // Show the backup versions screen versionsScreen: function(file,versions) { - top.get('mediaContainer').innerHTML = ''; - top.ICEcoder.showHide('show',top.get('blackMask')); + get('mediaContainer').innerHTML = ''; + ICEcoder.showHide('show',get('blackMask')); }, // Show the ICEcoder manual, loaded remotely @@ -3367,43 +3370,43 @@ var ICEcoder = { var sectionExtra; sectionExtra = section ? "#"+section : ""; - top.get('mediaContainer').innerHTML = ''; - top.ICEcoder.showHide('show',top.get('blackMask')); + get('mediaContainer').innerHTML = ''; + ICEcoder.showHide('show',get('blackMask')); }, // Show the properties screen propertiesScreen: function(fileName) { - top.get('mediaContainer').innerHTML = ''; - top.ICEcoder.showHide('show',top.get('blackMask')); + get('mediaContainer').innerHTML = ''; + ICEcoder.showHide('show',get('blackMask')); }, // Show the auto-logout warning screen autoLogoutWarningScreen: function() { - top.get('mediaContainer').innerHTML = ''; - top.ICEcoder.showHide('show',top.get('blackMask')); + get('mediaContainer').innerHTML = ''; + ICEcoder.showHide('show',get('blackMask')); }, // Show the plugins manager pluginsManager: function() { - top.get('mediaContainer').innerHTML = ''; - top.ICEcoder.showHide('show',top.get('blackMask')); + get('mediaContainer').innerHTML = ''; + ICEcoder.showHide('show',get('blackMask')); }, // Go to localhost root goLocalhostRoot: function() { - top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = "lib/go-localhost-root.php"; + ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/go-localhost-root.php"; }, // Show the GitHub commit screen githubAction: function(action) { - top.get('mediaContainer').innerHTML = ''; - top.ICEcoder.showHide('show',top.get('blackMask')); + get('mediaContainer').innerHTML = ''; + ICEcoder.showHide('show',get('blackMask')); }, // Ask user for GitHub token githubTokenAsk: function(goNext) { - if (githubAuthToken = top.ICEcoder.getInput(top.t['Please enter your...'],'')) { - top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = "lib/github.php?action=auth&token="+githubAuthToken+"&goNext="+goNext+"&csrf="+top.ICEcoder.csrf; + if (githubAuthToken = ICEcoder.getInput(t['Please enter your...'],'')) { + ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/github.php?action=auth&token="+githubAuthToken+"&goNext="+goNext+"&csrf="+ICEcoder.csrf; // Clear the token from the var for security githubAuthToken = ""; } @@ -3411,18 +3414,18 @@ var ICEcoder = { // Show/Hide the GitHub file nav showHideGithubNav: function(vis) { - top.get('githubNav').style.display = vis == "show" ? "block" : "none"; - top.get('fileNav').style.display = vis == "show" ? "none" : "block"; + get('githubNav').style.display = vis == "show" ? "block" : "none"; + get('fileNav').style.display = vis == "show" ? "none" : "block"; }, // Show the GitHub manager githubManager: function() { var githubAuthToken; - if (top.ICEcoder.githubAuthTokenSet) { - top.get('mediaContainer').innerHTML = ''; - top.ICEcoder.showHide('show',top.get('blackMask')); + if (ICEcoder.githubAuthTokenSet) { + get('mediaContainer').innerHTML = ''; + ICEcoder.showHide('show',get('blackMask')); } else { - top.ICEcoder.githubTokenAsk('showManager'); + ICEcoder.githubTokenAsk('showManager'); } }, @@ -3430,20 +3433,20 @@ var ICEcoder = { githubDiffToggle: function() { var gHDiff; - if (!top.ICEcoder.githubAuthTokenSet) { - top.ICEcoder.githubTokenAsk('loadFiles'); - } else if (top.ICEcoder.githubDiff || top.ICEcoder.ask(top.t['This will compare...'])) { - top.ICEcoder.githubDiff = !top.ICEcoder.githubDiff; - gHDiff = top.ICEcoder.githubDiff ? "true" : "false"; + if (!ICEcoder.githubAuthTokenSet) { + ICEcoder.githubTokenAsk('loadFiles'); + } else if (ICEcoder.githubDiff || ICEcoder.ask(t['This will compare...'])) { + ICEcoder.githubDiff = !ICEcoder.githubDiff; + gHDiff = ICEcoder.githubDiff ? "true" : "false"; - top.ICEcoder.filesFrame.src = "files.php?githubDiff="+gHDiff+"&csrf="+top.ICEcoder.csrf; + ICEcoder.filesFrame.src = "files.php?githubDiff="+gHDiff+"&csrf="+ICEcoder.csrf; } }, // Show the FTP manager ftpManager: function() { - top.get('mediaContainer').innerHTML = ''; - top.ICEcoder.showHide('show',top.get('blackMask')); + get('mediaContainer').innerHTML = ''; + ICEcoder.showHide('show',get('blackMask')); }, // Update the settings used when we make a change to them @@ -3455,46 +3458,46 @@ var ICEcoder = { // find out new theme name without leading path and trailing ".css" var newTheme = cleanThemeUrl.slice(cleanThemeUrl.lastIndexOf("/")+1,cleanThemeUrl.lastIndexOf(".")); // if theme was not changed - no need to do all these tricks - if (top.ICEcoder.theme !== newTheme){ + if (ICEcoder.theme !== newTheme){ // Add new stylesheet for selected theme to editor - top.ICEcoder.theme = newTheme; - if (top.ICEcoder.theme=="editor") {top.ICEcoder.theme="icecoder"}; + ICEcoder.theme = newTheme; + if (ICEcoder.theme=="editor") {ICEcoder.theme="icecoder"}; styleNode = document.createElement('link'); styleNode.setAttribute('rel', 'stylesheet'); styleNode.setAttribute('type', 'text/css'); styleNode.setAttribute('href', themeURL); - top.ICEcoder.content.contentWindow.document.getElementsByTagName('head')[0].appendChild(styleNode); + ICEcoder.content.contentWindow.document.getElementsByTagName('head')[0].appendChild(styleNode); // Add new stylesheet for selected theme to top level (used by Minimap) styleNode = document.createElement('link'); styleNode.setAttribute('rel', 'stylesheet'); styleNode.setAttribute('type', 'text/css'); styleNode.setAttribute('href', themeURL); - top.document.getElementsByTagName('head')[0].appendChild(styleNode); - if (["3024-day","base16-light","eclipse","elegant","mdn-like","neat","neo","paraiso-light","solarized","the-matrix","xq-light"].indexOf(top.ICEcoder.theme)>-1) { + document.getElementsByTagName('head')[0].appendChild(styleNode); + if (["3024-day","base16-light","eclipse","elegant","mdn-like","neat","neo","paraiso-light","solarized","the-matrix","xq-light"].indexOf(ICEcoder.theme)>-1) { activeLineBG = "#ccc"; - } else if (["3024-night","blackboard","colorforth","liquibyte","night","tomorrow-night-bright","tomorrow-night-eighties","vibrant-ink"].indexOf(top.ICEcoder.theme)>-1) { + } else if (["3024-night","blackboard","colorforth","liquibyte","night","tomorrow-night-bright","tomorrow-night-eighties","vibrant-ink"].indexOf(ICEcoder.theme)>-1) { activeLineBG = "#888"; } else { activeLineBG = "#000"; } - top.ICEcoder.switchTab(top.ICEcoder.selectedTab); + ICEcoder.switchTab(ICEcoder.selectedTab); } // Check/uncheck Code Assist setting - if (codeAssist != top.ICEcoder.codeAssist) { - top.get('codeAssist').checked = codeAssist; - top.ICEcoder.codeAssistToggle(); + if (codeAssist != ICEcoder.codeAssist) { + get('codeAssist').checked = codeAssist; + ICEcoder.codeAssistToggle(); } // Unlock/lock the file manager - if (lockedNav != top.ICEcoder.lockedNav) { - top.ICEcoder.lockUnlockNav(); + if (lockedNav != ICEcoder.lockedNav) { + ICEcoder.lockUnlockNav(); ICEcoder.changeFilesW(!lockedNav ? 'contract' : 'expand'); - top.ICEcoder.hideFileMenu(); + ICEcoder.hideFileMenu(); }; // Update font size at top level - thisCSS = top.document.styleSheets[0]; + thisCSS = document.styleSheets[0]; strCSS = thisCSS.rules ? 'rules' : 'cssRules'; thisCSS[strCSS][0].style['fontSize'] = fontSize; @@ -3511,86 +3514,86 @@ var ICEcoder = { thisCSS[strCSS][4].style['margin-left'] = visibleTabs ? '-1px' : '0'; thisCSS[strCSS][2].style.cssText = "background-color: " + activeLineBG + " !important"; - top.ICEcoder.lineWrapping = lineWrapping; - top.ICEcoder.lineNumbers = lineNumbers; - top.ICEcoder.showTrailingSpace = showTrailingSpace; - top.ICEcoder.matchBrackets = matchBrackets; - top.ICEcoder.autoCloseTags = autoCloseTags; - top.ICEcoder.autoCloseBrackets = autoCloseBrackets; - top.ICEcoder.indentWithTabs = indentWithTabs; - top.ICEcoder.indentSize = indentSize; - top.ICEcoder.indentAuto = indentAuto; + ICEcoder.lineWrapping = lineWrapping; + ICEcoder.lineNumbers = lineNumbers; + ICEcoder.showTrailingSpace = showTrailingSpace; + ICEcoder.matchBrackets = matchBrackets; + ICEcoder.autoCloseTags = autoCloseTags; + ICEcoder.autoCloseBrackets = autoCloseBrackets; + ICEcoder.indentWithTabs = indentWithTabs; + ICEcoder.indentSize = indentSize; + ICEcoder.indentAuto = indentAuto; for (var i=0;ichMod '+perms+' on
    '+file.replace(/\|/g,"/")); + file = file.replace(iceRoot,""); + ICEcoder.showHide('hide',get('blackMask')); + ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=perms&perms="+perms+"&csrf="+ICEcoder.csrf,encodeURIComponent(file)); + ICEcoder.serverMessage('chMod '+perms+' on
    '+file.replace(/\|/g,"/")); }, // Open/show the preview window openPreviewWindow: function() { - if (top.ICEcoder.openFiles.length>0) { + if (ICEcoder.openFiles.length>0) { var cM, cMdiff, thisCM, filepath, filename, fileExt; - filepath = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]; + filepath = ICEcoder.openFiles[ICEcoder.selectedTab-1]; filename = filepath.substr(filepath.lastIndexOf("/")+1); fileExt = filename.substr(filename.lastIndexOf(".")+1); cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - top.ICEcoder.previewWindowLoading = true; - top.ICEcoder.previewWindow = window.open(filepath,"previewWindow",500,500); + ICEcoder.previewWindowLoading = true; + ICEcoder.previewWindow = window.open(filepath,"previewWindow",500,500); if (["md"].indexOf(fileExt) > -1) { - top.ICEcoder.previewWindow.onload = function() { - top.ICEcoder.previewWindowLoading = false; - top.ICEcoder.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()) + ICEcoder.previewWindow.onload = function() { + ICEcoder.previewWindowLoading = false; + ICEcoder.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()) }; } else { - top.ICEcoder.previewWindow.onload = function() { - top.ICEcoder.previewWindowLoading = false; + ICEcoder.previewWindow.onload = function() { + ICEcoder.previewWindowLoading = false; // Do the pesticide plugin if it exists - try {top.ICEcoder.doPesticide();} catch(err) {}; + try {ICEcoder.doPesticide();} catch(err) {}; // Do the stats.js plugin if it exists - try {top.ICEcoder.doStatsJS('open');} catch(err) {}; + try {ICEcoder.doStatsJS('open');} catch(err) {}; // Do the responsive plugin if it exists - try {top.ICEcoder.doResponsive();} catch(err) {}; + try {ICEcoder.doResponsive();} catch(err) {}; } } } @@ -3662,20 +3665,20 @@ var ICEcoder = { // Reset auto-logout timer resetAutoLogoutTimer: function() { - if(top.ICEcoder.autoLogoutMins > 1 && top.ICEcoder.autoLogoutTimer > (top.ICEcoder.autoLogoutMins*60)-60) { + if(ICEcoder.autoLogoutMins > 1 && ICEcoder.autoLogoutTimer > (ICEcoder.autoLogoutMins*60)-60) { ICEcoder.showHide('hide',get('blackMask')); } - top.ICEcoder.autoLogoutTimer = 0; + ICEcoder.autoLogoutTimer = 0; }, // Logout of ICEcoder logout: function(type) { - window.location = window.location + "?logout&"+(type ? "type="+type+"&" : "")+"csrf="+top.ICEcoder.csrf; + window.location = window.location + "?logout&"+(type ? "type="+type+"&" : "")+"csrf="+ICEcoder.csrf; }, // Show a message outputMsg: function(msg) { - top.ICEcoder.output.innerHTML += msg + "
    "; + ICEcoder.output.innerHTML += msg + "
    "; }, // Show a message @@ -3697,7 +3700,7 @@ var ICEcoder = { dataMessage: function(message) { var dM; - dM = top.ICEcoder.content.contentWindow.document.getElementById('dataMessage'); + dM = ICEcoder.content.contentWindow.document.getElementById('dataMessage'); dM.style.display = "block"; dM.innerHTML = message; }, @@ -3706,10 +3709,10 @@ var ICEcoder = { update: function() { var autoUpdate; - autoUpdate = confirm(top.t['Please note for...']); + autoUpdate = confirm(t['Please note for...']); if (autoUpdate) { - top.ICEcoder.showHide('show',top.get('loadingMask')); - window.location = "lib/updater.php"; + ICEcoder.showHide('show',get('loadingMask')); + window.location = iceLoc+"/lib/updater.php"; } else { window.open("https://icecoder.net"); } @@ -3717,8 +3720,8 @@ var ICEcoder = { // ICEcoder just updated updated: function() { - top.get('blackMask').style.visibility = "visible"; - top.get('mediaContainer').innerHTML = '

    Thanks for updating to v'+top.ICEcoder.versionNo+'!

    ' + get('blackMask').style.visibility = "visible"; + get('mediaContainer').innerHTML = '

    Thanks for updating to v'+ICEcoder.versionNo+'!

    ' + '

    Click anywhere to continue using ICEcoder...

    '; }, @@ -3737,23 +3740,23 @@ var ICEcoder = { openBugReport: function() { var bugReportOpenFilePos; - if(top.ICEcoder.bugReportStatus=="off") { - top.ICEcoder.message(top.t['You can start...']); + if(ICEcoder.bugReportStatus=="off") { + ICEcoder.message(t['You can start...']); } - if(top.ICEcoder.bugReportStatus=="error") { - top.ICEcoder.message(top.t['Error cannot find...']); + if(ICEcoder.bugReportStatus=="error") { + ICEcoder.message(t['Error cannot find...']); } - if(top.ICEcoder.bugReportStatus=="ok") { - top.ICEcoder.message(top.t['No new errors...']); + if(ICEcoder.bugReportStatus=="ok") { + ICEcoder.message(t['No new errors...']); } - if(top.ICEcoder.bugReportStatus=="bugs") { + if(ICEcoder.bugReportStatus=="bugs") { // Close bug-report without saving previousFiles and without confirming close if we made changes on the bug report - var bugReportOpenFilePos = top.ICEcoder.openFiles.indexOf(top.ICEcoder.bugReportPath.replace(/\|/g,"/")); + var bugReportOpenFilePos = ICEcoder.openFiles.indexOf(ICEcoder.bugReportPath.replace(/\|/g,"/")); if (bugReportOpenFilePos > -1) { - top.ICEcoder.closeTab(bugReportOpenFilePos+1,'dontSetPV','dontAsk'); + ICEcoder.closeTab(bugReportOpenFilePos+1,'dontSetPV','dontAsk'); } - top.ICEcoder.openFile(top.ICEcoder.bugReportPath); - top.ICEcoder.bugFilesSizesSeen = top.ICEcoder.bugFilesSizesActual; + ICEcoder.openFile(ICEcoder.bugReportPath); + ICEcoder.bugFilesSizesSeen = ICEcoder.bugFilesSizesActual; } }, @@ -3761,28 +3764,28 @@ var ICEcoder = { startBugChecking: function() { var bugCheckURL; - if (top.ICEcoder.bugFileCheckTimer !== 0) { + if (ICEcoder.bugFileCheckTimer !== 0) { // Clear any existing interval - if ("undefined" != typeof top.ICEcoder.bugFileCheckInt) { - clearInterval(top.ICEcoder.bugFileCheckInt); + if ("undefined" != typeof ICEcoder.bugFileCheckInt) { + clearInterval(ICEcoder.bugFileCheckInt); } // Start a new timer - top.ICEcoder.bugFilesSizesSeen = []; - top.ICEcoder.bugFileCheckInt = setInterval(function() { - bugCheckURL = "lib/bug-files-check.php?"; - bugCheckURL += "files="+(top.ICEcoder.bugFilePaths[0] !== "" ? top.ICEcoder.bugFilePaths.join() : "null").replace(/\//g,"|"); + ICEcoder.bugFilesSizesSeen = []; + ICEcoder.bugFileCheckInt = setInterval(function() { + bugCheckURL = iceLoc+"/lib/bug-files-check.php?"; + bugCheckURL += "files="+(ICEcoder.bugFilePaths[0] !== "" ? ICEcoder.bugFilePaths.join() : "null").replace(/\//g,"|"); bugCheckURL += "&filesSizesSeen="; - if (top.ICEcoder.bugFilesSizesSeen.length != top.ICEcoder.bugFilePaths.length) { + if (ICEcoder.bugFilesSizesSeen.length != ICEcoder.bugFilePaths.length) { // Fill the array with nulls - for (var i=0; i -1 ? cMdiff : cM; - printIFrame = top.ICEcoder.filesFrame.contentWindow.frames['fileControl']; + cM = ICEcoder.getcMInstance(); + cMdiff = ICEcoder.getcMdiffInstance(); + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + printIFrame = ICEcoder.filesFrame.contentWindow.frames['fileControl']; // Print page content injected into iFrame, escaped with pre and xssClean - printIFrame.window.document.body.innerHTML = 'ICEcoder code output
    '+top.ICEcoder.xssClean(thisCM.getValue())+'
    '; + printIFrame.window.document.body.innerHTML = 'ICEcoder code output
    '+ICEcoder.xssClean(thisCM.getValue())+'
    '; printIFrame.focus(); printIFrame.print(); // Focus back on code @@ -3848,16 +3851,16 @@ var ICEcoder = { indicateChanges: function() { var winTitle; - if (!top.ICEcoder.loadingFile) { - winTitle = "ICEcoder v "+top.ICEcoder.versionNo; - for(var i=1;i<=top.ICEcoder.savedPoints.length;i++) { - if (top.ICEcoder.savedPoints[i-1]!=top.ICEcoder.getcMInstance(i).changeGeneration()) { + if (!ICEcoder.loadingFile) { + winTitle = "ICEcoder v "+ICEcoder.versionNo; + for(var i=1;i<=ICEcoder.savedPoints.length;i++) { + if (ICEcoder.savedPoints[i-1]!=ICEcoder.getcMInstance(i).changeGeneration()) { // We have an unsaved tab, indicate that in the title winTitle += " \u2744"; break; } } - top.document.title = winTitle; + document.title = winTitle; } }, @@ -3870,15 +3873,15 @@ var ICEcoder = { var cM, cMdiff, thisCM; // If we're not switching to same tab (for some reason), note the previous tab - if (newTab !== top.ICEcoder.selectedTab) { - top.ICEcoder.prevTab = top.ICEcoder.selectedTab; + if (newTab !== ICEcoder.selectedTab) { + ICEcoder.prevTab = ICEcoder.selectedTab; } // Identify tab that's currently selected & get the instance ICEcoder.selectedTab = newTab; cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (thisCM) { // Switch mode to HTML, PHP, CSS etc @@ -3889,48 +3892,48 @@ var ICEcoder = { ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]].getWrapperElement().style.display = "none"; ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]+'diff'].getWrapperElement().style.display = "none"; } - cM.setOption('theme',top.ICEcoder.theme); - cMdiff.setOption('theme',top.ICEcoder.theme + " diff"); + cM.setOption('theme',ICEcoder.theme); + cMdiff.setOption('theme',ICEcoder.theme + " diff"); cM.getWrapperElement().style.display = "block"; cMdiff.getWrapperElement().style.display = "block"; // Redo our diffs if split pane - if (top.ICEcoder.splitPane) { - top.ICEcoder.updateDiffs(); + if (ICEcoder.splitPane) { + ICEcoder.updateDiffs(); } // Focus on & refresh our selected instance - if (!noFocus) {setTimeout(function() {top.ICEcoder.focus();},4);} + if (!noFocus) {setTimeout(function() {ICEcoder.focus();},4);} cM.refresh(); cMdiff.refresh(); - top.ICEcoder.updateFunctionClassList(); + ICEcoder.updateFunctionClassList(); // Update the minimap nav - if ("undefined" != typeof top.doMiniNav) { - clearTimeout(top.doMiniNav); + if ("undefined" != typeof doMiniNav) { + clearTimeout(doMiniNav); } - top.doMiniNav = setTimeout(function() { - top.ICEcoder.setMinimap(); - },top.ICEcoder.loadingFile ? 0 : 100); + doMiniNav = setTimeout(function() { + ICEcoder.setMinimap(); + },ICEcoder.loadingFile ? 0 : 100); get('docExplorer').style.display = "block"; get('docExplorer').style.right = "-400px"; - top.ICEcoder.highlightGitDiffs(); + ICEcoder.highlightGitDiffs(); // Highlight the selected tab ICEcoder.redoTabHighlight(ICEcoder.selectedTab); // Redo our find display - top.ICEcoder.findMode = false; - ICEcoder.findReplace(top.get('find').value,true,false); + ICEcoder.findMode = false; + ICEcoder.findReplace(get('find').value,true,false); // Update our versions display - top.ICEcoder.updateVersionsDisplay(); + ICEcoder.updateVersionsDisplay(); // Finally, update the cursor display - top.ICEcoder.getCaretPosition(); - top.ICEcoder.updateCharDisplay(); - top.ICEcoder.updateByteDisplay(); + ICEcoder.getCaretPosition(); + ICEcoder.updateCharDisplay(); + ICEcoder.updateByteDisplay(); } }, @@ -3951,13 +3954,13 @@ var ICEcoder = { cM = ICEcoder.getcMInstance('new'); ICEcoder.switchTab(ICEcoder.openFiles.length); - cM.removeLineClass(ICEcoder['cMActiveLinecM'+ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]], "background"); + cM.removeLineClass(ICEcoder['cMActiveLinecM'+ICEcoder.cMInstances[ICEcoder.selectedTab-1]], "background"); ICEcoder['cMActiveLinecM'+ICEcoder.selectedTab] = cM.addLineClass(0, "background", "cm-s-activeLine"); ICEcoder.nextcMInstance++; // Also save? if (alsoSave) { - top.ICEcoder.saveFile(); + ICEcoder.saveFile(); } }, @@ -3966,28 +3969,28 @@ var ICEcoder = { var closeTabLink, fileName; // Push new file into array - top.ICEcoder.openFiles.push(top.ICEcoder.shortURL); + ICEcoder.openFiles.push(ICEcoder.shortURL); // Setup a new tab - closeTabLink = ''; - top.get('tab'+(top.ICEcoder.openFiles.length)).style.display = "inline-block"; - fileName = top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1]; - top.get('tab'+(top.ICEcoder.openFiles.length)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); - top.get('tab'+(top.ICEcoder.openFiles.length)).title = "/" + top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1].replace(/\//,""); + closeTabLink = ''; + get('tab'+(ICEcoder.openFiles.length)).style.display = "inline-block"; + fileName = ICEcoder.openFiles[ICEcoder.openFiles.length-1]; + get('tab'+(ICEcoder.openFiles.length)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); + get('tab'+(ICEcoder.openFiles.length)).title = "/" + ICEcoder.openFiles[ICEcoder.openFiles.length-1].replace(/\//,""); // Set the widths - top.ICEcoder.setTabWidths(); + ICEcoder.setTabWidths(); // Highlight it and state it's selected - top.ICEcoder.redoTabHighlight(top.ICEcoder.openFiles.length); - top.ICEcoder.selectedTab=top.ICEcoder.openFiles.length; + ICEcoder.redoTabHighlight(ICEcoder.openFiles.length); + ICEcoder.selectedTab=ICEcoder.openFiles.length; // Add a new value ready to indicate if this content has been changed - top.ICEcoder.savedPoints.push(0); - top.ICEcoder.savedContents.push(""); + ICEcoder.savedPoints.push(0); + ICEcoder.savedContents.push(""); if (!isNew) { - top.ICEcoder.setPreviousFiles(); + ICEcoder.setPreviousFiles(); } }, @@ -3995,16 +3998,16 @@ var ICEcoder = { nextTab: function() { var goToTab; - goToTab = top.ICEcoder.selectedTab+1 <= top.ICEcoder.openFiles.length ? top.ICEcoder.selectedTab+1 : 1; - top.ICEcoder.switchTab(goToTab,'noFocus'); + goToTab = ICEcoder.selectedTab+1 <= ICEcoder.openFiles.length ? ICEcoder.selectedTab+1 : 1; + ICEcoder.switchTab(goToTab,'noFocus'); }, // Cycle to next tab previousTab: function() { var goToTab; - goToTab = top.ICEcoder.selectedTab-1 >= 1 ? top.ICEcoder.selectedTab-1 : top.ICEcoder.openFiles.length; - top.ICEcoder.switchTab(goToTab,'noFocus'); + goToTab = ICEcoder.selectedTab-1 >= 1 ? ICEcoder.selectedTab-1 : ICEcoder.openFiles.length; + ICEcoder.switchTab(goToTab,'noFocus'); }, // Create a new tab for a file @@ -4012,13 +4015,13 @@ var ICEcoder = { var closeTabLink, fileName; // Push new file into array - top.ICEcoder.openFiles[tabNum-1] = newName; + ICEcoder.openFiles[tabNum-1] = newName; // Setup a new tab - closeTabLink = ''; - fileName = top.ICEcoder.openFiles[tabNum-1]; - top.get('tab'+tabNum).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); - top.get('tab'+tabNum).title = "/" + top.ICEcoder.openFiles[tabNum-1].replace(/\//,""); + closeTabLink = ''; + fileName = ICEcoder.openFiles[tabNum-1]; + get('tab'+tabNum).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); + get('tab'+tabNum).title = "/" + ICEcoder.openFiles[tabNum-1].replace(/\//,""); }, // Reset all tabs to be without a highlight and then highlight the selected @@ -4026,21 +4029,21 @@ var ICEcoder = { var tColor, fileLink; for(var i=1;i<=ICEcoder.savedPoints.length;i++) { - if (top.get('tab'+i).childNodes[0]) { - top.get('tab'+i).childNodes[0].childNodes[0].style.backgroundColor = ICEcoder.savedPoints[i-1]!=top.ICEcoder.getcMInstance(i).changeGeneration() + if (get('tab'+i).childNodes[0]) { + get('tab'+i).childNodes[0].childNodes[0].style.backgroundColor = ICEcoder.savedPoints[i-1]!=ICEcoder.getcMInstance(i).changeGeneration() ? "#b00" : "transparent"; } - tColor = i==selectedTab ? top.ICEcoder.tabFGselected : top.ICEcoder.tabFGnormalTab; - if ("undefined" != typeof top.ICEcoder.openFiles[i-1] && top.ICEcoder.openFiles[i-1] != "/[NEW]") { - fileLink = top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.openFiles[i-1].replace(/\//g,"|")); + tColor = i==selectedTab ? ICEcoder.tabFGselected : ICEcoder.tabFGnormalTab; + if ("undefined" != typeof ICEcoder.openFiles[i-1] && ICEcoder.openFiles[i-1] != "/[NEW]") { + fileLink = ICEcoder.filesFrame.contentWindow.document.getElementById(ICEcoder.openFiles[i-1].replace(/\//g,"|")); if (fileLink) { - fileLink.style.backgroundColor = i==selectedTab ? top.ICEcoder.tabBGcurrent : top.ICEcoder.tabBGopen; - fileLink.style.color = i==selectedTab ? top.ICEcoder.tabFGcurrent : top.ICEcoder.tabFGopenFile; + fileLink.style.backgroundColor = i==selectedTab ? ICEcoder.tabBGcurrent : ICEcoder.tabBGopen; + fileLink.style.color = i==selectedTab ? ICEcoder.tabFGcurrent : ICEcoder.tabFGopenFile; }; } - top.get('tab'+i).style.color = tColor; - top.get('tab'+i).style.background = i==selectedTab ? top.ICEcoder.tabBGcurrent : top.ICEcoder.tabBGopen; + get('tab'+i).style.color = tColor; + get('tab'+i).style.background = i==selectedTab ? ICEcoder.tabBGcurrent : ICEcoder.tabBGopen; } }, @@ -4049,35 +4052,35 @@ var ICEcoder = { var cM, cMdiff, thisCM, okToRemove, closeFileName; // If we haven't specified, close current tab - if (!closeTabNum) {closeTabNum = top.ICEcoder.selectedTab}; + if (!closeTabNum) {closeTabNum = ICEcoder.selectedTab}; cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); okToRemove = true; - if (!dontAsk && ICEcoder.savedPoints[closeTabNum-1]!=top.ICEcoder.getcMInstance(closeTabNum).changeGeneration()) { - okToRemove = top.ICEcoder.ask(top.t['You have made...']); + if (!dontAsk && ICEcoder.savedPoints[closeTabNum-1]!=ICEcoder.getcMInstance(closeTabNum).changeGeneration()) { + okToRemove = ICEcoder.ask(t['You have made...']); } if (okToRemove) { // Get the filename of tab we're closing - closeFileName = top.ICEcoder.openFiles[closeTabNum-1]; + closeFileName = ICEcoder.openFiles[closeTabNum-1]; // recursively copy over all tabs & data from the tab to the right, if there is one for (var i=closeTabNum;i0 && ICEcoder.ask(top.t['Close all tabs'])) { - for (var i=top.ICEcoder.cMInstances.length; i>0; i--) { - top.ICEcoder.closeTab(i, i>1? true:false); + if (ICEcoder.cMInstances.length>0 && ICEcoder.ask(t['Close all tabs'])) { + for (var i=ICEcoder.cMInstances.length; i>0; i--) { + ICEcoder.closeTab(i, i>1? true:false); } } // Update the title tag to indicate any changes - top.ICEcoder.indicateChanges(); + ICEcoder.indicateChanges(); }, // Set the tabs width setTabWidths: function(posOnlyNewTab) { var availWidth, avgWidth, tabWidth, lastLeft, lastWidth; - if (top.ICEcoder.ready) { - availWidth = parseInt(top.ICEcoder.content.style.width,10)-53-22-10; // - left margin - new tab - right margin - avgWidth = (availWidth/top.ICEcoder.openFiles.length)-18; + if (ICEcoder.ready) { + availWidth = parseInt(ICEcoder.content.style.width,10)-53-22-10; // - left margin - new tab - right margin + avgWidth = (availWidth/ICEcoder.openFiles.length)-18; tabWidth = -18; // Incl 18px offset lastLeft = 53; lastWidth = 0; - top.ICEcoder.tabLeftPos = []; - for (var i=0;i availWidth ? parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10) : 150; - lastLeft = i==0 ? 53 : parseInt(top.get('tab'+(i)).style.left,10); - lastWidth = i==0 ? 0 : parseInt(top.get('tab'+(i)).style.width,10)+18; + ICEcoder.tabLeftPos = []; + for (var i=0;i availWidth ? parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10) : 150; + lastLeft = i==0 ? 53 : parseInt(get('tab'+(i)).style.left,10); + lastWidth = i==0 ? 0 : parseInt(get('tab'+(i)).style.width,10)+18; if (!posOnlyNewTab) { - top.get('tab'+(i+1)).style.left = (lastLeft+lastWidth) + "px"; - top.get('tab'+(i+1)).style.width = tabWidth + "px"; + get('tab'+(i+1)).style.left = (lastLeft+lastWidth) + "px"; + get('tab'+(i+1)).style.width = tabWidth + "px"; } else { tabWidth = -18; } - top.ICEcoder.tabLeftPos.push(lastLeft+lastWidth); + ICEcoder.tabLeftPos.push(lastLeft+lastWidth); } - top.get('newTab').style.left = (lastLeft+lastWidth+tabWidth+18) + "px"; + get('newTab').style.left = (lastLeft+lastWidth+tabWidth+18) + "px"; } }, // Tab dragging start tabDragStart: function(tab) { - top.ICEcoder.draggingTab = tab; - top.ICEcoder.diffStartX = top.ICEcoder.mouseX; - top.ICEcoder.tabDragMouseXStart = (top.ICEcoder.mouseX - (parseInt(top.ICEcoder.files.style.width,10)+53+18)) % 150; + ICEcoder.draggingTab = tab; + ICEcoder.diffStartX = ICEcoder.mouseX; + ICEcoder.tabDragMouseXStart = (ICEcoder.mouseX - (parseInt(ICEcoder.files.style.width,10)+53+18)) % 150; // Put tab we're dragging over others - top.get('tab'+tab).style.zIndex = 2; + get('tab'+tab).style.zIndex = 2; // Set classes for other tabs (tabSlide) and the one we're dragging (tabDrag) - for (var i=1; i<=top.ICEcoder.openFiles.length; i++) { - top.get('tab'+i).className = i!==tab + for (var i=1; i<=ICEcoder.openFiles.length; i++) { + get('tab'+i).className = i!==tab ? "tab tabSlide" : "tab tabDrag"; } @@ -4179,30 +4182,30 @@ var ICEcoder = { tabDragMove: function() { var lastTabWidth, thisLeft, dragTabNo, tabWidth; - lastTabWidth = parseInt(top.get('tab'+top.ICEcoder.openFiles.length).style.width,10)+18; + lastTabWidth = parseInt(get('tab'+ICEcoder.openFiles.length).style.width,10)+18; // Set the left position but stay within left side (53) and new tab - top.ICEcoder.thisLeft = thisLeft = top.ICEcoder.tabDragMouseX >= 53 - ? top.ICEcoder.tabDragMouseX <= parseInt(top.get('newTab').style.left,10) - lastTabWidth - ? top.ICEcoder.tabDragMouseX : (parseInt(top.get('newTab').style.left,10) - lastTabWidth) : 53; + ICEcoder.thisLeft = thisLeft = ICEcoder.tabDragMouseX >= 53 + ? ICEcoder.tabDragMouseX <= parseInt(get('newTab').style.left,10) - lastTabWidth + ? ICEcoder.tabDragMouseX : (parseInt(get('newTab').style.left,10) - lastTabWidth) : 53; - top.get('tab'+top.ICEcoder.draggingTab).style.left = thisLeft + "px"; + get('tab'+ICEcoder.draggingTab).style.left = thisLeft + "px"; - top.ICEcoder.dragTabNo = dragTabNo = top.ICEcoder.draggingTab; + ICEcoder.dragTabNo = dragTabNo = ICEcoder.draggingTab; // Set the opacities of tabs then positions of tabs we're not dragging - for (var i=1; i<=top.ICEcoder.openFiles.length; i++) { - top.get('tab'+i).style.opacity = i == top.ICEcoder.draggingTab ? 1 : 0.5; - tabWidth = top.ICEcoder.tabLeftPos[i] ? top.ICEcoder.tabLeftPos[i] - top.ICEcoder.tabLeftPos[i-1] : tabWidth; - if (i!=top.ICEcoder.draggingTab) { - if (i < top.ICEcoder.draggingTab) { - top.get('tab'+i).style.left = thisLeft <= top.ICEcoder.tabLeftPos[i-1] - ? top.ICEcoder.tabLeftPos[i-1]+tabWidth - : top.ICEcoder.tabLeftPos[i-1]; + for (var i=1; i<=ICEcoder.openFiles.length; i++) { + get('tab'+i).style.opacity = i == ICEcoder.draggingTab ? 1 : 0.5; + tabWidth = ICEcoder.tabLeftPos[i] ? ICEcoder.tabLeftPos[i] - ICEcoder.tabLeftPos[i-1] : tabWidth; + if (i!=ICEcoder.draggingTab) { + if (i < ICEcoder.draggingTab) { + get('tab'+i).style.left = thisLeft <= ICEcoder.tabLeftPos[i-1] + ? ICEcoder.tabLeftPos[i-1]+tabWidth + : ICEcoder.tabLeftPos[i-1]; } else { - top.get('tab'+i).style.left = thisLeft >= top.ICEcoder.tabLeftPos[i-1] - ? top.ICEcoder.tabLeftPos[i-1]-tabWidth - : top.ICEcoder.tabLeftPos[i-1]; + get('tab'+i).style.left = thisLeft >= ICEcoder.tabLeftPos[i-1] + ? ICEcoder.tabLeftPos[i-1]-tabWidth + : ICEcoder.tabLeftPos[i-1]; } } } @@ -4213,37 +4216,37 @@ var ICEcoder = { var swapWith, tempArray; // Set the tab widths - top.ICEcoder.setTabWidths(); + ICEcoder.setTabWidths(); // Determin what tabs we've swapped and reset classname, opacity & z-index for all - for (var i=1; i<=top.ICEcoder.openFiles.length; i++) { - if (top.ICEcoder.thisLeft >= top.ICEcoder.tabLeftPos[i-1]) { - swapWith = top.ICEcoder.thisLeft == top.ICEcoder.tabLeftPos[0] ? 1 : top.ICEcoder.dragTabNo > i ? i+1 : i; + for (var i=1; i<=ICEcoder.openFiles.length; i++) { + if (ICEcoder.thisLeft >= ICEcoder.tabLeftPos[i-1]) { + swapWith = ICEcoder.thisLeft == ICEcoder.tabLeftPos[0] ? 1 : ICEcoder.dragTabNo > i ? i+1 : i; } - top.get('tab'+i).className = "tab"; - top.get('tab'+i).style.opacity = 1; - if (i!=top.ICEcoder.dragTabNo) { - top.get('tab'+i).style.zIndex = 1; + get('tab'+i).className = "tab"; + get('tab'+i).style.opacity = 1; + if (i!=ICEcoder.dragTabNo) { + get('tab'+i).style.zIndex = 1; } else { setTimeout(function() { - top.get('tab'+i).style.zIndex = 1; + get('tab'+i).style.zIndex = 1; },150); } } - if (top.ICEcoder.thisLeft && top.ICEcoder.thisLeft!==false) { + if (ICEcoder.thisLeft && ICEcoder.thisLeft!==false) { // Make a number ascending array tempArray = []; - for (var i=1;i<=top.ICEcoder.openFiles.length;i++) { + for (var i=1;i<=ICEcoder.openFiles.length;i++) { tempArray.push(i); } // Then swap our tab numbers - tempArray.splice(top.ICEcoder.dragTabNo-1,1); - tempArray.splice(swapWith-1,0,top.ICEcoder.dragTabNo); + tempArray.splice(ICEcoder.dragTabNo-1,1); + tempArray.splice(swapWith-1,0,ICEcoder.dragTabNo); // Now we have an order to sort against ICEcoder.sortTabs(tempArray); } - top.ICEcoder.setTabWidths(); - top.ICEcoder.draggingTab = false; - top.ICEcoder.thisLeft = false; + ICEcoder.setTabWidths(); + ICEcoder.draggingTab = false; + ICEcoder.thisLeft = false; }, // Sort tabs into new order @@ -4262,18 +4265,18 @@ var ICEcoder = { } // Begin swapping tab id's around to an ascending order and work out new selectedTab for (var i=0;i0) { + if (ICEcoder.openFiles.length>0) { var currentArray, currentArrayFull, alphaArray, nextValue, nextPos; currentArray = []; currentArrayFull = []; alphaArray = []; // Get filenames, full paths and set classname for sliding - for (var i=0;i0) { @@ -4308,17 +4311,17 @@ var ICEcoder = { for (var i=0;i -1 ? true : false);return false;} + if (key==37) {ICEcoder.filesFrame.contentWindow.focus();return false;} + else if (key==39) {ICEcoder.focus(ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? true : false);return false;} else {return key;} // Alt+Enter (Insert Line After) } else if (key==13) { - top.ICEcoder.insertLineAfter(); + ICEcoder.insertLineAfter(); return false; } else {return key;} @@ -4445,17 +4448,17 @@ var ICEcoder = { // Shift+Enter (Insert Line Before) if(key==13 && evt.shiftKey) { - top.ICEcoder.insertLineBefore(); + ICEcoder.insertLineBefore(); return false; // CTRL/Cmd+F (Find next) // and // CTRL/Cmd+G (Find previous) - } else if((key==70||key==71) && (evt.ctrlKey||top.ICEcoder.cmdKey)) { - var find = top.get('find'); + } else if((key==70||key==71) && (evt.ctrlKey||ICEcoder.cmdKey)) { + var find = get('find'); cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; var selections = thisCM.getSelections(); if (selections.length > 0){ if (selections[0].length > 0){ @@ -4466,109 +4469,109 @@ var ICEcoder = { // this is trick for Chrome - after you have used Ctrl-F once, when // you try using Ctrl-F another time, somewhy Chrome still thinks, // that find has focus and refuses to give it focus second time. - top.get('goToLineNo').focus(); + get('goToLineNo').focus(); find.focus(); // Trigger the find/replace operation if(key==70) { // Find next - top.get('findReplaceSubmit').click(); + get('findReplaceSubmit').click(); } else { // Find previous - ICEcoder.findReplace(top.document.getElementById('find').value,false,true,false,'findPrevious'); + ICEcoder.findReplace(document.getElementById('find').value,false,true,false,'findPrevious'); } return false; // CTRL/Cmd+L (Go to line) - } else if(key==76 && (evt.ctrlKey||top.ICEcoder.cmdKey)) { - var goToLineInput = top.get('goToLineNo'); + } else if(key==76 && (evt.ctrlKey||ICEcoder.cmdKey)) { + var goToLineInput = get('goToLineNo'); goToLineInput.select(); // this is trick for Chrome - after you have used Ctrl-F once, when // you try using Ctrl-F another time, somewhy Chrome still thinks, // that find has focus and refuses to give it focus second time. - top.get('find').focus(); + get('find').focus(); goToLineInput.focus(); return false; // CTRL/Cmd+I (Get info) - } else if(key==73 && (evt.ctrlKey||top.ICEcoder.cmdKey) && area == "content") { - top.ICEcoder.searchForSelected(); + } else if(key==73 && (evt.ctrlKey||ICEcoder.cmdKey) && area == "content") { + ICEcoder.searchForSelected(); return false; // CTRL/Cmd+backspace arrow (Go to previous tab selected) - } else if(key==8 && (evt.ctrlKey||top.ICEcoder.cmdKey)) { - if (top.ICEcoder.prevTab !== 0) { - top.ICEcoder.switchTab(top.ICEcoder.prevTab); + } else if(key==8 && (evt.ctrlKey||ICEcoder.cmdKey)) { + if (ICEcoder.prevTab !== 0) { + ICEcoder.switchTab(ICEcoder.prevTab); } return false; // CTRL/Cmd+right arrow (Tab to right) - } else if(key==39 && (evt.ctrlKey||top.ICEcoder.cmdKey) && area!="content") { - top.ICEcoder.nextTab(); + } else if(key==39 && (evt.ctrlKey||ICEcoder.cmdKey) && area!="content") { + ICEcoder.nextTab(); return false; // CTRL/Cmd+left arrow (Tab to left) - } else if(key==37 && (evt.ctrlKey||top.ICEcoder.cmdKey) && area!="content") { - top.ICEcoder.previousTab(); + } else if(key==37 && (evt.ctrlKey||ICEcoder.cmdKey) && area!="content") { + ICEcoder.previousTab(); return false; // CTRL/Cmd+up arrow (Move line up) - } else if(key==38 && (evt.ctrlKey||top.ICEcoder.cmdKey) && area=="content") { - top.ICEcoder.moveLines('up'); + } else if(key==38 && (evt.ctrlKey||ICEcoder.cmdKey) && area=="content") { + ICEcoder.moveLines('up'); return false; // CTRL/Cmd+down arrow (Move line down) - } else if(key==40 && (evt.ctrlKey||top.ICEcoder.cmdKey) && area=="content") { - top.ICEcoder.moveLines('down'); + } else if(key==40 && (evt.ctrlKey||ICEcoder.cmdKey) && area=="content") { + ICEcoder.moveLines('down'); return false; // CTRL/Cmd+numeric plus (New tab) - } else if((key==107 || key==187) && (evt.ctrlKey||top.ICEcoder.cmdKey)) { + } else if((key==107 || key==187) && (evt.ctrlKey||ICEcoder.cmdKey)) { area=="content" - ? top.ICEcoder.duplicateLines() - : top.ICEcoder.newTab(); + ? ICEcoder.duplicateLines() + : ICEcoder.newTab(); return false; // CTRL/Cmd+numeric minus (Close tab) - } else if((key==109 || key==189) && (evt.ctrlKey||top.ICEcoder.cmdKey)) { + } else if((key==109 || key==189) && (evt.ctrlKey||ICEcoder.cmdKey)) { area=="content" - ? top.ICEcoder.removeLines() - : top.ICEcoder.closeTab(top.ICEcoder.selectedTab); + ? ICEcoder.removeLines() + : ICEcoder.closeTab(ICEcoder.selectedTab); return false; // CTRL/Cmd+S (Save), CTRL/Cmd+Shift+S (Save As) - } else if(key==83 && (evt.ctrlKey||top.ICEcoder.cmdKey)) { + } else if(key==83 && (evt.ctrlKey||ICEcoder.cmdKey)) { if(evt.shiftKey) { - top.ICEcoder.saveFile('saveAs'); + ICEcoder.saveFile('saveAs'); } else { - top.ICEcoder.saveFile(); + ICEcoder.saveFile(); } return false; // CTRL/Cmd+Enter (Open Webpage) - } else if(key==13 && (evt.ctrlKey||top.ICEcoder.cmdKey) && top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] != "/[NEW]") { - top.ICEcoder.resetKeys(evt); - window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]); + } else if(key==13 && (evt.ctrlKey||ICEcoder.cmdKey) && ICEcoder.openFiles[ICEcoder.selectedTab-1] != "/[NEW]") { + ICEcoder.resetKeys(evt); + window.open(ICEcoder.openFiles[ICEcoder.selectedTab-1]); return false; // Enter (Expand dir/open file) } else if(key==13 && area=="files") { - if(!evt.ctrlKey && !top.ICEcoder.cmdKey) { - if (top.ICEcoder.selectedFiles.length == 0) { - top.ICEcoder.overFileFolder('folder', '|'); - top.ICEcoder.selectFileFolder('init'); + if(!evt.ctrlKey && !ICEcoder.cmdKey) { + if (ICEcoder.selectedFiles.length == 0) { + ICEcoder.overFileFolder('folder', '|'); + ICEcoder.selectFileFolder('init'); } - top.ICEcoder.fmAction(evt,'enter'); + ICEcoder.fmAction(evt,'enter'); } return false; // Up/down/left/right arrows (Traverse files) } else if((key==38||key==40||key==37||key==39) && area=="files") { - if(!evt.ctrlKey && !top.ICEcoder.cmdKey) { - if (top.ICEcoder.selectedFiles.length == 0) { - top.ICEcoder.overFileFolder('folder', '|'); - top.ICEcoder.selectFileFolder('init'); + if(!evt.ctrlKey && !ICEcoder.cmdKey) { + if (ICEcoder.selectedFiles.length == 0) { + ICEcoder.overFileFolder('folder', '|'); + ICEcoder.selectFileFolder('init'); } - top.ICEcoder.fmAction(evt, + ICEcoder.fmAction(evt, key==38 ? 'up' : key==40 ? 'down' : key==37 ? 'left' : @@ -4577,31 +4580,31 @@ var ICEcoder = { return false; // CTRL/Cmd+O (Open Prompt) - } else if(key==79 && (evt.ctrlKey||top.ICEcoder.cmdKey)) { - top.ICEcoder.openPrompt(); + } else if(key==79 && (evt.ctrlKey||ICEcoder.cmdKey)) { + ICEcoder.openPrompt(); return false; // CTRL/Cmd+Space (Add snippet) - } else if(key==32 && (evt.ctrlKey||top.ICEcoder.cmdKey) && area=="content") { - top.ICEcoder.addSnippet(); + } else if(key==32 && (evt.ctrlKey||ICEcoder.cmdKey) && area=="content") { + ICEcoder.addSnippet(); return false; // CTRL/Cmd+J (Jump to definition/back again) - } else if(key==74 && (evt.ctrlKey||top.ICEcoder.cmdKey) && area=="content") { - top.ICEcoder.jumpToDefinition(); + } else if(key==74 && (evt.ctrlKey||ICEcoder.cmdKey) && area=="content") { + ICEcoder.jumpToDefinition(); return false; // CTRL + Tab (lock/unlock file manager) - } else if(key==223 && (evt.ctrlKey||top.ICEcoder.cmdKey)) { - top.ICEcoder.lockUnlockNav(); - ICEcoder.changeFilesW(top.ICEcoder.lockedNav ? 'expand' : 'contract'); + } else if(key==223 && (evt.ctrlKey||ICEcoder.cmdKey)) { + ICEcoder.lockUnlockNav(); + ICEcoder.changeFilesW(ICEcoder.lockedNav ? 'expand' : 'contract'); return false; // CTRL + . (Fold/unfold current line) - } else if(key==190 && (evt.ctrlKey||top.ICEcoder.cmdKey)) { + } else if(key==190 && (evt.ctrlKey||ICEcoder.cmdKey)) { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; var line = thisCM.getCursor().line; return false; @@ -4610,18 +4613,18 @@ var ICEcoder = { } else if(key==27 && area == "content") { cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (thisCM.getSelections().length > 1) { thisCM.execCommand("singleSelection"); } else { - top.ICEcoder.lineCommentToggle(); + ICEcoder.lineCommentToggle(); } return false; // ESC not in content area (Cancel all actions) } else if(key==27 && area != "content") { - top.ICEcoder.cancelAllActions(); + ICEcoder.cancelAllActions(); return false; // Any other key @@ -4637,13 +4640,13 @@ var ICEcoder = { key = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode; - if (key == 112 && top.ICEcoder.codeZoomedOut) { + if (key == 112 && ICEcoder.codeZoomedOut) { cM = ICEcoder.getcMInstance(); // For every line in the current editor, remove code-zoomed-out class if not a function/class declaration line for (var i=0; i -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; lineNo = thisCM.getCursor().line; whiteSpace = thisCM.getLine(lineNo).length - thisCM.getLine(lineNo).replace(/^\s\s*/, '').length; content = thisCM.getLine(lineNo).slice(whiteSpace); // function snippet if (content.slice(0,8)=="function") { - top.ICEcoder.doSnippet('function','function VAR() {\nINDENT\tCURSOR\nINDENT}'); + ICEcoder.doSnippet('function','function VAR() {\nINDENT\tCURSOR\nINDENT}'); // if snippet } else if (content.slice(0,2)=="if") { - top.ICEcoder.doSnippet('if','if (CURSOR) {\nINDENT\t\nINDENT}'); + ICEcoder.doSnippet('if','if (CURSOR) {\nINDENT\t\nINDENT}'); // for snippet } else if (content.slice(0,3)=="for") { - top.ICEcoder.doSnippet('for','for (var i=0; i -1 ? cMdiff : cM; + thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; lineNo = thisCM.getCursor().line; lineContents = thisCM.getLine(lineNo); @@ -4727,19 +4730,19 @@ var ICEcoder = { thisCM.replaceRange(replacedLine.replace("CURSOR",""),{line:lineNo,ch:0},{line:lineNo,ch:1000000}); thisCM.setCursor(lineNoCount,curPos); // Finally, focus on the editor - top.ICEcoder.focus(top.ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? true : false); + ICEcoder.focus(ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? true : false); } }, // Snart snake startSnake: function() { - top.ICEcoder.snakePlaying = true; - top.ICEcoder.showHide('show',top.get('blackMask')); - top.get('mediaContainer').innerHTML = 'Let\'s play
    snake


    Use arrow keys to eat your code

    (it returns afterwards of course) :-)
    '; + ICEcoder.snakePlaying = true; + ICEcoder.showHide('show',get('blackMask')); + get('mediaContainer').innerHTML = 'Let\'s play
    snake


    Use arrow keys to eat your code

    (it returns afterwards of course) :-)
    '; setTimeout(function() { - top.ICEcoder.showHide('hide',top.get('blackMask')); - top.get('mediaContainer').innerHTML = ''; - top.ICEcoder.playSnake(); + ICEcoder.showHide('hide',get('blackMask')); + get('mediaContainer').innerHTML = ''; + ICEcoder.playSnake(); },2000); }, @@ -4752,13 +4755,13 @@ var ICEcoder = { cM.focus(); // Get state of editor at present - top.ICEcoder.snakePreHistory = cM.getHistory(); - top.ICEcoder.snakePreContent = cM.getValue(); - top.ICEcoder.snakePreCursor = cM.getCursor(); + ICEcoder.snakePreHistory = cM.getHistory(); + ICEcoder.snakePreContent = cM.getValue(); + ICEcoder.snakePreCursor = cM.getCursor(); // Pick a random point for snake to come in and set head and 4 body parts off screen var randPos = Math.floor(Math.random()*50); - top.ICEcoder.snakePos = [ + ICEcoder.snakePos = [ [randPos,0], [randPos,-1], [randPos,-2], @@ -4767,21 +4770,21 @@ var ICEcoder = { ]; // Show game layer, set direction and do 1st frame of snake - top.ICEcoder.content.contentWindow.document.getElementById('game').style.display = 'block'; - top.ICEcoder.snakeDir = "down"; - top.ICEcoder.doSnake(); + ICEcoder.content.contentWindow.document.getElementById('game').style.display = 'block'; + ICEcoder.snakeDir = "down"; + ICEcoder.doSnake(); // Every 0.1s, move snake - top.ICEcoder.snakeInt = setInterval(function() { + ICEcoder.snakeInt = setInterval(function() { // Set new head X & Y pos according to direction var newHead = []; - newHead[0] = top.ICEcoder.snakePos[0][0]+(top.ICEcoder.snakeDir == "right" ? 1 : top.ICEcoder.snakeDir == "left" ? -1 : 0); - newHead[1] = top.ICEcoder.snakePos[0][1]+(top.ICEcoder.snakeDir == "down" ? 1 : top.ICEcoder.snakeDir == "up" ? -1 : 0); + newHead[0] = ICEcoder.snakePos[0][0]+(ICEcoder.snakeDir == "right" ? 1 : ICEcoder.snakeDir == "left" ? -1 : 0); + newHead[1] = ICEcoder.snakePos[0][1]+(ICEcoder.snakeDir == "down" ? 1 : ICEcoder.snakeDir == "up" ? -1 : 0); // Add new head and remove tail - top.ICEcoder.snakePos.unshift(newHead); - top.ICEcoder.snakePos.pop(); + ICEcoder.snakePos.unshift(newHead); + ICEcoder.snakePos.pop(); // Do next frame of snake - top.ICEcoder.doSnake(); + ICEcoder.doSnake(); },100); }, @@ -4794,22 +4797,22 @@ var ICEcoder = { cH = cM.defaultTextHeight(); // Clear content of game layer - top.ICEcoder.content.contentWindow.document.getElementById('game').innerHTML = ""; + ICEcoder.content.contentWindow.document.getElementById('game').innerHTML = ""; // Start a new set of contents newInnerHTML = ""; // For every part of snake, draw it's block in position - for (var i=0; i'; + for (var i=0; i'; } // Set new content in game layer - top.ICEcoder.content.contentWindow.document.getElementById('game').innerHTML = newInnerHTML; + ICEcoder.content.contentWindow.document.getElementById('game').innerHTML = newInnerHTML; // Get line & ch value under snake head then line content - lineData = cM.coordsChar({top: ((top.ICEcoder.snakePos[0][1]*cH)+4), left: ((top.ICEcoder.snakePos[0][0]*cW)+60)}); + lineData = cM.coordsChar({top: ((ICEcoder.snakePos[0][1]*cH)+4), left: ((ICEcoder.snakePos[0][0]*cW)+60)}); lineContent = cM.getLine(lineData.line); // If not the last char on the line - if (top.ICEcoder.snakePos[0][0]-1 <= lineContent.length-2) { + if (ICEcoder.snakePos[0][0]-1 <= lineContent.length-2) { spaceReplaceChars = ""; // If char under snake head is a tab, replace string contains spaces of same width if (lineContent.substr(lineData.ch,1) === "\t") { @@ -4821,23 +4824,23 @@ var ICEcoder = { spaceReplaceChars = " "; } // Push a duplicate of tail onto end, to increase snake length by 1 block - top.ICEcoder.snakePos.push([top.ICEcoder.snakePos[top.ICEcoder.snakePos.length-1][0],top.ICEcoder.snakePos[top.ICEcoder.snakePos.length-1][1]]); + ICEcoder.snakePos.push([ICEcoder.snakePos[ICEcoder.snakePos.length-1][0],ICEcoder.snakePos[ICEcoder.snakePos.length-1][1]]); // Replace char under head with nothing if end of line, else with our replacement string - cM.doc.replaceRange(top.ICEcoder.snakePos[0][0]-1 == lineContent.length-2 ? "" : spaceReplaceChars,lineData,{line: lineData.line, ch: lineData.ch+1}); + cM.doc.replaceRange(ICEcoder.snakePos[0][0]-1 == lineContent.length-2 ? "" : spaceReplaceChars,lineData,{line: lineData.line, ch: lineData.ch+1}); // Remove any trailing space at end - if (top.ICEcoder.snakePos[0][0]-1 == lineContent.length-2) { + if (ICEcoder.snakePos[0][0]-1 == lineContent.length-2) { cM.doc.replaceRange(cM.getLine(lineData.line).replace(/[ \t]+$/,''),{line: lineData.line, ch: 0},{line: lineData.line, ch: 1000000}); } } else { // Reduce snake length if over 5 chars and not on content - if (top.ICEcoder.snakePos.length >= 5) { - top.ICEcoder.snakePos.pop(); + if (ICEcoder.snakePos.length >= 5) { + ICEcoder.snakePos.pop(); } } // Detect if snake head has collided into itself collision = false; - for (var i=1; i scrollInfo.clientWidth || ((top.ICEcoder.snakePos[0][1]*cH)+4) > scrollInfo.clientHeight || + ICEcoder.snakePos[0][0] < 0 || ICEcoder.snakePos[0][1] < 0 || + ((ICEcoder.snakePos[0][0]*cW)+60) > scrollInfo.clientWidth || ((ICEcoder.snakePos[0][1]*cH)+4) > scrollInfo.clientHeight || collision ) { // Clear interval and hide game layer - clearInterval(top.ICEcoder.snakeInt); - top.ICEcoder.content.contentWindow.document.getElementById('game').style.display = 'none'; + clearInterval(ICEcoder.snakeInt); + ICEcoder.content.contentWindow.document.getElementById('game').style.display = 'none'; // Set content, saved point, saved contents and history back to what they were pre game - cM.setValue(top.ICEcoder.snakePreContent); - top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1] = cM.changeGeneration(); - top.ICEcoder.savedContents[top.ICEcoder.selectedTab-1] = top.ICEcoder.snakePreContent; - cM.setHistory(top.ICEcoder.snakePreHistory); + cM.setValue(ICEcoder.snakePreContent); + ICEcoder.savedPoints[ICEcoder.selectedTab-1] = cM.changeGeneration(); + ICEcoder.savedContents[ICEcoder.selectedTab-1] = ICEcoder.snakePreContent; + cM.setHistory(ICEcoder.snakePreHistory); // Redo changes indicator in title tag and tab highlight save indicator also to what they are now (pre game state) - top.ICEcoder.indicateChanges(); - top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab); + ICEcoder.indicateChanges(); + ICEcoder.redoTabHighlight(ICEcoder.selectedTab); // Set editor to be editable again cM.setOption('readOnly', false); // Set cursor back to what it was pre game and focus on editor - cM.setCursor(top.ICEcoder.snakePreCursor); + cM.setCursor(ICEcoder.snakePreCursor); cM.focus(); // State we are no longer playing snake - top.ICEcoder.snakePlaying = false; + ICEcoder.snakePlaying = false; } } From f22dee6550e0795af53d301c464025eb38ad5acb Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:21:11 +0000 Subject: [PATCH 014/231] Min JS file updated --- lib/ice-coder.min.js | 420 +++++++++++++++++++++---------------------- 1 file changed, 206 insertions(+), 214 deletions(-) diff --git a/lib/ice-coder.min.js b/lib/ice-coder.min.js index d679e6b..3f02635 100644 --- a/lib/ice-coder.min.js +++ b/lib/ice-coder.min.js @@ -1,215 +1,207 @@ -var get=function(a){return top.document.getElementById(a)},ICEcoder={filesW:250,minFilesW:14,maxFilesW:250,selectedTab:0,savedPoints:[],savedContents:[],canSwitchTabs:!0,openFiles:[],openFileMDTs:[],openFileVersions:[],cMInstances:[],nextcMInstance:1,selectedFiles:[],findMode:!1,scrollbarVisible:!1,mouseDown:!1,mouseDownInCM:!1,mouseDownMinimap:!1,draggingFilesW:!1,draggingTab:!1,draggingWithKey:!1,tabLeftPos:[],tabBGcurrent:"#1d1d1b",tabBGselected:"#49d",tabBGopen:"#c3c3c3",tabBGnormal:"transparent", - tabFGcurrent:"#fff",tabFGselected:"#fff",tabFGopenFile:"#000",tabFGnormalFile:"#eee",tabFGnormalTab:"#888",prevTab:0,serverQueueItems:[],miniMapBoxTop:0,miniMapBoxHeight:0,previewWindow:!1,previewWindowLoading:!1,pluginIntervalRefs:[],overPopup:!1,cmdKey:!1,codeZoomedOut:!1,showingTool:!1,oppTagReplaceData:[],fmReady:!1,bugReportStatus:"off",bugReportPath:"",bugFilesSizesSeen:[],bugFilesSizesActual:[],githubDiff:!1,githubAuthTokenSet:!1,splitPane:!1,splitPaneLeftPerc:100,renderLineStyle:[],renderPaneShiftAmount:0, - debounce:"",editorFocusInstance:"",openSeconds:0,indexing:!1,ready:!1,initAliases:function(){for(var a="header files fileOptions optionsFile optionsEdit optionsSource optionsHelp filesFrame editor tabsBar findBar terminal output database git content tools footer nestValid versionsDisplay splitPaneControls splitPaneNamesMain splitPaneNamesDiff charDisplay byteDisplay docExplorer miniMap miniMapContainer miniMapContent functionClassList".split(" "),b=0;b=60*top.ICEcoder.autoLogoutMins&&top.ICEcoder.logout("autoLogout");top.ICEcoder.openSeconds++;0==top.ICEcoder.openSeconds%300&&(top.ICEcoder.filesFrame.contentWindow.frames.pingActive.location.href="lib/session-active-ping.php");top.ICEcoder.indexing||top.ICEcoder.loadingFile||0!==top.ICEcoder.serverQueueItems.length||0!=top.ICEcoder.openSeconds% - 3||(top.ICEcoder.indexing=!0,fetch("lib/indexer.php"+(top.ICEcoder.indexData?"?timestamp="+top.ICEcoder.indexData.timestamps.indexed+"&csrf="+top.ICEcoder.csrf:"")).then(function(a){return a.json()}).then(function(a){a.timestamps.changed&&(top.ICEcoder.indexData=a,a.gitDiff&&top.ICEcoder.updateGitDiffPane(),a.gitContent&&top.ICEcoder.highlightGitDiffs());top.ICEcoder.indexing=!1}))},1E3);top.ICEcoder.ready=!0},setLayout:function(a){var b=window.innerWidth;var c=window.innerHeight;this.header.style.width= - this.tabsBar.style.width=this.findBar.style.width=b+"px";this.files.style.width=this.editor.style.left=this.filesW+"px";this.optionsFile.style.width=this.optionsEdit.style.width=this.optionsSource.style.width=this.optionsHelp.style.width=this.filesW-60+"px";this.filesFrame.style.height=c-25-35-30+"px";this.nestValid.style.left=this.filesW+10+"px";this.versionsDisplay.style.left=this.filesW+25+"px";this.splitPaneControls.style.left=parseInt((b-this.filesW)/2+this.filesW-get("splitPaneControls").getBoundingClientRect().width/ - 2,10)+"px";this.splitPaneNamesMain.style.left=parseInt(.25*(b-this.filesW),10)-50+this.filesW-60+"px";this.splitPaneNamesDiff.style.left=parseInt(.75*(b-this.filesW),10)-50+this.filesW-135+"px";top.ICEcoder.setTabWidths();a||(this.editor.style.width=ICEcoder.content.style.width=b-this.filesW-200+"px",ICEcoder.terminal.style.width=b-this.filesW+"px",ICEcoder.output.style.width=b-this.filesW-31+"px",ICEcoder.database.style.width=b-this.filesW+"px",ICEcoder.git.style.width=b-this.filesW-31+"px",ICEcoder.content.style.height= - c-25-21-28-26+"px",ICEcoder.terminal.style.height=c+"px",ICEcoder.output.style.height=c+"px",ICEcoder.database.style.height=c+"px",ICEcoder.git.style.height=c+"px",ICEcoder.terminal.style.top=c+"px",ICEcoder.output.style.top=c+"px",ICEcoder.database.style.top=c+"px",ICEcoder.git.style.top=c+"px",!1!==top.ICEcoder.showingTool&&(get(top.ICEcoder.showingTool).style.top=0),setTimeout(function(){for(var a=0;atop.ICEcoder.splitPaneLeftPerc?top.ICEcoder.splitPaneLeftPerc=50-(100-top.ICEcoder.splitPaneLeftPerc)/1.8+50:(top.ICEcoder.splitPaneLeftPerc=top.ICEcoder.splitPane?50:100,clearInterval(top.ICEcoder.animSplitPaneInt));top.ICEcoder.setLayout()},4)},toolShowHideToggle:function(a){var b=window.innerHeight;-1<["terminal","output","database","git"].indexOf(a)&&(get("terminal").style.top=b+"px",get("output").style.top=b+"px",get("database").style.top=b+"px",get("git").style.top=b+"px",get(a).style.top= - top.ICEcoder.showingTool===a?b+"px":0,"terminal"===a&&setTimeout(function(){top.ICEcoder.terminal.contentWindow.document.getElementById("command").focus()},0),top.ICEcoder.showingTool=top.ICEcoder.showingTool!==a?a:!1)},docExplorerShow:function(a){var b;get("miniMap").style.display="miniMap"==a?"block":"none";get("functionClassList").style.display="functionClassList"==a?"block":"none";"miniMap"==a&&(top.miniMapInt=setInterval(function(){0!=get("miniMapContent").getBoundingClientRect().height&&(b= - top.ICEcoder.getcMInstance(),top.ICEcoder.setMinimapLayout(b),clearInterval(top.miniMapInt))},10))},changeFilesW:function(a){ICEcoder.lockedNav&&ICEcoder.filesW!=ICEcoder.minFilesW||("undefined"!=typeof ICEcoder.changeFilesInt&&clearInterval(ICEcoder.changeFilesInt),ICEcoder.changeFilesInt=setInterval(function(){ICEcoder.changeFilesWStep(a)},10))},changeFilesWStep:function(a){"expand"==a?ICEcoder.filesWICEcoder.minFilesW+1?ICEcoder.filesW-=Math.ceil((ICEcoder.filesW-ICEcoder.minFilesW)/2):ICEcoder.filesW=ICEcoder.minFilesW;("expand"==a&&ICEcoder.filesW==ICEcoder.maxFilesW||"contract"==a&&ICEcoder.filesW==ICEcoder.minFilesW)&&clearInterval(ICEcoder.changeFilesInt);ICEcoder.setLayout()},canResizeFilesW:function(){top.ICEcoder.ready&&"w-resize"==top.document.body.style.cursor?top.ICEcoder.mouseDown&&"gutter"==top.ICEcoder.mouseDownInCM&&(top.ICEcoder.filesW=top.ICEcoder.maxFilesW= - 250<=top.ICEcoder.mouseX&&400>=top.ICEcoder.mouseX?top.ICEcoder.mouseX:250>top.ICEcoder.mouseX?250:400,top.ICEcoder.files.style.width=top.ICEcoder.filesFrame.style.width=top.ICEcoder.filesW+"px",top.ICEcoder.setLayout(),top.ICEcoder.draggingFilesW=!0):top.ICEcoder.draggingFilesW=!1},lockUnlockNav:function(){var a=top.ICEcoder.filesFrame.contentWindow.document.getElementById("fmLock");ICEcoder.lockedNav=!ICEcoder.lockedNav;a.style.backgroundPosition=ICEcoder.lockedNav?"0 0":"-16px 0"},showHidePlugins:function(a){get("plugins").style.width= - "show"==a?"55px":"3px";get("plugins").style.background="show"==a?"#333":"transparent";"show"==a&&ICEcoder.changeFilesW("expand")},cMonFocus:function(a,b){top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay();top.ICEcoder.editorFocusInstance=b;top.ICEcoder.getCaretPosition()},cMonBlur:function(a,b){},cMonKeyUp:function(a,b){"undefined"!=typeof top.doFind&&clearInterval(top.doFind);top.doFind=setTimeout(function(){top.ICEcoder.findReplace(top.get("find").value, - !0,!1)},500);top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay()},cMonCursorActivity:function(a,b){top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay();a.removeLineClass(top.ICEcoder["cMActiveLine"+b],"background");a.getCursor("start").line==a.getCursor().line&&(top.ICEcoder["cMActiveLine"+b]=a.addLineClass(a.getCursor().line,"background","cm-s-activeLine"));"CSS"==top.ICEcoder.caretLocType&&top.ICEcoder.cssColorPreview(); - var c=-1")&&"undefined"!=typeof f&&"undo"!=c.origin&&"redo"!=c.origin&&"undefined"!=typeof f.open&&"undefined"!=typeof f.close){var g="open"==f.at?"close":"open";null!==f[g]&&(f=f[g].tag+";"+ - f[g].from.line+":"+f[g].from.ch,-1==top.ICEcoder.oppTagReplaceData.indexOf(f)&&top.ICEcoder.oppTagReplaceData.push(f))}}},cMonChange:function(a,b,c,d){var e;b=a.listSelections();top.ICEcoder.loadingFile?setTimeout(function(){a.replaceRange("X",{line:1,ch:1},{line:1,ch:1});a.undo();a.clearHistory();top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1]=a.changeGeneration();top.ICEcoder.savedContents[top.ICEcoder.selectedTab-1]=a.getValue()},0):top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab); - setTimeout(function(){top.ICEcoder.scrollBarVisible=a.getScrollInfo().height>a.getScrollInfo().clientHeight;top.ICEcoder.setLayout()},0);if("undefined"!=typeof top.ICEcoder.oppTagReplaceData[0])for(var f=0;fa.defaultTextHeight()&&(f+=b.getLineHandle(e).height-a.defaultTextHeight());f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["main",c[d][2],"height",f+"px"]);for(e=0;ea.defaultTextHeight()&&(f+=a.getLineHandle(e).height-a.defaultTextHeight());f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",f+"px"]);for(e=0;ec&e>c&a[d-1]==b[e-1];d--)e--;return[c,d-c,e-c]},highlightGitDiffs:function(){"undefined"!= - typeof top.highlightGitDiffTimeout&&clearTimeout(top.highlightGitDiffTimeout);top.ICEcoder.indexData&&top.ICEcoder.indexData.gitContent&&(top.highlightGitDiffTimeout=setTimeout(function(){if(top.ICEcoder.indexData.gitContent[top.docRoot+top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]]){cM=top.ICEcoder.getcMInstance();cM.clearGutter("CodeMirror-linenumbers");for(var a=cM?difflib.stringAsLines(cM.getValue()):"",b=difflib.stringAsLines(top.ICEcoder.indexData.gitContent[top.docRoot+top.ICEcoder.openFiles[top.ICEcoder.selectedTab- - 1]].lastHashContent),c=(new difflib.SequenceMatcher(b,a)).get_opcodes(),d=0;dc[d][3]?(f.style.borderTop="solid #b00 1px",f.innerHTML=c[d][3]+1,cM.setGutterMarker(c[d][3],"CodeMirror-linenumbers",f)):(f.style.borderBottom="solid #b00 1px",f.innerHTML=c[d][3],cM.setGutterMarker(c[d][3]-1,"CodeMirror-linenumbers", - f))}},top.ICEcoder.loadingFile?100:0))},updateGitDiffPane:function(){for(var a="",b=0;b"+top.ICEcoder.indexData.gitDiff.paths[b]+"\n",top.get("git").innerHTML=a+"

    "},updatePreviewWindow:function(a,b,c,d){top.ICEcoder.previewWindow.location.pathname==b?-1<["htm","html","txt"].indexOf(d)?top.ICEcoder.previewWindow.document.documentElement.innerHTML= - a.getValue():-1<["md"].indexOf(d)&&(top.ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(a.getValue())):-1<["css"].indexOf(d)&&-1/g,"");a.setValue(b);a.clearHistory();top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1]= - a.changeGeneration();top.ICEcoder.savedContents[top.ICEcoder.selectedTab-1]=a.getValue()},undo:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.getcMdiffInstance();(-1=f.line;b--)e.replaceRange(e.getLine(b),{line:b+1,ch:0},{line:b+1,ch:1E6});e.replaceRange(l,{line:"up"==a?g.line:f.line,ch:0},{line:"up"==a?g.line:f.line,ch:1E6});e.setSelection({line:f.line+("up"==a?-1:1),ch:f.ch},{line:g.line+("up"==a?-1:1),ch:g.ch})})}},highlightLine:function(a){var b=top.ICEcoder.getcMInstance();var c=top.ICEcoder.getcMdiffInstance();b=-1\n"+ +var get=function(a){return document.getElementById(a)},iceLoc=window.location.pathname,ICEcoder={filesW:250,minFilesW:14,maxFilesW:250,selectedTab:0,savedPoints:[],savedContents:[],canSwitchTabs:!0,openFiles:[],openFileMDTs:[],openFileVersions:[],cMInstances:[],nextcMInstance:1,selectedFiles:[],findMode:!1,scrollbarVisible:!1,mouseDown:!1,mouseDownInCM:!1,mouseDownMinimap:!1,draggingFilesW:!1,draggingTab:!1,draggingWithKey:!1,tabLeftPos:[],tabBGcurrent:"#1d1d1b",tabBGselected:"#49d",tabBGopen:"#c3c3c3", + tabBGnormal:"transparent",tabFGcurrent:"#fff",tabFGselected:"#fff",tabFGopenFile:"#000",tabFGnormalFile:"#eee",tabFGnormalTab:"#888",prevTab:0,serverQueueItems:[],miniMapBoxTop:0,miniMapBoxHeight:0,previewWindow:!1,previewWindowLoading:!1,pluginIntervalRefs:[],overPopup:!1,cmdKey:!1,codeZoomedOut:!1,showingTool:!1,oppTagReplaceData:[],fmReady:!1,bugReportStatus:"off",bugReportPath:"",bugFilesSizesSeen:[],bugFilesSizesActual:[],githubDiff:!1,githubAuthTokenSet:!1,splitPane:!1,splitPaneLeftPerc:100, + renderLineStyle:[],renderPaneShiftAmount:0,debounce:"",editorFocusInstance:"",openSeconds:0,indexing:!1,ready:!1,initAliases:function(){for(var a="header files fileOptions optionsFile optionsEdit optionsSource optionsHelp filesFrame editor tabsBar findBar terminal output database git content tools footer nestValid versionsDisplay splitPaneControls splitPaneNamesMain splitPaneNamesDiff charDisplay byteDisplay docExplorer miniMap miniMapContainer miniMapContent functionClassList".split(" "),b=0;b=60*ICEcoder.autoLogoutMins&&ICEcoder.logout("autoLogout");ICEcoder.openSeconds++;0==ICEcoder.openSeconds%300&&(ICEcoder.filesFrame.contentWindow.frames.pingActive.location.href=iceLoc+"/lib/session-active-ping.php");ICEcoder.indexing||ICEcoder.loadingFile||0!==ICEcoder.serverQueueItems.length||0!=ICEcoder.openSeconds%3||(ICEcoder.indexing=!0,fetch(iceLoc+"/lib/indexer.php"+ + (ICEcoder.indexData?"?timestamp="+ICEcoder.indexData.timestamps.indexed+"&csrf="+ICEcoder.csrf:"")).then(function(a){return a.json()}).then(function(a){a.timestamps.changed&&(ICEcoder.indexData=a,a.gitDiff&&ICEcoder.updateGitDiffPane(),a.gitContent&&ICEcoder.highlightGitDiffs());ICEcoder.indexing=!1}))},1E3);ICEcoder.ready=!0},setLayout:function(a){var b=window.innerWidth;var c=window.innerHeight;this.header.style.width=this.tabsBar.style.width=this.findBar.style.width=b+"px";this.files.style.width= + this.editor.style.left=this.filesW+"px";this.optionsFile.style.width=this.optionsEdit.style.width=this.optionsSource.style.width=this.optionsHelp.style.width=this.filesW-60+"px";this.filesFrame.style.height=c-25-35-30+"px";this.nestValid.style.left=this.filesW+10+"px";this.versionsDisplay.style.left=this.filesW+25+"px";this.splitPaneControls.style.left=parseInt((b-this.filesW)/2+this.filesW-get("splitPaneControls").getBoundingClientRect().width/2,10)+"px";this.splitPaneNamesMain.style.left=parseInt(.25* + (b-this.filesW),10)-50+this.filesW-60+"px";this.splitPaneNamesDiff.style.left=parseInt(.75*(b-this.filesW),10)-50+this.filesW-135+"px";ICEcoder.setTabWidths();a||(this.editor.style.width=ICEcoder.content.style.width=b-this.filesW-200+"px",ICEcoder.terminal.style.width=b-this.filesW+"px",ICEcoder.output.style.width=b-this.filesW-31+"px",ICEcoder.database.style.width=b-this.filesW+"px",ICEcoder.git.style.width=b-this.filesW-31+"px",ICEcoder.content.style.height=c-25-21-28-26+"px",ICEcoder.terminal.style.height= + c+"px",ICEcoder.output.style.height=c+"px",ICEcoder.database.style.height=c+"px",ICEcoder.git.style.height=c+"px",ICEcoder.terminal.style.top=c+"px",ICEcoder.output.style.top=c+"px",ICEcoder.database.style.top=c+"px",ICEcoder.git.style.top=c+"px",!1!==ICEcoder.showingTool&&(get(ICEcoder.showingTool).style.top=0),setTimeout(function(){for(var a=0;aICEcoder.splitPaneLeftPerc?ICEcoder.splitPaneLeftPerc=50-(100-ICEcoder.splitPaneLeftPerc)/1.8+50:(ICEcoder.splitPaneLeftPerc=ICEcoder.splitPane?50:100,clearInterval(ICEcoder.animSplitPaneInt));ICEcoder.setLayout()},4)},toolShowHideToggle:function(a){var b= + window.innerHeight;-1<["terminal","output","database","git"].indexOf(a)&&(get("terminal").style.top=b+"px",get("output").style.top=b+"px",get("database").style.top=b+"px",get("git").style.top=b+"px",get(a).style.top=ICEcoder.showingTool===a?b+"px":0,"terminal"===a&&setTimeout(function(){ICEcoder.terminal.contentWindow.document.getElementById("command").focus()},0),ICEcoder.showingTool=ICEcoder.showingTool!==a?a:!1)},docExplorerShow:function(a){var b;get("miniMap").style.display="miniMap"==a?"block": + "none";get("functionClassList").style.display="functionClassList"==a?"block":"none";"miniMap"==a&&(miniMapInt=setInterval(function(){0!=get("miniMapContent").getBoundingClientRect().height&&(b=ICEcoder.getcMInstance(),ICEcoder.setMinimapLayout(b),clearInterval(miniMapInt))},10))},changeFilesW:function(a){ICEcoder.lockedNav&&ICEcoder.filesW!=ICEcoder.minFilesW||("undefined"!=typeof ICEcoder.changeFilesInt&&clearInterval(ICEcoder.changeFilesInt),ICEcoder.changeFilesInt=setInterval(function(){ICEcoder.changeFilesWStep(a)}, + 10))},changeFilesWStep:function(a){"expand"==a?ICEcoder.filesWICEcoder.minFilesW+1?ICEcoder.filesW-=Math.ceil((ICEcoder.filesW-ICEcoder.minFilesW)/2):ICEcoder.filesW=ICEcoder.minFilesW;("expand"==a&&ICEcoder.filesW==ICEcoder.maxFilesW||"contract"==a&&ICEcoder.filesW==ICEcoder.minFilesW)&&clearInterval(ICEcoder.changeFilesInt);ICEcoder.setLayout()},canResizeFilesW:function(){ICEcoder.ready&& + "w-resize"==document.body.style.cursor?ICEcoder.mouseDown&&"gutter"==ICEcoder.mouseDownInCM&&(ICEcoder.filesW=ICEcoder.maxFilesW=250<=ICEcoder.mouseX&&400>=ICEcoder.mouseX?ICEcoder.mouseX:250>ICEcoder.mouseX?250:400,ICEcoder.files.style.width=ICEcoder.filesFrame.style.width=ICEcoder.filesW+"px",ICEcoder.setLayout(),ICEcoder.draggingFilesW=!0):ICEcoder.draggingFilesW=!1},lockUnlockNav:function(){var a=ICEcoder.filesFrame.contentWindow.document.getElementById("fmLock");ICEcoder.lockedNav=!ICEcoder.lockedNav; + a.style.backgroundPosition=ICEcoder.lockedNav?"0 0":"-16px 0"},showHidePlugins:function(a){get("plugins").style.width="show"==a?"55px":"3px";get("plugins").style.background="show"==a?"#333":"transparent";"show"==a&&ICEcoder.changeFilesW("expand")},cMonFocus:function(a,b){ICEcoder.getCaretPosition();ICEcoder.updateCharDisplay();ICEcoder.updateByteDisplay();ICEcoder.editorFocusInstance=b;ICEcoder.getCaretPosition()},cMonBlur:function(a,b){},cMonKeyUp:function(a,b){"undefined"!=typeof doFind&&clearInterval(doFind); + doFind=setTimeout(function(){ICEcoder.findReplace(get("find").value,!0,!1)},500);ICEcoder.getCaretPosition();ICEcoder.updateCharDisplay();ICEcoder.updateByteDisplay()},cMonCursorActivity:function(a,b){ICEcoder.getCaretPosition();ICEcoder.updateCharDisplay();ICEcoder.updateByteDisplay();a.removeLineClass(ICEcoder["cMActiveLine"+b],"background");a.getCursor("start").line==a.getCursor().line&&(ICEcoder["cMActiveLine"+b]=a.addLineClass(a.getCursor().line,"background","cm-s-activeLine"));"CSS"==ICEcoder.caretLocType&& + ICEcoder.cssColorPreview();var c=-1")&&"undefined"!=typeof f&&"undo"!=c.origin&&"redo"!=c.origin&&"undefined"!=typeof f.open&&"undefined"!=typeof f.close){var g="open"==f.at?"close":"open";null!==f[g]&&(f=f[g].tag+";"+f[g].from.line+ + ":"+f[g].from.ch,-1==ICEcoder.oppTagReplaceData.indexOf(f)&&ICEcoder.oppTagReplaceData.push(f))}}},cMonChange:function(a,b,c,d){var e;b=a.listSelections();ICEcoder.loadingFile?setTimeout(function(){a.replaceRange("X",{line:1,ch:1},{line:1,ch:1});a.undo();a.clearHistory();ICEcoder.savedPoints[ICEcoder.selectedTab-1]=a.changeGeneration();ICEcoder.savedContents[ICEcoder.selectedTab-1]=a.getValue()},0):ICEcoder.redoTabHighlight(ICEcoder.selectedTab);setTimeout(function(){ICEcoder.scrollBarVisible=a.getScrollInfo().height> + a.getScrollInfo().clientHeight;ICEcoder.setLayout()},0);if("undefined"!=typeof ICEcoder.oppTagReplaceData[0])for(var f=0;fa.defaultTextHeight()&&(f+=b.getLineHandle(e).height-a.defaultTextHeight());f>a.defaultTextHeight()&&ICEcoder.renderLineStyle.push(["main",c[d][2],"height",f+"px"]);for(e=0;ea.defaultTextHeight()&&(f+=a.getLineHandle(e).height-a.defaultTextHeight());f>a.defaultTextHeight()&& + ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",f+"px"]);for(e=0;ec&e>c&a[d-1]==b[e-1];d--)e--;return[c,d-c,e-c]},highlightGitDiffs:function(){"undefined"!=typeof highlightGitDiffTimeout&&clearTimeout(highlightGitDiffTimeout);ICEcoder.indexData&&ICEcoder.indexData.gitContent&&(highlightGitDiffTimeout=setTimeout(function(){if(ICEcoder.indexData.gitContent[docRoot+ICEcoder.openFiles[ICEcoder.selectedTab-1]]){cM=ICEcoder.getcMInstance();cM.clearGutter("CodeMirror-linenumbers");for(var a=cM?difflib.stringAsLines(cM.getValue()): + "",b=difflib.stringAsLines(ICEcoder.indexData.gitContent[docRoot+ICEcoder.openFiles[ICEcoder.selectedTab-1]].lastHashContent),c=(new difflib.SequenceMatcher(b,a)).get_opcodes(),d=0;dc[d][3]?(f.style.borderTop="solid #b00 1px",f.innerHTML=c[d][3]+1,cM.setGutterMarker(c[d][3],"CodeMirror-linenumbers",f)):(f.style.borderBottom= + "solid #b00 1px",f.innerHTML=c[d][3],cM.setGutterMarker(c[d][3]-1,"CodeMirror-linenumbers",f))}},ICEcoder.loadingFile?100:0))},updateGitDiffPane:function(){for(var a="",b=0;b"+ICEcoder.indexData.gitDiff.paths[b]+"\n",get("git").innerHTML=a+"

    "},updatePreviewWindow:function(a,b,c,d){ICEcoder.previewWindow.location.pathname== + b?-1<["htm","html","txt"].indexOf(d)?ICEcoder.previewWindow.document.documentElement.innerHTML=a.getValue():-1<["md"].indexOf(d)&&(ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(a.getValue())):-1<["css"].indexOf(d)&&-1/g,""); + a.setValue(b);a.clearHistory();ICEcoder.savedPoints[ICEcoder.selectedTab-1]=a.changeGeneration();ICEcoder.savedContents[ICEcoder.selectedTab-1]=a.getValue()},undo:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.getcMdiffInstance();(-1=f.line;b--)e.replaceRange(e.getLine(b),{line:b+1,ch:0},{line:b+1,ch:1E6});e.replaceRange(l,{line:"up"==a?g.line:f.line,ch:0},{line:"up"==a?g.line:f.line,ch:1E6});e.setSelection({line:f.line+("up"==a?-1:1),ch:f.ch},{line:g.line+("up"==a?-1:1),ch:g.ch})})}},highlightLine:function(a){var b=ICEcoder.getcMInstance();var c= + ICEcoder.getcMdiffInstance();b=-1\n"+ d.getSelection()+"\n","around");for(var a=e+1;a<=f+1;a++)d.indentLine(a);d.indentLine(f+2,"prev");d.indentLine(f+2,"subtract")})}else-1<["p","a","h1","h2","h3"].indexOf(a)&&d.getSelection().substr(0,a.length+1)=="<"+b&&d.getSelection().substr(-(a.length+3))==""?d.replaceSelection(d.getSelection().substr(d.getSelection().indexOf(">")+1,d.getSelection().length-d.getSelection().indexOf(">")-1-a.length-3),"around"):("a"==a&&(b='a href=""'),d.replaceSelection("<"+b+">"+d.getSelection()+"","around"),"a"==a&&d.setCursor({line:d.getCursor("start").line,ch:d.getCursor("start").ch+9}))},addLineBreakAtEnd:function(a){var b=ICEcoder.getcMInstance();var c=ICEcoder.getcMdiffInstance();b=-1",{line:a,ch:0},{line:a,ch:1E6})},insertLineBefore:function(a){var b=ICEcoder.getcMInstance();var c=ICEcoder.getcMdiffInstance();var d=-1'+top.ICEcoder.functionClassList[b].name+'
    '+top.ICEcoder.functionClassList[b].params+"");get("functionClassList").innerHTML=a},0))},updateFunctionClassListItems:function(a){var b=ICEcoder.getcMInstance(); - var c="";-1'+get("miniMapContent").innerHTML+"";get("miniMapContent").innerHTML=get("miniMapContent").innerHTML.replace(/'; - var b=get("miniMapBox");b=new Draggabilly(b,{axis:"y",containment:!0});b.on("dragMove",function(b,d,e){yPos=this.position.y;maxHeight=parseInt(get("docExplorer").style.height,10)<=parseInt(get("miniMapContent").getBoundingClientRect().height,10)?parseInt(get("docExplorer").style.height,10):parseInt(get("miniMapContent").getBoundingClientRect().height,10);newPerc=this.position.y/(maxHeight-top.ICEcoder.miniMapBoxHeight);yPos=(a.getScrollInfo().height-a.getScrollInfo().clientHeight)*newPerc;a.scrollTo(0, - yPos)});b.on("pointerDown",function(a,b){top.ICEcoder.mouseDownMinimap=!0});b.on("pointerUp",function(a,b){top.ICEcoder.mouseDownMinimap=!1});top.ICEcoder.setMinimapLayout(a);get("docExplorer").style.right="-220px"}},setMinimapLayout:function(a,b){if(get("miniMapBox")&&a){var c=top.ICEcoder.getcMInstance();var d=a.getScrollInfo().top/(a.getScrollInfo().height-a.getScrollInfo().clientHeight);parseInt(get("miniMapContent").getBoundingClientRect().height,10)>parseInt(get("docExplorer").style.height, - 10)?(get("miniMapContainer").style.height=parseInt(get("docExplorer").style.height,10)+"px",top.ICEcoder.miniMapBoxHeight=parseInt(get("docExplorer").style.height,10)/c.defaultTextHeight()*2,get("miniMapBox").style.height=top.ICEcoder.miniMapBoxHeight+"px",top.ICEcoder.miniMapBoxTop=d*parseInt(get("docExplorer").style.height,10)-d*top.ICEcoder.miniMapBoxHeight,get("miniMapContent").style.marginTop=-(parseInt(get("miniMapContent").getBoundingClientRect().height,10)-parseInt(get("docExplorer").style.height, - 10))*d+"px"):(get("miniMapContainer").style.height=parseInt(get("miniMapContent").getBoundingClientRect().height,10)+"px",top.ICEcoder.miniMapBoxHeight=parseInt(get("docExplorer").style.height,10)/c.defaultTextHeight()*2,get("miniMapBox").style.height=top.ICEcoder.miniMapBoxHeight+"px",top.ICEcoder.miniMapBoxTop=d*parseInt(get("miniMapContainer").getBoundingClientRect().height,10)-d*top.ICEcoder.miniMapBoxHeight,get("miniMapContent").style.marginTop=0);top.ICEcoder.mouseDownMinimap||(get("miniMapBox").style.top= - top.ICEcoder.miniMapBoxTop+"px")}},autocomplete:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.getcMdiffInstance();a=-1g.replace(/\d+/g,f)?d:g;if(0d&&("LI"!=b.childNodes[d].nodeName&&d++,e=b.childNodes[d].childNodes[0].childNodes[1],e.id==c&&(a=!0),1==a&&-1==top.ICEcoder.selectedFiles.indexOf(e.id)&&(ICEcoder.selectDeselectFile("select",e),top.ICEcoder.selectedFiles.push(e.id)),e.id!=g);d+=2);else ICEcoder.selectDeselectFile("select", - e),top.ICEcoder.selectedFiles.push(d)}else top.ICEcoder.deselectAllFiles(),ICEcoder.selectDeselectFile("select",e),top.ICEcoder.selectedFiles.push(d)}top.ICEcoder.githubDiff&&(top.get("githubNavSelectedCount").innerHTML="Selected: "+top.ICEcoder.selectedFiles.length,top.get("githubNavCommit").style.color=0"+top.t["Creating Folder"]+ - "
    "+a)},returnFileAndLine:function(a){var b=1,c=/^([^ ]*)\s+(on\s+)?(line\s+)?(\d+)/.exec(a);null!==c?(b=c[4],a=c[1]):0"+top.t["Opening File"]+"
    "+top.ICEcoder.shortURL)):top.ICEcoder.createNewTab("new"),top.ICEcoder.fMIconVis("fMView",1))}},openFilesFromList:function(a){for(var b=0;b"+top.t.Getting+"
    "+a)},getChangesToSave:function(){var a=top.ICEcoder.getcMInstance();var b=top.ICEcoder.savedContents[top.ICEcoder.selectedTab-1];a=difflib.stringAsLines(a.getValue());b=difflib.stringAsLines(b);b=(new difflib.SequenceMatcher(b,a)).get_opcodes();for(var c=0;c"+top.t.Saving+"
    "+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,""))},renameFile:function(a,b){if(a)var c=a.replace(/\|/g,"/");else c=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"),a=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/");b||(b=top.ICEcoder.getInput(top.t["Please enter the..."],c));if(b){var d=top.ICEcoder.openFiles.indexOf(c.replace(/\|/g, - "/"));-1',c=top.ICEcoder.openFiles[d],top.get("tab"+(d+1)).innerHTML=closeTabLink+" "+c.slice(c.lastIndexOf("/")).replace(/\//, - ""),top.get("tab"+(d+1)).title=b);top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=rename&oldFileName="+encodeURIComponent(a.replace(/\|/g,"/"))+"&csrf="+top.ICEcoder.csrf,encodeURIComponent(b));top.ICEcoder.serverMessage(""+top.t["Renaming to"]+"
    "+b);top.ICEcoder.setPreviousFiles()}},moveFile:function(a,b){if(b&&b!=a){var c=top.ICEcoder.openFiles.indexOf(a.replace(/\|/g,"/"));if(-1'; - var d=top.ICEcoder.openFiles[c];top.get("tab"+(c+1)).innerHTML=closeTabLink+" "+d.slice(d.lastIndexOf("/")).replace(/\//,"");top.get("tab"+(c+1)).title=b}top.ICEcoder.ask("Are you sure you want to move file "+a+" to "+b+" ?")&&(top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=move&oldFileName="+encodeURIComponent(a.replace(/\//g,"|"))+"&csrf="+top.ICEcoder.csrf,encodeURIComponent(b.replace(/\//g,"|"))),top.ICEcoder.serverMessage(""+top.t["Moving to"]+"
    "+b));top.ICEcoder.setPreviousFiles()}}, - deleteFiles:function(a){a=a?a:top.ICEcoder.selectedFiles;var b=a.toString().replace(/\|/g,"/").replace(/,/g,"\n");0"+top.t["Deleting File"]+"
    "+b))},copyFiles:function(a,b,c){top.ICEcoder.copiedFiles=[];for(var d=0;d"+top.t["Pasting File"]+"
    "+top.ICEcoder.copiedFiles[b].toString().replace(/\|/g,"/").replace(/,/g,"\n"))):top.ICEcoder.message(top.t["Sorry cannot paste..."]); - else top.ICEcoder.message(top.t["Nothing to paste..."])},duplicateFiles:function(a){if(top.ICEcoder.copiedFiles)var b=top.ICEcoder.copiedFiles;top.ICEcoder.copyFiles(a,"dontShowPaste","dontHide");a=a[0].substr(0,a[0].lastIndexOf("|"));top.ICEcoder.pasteFiles(a);"undefined"!=typeof b&&(top.ICEcoder.copiedFiles=b)},uploadFilesSelect:function(a){top.get("uploadDir").value=a;top.get("fileInput").click()},uploadFilesSubmit:function(a){""!=top.get("fileInput").value&&(top.ICEcoder.showHide("show",top.get("loadingMask")), - top.get("uploadFilesForm").submit(),event.preventDefault())},showHideFileNav:function(a,b){var c=["optionsFile","optionsEdit","optionsSource","optionsHelp"];if("hide"==a)fileNavInt=setTimeout(function(){for(var a=0;ab&&(c-=c+a-b);top.get("fileMenu").style.top=c+"px"}return!1},showFileMenu:function(){top.get("fileMenu").style.display="inline-block";setTimeout(function(){top.get("fileMenu").style.opacity="1"},4)},hideFileMenu:function(){top.get("fileMenu").style.display="none";top.get("fileMenu").style.opacity="0"},updateFileManagerList:function(a,b,c,d,e,f,g){if("add"==a&&!top.get("filesFrame").contentWindow.document.getElementById(b.replace(top.iceRoot, - "").replace(/\/$/,"").replace(/\//g,"|")+"|"+c)){var l="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?top.ICEcoder.newFilePerms:top.ICEcoder.newDirPerms;b||(b="/");b=b.replace(top.iceRoot,"/");b=b.replace("//","/");var h=top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));var m=h.parentNode.parentNode.nextSibling;var n=document.createTextNode("\n");var p=777==d?"background: #800; color: #eee":"color: #888";p='        '+c+' '+d+"";if(!m||3>m.childNodes.length){var k=document.createElement("ul");m=h.parentNode.parentNode; - m.parentNode.insertBefore(k,m.nextSibling);k=document.createElement("li");k.className=l;k.draggable=!1;k.ondragstart=function(a){top.ICEcoder.addDefaultDragData(this,a)};k.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())};k.ondragover=function(a){top.ICEcoder.setDragCursor(a,"folder"==g?"folder":"file")};k.ondragend=function(){top.ICEcoder.dropFile(this)}; - k.innerHTML=p;m.nextSibling.appendChild(k);m.nextSibling.appendChild(n)}else for(h=0;hc||"folder"==g&&"file"==k||h==m.childNodes.length-1){k=document.createElement("li");k.className=l;k.draggable=!1;k.ondragstart=function(a){top.ICEcoder.addDefaultDragData(this,a)};k.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a); - top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())};k.ondragover=function(a){top.ICEcoder.setDragCursor(a,"folder"==g?"folder":"file")};k.ondragend=function(){top.ICEcoder.dropFile(this)};k.innerHTML=p;h==m.childNodes.length-1?(m.appendChild(k),m.appendChild(n)):(m.insertBefore(k,m.childNodes[h]),m.insertBefore(n,m.childNodes[h+1]));break}}"file"!=g||f||(top.ICEcoder.openFiles[top.ICEcoder.selectedTab- - 1]=b+c)}"rename"==a&&(f=e.replace(/\//g,"|"),h=top.get("filesFrame").contentWindow.document.getElementById(f),h.innerHTML=c,h.id=b.replace(/\//g,"|")+"|"+c,h.parentNode.title=h.id.replace(/\|/g,"/"),targetElemPerms=top.get("filesFrame").contentWindow.document.getElementById(f+"_perms"),targetElemPerms.id=b.replace(/\//g,"|")+"|"+c+"_perms",top.ICEcoder.renameInChildren(h,e,b,c));"move"==a&&(top.ICEcoder.updateFileManagerList("add",b,c,!1,!1,!1,g),top.ICEcoder.updateFileManagerList("delete",e.substr(0, - e.lastIndexOf("/")),c));"chmod"==a&&(f=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"),h=top.get("filesFrame").contentWindow.document.getElementById(f.replace(/\//g,"|")+"_perms"),h.style.background=777==d?"#800":"none",h.style.color=777==d?"#eee":"#888",h.innerHTML=d);"delete"==a&&(b||(b=""),b=b.replace(top.iceRoot,"/"),b=b.replace("//","/"),b=b.replace(/\/$/,"").replace(/\//g,"|"),h=(b+"|"+c).replace("||","|"),h=top.get("filesFrame").contentWindow.document.getElementById(h).parentNode.parentNode, - top.ICEcoder.openCloseDir(h.childNodes[0],!1),h.parentNode.removeChild(h))},renameInChildren:function(a,b,c,d){if(a.parentNode.parentNode.nextSibling&&"UL"==a.parentNode.parentNode.nextSibling.nodeName){a=a.parentNode.parentNode.nextSibling;for(var e=0;ed.indexFromPos({ch:d.getCursor().ch- - 1,line:d.getCursor().line})&&ICEcoder.findResult--;else for(f=ICEcoder.findResult=0;fICEcoder.results.length-1&&(ICEcoder.findResult=0);e&&1==ICEcoder.findResult&&(ICEcoder.findResult=ICEcoder.results.length+1);g.innerHTML="Highlighted result "+(ICEcoder.findResult+(e?-1:1))+" of "+ICEcoder.results.length+" results";e?(b=d.getSearchCursor(a, - {ch:d.getCursor().ch-1,line:d.getCursor().line},!0),b.findPrevious(),b.from()||(b=d.getSearchCursor(a,{line:1E6,ch:1E6},!0),b.findPrevious())):(b=d.getSearchCursor(a,{ch:d.getCursor().ch+1,line:d.getCursor().line},!0),b.findNext(),b.from()||(b=d.getSearchCursor(a,{line:0,ch:0},!0),b.findNext()));d.setSelection(b.from(),b.to());top.ICEcoder.focus();top.ICEcoder.findMode=!0}a=top.ICEcoder.scrollBarVisible?parseInt(top.ICEcoder.content.style.height,10)/d.lineCount():d.defaultTextHeight();b=top.ICEcoder.scrollBarVisible? - 0:d.heightAtLine(0);e="";for(f=1;f<=d.lineCount();f++)g=-1';top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML=e;top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="inline-block";return!0}g.innerHTML="No results"; - top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML="";top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="none";return!1}""!=a&&c?(e=b=d="",document.findAndReplace.connector.value==top.t.and&&(d="&replace="+f),0<=document.findAndReplace.target.value.indexOf(top.t.file)&&(b="&target="+document.findAndReplace.target.value.replace(/ /g,"-")),document.findAndReplace.target.value==top.t["selected files"]&&(e="&selectedFiles="+top.ICEcoder.selectedFiles.join(":")), - a=a.replace(/'/g,"'"),a!=encodeURIComponent(a)?a="ICEcoder:"+encodeURIComponent(a):a,top.ICEcoder.showHide("show",top.get("loadingMask")),top.get("mediaContainer").innerHTML=''):(g.innerHTML="No results",top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML="",top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display= - "none")}},replaceInFile:function(a,b,c){top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=replaceText&find="+b+"&replace="+c+"&csrf="+top.ICEcoder.csrf,encodeURIComponent(a.replace(/\//g,"|")));top.ICEcoder.serverMessage(""+top.t["Replacing text in"]+"
    "+a)},getCaretPosition:function(){var a;var b=ICEcoder.getcMInstance();var c=ICEcoder.getcMdiffInstance();b=-1=b||10<=b)&&top.ICEcoder.mouseX>parseInt(top.ICEcoder.files.style.width,10)&&(top.ICEcoder.tabDragMouseX=top.ICEcoder.mouseX-parseInt(top.ICEcoder.files.style.width,10)-top.ICEcoder.tabDragMouseXStart,top.ICEcoder.tabDragMove());if(top.ICEcoder.ready&&(top.ICEcoder.mouseDown||(top.ICEcoder.draggingFilesW=!1),b=!ICEcoder.draggingTab&&(top.ICEcoder.mouseX>top.ICEcoder.filesW-7&&top.ICEcoder.mouseX").replace(/<\/b>/g,"").replace(/<br>/g,"
    "),b.style.left="0"):setTimeout(function(){b.style.left="2000px"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a, - b;var c=ICEcoder.getcMInstance();var d=ICEcoder.getcMdiffInstance();if(c=-1b.index+b[0].length;);(d=top.get("content").contentWindow.document.getElementById("cssColor"))&&d.parentNode.removeChild(d);top.ICEcoder.codeAssist&&"CSS"==top.ICEcoder.caretLocType&&(d=top.document.createElement("div"),d.id= - "cssColor",d.style.position="absolute",d.style.display="block",d.style.width=d.style.height="20px",d.style.zIndex="1000",d.style.background=b?b[0]:"",d.style.cursor="pointer",d.onclick=function(){top.ICEcoder.showColorPicker(b[0])},""==d.style.backgroundColor&&(d.style.display="none"),top.get("header").appendChild(d),c.addWidget(c.getCursor(),top.get("cssColor"),!0))}},showColorPicker:function(a){top.get("blackMask").style.visibility="visible";top.get("mediaContainer").innerHTML='



    '; - farbtastic("picker","color");a&&top.get("picker").farbtastic.setColor(a)},initCanvasImage:function(a){var b=top.get("canvasPicker").getContext("2d");var c=new Image;c.crossOrigin="Anonymous";c.src=a.src;c.onerror=function(){get("floatingContainer").style.visibility="hidden";get("canvasPickerColorInfo").style.display="none";get("canvasPickerCORSInfo").style.display="block"};c.onload=function(){top.get("canvasPicker").width=a.width;top.get("canvasPicker").height=a.height;b.drawImage(c,0,0,a.width,a.height); - get("canvasPickerColorInfo").style.display="block";get("canvasPickerCORSInfo").style.display="none";top.get("canvasPicker").onmouseover=function(a){get("floatingContainer").style.visibility="visible"};top.get("canvasPicker").onmouseout=function(a){get("floatingContainer").style.visibility="hidden"}};top.document.getElementById("floatingContainer").style.backgroundSize=5*a.naturalWidth+"px "+5*a.naturalHeight+"px"},interactCanvasImage:function(a){var b,c,d,e,f,g,l,h,m,n,p,k;var r=top.get("canvasPicker").getContext("2d"); - top.get("canvasPicker").onmousemove=function(t){b=t.pageX-this.offsetLeft;c=t.pageY-this.offsetTop;d=r.getImageData(b,c,1,1).data;e=d[0];f=d[1];g=d[2];l=e+","+f+","+g;h=top.ICEcoder.rgbToHex(e,f,g);top.get("rgbMouseXY").value=l;top.get("hexMouseXY").value="#"+h;top.get("hexMouseXY").style.backgroundColor=top.get("rgbMouseXY").style.backgroundColor="#"+h;m=128>e||128>f||128>g&&200>e&&200>f&&50'+top.t["Cancelled tasks"]+""); - setTimeout(function(){top.ICEcoder.serverMessage()},2E3)},setPreviousFiles:function(){var a=top.ICEcoder.openFiles.join(",").replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,"");""==a&&(a="CLEAR");top.ICEcoder.serverQueue("add","lib/settings.php?saveFiles="+encodeURIComponent(a)+"&csrf="+top.ICEcoder.csrf);top.ICEcoder.updateLast10List(a)},updateLast10List:function(a){a=a.split(",");for(var b=0;b"+a[b].replace(/\|/g,"/")+"\n";var d=top.ICEcoder.content.contentWindow.document.getElementById("last10Files");if(-1==d.innerHTML.indexOf(c)){var e=d.innerHTML.split("\n");(10<=e.length||'
    [none]


    '==e[0]||""==e[e.length-1])&&e.pop();d.innerHTML=c+e.join("\n")}}},autoOpenFiles:function(){if(0< - top.ICEcoder.previousFiles.length&&top.ICEcoder.ask(top.t["Open previous files"]+"\n\n"+top.ICEcoder.previousFiles.length+" files:\n"+top.ICEcoder.previousFiles.join("\n").replace(/\|/g,"/").replace(new RegExp(top.docRoot+top.iceRoot,"gi"),"")))for(var a=0;a');top.ICEcoder.showHide(a?"hide":"show",top.get("blackMask"))},helpScreen:function(){top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))},versionsScreen:function(a,b){top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))},showManual:function(a,b){var c=b?"#"+b:"";top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))},propertiesScreen:function(a){top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))},autoLogoutWarningScreen:function(){top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))},pluginsManager:function(){top.get("mediaContainer").innerHTML=''; - top.ICEcoder.showHide("show",top.get("blackMask"))},goLocalhostRoot:function(){top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="lib/go-localhost-root.php"},githubAction:function(a){top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))},githubTokenAsk:function(a){if(githubAuthToken= - top.ICEcoder.getInput(top.t["Please enter your..."],""))top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="lib/github.php?action=auth&token="+githubAuthToken+"&goNext="+a+"&csrf="+top.ICEcoder.csrf,githubAuthToken=""},showHideGithubNav:function(a){top.get("githubNav").style.display="show"==a?"block":"none";top.get("fileNav").style.display="show"==a?"none":"block"},githubManager:function(){top.ICEcoder.githubAuthTokenSet?(top.get("mediaContainer").innerHTML='', - top.ICEcoder.showHide("show",top.get("blackMask"))):top.ICEcoder.githubTokenAsk("showManager")},githubDiffToggle:function(){if(!top.ICEcoder.githubAuthTokenSet)top.ICEcoder.githubTokenAsk("loadFiles");else if(top.ICEcoder.githubDiff||top.ICEcoder.ask(top.t["This will compare..."])){top.ICEcoder.githubDiff=!top.ICEcoder.githubDiff;var a=top.ICEcoder.githubDiff?"true":"false";top.ICEcoder.filesFrame.src="files.php?githubDiff="+a+"&csrf="+top.ICEcoder.csrf}},ftpManager:function(){top.get("mediaContainer").innerHTML= - '';top.ICEcoder.showHide("show",top.get("blackMask"))},useNewSettings:function(a,b,c,d,e,f,g,l,h,m,n,p,k,r,t,w,v,x,y,z,A,B,C,D){var u=a.slice(0,a.lastIndexOf("?"));u=u.slice(u.lastIndexOf("/")+1,u.lastIndexOf("."));if(top.ICEcoder.theme!==u){top.ICEcoder.theme=u;"editor"==top.ICEcoder.theme&&(top.ICEcoder.theme="icecoder");var q=document.createElement("link");q.setAttribute("rel","stylesheet");q.setAttribute("type", - "text/css");q.setAttribute("href",a);top.ICEcoder.content.contentWindow.document.getElementsByTagName("head")[0].appendChild(q);q=document.createElement("link");q.setAttribute("rel","stylesheet");q.setAttribute("type","text/css");q.setAttribute("href",a);top.document.getElementsByTagName("head")[0].appendChild(q);q=-1<"3024-day base16-light eclipse elegant mdn-like neat neo paraiso-light solarized the-matrix xq-light".split(" ").indexOf(top.ICEcoder.theme)?"#ccc":-1<"3024-night blackboard colorforth liquibyte night tomorrow-night-bright tomorrow-night-eighties vibrant-ink".split(" ").indexOf(top.ICEcoder.theme)? - "#888":"#000";top.ICEcoder.switchTab(top.ICEcoder.selectedTab)}b!=top.ICEcoder.codeAssist&&(top.get("codeAssist").checked=b,top.ICEcoder.codeAssistToggle());c!=top.ICEcoder.lockedNav&&(top.ICEcoder.lockUnlockNav(),ICEcoder.changeFilesW(c?"expand":"contract"),top.ICEcoder.hideFileMenu());a=top.document.styleSheets[0];b=a.rules?"rules":"cssRules";a[b][0].style.fontSize=g;a=ICEcoder.filesFrame.contentWindow.document.styleSheets[3];b=a.rules?"rules":"cssRules";a[b][0].style.fontSize=g;a=ICEcoder.content.contentWindow.document.styleSheets[6]; - b=a.rules?"rules":"cssRules";a[b][0].style.fontSize=g;a[b][4].style["border-left-width"]=f?"1px":"0";a[b][4].style["margin-left"]=f?"-1px":"0";a[b][2].style.cssText="background-color: "+q+" !important";top.ICEcoder.lineWrapping=l;top.ICEcoder.lineNumbers=h;top.ICEcoder.showTrailingSpace=m;top.ICEcoder.matchBrackets=n;top.ICEcoder.autoCloseTags=p;top.ICEcoder.autoCloseBrackets=k;top.ICEcoder.indentWithTabs=r;top.ICEcoder.indentSize=w;top.ICEcoder.indentAuto=t;for(f=0;fchMod "+ - b+" on
    "+a.replace(/\|/g,"/"))},openPreviewWindow:function(){if(060*top.ICEcoder.autoLogoutMins-60&&ICEcoder.showHide("hide",get("blackMask")); - top.ICEcoder.autoLogoutTimer=0},logout:function(a){window.location=window.location+"?logout&"+(a?"type="+a+"&":"")+"csrf="+top.ICEcoder.csrf},outputMsg:function(a){top.ICEcoder.output.innerHTML+=a+"
    "},message:function(a){alert(a)},ask:function(a){return confirm(a)},getInput:function(a,b){return prompt(a,b)},dataMessage:function(a){var b=top.ICEcoder.content.contentWindow.document.getElementById("dataMessage");b.style.display="block";b.innerHTML=a},update:function(){confirm(top.t["Please note for..."])? - (top.ICEcoder.showHide("show",top.get("loadingMask")),window.location="lib/updater.php"):window.open("https://icecoder.net")},updated:function(){top.get("blackMask").style.visibility="visible";top.get("mediaContainer").innerHTML='

    Thanks for updating to v'+top.ICEcoder.versionNo+'!

    Click anywhere to continue using ICEcoder...

    '},xhrObj:function(){try{return new XMLHttpRequest}catch(a){}try{return new ActiveXObject("Msxml3.XMLHTTP")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}return null}, - openBugReport:function(){"off"==top.ICEcoder.bugReportStatus&&top.ICEcoder.message(top.t["You can start..."]);"error"==top.ICEcoder.bugReportStatus&&top.ICEcoder.message(top.t["Error cannot find..."]);"ok"==top.ICEcoder.bugReportStatus&&top.ICEcoder.message(top.t["No new errors..."]);if("bugs"==top.ICEcoder.bugReportStatus){var a=top.ICEcoder.openFiles.indexOf(top.ICEcoder.bugReportPath.replace(/\|/g,"/"));-1/g,">").replace(/"/g, - """).replace(/'/g,"'")},printCode:function(){var a=top.ICEcoder.getcMInstance();var b=top.ICEcoder.getcMdiffInstance();a=-1ICEcoder code output
    '+top.ICEcoder.xssClean(a.getValue())+"
    ";b.focus();b.print();a.focus()},indicateChanges:function(){if(!top.ICEcoder.loadingFile){var a= - "ICEcoder v "+top.ICEcoder.versionNo;for(var b=1;b<=top.ICEcoder.savedPoints.length;b++)if(top.ICEcoder.savedPoints[b-1]!=top.ICEcoder.getcMInstance(b).changeGeneration()){a+=" \u2744";break}top.document.title=a}},switchTab:function(a,b){a!==top.ICEcoder.selectedTab&&(top.ICEcoder.prevTab=top.ICEcoder.selectedTab);ICEcoder.selectedTab=a;var c=ICEcoder.getcMInstance();var d=ICEcoder.getcMdiffInstance();if(-1 '+b.slice(b.lastIndexOf("/")).replace(/\//,"");top.get("tab"+top.ICEcoder.openFiles.length).title="/"+top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1].replace(/\//, - "");top.ICEcoder.setTabWidths();top.ICEcoder.redoTabHighlight(top.ICEcoder.openFiles.length);top.ICEcoder.selectedTab=top.ICEcoder.openFiles.length;top.ICEcoder.savedPoints.push(0);top.ICEcoder.savedContents.push("");a||top.ICEcoder.setPreviousFiles()},nextTab:function(){top.ICEcoder.switchTab(top.ICEcoder.selectedTab+1<=top.ICEcoder.openFiles.length?top.ICEcoder.selectedTab+1:1,"noFocus")},previousTab:function(){top.ICEcoder.switchTab(1<=top.ICEcoder.selectedTab-1?top.ICEcoder.selectedTab-1:top.ICEcoder.openFiles.length, - "noFocus")},renameTab:function(a,b){top.ICEcoder.openFiles[a-1]=b;var c=top.ICEcoder.openFiles[a-1];top.get("tab"+a).innerHTML=' '+c.slice(c.lastIndexOf("/")).replace(/\//, - "");top.get("tab"+a).title="/"+top.ICEcoder.openFiles[a-1].replace(/\//,"")},redoTabHighlight:function(a){for(var b,c,d=1;d<=ICEcoder.savedPoints.length;d++)top.get("tab"+d).childNodes[0]&&(top.get("tab"+d).childNodes[0].childNodes[0].style.backgroundColor=ICEcoder.savedPoints[d-1]!=top.ICEcoder.getcMInstance(d).changeGeneration()?"#b00":"transparent"),b=d==a?top.ICEcoder.tabFGselected:top.ICEcoder.tabFGnormalTab,"undefined"!=typeof top.ICEcoder.openFiles[d-1]&&"/[NEW]"!=top.ICEcoder.openFiles[d- - 1]&&(c=top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.openFiles[d-1].replace(/\//g,"|")))&&(c.style.backgroundColor=d==a?top.ICEcoder.tabBGcurrent:top.ICEcoder.tabBGopen,c.style.color=d==a?top.ICEcoder.tabFGcurrent:top.ICEcoder.tabFGopenFile),top.get("tab"+d).style.color=b,top.get("tab"+d).style.background=d==a?top.ICEcoder.tabBGcurrent:top.ICEcoder.tabBGopen},closeTab:function(a,b,c){a||(a=top.ICEcoder.selectedTab);ICEcoder.getcMInstance();ICEcoder.getcMdiffInstance(); - var d=!0;c||ICEcoder.savedPoints[a-1]==top.ICEcoder.getcMInstance(a).changeGeneration()||(d=top.ICEcoder.ask(top.t["You have made..."]));if(d){c=top.ICEcoder.openFiles[a-1];for(d=a;db?parseInt(c*g,10)-parseInt(c*(g-1),10):150,e=0==g?53:parseInt(top.get("tab"+g).style.left,10),f=0==g?0:parseInt(top.get("tab"+g).style.width, - 10)+18,a?d=-18:(top.get("tab"+(g+1)).style.left=e+f+"px",top.get("tab"+(g+1)).style.width=d+"px"),top.ICEcoder.tabLeftPos.push(e+f);top.get("newTab").style.left=e+f+d+18+"px"}},tabDragStart:function(a){top.ICEcoder.draggingTab=a;top.ICEcoder.diffStartX=top.ICEcoder.mouseX;top.ICEcoder.tabDragMouseXStart=(top.ICEcoder.mouseX-(parseInt(top.ICEcoder.files.style.width,10)+53+18))%150;top.get("tab"+a).style.zIndex=2;for(var b=1;b<=top.ICEcoder.openFiles.length;b++)top.get("tab"+b).className=b!==a?"tab tabSlide": - "tab tabDrag"},tabDragMove:function(){var a=parseInt(top.get("tab"+top.ICEcoder.openFiles.length).style.width,10)+18;top.ICEcoder.thisLeft=a=53<=top.ICEcoder.tabDragMouseX?top.ICEcoder.tabDragMouseX<=parseInt(top.get("newTab").style.left,10)-a?top.ICEcoder.tabDragMouseX:parseInt(top.get("newTab").style.left,10)-a:53;top.get("tab"+top.ICEcoder.draggingTab).style.left=a+"px";top.ICEcoder.dragTabNo=top.ICEcoder.draggingTab;for(var b=1;b<=top.ICEcoder.openFiles.length;b++){top.get("tab"+b).style.opacity= - b==top.ICEcoder.draggingTab?1:.5;var c=top.ICEcoder.tabLeftPos[b]?top.ICEcoder.tabLeftPos[b]-top.ICEcoder.tabLeftPos[b-1]:c;b!=top.ICEcoder.draggingTab&&(b=top.ICEcoder.tabLeftPos[b-1]?top.ICEcoder.tabLeftPos[b-1]-c:top.ICEcoder.tabLeftPos[b-1])}},tabDragEnd:function(){var a;top.ICEcoder.setTabWidths();for(var b=1;b<=top.ICEcoder.openFiles.length;b++)top.ICEcoder.thisLeft>= - top.ICEcoder.tabLeftPos[b-1]&&(a=top.ICEcoder.thisLeft==top.ICEcoder.tabLeftPos[0]?1:top.ICEcoder.dragTabNo>b?b+1:b),top.get("tab"+b).className="tab",top.get("tab"+b).style.opacity=1,b!=top.ICEcoder.dragTabNo?top.get("tab"+b).style.zIndex=1:setTimeout(function(){top.get("tab"+b).style.zIndex=1},150);if(top.ICEcoder.thisLeft&&!1!==top.ICEcoder.thisLeft){var c=[];for(b=1;b<=top.ICEcoder.openFiles.length;b++)c.push(b);c.splice(top.ICEcoder.dragTabNo-1,1);c.splice(a-1,0,top.ICEcoder.dragTabNo);ICEcoder.sortTabs(c)}top.ICEcoder.setTabWidths(); - top.ICEcoder.draggingTab=!1;top.ICEcoder.thisLeft=!1},sortTabs:function(a){var b;var c=[ICEcoder.savedPoints,ICEcoder.savedContents,ICEcoder.openFiles,ICEcoder.openFileMDTs,ICEcoder.openFileVersions,ICEcoder.cMInstances];var d=[[],[],[],[],[],[]];for(var e=0;eb-5;)e.undo(),a++;if(top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1]==e.changeGeneration())top.ICEcoder.startSnake();else for(b=1;b<=a;b++)e.redo()},0);if(top.ICEcoder.snakePlaying)return 37==d&&(top.ICEcoder.snakeDir= - "left"),39==d&&(top.ICEcoder.snakeDir="right"),38==d&&(top.ICEcoder.snakeDir="up"),40==d&&(top.ICEcoder.snakeDir="down"),!1;if(224==d||91==d||93==d)top.ICEcoder.cmdKey=!0;if(112===d){if(top.ICEcoder.codeZoomedOut)return;top.ICEcoder.codeZoomedOut=!0;var e=ICEcoder.getcMInstance();for(d=0;dLet\'s play
    snake


    Use arrow keys to eat your code

    (it returns afterwards of course) :-)
    ';setTimeout(function(){top.ICEcoder.showHide("hide",top.get("blackMask"));top.get("mediaContainer").innerHTML= - "";top.ICEcoder.playSnake()},2E3)},playSnake:function(){var a=ICEcoder.getcMInstance();a.setOption("readOnly","nocursor");a.focus();top.ICEcoder.snakePreHistory=a.getHistory();top.ICEcoder.snakePreContent=a.getValue();top.ICEcoder.snakePreCursor=a.getCursor();a=Math.floor(50*Math.random());top.ICEcoder.snakePos=[[a,0],[a,-1],[a,-2],[a,-3],[a,-4]];top.ICEcoder.content.contentWindow.document.getElementById("game").style.display="block";top.ICEcoder.snakeDir="down";top.ICEcoder.doSnake();top.ICEcoder.snakeInt= - setInterval(function(){var a=[];a[0]=top.ICEcoder.snakePos[0][0]+("right"==top.ICEcoder.snakeDir?1:"left"==top.ICEcoder.snakeDir?-1:0);a[1]=top.ICEcoder.snakePos[0][1]+("down"==top.ICEcoder.snakeDir?1:"up"==top.ICEcoder.snakeDir?-1:0);top.ICEcoder.snakePos.unshift(a);top.ICEcoder.snakePos.pop();top.ICEcoder.doSnake()},100)},doSnake:function(){var a;var b=ICEcoder.getcMInstance();var c=b.defaultCharWidth();var d=b.defaultTextHeight();var e=top.ICEcoder.content.contentWindow.document.getElementById("game").innerHTML= - "";for(a=0;a';top.ICEcoder.content.contentWindow.document.getElementById("game").innerHTML=e;e=b.coordsChar({top:top.ICEcoder.snakePos[0][1]*d+4,left:top.ICEcoder.snakePos[0][0]*c+60});var f=b.getLine(e.line);if(top.ICEcoder.snakePos[0][0]-1<=f.length-2){var g= - "";if("\t"===f.substr(e.ch,1))for(a=0;atop.ICEcoder.snakePos[0][0]||0>top.ICEcoder.snakePos[0][1]||top.ICEcoder.snakePos[0][0]*c+60>a.clientWidth||top.ICEcoder.snakePos[0][1]*d+4>a.clientHeight||e)clearInterval(top.ICEcoder.snakeInt),top.ICEcoder.content.contentWindow.document.getElementById("game").style.display="none", - b.setValue(top.ICEcoder.snakePreContent),top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1]=b.changeGeneration(),top.ICEcoder.savedContents[top.ICEcoder.selectedTab-1]=top.ICEcoder.snakePreContent,b.setHistory(top.ICEcoder.snakePreHistory),top.ICEcoder.indicateChanges(),top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab),b.setOption("readOnly",!1),b.setCursor(top.ICEcoder.snakePreCursor),b.focus(),top.ICEcoder.snakePlaying=!1}}; \ No newline at end of file + a+">","around"),"a"==a&&d.setCursor({line:d.getCursor("start").line,ch:d.getCursor("start").ch+9}))},addLineBreakAtEnd:function(a){var b=ICEcoder.getcMInstance();var c=ICEcoder.getcMdiffInstance();b=-1",{line:a,ch:0},{line:a,ch:1E6})},insertLineBefore:function(a){var b=ICEcoder.getcMInstance();var c=ICEcoder.getcMdiffInstance();var d=-1'+ICEcoder.functionClassList[b].name+'
    '+ICEcoder.functionClassList[b].params+"");get("functionClassList").innerHTML=a},0))},updateFunctionClassListItems:function(a){var b=ICEcoder.getcMInstance();var c="";-1< + a.text.indexOf("function ")&&-1'+get("miniMapContent").innerHTML+"";get("miniMapContent").innerHTML=get("miniMapContent").innerHTML.replace(/';var b=get("miniMapBox"); + b=new Draggabilly(b,{axis:"y",containment:!0});b.on("dragMove",function(b,d,e){yPos=this.position.y;maxHeight=parseInt(get("docExplorer").style.height,10)<=parseInt(get("miniMapContent").getBoundingClientRect().height,10)?parseInt(get("docExplorer").style.height,10):parseInt(get("miniMapContent").getBoundingClientRect().height,10);newPerc=this.position.y/(maxHeight-ICEcoder.miniMapBoxHeight);yPos=(a.getScrollInfo().height-a.getScrollInfo().clientHeight)*newPerc;a.scrollTo(0,yPos)});b.on("pointerDown", + function(a,b){ICEcoder.mouseDownMinimap=!0});b.on("pointerUp",function(a,b){ICEcoder.mouseDownMinimap=!1});ICEcoder.setMinimapLayout(a);get("docExplorer").style.right="-220px"}},setMinimapLayout:function(a,b){if(get("miniMapBox")&&a){var c=ICEcoder.getcMInstance();var d=a.getScrollInfo().top/(a.getScrollInfo().height-a.getScrollInfo().clientHeight);parseInt(get("miniMapContent").getBoundingClientRect().height,10)>parseInt(get("docExplorer").style.height,10)?(get("miniMapContainer").style.height=parseInt(get("docExplorer").style.height, + 10)+"px",ICEcoder.miniMapBoxHeight=parseInt(get("docExplorer").style.height,10)/c.defaultTextHeight()*2,get("miniMapBox").style.height=ICEcoder.miniMapBoxHeight+"px",ICEcoder.miniMapBoxTop=d*parseInt(get("docExplorer").style.height,10)-d*ICEcoder.miniMapBoxHeight,get("miniMapContent").style.marginTop=-(parseInt(get("miniMapContent").getBoundingClientRect().height,10)-parseInt(get("docExplorer").style.height,10))*d+"px"):(get("miniMapContainer").style.height=parseInt(get("miniMapContent").getBoundingClientRect().height, + 10)+"px",ICEcoder.miniMapBoxHeight=parseInt(get("docExplorer").style.height,10)/c.defaultTextHeight()*2,get("miniMapBox").style.height=ICEcoder.miniMapBoxHeight+"px",ICEcoder.miniMapBoxTop=d*parseInt(get("miniMapContainer").getBoundingClientRect().height,10)-d*ICEcoder.miniMapBoxHeight,get("miniMapContent").style.marginTop=0);ICEcoder.mouseDownMinimap||(get("miniMapBox").style.top=ICEcoder.miniMapBoxTop+"px")}},autocomplete:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.getcMdiffInstance(); + a=-1g.replace(/\d+/g,f)?d:g;if(0d&&("LI"!=b.childNodes[d].nodeName&&d++,e=b.childNodes[d].childNodes[0].childNodes[1],e.id==c&&(a=!0),1==a&&-1==ICEcoder.selectedFiles.indexOf(e.id)&&(ICEcoder.selectDeselectFile("select",e),ICEcoder.selectedFiles.push(e.id)),e.id!=g);d+=2);else ICEcoder.selectDeselectFile("select",e),ICEcoder.selectedFiles.push(d)}else ICEcoder.deselectAllFiles(),ICEcoder.selectDeselectFile("select",e),ICEcoder.selectedFiles.push(d)}ICEcoder.githubDiff&&(get("githubNavSelectedCount").innerHTML= + "Selected: "+ICEcoder.selectedFiles.length,get("githubNavCommit").style.color=0"+t["Creating Folder"]+"
    "+a)},returnFileAndLine:function(a){var b= + 1,c=/^([^ ]*)\s+(on\s+)?(line\s+)?(\d+)/.exec(a);null!==c?(b=c[4],a=c[1]):0"+t["Opening File"]+"
    "+ICEcoder.shortURL)):ICEcoder.createNewTab("new"),ICEcoder.fMIconVis("fMView",1))}},openFilesFromList:function(a){for(var b=0;b"+t.Getting+"
    "+a)},getChangesToSave:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.savedContents[ICEcoder.selectedTab- + 1];a=difflib.stringAsLines(a.getValue());b=difflib.stringAsLines(b);b=(new difflib.SequenceMatcher(b,a)).get_opcodes();for(var c=0;c"+t.Saving+"
    "+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(iceRoot,""))},renameFile:function(a, + b){if(a)var c=a.replace(/\|/g,"/");else c=ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"),a=ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/");b||(b=ICEcoder.getInput(t["Please enter the..."],c));if(b){var d=ICEcoder.openFiles.indexOf(c.replace(/\|/g,"/"));-1', + c=ICEcoder.openFiles[d],get("tab"+(d+1)).innerHTML=closeTabLink+" "+c.slice(c.lastIndexOf("/")).replace(/\//,""),get("tab"+(d+1)).title=b);ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=rename&oldFileName="+encodeURIComponent(a.replace(/\|/g,"/"))+"&csrf="+ICEcoder.csrf,encodeURIComponent(b));ICEcoder.serverMessage(""+t["Renaming to"]+"
    "+b);ICEcoder.setPreviousFiles()}},moveFile:function(a,b){if(b&&b!=a){var c=ICEcoder.openFiles.indexOf(a.replace(/\|/g,"/"));if(-1< + c){ICEcoder.openFiles[c]=b;closeTabLink='';var d=ICEcoder.openFiles[c];get("tab"+(c+1)).innerHTML=closeTabLink+" "+d.slice(d.lastIndexOf("/")).replace(/\//,"");get("tab"+ + (c+1)).title=b}ICEcoder.ask("Are you sure you want to move file "+a+" to "+b+" ?")&&(ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=move&oldFileName="+encodeURIComponent(a.replace(/\//g,"|"))+"&csrf="+ICEcoder.csrf,encodeURIComponent(b.replace(/\//g,"|"))),ICEcoder.serverMessage(""+t["Moving to"]+"
    "+b));ICEcoder.setPreviousFiles()}},deleteFiles:function(a){a=a?a:ICEcoder.selectedFiles;var b=a.toString().replace(/\|/g,"/").replace(/,/g,"\n");0"+t["Deleting File"]+"
    "+b))},copyFiles:function(a,b,c){ICEcoder.copiedFiles=[];for(var d=0;d"+t["Pasting File"]+"
    "+ICEcoder.copiedFiles[b].toString().replace(/\|/g,"/").replace(/,/g,"\n"))):ICEcoder.message(t["Sorry cannot paste..."]);else ICEcoder.message(t["Nothing to paste..."])},duplicateFiles:function(a){if(ICEcoder.copiedFiles)var b=ICEcoder.copiedFiles;ICEcoder.copyFiles(a,"dontShowPaste","dontHide"); + a=a[0].substr(0,a[0].lastIndexOf("|"));ICEcoder.pasteFiles(a);"undefined"!=typeof b&&(ICEcoder.copiedFiles=b)},uploadFilesSelect:function(a){get("uploadDir").value=a;get("fileInput").click()},uploadFilesSubmit:function(a){""!=get("fileInput").value&&(ICEcoder.showHide("show",get("loadingMask")),get("uploadFilesForm").submit(),event.preventDefault())},showHideFileNav:function(a,b){var c=["optionsFile","optionsEdit","optionsSource","optionsHelp"];if("hide"==a)fileNavInt=setTimeout(function(){for(var a= + 0;ab&&(c-=c+a-b);get("fileMenu").style.top=c+"px"}return!1},showFileMenu:function(){get("fileMenu").style.display="inline-block";setTimeout(function(){get("fileMenu").style.opacity="1"},4)},hideFileMenu:function(){get("fileMenu").style.display="none";get("fileMenu").style.opacity= + "0"},updateFileManagerList:function(a,b,c,d,e,f,g){if("add"==a&&!get("filesFrame").contentWindow.document.getElementById(b.replace(iceRoot,"").replace(/\/$/,"").replace(/\//g,"|")+"|"+c)){var l="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?ICEcoder.newFilePerms:ICEcoder.newDirPerms;b||(b="/");b=b.replace(iceRoot,"/");b=b.replace("//","/");var h=get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));var m=h.parentNode.parentNode.nextSibling; + var n=document.createTextNode("\n");var p=777==d?"background: #800; color: #eee":"color: #888";p='        '+c+' '+d+""; + if(!m||3>m.childNodes.length){var k=document.createElement("ul");m=h.parentNode.parentNode;m.parentNode.insertBefore(k,m.nextSibling);k=document.createElement("li");k.className=l;k.draggable=!1;k.ondragstart=function(a){ICEcoder.addDefaultDragData(this,a)};k.ondrag=function(a){ICEcoder.draggingWithKeyTest(a);ICEcoder.getcMInstance()&&(-1==ICEcoder.editorFocusInstance.indexOf("diff")?ICEcoder.getcMInstance().focus():ICEcoder.getcMdiffInstance().focus())};k.ondragover=function(a){ICEcoder.setDragCursor(a, + "folder"==g?"folder":"file")};k.ondragend=function(){ICEcoder.dropFile(this)};k.innerHTML=p;m.nextSibling.appendChild(k);m.nextSibling.appendChild(n)}else for(h=0;hc||"folder"==g&&"file"==k||h==m.childNodes.length-1){k=document.createElement("li");k.className=l;k.draggable=!1;k.ondragstart=function(a){ICEcoder.addDefaultDragData(this, + a)};k.ondrag=function(a){ICEcoder.draggingWithKeyTest(a);ICEcoder.getcMInstance()&&(-1==ICEcoder.editorFocusInstance.indexOf("diff")?ICEcoder.getcMInstance().focus():ICEcoder.getcMdiffInstance().focus())};k.ondragover=function(a){ICEcoder.setDragCursor(a,"folder"==g?"folder":"file")};k.ondragend=function(){ICEcoder.dropFile(this)};k.innerHTML=p;h==m.childNodes.length-1?(m.appendChild(k),m.appendChild(n)):(m.insertBefore(k,m.childNodes[h]),m.insertBefore(n,m.childNodes[h+1]));break}}"file"!=g||f|| + (ICEcoder.openFiles[ICEcoder.selectedTab-1]=b+c)}"rename"==a&&(f=e.replace(/\//g,"|"),h=get("filesFrame").contentWindow.document.getElementById(f),h.innerHTML=c,h.id=b.replace(/\//g,"|")+"|"+c,h.parentNode.title=h.id.replace(/\|/g,"/"),targetElemPerms=get("filesFrame").contentWindow.document.getElementById(f+"_perms"),targetElemPerms.id=b.replace(/\//g,"|")+"|"+c+"_perms",ICEcoder.renameInChildren(h,e,b,c));"move"==a&&(ICEcoder.updateFileManagerList("add",b,c,!1,!1,!1,g),ICEcoder.updateFileManagerList("delete", + e.substr(0,e.lastIndexOf("/")),c));"chmod"==a&&(f=ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"),h=get("filesFrame").contentWindow.document.getElementById(f.replace(/\//g,"|")+"_perms"),h.style.background=777==d?"#800":"none",h.style.color=777==d?"#eee":"#888",h.innerHTML=d);"delete"==a&&(b||(b=""),b=b.replace(iceRoot,"/"),b=b.replace("//","/"),b=b.replace(/\/$/,"").replace(/\//g,"|"),h=(b+"|"+c).replace("||","|"),h=get("filesFrame").contentWindow.document.getElementById(h).parentNode.parentNode, + ICEcoder.openCloseDir(h.childNodes[0],!1),h.parentNode.removeChild(h))},renameInChildren:function(a,b,c,d){if(a.parentNode.parentNode.nextSibling&&"UL"==a.parentNode.parentNode.nextSibling.nodeName){a=a.parentNode.parentNode.nextSibling;for(var e=0;ed.indexFromPos({ch:d.getCursor().ch-1,line:d.getCursor().line})&&ICEcoder.findResult--;else for(f=ICEcoder.findResult=0;fICEcoder.results.length-1&&(ICEcoder.findResult=0);e&&1==ICEcoder.findResult&&(ICEcoder.findResult=ICEcoder.results.length+1);g.innerHTML="Highlighted result "+(ICEcoder.findResult+(e?-1:1))+" of "+ICEcoder.results.length+" results";e?(b=d.getSearchCursor(a,{ch:d.getCursor().ch-1,line:d.getCursor().line},!0),b.findPrevious(),b.from()||(b=d.getSearchCursor(a,{line:1E6,ch:1E6},!0),b.findPrevious())): + (b=d.getSearchCursor(a,{ch:d.getCursor().ch+1,line:d.getCursor().line},!0),b.findNext(),b.from()||(b=d.getSearchCursor(a,{line:0,ch:0},!0),b.findNext()));d.setSelection(b.from(),b.to());ICEcoder.focus();ICEcoder.findMode=!0}a=ICEcoder.scrollBarVisible?parseInt(ICEcoder.content.style.height,10)/d.lineCount():d.defaultTextHeight();b=ICEcoder.scrollBarVisible?0:d.heightAtLine(0);e="";for(f=1;f<=d.lineCount();f++)g=-1';ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML=e;ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="inline-block";return!0}g.innerHTML="No results";ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML="";ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display= + "none";return!1}""!=a&&c?(e=b=d="",document.findAndReplace.connector.value==t.and&&(d="&replace="+f),0<=document.findAndReplace.target.value.indexOf(t.file)&&(b="&target="+document.findAndReplace.target.value.replace(/ /g,"-")),document.findAndReplace.target.value==t["selected files"]&&(e="&selectedFiles="+ICEcoder.selectedFiles.join(":")),a=a.replace(/'/g,"'"),a!=encodeURIComponent(a)?a="ICEcoder:"+encodeURIComponent(a):a,ICEcoder.showHide("show",get("loadingMask")),get("mediaContainer").innerHTML= + ''):(g.innerHTML="No results",ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML="",ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="none")}},replaceInFile:function(a,b,c){ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=replaceText&find="+b+"&replace="+c+"&csrf="+ICEcoder.csrf, + encodeURIComponent(a.replace(/\//g,"|")));ICEcoder.serverMessage(""+t["Replacing text in"]+"
    "+a)},getCaretPosition:function(){var a;var b=ICEcoder.getcMInstance();var c=ICEcoder.getcMdiffInstance();b=-1=b||10<=b)&&ICEcoder.mouseX>parseInt(ICEcoder.files.style.width,10)&&(ICEcoder.tabDragMouseX=ICEcoder.mouseX-parseInt(ICEcoder.files.style.width,10)-ICEcoder.tabDragMouseXStart,ICEcoder.tabDragMove());if(ICEcoder.ready&&(ICEcoder.mouseDown||(ICEcoder.draggingFilesW=!1),b=!ICEcoder.draggingTab&& + (ICEcoder.mouseX>ICEcoder.filesW-7&&ICEcoder.mouseX").replace(/<\/b>/g,"").replace(/<br>/g, + "
    "),b.style.left="0"):setTimeout(function(){b.style.left="2000px"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b;var c=ICEcoder.getcMInstance();var d=ICEcoder.getcMdiffInstance();if(c=-1b.index+b[0].length;);(d=get("content").contentWindow.document.getElementById("cssColor"))&&d.parentNode.removeChild(d); + ICEcoder.codeAssist&&"CSS"==ICEcoder.caretLocType&&(d=document.createElement("div"),d.id="cssColor",d.style.position="absolute",d.style.display="block",d.style.width=d.style.height="20px",d.style.zIndex="1000",d.style.background=b?b[0]:"",d.style.cursor="pointer",d.onclick=function(){ICEcoder.showColorPicker(b[0])},""==d.style.backgroundColor&&(d.style.display="none"),get("header").appendChild(d),c.addWidget(c.getCursor(),get("cssColor"),!0))}},showColorPicker:function(a){get("blackMask").style.visibility= + "visible";get("mediaContainer").innerHTML='



    '; + farbtastic("picker","color");a&&get("picker").farbtastic.setColor(a)},initCanvasImage:function(a){var b=get("canvasPicker").getContext("2d");var c=new Image;c.crossOrigin="Anonymous";c.src=a.src;c.onerror=function(){get("floatingContainer").style.visibility="hidden";get("canvasPickerColorInfo").style.display="none";get("canvasPickerCORSInfo").style.display="block"};c.onload=function(){get("canvasPicker").width=a.width;get("canvasPicker").height=a.height;b.drawImage(c,0,0,a.width,a.height);get("canvasPickerColorInfo").style.display= + "block";get("canvasPickerCORSInfo").style.display="none";get("canvasPicker").onmouseover=function(a){get("floatingContainer").style.visibility="visible"};get("canvasPicker").onmouseout=function(a){get("floatingContainer").style.visibility="hidden"}};document.getElementById("floatingContainer").style.backgroundSize=5*a.naturalWidth+"px "+5*a.naturalHeight+"px"},interactCanvasImage:function(a){var b,c,d,e,f,g,l,h,m,n,p,k;var r=get("canvasPicker").getContext("2d");get("canvasPicker").onmousemove=function(u){b= + u.pageX-this.offsetLeft;c=u.pageY-this.offsetTop;d=r.getImageData(b,c,1,1).data;e=d[0];f=d[1];g=d[2];l=e+","+f+","+g;h=ICEcoder.rgbToHex(e,f,g);get("rgbMouseXY").value=l;get("hexMouseXY").value="#"+h;get("hexMouseXY").style.backgroundColor=get("rgbMouseXY").style.backgroundColor="#"+h;m=128>e||128>f||128>g&&200>e&&200>f&&50'+t["Cancelled tasks"]+"");setTimeout(function(){ICEcoder.serverMessage()},2E3)},setPreviousFiles:function(){var a=ICEcoder.openFiles.join(",").replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g, + "");""==a&&(a="CLEAR");ICEcoder.serverQueue("add",iceLoc+"/lib/settings.php?saveFiles="+encodeURIComponent(a)+"&csrf="+ICEcoder.csrf);ICEcoder.updateLast10List(a)},updateLast10List:function(a){a=a.split(",");for(var b=0;b"+a[b].replace(/\|/g,"/")+"\n";var d=ICEcoder.content.contentWindow.document.getElementById("last10Files"); + if(-1==d.innerHTML.indexOf(c)){var e=d.innerHTML.split("\n");(10<=e.length||'
    [none]


    '==e[0]||""==e[e.length-1])&&e.pop();d.innerHTML=c+e.join("\n")}}},autoOpenFiles:function(){if(0');ICEcoder.showHide(a?"hide":"show",get("blackMask"))},helpScreen:function(){get("mediaContainer").innerHTML='';ICEcoder.showHide("show", + get("blackMask"))},versionsScreen:function(a,b){get("mediaContainer").innerHTML='';ICEcoder.showHide("show",get("blackMask"))},showManual:function(a,b){var c=b?"#"+b:"";get("mediaContainer").innerHTML='';ICEcoder.showHide("show", + get("blackMask"))},propertiesScreen:function(a){get("mediaContainer").innerHTML='';ICEcoder.showHide("show",get("blackMask"))},autoLogoutWarningScreen:function(){get("mediaContainer").innerHTML='';ICEcoder.showHide("show", + get("blackMask"))},pluginsManager:function(){get("mediaContainer").innerHTML='';ICEcoder.showHide("show",get("blackMask"))},goLocalhostRoot:function(){ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href=iceLoc+"/lib/go-localhost-root.php"},githubAction:function(a){get("mediaContainer").innerHTML='';ICEcoder.showHide("show",get("blackMask"))},githubTokenAsk:function(a){if(githubAuthToken=ICEcoder.getInput(t["Please enter your..."],""))ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href=iceLoc+"/lib/github.php?action=auth&token="+githubAuthToken+"&goNext="+a+"&csrf="+ICEcoder.csrf,githubAuthToken=""},showHideGithubNav:function(a){get("githubNav").style.display="show"==a?"block":"none";get("fileNav").style.display= + "show"==a?"none":"block"},githubManager:function(){ICEcoder.githubAuthTokenSet?(get("mediaContainer").innerHTML='',ICEcoder.showHide("show",get("blackMask"))):ICEcoder.githubTokenAsk("showManager")},githubDiffToggle:function(){if(!ICEcoder.githubAuthTokenSet)ICEcoder.githubTokenAsk("loadFiles");else if(ICEcoder.githubDiff||ICEcoder.ask(t["This will compare..."])){ICEcoder.githubDiff=!ICEcoder.githubDiff; + var a=ICEcoder.githubDiff?"true":"false";ICEcoder.filesFrame.src="files.php?githubDiff="+a+"&csrf="+ICEcoder.csrf}},ftpManager:function(){get("mediaContainer").innerHTML='';ICEcoder.showHide("show",get("blackMask"))},useNewSettings:function(a,b,c,d,e,f,g,l,h,m,n,p,k,r,u,x,w,y,z,A,B,C,D,E){var v=a.slice(0,a.lastIndexOf("?"));v=v.slice(v.lastIndexOf("/")+1,v.lastIndexOf("."));if(ICEcoder.theme!== + v){ICEcoder.theme=v;"editor"==ICEcoder.theme&&(ICEcoder.theme="icecoder");var q=document.createElement("link");q.setAttribute("rel","stylesheet");q.setAttribute("type","text/css");q.setAttribute("href",a);ICEcoder.content.contentWindow.document.getElementsByTagName("head")[0].appendChild(q);q=document.createElement("link");q.setAttribute("rel","stylesheet");q.setAttribute("type","text/css");q.setAttribute("href",a);document.getElementsByTagName("head")[0].appendChild(q);q=-1<"3024-day base16-light eclipse elegant mdn-like neat neo paraiso-light solarized the-matrix xq-light".split(" ").indexOf(ICEcoder.theme)? + "#ccc":-1<"3024-night blackboard colorforth liquibyte night tomorrow-night-bright tomorrow-night-eighties vibrant-ink".split(" ").indexOf(ICEcoder.theme)?"#888":"#000";ICEcoder.switchTab(ICEcoder.selectedTab)}b!=ICEcoder.codeAssist&&(get("codeAssist").checked=b,ICEcoder.codeAssistToggle());c!=ICEcoder.lockedNav&&(ICEcoder.lockUnlockNav(),ICEcoder.changeFilesW(c?"expand":"contract"),ICEcoder.hideFileMenu());a=document.styleSheets[0];b=a.rules?"rules":"cssRules";a[b][0].style.fontSize=g;a=ICEcoder.filesFrame.contentWindow.document.styleSheets[3]; + b=a.rules?"rules":"cssRules";a[b][0].style.fontSize=g;a=ICEcoder.content.contentWindow.document.styleSheets[6];b=a.rules?"rules":"cssRules";a[b][0].style.fontSize=g;a[b][4].style["border-left-width"]=f?"1px":"0";a[b][4].style["margin-left"]=f?"-1px":"0";a[b][2].style.cssText="background-color: "+q+" !important";ICEcoder.lineWrapping=l;ICEcoder.lineNumbers=h;ICEcoder.showTrailingSpace=m;ICEcoder.matchBrackets=n;ICEcoder.autoCloseTags=p;ICEcoder.autoCloseBrackets=k;ICEcoder.indentWithTabs=r;ICEcoder.indentSize= + x;ICEcoder.indentAuto=u;for(f=0;fchMod "+b+" on
    "+ + a.replace(/\|/g,"/"))},openPreviewWindow:function(){if(060*ICEcoder.autoLogoutMins-60&&ICEcoder.showHide("hide",get("blackMask"));ICEcoder.autoLogoutTimer=0},logout:function(a){window.location=window.location+ + "?logout&"+(a?"type="+a+"&":"")+"csrf="+ICEcoder.csrf},outputMsg:function(a){ICEcoder.output.innerHTML+=a+"
    "},message:function(a){alert(a)},ask:function(a){return confirm(a)},getInput:function(a,b){return prompt(a,b)},dataMessage:function(a){var b=ICEcoder.content.contentWindow.document.getElementById("dataMessage");b.style.display="block";b.innerHTML=a},update:function(){confirm(t["Please note for..."])?(ICEcoder.showHide("show",get("loadingMask")),window.location=iceLoc+"/lib/updater.php"): + window.open("https://icecoder.net")},updated:function(){get("blackMask").style.visibility="visible";get("mediaContainer").innerHTML='

    Thanks for updating to v'+ICEcoder.versionNo+'!

    Click anywhere to continue using ICEcoder...

    '},xhrObj:function(){try{return new XMLHttpRequest}catch(a){}try{return new ActiveXObject("Msxml3.XMLHTTP")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}return null}, + openBugReport:function(){"off"==ICEcoder.bugReportStatus&&ICEcoder.message(t["You can start..."]);"error"==ICEcoder.bugReportStatus&&ICEcoder.message(t["Error cannot find..."]);"ok"==ICEcoder.bugReportStatus&&ICEcoder.message(t["No new errors..."]);if("bugs"==ICEcoder.bugReportStatus){var a=ICEcoder.openFiles.indexOf(ICEcoder.bugReportPath.replace(/\|/g,"/"));-1/g,">").replace(/"/g,""").replace(/'/g,"'")},printCode:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.getcMdiffInstance();a=-1ICEcoder code output
    '+ICEcoder.xssClean(a.getValue())+"
    ";b.focus();b.print();a.focus()},indicateChanges:function(){if(!ICEcoder.loadingFile){var a="ICEcoder v "+ICEcoder.versionNo;for(var b=1;b<=ICEcoder.savedPoints.length;b++)if(ICEcoder.savedPoints[b-1]!=ICEcoder.getcMInstance(b).changeGeneration()){a+= + " \u2744";break}document.title=a}},switchTab:function(a,b){a!==ICEcoder.selectedTab&&(ICEcoder.prevTab=ICEcoder.selectedTab);ICEcoder.selectedTab=a;var c=ICEcoder.getcMInstance();var d=ICEcoder.getcMdiffInstance();if(-1';get("tab"+ICEcoder.openFiles.length).style.display="inline-block";var c=ICEcoder.openFiles[ICEcoder.openFiles.length-1];get("tab"+ICEcoder.openFiles.length).innerHTML= + b+" "+c.slice(c.lastIndexOf("/")).replace(/\//,"");get("tab"+ICEcoder.openFiles.length).title="/"+ICEcoder.openFiles[ICEcoder.openFiles.length-1].replace(/\//,"");ICEcoder.setTabWidths();ICEcoder.redoTabHighlight(ICEcoder.openFiles.length);ICEcoder.selectedTab=ICEcoder.openFiles.length;ICEcoder.savedPoints.push(0);ICEcoder.savedContents.push("");a||ICEcoder.setPreviousFiles()},nextTab:function(){ICEcoder.switchTab(ICEcoder.selectedTab+1<=ICEcoder.openFiles.length?ICEcoder.selectedTab+1:1,"noFocus")}, + previousTab:function(){ICEcoder.switchTab(1<=ICEcoder.selectedTab-1?ICEcoder.selectedTab-1:ICEcoder.openFiles.length,"noFocus")},renameTab:function(a,b){ICEcoder.openFiles[a-1]=b;var c=''; + var d=ICEcoder.openFiles[a-1];get("tab"+a).innerHTML=c+" "+d.slice(d.lastIndexOf("/")).replace(/\//,"");get("tab"+a).title="/"+ICEcoder.openFiles[a-1].replace(/\//,"")},redoTabHighlight:function(a){for(var b,c,d=1;d<=ICEcoder.savedPoints.length;d++)get("tab"+d).childNodes[0]&&(get("tab"+d).childNodes[0].childNodes[0].style.backgroundColor=ICEcoder.savedPoints[d-1]!=ICEcoder.getcMInstance(d).changeGeneration()?"#b00":"transparent"),b=d==a?ICEcoder.tabFGselected:ICEcoder.tabFGnormalTab,"undefined"!= + typeof ICEcoder.openFiles[d-1]&&"/[NEW]"!=ICEcoder.openFiles[d-1]&&(c=ICEcoder.filesFrame.contentWindow.document.getElementById(ICEcoder.openFiles[d-1].replace(/\//g,"|")))&&(c.style.backgroundColor=d==a?ICEcoder.tabBGcurrent:ICEcoder.tabBGopen,c.style.color=d==a?ICEcoder.tabFGcurrent:ICEcoder.tabFGopenFile),get("tab"+d).style.color=b,get("tab"+d).style.background=d==a?ICEcoder.tabBGcurrent:ICEcoder.tabBGopen},closeTab:function(a,b,c){a||(a=ICEcoder.selectedTab);ICEcoder.getcMInstance();ICEcoder.getcMdiffInstance(); + var d=!0;c||ICEcoder.savedPoints[a-1]==ICEcoder.getcMInstance(a).changeGeneration()||(d=ICEcoder.ask(t["You have made..."]));if(d){c=ICEcoder.openFiles[a-1];for(d=a;db?parseInt(c*g,10)-parseInt(c*(g-1),10):150,e=0==g?53:parseInt(get("tab"+g).style.left,10),f=0==g?0:parseInt(get("tab"+g).style.width,10)+18,a?d=-18:(get("tab"+(g+1)).style.left=e+f+"px",get("tab"+(g+1)).style.width=d+"px"),ICEcoder.tabLeftPos.push(e+f);get("newTab").style.left=e+f+d+18+"px"}}, + tabDragStart:function(a){ICEcoder.draggingTab=a;ICEcoder.diffStartX=ICEcoder.mouseX;ICEcoder.tabDragMouseXStart=(ICEcoder.mouseX-(parseInt(ICEcoder.files.style.width,10)+53+18))%150;get("tab"+a).style.zIndex=2;for(var b=1;b<=ICEcoder.openFiles.length;b++)get("tab"+b).className=b!==a?"tab tabSlide":"tab tabDrag"},tabDragMove:function(){var a=parseInt(get("tab"+ICEcoder.openFiles.length).style.width,10)+18;ICEcoder.thisLeft=a=53<=ICEcoder.tabDragMouseX?ICEcoder.tabDragMouseX<=parseInt(get("newTab").style.left, + 10)-a?ICEcoder.tabDragMouseX:parseInt(get("newTab").style.left,10)-a:53;get("tab"+ICEcoder.draggingTab).style.left=a+"px";ICEcoder.dragTabNo=ICEcoder.draggingTab;for(var b=1;b<=ICEcoder.openFiles.length;b++){get("tab"+b).style.opacity=b==ICEcoder.draggingTab?1:.5;var c=ICEcoder.tabLeftPos[b]?ICEcoder.tabLeftPos[b]-ICEcoder.tabLeftPos[b-1]:c;b!=ICEcoder.draggingTab&&(b=ICEcoder.tabLeftPos[b-1]?ICEcoder.tabLeftPos[b-1]-c:ICEcoder.tabLeftPos[b-1])}},tabDragEnd:function(){var a;ICEcoder.setTabWidths();for(var b=1;b<=ICEcoder.openFiles.length;b++)ICEcoder.thisLeft>=ICEcoder.tabLeftPos[b-1]&&(a=ICEcoder.thisLeft==ICEcoder.tabLeftPos[0]?1:ICEcoder.dragTabNo>b?b+1:b),get("tab"+b).className="tab",get("tab"+b).style.opacity=1,b!=ICEcoder.dragTabNo?get("tab"+b).style.zIndex=1:setTimeout(function(){get("tab"+b).style.zIndex=1},150);if(ICEcoder.thisLeft&&!1!== + ICEcoder.thisLeft){var c=[];for(b=1;b<=ICEcoder.openFiles.length;b++)c.push(b);c.splice(ICEcoder.dragTabNo-1,1);c.splice(a-1,0,ICEcoder.dragTabNo);ICEcoder.sortTabs(c)}ICEcoder.setTabWidths();ICEcoder.draggingTab=!1;ICEcoder.thisLeft=!1},sortTabs:function(a){var b;var c=[ICEcoder.savedPoints,ICEcoder.savedContents,ICEcoder.openFiles,ICEcoder.openFileMDTs,ICEcoder.openFileVersions,ICEcoder.cMInstances];var d=[[],[],[],[],[],[]];for(var e=0;eb-5;)e.undo(),a++;if(ICEcoder.savedPoints[ICEcoder.selectedTab-1]==e.changeGeneration())ICEcoder.startSnake();else for(b=1;b<=a;b++)e.redo()}, + 0);if(ICEcoder.snakePlaying)return 37==d&&(ICEcoder.snakeDir="left"),39==d&&(ICEcoder.snakeDir="right"),38==d&&(ICEcoder.snakeDir="up"),40==d&&(ICEcoder.snakeDir="down"),!1;if(224==d||91==d||93==d)ICEcoder.cmdKey=!0;if(112===d){if(ICEcoder.codeZoomedOut)return;ICEcoder.codeZoomedOut=!0;var e=ICEcoder.getcMInstance();for(d=0;dLet\'s play
    snake


    Use arrow keys to eat your code

    (it returns afterwards of course) :-)
    '; + setTimeout(function(){ICEcoder.showHide("hide",get("blackMask"));get("mediaContainer").innerHTML="";ICEcoder.playSnake()},2E3)},playSnake:function(){var a=ICEcoder.getcMInstance();a.setOption("readOnly","nocursor");a.focus();ICEcoder.snakePreHistory=a.getHistory();ICEcoder.snakePreContent=a.getValue();ICEcoder.snakePreCursor=a.getCursor();a=Math.floor(50*Math.random());ICEcoder.snakePos=[[a,0],[a,-1],[a,-2],[a,-3],[a,-4]];ICEcoder.content.contentWindow.document.getElementById("game").style.display= + "block";ICEcoder.snakeDir="down";ICEcoder.doSnake();ICEcoder.snakeInt=setInterval(function(){var a=[];a[0]=ICEcoder.snakePos[0][0]+("right"==ICEcoder.snakeDir?1:"left"==ICEcoder.snakeDir?-1:0);a[1]=ICEcoder.snakePos[0][1]+("down"==ICEcoder.snakeDir?1:"up"==ICEcoder.snakeDir?-1:0);ICEcoder.snakePos.unshift(a);ICEcoder.snakePos.pop();ICEcoder.doSnake()},100)},doSnake:function(){var a;var b=ICEcoder.getcMInstance();var c=b.defaultCharWidth();var d=b.defaultTextHeight();var e=ICEcoder.content.contentWindow.document.getElementById("game").innerHTML= + "";for(a=0;a';ICEcoder.content.contentWindow.document.getElementById("game").innerHTML=e;e=b.coordsChar({top:ICEcoder.snakePos[0][1]*d+4,left:ICEcoder.snakePos[0][0]*c+60});var f=b.getLine(e.line);if(ICEcoder.snakePos[0][0]-1<=f.length-2){var g="";if("\t"===f.substr(e.ch, + 1))for(a=0;aICEcoder.snakePos[0][0]||0>ICEcoder.snakePos[0][1]||ICEcoder.snakePos[0][0]*c+60>a.clientWidth||ICEcoder.snakePos[0][1]*d+4>a.clientHeight||e)clearInterval(ICEcoder.snakeInt),ICEcoder.content.contentWindow.document.getElementById("game").style.display="none",b.setValue(ICEcoder.snakePreContent),ICEcoder.savedPoints[ICEcoder.selectedTab-1]=b.changeGeneration(),ICEcoder.savedContents[ICEcoder.selectedTab- + 1]=ICEcoder.snakePreContent,b.setHistory(ICEcoder.snakePreHistory),ICEcoder.indicateChanges(),ICEcoder.redoTabHighlight(ICEcoder.selectedTab),b.setOption("readOnly",!1),b.setCursor(ICEcoder.snakePreCursor),b.focus(),ICEcoder.snakePlaying=!1}}; \ No newline at end of file From a24030f43a9b91b645d53709171c85adc1ee49a3 Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:23:33 +0000 Subject: [PATCH 015/231] Replaced top. with parent. in get-branch --- lib/get-branch.php | 86 +++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/lib/get-branch.php b/lib/get-branch.php index dff4e22..c885c05 100644 --- a/lib/get-branch.php +++ b/lib/get-branch.php @@ -127,7 +127,7 @@ if (isset($ftpSite)) { ftpStart(); // Show user warning if no good connection if (!$ftpConn || !$ftpLogin) { - die(''); + die(''); exit; } // Get our simple and detailed lists and close the FTP connection @@ -186,15 +186,15 @@ for ($i=0;$i        ".xssClean(basename($fileFolderName),"html")." "; + " if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {parent.ICEcoder.openFile()}}\" style=\"position: relative; left:-22px\">        ".xssClean(basename($fileFolderName),"html")." "; if (!isset($ftpSite)) { $thisPermVal = $serverType=="Linux" ? substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3) : ''; } else { @@ -224,7 +224,7 @@ echo ' '; if (!isset($ftpSite) && $_SESSION['githubDiff']) { // Show the loading screen until we're done comparing files with GitHub - echo ""; + echo ""; $i=0; $dirListArray = $dirSHAArray = $dirTypeArray = array(); // For each of the files in our local path... @@ -271,8 +271,8 @@ if (!isset($ftpSite) && $_SESSION['githubDiff']) { } ?> @@ -377,7 +377,7 @@ if (!isset($ftpSite) && $_SESSION['githubDiff']) { } ?> '; };?> - + @@ -130,7 +130,7 @@ h2 {color: rgba(0,198,255,0.7)} // Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers) $ext = "ext-".pathinfo($docRoot.$iceRoot.$fileFolderName, PATHINFO_EXTENSION); echo '
  • '; - echo ''; + echo ''; echo str_replace($docRoot,"",str_replace("|","/",$last10FilesArray[$i])); echo '
  • '; if ($i From 03d72ce3598b4a2e79cb1c303e15e9ab84ce2a91 Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:27:18 +0000 Subject: [PATCH 017/231] top. changed to parent. in files.php --- files.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/files.php b/files.php index 00ea4e8..7aa78d9 100644 --- a/files.php +++ b/files.php @@ -8,7 +8,7 @@ $isGitHubRepoDir = in_array($ICEcoder["root"],$ICEcoder['githubLocalPaths']); ?> - + ICEcoder v <?php echo $ICEcoder["versionNo"];?> file manager @@ -22,11 +22,11 @@ $isGitHubRepoDir = in_array($ICEcoder["root"],$ICEcoder['githubLocalPaths']); - + -
    -
    -
    +
    +
    +
    top.ICEcoder.setSplitPane('on');"; + echo ""; } - echo '
    '; + echo '
    '; } ?>
      -
    •         /         / Date: Fri, 28 Feb 2020 17:30:07 +0000 Subject: [PATCH 018/231] top. removed and iceURLPath used in index.php --- index.php | 212 +++++++++++++++++++++++++++--------------------------- 1 file changed, 106 insertions(+), 106 deletions(-) diff --git a/index.php b/index.php index 7952d89..2c4dc26 100644 --- a/index.php +++ b/index.php @@ -22,14 +22,14 @@ if ($ICEcoder["checkUpdates"]) { $thisV = $ICEcoder["versionNo"]; if (strpos($thisV,"beta")>-1 && !strpos($icv,"beta") && str_replace(" beta","",$thisV) == $icv) {$thisV-=0.1;}; if ($thisV<$icv) { - $updateMsg = ";top.ICEcoder.dataMessage('".$t['UPDATE INFO'].": ICEcoder v ".$icv." ".$t['now available'].". (".$t['Your version is']." v ".$ICEcoder["versionNo"].").

      ".$t['Update now']."

      ".$icvI."');"; + $updateMsg = ";ICEcoder.dataMessage('".$t['UPDATE INFO'].": ICEcoder v ".$icv." ".$t['now available'].". (".$t['Your version is']." v ".$ICEcoder["versionNo"].").

      ".$t['Update now']."

      ".$icvI."');"; } } $isMac = strpos($_SERVER['HTTP_USER_AGENT'], "Macintosh")>-1 ? true : false; ?> - + ICEcoder v <?php echo $ICEcoder["versionNo"];?> @@ -39,8 +39,8 @@ $isMac = strpos($_SERVER['HTTP_USER_AGENT'], "Macintosh")>-1 ? true : false; - - + @@ -49,9 +49,9 @@ echo "?microtime=".microtime(true); iceRoot = ""; window.onbeforeunload = function() { - if(top.ICEcoder.autoLogoutTimer < top.ICEcoder.autoLogoutMins*60) { + if(ICEcoder.autoLogoutTimer < ICEcoder.autoLogoutMins*60) { for(var i=1;i<=ICEcoder.savedPoints.length;i++) { - if (ICEcoder.savedPoints[i-1]!=top.ICEcoder.getcMInstance(i).changeGeneration()) { + if (ICEcoder.savedPoints[i-1]!=ICEcoder.getcMInstance(i).changeGeneration()) { return "."; } } @@ -74,54 +74,54 @@ $t = $text['index']; ?> } - - - - - - + + + + + + ICEcoder.init();top.ICEcoder.content.style.visibility='visible';top.ICEcoder.filesFrame.contentWindow.frames['processControl'].location.href = 'processes/on-load.php';" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);" onBlur="parent.ICEcoder.resetKeys(event);"> + echo "ICEcoder.csrf = '".$_SESSION["csrf"]."';"; +?>ICEcoder.init();ICEcoder.content.style.visibility='visible';ICEcoder.filesFrame.contentWindow.frames['processControl'].location.href = iceLoc+'/processes/on-load.php';" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="ICEcoder.resetKeys(event);" onBlur="ICEcoder.resetKeys(event);">
      @@ -139,70 +139,70 @@ $t = $text['index'];
      -
      : 0" onMouseOver="top.ICEcoder.showHidePlugins('show')" onMouseOut="top.ICEcoder.showHidePlugins('hide')" onClick="top.ICEcoder.showHidePlugins('hide')"> +
      : 0" onMouseOver="ICEcoder.showHidePlugins('show')" onMouseOut="ICEcoder.showHidePlugins('hide')" onClick="ICEcoder.showHidePlugins('hide')">
      - Color Picker

      + Color Picker

      - + / - + + / -
      -
      +
      - - + +

      - +
      - + ">
      - +

      - - - - + + + + - +

      - +

      Zip It!'.PHP_EOL; + echo 'Zip It!'.PHP_EOL; }; ?> - +

      - +
      -
      +
        -
      • -
      • -
      • -
      • +
      • +
      • +
      • +
      -
      Commit
      +
      Commit
      Selected: 0
      -
      Pull
      +
      Pull
      -
      +
      -
      +
      • @@ -236,7 +236,7 @@ $t = $text['index'];
      -
      +
      • Localhost
      • FTP
      • @@ -250,7 +250,7 @@ $t = $text['index']; //-->
      -
      +
      • ')">
      • @@ -259,32 +259,32 @@ $t = $text['index'];
      - +
      -
      Terminal
      -
      Output
      -
      Database
      -
      Git
      +
      Terminal
      +
      Output
      +
      Database
      +
      Git
      - - + +
      '; + echo '
      '; } ?>
      +
      -
      +
      - +
      "> -
      +
      > - 0" onClick="top.ICEcoder.codeAssistToggle()"> + 0" onClick="ICEcoder.codeAssistToggle()">
      -
      -
      - - +
      +
      + + ">
      - -
      Output
      via top.ICEcoder.output(message);

      - + +
      Output
      via ICEcoder.output(message);

      +

      sudo nohup php processes/system.php > data/nohup.log 2>&1 &

      ...to run as a background process"; };?>
      - +
      From b500a728f292720141118fce5e5cfd302a0eefc8 Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:34:02 +0000 Subject: [PATCH 019/231] parent.parent. needed --- lib/get-branch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/get-branch.php b/lib/get-branch.php index c885c05..d44b9f0 100644 --- a/lib/get-branch.php +++ b/lib/get-branch.php @@ -377,7 +377,7 @@ if (!isset($ftpSite) && $_SESSION['githubDiff']) { } ?> @@ -60,7 +59,7 @@ for ($i=0; $i"); + die("parent.parent.ICEcoder.message('Sorry! - problem with file requested');"); }; } @@ -75,7 +74,7 @@ if ($_GET['action']=="load") { } if (!$canOpen) { - echo 'fileType="nothing"; ICEcoder.message(\''.$t['Sorry, could not...'].' '.$fileLoc."/".$fileName.'\');'; + echo 'fileType="nothing"; parent.parent.ICEcoder.message(\''.$t['Sorry, could not...'].' '.$fileLoc."/".$fileName.'\');'; } elseif (isset($ftpSite) || file_exists($file)) { $finfo = "text"; // Determine what to do based on mime type @@ -91,14 +90,14 @@ if ($_GET['action']=="load") { } if (strpos($finfo,"text")===0 || strpos($finfo, "application/xml")===0 || strpos($finfo,"empty")!==false) { echo 'fileType="text";'; - echo 'ICEcoder.shortURL = ICEcoder.thisFileFolderLink = "'.$fileLoc."/".$fileName.'";'; + echo 'parent.parent.ICEcoder.shortURL = parent.parent.ICEcoder.thisFileFolderLink = "'.$fileLoc."/".$fileName.'";'; // Get file over FTP? if (isset($ftpSite)) { ftpStart(); // Show user warning if no good connection if (!$ftpConn || !$ftpLogin) { - die('ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'); + die('parent.parent.ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'); exit; } // Get our file contents and close the FTP connection @@ -126,7 +125,7 @@ if ($_GET['action']=="load") { echo 'fileType="other";window.open(\'http://'.$_SERVER['SERVER_NAME'].$fileLoc."/".$fileName.'\');'; }; } else { - echo 'fileType="nothing"; ICEcoder.message(\''.$t['Sorry'].', '.$fileLoc."/".$fileName.' '.$t['does not seem...'].'\');'; + echo 'fileType="nothing"; parent.parent.ICEcoder.message(\''.$t['Sorry'].', '.$fileLoc."/".$fileName.' '.$t['does not seem...'].'\');'; } }; @@ -136,26 +135,26 @@ if ($_GET['action']=="load") { if (action=="load") { if (fileType=="text") { setTimeout(function() { - if (!ICEcoder.content.contentWindow.createNewCMInstance) { + if (!parent.parent.ICEcoder.content.contentWindow.createNewCMInstance) { console.log(''); window.location.reload(true); } else { - ICEcoder.loadingFile = true; + parent.parent.ICEcoder.loadingFile = true; // Reset the various states back to their initial setting - selectedTab = ICEcoder.openFiles.length; // The tab that's currently selected + selectedTab = parent.parent.ICEcoder.openFiles.length; // The tab that's currently selected // Finally, store all data, show tabs etc - ICEcoder.createNewTab(); - ICEcoder.cMInstances.push(ICEcoder.nextcMInstance); - ICEcoder.setLayout(); - ICEcoder.content.contentWindow.createNewCMInstance(ICEcoder.nextcMInstance); + parent.parent.ICEcoder.createNewTab(); + parent.parent.ICEcoder.cMInstances.push(parent.parent.ICEcoder.nextcMInstance); + parent.parent.ICEcoder.setLayout(); + parent.parent.ICEcoder.content.contentWindow.createNewCMInstance(parent.parent.ICEcoder.nextcMInstance); // If we're in GitHub diff mode and have a split pane display, get the content for the diff pane - if (ICEcoder.githubDiff && ICEcoder.splitPane) { + if (parent.parent.ICEcoder.githubDiff && parent.parent.ICEcoder.splitPane) { - ICEcoder.filesFrame.contentWindow.frames['processControl'].location.href = "github.php?action=read&repo=&filePath=&csrf="+ICEcoder.csrf; + parent.parent.ICEcoder.filesFrame.contentWindow.frames['processControl'].location.href = "github.php?action=read&repo=&filePath=&csrf="+parent.parent.ICEcoder.csrf; } // Set the value & innerHTML of the code textarea to that of our loaded file plus make it visible (it's hidden on ICEcoder's load) - ICEcoder.switchMode(); - cM = ICEcoder.getcMInstance(); + parent.parent.ICEcoder.switchMode(); + cM = parent.parent.ICEcoder.getcMInstance(); cM.setValue(document.getElementById('loadedFile').value); - ICEcoder.savedPoints[ICEcoder.selectedTab-1] = cM.changeGeneration(); - ICEcoder.savedContents[ICEcoder.selectedTab-1] = cM.getValue(); + parent.parent.ICEcoder.savedPoints[parent.parent.ICEcoder.selectedTab-1] = cM.changeGeneration(); + parent.parent.ICEcoder.savedContents[parent.parent.ICEcoder.selectedTab-1] = cM.getValue(); parent.parent.document.getElementById('content').style.visibility='visible'; - ICEcoder.switchTab(ICEcoder.selectedTab,'noFocus'); - setTimeout(function(){ICEcoder.filesFrame.contentWindow.focus();},0); + parent.parent.ICEcoder.switchTab(parent.parent.ICEcoder.selectedTab,'noFocus'); + setTimeout(function(){parent.parent.ICEcoder.filesFrame.contentWindow.focus();},0); // Then clean it up, set the text cursor, update the display and get the character data - ICEcoder.contentCleanUp(); - ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[ICEcoder.selectedTab-1]].removeLineClass(ICEcoder['cMActiveLinecM'+ICEcoder.cMInstances[ICEcoder.selectedTab-1]], "background"); - ICEcoder['cMActiveLinecM'+ICEcoder.selectedTab] = ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[ICEcoder.selectedTab-1]].addLineClass(0, "background", "cm-s-activeLine"); - ICEcoder.nextcMInstance++; - ICEcoder.openFileMDTs.push(''); - ICEcoder.openFileVersions.push('); + parent.parent.ICEcoder.openFileVersions.push(); - ICEcoder.updateVersionsDisplay(); + parent.parent.ICEcoder.updateVersionsDisplay(); - ICEcoder.goToLine(); - ICEcoder.loadingFile = false; + parent.parent.ICEcoder.goToLine(); + parent.parent.ICEcoder.loadingFile = false; @@ -218,24 +217,24 @@ if (action=="load") { if (fileType=="image") { parent.parent.document.getElementById('blackMask').style.visibility = "visible"; parent.parent.document.getElementById('mediaContainer').innerHTML = - "" + - " 700 || this.naturalHeight > 500) ? ', ' + this.width + ' x ' + this.height : ''; document.getElementById('imgInfo').innerHTML += ' (' + this.naturalWidth + ' x ' + this.naturalHeight + reducedImgMsg + ')'; ICEcoder.initCanvasImage(this); ICEcoder.interactCanvasImage(this)\">
      " + - "
      " + + "" + + " 700 || this.naturalHeight > 500) ? ', ' + this.width + ' x ' + this.height : ''; document.getElementById('imgInfo').innerHTML += ' (' + this.naturalWidth + ' x ' + this.naturalHeight + reducedImgMsg + ')'; parent.parent.ICEcoder.initCanvasImage(this); parent.parent.ICEcoder.interactCanvasImage(this)\">
      " + + "
      " + "" + "

      " + "
      "+ - "" + - "" + - "" + - ""+ + "" + + "" + + "" + + ""+ "
      "+ "
      CORS not enabled on resource site
      "; parent.parent.document.getElementById('floatingContainer').style.background = "#fff url('') no-repeat 0 0"; } - ICEcoder.serverMessage();ICEcoder.serverQueue("del",0); + parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0); } // Finally, switch mode in case we have saved, renamed file etc -ICEcoder.switchMode(); +parent.parent.ICEcoder.switchMode(); From 73c24202e744cba4114c9eccf2216a157a805e7e Mon Sep 17 00:00:00 2001 From: mattpass Date: Fri, 28 Feb 2020 17:45:09 +0000 Subject: [PATCH 021/231] parent. added to some key places --- lib/ice-coder.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 995a62b..e75378c 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -2837,7 +2837,7 @@ var ICEcoder = { // Determine the CodeMirror instance we're using getcMInstance: function(tab) { - return ICEcoder.content.contentWindow[ + return parent.ICEcoder.content.contentWindow[ // target specific tab !isNaN(tab) ? 'cM'+ICEcoder.cMInstances[tab-1] @@ -2851,7 +2851,7 @@ var ICEcoder = { // Determine the CodeMirror instance we're using getcMdiffInstance: function(tab) { - return ICEcoder.content.contentWindow[ + return parent.ICEcoder.content.contentWindow[ (// target specific tab !isNaN(tab) ? 'cM'+ICEcoder.cMInstances[tab-1] @@ -2915,7 +2915,7 @@ var ICEcoder = { serverMessage: function(message) { var serverMessage; - serverMessage = get('serverMessage'); + serverMessage = parent.get('serverMessage'); if (message) { serverMessage.innerHTML = ICEcoder.xssClean(message).replace(/\<b\>/g,"").replace(/\<\/b\>/g,"").replace(/\<br\>/g,"
      "); serverMessage.style.left = "0"; From e0c9061de13662917dc344fd21b84c2881203516 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 21:52:27 +0000 Subject: [PATCH 022/231] Update english.php --- lang/english.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/english.php b/lang/english.php index 41a4d2d..01ee58a 100644 --- a/lang/english.php +++ b/lang/english.php @@ -26,7 +26,7 @@ $text = array( "dev mode" => "dev mode", "Status" => "Status", "Using" => "Using", - "You can switch..." => "You can switch dev mode on/off in lib/config__settings.php" + "You can switch..." => "You can switch dev mode on/off in data/config-settings.php" ), From 60da86600f10d61dc50aed74092955e134313681 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 21:53:07 +0000 Subject: [PATCH 023/231] Update chinese-simplified.php --- lang/chinese-simplified.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/chinese-simplified.php b/lang/chinese-simplified.php index 32ac7be..376c686 100644 --- a/lang/chinese-simplified.php +++ b/lang/chinese-simplified.php @@ -27,7 +27,7 @@ $text = array( "dev mode" => "开发模式", "Status" => "状态", "Using" => "使用", - "You can switch..." => "你可以在 lib/config__settings.php 中设置开发模式开关", + "You can switch..." => "你可以在 data/config-settings.php 中设置开发模式开关", "results" => "结果" ), From a6e302b69d04d0ddcbdb29c9f00d5aa60744d82f Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 21:53:39 +0000 Subject: [PATCH 024/231] Update chinese-traditional.php --- lang/chinese-traditional.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/chinese-traditional.php b/lang/chinese-traditional.php index acac0ef..11d9a10 100644 --- a/lang/chinese-traditional.php +++ b/lang/chinese-traditional.php @@ -27,7 +27,7 @@ $text = array( "dev mode" => "開發模式", "Status" => "狀態", "Using" => "使用", - "You can switch..." => "你可以在 lib/config__settings.php 中設置開發模式開關", + "You can switch..." => "你可以在 data/config-settings.php 中設置開發模式開關", "results" => "結果" ), From ca124a1d45e8eeb56acc62f441c3eed7033a9b2c Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 21:54:15 +0000 Subject: [PATCH 025/231] Update dutch.php --- lang/dutch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/dutch.php b/lang/dutch.php index a04a631..3589aa6 100644 --- a/lang/dutch.php +++ b/lang/dutch.php @@ -27,7 +27,7 @@ $text = array( "dev mode" => "Ontwikkelaars modus", "Status" => "Status", "Using" => "Gebruikt", - "You can switch..." => "U kunt de ontwikkelaars modus aan/uit zetten in lib/config__settings.php", + "You can switch..." => "U kunt de ontwikkelaars modus aan/uit zetten in data/config-settings.php", ), From 2e7c286d4787770d49cff79bdaa678868f953325 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 21:55:08 +0000 Subject: [PATCH 026/231] Update french.php --- lang/french.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/french.php b/lang/french.php index 0de12bb..623d69f 100644 --- a/lang/french.php +++ b/lang/french.php @@ -28,7 +28,7 @@ $text = array( "Status" => "Statuts", "Using" => "Utilise", "You can switch..." => "Vous pouvez basculer le mode dev on/off -dans lib/config__settings.php", +dans data/config-settings.php", "results" => "résultats" ), From 8c9d843328e21db5c2495b930d2ab3b95f4bacc0 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 21:55:46 +0000 Subject: [PATCH 027/231] Update german.php --- lang/german.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/german.php b/lang/german.php index 132670c..e40af42 100644 --- a/lang/german.php +++ b/lang/german.php @@ -27,7 +27,7 @@ $text = array( "dev mode" => "Entwicklermodus", "Status" => "Status", "Using" => "Verwenden", - "You can switch..." => "Du kannst den Entwicklermodus in der in lib/config__settings.php ein- und ausschateln", + "You can switch..." => "Du kannst den Entwicklermodus in der in data/config-settings.php ein- und ausschateln", "results" => "Ergebnis" ), From 977fdc597f3e3da1ae3861342afceaac419bae8c Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 21:56:17 +0000 Subject: [PATCH 028/231] Update italian.php --- lang/italian.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/italian.php b/lang/italian.php index 6ffe4d4..5f9e756 100644 --- a/lang/italian.php +++ b/lang/italian.php @@ -26,7 +26,7 @@ $text = array( "dev mode" => "modalità sviluppo", "Status" => "Stato", "Using" => "Utilizzo", - "You can switch..." => "È possibile attivare/disattivare la modalità sviluppo nel file lib/config__settings.php" + "You can switch..." => "È possibile attivare/disattivare la modalità sviluppo nel file data/config-settings.php" ), From 84f656bd3490bf7e6fa76d70b99fe7b528cd12c1 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 21:56:51 +0000 Subject: [PATCH 029/231] Update norwegian.php --- lang/norwegian.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/norwegian.php b/lang/norwegian.php index 7832d82..36943c8 100644 --- a/lang/norwegian.php +++ b/lang/norwegian.php @@ -27,7 +27,7 @@ $text = array( "dev mode" => "utvikler modus", "Status" => "Status", "Using" => "Brukes", - "You can switch..." => "Du kan slå utvikler modus på/av i lib/config__settings.php", + "You can switch..." => "Du kan slå utvikler modus på/av i data/config-settings.php", "results" => "resultater" ), From 0bb44721f330c4fb6845632ecc0df3eaa8d4ec0d Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 21:57:48 +0000 Subject: [PATCH 030/231] Update persian.php --- lang/persian.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/persian.php b/lang/persian.php index ca64425..ca1f1e2 100644 --- a/lang/persian.php +++ b/lang/persian.php @@ -27,7 +27,7 @@ $text = array( "dev mode" => "حالت توسعه دهنده", "Status" => "وضعیت", "Using" => "استفاده", - "You can switch..." => "شما میتوانید حالت توسعه را از lib/config__settings.php روشن یا خاموش کنید", + "You can switch..." => "شما میتوانید حالت توسعه را از data/config-settings.php روشن یا خاموش کنید", "results" => "نتایج" ), From b7e9b8d83e75a753301555a1de27c37d248973b1 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 21:58:20 +0000 Subject: [PATCH 031/231] Update portuguese-brazilian.php --- lang/portuguese-brazilian.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/portuguese-brazilian.php b/lang/portuguese-brazilian.php index f294578..7e6565c 100644 --- a/lang/portuguese-brazilian.php +++ b/lang/portuguese-brazilian.php @@ -27,7 +27,7 @@ $text = array( "dev mode" => "modo desenv.", "Status" => "Status", "Using" => "Usando", - "You can switch..." => "Você pode alterar modo desenv. on/off em lib/config__settings.php" + "You can switch..." => "Você pode alterar modo desenv. on/off em data/config-settings.php" ), From 7ab28591eb6082fdf88fe8b98b8b980933a04dd3 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 21:58:51 +0000 Subject: [PATCH 032/231] Update spanish.php --- lang/spanish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/spanish.php b/lang/spanish.php index a5ab52c..7733ce5 100644 --- a/lang/spanish.php +++ b/lang/spanish.php @@ -26,7 +26,7 @@ $text = array( "dev mode" => "modo desarrollo", "Status" => "Estado", "Using" => "Usando", - "You can switch..." => "Usted puede cambiar el modo de desarrollo cambiando su valor on/off en lib/config__settings.php" + "You can switch..." => "Usted puede cambiar el modo de desarrollo cambiando su valor on/off en data/config-settings.php" ), From 9ba31af366bdfea45a9352e26746b6b73cc9458c Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 22:02:48 +0000 Subject: [PATCH 033/231] Remove test dir from .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index ab4bf85..f00fed8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,5 @@ data/* !data/.gitkeep plugins/* !plugins/index.php -test/test-file1.txt tmp/* !tmp/index.php From 1e718d04a01b443806d831797dc6c3db443736a1 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 22:03:45 +0000 Subject: [PATCH 034/231] Update licence year only --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 0858e74..d0a2395 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright: © 2015 ICEcoder Ltd +Copyright: © 2020 ICEcoder Ltd Website: icecoder.net Email: info@icecoder.net Twitter: @icecoder From 4a7abe4013ae4761e1063bbdfdc24ad69495809b Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 22:07:15 +0000 Subject: [PATCH 035/231] Tweaks to README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0e2ce09..34f9297 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ICEcoder is a web IDE / browser based code editor, which allows you to develop w ### Requirements -You can run ICEcoder either online or locally, on Linux, Windows or Mac based platforms. The only requirement is to have PHP 5 available (5.3 recommended). You can have this either as a vanilla installation or via a program such as WAMP or XAMPP (for Windows) or MAMP (for Mac). +You can run ICEcoder either online or locally, on Linux, Windows or Mac based platforms. The only requirement is to have PHP 7 available (7.4 recommended). You can have this either as a vanilla installation or via a program such as WAMP or XAMPP (for Windows) or MAMP (for Mac). ### Installation @@ -23,7 +23,7 @@ $ git clone git://github.com/mattpass/ICEcoder #### Step 2: Place in your document root (online or local) * Put in a new sub-dir URL such as yourdomain.com/ICEcoder or localhost/ICEcoder -* Set write permissions (757 or 775 depending on your system) on the 'backups', 'lib', 'plugins', 'test' and 'tmp' folders +* Set write permissions (757 or 775 depending on your system) on the 'data', 'lib', 'plugins' and 'tmp' folders *(Note: A small number of web servers give an internal server error here, if you get this, try 755 instead)* @@ -33,7 +33,7 @@ $ git clone git://github.com/mattpass/ICEcoder **Now you're setup, auto-logged in and ready to code!** -Suitable for commercial & non-commercial projects, just let me know if it's useful to you and any cool customisations you make to it. I take no responsibility for anything, your usage is all down to you. +Suitable for commercial & non-commercial projects, just let me know if it's useful to you and any cool customisations you make to it. I take no responsibility for anything, all usage is all down to you. It's fully open source and MIT licensed. I'm happy for you to take it, make it your own and customise to your hearts content and/or contribute to this main repo! :) From bdaa9d8cbc31cd0348d47d946eeb3561523d52ab Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 22:26:31 +0000 Subject: [PATCH 036/231] parent now not window --- editor.php | 68 +++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/editor.php b/editor.php index dbf19cb..f96fa7e 100644 --- a/editor.php +++ b/editor.php @@ -225,74 +225,74 @@ function createNewCMInstance(num) { }; // Start editor instances, main and diff - window['cM'+num] = CodeMirror(document.body, cMOptions); - window['cM'+num+'diff'] = CodeMirror(document.body, cMOptions); + parent['cM'+num] = CodeMirror(document.body, cMOptions); + parent['cM'+num+'diff'] = CodeMirror(document.body, cMOptions); // Define actions for those... // Focus - window['cM'+num] .on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM,'cM'+num+'diff')}); + parent['cM'+num] .on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM,'cM'+num)}); + parent['cM'+num+'diff'] .on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM,'cM'+num+'diff')}); // Blur - window['cM'+num] .on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM,'cM'+num+'diff')}); + parent['cM'+num] .on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM,'cM'+num)}); + parent['cM'+num+'diff'] .on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM,'cM'+num+'diff')}); // Keyup - window['cM'+num] .on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM,'cM'+num+'diff')}); + parent['cM'+num] .on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM,'cM'+num)}); + parent['cM'+num+'diff'] .on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM,'cM'+num+'diff')}); // Cursor activity - window['cM'+num] .on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM,'cM'+num+'diff')}); + parent['cM'+num] .on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM,'cM'+num)}); + parent['cM'+num+'diff'] .on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM,'cM'+num+'diff')}); // Before selection change - window['cM'+num] .on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLine = thisCM.getCursor().line;}); - window['cM'+num+'diff'] .on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLineDiff = thisCM.getCursor().line;}); + parent['cM'+num] .on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLine = thisCM.getCursor().line;}); + parent['cM'+num+'diff'] .on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLineDiff = thisCM.getCursor().line;}); // Change - window['cM'+num] .on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM,'cM'+num,changeObj,CodeMirror)}); - window['cM'+num+'diff'] .on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM,'cM'+num+'diff',changeObj,CodeMirror)}); + parent['cM'+num] .on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM,'cM'+num,changeObj,CodeMirror)}); + parent['cM'+num+'diff'] .on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM,'cM'+num+'diff',changeObj,CodeMirror)}); // Before change - window['cM'+num] .on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM,'cM'+num,changeObj,CodeMirror)}); - window['cM'+num+'diff'] .on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM,'cM'+num+'diff',changeObj,CodeMirror)}); + parent['cM'+num] .on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM,'cM'+num,changeObj,CodeMirror)}); + parent['cM'+num+'diff'] .on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM,'cM'+num+'diff',changeObj,CodeMirror)}); // Scroll - window['cM'+num] .on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM,'cM'+num+'diff')}); + parent['cM'+num] .on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM,'cM'+num)}); + parent['cM'+num+'diff'] .on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM,'cM'+num+'diff')}); // Update - window['cM'+num] .on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM,'cM'+num+'diff')}); + parent['cM'+num] .on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM,'cM'+num)}); + parent['cM'+num+'diff'] .on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM,'cM'+num+'diff')}); // Input read - window['cM'+num] .on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM,'cM'+num+'diff')}); + parent['cM'+num] .on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM,'cM'+num)}); + parent['cM'+num+'diff'] .on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM,'cM'+num+'diff')}); // Gutter Click - window['cM'+num] .on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM,line,gutter,evt,'cM'+num)}); - window['cM'+num+'diff'] .on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM,line,gutter,evt,'cM'+num+'diff')}); + parent['cM'+num] .on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM,line,gutter,evt,'cM'+num)}); + parent['cM'+num+'diff'] .on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM,line,gutter,evt,'cM'+num+'diff')}); // Mouse Down - window['cM'+num] .on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM,'cM'+num,evt)}); - window['cM'+num+'diff'] .on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM,'cM'+num+'diff',evt)}); + parent['cM'+num] .on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM,'cM'+num,evt)}); + parent['cM'+num+'diff'] .on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM,'cM'+num+'diff',evt)}); // Context Menu - window['cM'+num] .on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM,'cM'+num,evt)}); - window['cM'+num+'diff'] .on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM,'cM'+num+'diff',evt)}); + parent['cM'+num] .on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM,'cM'+num,evt)}); + parent['cM'+num+'diff'] .on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM,'cM'+num+'diff',evt)}); // Drag Over - window['cM'+num] .on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM,event,'cM'+num)}); - window['cM'+num+'diff'] .on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM,event,'cM'+num+'diff')}); + parent['cM'+num] .on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM,event,'cM'+num)}); + parent['cM'+num+'diff'] .on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM,event,'cM'+num+'diff')}); // Render line - window['cM'+num] .on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM,'cM'+num,line,element)}); - window['cM'+num+'diff'] .on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM,'cM'+num+'diff',line,element)}); + parent['cM'+num] .on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM,'cM'+num,line,element)}); + parent['cM'+num+'diff'] .on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM,'cM'+num+'diff',line,element)}); // Now create the active lines for them - parent.ICEcoder['cMActiveLinecM'+num] = window['cM'+num].addLineClass(0, "background", "cm-s-activeLine"); - parent.ICEcoder['cMActiveLinecM'+num+'diff'] = window['cM'+num+'diff'].addLineClass(0, "background", "cm-s-activeLine"); + parent.ICEcoder['cMActiveLinecM'+num] = parent['cM'+num].addLineClass(0, "background", "cm-s-activeLine"); + parent.ICEcoder['cMActiveLinecM'+num+'diff'] = parent['cM'+num+'diff'].addLineClass(0, "background", "cm-s-activeLine"); }; From f6916c732b857fa918a987b6fef137602663e7a4 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 22:43:10 +0000 Subject: [PATCH 037/231] parent used in terminal.php --- terminal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terminal.php b/terminal.php index ba99fca..08af48a 100644 --- a/terminal.php +++ b/terminal.php @@ -53,7 +53,7 @@ key = function(e) { sendCmd = function(command) { // Send command over XHR for response and display - xhr = ICEcoder.xhrObj(); + xhr = parent.ICEcoder.xhrObj(); xhr.onreadystatechange=function() { if (xhr.readyState==4) { // OK reponse? @@ -79,7 +79,7 @@ sendCmd = function(command) { } }; // Send the XHR request - xhr.open("POST","lib/terminal-xhr.php?csrf="+ICEcoder.csrf,true); + xhr.open("POST","lib/terminal-xhr.php?csrf="+parent.ICEcoder.csrf,true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.send('command='+encodeURIComponent(command)); } From b896e8a82ee920a620944c31a2309565a075fcf6 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 28 Feb 2020 22:58:52 +0000 Subject: [PATCH 038/231] Typo fix --- terminal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminal.php b/terminal.php index 08af48a..2a7cf2b 100644 --- a/terminal.php +++ b/terminal.php @@ -35,7 +35,7 @@ key = function(e) { commandHistory[commandHistory.length-1] = "[[ICEcoder]]:"+currentCommand; } } - // If ee have at least some items in history, step back a level and display the previous command + // If we have at least some items in history, step back a level and display the previous command if (currentLine > 0) { currentLine--; document.getElementById('command').value = commandHistory[currentLine].replace("[[ICEcoder]]:",""); From e2076eb4c4719d39ae43c84a3d1e9a079dda8ab0 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 29 Feb 2020 09:16:10 +0000 Subject: [PATCH 039/231] Path fixes to 2 x files --- editor.php | 68 ++++++++++++++--------------- lib/settings-save-current-files.php | 6 +-- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/editor.php b/editor.php index f96fa7e..4fac3fd 100644 --- a/editor.php +++ b/editor.php @@ -225,74 +225,74 @@ function createNewCMInstance(num) { }; // Start editor instances, main and diff - parent['cM'+num] = CodeMirror(document.body, cMOptions); - parent['cM'+num+'diff'] = CodeMirror(document.body, cMOptions); + window['cM'+num] = CodeMirror(document.body, cMOptions); + window['cM'+num+'diff'] = CodeMirror(document.body, cMOptions); // Define actions for those... // Focus - parent['cM'+num] .on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM,'cM'+num)}); - parent['cM'+num+'diff'] .on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM,'cM'+num+'diff')}); + window['cM'+num] .on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM,'cM'+num)}); + window['cM'+num+'diff'] .on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM,'cM'+num+'diff')}); // Blur - parent['cM'+num] .on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM,'cM'+num)}); - parent['cM'+num+'diff'] .on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM,'cM'+num+'diff')}); + window['cM'+num] .on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM,'cM'+num)}); + window['cM'+num+'diff'] .on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM,'cM'+num+'diff')}); // Keyup - parent['cM'+num] .on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM,'cM'+num)}); - parent['cM'+num+'diff'] .on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM,'cM'+num+'diff')}); + window['cM'+num] .on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM,'cM'+num)}); + window['cM'+num+'diff'] .on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM,'cM'+num+'diff')}); // Cursor activity - parent['cM'+num] .on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM,'cM'+num)}); - parent['cM'+num+'diff'] .on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM,'cM'+num+'diff')}); + window['cM'+num] .on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM,'cM'+num)}); + window['cM'+num+'diff'] .on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM,'cM'+num+'diff')}); // Before selection change - parent['cM'+num] .on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLine = thisCM.getCursor().line;}); - parent['cM'+num+'diff'] .on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLineDiff = thisCM.getCursor().line;}); + window['cM'+num] .on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLine = thisCM.getCursor().line;}); + window['cM'+num+'diff'] .on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLineDiff = thisCM.getCursor().line;}); // Change - parent['cM'+num] .on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM,'cM'+num,changeObj,CodeMirror)}); - parent['cM'+num+'diff'] .on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM,'cM'+num+'diff',changeObj,CodeMirror)}); + window['cM'+num] .on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM,'cM'+num,changeObj,CodeMirror)}); + window['cM'+num+'diff'] .on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM,'cM'+num+'diff',changeObj,CodeMirror)}); // Before change - parent['cM'+num] .on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM,'cM'+num,changeObj,CodeMirror)}); - parent['cM'+num+'diff'] .on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM,'cM'+num+'diff',changeObj,CodeMirror)}); + window['cM'+num] .on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM,'cM'+num,changeObj,CodeMirror)}); + window['cM'+num+'diff'] .on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM,'cM'+num+'diff',changeObj,CodeMirror)}); // Scroll - parent['cM'+num] .on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM,'cM'+num)}); - parent['cM'+num+'diff'] .on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM,'cM'+num+'diff')}); + window['cM'+num] .on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM,'cM'+num)}); + window['cM'+num+'diff'] .on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM,'cM'+num+'diff')}); // Update - parent['cM'+num] .on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM,'cM'+num)}); - parent['cM'+num+'diff'] .on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM,'cM'+num+'diff')}); + window['cM'+num] .on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM,'cM'+num)}); + window['cM'+num+'diff'] .on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM,'cM'+num+'diff')}); // Input read - parent['cM'+num] .on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM,'cM'+num)}); - parent['cM'+num+'diff'] .on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM,'cM'+num+'diff')}); + window['cM'+num] .on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM,'cM'+num)}); + window['cM'+num+'diff'] .on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM,'cM'+num+'diff')}); // Gutter Click - parent['cM'+num] .on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM,line,gutter,evt,'cM'+num)}); - parent['cM'+num+'diff'] .on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM,line,gutter,evt,'cM'+num+'diff')}); + window['cM'+num] .on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM,line,gutter,evt,'cM'+num)}); + window['cM'+num+'diff'] .on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM,line,gutter,evt,'cM'+num+'diff')}); // Mouse Down - parent['cM'+num] .on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM,'cM'+num,evt)}); - parent['cM'+num+'diff'] .on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM,'cM'+num+'diff',evt)}); + window['cM'+num] .on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM,'cM'+num,evt)}); + window['cM'+num+'diff'] .on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM,'cM'+num+'diff',evt)}); // Context Menu - parent['cM'+num] .on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM,'cM'+num,evt)}); - parent['cM'+num+'diff'] .on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM,'cM'+num+'diff',evt)}); + window['cM'+num] .on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM,'cM'+num,evt)}); + window['cM'+num+'diff'] .on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM,'cM'+num+'diff',evt)}); // Drag Over - parent['cM'+num] .on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM,event,'cM'+num)}); - parent['cM'+num+'diff'] .on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM,event,'cM'+num+'diff')}); + window['cM'+num] .on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM,event,'cM'+num)}); + window['cM'+num+'diff'] .on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM,event,'cM'+num+'diff')}); // Render line - parent['cM'+num] .on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM,'cM'+num,line,element)}); - parent['cM'+num+'diff'] .on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM,'cM'+num+'diff',line,element)}); + window['cM'+num] .on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM,'cM'+num,line,element)}); + window['cM'+num+'diff'] .on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM,'cM'+num+'diff',line,element)}); // Now create the active lines for them - parent.ICEcoder['cMActiveLinecM'+num] = parent['cM'+num].addLineClass(0, "background", "cm-s-activeLine"); - parent.ICEcoder['cMActiveLinecM'+num+'diff'] = parent['cM'+num+'diff'].addLineClass(0, "background", "cm-s-activeLine"); + parent.ICEcoder['cMActiveLinecM'+num] = window['cM'+num].addLineClass(0, "background", "cm-s-activeLine"); + parent.ICEcoder['cMActiveLinecM'+num+'diff'] = window['cM'+num+'diff'].addLineClass(0, "background", "cm-s-activeLine"); }; diff --git a/lib/settings-save-current-files.php b/lib/settings-save-current-files.php index ef147d7..00392ab 100644 --- a/lib/settings-save-current-files.php +++ b/lib/settings-save-current-files.php @@ -31,7 +31,7 @@ if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) { fwrite($fh, $settingsContents); fclose($fh); } else { - echo ""; + echo ""; } // Update our last10Files var? @@ -50,10 +50,10 @@ if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) { fwrite($fh, $settingsContents); fclose($fh); } else { - echo ""; + echo ""; } } } } - echo ''; + echo ''; } From 1df109a6605e4b1bdd3ada488fc8fa7ae6a6c594 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 29 Feb 2020 10:13:53 +0000 Subject: [PATCH 040/231] ice-coder.js huge paths overhaul --- lib/ice-coder.js | 2523 +++++++++++++++++++++++----------------------- 1 file changed, 1264 insertions(+), 1259 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index e75378c..25a0e65 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -80,79 +80,77 @@ var ICEcoder = { // Create our ID aliases for (var i=0;i
      " + "\n"; get("git").innerHTML = gitDiffList + "

      "; @@ -1071,14 +1068,14 @@ var ICEcoder = { // Update preview window content updatePreviewWindow: function(thisCM,filepath,filename,fileExt) { - if (ICEcoder.previewWindow.location.pathname==filepath) { + if (this.previewWindow.location.pathname==filepath) { if (["htm","html","txt"].indexOf(fileExt) > -1) { - ICEcoder.previewWindow.document.documentElement.innerHTML = thisCM.getValue(); + this.previewWindow.document.documentElement.innerHTML = thisCM.getValue(); } else if (["md"].indexOf(fileExt) > -1) { - ICEcoder.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()); + this.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()); } } else if (["css"].indexOf(fileExt) > -1) { - if (ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(filename) > -1) { + if (this.previewWindow.document.documentElement.innerHTML.indexOf(filename) > -1) { var css = thisCM.getValue(); var style = document.createElement('style'); style.type = 'text/css'; @@ -1088,18 +1085,18 @@ var ICEcoder = { } else { style.appendChild(document.createTextNode(css)); } - if (ICEcoder.previewWindow.document.getElementById(style.id)) { - ICEcoder.previewWindow.document.documentElement.removeChild(ICEcoder.previewWindow.document.getElementById(style.id)); + if (this.previewWindow.document.getElementById(style.id)) { + this.previewWindow.document.documentElement.removeChild(this.previewWindow.document.getElementById(style.id)); } - ICEcoder.previewWindow.document.documentElement.appendChild(style); + this.previewWindow.document.documentElement.appendChild(style); } } // Do the pesticide plugin if it exists - try {ICEcoder.doPesticide();} catch(err) {}; + try {this.doPesticide();} catch(err) {}; // Do the stats.js plugin if it exists - try {ICEcoder.doStatsJS('update');} catch(err) {}; + try {this.doStatsJS('update');} catch(err) {}; // Do the responsive plugin if it exists - try {ICEcoder.doResponsive();} catch(err) {}; + try {this.doResponsive();} catch(err) {}; }, // Clean up our loaded code @@ -1107,26 +1104,26 @@ var ICEcoder = { var cM, cMdiff, thisCM, content; // Replace any temp /textarea value - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; content = thisCM.getValue(); content = content.replace(//g,'<\/textarea>'); // Then set the content in the editor & clear the history thisCM.setValue(content); thisCM.clearHistory(); - ICEcoder.savedPoints[ICEcoder.selectedTab-1] = thisCM.changeGeneration(); - ICEcoder.savedContents[ICEcoder.selectedTab-1] = thisCM.getValue(); + this.savedPoints[this.selectedTab-1] = thisCM.changeGeneration(); + this.savedContents[this.selectedTab-1] = thisCM.getValue(); }, // Undo last change undo: function() { var cM, cMdiff, thisCM; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; thisCM.undo(); }, @@ -1134,9 +1131,9 @@ var ICEcoder = { redo: function() { var cM, cMdiff, thisCM; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; thisCM.redo(); }, @@ -1144,13 +1141,13 @@ var ICEcoder = { indent: function(moreLess) { var cM, cMdiff, thisCM; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (moreLess=="more") { - ICEcoder.content.contentWindow.CodeMirror.commands.indentMore(thisCM); + this.content.contentWindow.CodeMirror.commands.indentMore(thisCM); } else { - ICEcoder.content.contentWindow.CodeMirror.commands.indentLess(thisCM); + this.content.contentWindow.CodeMirror.commands.indentLess(thisCM); } }, @@ -1158,9 +1155,9 @@ var ICEcoder = { moveLines: function(dir) { var cM, cMdiff, thisCM, lineStart, lineEnd, swapLineNo, swapLine; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; // Get start & end lines plus the line we'll swap with lineStart = thisCM.getCursor('start'); @@ -1199,9 +1196,9 @@ var ICEcoder = { highlightLine: function(line) { var cM, cMdiff, thisCM; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; thisCM.setSelection({line:line,ch:0}, {line:line,ch:thisCM.lineInfo(line).text.length}); }, @@ -1210,8 +1207,8 @@ var ICEcoder = { var cM, cMdiff, thisCM; if (!(/iPhone|iPad|iPod/i.test(navigator.userAgent))) { - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); thisCM = diff ? cMdiff : cM; if (thisCM) { thisCM.focus(); @@ -1226,31 +1223,31 @@ var ICEcoder = { lineNo = lineNo ? lineNo-1 : get('goToLineNo').value-1; charNo = charNo ? charNo : 0; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - ICEcoder.scrollingOnLine = thisCM.getCursor().line; + this.scrollingOnLine = thisCM.getCursor().line; // Scroll cursor into middle of view - if ("undefined" != typeof ICEcoder.scrollInt) { - clearInterval(ICEcoder.scrollInt); + if ("undefined" != typeof this.scrollInt) { + clearInterval(this.scrollInt); } - ICEcoder.scrollInt = setInterval(function() { - ICEcoder.scrollingOnLine = ICEcoder.scrollingOnLine+((lineNo-ICEcoder.scrollingOnLine)/5); - thisCM.scrollTo(0,(thisCM.defaultTextHeight()*ICEcoder.scrollingOnLine)-(thisCM.getScrollInfo().clientHeight/10)); - ICEcoder.setMinimapLayout(thisCM); - if (Math.round(ICEcoder.scrollingOnLine) == lineNo) { - clearInterval(ICEcoder.scrollInt); + this.scrollInt = setInterval(function(ic) { + ic.scrollingOnLine = ic.scrollingOnLine+((lineNo-ic.scrollingOnLine)/5); + thisCM.scrollTo(0,(thisCM.defaultTextHeight()*ic.scrollingOnLine)-(thisCM.getScrollInfo().clientHeight/10)); + ic.setMinimapLayout(thisCM); + if (Math.round(ic.scrollingOnLine) == lineNo) { + clearInterval(ic.scrollInt); } - },10); + },10,this); thisCM.setCursor(lineNo, charNo); if (!noFocus) { - ICEcoder.focus(); + this.focus(); // Also do this after a 0ms tickover incase DOM wasn't ready - setTimeout(function(){ICEcoder.focus();},0); + setTimeout(function(ic){ic.focus();},0,this); } return false; }, @@ -1259,25 +1256,25 @@ var ICEcoder = { lineCommentToggle: function() { var cM, cMdiff, thisCM, cursorPos, linePos, lineContent, lCLen; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; cursorPos = thisCM.getCursor().ch; linePos = thisCM.getCursor().line; lineContent = thisCM.getLine(linePos); lCLen = lineContent.length; - ICEcoder.lineCommentToggleSub(thisCM, cursorPos, linePos, lineContent, lCLen); + this.lineCommentToggleSub(thisCM, cursorPos, linePos, lineContent, lCLen); }, // Wrap our selected text/cursor with tags tagWrapper: function(tag) { var cM, cMdiff, thisCM, tagStart, tagEnd, startLine, endLine; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; tagStart = tag; tagEnd = tag; if (tag=='div') { @@ -1310,9 +1307,9 @@ var ICEcoder = { addLineBreakAtEnd: function(line) { var cM,cMdiff, thisCM; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (!line) {line = thisCM.getCursor().line}; thisCM.replaceRange(thisCM.getLine(line)+"
      ",{line:line,ch:0},{line:line,ch:1000000}); }, @@ -1321,9 +1318,9 @@ var ICEcoder = { insertLineBefore: function(line) { var cM, cMdiff, thisCM; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (!line) {line = thisCM.getCursor().line}; thisCM.operation(function() { thisCM.replaceRange("\n"+thisCM.getLine(line),{line:line,ch:0},{line:line,ch:1000000}); @@ -1336,9 +1333,9 @@ var ICEcoder = { insertLineAfter: function(line) { var cM, cMdiff, thisCM; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (!line) {line = thisCM.getCursor().line}; thisCM.operation(function() { thisCM.replaceRange(thisCM.getLine(line)+"\n",{line:line,ch:0},{line:line,ch:1000000}); @@ -1350,9 +1347,9 @@ var ICEcoder = { duplicateLines: function(line) { var cM, cMdiff, thisCM, ch, lineExtra, userSelStart, userSelEnd, lineBreak; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (!line && thisCM.somethingSelected()) { userSelStart = thisCM.getCursor('start'); userSelEnd = thisCM.getCursor('end'); @@ -1371,9 +1368,9 @@ var ICEcoder = { removeLines: function(line) { var cM, cMdiff, thisCM, ch; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (!line && thisCM.somethingSelected()) { thisCM.replaceSelection("","end"); } else { @@ -1388,15 +1385,15 @@ var ICEcoder = { jumpToDefinition: function() { var cM, cMdiff, thisCM, tokenString, defVars; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; tokenString = thisCM.getTokenAt(thisCM.getCursor()).string; - if (thisCM.somethingSelected() && ICEcoder.origCurorPos) { - thisCM.setCursor(ICEcoder.origCurorPos); + if (thisCM.somethingSelected() && this.origCurorPos) { + thisCM.setCursor(this.origCurorPos); } else { - ICEcoder.origCurorPos = thisCM.getCursor(); + this.origCurorPos = thisCM.getCursor(); defVars = [ "var "+tokenString, "function "+tokenString, @@ -1408,7 +1405,7 @@ var ICEcoder = { "def "+tokenString, "class "+tokenString]; for (var i=0; i'+ICEcoder.functionClassList[i]['name']+'
      '+ICEcoder.functionClassList[i]['params']+'
      '; + for (var i=0; i'+ic.functionClassList[i]['name']+'
      '+ic.functionClassList[i]['params']+'
      '; } } // Update our list get('functionClassList').innerHTML = functionClassList; - },0); + },0,this); } }, @@ -1444,7 +1441,7 @@ var ICEcoder = { updateFunctionClassListItems: function(handle) { var cM, functionClassText; - cM = ICEcoder.getcMInstance(); + cM = this.getcMInstance(); functionClassText = ""; // Get function declaration lines if (handle.text.indexOf("function ") > -1 && handle.text.replace(/\$function/g,"").indexOf("function ") > -1) { @@ -1459,24 +1456,24 @@ var ICEcoder = { // Push items into array if (functionClassText[0] != "") { - ICEcoder.functionClassList.push({ + this.functionClassList.push({ line: cM.getLineNumber(handle), name: functionClassText[0], params: "("+(functionClassText[1] ? functionClassText[1].replace(/[,]/g,", ") : ""), verified: false }); // After a 0ms tickover, verify the item - setTimeout(function() { + setTimeout(function(ic) { // If we're defining a function/class if (!handle.styles || (handle.styles && handle.styles.indexOf('def') > -1 && cM.getLineNumber(handle))) { // Find our item in the array and mark it as verified - for (var i=0; i< ICEcoder.functionClassList.length; i++) { - if (ICEcoder.functionClassList[i]['line'] == cM.getLineNumber(handle)) { - ICEcoder.functionClassList[i]['verified'] = true; + for (var i=0; i< ic.functionClassList.length; i++) { + if (ic.functionClassList[i]['line'] == cM.getLineNumber(handle)) { + ic.functionClassList[i]['verified'] = true; } }; } - },0); + },0,this); } }, @@ -1484,19 +1481,19 @@ var ICEcoder = { setMinimap: function() { var cM; - cM = ICEcoder.getcMInstance(); + cM = this.getcMInstance(); if(cM) { // Get syntax formatted content and output to miniMapContent - ICEcoder.content.contentWindow.CodeMirror.runMode(cM.getValue(),cM.getOption('mode'),get('miniMapContent')); + this.content.contentWindow.CodeMirror.runMode(cM.getValue(),cM.getOption('mode'),get('miniMapContent')); // white-space: pre vs pre-wrap depending on line wrapping - get('miniMapContent').innerHTML = '
      '+get('miniMapContent').innerHTML+'
      '; + get('miniMapContent').innerHTML = '
      '+get('miniMapContent').innerHTML+'
      '; get('miniMapContent').innerHTML = get('miniMapContent').innerHTML.replace(/\
      '; + this.miniMapBoxHeight+'px; background: rgba(0,198,255,0.1); z-index: 1; cursor: pointer" id="miniMapBox">
      '; var elem = get('miniMapBox'); var draggie = new Draggabilly( elem, { @@ -1509,18 +1506,18 @@ var ICEcoder = { maxHeight = parseInt(get('docExplorer').style.height,10) <= parseInt(get('miniMapContent').getBoundingClientRect().height,10) ? parseInt(get('docExplorer').style.height,10) : parseInt(get('miniMapContent').getBoundingClientRect().height,10); - newPerc = (this.position.y/(maxHeight-ICEcoder.miniMapBoxHeight)); + newPerc = (this.position.y/(maxHeight-this.miniMapBoxHeight)); yPos = (cM.getScrollInfo().height-cM.getScrollInfo().clientHeight)*newPerc; cM.scrollTo(0,yPos); // this.position.y }); draggie.on( 'pointerDown', function( event, pointer ) { - ICEcoder.mouseDownMinimap = true; + this.mouseDownMinimap = true; }); draggie.on( 'pointerUp', function( event, pointer ) { - ICEcoder.mouseDownMinimap = false; + this.mouseDownMinimap = false; }); - ICEcoder.setMinimapLayout(cM); + this.setMinimapLayout(cM); get('docExplorer').style.right = "-220px"; } @@ -1533,7 +1530,7 @@ var ICEcoder = { if (get('miniMapBox') && thisCM) { // Get CM instance and percentage through document - cM = ICEcoder.getcMInstance(); + cM = this.getcMInstance(); percThru = thisCM.getScrollInfo().top/(thisCM.getScrollInfo().height-thisCM.getScrollInfo().clientHeight); // If content to display has a greater height than docExplorer @@ -1541,10 +1538,10 @@ var ICEcoder = { // Set the minimap container to same height get('miniMapContainer').style.height = parseInt(get('docExplorer').style.height,10)+"px"; // Set box height relative to font height - ICEcoder.miniMapBoxHeight = (parseInt(get('docExplorer').style.height,10)/cM.defaultTextHeight()*2); - get('miniMapBox').style.height = ICEcoder.miniMapBoxHeight + "px"; + this.miniMapBoxHeight = (parseInt(get('docExplorer').style.height,10)/cM.defaultTextHeight()*2); + get('miniMapBox').style.height = this.miniMapBoxHeight + "px"; // Set top position of it according to percentage through document and account for height of nav box - ICEcoder.miniMapBoxTop = (percThru*parseInt(get('docExplorer').style.height,10)) - (percThru*ICEcoder.miniMapBoxHeight); + this.miniMapBoxTop = (percThru*parseInt(get('docExplorer').style.height,10)) - (percThru*this.miniMapBoxHeight); // Set the minimap position according to scroll position (used if we move cursor in document) get('miniMapContent').style.marginTop = (-(parseInt(get('miniMapContent').getBoundingClientRect().height,10) - parseInt(get('docExplorer').style.height,10))*percThru) + "px"; // If less than the docExplorer height @@ -1552,16 +1549,16 @@ var ICEcoder = { // Set height of container to that of the content get('miniMapContainer').style.height = parseInt(get('miniMapContent').getBoundingClientRect().height,10)+"px"; // Set box height relative to font height - ICEcoder.miniMapBoxHeight = (parseInt(get('docExplorer').style.height,10)/cM.defaultTextHeight()*2); - get('miniMapBox').style.height = ICEcoder.miniMapBoxHeight + "px"; + this.miniMapBoxHeight = (parseInt(get('docExplorer').style.height,10)/cM.defaultTextHeight()*2); + get('miniMapBox').style.height = this.miniMapBoxHeight + "px"; // Set top position of it according to percentage through minimap and account for height of nav box - ICEcoder.miniMapBoxTop = (percThru*parseInt(get('miniMapContainer').getBoundingClientRect().height,10)) - (percThru*ICEcoder.miniMapBoxHeight); + this.miniMapBoxTop = (percThru*parseInt(get('miniMapContainer').getBoundingClientRect().height,10)) - (percThru*this.miniMapBoxHeight); // Set the minimap position to 0 get('miniMapContent').style.marginTop = 0; } // Can set the Minimap nav position if not dragging it (let Draggabilly handle that) - if (!ICEcoder.mouseDownMinimap) { - get('miniMapBox').style.top = ICEcoder.miniMapBoxTop + "px"; + if (!this.mouseDownMinimap) { + get('miniMapBox').style.top = this.miniMapBoxTop + "px"; } } }, @@ -1570,20 +1567,20 @@ var ICEcoder = { autocomplete: function() { var cM, cMdiff, thisCM; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - ICEcoder.content.contentWindow.CodeMirror.commands.autocomplete(thisCM); + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + this.content.contentWindow.CodeMirror.commands.autocomplete(thisCM); }, // Paste a URL, locally or absolutely if CTRL/Cmd key down pasteURL: function(url) { var cM, cMdiff, thisCM; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if(ICEcoder.draggingWithKey == "CTRL") { + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if(this.draggingWithKey == "CTRL") { url = window.location.protocol + "//" + window.location.hostname + url; } thisCM.replaceSelection(url,"around"); @@ -1593,18 +1590,18 @@ var ICEcoder = { searchForSelected: function() { var cM, cMdiff, thisCM; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (ICEcoder.caretLocType) { + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if (this.caretLocType) { if (thisCM.getSelection() != "") { - var searchPrefix = ICEcoder.caretLocType.toLowerCase()+" "; - if (ICEcoder.caretLocType=="Content") { + var searchPrefix = this.caretLocType.toLowerCase()+" "; + if (this.caretLocType=="Content") { searchPrefix = ""; } window.open("http://www.google.com/#output=search&q="+searchPrefix+thisCM.getSelection()); } else { - ICEcoder.message(t['No text selected...']); + this.message(t['No text selected...']); } } }, @@ -1618,7 +1615,7 @@ var ICEcoder = { var selElem, sPN, fileFolder, goElem, // Get selected elem, the parent node of that, if it's a file/folder and set elem to go to next - selElem = get('filesFrame').contentWindow.document.getElementById(ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1]+"_perms").parentNode; + selElem = get('filesFrame').contentWindow.document.getElementById(this.selectedFiles[this.selectedFiles.length-1]+"_perms").parentNode; sPN = selElem.parentNode; fileFolder = selElem.onmouseover.toString().indexOf("'folder'") > -1 ? "folder" : "file"; goElem = false; @@ -1646,17 +1643,17 @@ var ICEcoder = { } if (action == "left") { if (fileFolder == "folder" && sPN.parentNode.previousSibling) { - ICEcoder.openCloseDir(selElem,false); // contract dir + this.openCloseDir(selElem,false); // contract dir } } if (action == "right" || action == "enter") { fileFolder == "folder" - ? ICEcoder.openCloseDir(selElem,true) // expand dir - : ICEcoder.openFile(selElem.childNodes[1].id.replace(/\|/g,"/")); // open file + ? this.openCloseDir(selElem,true) // expand dir + : this.openFile(selElem.childNodes[1].id.replace(/\|/g,"/")); // open file } if (goElem && goElem.childNodes[1]) { - ICEcoder.overFileFolder(fileFolder, goElem.childNodes[1].id); // If we have an elem to go to, select it - ICEcoder.selectFileFolder(evt); + this.overFileFolder(fileFolder, goElem.childNodes[1].id); // If we have an elem to go to, select it + this.selectFileFolder(evt); } }, @@ -1665,8 +1662,8 @@ var ICEcoder = { var node, d; dir.onclick = function(event) { - if(!event.ctrlKey && !ICEcoder.cmdKey) { - ICEcoder.openCloseDir(this,!load); + if(!event.ctrlKey && !this.cmdKey) { + this.openCloseDir(this,!load); } }; node = dir.parentNode; @@ -1677,7 +1674,7 @@ var ICEcoder = { dir.parentNode.className = dir.className = d ? "pft-directory dirOpen" : "pft-directory"; } if (load) { - ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/get-branch.php?location="+dir.childNodes[1].id+"&csrf="+ICEcoder.csrf; + this.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/get-branch.php?location="+dir.childNodes[1].id+"&csrf="+this.csrf; } else if(node.tagName == "UL") { node.parentNode.removeChild(node); } @@ -1686,8 +1683,8 @@ var ICEcoder = { // Note which files or folders we are over on mouseover/mouseout overFileFolder: function(type, link) { - ICEcoder.thisFileFolderType=type; - ICEcoder.thisFileFolderLink=link; + this.thisFileFolderType=type; + this.thisFileFolderLink=link; }, // Detect and return dir/file/false for this DOM ref (false for not found) @@ -1709,30 +1706,30 @@ var ICEcoder = { var tgtFile, shortURL, selecting, dirList, lastFileClicked, startFile, endFile, thisFileObj; // If we've clicked somewhere other than a file/folder - if (ICEcoder.thisFileFolderLink=="") { - if (!ctrlSim && !evt.ctrlKey && !ICEcoder.cmdKey) { - ICEcoder.deselectAllFiles(); + if (this.thisFileFolderLink=="") { + if (!ctrlSim && !evt.ctrlKey && !this.cmdKey) { + this.deselectAllFiles(); } - } else if (ICEcoder.thisFileFolderLink) { + } else if (this.thisFileFolderLink) { // Get file URL, with pipes instead of slashes & target DOM elem - shortURL = ICEcoder.thisFileFolderLink.replace(/\//g,"|"); - tgtFile = ICEcoder.filesFrame.contentWindow.document.getElementById(shortURL); + shortURL = this.thisFileFolderLink.replace(/\//g,"|"); + tgtFile = this.filesFrame.contentWindow.document.getElementById(shortURL); // If we have the CTRL/Cmd key down - if (ctrlSim || evt.ctrlKey || ICEcoder.cmdKey) { + if (ctrlSim || evt.ctrlKey || this.cmdKey) { // Deselect or select file - if (ICEcoder.selectedFiles.indexOf(shortURL)>-1) { - ICEcoder.selectDeselectFile('deselect',tgtFile); - ICEcoder.selectedFiles.splice(ICEcoder.selectedFiles.indexOf(shortURL),1); + if (this.selectedFiles.indexOf(shortURL)>-1) { + this.selectDeselectFile('deselect',tgtFile); + this.selectedFiles.splice(this.selectedFiles.indexOf(shortURL),1); } else { - ICEcoder.selectDeselectFile('select',tgtFile); - ICEcoder.selectedFiles.push(shortURL); + this.selectDeselectFile('select',tgtFile); + this.selectedFiles.push(shortURL); } // Select from last click to this one } else if (shiftSim || evt.shiftKey) { selecting = false; dirList = tgtFile.parentNode.parentNode.parentNode; - lastFileClicked = ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1]; + lastFileClicked = this.selectedFiles[this.selectedFiles.length-1]; // Prefix numbers with up to 20 leading zeros // This is so we can have some kind of natural comparison on the regex below @@ -1743,62 +1740,62 @@ var ICEcoder = { startFile = shortURL.replace(/\d+/g, prefixer) < lastFileClicked.replace(/\d+/g, prefixer) ? shortURL : lastFileClicked; endFile = shortURL.replace(/\d+/g, prefixer) > lastFileClicked.replace(/\d+/g, prefixer) ? shortURL : lastFileClicked; - if (ICEcoder.selectedFiles.length > 0 && startFile.substr(0,startFile.lastIndexOf("|")) == endFile.substr(0,endFile.lastIndexOf("|"))) { + if (this.selectedFiles.length > 0 && startFile.substr(0,startFile.lastIndexOf("|")) == endFile.substr(0,endFile.lastIndexOf("|"))) { for (var i=0; i<1000000; i+=2) { if(dirList.childNodes[i].nodeName != "LI") {i++;}; thisFileObj = dirList.childNodes[i].childNodes[0].childNodes[1]; if (thisFileObj.id == startFile) { selecting = true; } - if (selecting==true && ICEcoder.selectedFiles.indexOf(thisFileObj.id)==-1) { - ICEcoder.selectDeselectFile('select',thisFileObj); - ICEcoder.selectedFiles.push(thisFileObj.id); + if (selecting==true && this.selectedFiles.indexOf(thisFileObj.id)==-1) { + this.selectDeselectFile('select',thisFileObj); + this.selectedFiles.push(thisFileObj.id); } if (thisFileObj.id == endFile) { break; } } } else { - ICEcoder.selectDeselectFile('select',tgtFile); - ICEcoder.selectedFiles.push(shortURL); + this.selectDeselectFile('select',tgtFile); + this.selectedFiles.push(shortURL); } // We are single clicking } else { - ICEcoder.deselectAllFiles(); + this.deselectAllFiles(); // Add our URL and highlight the file - ICEcoder.selectDeselectFile('select',tgtFile); - ICEcoder.selectedFiles.push(shortURL); + this.selectDeselectFile('select',tgtFile); + this.selectedFiles.push(shortURL); } } // If in GitHub mode, update the selected count and button colours - if (ICEcoder.githubDiff) { - get('githubNavSelectedCount').innerHTML = "Selected: " + ICEcoder.selectedFiles.length; - get('githubNavCommit').style.color = ICEcoder.selectedFiles.length > 0 ? "#fff" : "#333"; - get('githubNavCommit').style.background = ICEcoder.selectedFiles.length > 0 ? "#2187e7" : "#555"; - get('githubNavSelectedCount').style.color = ICEcoder.selectedFiles.length > 0 ? "#fff" : "#333"; - get('githubNavPull').style.color = ICEcoder.selectedFiles.length > 0 ? "#fff" : "#333"; - get('githubNavPull').style.background = ICEcoder.selectedFiles.length > 0 ? "#2187e7" : "#555"; + if (this.githubDiff) { + get('githubNavSelectedCount').innerHTML = "Selected: " + this.selectedFiles.length; + get('githubNavCommit').style.color = this.selectedFiles.length > 0 ? "#fff" : "#333"; + get('githubNavCommit').style.background = this.selectedFiles.length > 0 ? "#2187e7" : "#555"; + get('githubNavSelectedCount').style.color = this.selectedFiles.length > 0 ? "#fff" : "#333"; + get('githubNavPull').style.color = this.selectedFiles.length > 0 ? "#fff" : "#333"; + get('githubNavPull').style.background = this.selectedFiles.length > 0 ? "#2187e7" : "#555"; } // Adjust the file & replace select dropdown values accordingly - document.findAndReplace.target[2].innerHTML = !ICEcoder.selectedFiles[0] ? t['all files'] : t['selected files']; - document.findAndReplace.target[3].innerHTML = !ICEcoder.selectedFiles[0] ? t['all filenames'] : t['selected filenames']; + document.findAndReplace.target[2].innerHTML = !this.selectedFiles[0] ? t['all files'] : t['selected files']; + document.findAndReplace.target[3].innerHTML = !this.selectedFiles[0] ? t['all filenames'] : t['selected filenames']; // Hide the file menu incase it's showing - ICEcoder.hideFileMenu(); + this.hideFileMenu(); }, // Deselect all files deselectAllFiles: function() { var tgtFile; - for (var i=0;i -1 ? true : false; + isOpen = this.openFiles.indexOf(file.id.replace(/\|/g,"/")) > -1 ? true : false; - if (ICEcoder.openFiles[ICEcoder.selectedTab-1] == file.id.replace(/\|/g,"/")) { + if (this.openFiles[this.selectedTab-1] == file.id.replace(/\|/g,"/")) { file.style.backgroundColor = action=="select" - ? ICEcoder.tabBGselected : ICEcoder.tabBGcurrent; + ? this.tabBGselected : this.tabBGcurrent; } else { file.style.backgroundColor = action=="select" - ? ICEcoder.tabBGselected : file.style.backgroundColor = isOpen - ? ICEcoder.tabBGopen : ICEcoder.tabBGnormal; + ? this.tabBGselected : file.style.backgroundColor = isOpen + ? this.tabBGopen : this.tabBGnormal; } - file.style.color = action=="select" ? ICEcoder.tabFGselected : ICEcoder.tabFGnormalFile; + file.style.color = action=="select" ? this.tabFGselected : this.tabFGnormalFile; } }, @@ -1824,40 +1821,40 @@ var ICEcoder = { boxSelect: function(evt, mouseAction) { var fmDragBox, positive; - fmDragBox = ICEcoder.filesFrame.contentWindow.document.getElementById('fmDragBox'); + fmDragBox = this.filesFrame.contentWindow.document.getElementById('fmDragBox'); // On mouse down, set start X & Y and reset first and last items in box area select if (mouseAction == "down") { - ICEcoder.fmDragBoxStartX = ICEcoder.mouseX; - ICEcoder.fmDragBoxStartY = ICEcoder.mouseY; - ICEcoder.fmDragSelectFirst = ""; - ICEcoder.fmDragSelectLast = ""; + this.fmDragBoxStartX = this.mouseX; + this.fmDragBoxStartY = this.mouseY; + this.fmDragSelectFirst = ""; + this.fmDragSelectLast = ""; } // On mouse drag, state we're dragging, set the box size and position properties and select files - if(ICEcoder.mouseDown && !ICEcoder.mouseDownInCM && mouseAction == "drag") { - ICEcoder.fmDraggedBox = true; + if(this.mouseDown && !this.mouseDownInCM && mouseAction == "drag") { + this.fmDraggedBox = true; // Handle X-axis properties - positive = ICEcoder.mouseX-ICEcoder.fmDragBoxStartX > 0; - fmDragBox.style.left = (positive ? ICEcoder.fmDragBoxStartX : ICEcoder.mouseX) + "px"; - fmDragBox.style.width = Math.abs(ICEcoder.mouseX-ICEcoder.fmDragBoxStartX) + "px"; + positive = this.mouseX-this.fmDragBoxStartX > 0; + fmDragBox.style.left = (positive ? this.fmDragBoxStartX : this.mouseX) + "px"; + fmDragBox.style.width = Math.abs(this.mouseX-this.fmDragBoxStartX) + "px"; // Handle Y-axis properties - positive = ICEcoder.mouseY-ICEcoder.fmDragBoxStartY > 0; - fmDragBox.style.top = (positive ? ICEcoder.fmDragBoxStartY-70 : ICEcoder.mouseY-70) + "px"; - fmDragBox.style.height = Math.abs(ICEcoder.mouseY-ICEcoder.fmDragBoxStartY) + "px"; + positive = this.mouseY-this.fmDragBoxStartY > 0; + fmDragBox.style.top = (positive ? this.fmDragBoxStartY-70 : this.mouseY-70) + "px"; + fmDragBox.style.height = Math.abs(this.mouseY-this.fmDragBoxStartY) + "px"; // Select the files - if (ICEcoder.thisFileFolderLink != "") { - if (ICEcoder.fmDragSelectFirst == "") { - ICEcoder.fmDragSelectFirst = ICEcoder.thisFileFolderLink; - ICEcoder.overFileFolder(ICEcoder.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', ICEcoder.fmDragSelectFirst); - ICEcoder.selectFileFolder(evt); + if (this.thisFileFolderLink != "") { + if (this.fmDragSelectFirst == "") { + this.fmDragSelectFirst = this.thisFileFolderLink; + this.overFileFolder(this.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', this.fmDragSelectFirst); + this.selectFileFolder(evt); } else { - ICEcoder.fmDragSelectLast = ICEcoder.thisFileFolderLink; - ICEcoder.overFileFolder(ICEcoder.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', ICEcoder.fmDragSelectLast); - ICEcoder.selectFileFolder(evt,false,'shiftSim'); + this.fmDragSelectLast = this.thisFileFolderLink; + this.overFileFolder(this.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', this.fmDragSelectLast); + this.selectFileFolder(evt,false,'shiftSim'); } } } @@ -1871,19 +1868,19 @@ var ICEcoder = { // Create a new file (start & instant save) newFile: function() { - ICEcoder.newTab('alsoSave'); + this.newTab('alsoSave'); }, // Create a new folder newFolder: function() { var shortURL, newFolder; - shortURL = ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); - newFolder = ICEcoder.getInput('Enter new folder name at '+shortURL,''); + shortURL = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); + newFolder = this.getInput('Enter new folder name at '+shortURL,''); if (newFolder) { newFolder = (shortURL + "/" + newFolder).replace(/\/\//,"/"); - ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=newFolder&csrf="+ICEcoder.csrf,encodeURIComponent(newFolder.replace(/\//g,"|"))); - ICEcoder.serverMessage(''+t['Creating Folder']+'
      '+newFolder); + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=newFolder&csrf="+this.csrf,encodeURIComponent(newFolder.replace(/\//g,"|"))); + this.serverMessage(''+t['Creating Folder']+'
      '+newFolder); } }, @@ -1917,44 +1914,44 @@ var ICEcoder = { var flSplit, line, shortURL, canOpenFile; if ("undefined" != typeof fileLink) { - flSplit = ICEcoder.returnFileAndLine(fileLink); + flSplit = this.returnFileAndLine(fileLink); fileLink = flSplit[0]; line = flSplit[1]; } if (fileLink) { - ICEcoder.thisFileFolderLink=fileLink; - ICEcoder.thisFileFolderType="file"; + this.thisFileFolderLink=fileLink; + this.thisFileFolderType="file"; } - if (ICEcoder.thisFileFolderLink != "/[NEW]" && ICEcoder.isOpen(ICEcoder.thisFileFolderLink)!==false) { - ICEcoder.switchTab(ICEcoder.isOpen(ICEcoder.thisFileFolderLink)+1); + if (this.thisFileFolderLink != "/[NEW]" && this.isOpen(this.thisFileFolderLink)!==false) { + this.switchTab(this.isOpen(this.thisFileFolderLink)+1); if (line > 1){ - ICEcoder.goToLine(line); + this.goToLine(line); } - } else if (ICEcoder.thisFileFolderLink!="" && ICEcoder.thisFileFolderType=="file") { + } else if (this.thisFileFolderLink!="" && this.thisFileFolderType=="file") { // work out a shortened URL for the file - shortURL = ICEcoder.thisFileFolderLink.replace(/\|/g,"/"); + shortURL = this.thisFileFolderLink.replace(/\|/g,"/"); // No reason why we can't open a file (so far) canOpenFile = true; // Limit to 100 files open at a time - if (ICEcoder.openFiles.length>=100) { - ICEcoder.message(t['Sorry you can...']); + if (this.openFiles.length>=100) { + this.message(t['Sorry you can...']); canOpenFile = false; } // if we're still OK to open it... if (canOpenFile) { - ICEcoder.shortURL = shortURL; + this.shortURL = shortURL; if (shortURL!="/[NEW]") { - ICEcoder.thisFileFolderLink = ICEcoder.thisFileFolderLink.replace(/\//g,"|"); - ICEcoder.serverQueue("add",iceLoc+"/lib/file-control.php?action=load&file="+encodeURIComponent(ICEcoder.thisFileFolderLink)+"&csrf="+ICEcoder.csrf+"&lineNumber="+line); - ICEcoder.serverMessage(''+t['Opening File']+'
      '+ICEcoder.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); + this.serverMessage(''+t['Opening File']+'
      '+this.shortURL); } else { - ICEcoder.createNewTab('new'); + this.createNewTab('new'); } - ICEcoder.fMIconVis('fMView',1); + this.fMIconVis('fMView',1); } } }, @@ -1962,9 +1959,9 @@ var ICEcoder = { // Open selected files openFilesFromList: function(fileList) { for (var i=0;i-1 - ? ICEcoder.getRemoteFile(fileLink) - : ICEcoder.openFile(fileLink); + ? this.getRemoteFile(fileLink) + : this.openFile(fileLink); } }, @@ -1984,23 +1981,23 @@ var ICEcoder = { var flSplit, line; if ("undefined" != typeof remoteFile) { - flSplit = ICEcoder.returnFileAndLine(remoteFile); + flSplit = this.returnFileAndLine(remoteFile); remoteFile = flSplit[0]; line = flSplit[1]; } - ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=getRemoteFile&csrf="+ICEcoder.csrf+"&lineNumber="+line,encodeURIComponent(remoteFile)); - ICEcoder.serverMessage(''+t['Getting']+'
      '+remoteFile); + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=getRemoteFile&csrf="+this.csrf+"&lineNumber="+line,encodeURIComponent(remoteFile)); + this.serverMessage(''+t['Getting']+'
      '+remoteFile); }, // Get changes to save (used when simply saving, gets diff changes between current and last known version) getChangesToSave: function() { var cM, savedText, newText, sm, opcodes; - cM = ICEcoder.getcMInstance(); + cM = this.getcMInstance(); // Get the last known saved version of file from array - savedText = ICEcoder.savedContents[ICEcoder.selectedTab-1]; + savedText = this.savedContents[this.selectedTab-1]; // Get the text values and split it into lines newText = difflib.stringAsLines(cM.getValue()); @@ -2037,23 +2034,22 @@ var ICEcoder = { // Save a file saveFile: function(saveAs) { var changes, saveType, filePath, pathPrefix; - // If we're not 'saving as', establish changes between current and known saved version from array if (!saveAs) { - changes = ICEcoder.getChangesToSave(); + changes = this.getChangesToSave(); } saveType = saveAs ? "saveAs" : "save"; - filePath = ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(iceRoot,"").replace(/\//g,"|"); - if (filePath=="|[NEW]" && ICEcoder.selectedFiles.length>0) { - pathPrefix = ICEcoder.selectedFiles[0]; + filePath = this.openFiles[this.selectedTab-1].replace(iceRoot,"").replace(/\//g,"|"); + if (filePath=="|[NEW]" && this.selectedFiles.length>0) { + pathPrefix = this.selectedFiles[0]; filePath = pathPrefix.lastIndexOf(".") == -1 || pathPrefix.lastIndexOf(".") < pathPrefix.lastIndexOf("|") ? pathPrefix+filePath : "|[NEW]"; } filePath = filePath.replace("||","|"); - ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=save&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&fileVersion="+ICEcoder.openFileVersions[ICEcoder.selectedTab-1]+"&saveType="+saveType+"&csrf="+ICEcoder.csrf,encodeURIComponent(filePath),changes); - ICEcoder.serverMessage(''+t['Saving']+'
      '+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(iceRoot,"")); + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=save&fileMDT="+this.openFileMDTs[this.selectedTab-1]+"&fileVersion="+this.openFileVersions[this.selectedTab-1]+"&saveType="+saveType+"&csrf="+this.csrf,encodeURIComponent(filePath),changes); + this.serverMessage(''+t['Saving']+'
      '+this.openFiles[this.selectedTab-1].replace(iceRoot,"")); }, // Prompt a rename dialog @@ -2061,28 +2057,28 @@ var ICEcoder = { var shortURL, fileName, i; if (!oldName) { - shortURL = ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); - oldName = ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); + shortURL = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); + oldName = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); } else { shortURL = oldName.replace(/\|/g,"/"); } if (!newName) { - newName = ICEcoder.getInput(t['Please enter the...'],shortURL); + newName = this.getInput(t['Please enter the...'],shortURL); } if (newName) { - i = ICEcoder.openFiles.indexOf(shortURL.replace(/\|/g,"/")); + i = this.openFiles.indexOf(shortURL.replace(/\|/g,"/")); if(i>-1) { // rename array item and the tab - ICEcoder.openFiles[i] = newName; - closeTabLink = ''; - fileName = ICEcoder.openFiles[i]; + this.openFiles[i] = newName; + closeTabLink = ''; + fileName = this.openFiles[i]; get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); get('tab'+(i+1)).title = newName; } - ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=rename&oldFileName="+encodeURIComponent(oldName.replace(/\|/g,"/"))+"&csrf="+ICEcoder.csrf,encodeURIComponent(newName)); - ICEcoder.serverMessage(''+t['Renaming to']+'
      '+newName); + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=rename&oldFileName="+encodeURIComponent(oldName.replace(/\|/g,"/"))+"&csrf="+this.csrf,encodeURIComponent(newName)); + this.serverMessage(''+t['Renaming to']+'
      '+newName); - ICEcoder.setPreviousFiles(); + this.setPreviousFiles(); } }, @@ -2091,21 +2087,21 @@ var ICEcoder = { var fileName, i; if (newName && newName != oldName) { - i = ICEcoder.openFiles.indexOf(oldName.replace(/\|/g,"/")); + i = this.openFiles.indexOf(oldName.replace(/\|/g,"/")); if(i>-1) { // rename array item and the tab - ICEcoder.openFiles[i] = newName; - closeTabLink = ''; - fileName = ICEcoder.openFiles[i]; + this.openFiles[i] = newName; + closeTabLink = ''; + fileName = this.openFiles[i]; get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); get('tab'+(i+1)).title = newName; } - if (ICEcoder.ask("Are you sure you want to move file " + oldName + " to " + newName + " ?")){ - ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=move&oldFileName="+encodeURIComponent(oldName.replace(/\//g,"|"))+"&csrf="+ICEcoder.csrf,encodeURIComponent(newName.replace(/\//g,"|"))); - ICEcoder.serverMessage(''+t['Moving to']+'
      '+newName); + if (this.ask("Are you sure you want to move file " + oldName + " to " + newName + " ?")){ + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=move&oldFileName="+encodeURIComponent(oldName.replace(/\//g,"|"))+"&csrf="+this.csrf,encodeURIComponent(newName.replace(/\//g,"|"))); + this.serverMessage(''+t['Moving to']+'
      '+newName); } - ICEcoder.setPreviousFiles(); + this.setPreviousFiles(); } }, @@ -2113,41 +2109,41 @@ var ICEcoder = { deleteFiles: function(fileList) { var tgtFiles, tgtListDisplay; - tgtFiles = fileList ? fileList : ICEcoder.selectedFiles; + tgtFiles = fileList ? fileList : this.selectedFiles; tgtListDisplay = tgtFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n"); - if (tgtFiles.length>0 && ICEcoder.ask('Delete:\n\n'+tgtListDisplay+'?')) { - ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=delete&&csrf="+ICEcoder.csrf,encodeURIComponent(tgtFiles.join(";"))); - ICEcoder.serverMessage(''+t['Deleting File']+'
      '+tgtListDisplay); + if (tgtFiles.length>0 && this.ask('Delete:\n\n'+tgtListDisplay+'?')) { + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=delete&&csrf="+this.csrf,encodeURIComponent(tgtFiles.join(";"))); + this.serverMessage(''+t['Deleting File']+'
      '+tgtListDisplay); }; }, // Copy files copyFiles: function(fileList,dontShowPaste,dontHide) { - ICEcoder.copiedFiles = []; + this.copiedFiles = []; for (var i=0; i'+t['Pasting File']+'
      '+ICEcoder.copiedFiles[i].toString().replace(/\|/g,"/").replace(/,/g,"\n")); + if (this.copiedFiles) { + for (var i=0; i'+t['Pasting File']+'
      '+this.copiedFiles[i].toString().replace(/\|/g,"/").replace(/,/g,"\n")); } else { - ICEcoder.message(t['Sorry cannot paste...']); + this.message(t['Sorry cannot paste...']); } } } else { - ICEcoder.message(t['Nothing to paste...']); + this.message(t['Nothing to paste...']); } }, @@ -2156,17 +2152,17 @@ var ICEcoder = { var copiedFiles, location; // Take a snapshot of copied files - if (ICEcoder.copiedFiles) { - copiedFiles = ICEcoder.copiedFiles; + if (this.copiedFiles) { + copiedFiles = this.copiedFiles; } - ICEcoder.copyFiles(fileList,'dontShowPaste','dontHide'); + this.copyFiles(fileList,'dontShowPaste','dontHide'); location = fileList[0].substr(0,fileList[0].lastIndexOf("|")); - ICEcoder.pasteFiles(location); + this.pasteFiles(location); // Restore copied files back to the snapshot if ("undefined" != typeof copiedFiles) { - ICEcoder.copiedFiles = copiedFiles; + this.copiedFiles = copiedFiles; } }, @@ -2177,7 +2173,7 @@ var ICEcoder = { }, uploadFilesSubmit: function(obj) { if (get('fileInput').value!="") { - ICEcoder.showHide('show',get('loadingMask')); + this.showHide('show',get('loadingMask')); get('uploadFilesForm').submit(); event.preventDefault(); } @@ -2187,15 +2183,15 @@ var ICEcoder = { showHideFileNav: function(vis,elem) { var options = ["optionsFile","optionsEdit","optionsSource","optionsHelp"]; if (vis=="hide") { - fileNavInt = setTimeout(function() { + fileNavInt = setTimeout(function(ic) { for (var i=0; i= 0) { + if (["raw","both"].indexOf(this.fileDirResOutput) >= 0) { console.log(xhr.responseText); } // User wanted object (or both) output of the response? - if (["object","both"].indexOf(ICEcoder.fileDirResOutput) >= 0) { + if (["object","both"].indexOf(this.fileDirResOutput) >= 0) { console.log(statusObj); } // Also store the statusObj - ICEcoder.lastFileDirCheckStatusObj = statusObj; + this.lastFileDirCheckStatusObj = statusObj; // If error, show that, otherwise do whatever we're required to do next if (statusObj.status.error) { - ICEcoder.message(statusObj.status.errorMsg); + this.message(statusObj.status.errorMsg); console.log("ICEcoder error info for your request..."); console.log(statusObj); - ICEcoder.serverMessage(); - ICEcoder.serverQueue('del',0); + this.serverMessage(); + this.serverQueue('del',0); } else { eval(statusObj.action.doNext); } // Some other response? Display a message about that } else { - ICEcoder.message(t['Sorry there was...']); + this.message(t['Sorry there was...']); console.log("ICEcoder error info for your request..."); console.log(statusObj); - ICEcoder.serverMessage(); - ICEcoder.serverQueue('del',0); + this.serverMessage(); + this.serverQueue('del',0); } } }; - xhr.open("POST",iceLoc+"/lib/file-control-xhr.php?action=checkExists&csrf="+ICEcoder.csrf,true); + xhr.open("POST",iceLoc+"/lib/file-control-xhr.php?action=checkExists&csrf="+this.csrf,true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); timeStart = new Date().getTime(); xhr.send('timeStart='+timeStart+'&file='+encodeURIComponent(path)); @@ -2301,30 +2297,30 @@ var ICEcoder = { showMenu: function(evt) { var menuType, menuHeight, winH, fmYPos; - if ( ICEcoder.selectedFiles.length == 0 || - ICEcoder.selectedFiles.indexOf(ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\//g,"|")) == -1) { - ICEcoder.selectFileFolder(evt); + if ( this.selectedFiles.length == 0 || + this.selectedFiles.indexOf(this.selectedFiles[this.selectedFiles.length-1].replace(/\//g,"|")) == -1) { + this.selectFileFolder(evt); } menuHeight = 124+5; // general options height in px plus 5px space winH = window.innerHeight; - if ("undefined" != typeof ICEcoder.thisFileFolderLink && ICEcoder.thisFileFolderLink!="") { - menuType = this.isPathFolder(ICEcoder.selectedFiles[0]) ? "folder" : "file"; - get('folderMenuItems').style.display = menuType == "folder" && ICEcoder.selectedFiles.length == 1 ? "block" : "none"; - if (menuType == "folder" && ICEcoder.selectedFiles.length == 1) { + if ("undefined" != typeof this.thisFileFolderLink && this.thisFileFolderLink!="") { + menuType = this.isPathFolder(this.selectedFiles[0]) ? "folder" : "file"; + get('folderMenuItems').style.display = menuType == "folder" && this.selectedFiles.length == 1 ? "block" : "none"; + if (menuType == "folder" && this.selectedFiles.length == 1) { menuHeight += 20+20+1+23+1+2; // new file, new folder, hr, upload files(s), hr, padding if (get('fmMenuPasteOption').style.display == "block") { menuHeight += 19; } } - get('singleFileMenuItems').style.display = ICEcoder.selectedFiles.length > 1 ? "none" : "block"; - if (ICEcoder.selectedFiles.length == 1) { + get('singleFileMenuItems').style.display = this.selectedFiles.length > 1 ? "none" : "block"; + if (this.selectedFiles.length == 1) { menuHeight += 43; } get('fileMenu').style.display = "inline-block"; setTimeout(function() {get('fileMenu').style.opacity = "1"},4); - get('fileMenu').style.left = (ICEcoder.mouseX+20) + "px"; - fmYPos = ICEcoder.mouseY-ICEcoder.filesFrame.contentWindow.document.body.scrollTop-10; + get('fileMenu').style.left = (this.mouseX+20) + "px"; + fmYPos = this.mouseY-this.filesFrame.contentWindow.document.body.scrollTop-10; if (fmYPos+menuHeight > winH) { fmYPos -= (fmYPos+menuHeight-winH); } @@ -2354,7 +2350,7 @@ var ICEcoder = { // Is this is a file or folder and based on that, set the CSS styling & link actionElemType = fileOrFolder; cssStyle = actionElemType=="file" ? "pft-file ext-" + file.substr(file.indexOf(".")+1) : "pft-directory"; - perms = actionElemType=="file" ? ICEcoder.newFilePerms : ICEcoder.newDirPerms; + perms = actionElemType=="file" ? this.newFilePerms : this.newDirPerms; // Identify our target element & the first child element in it's location if (!location) {location="/"} @@ -2364,15 +2360,15 @@ var ICEcoder = { locNest = targetElem.parentNode.parentNode.nextSibling; newText = document.createTextNode("\n"); permColors = perms == 777 ? 'background: #800; color: #eee' : 'color: #888'; - innerLI = '        '+file+' '+perms+''; + ' if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {this.openFile()}}" style="position: relative; left:-22px">        '+file+' '+perms+''; // If we don't have a locNest or at least 3 DOM items in there, it's an empty folder if(!locNest || locNest.childNodes.length<3) { @@ -2385,10 +2381,10 @@ var ICEcoder = { newLI = document.createElement("li"); newLI.className = cssStyle; newLI.draggable = false; - newLI.ondragstart = function(event) {ICEcoder.addDefaultDragData(this,event)}; - newLI.ondrag = function(event) {ICEcoder.draggingWithKeyTest(event);if(ICEcoder.getcMInstance()){ICEcoder.editorFocusInstance.indexOf('diff') == -1 ? ICEcoder.getcMInstance().focus() : ICEcoder.getcMdiffInstance().focus()}}; - newLI.ondragover = function(event) {ICEcoder.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; - newLI.ondragend = function() {ICEcoder.dropFile(this)}; + newLI.ondragstart = function(event) {this.addDefaultDragData(this,event)}; + newLI.ondrag = function(event) {this.draggingWithKeyTest(event);if(this.getcMInstance()){this.editorFocusInstance.indexOf('diff') == -1 ? this.getcMInstance().focus() : this.getcMdiffInstance().focus()}}; + newLI.ondragover = function(event) {this.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; + newLI.ondragend = function() {this.dropFile(this)}; newLI.innerHTML = innerLI locNest.nextSibling.appendChild(newLI); locNest.nextSibling.appendChild(newText); @@ -2408,10 +2404,10 @@ var ICEcoder = { newLI = document.createElement("li"); newLI.className = cssStyle; newLI.draggable = false; - newLI.ondragstart = function(event) {ICEcoder.addDefaultDragData(this,event)}; - newLI.ondrag = function(event) {ICEcoder.draggingWithKeyTest(event);if(ICEcoder.getcMInstance()){ICEcoder.editorFocusInstance.indexOf('diff') == -1 ? ICEcoder.getcMInstance().focus() : ICEcoder.getcMdiffInstance().focus()}}; - newLI.ondragover = function(event) {ICEcoder.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; - newLI.ondragend = function() {ICEcoder.dropFile(this)}; + newLI.ondragstart = function(event) {this.addDefaultDragData(this,event)}; + newLI.ondrag = function(event) {this.draggingWithKeyTest(event);if(this.getcMInstance()){this.editorFocusInstance.indexOf('diff') == -1 ? this.getcMInstance().focus() : this.getcMdiffInstance().focus()}}; + newLI.ondragover = function(event) {this.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; + newLI.ondragend = function() {this.dropFile(this)}; newLI.innerHTML = innerLI; // Append or insert depending on which of the above if statements is true if (i==locNest.childNodes.length-1) { @@ -2428,7 +2424,7 @@ var ICEcoder = { } // If we added a new file, we've saved it under a new filename, so set that if (actionElemType=="file" && !uploaded) { - ICEcoder.openFiles[ICEcoder.selectedTab-1]=location+file; + this.openFiles[this.selectedTab-1]=location+file; } } @@ -2445,19 +2441,19 @@ var ICEcoder = { targetElemPerms = get('filesFrame').contentWindow.document.getElementById(shortURL+"_perms"); targetElemPerms.id = location.replace(/\//g,"|") + "|" + file + "_perms"; // Finally, rename also within any children - ICEcoder.renameInChildren(targetElem, oldName, location, file); + this.renameInChildren(targetElem, oldName, location, file); } // Moving files if (action=="move") { - ICEcoder.updateFileManagerList("add",location,file,false,false,false,fileOrFolder); - ICEcoder.updateFileManagerList("delete",oldName.substr(0,oldName.lastIndexOf("/")),file); + this.updateFileManagerList("add",location,file,false,false,false,fileOrFolder); + this.updateFileManagerList("delete",oldName.substr(0,oldName.lastIndexOf("/")),file); } // Chmod on files if (action=="chmod") { // Get short URL for our file and get our target elem based on this - shortURL = ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"); + shortURL = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); targetElem = get('filesFrame').contentWindow.document.getElementById(shortURL.replace(/\//g,"|")+"_perms"); // Set the color for the perms targetElem.style.background = perms == 777 ? '#800' : 'none'; @@ -2474,7 +2470,7 @@ var ICEcoder = { location = location.replace(/\/$/, "").replace(/\//g,"|"); targetElem = (location +"|"+file).replace("||","|"); targetElem = get('filesFrame').contentWindow.document.getElementById(targetElem).parentNode.parentNode; - ICEcoder.openCloseDir(targetElem.childNodes[0],false); + this.openCloseDir(targetElem.childNodes[0],false); targetElem.parentNode.removeChild(targetElem); } }, @@ -2499,7 +2495,7 @@ var ICEcoder = { targetElemPerms = get('filesFrame').contentWindow.document.getElementById(targetElem.id).nextSibling.nextSibling; targetElemPerms.id = targetElem.id + "_perms"; // Finally, test this node for ULs next to it also, incase it's a dir - ICEcoder.renameInChildren(targetElem, oldName, location, file); + this.renameInChildren(targetElem, oldName, location, file); } } } @@ -2507,10 +2503,10 @@ var ICEcoder = { // Refresh file manager refreshFileManager: function() { - ICEcoder.showHide('show',get('loadingMask')); - ICEcoder.filesFrame.contentWindow.location.reload(true); - ICEcoder.filesFrame.style.opacity="0"; - ICEcoder.filesFrame.onload = function() { + this.showHide('show',get('loadingMask')); + this.filesFrame.contentWindow.location.reload(true); + this.filesFrame.style.opacity="0"; + this.filesFrame.onload = function() { ICEcoder.filesFrame.style.opacity="1"; ICEcoder.showHide('hide',get('loadingMask')); } @@ -2524,10 +2520,10 @@ var ICEcoder = { // Mac command key handling (224 = Moz, 91/93 = Webkit Left/Right Apple) if (key==224 || key==91 || key==93) { - ICEcoder.cmdKey = true; + this.cmdKey = true; } - ICEcoder.draggingWithKey = evt.ctrlKey||ICEcoder.cmdKey ? "CTRL" : false; + this.draggingWithKey = evt.ctrlKey||this.cmdKey ? "CTRL" : false; }, // Add default drag data (dragging in Firefox on DOM elems not possible otherwise) @@ -2541,15 +2537,15 @@ var ICEcoder = { // Prevent the default and establish if CTRL key is down evt.preventDefault(); - ICEcoder.draggingWithKeyTest(evt); + this.draggingWithKeyTest(evt); // Establish the cursor to show cursorIcon = dropType == "editor" - ? ICEcoder.draggingWithKey == "CTRL" + ? this.draggingWithKey == "CTRL" ? "copy" : "link" : dropType == "folder" - ? ICEcoder.draggingWithKey == "CTRL" + ? this.draggingWithKey == "CTRL" ? "copy" : "move" : "none"; @@ -2563,22 +2559,22 @@ var ICEcoder = { filePath = elem.childNodes[0].childNodes[1].id.replace(/\|/g,"/"); fileName = filePath.substr(filePath.lastIndexOf("/")+1); - if (ICEcoder.area=='editor') { - ICEcoder.pasteURL(filePath); + if (this.area=='editor') { + this.pasteURL(filePath); }; - if (ICEcoder.area=='files') { + if (this.area=='files') { setTimeout(function() { - tgtPath = ICEcoder.thisFileFolderType == "folder" ? ICEcoder.thisFileFolderLink : ICEcoder.thisFileFolderLink.substr(0,ICEcoder.thisFileFolderLink.lastIndexOf("|")); - if(ICEcoder.draggingWithKey == "CTRL") { - ICEcoder.copyFiles(ICEcoder.selectedFiles); - ICEcoder.pasteFiles(tgtPath); + tgtPath = ic.thisFileFolderType == "folder" ? ic.thisFileFolderLink : ic.thisFileFolderLink.substr(0,ic.thisFileFolderLink.lastIndexOf("|")); + if(ic.draggingWithKey == "CTRL") { + ic.copyFiles(ic.selectedFiles); + ic.pasteFiles(tgtPath); } else { - ICEcoder.moveFile(filePath,tgtPath.replace(/\|/g,"/") + "/" + fileName); + ic.moveFile(filePath,tgtPath.replace(/\|/g,"/") + "/" + fileName); } - },4); + },4,this); }; - ICEcoder.mouseDown=false; - ICEcoder.mouseDownInCM=false; + this.mouseDown=false; + this.mouseDownInCM=false; }, // ============== @@ -2601,7 +2597,7 @@ var ICEcoder = { if (isCancel){ // Deselect by setting value to itself, then focus on editor get('find').value = get('find').value; - ICEcoder.focus(); + this.focus(); return; } // Set findPrevious to false if not passed in @@ -2615,9 +2611,9 @@ var ICEcoder = { results = get('results'); // If we have something to find in currrent document - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (thisCM && find.length>0 && document.findAndReplace.target.value==t['this document']) { content = thisCM.getValue().toLowerCase(); // Find & replace the next instance, or all? @@ -2632,65 +2628,65 @@ var ICEcoder = { // Get the content again, as it might of changed content = thisCM.getValue().toLowerCase(); - if (!ICEcoder.findMode||find!=ICEcoder.lastsearch) { - ICEcoder.results = []; - ICEcoder.resultsLines = []; + if (!this.findMode||find!=this.lastsearch) { + this.results = []; + this.resultsLines = []; for (var i=0;i0) { + if (this.results.length>0) { // Show results only if (resultsOnly) { - results.innerHTML = ICEcoder.results.length + " results"; + results.innerHTML = this.results.length + " results"; // We need to take action instead } else { // Find our cursor position relative to results // Go next if (!findPrevious) { - ICEcoder.findResult = 0; - for (var i=0;i=0;i--) { - if (ICEcoder.results[i]>thisCM.indexFromPos({"ch": thisCM.getCursor().ch-1, "line": thisCM.getCursor().line})) { - ICEcoder.findResult--; + for (var i=this.results.length-1;i>=0;i--) { + if (this.results[i]>thisCM.indexFromPos({"ch": thisCM.getCursor().ch-1, "line": thisCM.getCursor().line})) { + this.findResult--; } } } // Loop round to start - if (!findPrevious && ICEcoder.findResult>ICEcoder.results.length-1) { - ICEcoder.findResult = 0 + if (!findPrevious && this.findResult>this.results.length-1) { + this.findResult = 0 } // Loop round to end - if (findPrevious && ICEcoder.findResult==1) { - ICEcoder.findResult = ICEcoder.results.length+1; + if (findPrevious && this.findResult==1) { + this.findResult = this.results.length+1; } // Update results display - results.innerHTML = "Highlighted result "+(ICEcoder.findResult+(!findPrevious ? 1 : -1))+" of "+ICEcoder.results.length+" results"; + results.innerHTML = "Highlighted result "+(this.findResult+(!findPrevious ? 1 : -1))+" of "+this.results.length+" results"; // Now actually perform the movement in the editor if (!findPrevious) { @@ -2714,28 +2710,28 @@ var ICEcoder = { } // Finally, highlight our selection thisCM.setSelection(cursor.from(), cursor.to()); - ICEcoder.focus(); - ICEcoder.findMode = true; + this.focus(); + this.findMode = true; } // Display the find results bar // The avg block is either line height or fraction of space available - avgBlockH = !ICEcoder.scrollBarVisible ? thisCM.defaultTextHeight() : parseInt(ICEcoder.content.style.height,10)/thisCM.lineCount(); + avgBlockH = !this.scrollBarVisible ? thisCM.defaultTextHeight() : parseInt(this.content.style.height,10)/thisCM.lineCount(); // Need to add padding if there's no scrollbar, so current line highlighting lines up with it - addPadding = !ICEcoder.scrollBarVisible ? thisCM.heightAtLine(0) : 0; + addPadding = !this.scrollBarVisible ? thisCM.heightAtLine(0) : 0; rBlocks = ""; for (var i=1; i<=thisCM.lineCount(); i++) { - blockColor = ICEcoder.resultsLines.indexOf(i)>-1 ? thisCM.getCursor().line+1 == i ? "#b00" : "#888" : "transparent" + blockColor = this.resultsLines.indexOf(i)>-1 ? thisCM.getCursor().line+1 == i ? "#b00" : "#888" : "transparent" rBlocks += '
      '; } - ICEcoder.content.contentWindow.document.getElementById('resultsBar').innerHTML = rBlocks; - ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.display = "inline-block"; + this.content.contentWindow.document.getElementById('resultsBar').innerHTML = rBlocks; + this.content.contentWindow.document.getElementById('resultsBar').style.display = "inline-block"; return true; } else { results.innerHTML = "No results"; - ICEcoder.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; - ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; + this.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; + this.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; return false; } } else { @@ -2751,25 +2747,25 @@ var ICEcoder = { targetQS = "&target="+document.findAndReplace.target.value.replace(/ /g,"-"); } if (document.findAndReplace.target.value==t['selected files']) { - filesQS = "&selectedFiles="+ICEcoder.selectedFiles.join(":"); + filesQS = "&selectedFiles="+this.selectedFiles.join(":"); } find = find.replace(/\'/g, '\''); find != encodeURIComponent(find) ? find = 'ICEcoder:'+encodeURIComponent(find) : find; - ICEcoder.showHide('show',get('loadingMask')); - get('mediaContainer').innerHTML = ''; + this.showHide('show',get('loadingMask')); + get('mediaContainer').innerHTML = ''; // We have nothing to search for, blank it all out } else { results.innerHTML = "No results"; - ICEcoder.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; - ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; + this.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; + this.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; } } }, // Replace text in a file replaceInFile: function(fileRef,find,replace) { - ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=replaceText&find="+find+"&replace="+replace+"&csrf="+ICEcoder.csrf,encodeURIComponent(fileRef.replace(/\//g,"|"))); - ICEcoder.serverMessage(''+t['Replacing text in']+'
      '+fileRef); + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=replaceText&find="+find+"&replace="+replace+"&csrf="+this.csrf,encodeURIComponent(fileRef.replace(/\//g,"|"))); + this.serverMessage(''+t['Replacing text in']+'
      '+fileRef); }, // ============== @@ -2780,9 +2776,9 @@ var ICEcoder = { getCaretPosition: function() { var cM, cMdiff, thisCM, line, ch, chPos; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; line = thisCM.getCursor().line; ch = thisCM.getCursor().ch; @@ -2790,26 +2786,26 @@ var ICEcoder = { for (var i=0;i -1 ? cMdiff : cM; - ICEcoder.caretLocationType(); - ICEcoder.charDisplay.innerHTML = ICEcoder.caretLocType + ", Line: " + (thisCM.getCursor().line+1) + ", Char: " + thisCM.getCursor().ch; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + this.caretLocationType(); + this.charDisplay.innerHTML = this.caretLocType + ", Line: " + (thisCM.getCursor().line+1) + ", Char: " + thisCM.getCursor().ch; }, // Update version display updateVersionsDisplay: function() { - var versionsCount = ICEcoder.openFileVersions[ICEcoder.selectedTab-1]; + var versionsCount = this.openFileVersions[this.selectedTab-1]; get('versionsDisplay').innerHTML = "undefined" != typeof versionsCount - ? ICEcoder.openFileVersions[ICEcoder.selectedTab-1] + " backup" + + ? this.openFileVersions[this.selectedTab-1] + " backup" + (versionsCount != 1 ? "s" : "") : ""; }, @@ -2818,16 +2814,16 @@ var ICEcoder = { updateByteDisplay: function() { var cM, cMdiff, thisCM; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - ICEcoder.byteDisplay.innerHTML = thisCM.getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " bytes"; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + this.byteDisplay.innerHTML = thisCM.getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " bytes"; }, // Toggle the char/byte display showDisplay: function(show) { - ICEcoder.byteDisplay.style.display = show == "byte" ? "inline-block" : "none"; - ICEcoder.charDisplay.style.display = show == "char" ? "inline-block" : "none"; + this.byteDisplay.style.display = show == "byte" ? "inline-block" : "none"; + this.charDisplay.style.display = show == "char" ? "inline-block" : "none"; }, // Show & hide target element @@ -2837,27 +2833,37 @@ var ICEcoder = { // Determine the CodeMirror instance we're using getcMInstance: function(tab) { - return parent.ICEcoder.content.contentWindow[ + ic = this; + if (!ic.content) { + ic = parent.ICEcoder; + } + if (!ic.content) { + ic = parent.ICEcoder; + } + return ic.content.contentWindow[ // target specific tab !isNaN(tab) ? 'cM'+ICEcoder.cMInstances[tab-1] // new tab or selected tab - : tab=="new"||(tab!="new" && ICEcoder.openFiles.length>0) - ? 'cM'+ICEcoder.cMInstances[ICEcoder.selectedTab-1] + : tab=="new"||(tab!="new" && this.openFiles.length>0) + ? 'cM'+ICEcoder.cMInstances[this.selectedTab-1] // fallback to first tab : 'cM1' ]; }, // Determine the CodeMirror instance we're using - getcMdiffInstance: function(tab) { - return parent.ICEcoder.content.contentWindow[ + getcMdiffInstance: function(tab, context) { + if ("undefined" === typeof context) { + context = ICEcoder; + } + return context.content.contentWindow[ (// target specific tab !isNaN(tab) ? 'cM'+ICEcoder.cMInstances[tab-1] // new tab or selected tab - : tab=="new"||(tab!="new" && ICEcoder.openFiles.length>0) - ? 'cM'+ICEcoder.cMInstances[ICEcoder.selectedTab-1] + : tab=="new"||(tab!="new" && this.openFiles.length>0) + ? 'cM'+ICEcoder.cMInstances[this.selectedTab-1] // fallback to first tab : 'cM1') + 'diff' @@ -2868,18 +2874,18 @@ var ICEcoder = { getMouseXY: function(e,area) { var tempX, tempY; - ICEcoder.mouseX = e.pageX ? e.pageX : e.clientX + document.body.scrollLeft; - ICEcoder.mouseY = e.pageY ? e.pageY : e.clientY + document.body.scrollTop; + this.mouseX = e.pageX ? e.pageX : e.clientX + document.body.scrollLeft; + this.mouseY = e.pageY ? e.pageY : e.clientY + document.body.scrollTop; - ICEcoder.area = area; + this.area = area; if (area!="top") { - ICEcoder.mouseY += 25 + 45; + this.mouseY += 25 + 45; } if (area=="editor") { - ICEcoder.mouseX += ICEcoder.filesW; + this.mouseX += this.filesW; } - ICEcoder.dragCursorTest(); - if (ICEcoder.mouseY>62) {ICEcoder.setTabWidths();}; + this.dragCursorTest(); + if (this.mouseY>62) {this.setTabWidths();}; }, // Test if we need to show a drag cursor or not @@ -2887,26 +2893,26 @@ var ICEcoder = { var diffX, winH, cursorName, zone; // Dragging tabs, started after dragging for 10px from origin - diffX = ICEcoder.mouseX - ICEcoder.diffStartX; - if (ICEcoder.draggingTab!==false && ICEcoder.diffStartX && (diffX <= -10 || diffX >= 10)) { - if (ICEcoder.mouseX > parseInt(ICEcoder.files.style.width,10)) { - ICEcoder.tabDragMouseX = ICEcoder.mouseX - parseInt(ICEcoder.files.style.width,10) - ICEcoder.tabDragMouseXStart; - ICEcoder.tabDragMove(); + diffX = this.mouseX - this.diffStartX; + if (this.draggingTab!==false && this.diffStartX && (diffX <= -10 || diffX >= 10)) { + if (this.mouseX > parseInt(this.files.style.width,10)) { + this.tabDragMouseX = this.mouseX - parseInt(this.files.style.width,10) - this.tabDragMouseXStart; + this.tabDragMove(); } } // Dragging file manager, possible within 7px of file manager edge - if (ICEcoder.ready) { + if (this.ready) { winH = window.innerHeight; - if (!ICEcoder.mouseDown) {ICEcoder.draggingFilesW = false}; + if (!this.mouseDown) {this.draggingFilesW = false}; - cursorName = (!ICEcoder.draggingTab && ((ICEcoder.mouseX > ICEcoder.filesW-7 && ICEcoder.mouseX < ICEcoder.filesW+7) || ICEcoder.draggingFilesW)) + cursorName = (!this.draggingTab && ((this.mouseX > this.filesW-7 && this.mouseX < this.filesW+7) || this.draggingFilesW)) ? "w-resize" : "auto"; - if (ICEcoder.content.contentWindow.document && ICEcoder.filesFrame.contentWindow) { + if (this.content.contentWindow.document && this.filesFrame.contentWindow) { document.body.style.cursor = cursorName; - if (zone = ICEcoder.content.contentWindow.document.body) {zone.style.cursor = cursorName}; - if (zone = ICEcoder.filesFrame.contentWindow.document.body) {zone.style.cursor = cursorName}; + if (zone = this.content.contentWindow.document.body) {zone.style.cursor = cursorName}; + if (zone = this.filesFrame.contentWindow.document.body) {zone.style.cursor = cursorName}; } } }, @@ -2917,7 +2923,7 @@ var ICEcoder = { serverMessage = parent.get('serverMessage'); if (message) { - serverMessage.innerHTML = ICEcoder.xssClean(message).replace(/\<b\>/g,"").replace(/\<\/b\>/g,"").replace(/\<br\>/g,"
      "); + serverMessage.innerHTML = this.xssClean(message).replace(/\<b\>/g,"").replace(/\<\/b\>/g,"").replace(/\<br\>/g,"
      "); serverMessage.style.left = "0"; } else { setTimeout(function() {serverMessage.style.left = "2000px";},200); @@ -2929,9 +2935,9 @@ var ICEcoder = { cssColorPreview: function() { var cM, cMdiff, thisCM, string, rx, match, oldBlock, newBlock; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (thisCM) { string = thisCM.getLine(thisCM.getCursor().line); @@ -2941,7 +2947,7 @@ var ICEcoder = { oldBlock = get('content').contentWindow.document.getElementById('cssColor'); if (oldBlock) {oldBlock.parentNode.removeChild(oldBlock)}; - if (ICEcoder.codeAssist && ICEcoder.caretLocType=="CSS") { + if (this.codeAssist && this.caretLocType=="CSS") { newBlock = document.createElement("div"); newBlock.id = "cssColor"; newBlock.style.position = "absolute"; @@ -2950,7 +2956,7 @@ var ICEcoder = { newBlock.style.zIndex = "1000"; newBlock.style.background = match ? match[0] : ''; newBlock.style.cursor = "pointer"; - newBlock.onclick = function() {ICEcoder.showColorPicker(match[0])}; + newBlock.onclick = function() {this.showColorPicker(match[0])}; if (newBlock.style.backgroundColor=="") {newBlock.style.display = "none"}; get('header').appendChild(newBlock); thisCM.addWidget(thisCM.getCursor(), get('cssColor'), true); @@ -2963,9 +2969,9 @@ var ICEcoder = { get('blackMask').style.visibility = "visible"; get('mediaContainer').innerHTML = '


      '+ ''+ - '
      '+ + '
      '+ ''+ - ''; + ''; farbtastic('picker','color'); if (color) { get('picker').farbtastic.setColor(color); @@ -3031,7 +3037,7 @@ var ICEcoder = { B = imgData[2]; rgb = R+','+G+','+B; // Get hex from RGB value - hex = ICEcoder.rgbToHex(R,G,B); + hex = this.rgbToHex(R,G,B); // set the values & BG colours of the input boxes get('rgbMouseXY').value = rgb; get('hexMouseXY').value = '#' + hex; @@ -3041,8 +3047,8 @@ var ICEcoder = { // Move the floating container to follow mouse pointer fcElem = get('floatingContainer'); - fcElem.style.left = ICEcoder.mouseX+20 + "px"; - fcElem.style.top = ICEcoder.mouseY + "px"; + fcElem.style.left = this.mouseX+20 + "px"; + fcElem.style.top = this.mouseY + "px"; // Move the background image for the container to match also // 5 x zoom, account for scaling down of large images and shift 25px of the hover div size // (55px is the 11x11 grid of pixels), minus 5px for centre row/col @@ -3062,7 +3068,7 @@ var ICEcoder = { // Convert RGB values to Hex rgbToHex: function(R,G,B) { - return ICEcoder.toHex(R)+ICEcoder.toHex(G)+ICEcoder.toHex(B); + return this.toHex(R)+this.toHex(G)+this.toHex(B); }, // Return numbers as hex equivalent @@ -3077,9 +3083,9 @@ var ICEcoder = { insertColorValue: function(color) { var cM, cMdiff, thisCM, cursor; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; cursor = thisCM.getTokenAt(thisCM.getCursor()); thisCM.replaceRange(color,{line:thisCM.getCursor().line,ch:cursor.start},{line:thisCM.getCursor().line,ch:1000000}); }, @@ -3098,7 +3104,7 @@ var ICEcoder = { var i; file = file.replace(/\|/g, "/").replace(docRoot+iceRoot,""); - i = ICEcoder.openFiles.indexOf(file); + i = this.openFiles.indexOf(file); // return the array position or false return i!=-1 ? i : false; }, @@ -3111,41 +3117,41 @@ var ICEcoder = { startPluginIntervals: function(plugRef,plugURL,plugTarget,plugTimer) { // Add CSRF to URL if it has QS params if (plugURL.indexOf("?") > -1) { - plugURL = plugURL+"&csrf="+ICEcoder.csrf; + plugURL = plugURL+"&csrf="+this.csrf; } - ICEcoder['plugTimer'+plugRef] = + this['plugTimer'+plugRef] = // This window instances ["_parent","_top","_self",""].indexOf(plugTarget) > -1 - ? ICEcoder['plugTimer'+plugRef] = setInterval('window.location=\''+plugURL+'\'',plugTimer*1000*60) + ? this['plugTimer'+plugRef] = setInterval('window.location=\''+plugURL+'\'',plugTimer*1000*60) // fileControl iframe instances : plugTarget.indexOf("fileControl") == 0 - ? ICEcoder['plugTimer'+plugRef] = setInterval(function() { - ICEcoder.serverQueue("add",plugURL);ICEcoder.serverMessage(plugTarget.split(":")[1]); - },plugTimer*1000*60) + ? this['plugTimer'+plugRef] = setInterval(function(ic) { + ic.serverQueue("add",plugURL);ic.serverMessage(plugTarget.split(":")[1]); + },plugTimer*1000*60,this) // _blank or named target window instances - : ICEcoder['plugTimer'+plugRef] = setInterval('window.open(\''+plugURL+'\',\''+plugTarget+'\')',plugTimer*1000*60); + : this['plugTimer'+plugRef] = setInterval('window.open(\''+plugURL+'\',\''+plugTarget+'\')',plugTimer*1000*60); // push the plugin ref into our array - ICEcoder.pluginIntervalRefs.push(plugRef); + this.pluginIntervalRefs.push(plugRef); }, // Turning on/off the Code Assist codeAssistToggle: function() { var cM, cMdiff, fileName, fileExt; - ICEcoder.codeAssist = !ICEcoder.codeAssist; - get('codeAssistDisplay').style.backgroundPosition = ICEcoder.codeAssist ? "0 0" : "-16px 0"; - ICEcoder.cssColorPreview(); - ICEcoder.focus(ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? 'diff' : false); + this.codeAssist = !this.codeAssist; + get('codeAssistDisplay').style.backgroundPosition = this.codeAssist ? "0 0" : "-16px 0"; + this.cssColorPreview(); + this.focus(this.editorFocusInstance.indexOf('diff') > -1 ? 'diff' : false); - for (i=0;i0) { + for (var i=0;i0) { nextSaveID++; } } nextSaveID++; - // Add to end of array or remove from beginning on demand, plus add or remove if necessary if (action=="add") { - ICEcoder.serverQueueItems.push(item); + this.serverQueueItems.push(item); if (item.indexOf('action=save')>0) { txtArea = document.createElement('textarea'); txtArea.setAttribute('id', 'saveTemp'+nextSaveID); @@ -3196,7 +3200,8 @@ var ICEcoder = { } } } else if (action=="del") { - if (ICEcoder.serverQueueItems[0] && ICEcoder.serverQueueItems[0].indexOf('action=save')>0) { + // console.log(this); + if (this.serverQueueItems[0] && this.serverQueueItems[0].indexOf('action=save')>0) { topSaveID = nextSaveID-1; for (var i=1;i=1 || ICEcoder.serverQueueItems.length==1) { + if (action=="del" && this.serverQueueItems.length>=1 || this.serverQueueItems.length==1) { // If we have an item, we're not saving previous file refs and not loading if (item && (item.indexOf('saveFiles=')==-1 && item.indexOf('action=load')==-1)) { - xhr = ICEcoder.xhrObj(); + xhr = this.xhrObj(); xhr.onreadystatechange=function() { if (xhr.readyState==4) { // OK reponse? @@ -3225,34 +3230,34 @@ var ICEcoder = { statusObj.action.timeTaken = statusObj.action.timeEnd - statusObj.action.timeStart; // User wanted raw (or both) output of the response? - if (["raw","both"].indexOf(ICEcoder.fileDirResOutput) >= 0) { + if (["raw","both"].indexOf(this.fileDirResOutput) >= 0) { console.log(xhr.responseText); } // User wanted object (or both) output of the response? - if (["object","both"].indexOf(ICEcoder.fileDirResOutput) >= 0) { + if (["object","both"].indexOf(this.fileDirResOutput) >= 0) { console.log(statusObj); } // If error, show that, otherwise do whatever we're required to do next if (statusObj.status.error) { - ICEcoder.message(statusObj.status.errorMsg); + this.message(statusObj.status.errorMsg); console.log("ICEcoder error info for your request..."); console.log(statusObj); - ICEcoder.serverMessage(); - ICEcoder.serverQueue('del',0); + this.serverMessage(); + this.serverQueue('del',0); } else { eval(statusObj.action.doNext); } // Some other response? Display a message about that } else { - ICEcoder.message(t['Sorry there was...']); + this.message(t['Sorry there was...']); console.log("ICEcoder error info for your request..."); console.log(statusObj); - ICEcoder.serverMessage(); - ICEcoder.serverQueue('del',0); + this.serverMessage(); + this.serverQueue('del',0); } } }; - xhr.open("POST",ICEcoder.serverQueueItems[0],true); + xhr.open("POST",this.serverQueueItems[0],true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); timeStart = new Date().getTime(); @@ -3268,11 +3273,11 @@ var ICEcoder = { } } else { - setTimeout(function() { - if ("undefined" != typeof ICEcoder.serverQueueItems[0]) { - ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href=ICEcoder.serverQueueItems[0]; + setTimeout(function(ic) { + if ("undefined" != typeof ic.serverQueueItems[0]) { + ic.filesFrame.contentWindow.frames['fileControl'].location.href=ic.serverQueueItems[0]; } - },1); + },1,this); } } @@ -3282,23 +3287,23 @@ var ICEcoder = { cancelAllActions: function() { // Stop whatever the parent may be loading and clear tasks other than the current one window.stop(); - if (ICEcoder.serverQueueItems.length>0) { - ICEcoder.serverQueueItems.splice(1,ICEcoder.serverQueueItems.length); + if (this.serverQueueItems.length>0) { + this.serverQueueItems.splice(1,this.serverQueueItems.length); } - ICEcoder.showHide('hide',get('loadingMask')); - ICEcoder.serverMessage(''+t['Cancelled tasks']+''); - setTimeout(function() {ICEcoder.serverMessage();},2000); + this.showHide('hide',get('loadingMask')); + this.serverMessage(''+t['Cancelled tasks']+''); + setTimeout(function(ic) {ic.serverMessage();},2000,this); }, // Set the current previousFiles in the settings file setPreviousFiles: function() { var previousFiles; - previousFiles = ICEcoder.openFiles.join(',').replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,""); + previousFiles = this.openFiles.join(',').replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,""); if (previousFiles=="") {previousFiles="CLEAR"}; // Then send through to the settings page to update setting - ICEcoder.serverQueue("add",iceLoc+"/lib/settings.php?saveFiles="+encodeURIComponent(previousFiles)+"&csrf="+ICEcoder.csrf); - ICEcoder.updateLast10List(previousFiles); + this.serverQueue("add",iceLoc+"/lib/settings.php?saveFiles="+encodeURIComponent(previousFiles)+"&csrf="+this.csrf); + this.updateLast10List(previousFiles); }, // Update the list of 10 previous files in browser @@ -3311,10 +3316,10 @@ 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 = ICEcoder.content.contentWindow.document.getElementById('last10Files'); + last10Files = this.content.contentWindow.document.getElementById('last10Files'); // If the innerHTML of that doesn't contain our new item, we can insert it if(last10Files.innerHTML.indexOf(newFile) == -1) { @@ -3336,11 +3341,11 @@ var ICEcoder = { // Opens the last files we had open autoOpenFiles: function() { - if (ICEcoder.previousFiles.length>0 && ICEcoder.ask(t['Open previous files']+'\n\n'+ICEcoder.previousFiles.length+' files:\n'+ICEcoder.previousFiles.join('\n').replace(/\|/g,"/").replace(new RegExp(docRoot+iceRoot,'gi'),""))) { - for (var i=0;i0 && 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'; } - ICEcoder.showHide(hide?'hide':'show',get('blackMask')); + this.showHide(hide?'hide':'show',get('blackMask')); }, // Show the help screen helpScreen: function() { get('mediaContainer').innerHTML = ''; - ICEcoder.showHide('show',get('blackMask')); + this.showHide('show',get('blackMask')); }, // Show the backup versions screen versionsScreen: function(file,versions) { - get('mediaContainer').innerHTML = ''; - ICEcoder.showHide('show',get('blackMask')); + get('mediaContainer').innerHTML = ''; + this.showHide('show',get('blackMask')); }, // Show the ICEcoder manual, loaded remotely @@ -3370,43 +3375,43 @@ var ICEcoder = { var sectionExtra; sectionExtra = section ? "#"+section : ""; - get('mediaContainer').innerHTML = ''; - ICEcoder.showHide('show',get('blackMask')); + get('mediaContainer').innerHTML = ''; + this.showHide('show',get('blackMask')); }, // Show the properties screen propertiesScreen: function(fileName) { - get('mediaContainer').innerHTML = ''; - ICEcoder.showHide('show',get('blackMask')); + get('mediaContainer').innerHTML = ''; + this.showHide('show',get('blackMask')); }, // Show the auto-logout warning screen autoLogoutWarningScreen: function() { get('mediaContainer').innerHTML = ''; - ICEcoder.showHide('show',get('blackMask')); + this.showHide('show',get('blackMask')); }, // Show the plugins manager pluginsManager: function() { get('mediaContainer').innerHTML = ''; - ICEcoder.showHide('show',get('blackMask')); + this.showHide('show',get('blackMask')); }, // Go to localhost root goLocalhostRoot: function() { - ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/go-localhost-root.php"; + this.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/go-localhost-root.php"; }, // Show the GitHub commit screen githubAction: function(action) { - get('mediaContainer').innerHTML = ''; - ICEcoder.showHide('show',get('blackMask')); + get('mediaContainer').innerHTML = ''; + this.showHide('show',get('blackMask')); }, // Ask user for GitHub token githubTokenAsk: function(goNext) { - if (githubAuthToken = ICEcoder.getInput(t['Please enter your...'],'')) { - ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/github.php?action=auth&token="+githubAuthToken+"&goNext="+goNext+"&csrf="+ICEcoder.csrf; + if (githubAuthToken = this.getInput(t['Please enter your...'],'')) { + this.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/github.php?action=auth&token="+githubAuthToken+"&goNext="+goNext+"&csrf="+this.csrf; // Clear the token from the var for security githubAuthToken = ""; } @@ -3421,11 +3426,11 @@ var ICEcoder = { // Show the GitHub manager githubManager: function() { var githubAuthToken; - if (ICEcoder.githubAuthTokenSet) { + if (this.githubAuthTokenSet) { get('mediaContainer').innerHTML = ''; - ICEcoder.showHide('show',get('blackMask')); + this.showHide('show',get('blackMask')); } else { - ICEcoder.githubTokenAsk('showManager'); + this.githubTokenAsk('showManager'); } }, @@ -3433,20 +3438,20 @@ var ICEcoder = { githubDiffToggle: function() { var gHDiff; - if (!ICEcoder.githubAuthTokenSet) { - ICEcoder.githubTokenAsk('loadFiles'); - } else if (ICEcoder.githubDiff || ICEcoder.ask(t['This will compare...'])) { - ICEcoder.githubDiff = !ICEcoder.githubDiff; - gHDiff = ICEcoder.githubDiff ? "true" : "false"; + if (!this.githubAuthTokenSet) { + this.githubTokenAsk('loadFiles'); + } else if (this.githubDiff || this.ask(t['This will compare...'])) { + this.githubDiff = !this.githubDiff; + gHDiff = this.githubDiff ? "true" : "false"; - ICEcoder.filesFrame.src = "files.php?githubDiff="+gHDiff+"&csrf="+ICEcoder.csrf; + this.filesFrame.src = "files.php?githubDiff="+gHDiff+"&csrf="+this.csrf; } }, // Show the FTP manager ftpManager: function() { get('mediaContainer').innerHTML = ''; - ICEcoder.showHide('show',get('blackMask')); + this.showHide('show',get('blackMask')); }, // Update the settings used when we make a change to them @@ -3458,42 +3463,42 @@ var ICEcoder = { // find out new theme name without leading path and trailing ".css" var newTheme = cleanThemeUrl.slice(cleanThemeUrl.lastIndexOf("/")+1,cleanThemeUrl.lastIndexOf(".")); // if theme was not changed - no need to do all these tricks - if (ICEcoder.theme !== newTheme){ + if (this.theme !== newTheme){ // Add new stylesheet for selected theme to editor - ICEcoder.theme = newTheme; - if (ICEcoder.theme=="editor") {ICEcoder.theme="icecoder"}; + this.theme = newTheme; + if (this.theme=="editor") {this.theme="icecoder"}; styleNode = document.createElement('link'); styleNode.setAttribute('rel', 'stylesheet'); styleNode.setAttribute('type', 'text/css'); styleNode.setAttribute('href', themeURL); - ICEcoder.content.contentWindow.document.getElementsByTagName('head')[0].appendChild(styleNode); + this.content.contentWindow.document.getElementsByTagName('head')[0].appendChild(styleNode); // Add new stylesheet for selected theme to top level (used by Minimap) styleNode = document.createElement('link'); styleNode.setAttribute('rel', 'stylesheet'); styleNode.setAttribute('type', 'text/css'); styleNode.setAttribute('href', themeURL); document.getElementsByTagName('head')[0].appendChild(styleNode); - if (["3024-day","base16-light","eclipse","elegant","mdn-like","neat","neo","paraiso-light","solarized","the-matrix","xq-light"].indexOf(ICEcoder.theme)>-1) { + if (["3024-day","base16-light","eclipse","elegant","mdn-like","neat","neo","paraiso-light","solarized","the-matrix","xq-light"].indexOf(this.theme)>-1) { activeLineBG = "#ccc"; - } else if (["3024-night","blackboard","colorforth","liquibyte","night","tomorrow-night-bright","tomorrow-night-eighties","vibrant-ink"].indexOf(ICEcoder.theme)>-1) { + } else if (["3024-night","blackboard","colorforth","liquibyte","night","tomorrow-night-bright","tomorrow-night-eighties","vibrant-ink"].indexOf(this.theme)>-1) { activeLineBG = "#888"; } else { activeLineBG = "#000"; } - ICEcoder.switchTab(ICEcoder.selectedTab); + this.switchTab(this.selectedTab); } // Check/uncheck Code Assist setting - if (codeAssist != ICEcoder.codeAssist) { + if (codeAssist != this.codeAssist) { get('codeAssist').checked = codeAssist; - ICEcoder.codeAssistToggle(); + this.codeAssistToggle(); } // Unlock/lock the file manager - if (lockedNav != ICEcoder.lockedNav) { - ICEcoder.lockUnlockNav(); - ICEcoder.changeFilesW(!lockedNav ? 'contract' : 'expand'); - ICEcoder.hideFileMenu(); + if (lockedNav != this.lockedNav) { + this.lockUnlockNav(); + this.changeFilesW(!lockedNav ? 'contract' : 'expand'); + this.hideFileMenu(); }; // Update font size at top level @@ -3502,97 +3507,97 @@ var ICEcoder = { thisCSS[strCSS][0].style['fontSize'] = fontSize; // Update font size in file manager - thisCSS = ICEcoder.filesFrame.contentWindow.document.styleSheets[3]; + thisCSS = this.filesFrame.contentWindow.document.styleSheets[3]; strCSS = thisCSS.rules ? 'rules' : 'cssRules'; thisCSS[strCSS][0].style['fontSize'] = fontSize; // Update styles in editor - thisCSS = ICEcoder.content.contentWindow.document.styleSheets[6]; + thisCSS = this.content.contentWindow.document.styleSheets[6]; strCSS = thisCSS.rules ? 'rules' : 'cssRules'; thisCSS[strCSS][0].style['fontSize'] = fontSize; thisCSS[strCSS][4].style['border-left-width'] = visibleTabs ? '1px' : '0'; thisCSS[strCSS][4].style['margin-left'] = visibleTabs ? '-1px' : '0'; thisCSS[strCSS][2].style.cssText = "background-color: " + activeLineBG + " !important"; - ICEcoder.lineWrapping = lineWrapping; - ICEcoder.lineNumbers = lineNumbers; - ICEcoder.showTrailingSpace = showTrailingSpace; - ICEcoder.matchBrackets = matchBrackets; - ICEcoder.autoCloseTags = autoCloseTags; - ICEcoder.autoCloseBrackets = autoCloseBrackets; - ICEcoder.indentWithTabs = indentWithTabs; - ICEcoder.indentSize = indentSize; - ICEcoder.indentAuto = indentAuto; - for (var i=0;ichMod '+perms+' on
      '+file.replace(/\|/g,"/")); + this.showHide('hide',get('blackMask')); + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=perms&perms="+perms+"&csrf="+this.csrf,encodeURIComponent(file)); + this.serverMessage('chMod '+perms+' on
      '+file.replace(/\|/g,"/")); }, // Open/show the preview window openPreviewWindow: function() { - if (ICEcoder.openFiles.length>0) { + if (this.openFiles.length>0) { var cM, cMdiff, thisCM, filepath, filename, fileExt; - filepath = ICEcoder.openFiles[ICEcoder.selectedTab-1]; + filepath = this.openFiles[this.selectedTab-1]; filename = filepath.substr(filepath.lastIndexOf("/")+1); fileExt = filename.substr(filename.lastIndexOf(".")+1); - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - ICEcoder.previewWindowLoading = true; - ICEcoder.previewWindow = window.open(filepath,"previewWindow",500,500); + this.previewWindowLoading = true; + this.previewWindow = window.open(filepath,"previewWindow",500,500); if (["md"].indexOf(fileExt) > -1) { - ICEcoder.previewWindow.onload = function() { - ICEcoder.previewWindowLoading = false; - ICEcoder.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()) + this.previewWindow.onload = function() { + this.previewWindowLoading = false; + this.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()) }; } else { - ICEcoder.previewWindow.onload = function() { - ICEcoder.previewWindowLoading = false; + this.previewWindow.onload = function() { + this.previewWindowLoading = false; // Do the pesticide plugin if it exists - try {ICEcoder.doPesticide();} catch(err) {}; + try {this.doPesticide();} catch(err) {}; // Do the stats.js plugin if it exists - try {ICEcoder.doStatsJS('open');} catch(err) {}; + try {this.doStatsJS('open');} catch(err) {}; // Do the responsive plugin if it exists - try {ICEcoder.doResponsive();} catch(err) {}; + try {this.doResponsive();} catch(err) {}; } } } @@ -3665,20 +3670,20 @@ var ICEcoder = { // Reset auto-logout timer resetAutoLogoutTimer: function() { - if(ICEcoder.autoLogoutMins > 1 && ICEcoder.autoLogoutTimer > (ICEcoder.autoLogoutMins*60)-60) { - ICEcoder.showHide('hide',get('blackMask')); + if(this.autoLogoutMins > 1 && this.autoLogoutTimer > (this.autoLogoutMins*60)-60) { + this.showHide('hide',get('blackMask')); } - ICEcoder.autoLogoutTimer = 0; + this.autoLogoutTimer = 0; }, // Logout of ICEcoder logout: function(type) { - window.location = window.location + "?logout&"+(type ? "type="+type+"&" : "")+"csrf="+ICEcoder.csrf; + window.location = window.location + "?logout&"+(type ? "type="+type+"&" : "")+"csrf="+this.csrf; }, // Show a message outputMsg: function(msg) { - ICEcoder.output.innerHTML += msg + "
      "; + this.output.innerHTML += msg + "
      "; }, // Show a message @@ -3700,7 +3705,7 @@ var ICEcoder = { dataMessage: function(message) { var dM; - dM = ICEcoder.content.contentWindow.document.getElementById('dataMessage'); + dM = this.content.contentWindow.document.getElementById('dataMessage'); dM.style.display = "block"; dM.innerHTML = message; }, @@ -3711,18 +3716,18 @@ var ICEcoder = { autoUpdate = confirm(t['Please note for...']); if (autoUpdate) { - ICEcoder.showHide('show',get('loadingMask')); + this.showHide('show',get('loadingMask')); window.location = iceLoc+"/lib/updater.php"; } else { - window.open("https://icecoder.net"); + window.open("https://this.net"); } }, // ICEcoder just updated updated: function() { get('blackMask').style.visibility = "visible"; - get('mediaContainer').innerHTML = '

      Thanks for updating to v'+ICEcoder.versionNo+'!

      ' - + '

      Click anywhere to continue using ICEcoder...

      '; + get('mediaContainer').innerHTML = '

      Thanks for updating to v'+this.versionNo+'!

      ' + + '

      Click anywhere to continue using this...

      '; }, // XHR object @@ -3740,23 +3745,23 @@ var ICEcoder = { openBugReport: function() { var bugReportOpenFilePos; - if(ICEcoder.bugReportStatus=="off") { - ICEcoder.message(t['You can start...']); + if(this.bugReportStatus=="off") { + this.message(t['You can start...']); } - if(ICEcoder.bugReportStatus=="error") { - ICEcoder.message(t['Error cannot find...']); + if(this.bugReportStatus=="error") { + this.message(t['Error cannot find...']); } - if(ICEcoder.bugReportStatus=="ok") { - ICEcoder.message(t['No new errors...']); + if(this.bugReportStatus=="ok") { + this.message(t['No new errors...']); } - if(ICEcoder.bugReportStatus=="bugs") { + if(this.bugReportStatus=="bugs") { // Close bug-report without saving previousFiles and without confirming close if we made changes on the bug report - var bugReportOpenFilePos = ICEcoder.openFiles.indexOf(ICEcoder.bugReportPath.replace(/\|/g,"/")); + var bugReportOpenFilePos = this.openFiles.indexOf(this.bugReportPath.replace(/\|/g,"/")); if (bugReportOpenFilePos > -1) { - ICEcoder.closeTab(bugReportOpenFilePos+1,'dontSetPV','dontAsk'); + this.closeTab(bugReportOpenFilePos+1,'dontSetPV','dontAsk'); } - ICEcoder.openFile(ICEcoder.bugReportPath); - ICEcoder.bugFilesSizesSeen = ICEcoder.bugFilesSizesActual; + this.openFile(this.bugReportPath); + this.bugFilesSizesSeen = this.bugFilesSizesActual; } }, @@ -3764,28 +3769,28 @@ var ICEcoder = { startBugChecking: function() { var bugCheckURL; - if (ICEcoder.bugFileCheckTimer !== 0) { + if (this.bugFileCheckTimer !== 0) { // Clear any existing interval - if ("undefined" != typeof ICEcoder.bugFileCheckInt) { - clearInterval(ICEcoder.bugFileCheckInt); + if ("undefined" != typeof this.bugFileCheckInt) { + clearInterval(this.bugFileCheckInt); } // Start a new timer - ICEcoder.bugFilesSizesSeen = []; - ICEcoder.bugFileCheckInt = setInterval(function() { + this.bugFilesSizesSeen = []; + this.bugFileCheckInt = setInterval(function(ic) { bugCheckURL = iceLoc+"/lib/bug-files-check.php?"; - bugCheckURL += "files="+(ICEcoder.bugFilePaths[0] !== "" ? ICEcoder.bugFilePaths.join() : "null").replace(/\//g,"|"); + bugCheckURL += "files="+(ic.bugFilePaths[0] !== "" ? ic.bugFilePaths.join() : "null").replace(/\//g,"|"); bugCheckURL += "&filesSizesSeen="; - if (ICEcoder.bugFilesSizesSeen.length != ICEcoder.bugFilePaths.length) { + if (ic.bugFilesSizesSeen.length != ic.bugFilePaths.length) { // Fill the array with nulls - for (var i=0; i -1 ? cMdiff : cM; - printIFrame = ICEcoder.filesFrame.contentWindow.frames['fileControl']; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + printIFrame = this.filesFrame.contentWindow.frames['fileControl']; // Print page content injected into iFrame, escaped with pre and xssClean - printIFrame.window.document.body.innerHTML = 'ICEcoder code output
      '+ICEcoder.xssClean(thisCM.getValue())+'
      '; + printIFrame.window.document.body.innerHTML = 'ICEcoder code output
      '+this.xssClean(thisCM.getValue())+'
      '; printIFrame.focus(); printIFrame.print(); // Focus back on code @@ -3851,10 +3856,10 @@ var ICEcoder = { indicateChanges: function() { var winTitle; - if (!ICEcoder.loadingFile) { - winTitle = "ICEcoder v "+ICEcoder.versionNo; - for(var i=1;i<=ICEcoder.savedPoints.length;i++) { - if (ICEcoder.savedPoints[i-1]!=ICEcoder.getcMInstance(i).changeGeneration()) { + if (!this.loadingFile) { + winTitle = "ICEcoder v "+this.versionNo; + for(var i=1;i<=this.savedPoints.length;i++) { + if (this.savedPoints[i-1]!=this.getcMInstance(i).changeGeneration()) { // We have an unsaved tab, indicate that in the title winTitle += " \u2744"; break; @@ -3873,67 +3878,67 @@ var ICEcoder = { var cM, cMdiff, thisCM; // If we're not switching to same tab (for some reason), note the previous tab - if (newTab !== ICEcoder.selectedTab) { - ICEcoder.prevTab = ICEcoder.selectedTab; + if (newTab !== this.selectedTab) { + this.prevTab = this.selectedTab; } // Identify tab that's currently selected & get the instance - ICEcoder.selectedTab = newTab; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + this.selectedTab = newTab; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (thisCM) { // Switch mode to HTML, PHP, CSS etc - ICEcoder.switchMode(); + this.switchMode(); // Set all cM instances to be hidden, then make our selected instance visible - for (var i=0;i'; - get('tab'+(ICEcoder.openFiles.length)).style.display = "inline-block"; - fileName = ICEcoder.openFiles[ICEcoder.openFiles.length-1]; - get('tab'+(ICEcoder.openFiles.length)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); - get('tab'+(ICEcoder.openFiles.length)).title = "/" + ICEcoder.openFiles[ICEcoder.openFiles.length-1].replace(/\//,""); + closeTabLink = ''; + get('tab'+(this.openFiles.length)).style.display = "inline-block"; + fileName = this.openFiles[this.openFiles.length-1]; + get('tab'+(this.openFiles.length)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); + get('tab'+(this.openFiles.length)).title = "/" + this.openFiles[this.openFiles.length-1].replace(/\//,""); // Set the widths - ICEcoder.setTabWidths(); + this.setTabWidths(); // Highlight it and state it's selected - ICEcoder.redoTabHighlight(ICEcoder.openFiles.length); - ICEcoder.selectedTab=ICEcoder.openFiles.length; + this.redoTabHighlight(this.openFiles.length); + this.selectedTab=this.openFiles.length; // Add a new value ready to indicate if this content has been changed - ICEcoder.savedPoints.push(0); - ICEcoder.savedContents.push(""); + this.savedPoints.push(0); + this.savedContents.push(""); if (!isNew) { - ICEcoder.setPreviousFiles(); + this.setPreviousFiles(); } }, @@ -3998,16 +4003,16 @@ var ICEcoder = { nextTab: function() { var goToTab; - goToTab = ICEcoder.selectedTab+1 <= ICEcoder.openFiles.length ? ICEcoder.selectedTab+1 : 1; - ICEcoder.switchTab(goToTab,'noFocus'); + goToTab = this.selectedTab+1 <= this.openFiles.length ? this.selectedTab+1 : 1; + this.switchTab(goToTab,'noFocus'); }, // Cycle to next tab previousTab: function() { var goToTab; - goToTab = ICEcoder.selectedTab-1 >= 1 ? ICEcoder.selectedTab-1 : ICEcoder.openFiles.length; - ICEcoder.switchTab(goToTab,'noFocus'); + goToTab = this.selectedTab-1 >= 1 ? this.selectedTab-1 : this.openFiles.length; + this.switchTab(goToTab,'noFocus'); }, // Create a new tab for a file @@ -4015,35 +4020,35 @@ var ICEcoder = { var closeTabLink, fileName; // Push new file into array - ICEcoder.openFiles[tabNum-1] = newName; + this.openFiles[tabNum-1] = newName; // Setup a new tab - closeTabLink = ''; - fileName = ICEcoder.openFiles[tabNum-1]; + closeTabLink = ''; + fileName = this.openFiles[tabNum-1]; get('tab'+tabNum).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); - get('tab'+tabNum).title = "/" + ICEcoder.openFiles[tabNum-1].replace(/\//,""); + get('tab'+tabNum).title = "/" + this.openFiles[tabNum-1].replace(/\//,""); }, // Reset all tabs to be without a highlight and then highlight the selected redoTabHighlight: function(selectedTab) { var tColor, fileLink; - for(var i=1;i<=ICEcoder.savedPoints.length;i++) { + for(var i=1;i<=this.savedPoints.length;i++) { if (get('tab'+i).childNodes[0]) { - get('tab'+i).childNodes[0].childNodes[0].style.backgroundColor = ICEcoder.savedPoints[i-1]!=ICEcoder.getcMInstance(i).changeGeneration() + get('tab'+i).childNodes[0].childNodes[0].style.backgroundColor = this.savedPoints[i-1]!=this.getcMInstance(i).changeGeneration() ? "#b00" : "transparent"; } - tColor = i==selectedTab ? ICEcoder.tabFGselected : ICEcoder.tabFGnormalTab; - if ("undefined" != typeof ICEcoder.openFiles[i-1] && ICEcoder.openFiles[i-1] != "/[NEW]") { - fileLink = ICEcoder.filesFrame.contentWindow.document.getElementById(ICEcoder.openFiles[i-1].replace(/\//g,"|")); + tColor = i==selectedTab ? this.tabFGselected : this.tabFGnormalTab; + if ("undefined" != typeof this.openFiles[i-1] && this.openFiles[i-1] != "/[NEW]") { + fileLink = this.filesFrame.contentWindow.document.getElementById(this.openFiles[i-1].replace(/\//g,"|")); if (fileLink) { - fileLink.style.backgroundColor = i==selectedTab ? ICEcoder.tabBGcurrent : ICEcoder.tabBGopen; - fileLink.style.color = i==selectedTab ? ICEcoder.tabFGcurrent : ICEcoder.tabFGopenFile; + fileLink.style.backgroundColor = i==selectedTab ? this.tabBGcurrent : this.tabBGopen; + fileLink.style.color = i==selectedTab ? this.tabFGcurrent : this.tabFGopenFile; }; } get('tab'+i).style.color = tColor; - get('tab'+i).style.background = i==selectedTab ? ICEcoder.tabBGcurrent : ICEcoder.tabBGopen; + get('tab'+i).style.background = i==selectedTab ? this.tabBGcurrent : this.tabBGopen; } }, @@ -4052,103 +4057,103 @@ var ICEcoder = { var cM, cMdiff, thisCM, okToRemove, closeFileName; // If we haven't specified, close current tab - if (!closeTabNum) {closeTabNum = ICEcoder.selectedTab}; + if (!closeTabNum) {closeTabNum = this.selectedTab}; - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); okToRemove = true; - if (!dontAsk && ICEcoder.savedPoints[closeTabNum-1]!=ICEcoder.getcMInstance(closeTabNum).changeGeneration()) { - okToRemove = ICEcoder.ask(t['You have made...']); + if (!dontAsk && this.savedPoints[closeTabNum-1]!=this.getcMInstance(closeTabNum).changeGeneration()) { + okToRemove = this.ask(t['You have made...']); } if (okToRemove) { // Get the filename of tab we're closing - closeFileName = ICEcoder.openFiles[closeTabNum-1]; + closeFileName = this.openFiles[closeTabNum-1]; // recursively copy over all tabs & data from the tab to the right, if there is one - for (var i=closeTabNum;i0 ? ICEcoder.selectedTab-=1 : ICEcoder.selectedTab = 0; + if (this.selectedTab==closeTabNum) { + this.openFiles.length>0 ? this.selectedTab-=1 : this.selectedTab = 0; } - if (ICEcoder.openFiles.length>0 && ICEcoder.selectedTab==0) {ICEcoder.selectedTab=1}; + if (this.openFiles.length>0 && this.selectedTab==0) {this.selectedTab=1}; // grey out the view icon - if (ICEcoder.openFiles.length==0) { - ICEcoder.fMIconVis('fMView',0.3); + if (this.openFiles.length==0) { + this.fMIconVis('fMView',0.3); get('docExplorer').style.display = "none"; } else { // Switch the mode & the tab - ICEcoder.switchMode(); - ICEcoder.switchTab(ICEcoder.selectedTab); + this.switchMode(); + this.switchTab(this.selectedTab); } // Highlight the selected tab after splicing the change state out of the array - ICEcoder.savedPoints.splice(closeTabNum-1,1); - ICEcoder.savedContents.splice(closeTabNum-1,1); - ICEcoder.redoTabHighlight(ICEcoder.selectedTab); + this.savedPoints.splice(closeTabNum-1,1); + this.savedContents.splice(closeTabNum-1,1); + this.redoTabHighlight(this.selectedTab); // Remove any highlighting from the file manager - ICEcoder.selectDeselectFile('deselect',ICEcoder.filesFrame.contentWindow.document.getElementById(closeFileName.replace(/\//g,"|"))); + this.selectDeselectFile('deselect',this.filesFrame.contentWindow.document.getElementById(closeFileName.replace(/\//g,"|"))); if (!dontSetPV) { - ICEcoder.setPreviousFiles(); + this.setPreviousFiles(); } // Update the versions display - ICEcoder.updateVersionsDisplay(); + this.updateVersionsDisplay(); // Update the title tag to indicate any changes - ICEcoder.indicateChanges(); + this.indicateChanges(); } // Lastly, stop it from trying to also switch tab - ICEcoder.canSwitchTabs=false; + this.canSwitchTabs=false; // and set the widths - ICEcoder.setTabWidths('posOnlyNewTab'); - setTimeout(function() {ICEcoder.canSwitchTabs=true;},100); + this.setTabWidths('posOnlyNewTab'); + setTimeout(function(ic) {ic.canSwitchTabs=true;},100,this); }, // Close all tabs closeAllTabs: function() { - if (ICEcoder.cMInstances.length>0 && ICEcoder.ask(t['Close all tabs'])) { - for (var i=ICEcoder.cMInstances.length; i>0; i--) { - ICEcoder.closeTab(i, i>1? true:false); + if (this.cMInstances.length>0 && this.ask(t['Close all tabs'])) { + for (var i=this.cMInstances.length; i>0; i--) { + this.closeTab(i, i>1? true:false); } } // Update the title tag to indicate any changes - ICEcoder.indicateChanges(); + this.indicateChanges(); }, // Set the tabs width setTabWidths: function(posOnlyNewTab) { var availWidth, avgWidth, tabWidth, lastLeft, lastWidth; - if (ICEcoder.ready) { - availWidth = parseInt(ICEcoder.content.style.width,10)-53-22-10; // - left margin - new tab - right margin - avgWidth = (availWidth/ICEcoder.openFiles.length)-18; + if (this.ready) { + availWidth = parseInt(this.content.style.width,10)-53-22-10; // - left margin - new tab - right margin + avgWidth = (availWidth/this.openFiles.length)-18; tabWidth = -18; // Incl 18px offset lastLeft = 53; lastWidth = 0; - ICEcoder.tabLeftPos = []; - for (var i=0;i availWidth ? parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10) : 150; + this.tabLeftPos = []; + for (var i=0;i availWidth ? parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10) : 150; lastLeft = i==0 ? 53 : parseInt(get('tab'+(i)).style.left,10); lastWidth = i==0 ? 0 : parseInt(get('tab'+(i)).style.width,10)+18; if (!posOnlyNewTab) { @@ -4157,7 +4162,7 @@ var ICEcoder = { } else { tabWidth = -18; } - ICEcoder.tabLeftPos.push(lastLeft+lastWidth); + this.tabLeftPos.push(lastLeft+lastWidth); } get('newTab').style.left = (lastLeft+lastWidth+tabWidth+18) + "px"; } @@ -4165,13 +4170,13 @@ var ICEcoder = { // Tab dragging start tabDragStart: function(tab) { - ICEcoder.draggingTab = tab; - ICEcoder.diffStartX = ICEcoder.mouseX; - ICEcoder.tabDragMouseXStart = (ICEcoder.mouseX - (parseInt(ICEcoder.files.style.width,10)+53+18)) % 150; + this.draggingTab = tab; + this.diffStartX = this.mouseX; + this.tabDragMouseXStart = (this.mouseX - (parseInt(this.files.style.width,10)+53+18)) % 150; // Put tab we're dragging over others get('tab'+tab).style.zIndex = 2; // Set classes for other tabs (tabSlide) and the one we're dragging (tabDrag) - for (var i=1; i<=ICEcoder.openFiles.length; i++) { + for (var i=1; i<=this.openFiles.length; i++) { get('tab'+i).className = i!==tab ? "tab tabSlide" : "tab tabDrag"; @@ -4182,30 +4187,30 @@ var ICEcoder = { tabDragMove: function() { var lastTabWidth, thisLeft, dragTabNo, tabWidth; - lastTabWidth = parseInt(get('tab'+ICEcoder.openFiles.length).style.width,10)+18; + lastTabWidth = parseInt(get('tab'+this.openFiles.length).style.width,10)+18; // Set the left position but stay within left side (53) and new tab - ICEcoder.thisLeft = thisLeft = ICEcoder.tabDragMouseX >= 53 - ? ICEcoder.tabDragMouseX <= parseInt(get('newTab').style.left,10) - lastTabWidth - ? ICEcoder.tabDragMouseX : (parseInt(get('newTab').style.left,10) - lastTabWidth) : 53; + this.thisLeft = thisLeft = this.tabDragMouseX >= 53 + ? this.tabDragMouseX <= parseInt(get('newTab').style.left,10) - lastTabWidth + ? this.tabDragMouseX : (parseInt(get('newTab').style.left,10) - lastTabWidth) : 53; - get('tab'+ICEcoder.draggingTab).style.left = thisLeft + "px"; + get('tab'+this.draggingTab).style.left = thisLeft + "px"; - ICEcoder.dragTabNo = dragTabNo = ICEcoder.draggingTab; + this.dragTabNo = dragTabNo = this.draggingTab; // Set the opacities of tabs then positions of tabs we're not dragging - for (var i=1; i<=ICEcoder.openFiles.length; i++) { - get('tab'+i).style.opacity = i == ICEcoder.draggingTab ? 1 : 0.5; - tabWidth = ICEcoder.tabLeftPos[i] ? ICEcoder.tabLeftPos[i] - ICEcoder.tabLeftPos[i-1] : tabWidth; - if (i!=ICEcoder.draggingTab) { - if (i < ICEcoder.draggingTab) { - get('tab'+i).style.left = thisLeft <= ICEcoder.tabLeftPos[i-1] - ? ICEcoder.tabLeftPos[i-1]+tabWidth - : ICEcoder.tabLeftPos[i-1]; + for (var i=1; i<=this.openFiles.length; i++) { + get('tab'+i).style.opacity = i == this.draggingTab ? 1 : 0.5; + tabWidth = this.tabLeftPos[i] ? this.tabLeftPos[i] - this.tabLeftPos[i-1] : tabWidth; + if (i!=this.draggingTab) { + if (i < this.draggingTab) { + get('tab'+i).style.left = thisLeft <= this.tabLeftPos[i-1] + ? this.tabLeftPos[i-1]+tabWidth + : this.tabLeftPos[i-1]; } else { - get('tab'+i).style.left = thisLeft >= ICEcoder.tabLeftPos[i-1] - ? ICEcoder.tabLeftPos[i-1]-tabWidth - : ICEcoder.tabLeftPos[i-1]; + get('tab'+i).style.left = thisLeft >= this.tabLeftPos[i-1] + ? this.tabLeftPos[i-1]-tabWidth + : this.tabLeftPos[i-1]; } } } @@ -4216,15 +4221,15 @@ var ICEcoder = { var swapWith, tempArray; // Set the tab widths - ICEcoder.setTabWidths(); + this.setTabWidths(); // Determin what tabs we've swapped and reset classname, opacity & z-index for all - for (var i=1; i<=ICEcoder.openFiles.length; i++) { - if (ICEcoder.thisLeft >= ICEcoder.tabLeftPos[i-1]) { - swapWith = ICEcoder.thisLeft == ICEcoder.tabLeftPos[0] ? 1 : ICEcoder.dragTabNo > i ? i+1 : i; + for (var i=1; i<=this.openFiles.length; i++) { + if (this.thisLeft >= this.tabLeftPos[i-1]) { + swapWith = this.thisLeft == this.tabLeftPos[0] ? 1 : this.dragTabNo > i ? i+1 : i; } get('tab'+i).className = "tab"; get('tab'+i).style.opacity = 1; - if (i!=ICEcoder.dragTabNo) { + if (i!=this.dragTabNo) { get('tab'+i).style.zIndex = 1; } else { setTimeout(function() { @@ -4232,21 +4237,21 @@ var ICEcoder = { },150); } } - if (ICEcoder.thisLeft && ICEcoder.thisLeft!==false) { + if (this.thisLeft && this.thisLeft!==false) { // Make a number ascending array tempArray = []; - for (var i=1;i<=ICEcoder.openFiles.length;i++) { + for (var i=1;i<=this.openFiles.length;i++) { tempArray.push(i); } // Then swap our tab numbers - tempArray.splice(ICEcoder.dragTabNo-1,1); - tempArray.splice(swapWith-1,0,ICEcoder.dragTabNo); + tempArray.splice(this.dragTabNo-1,1); + tempArray.splice(swapWith-1,0,this.dragTabNo); // Now we have an order to sort against - ICEcoder.sortTabs(tempArray); + this.sortTabs(tempArray); } - ICEcoder.setTabWidths(); - ICEcoder.draggingTab = false; - ICEcoder.thisLeft = false; + this.setTabWidths(); + this.draggingTab = false; + this.thisLeft = false; }, // Sort tabs into new order @@ -4254,7 +4259,7 @@ var ICEcoder = { var a, b, savedPoints = [], savedContents = [], openFiles = [], openFileMDTs = [], openFileVersions = [], cMInstances = [], selectedTabWillBe; // Setup an array of our actual arrays and the blank ones - a = [ICEcoder.savedPoints, ICEcoder.savedContents, ICEcoder.openFiles, ICEcoder.openFileMDTs, ICEcoder.openFileVersions, ICEcoder.cMInstances]; + a = [this.savedPoints, this.savedContents, this.openFiles, this.openFileMDTs, this.openFileVersions, this.cMInstances]; b = [savedPoints, savedContents, openFiles, openFileMDTs, openFileVersions, cMInstances]; // Push the new order values into array b then set into array a for (var i=0;i0) { + if (this.openFiles.length>0) { var currentArray, currentArrayFull, alphaArray, nextValue, nextPos; currentArray = []; currentArrayFull = []; alphaArray = []; // Get filenames, full paths and set classname for sliding - for (var i=0;i startCG-5) { @@ -4355,45 +4360,45 @@ var ICEcoder = { undoCounts++; } // If we have content saved - if (ICEcoder.savedPoints[ICEcoder.selectedTab-1] == cM.changeGeneration()) { + if (ic.savedPoints[ic.selectedTab-1] == cM.changeGeneration()) { // Start snake game - ICEcoder.startSnake(); + ic.startSnake(); // If we don't, redo snake word } else { for (var i=1; i<=undoCounts; i++) { cM.redo(); } } - },0); + },0,this); } // Detect arrow keys if playing snake - if (ICEcoder.snakePlaying) { - if (key==37) {ICEcoder.snakeDir = 'left'} - if (key==39) {ICEcoder.snakeDir = 'right'} - if (key==38) {ICEcoder.snakeDir = 'up'} - if (key==40) {ICEcoder.snakeDir = 'down'} + if (this.snakePlaying) { + if (key==37) {this.snakeDir = 'left'} + if (key==39) {this.snakeDir = 'right'} + if (key==38) {this.snakeDir = 'up'} + if (key==40) {this.snakeDir = 'down'} return false; } // Mac command key handling (224 = Moz, 91/93 = Webkit Left/Right Apple) if (key==224 || key==91 || key==93) { - ICEcoder.cmdKey = true; + this.cmdKey = true; } // F1 (zoom code out non declaration lines) if (key === 112) { - if (ICEcoder.codeZoomedOut) { + if (this.codeZoomedOut) { return; } - ICEcoder.codeZoomedOut = true; + this.codeZoomedOut = true; - cM = ICEcoder.getcMInstance(); + cM = this.getcMInstance(); // For every line in the current editor, add code-zoomed-out class if not a function/class declaration line for (var i=0; i -1 ? true : false);return false;} + if (key==37) {this.filesFrame.contentWindow.focus();return false;} + else if (key==39) {this.focus(this.editorFocusInstance.indexOf('diff') > -1 ? true : false);return false;} else {return key;} // Alt+Enter (Insert Line After) } else if (key==13) { - ICEcoder.insertLineAfter(); + this.insertLineAfter(); return false; } else {return key;} @@ -4448,17 +4453,17 @@ var ICEcoder = { // Shift+Enter (Insert Line Before) if(key==13 && evt.shiftKey) { - ICEcoder.insertLineBefore(); + this.insertLineBefore(); return false; // CTRL/Cmd+F (Find next) // and // CTRL/Cmd+G (Find previous) - } else if((key==70||key==71) && (evt.ctrlKey||ICEcoder.cmdKey)) { + } else if((key==70||key==71) && (evt.ctrlKey||this.cmdKey)) { var find = get('find'); - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; var selections = thisCM.getSelections(); if (selections.length > 0){ if (selections[0].length > 0){ @@ -4477,12 +4482,12 @@ var ICEcoder = { get('findReplaceSubmit').click(); } else { // Find previous - ICEcoder.findReplace(document.getElementById('find').value,false,true,false,'findPrevious'); + this.findReplace(document.getElementById('find').value,false,true,false,'findPrevious'); } return false; // CTRL/Cmd+L (Go to line) - } else if(key==76 && (evt.ctrlKey||ICEcoder.cmdKey)) { + } else if(key==76 && (evt.ctrlKey||this.cmdKey)) { var goToLineInput = get('goToLineNo'); goToLineInput.select(); // this is trick for Chrome - after you have used Ctrl-F once, when @@ -4493,85 +4498,85 @@ var ICEcoder = { return false; // CTRL/Cmd+I (Get info) - } else if(key==73 && (evt.ctrlKey||ICEcoder.cmdKey) && area == "content") { - ICEcoder.searchForSelected(); + } else if(key==73 && (evt.ctrlKey||this.cmdKey) && area == "content") { + this.searchForSelected(); return false; // CTRL/Cmd+backspace arrow (Go to previous tab selected) - } else if(key==8 && (evt.ctrlKey||ICEcoder.cmdKey)) { - if (ICEcoder.prevTab !== 0) { - ICEcoder.switchTab(ICEcoder.prevTab); + } else if(key==8 && (evt.ctrlKey||this.cmdKey)) { + if (this.prevTab !== 0) { + this.switchTab(this.prevTab); } return false; // CTRL/Cmd+right arrow (Tab to right) - } else if(key==39 && (evt.ctrlKey||ICEcoder.cmdKey) && area!="content") { - ICEcoder.nextTab(); + } else if(key==39 && (evt.ctrlKey||this.cmdKey) && area!="content") { + this.nextTab(); return false; // CTRL/Cmd+left arrow (Tab to left) - } else if(key==37 && (evt.ctrlKey||ICEcoder.cmdKey) && area!="content") { - ICEcoder.previousTab(); + } else if(key==37 && (evt.ctrlKey||this.cmdKey) && area!="content") { + this.previousTab(); return false; // CTRL/Cmd+up arrow (Move line up) - } else if(key==38 && (evt.ctrlKey||ICEcoder.cmdKey) && area=="content") { - ICEcoder.moveLines('up'); + } else if(key==38 && (evt.ctrlKey||this.cmdKey) && area=="content") { + this.moveLines('up'); return false; // CTRL/Cmd+down arrow (Move line down) - } else if(key==40 && (evt.ctrlKey||ICEcoder.cmdKey) && area=="content") { - ICEcoder.moveLines('down'); + } else if(key==40 && (evt.ctrlKey||this.cmdKey) && area=="content") { + this.moveLines('down'); return false; // CTRL/Cmd+numeric plus (New tab) - } else if((key==107 || key==187) && (evt.ctrlKey||ICEcoder.cmdKey)) { + } else if((key==107 || key==187) && (evt.ctrlKey||this.cmdKey)) { area=="content" - ? ICEcoder.duplicateLines() - : ICEcoder.newTab(); + ? this.duplicateLines() + : this.newTab(); return false; // CTRL/Cmd+numeric minus (Close tab) - } else if((key==109 || key==189) && (evt.ctrlKey||ICEcoder.cmdKey)) { + } else if((key==109 || key==189) && (evt.ctrlKey||this.cmdKey)) { area=="content" - ? ICEcoder.removeLines() - : ICEcoder.closeTab(ICEcoder.selectedTab); + ? this.removeLines() + : this.closeTab(this.selectedTab); return false; // CTRL/Cmd+S (Save), CTRL/Cmd+Shift+S (Save As) - } else if(key==83 && (evt.ctrlKey||ICEcoder.cmdKey)) { + } else if(key==83 && (evt.ctrlKey||this.cmdKey)) { if(evt.shiftKey) { - ICEcoder.saveFile('saveAs'); + this.saveFile('saveAs'); } else { - ICEcoder.saveFile(); + this.saveFile(); } return false; // CTRL/Cmd+Enter (Open Webpage) - } else if(key==13 && (evt.ctrlKey||ICEcoder.cmdKey) && ICEcoder.openFiles[ICEcoder.selectedTab-1] != "/[NEW]") { - ICEcoder.resetKeys(evt); - window.open(ICEcoder.openFiles[ICEcoder.selectedTab-1]); + } else if(key==13 && (evt.ctrlKey||this.cmdKey) && this.openFiles[this.selectedTab-1] != "/[NEW]") { + this.resetKeys(evt); + window.open(this.openFiles[this.selectedTab-1]); return false; // Enter (Expand dir/open file) } else if(key==13 && area=="files") { - if(!evt.ctrlKey && !ICEcoder.cmdKey) { - if (ICEcoder.selectedFiles.length == 0) { - ICEcoder.overFileFolder('folder', '|'); - ICEcoder.selectFileFolder('init'); + if(!evt.ctrlKey && !this.cmdKey) { + if (this.selectedFiles.length == 0) { + this.overFileFolder('folder', '|'); + this.selectFileFolder('init'); } - ICEcoder.fmAction(evt,'enter'); + this.fmAction(evt,'enter'); } return false; // Up/down/left/right arrows (Traverse files) } else if((key==38||key==40||key==37||key==39) && area=="files") { - if(!evt.ctrlKey && !ICEcoder.cmdKey) { - if (ICEcoder.selectedFiles.length == 0) { - ICEcoder.overFileFolder('folder', '|'); - ICEcoder.selectFileFolder('init'); + if(!evt.ctrlKey && !this.cmdKey) { + if (this.selectedFiles.length == 0) { + this.overFileFolder('folder', '|'); + this.selectFileFolder('init'); } - ICEcoder.fmAction(evt, + this.fmAction(evt, key==38 ? 'up' : key==40 ? 'down' : key==37 ? 'left' : @@ -4580,51 +4585,51 @@ var ICEcoder = { return false; // CTRL/Cmd+O (Open Prompt) - } else if(key==79 && (evt.ctrlKey||ICEcoder.cmdKey)) { - ICEcoder.openPrompt(); + } else if(key==79 && (evt.ctrlKey||this.cmdKey)) { + this.openPrompt(); return false; // CTRL/Cmd+Space (Add snippet) - } else if(key==32 && (evt.ctrlKey||ICEcoder.cmdKey) && area=="content") { - ICEcoder.addSnippet(); + } else if(key==32 && (evt.ctrlKey||this.cmdKey) && area=="content") { + this.addSnippet(); return false; // CTRL/Cmd+J (Jump to definition/back again) - } else if(key==74 && (evt.ctrlKey||ICEcoder.cmdKey) && area=="content") { - ICEcoder.jumpToDefinition(); + } else if(key==74 && (evt.ctrlKey||this.cmdKey) && area=="content") { + this.jumpToDefinition(); return false; // CTRL + Tab (lock/unlock file manager) - } else if(key==223 && (evt.ctrlKey||ICEcoder.cmdKey)) { - ICEcoder.lockUnlockNav(); - ICEcoder.changeFilesW(ICEcoder.lockedNav ? 'expand' : 'contract'); + } else if(key==223 && (evt.ctrlKey||this.cmdKey)) { + this.lockUnlockNav(); + this.changeFilesW(this.lockedNav ? 'expand' : 'contract'); return false; // CTRL + . (Fold/unfold current line) - } else if(key==190 && (evt.ctrlKey||ICEcoder.cmdKey)) { - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + } else if(key==190 && (evt.ctrlKey||this.cmdKey)) { + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; var line = thisCM.getCursor().line; return false; // ESC in content area (Comment/Uncomment line) } else if(key==27 && area == "content") { - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - thisCM = ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; if (thisCM.getSelections().length > 1) { thisCM.execCommand("singleSelection"); } else { - ICEcoder.lineCommentToggle(); + this.lineCommentToggle(); } return false; // ESC not in content area (Cancel all actions) } else if(key==27 && area != "content") { - ICEcoder.cancelAllActions(); + this.cancelAllActions(); return false; // Any other key @@ -4640,13 +4645,13 @@ var ICEcoder = { key = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode; - if (key == 112 && ICEcoder.codeZoomedOut) { - cM = ICEcoder.getcMInstance(); + if (key == 112 && this.codeZoomedOut) { + cM = this.getcMInstance(); // For every line in the current editor, remove code-zoomed-out class if not a function/class declaration line for (var i=0; i -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; lineNo = thisCM.getCursor().line; whiteSpace = thisCM.getLine(lineNo).length - thisCM.getLine(lineNo).replace(/^\s\s*/, '').length; content = thisCM.getLine(lineNo).slice(whiteSpace); // function snippet if (content.slice(0,8)=="function") { - ICEcoder.doSnippet('function','function VAR() {\nINDENT\tCURSOR\nINDENT}'); + this.doSnippet('function','function VAR() {\nINDENT\tCURSOR\nINDENT}'); // if snippet } else if (content.slice(0,2)=="if") { - ICEcoder.doSnippet('if','if (CURSOR) {\nINDENT\t\nINDENT}'); + this.doSnippet('if','if (CURSOR) {\nINDENT\t\nINDENT}'); // for snippet } else if (content.slice(0,3)=="for") { - ICEcoder.doSnippet('for','for (var i=0; i -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; lineNo = thisCM.getCursor().line; lineContents = thisCM.getLine(lineNo); @@ -4730,38 +4735,38 @@ var ICEcoder = { thisCM.replaceRange(replacedLine.replace("CURSOR",""),{line:lineNo,ch:0},{line:lineNo,ch:1000000}); thisCM.setCursor(lineNoCount,curPos); // Finally, focus on the editor - ICEcoder.focus(ICEcoder.editorFocusInstance.indexOf('diff') > -1 ? true : false); + this.focus(this.editorFocusInstance.indexOf('diff') > -1 ? true : false); } }, // Snart snake startSnake: function() { - ICEcoder.snakePlaying = true; - ICEcoder.showHide('show',get('blackMask')); + this.snakePlaying = true; + this.showHide('show',get('blackMask')); get('mediaContainer').innerHTML = 'Let\'s play
      snake


      Use arrow keys to eat your code

      (it returns afterwards of course) :-)
      '; - setTimeout(function() { - ICEcoder.showHide('hide',get('blackMask')); + setTimeout(function(ic) { + ic.showHide('hide',get('blackMask')); get('mediaContainer').innerHTML = ''; - ICEcoder.playSnake(); - },2000); + ic.playSnake(); + },2000,this); }, // Play snake playSnake: function() { var cM; - cM = ICEcoder.getcMInstance(); + cM = this.getcMInstance(); cM.setOption('readOnly', 'nocursor'); cM.focus(); // Get state of editor at present - ICEcoder.snakePreHistory = cM.getHistory(); - ICEcoder.snakePreContent = cM.getValue(); - ICEcoder.snakePreCursor = cM.getCursor(); + this.snakePreHistory = cM.getHistory(); + this.snakePreContent = cM.getValue(); + this.snakePreCursor = cM.getCursor(); // Pick a random point for snake to come in and set head and 4 body parts off screen var randPos = Math.floor(Math.random()*50); - ICEcoder.snakePos = [ + this.snakePos = [ [randPos,0], [randPos,-1], [randPos,-2], @@ -4770,49 +4775,49 @@ var ICEcoder = { ]; // Show game layer, set direction and do 1st frame of snake - ICEcoder.content.contentWindow.document.getElementById('game').style.display = 'block'; - ICEcoder.snakeDir = "down"; - ICEcoder.doSnake(); + this.content.contentWindow.document.getElementById('game').style.display = 'block'; + this.snakeDir = "down"; + this.doSnake(); // Every 0.1s, move snake - ICEcoder.snakeInt = setInterval(function() { + this.snakeInt = setInterval(function(ic) { // Set new head X & Y pos according to direction var newHead = []; - newHead[0] = ICEcoder.snakePos[0][0]+(ICEcoder.snakeDir == "right" ? 1 : ICEcoder.snakeDir == "left" ? -1 : 0); - newHead[1] = ICEcoder.snakePos[0][1]+(ICEcoder.snakeDir == "down" ? 1 : ICEcoder.snakeDir == "up" ? -1 : 0); + newHead[0] = ic.snakePos[0][0]+(ic.snakeDir == "right" ? 1 : ic.snakeDir == "left" ? -1 : 0); + newHead[1] = ic.snakePos[0][1]+(ic.snakeDir == "down" ? 1 : ic.snakeDir == "up" ? -1 : 0); // Add new head and remove tail - ICEcoder.snakePos.unshift(newHead); - ICEcoder.snakePos.pop(); + ic.snakePos.unshift(newHead); + ic.snakePos.pop(); // Do next frame of snake - ICEcoder.doSnake(); - },100); + ic.doSnake(); + },100,this); }, doSnake: function() { var cM, cW, cH, newInnerHTML, lineData, lineContent, spaceReplaceChars, collision, scrollInfo; // Get CodeMirror instance, plus char width and height - cM = ICEcoder.getcMInstance(); + cM = this.getcMInstance(); cW = cM.defaultCharWidth(); cH = cM.defaultTextHeight(); // Clear content of game layer - ICEcoder.content.contentWindow.document.getElementById('game').innerHTML = ""; + this.content.contentWindow.document.getElementById('game').innerHTML = ""; // Start a new set of contents newInnerHTML = ""; // For every part of snake, draw it's block in position - for (var i=0; i'; + for (var i=0; i'; } // Set new content in game layer - ICEcoder.content.contentWindow.document.getElementById('game').innerHTML = newInnerHTML; + this.content.contentWindow.document.getElementById('game').innerHTML = newInnerHTML; // Get line & ch value under snake head then line content - lineData = cM.coordsChar({top: ((ICEcoder.snakePos[0][1]*cH)+4), left: ((ICEcoder.snakePos[0][0]*cW)+60)}); + lineData = cM.coordsChar({top: ((this.snakePos[0][1]*cH)+4), left: ((this.snakePos[0][0]*cW)+60)}); lineContent = cM.getLine(lineData.line); // If not the last char on the line - if (ICEcoder.snakePos[0][0]-1 <= lineContent.length-2) { + if (this.snakePos[0][0]-1 <= lineContent.length-2) { spaceReplaceChars = ""; // If char under snake head is a tab, replace string contains spaces of same width if (lineContent.substr(lineData.ch,1) === "\t") { @@ -4824,23 +4829,23 @@ var ICEcoder = { spaceReplaceChars = " "; } // Push a duplicate of tail onto end, to increase snake length by 1 block - ICEcoder.snakePos.push([ICEcoder.snakePos[ICEcoder.snakePos.length-1][0],ICEcoder.snakePos[ICEcoder.snakePos.length-1][1]]); + this.snakePos.push([this.snakePos[this.snakePos.length-1][0],this.snakePos[this.snakePos.length-1][1]]); // Replace char under head with nothing if end of line, else with our replacement string - cM.doc.replaceRange(ICEcoder.snakePos[0][0]-1 == lineContent.length-2 ? "" : spaceReplaceChars,lineData,{line: lineData.line, ch: lineData.ch+1}); + cM.doc.replaceRange(this.snakePos[0][0]-1 == lineContent.length-2 ? "" : spaceReplaceChars,lineData,{line: lineData.line, ch: lineData.ch+1}); // Remove any trailing space at end - if (ICEcoder.snakePos[0][0]-1 == lineContent.length-2) { + if (this.snakePos[0][0]-1 == lineContent.length-2) { cM.doc.replaceRange(cM.getLine(lineData.line).replace(/[ \t]+$/,''),{line: lineData.line, ch: 0},{line: lineData.line, ch: 1000000}); } } else { // Reduce snake length if over 5 chars and not on content - if (ICEcoder.snakePos.length >= 5) { - ICEcoder.snakePos.pop(); + if (this.snakePos.length >= 5) { + this.snakePos.pop(); } } // Detect if snake head has collided into itself collision = false; - for (var i=1; i scrollInfo.clientWidth || ((ICEcoder.snakePos[0][1]*cH)+4) > scrollInfo.clientHeight || + this.snakePos[0][0] < 0 || this.snakePos[0][1] < 0 || + ((this.snakePos[0][0]*cW)+60) > scrollInfo.clientWidth || ((this.snakePos[0][1]*cH)+4) > scrollInfo.clientHeight || collision ) { // Clear interval and hide game layer - clearInterval(ICEcoder.snakeInt); - ICEcoder.content.contentWindow.document.getElementById('game').style.display = 'none'; + clearInterval(this.snakeInt); + this.content.contentWindow.document.getElementById('game').style.display = 'none'; // Set content, saved point, saved contents and history back to what they were pre game - cM.setValue(ICEcoder.snakePreContent); - ICEcoder.savedPoints[ICEcoder.selectedTab-1] = cM.changeGeneration(); - ICEcoder.savedContents[ICEcoder.selectedTab-1] = ICEcoder.snakePreContent; - cM.setHistory(ICEcoder.snakePreHistory); + cM.setValue(this.snakePreContent); + this.savedPoints[this.selectedTab-1] = cM.changeGeneration(); + this.savedContents[this.selectedTab-1] = this.snakePreContent; + cM.setHistory(this.snakePreHistory); // Redo changes indicator in title tag and tab highlight save indicator also to what they are now (pre game state) - ICEcoder.indicateChanges(); - ICEcoder.redoTabHighlight(ICEcoder.selectedTab); + this.indicateChanges(); + this.redoTabHighlight(this.selectedTab); // Set editor to be editable again cM.setOption('readOnly', false); // Set cursor back to what it was pre game and focus on editor - cM.setCursor(ICEcoder.snakePreCursor); + cM.setCursor(this.snakePreCursor); cM.focus(); // State we are no longer playing snake - ICEcoder.snakePlaying = false; + this.snakePlaying = false; } } From 54e20ba592e2389c508c93ab08c0700c834917eb Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 29 Feb 2020 10:14:33 +0000 Subject: [PATCH 041/231] parent.parent. fixes on file-control-xhr.php --- lib/file-control-xhr.php | 190 +++++++++++++++++++-------------------- 1 file changed, 94 insertions(+), 96 deletions(-) diff --git a/lib/file-control-xhr.php b/lib/file-control-xhr.php index 117c54d..1f85080 100644 --- a/lib/file-control-xhr.php +++ b/lib/file-control-xhr.php @@ -103,7 +103,7 @@ if (isset($ftpSite)) { ftpStart(); // Show user warning if no good connection if (!$ftpConn || !$ftpLogin) { - $doNext .= 'ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");'; + $doNext .= 'parent.parent.ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");'; } } @@ -186,34 +186,34 @@ if (!$error && $_GET['action']=="save") { $fileMDTURLPart = isset($_GET["fileMDT"]) && $_GET["fileMDT"]!="undefined" ? "&fileMDT=".numClean($_GET['fileMDT']) : ""; $fileVersionURLPart = isset($_GET["fileVersion"]) && $_GET["fileVersion"]!="undefined" ? "&fileVersion=".numClean($_GET['fileVersion']) : ""; $doNext .= ' - ICEcoder.serverMessage(); + parent.parent.ICEcoder.serverMessage(); fileLoc = "'.$fileLoc.'"; overwriteOK = false; noConflictSave = false; - newFileName = ICEcoder.getInput("'.$t['Enter filename to...'].' "+(fileLoc!="" ? fileLoc : "/"),""); + newFileName = parent.parent.ICEcoder.getInput("'.$t['Enter filename to...'].' "+(fileLoc!="" ? fileLoc : "/"),""); if (newFileName) { if (newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName}; newFileName = fileLoc + newFileName; /* Check if file/dir exists */ - ICEcoder.lastFileDirCheckStatusObj = false; - ICEcoder.checkExists(newFileName); + parent.parent.ICEcoder.lastFileDirCheckStatusObj = false; + parent.parent.ICEcoder.checkExists(newFileName); var thisInt = setInterval(function() { - if (ICEcoder.lastFileDirCheckStatusObj != false) { + if (parent.parent.ICEcoder.lastFileDirCheckStatusObj != false) { clearInterval(thisInt); - if (ICEcoder.lastFileDirCheckStatusObj.file && ICEcoder.lastFileDirCheckStatusObj.file.exists) { - overwriteOK = ICEcoder.ask("'.$t['That file exists...'].'"); + if (ICEcoder.lastFileDirCheckStatusObj.file && parent.parent.ICEcoder.lastFileDirCheckStatusObj.file.exists) { + overwriteOK = parent.parent.ICEcoder.ask("'.$t['That file exists...'].'"); } else { noConflictSave = true; }; - + /* Saving under conditions: Confirmation of overwrite or there is no filename conflict, it is a new file, in either case we can save */ if (overwriteOK || noConflictSave) { newFileName = "'.(isset($ftpSite) ? "" : $docRoot).'" + newFileName; saveURL = "lib/file-control-xhr.php?action=save'.$fileMDTURLPart.$fileVersionURLPart.'&csrf='.$_GET["csrf"].'"; - var xhr = ICEcoder.xhrObj(); + var xhr = parent.parent.ICEcoder.xhrObj(); xhr.onreadystatechange=function() { if (xhr.readyState==4 && xhr.status==200) { @@ -225,20 +225,18 @@ if (!$error && $_GET['action']=="save") { /* console.log(statusObj); */ if (statusObj.status.error) { - ICEcoder.message(statusObj.status.errorMsg); + parent.parent.ICEcoder.message(statusObj.status.errorMsg); } else { eval(statusObj.action.doNext); } - - } }; /* console.log(\'Calling \'+saveURL+\' via XHR\'); */ xhr.open("POST",saveURL,true); xhr.setRequestHeader(\'Content-type\', \'application/x-www-form-urlencoded\'); - xhr.send(\'timeStart='.numClean($_POST["timeStart"]).'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(ICEcoder.saveAsContent)); - ICEcoder.serverMessage("'.$t['Saving'].'
      " + "'.($finalAction == "Save" ? "newFileName" : "'".$fileName."'").'"); + xhr.send(\'timeStart='.numClean($_POST["timeStart"]).'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(parent.parent.ICEcoder.saveAsContent)); + parent.parent.ICEcoder.serverMessage("'.$t['Saving'].'
      " + "'.($finalAction == "Save" ? "newFileName" : "'".$fileName."'").'"); } } },10); @@ -246,8 +244,8 @@ if (!$error && $_GET['action']=="save") { /* UI dialog cancelling and saving contents for save as looparound */ if (!newFileName || newFileName && !overwriteOK) { - ICEcoder.saveAsContent = document.getElementById(\'saveTemp1\').value; - ICEcoder.serverMessage();ICEcoder.serverQueue("del",0); + parent.parent.ICEcoder.saveAsContent = document.getElementById(\'saveTemp1\').value; + parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0); }'; // =================== @@ -311,10 +309,10 @@ if (!$error && $_GET['action']=="save") { } // Write our file contents if (!ftpWriteFile($ftpConn, $ftpFilepath, $contents, $ftpMode)) { - $doNext .= 'ICEcoder.message("Sorry, could not write '.$ftpFilepath.' at '.$ftpHost.'");'; + $doNext .= 'parent.parent.ICEcoder.message("Sorry, could not write '.$ftpFilepath.' at '.$ftpHost.'");'; } else { - $doNext .= 'ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]="'.$filemtime.'";'; - $doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();ICEcoder.updateVersionsDisplay();'; + $doNext .= 'parent.parent.ICEcoder.openFileMDTs[parent.parent.ICEcoder.selectedTab-1]="'.$filemtime.'";'; + $doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=parent.parent.ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();parent.parent.ICEcoder.updateVersionsDisplay();'; } // Local saving } else { @@ -357,8 +355,8 @@ if (!$error && $_GET['action']=="save") { } clearstatcache(); $filemtime = $serverType=="Linux" ? filemtime($file) : "1000000"; - $doNext .= 'ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]="'.$filemtime.'";'; - $doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();ICEcoder.updateVersionsDisplay();'; + $doNext .= 'parent.parent.ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]="'.$filemtime.'";'; + $doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=parent.parent.ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();parent.parent.ICEcoder.updateVersionsDisplay();'; } // Save a version controlled backup source of the file @@ -447,51 +445,51 @@ if (!$error && $_GET['action']=="save") { // Reload file manager, rename tab & remove old file highlighting if it was a new file if (isset($_POST['newFileName']) && $_POST['newFileName']!="") { - $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'file\');'; - $doNext .= 'ICEcoder.renameTab(ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');'; + $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'file\');'; + $doNext .= 'parent.parent.ICEcoder.renameTab(parent.parent.ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');'; if (!strpos($_REQUEST['file'],"[NEW]")) { // We're saving as a new file, so unhighlight the old name in the file manager if visible $doNext .= "fileLink = ICEcoder.filesFrame.contentWindow.document.getElementById('".str_replace("/","|",$fileLoc)."|".basename($_REQUEST['file'])."');"; - $doNext .= "if (fileLink) {fileLink.style.backgroundColor = ICEcoder.tabBGnormal; fileLink.style.color = ICEcoder.tabFGnormalFile};"; + $doNext .= "if (fileLink) {fileLink.style.backgroundColor = parent.parent.ICEcoder.tabBGnormal; fileLink.style.color = parent.parent.ICEcoder.tabFGnormalFile};"; } } // Reload previewWindow window if not a Markdown file // In doing this, we check on an interval for the page to be complete and if we last saw it loading // When we are done loading, so set the loading status to false and load plugins on.. - $doNext .= 'if (ICEcoder.previewWindow.location && ICEcoder.previewWindow.location.pathname && ICEcoder.previewWindow.location.pathname.indexOf(".md")==-1) { - ICEcoder.previewWindowLoading = false; - ICEcoder.previewWindow.location.reload(true); - - ICEcoder.checkPreviewWindowLoadingInt = setInterval(function() { - if (ICEcoder.previewWindow.document.readyState != "loading" && ICEcoder.previewWindowLoading) { - ICEcoder.previewWindowLoading = false; - try {ICEcoder.doPesticide();} catch(err) {}; - try {ICEcoder.doStatsJS(\'save\');} catch(err) {}; - try {ICEcoder.doResponsive();} catch(err) {}; - clearInterval(ICEcoder.checkPreviewWindowLoadingInt); + $doNext .= 'if (parent.parent.ICEcoder.previewWindow.location && parent.parent.ICEcoder.previewWindow.location.pathname && parent.parent.ICEcoder.previewWindow.location.pathname.indexOf(".md")==-1) { + parent.parent.ICEcoder.previewWindowLoading = false; + parent.parent.ICEcoder.previewWindow.location.reload(true); + + parent.parent.ICEcoder.checkPreviewWindowLoadingInt = setInterval(function() { + if (parent.parent.ICEcoder.previewWindow.document.readyState != "loading" && parent.parent.ICEcoder.previewWindowLoading) { + parent.parent.ICEcoder.previewWindowLoading = false; + try {parent.parent.ICEcoder.doPesticide();} catch(err) {}; + try {parent.parent.ICEcoder.doStatsJS(\'save\');} catch(err) {}; + try {parent.parent.ICEcoder.doResponsive();} catch(err) {}; + clearInterval(parent.parent.ICEcoder.checkPreviewWindowLoadingInt); } else { - ICEcoder.previewWindowLoading = ICEcoder.previewWindow.document.readyState == "loading" ? true : false; + parent.parent.ICEcoder.previewWindowLoading = parent.parent.ICEcoder.previewWindow.document.readyState == "loading" ? true : false; } },4); - + };'; // Copy over content to diff pane if we have that setting on $doNext .= ' - cM = ICEcoder.getcMInstance(); - cMdiff = ICEcoder.getcMdiffInstance(); - if (ICEcoder.updateDiffOnSave) { + cM = parent.parent.ICEcoder.getcMInstance(); + cMdiff = parent.parent.ICEcoder.getcMdiffInstance(); + if (parent.parent.ICEcoder.updateDiffOnSave) { cMdiff.setValue(cM.getValue()); }; '; // Finally, set previous files, indicate changes, set saved points and redo tabs $doNext .= ' - ICEcoder.setPreviousFiles(); + parent.parent.ICEcoder.setPreviousFiles(); setTimeout(function(){ICEcoder.indicateChanges()},4); - ICEcoder.savedPoints[ICEcoder.selectedTab-1] = cM.changeGeneration(); - ICEcoder.savedContents[ICEcoder.selectedTab-1] = cM.getValue(); - ICEcoder.redoTabHighlight(ICEcoder.selectedTab);'; + parent.parent.ICEcoder.savedPoints[parent.parent.ICEcoder.selectedTab-1] = cM.changeGeneration(); + parent.parent.ICEcoder.savedContents[parent.parent.ICEcoder.selectedTab-1] = cM.getValue(); + parent.parent.ICEcoder.redoTabHighlight(parent.parent.ICEcoder.selectedTab);'; // Run our custom processes include_once("../processes/on-file-save.php"); @@ -507,21 +505,21 @@ if (!$error && $_GET['action']=="save") { $doNext .= ' var loadedFile = document.createElement("textarea"); loadedFile.value = "'.str_replace('"','\\\"',str_replace("\r","\\\\r",str_replace("\n","\\\\n",str_replace("","",$loadedFile)))).'"; - var refreshFile = ICEcoder.ask("'.$t['Sorry, this file...'].'\\\n'.$file.'\\\n\\\n'.$t['Reload this file...'].'"); + var refreshFile = parent.parent.ICEcoder.ask("'.$t['Sorry, this file...'].'\\\n'.$file.'\\\n\\\n'.$t['Reload this file...'].'"); if (refreshFile) { - var cM = ICEcoder.getcMInstance(); - var thisTab = ICEcoder.selectedTab; + var cM = parent.parent.ICEcoder.getcMInstance(); + var thisTab = parent.parent.ICEcoder.selectedTab; var userVersionFile = cM.getValue(); /* Revert back to original */ cM.setValue(loadedFile.value); - ICEcoder.savedPoints[thisTab-1] = cM.changeGeneration(); - ICEcoder.savedContents[thisTab-1] = cM.getValue(); - ICEcoder.openFileMDTs[ICEcoder.selectedTab-1] = "'.$filemtime.'"; - ICEcoder.openFileVersions[ICEcoder.selectedTab-1] = "'.$fileCountInfo['count'].'"; + parent.parent.ICEcoder.savedPoints[thisTab-1] = cM.changeGeneration(); + parent.parent.ICEcoder.savedContents[thisTab-1] = cM.getValue(); + parent.parent.ICEcoder.openFileMDTs[parent.parent.ICEcoder.selectedTab-1] = "'.$filemtime.'"; + parent.parent.ICEcoder.openFileVersions[parent.parent.ICEcoder.selectedTab-1] = "'.$fileCountInfo['count'].'"; cM.clearHistory(); /* Now for the new version in the diff pane */ - ICEcoder.setSplitPane(\'on\'); - var cMdiff = ICEcoder.getcMdiffInstance(); + parent.parent.ICEcoder.setSplitPane(\'on\'); + var cMdiff = parent.parent.ICEcoder.getcMdiffInstance(); cMdiff.setValue(userVersionFile); };'; $finalAction = "nothing"; @@ -533,9 +531,9 @@ if (!$error && $_GET['action']=="save") { } else { $finalAction = "nothing"; - $doNext .= "ICEcoder.message('".$t['Sorry, cannot save']."\\\\n".$file."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot save']."\\\\n".$file."');"; } - $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; + $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; } }; @@ -550,7 +548,7 @@ if (!$error && $_GET['action']=="newFolder") { if (isset($ftpSite)) { $ftpFilepath = ltrim($fileLoc."/".$fileName,"/"); if (!ftpMkDir($ftpConn, octdec($ICEcoder['newDirPerms']), $ftpFilepath)) { - $doNext .= 'ICEcoder.message("Sorry, could not create dir '.$ftpFilepath.' at '.$ftpHost.'");'; + $doNext .= 'parent.parent.ICEcoder.message("Sorry, could not create dir '.$ftpFilepath.' at '.$ftpHost.'");'; } else { $updateFM = true; } @@ -562,16 +560,16 @@ if (!$error && $_GET['action']=="newFolder") { } // Update file manager on success if ($updateFM) { - $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'folder\');'; + $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'folder\');'; } $finalAction = "newFolder"; // Run our custom processes include_once("../processes/on-new-dir.php"); } else { - $doNext .= "ICEcoder.message('".$t['Sorry, cannot create...']."\\\\n".$fileLoc."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot create...']."\\\\n".$fileLoc."');"; $finalAction = "nothing"; } - $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; + $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; }; // ================ @@ -592,7 +590,7 @@ if (!$error && $_GET['action']=="move") { // FTP if (isset($ftpSite)) { if (!ftpRename($ftpConn, $srcDir, $tgtDir)) { - $doNext .= 'ICEcoder.message("Sorry, could not rename '.$srcDir.' to '.$tgtDir.'");'; + $doNext .= 'parent.parent.ICEcoder.message("Sorry, could not rename '.$srcDir.' to '.$tgtDir.'");'; } else { $ftpFileDirInfo = ftpGetFileInfo($ftpConn, ltrim($fileLoc,"/"), $fileName); $fileOrFolder = $ftpFileDirInfo['type'] == "directory" ? "folder" : "file"; @@ -608,20 +606,20 @@ if (!$error && $_GET['action']=="move") { } // Update file manager on success if ($updateFM) { - $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'move\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",str_replace("|","/",$_GET['oldFileName'])).'\',false,\''.$fileOrFolder.'\');'; + $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'move\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",str_replace("|","/",$_GET['oldFileName'])).'\',false,\''.$fileOrFolder.'\');'; } $finalAction = "move"; // Run our custom processes include_once("../processes/on-file-dir-move.php"); } else { - $doNext .= "ICEcoder.message('".$t['Sorry, cannot move']."\\\\n".str_replace("|","/",$_GET['oldFileName'])."\\\\n\\\\n".$t['Maybe public write...']."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot move']."\\\\n".str_replace("|","/",$_GET['oldFileName'])."\\\\n\\\\n".$t['Maybe public write...']."');"; $finalAction = "nothing"; } } else { $doNext .= ""; $finalAction = "nothing"; } - $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; + $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; }; // ================== @@ -635,7 +633,7 @@ if (!$error && $_GET['action']=="rename") { if (isset($ftpSite)) { $ftpFilepath = ltrim($fileLoc."/".$fileName,"/"); if (!ftpRename($ftpConn, ltrim($_GET['oldFileName'],"/"), $ftpFilepath)) { - $doNext .= 'ICEcoder.message("Sorry, could not rename '.ltrim($_GET['oldFileName'],"/").' to '.$ftpFilepath.'");'; + $doNext .= 'parent.parent.ICEcoder.message("Sorry, could not rename '.ltrim($_GET['oldFileName'],"/").' to '.$ftpFilepath.'");'; } else { $updateFM = true; } @@ -646,16 +644,16 @@ if (!$error && $_GET['action']=="rename") { } // Update file manager on success if ($updateFM) { - $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",$_GET['oldFileName']).'\');'; + $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",$_GET['oldFileName']).'\');'; } $finalAction = "rename"; // Run our custom processes include_once("../processes/on-file-dir-rename.php"); } else { - $doNext .= "ICEcoder.message('".$t['Sorry, cannot rename']."\\\\n".$_GET['oldFileName']."\\\\n\\\\n".$t['Maybe public write...']."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot rename']."\\\\n".$_GET['oldFileName']."\\\\n\\\\n".$t['Maybe public write...']."');"; $finalAction = "nothing"; } - $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; + $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; }; // ================= @@ -704,15 +702,15 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="paste") { } } // Reload file manager - $doNext .= 'ICEcoder.updateFileManagerList(\'add\',\''.str_replace("|","/",$_GET['location']).'\',\''.basename($dest).'\',false,false,false,\''.$fileOrFolder.'\');'; + $doNext .= 'parent.parent.ICEcoder.updateFileManagerList(\'add\',\''.str_replace("|","/",$_GET['location']).'\',\''.basename($dest).'\',false,false,false,\''.$fileOrFolder.'\');'; $finalAction = "pasteFile"; // Run our custom processes include_once("../processes/on-file-dir-paste.php"); } else { - $doNext .= "ICEcoder.message('".$t['Sorry, cannot copy']." \\\\n".str_replace($docRoot,"",$source)."\\\\n ".$t['into']." \\\\n".str_replace($docRoot,"",$dest)."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot copy']." \\\\n".str_replace($docRoot,"",$source)."\\\\n ".$t['into']." \\\\n".str_replace($docRoot,"",$dest)."');"; $finalAction = "nothing"; } - $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; + $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; }; // ============== @@ -736,10 +734,10 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="upload") { $setPerms = $ICEcoder['newFilePerms']; } if ($this->upload($current,$this->uploadFile,$setPerms)) { - $doNext .= 'ICEcoder.updateFileManagerList(\'add\',ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,\'/\'),\''.str_replace("'","\'",$fileName).'\',false,false,true,\'file\'); ICEcoder.serverMessage("'.$t['Uploaded file(s) OK'].'");setTimeout(function(){ICEcoder.serverMessage();},2000);'; + $doNext .= 'parent.parent.ICEcoder.updateFileManagerList(\'add\',parent.parent.ICEcoder.selectedFiles[parent.parent.ICEcoder.selectedFiles.length-1].replace(/\|/g,\'/\'),\''.str_replace("'","\'",$fileName).'\',false,false,true,\'file\'); parent.parent.ICEcoder.serverMessage("'.$t['Uploaded file(s) OK'].'");setTimeout(function(){parent.parent.ICEcoder.serverMessage();},2000);'; $finalAction = "upload"; } else { - $doNext .= "ICEcoder.message('".$t['Sorry, cannot upload']." \\\\n".$fileName."\\\\n ".$t['into']." \\\\n'+ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,'/'));"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot upload']." \\\\n".$fileName."\\\\n ".$t['into']." \\\\n'+parent.parent.ICEcoder.selectedFiles[parent.parent.ICEcoder.selectedFiles.length-1].replace(/\|/g,'/'));"; $finalAction = "nothing"; } } @@ -770,11 +768,11 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="upload") { // Run our custom processes include_once("../processes/on-file-upload.php"); } else { - $doNext .= "ICEcoder.message('".$t['Sorry, cannot upload...']."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot upload...']."');"; $finalAction = "nothing"; } - $doNext .= "ICEcoder.hideFileMenu();document.getElementById('fileInput').value='';ICEcoder.showHide('hide',document.getElementById('loadingMask'));"; + $doNext .= "parent.parent.ICEcoder.hideFileMenu();document.getElementById('fileInput').value='';parent.parent.ICEcoder.showHide('hide',document.getElementById('loadingMask'));"; // Upload is not handled by XHR methods, but form post, so we need to manually trigger $doNext in a script tag echo ""; @@ -795,16 +793,16 @@ if (!$error && $_GET['action']=="delete") { if (!$demoMode && ftpDelete($ftpConn,$itemType,$itemPath)) { if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";}; // Reload file manager - $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; + $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; $finalAction = "delete"; // Run our custom processes include_once("../processes/on-file-dir-delete.php"); } else { - $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".$fileLoc."/".$fileName."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".$fileLoc."/".$fileName."');"; $finalAction = "nothing"; } } else { - $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete more...']."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete more...']."');"; $finalAction = "nothing"; } // Local @@ -815,7 +813,7 @@ if (!$error && $_GET['action']=="delete") { $fullPath = $docRoot.$iceRoot.$fullPath; if (rtrim($fullPath,"/") == rtrim($docRoot,"/")) { - $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete...']."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete...']."');"; } else if (!$demoMode && is_writable($fullPath)) { if (is_dir($fullPath)) { rrmdir($fullPath); @@ -829,17 +827,17 @@ if (!$error && $_GET['action']=="delete") { $fileLoc = dirname(str_replace($docRoot,"",$fullPath)); if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";}; // Reload file manager - $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; + $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; $finalAction = "delete"; // Run our custom processes include_once("../processes/on-file-dir-delete.php"); } else { - $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".str_replace($docRoot,"",$fullPath)."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".str_replace($docRoot,"",$fullPath)."');"; $finalAction = "nothing"; } } } - $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; + $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; }; // The function to recursively remove folders & files @@ -881,10 +879,10 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="replaceText") { // Run our custom processes include_once("../processes/on-file-replace-text.php"); } else { - $doNext .= "ICEcoder.message('".$t['Sorry, cannot replace...']."\\\\n".$file."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot replace...']."\\\\n".$file."');"; $finalAction = "nothing"; } - $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; + $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; }; // ========================== @@ -898,17 +896,17 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="getRemoteFile") { $remoteFile = str_replace("\r\n", $ICEcoder["lineEnding"], $remoteFile); $remoteFile = str_replace("\r", $ICEcoder["lineEnding"], $remoteFile); $remoteFile = str_replace("\n", $ICEcoder["lineEnding"], $remoteFile); - $doNext .= 'ICEcoder.newTab();'; - $doNext .= 'ICEcoder.getcMInstance().setValue(\''.str_replace("\r","",str_replace("\t","\\\\t",str_replace("\n","\\\\n",str_replace("'","\\\\'",str_replace("\\","\\\\",preg_quote($remoteFile)))))).'\');'; - $doNext .= 'ICEcoder.goToLine('.$lineNumber.');'; + $doNext .= 'parent.parent.ICEcoder.newTab();'; + $doNext .= 'parent.parent.ICEcoder.getcMInstance().setValue(\''.str_replace("\r","",str_replace("\t","\\\\t",str_replace("\n","\\\\n",str_replace("'","\\\\'",str_replace("\\","\\\\",preg_quote($remoteFile)))))).'\');'; + $doNext .= 'parent.parent.ICEcoder.goToLine('.$lineNumber.');'; $finalAction = "getRemoteFile"; // Run our custom processes include_once("../processes/on-get-remote-file.php"); } else { $finalAction = "nothing"; - $doNext .= 'ICEcoder.message(\''.$t['Sorry, could not...'].' '.$file.'\');'; + $doNext .= 'parent.parent.ICEcoder.message(\''.$t['Sorry, could not...'].' '.$file.'\');'; } - $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; + $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; }; // ======================= @@ -922,7 +920,7 @@ if (!$error && $_GET['action']=="perms") { if (isset($ftpSite)) { $ftpFilepath = ltrim($fileLoc."/".$fileName,"/"); if (!ftpPerms($ftpConn, octdec(numClean($_GET['perms'])), $ftpFilepath)) { - $doNext .= 'ICEcoder.message("Sorry, could not set perms on '.$ftpFilepath.' at '.$ftpHost.'");'; + $doNext .= 'parent.parent.ICEcoder.message("Sorry, could not set perms on '.$ftpFilepath.' at '.$ftpHost.'");'; } else { $updateFM = true; } @@ -934,16 +932,16 @@ if (!$error && $_GET['action']=="perms") { } // Update file manager on success if ($updateFM) { - $doNext .= 'ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');'; + $doNext .= 'parent.parent.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');'; } $finalAction = "perms"; // Run our custom processes include_once("../processes/on-file-dir-perms.php"); } else { $finalAction = "nothing"; - $doNext .= "ICEcoder.message('".$t['Sorry, cannot change...']." \\n".$file."');"; + $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot change...']." \\n".$file."');"; } - $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; + $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; }; // ==================== @@ -951,10 +949,10 @@ if (!$error && $_GET['action']=="perms") { // ==================== if (!isset($ftpSite) && !$error && $_GET['action']=="checkExists") { - // This action is called under seperate AJAX call and the responseText object stored in ICEcoder.lastFileDirCheckStatusObj + // This action is called under seperate AJAX call and the responseText object stored in parent.parent.ICEcoder.lastFileDirCheckStatusObj // Nothing really done here though, we do something with the responseText $finalAction = "checkExists"; - $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; + $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; }; // =================== @@ -1012,7 +1010,7 @@ echo '{ "timeEnd": 0, "timeTaken": 0, "csrf": "'.xssClean($_GET['csrf'],"html").'", - "doNext" : "'.preg_replace('/\r|\n/','',str_replace(' ','',str_replace('"','\"',$doNext))).'ICEcoder.switchMode();" + "doNext" : "'.preg_replace('/\r|\n/','',str_replace(' ','',str_replace('"','\"',$doNext))).'parent.parent.ICEcoder.switchMode();" }, "status": { "error" : '.($error ? 'true' : 'false').', From f3b78ae34714bf1957324a0804ac2461976cac0b Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 29 Feb 2020 10:15:02 +0000 Subject: [PATCH 042/231] parent.parent. fixes on lib files --- lib/backup-versions.php | 38 +++++++++++++++++------------------ lib/ftp-manager.php | 8 ++++---- lib/get-branch.php | 42 +++++++++++++++++++-------------------- lib/go-localhost-root.php | 4 ++-- lib/plugins-display.php | 8 ++++---- lib/plugins-manager.php | 4 ++-- lib/properties.php | 2 +- lib/settings-common.php | 2 +- lib/settings-screen.php | 12 +++++------ lib/settings-update.php | 6 +++--- 10 files changed, 63 insertions(+), 63 deletions(-) diff --git a/lib/backup-versions.php b/lib/backup-versions.php index 134c6a0..0921d02 100644 --- a/lib/backup-versions.php +++ b/lib/backup-versions.php @@ -113,18 +113,18 @@ include(dirname(__FILE__)."/language-modes-partial.js"); var editor = CodeMirror.fromTextArea(document.getElementById("code"), { mode: mode, - lineNumbers: ICEcoder.lineNumbers, + lineNumbers: parent.parent.ICEcoder.lineNumbers, gutters: ["CodeMirror-foldgutter","CodeMirror-lint-markers","CodeMirror-linenumbers"], foldGutter: {gutter: "CodeMirror-foldgutter"}, foldOptions: {minFoldSize: 1}, - lineWrapping: ICEcoder.lineWrapping, - indentWithTabs: ICEcoder.indentWithTabs, - indentUnit: ICEcoder.indentSize, - tabSize: ICEcoder.indentSize, - matchBrackets: ICEcoder.matchBrackets, + lineWrapping: parent.parent.ICEcoder.lineWrapping, + indentWithTabs: parent.parent.ICEcoder.indentWithTabs, + indentUnit: parent.parent.ICEcoder.indentSize, + tabSize: parent.parent.ICEcoder.indentSize, + matchBrackets: parent.parent.ICEcoder.matchBrackets, electricChars: false, highlightSelectionMatches: true, - showTrailingSpace: ICEcoder.showTrailingSpace, + showTrailingSpace: parent.parent.ICEcoder.showTrailingSpace, lint: false, readOnly: "nocursor", theme: "" @@ -134,31 +134,31 @@ editor.setSize("480px","500px"); var openNew = function() { var cM; - ICEcoder.showHide('hide',document.getElementById('blackMask')) - ICEcoder.newTab(); - cM = ICEcoder.getcMInstance(); + parent.parent.ICEcoder.showHide('hide',parent.document.getElementById('blackMask')) + parent.parent.ICEcoder.newTab(); + cM = parent.parent.ICEcoder.getcMInstance(); cM.setValue(editor.getValue()); } var openDiff = function() { var cMDiff; - ICEcoder.showHide('hide',document.getElementById('blackMask')) - ICEcoder.setSplitPane('on'); - cMDiff = ICEcoder.getcMdiffInstance(); - ICEcoder.focus('diff'); + parent.parent.ICEcoder.showHide('hide',parent.document.getElementById('blackMask')) + parent.parent.ICEcoder.setSplitPane('on'); + cMDiff = parent.parent.ICEcoder.getcMdiffInstance(); + parent.parent.ICEcoder.focus('diff'); cMDiff.setValue(editor.getValue()); } var restoreVersion = function() { var cM; - if (ICEcoder.ask("To confirm - this will paste the displayed backup content to your current tab and save, OK?")) { - ICEcoder.showHide('hide',document.getElementById('blackMask')) - cM = ICEcoder.getcMInstance(); - ICEcoder.focus(); + if (parent.parent.ICEcoder.ask("To confirm - this will paste the displayed backup content to your current tab and save, OK?")) { + parent.parent.ICEcoder.showHide('hide',parent.document.getElementById('blackMask')) + cM = parent.parent.ICEcoder.getcMInstance(); + parent.parent.ICEcoder.focus(); cM.setValue(editor.getValue()); - ICEcoder.saveFile(); + parent.parent.ICEcoder.saveFile(); } } diff --git a/lib/ftp-manager.php b/lib/ftp-manager.php index c9c9be0..e5c520d 100644 --- a/lib/ftp-manager.php +++ b/lib/ftp-manager.php @@ -18,7 +18,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset // Set the site ref in session, hide the popup and reload the file manager $_SESSION['ftpSiteRef'] = numClean($_GET['ftpSiteRef']); // Hide this popup and reload file manager - echo ""; + echo ""; } else { // Start creating a new chunk for the FTP sites $settingsNew = '"ftpSites" => array( @@ -109,10 +109,10 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset fclose($fh); // Finally, reload the iFrame screen for the user header("Location: ftp-manager.php?updatedFTPSites&csrf=".$_SESSION["csrf"]); - echo ""; + echo ""; die($t['Saving FTP sites']); } else { - echo ""; + echo ""; } } } @@ -147,7 +147,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset echo ''.$ftpSites[$i]['site'].''; echo ''.$ftpSites[$i]['host'].''; echo 'Edit'; - echo 'Delete'; + echo 'Delete'; echo '
      '.$t['Choose'].'
      '; echo ''; } diff --git a/lib/get-branch.php b/lib/get-branch.php index d44b9f0..5560f00 100644 --- a/lib/get-branch.php +++ b/lib/get-branch.php @@ -127,7 +127,7 @@ if (isset($ftpSite)) { ftpStart(); // Show user warning if no good connection if (!$ftpConn || !$ftpLogin) { - die(''); + die(''); exit; } // Get our simple and detailed lists and close the FTP connection @@ -186,15 +186,15 @@ for ($i=0;$i        ".xssClean(basename($fileFolderName),"html")." "; + " if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {parent.parent.ICEcoder.openFile()}}\" style=\"position: relative; left:-22px\">        ".xssClean(basename($fileFolderName),"html")." "; if (!isset($ftpSite)) { $thisPermVal = $serverType=="Linux" ? substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3) : ''; } else { @@ -224,7 +224,7 @@ echo ' '; if (!isset($ftpSite) && $_SESSION['githubDiff']) { // Show the loading screen until we're done comparing files with GitHub - echo ""; + echo ""; $i=0; $dirListArray = $dirSHAArray = $dirTypeArray = array(); // For each of the files in our local path... @@ -356,20 +356,20 @@ if (!isset($ftpSite) && $_SESSION['githubDiff']) { // If there are no diffs, ask user if they want to switch back to regular mode setTimeout(function(){ if (parent.document.getElementById('|').parentNode.parentNode.parentNode.childNodes[2].childNodes.length==1) { - if(parent.ICEcoder.ask('')) { - parent.ICEcoder.githubDiffToggle(); + if(parent.parent.ICEcoder.ask('')) { + parent.parent.ICEcoder.githubDiffToggle(); } else { - parent.ICEcoder.showHide('hide',parent.get('loadingMask')); + parent.parent.ICEcoder.showHide('hide',parent.get('loadingMask')); } } else { - parent.ICEcoder.showHide('hide',parent.get('loadingMask')); + parent.parent.ICEcoder.showHide('hide',parent.get('loadingMask')); } },100); },4); } else { // There was an error, display HTTP error code and response message - parent.ICEcoder.message(' '+err.error+'\n\n'+err.request.response); - parent.ICEcoder.showHide('hide',parent.get('loadingMask')); + parent.parent.ICEcoder.message(' '+err.error+'\n\n'+err.request.response); + parent.parent.ICEcoder.showHide('hide',parent.get('loadingMask')); } }); @@ -432,15 +432,15 @@ if (!isset($ftpSite) && $_SESSION['githubDiff']) { // If we're adding a deleted dir/file in a sub-dir if ("" == "/"+thePath) { - parent.ICEcoder.updateFileManagerList('add','/'+thePath,theFile,false,false,false,'file'); + parent.parent.ICEcoder.updateFileManagerList('add','/'+thePath,theFile,false,false,false,'file'); // If we're adding a deleted dir/file at the root level } else { // Folder if (thePath != "") { - parent.ICEcoder.updateFileManagerList('add',parent.iceRoot,thePath,false,false,false,'folder'); + parent.parent.ICEcoder.updateFileManagerList('add',parent.iceRoot,thePath,false,false,false,'folder'); // File } else { - parent.ICEcoder.updateFileManagerList('add',parent.iceRoot+thePath,theFile,false,false,false,'file'); + parent.parent.ICEcoder.updateFileManagerList('add',parent.iceRoot+thePath,theFile,false,false,false,'file'); } } @@ -452,8 +452,8 @@ if (!isset($ftpSite) && $_SESSION['githubDiff']) { },20); } - setTimeout(function(){parent.ICEcoder.redoTabHighlight(parent.ICEcoder.selectedTab);},4); - if (!parent.ICEcoder.fmReady) {parent.ICEcoder.fmReady=true;}; + setTimeout(function(){parent.parent.ICEcoder.redoTabHighlight(parent.parent.ICEcoder.selectedTab);},4); + if (!parent.parent.ICEcoder.fmReady) {parent.parent.ICEcoder.fmReady=true;}; } newUL.innerHTML = showContent; locNest.parentNode.insertBefore(newUL,locNest.nextSibling); @@ -469,10 +469,10 @@ if (!isset($ftpSite) && $_SESSION['githubDiff']) { $pathPos = array_search($iceRoot,$iceGithubLocalPaths); if ($pathPos !== false) { ?> - if (parent.ICEcoder.ask(" ?")) { + if (parent.parent.ICEcoder.ask(" ?")) { setTimeout(function() { - parent.ICEcoder.showHide('show',parent.get('loadingMask')); - parent.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = "github.php?action=clone&csrf="+parent.ICEcoder.csrf; + parent.parent.ICEcoder.showHide('show',parent.get('loadingMask')); + parent.parent.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = "github.php?action=clone&csrf="+parent.parent.ICEcoder.csrf; },4); } diff --git a/lib/go-localhost-root.php b/lib/go-localhost-root.php index 242976a..5fc05ec 100644 --- a/lib/go-localhost-root.php +++ b/lib/go-localhost-root.php @@ -27,9 +27,9 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn']) { $_SESSION['ftpSiteRef'] = false; // Now we've reset the root path to localhost root, refresh the file manager to show it - echo ""; + echo ""; } else { - echo ""; + echo ""; } ?> document.getElementById('pluginsOptional').innerHTML = '".str_replace("'","\\'",$pluginsDisplay)."';"; + echo ""; } // Work out what plugins we'll need to set on a setInterval @@ -30,10 +30,10 @@ if ($_SESSION['loggedIn']) { if (isset($_GET['updatedPlugins'])) { ?> if (confirm('".$t['ICEcoder needs to...']."')) {window.location.reload(true);} else {window.location='plugins-manager.php?updatedPlugins&csrf='+ICEcoder.csrf;}"; + echo ""; } else { header("Location: plugins-manager.php?updatedPlugins&csrf=".$_SESSION["csrf"]); echo ""; } die("".$t['saving plugins'].""); } else { - echo ""; + echo ""; } } diff --git a/lib/properties.php b/lib/properties.php index 729aaf9..a252ee4 100644 --- a/lib/properties.php +++ b/lib/properties.php @@ -166,7 +166,7 @@ var validatePerms = function() { permText.split("")[2]*1 <0 || permText.split("")[2]*1 >7) { canUpdate = false; } - if (canUpdate) {ICEcoder.chmod('',permText)}; + if (canUpdate) {parent.parent.ICEcoder.chmod('',permText)}; } diff --git a/lib/settings-common.php b/lib/settings-common.php index 88bed0e..845c952 100644 --- a/lib/settings-common.php +++ b/lib/settings-common.php @@ -252,7 +252,7 @@ function toUTF8noBOM($string,$message=false) { if (!$strictUTF8 && strlen($teststringConverted) == strlen($teststringBroken)) { $string = utf8_encode($string); if ($message) { - echo "ICEcoder.message('".$t['Your document does...'].".');"; + echo "parent.parent.ICEcoder.message('".$t['Your document does...'].".');"; } } } diff --git a/lib/settings-screen.php b/lib/settings-screen.php index 8091693..e85378c 100644 --- a/lib/settings-screen.php +++ b/lib/settings-screen.php @@ -356,10 +356,10 @@ function findSequence(goal) { -
      ">update
      +
      ">update
      "> diff --git a/lib/settings-update.php b/lib/settings-update.php index 71bd3be..132b565 100644 --- a/lib/settings-update.php +++ b/lib/settings-update.php @@ -79,7 +79,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset fwrite($fh, $settingsContents); fclose($fh); } else { - echo ""; + echo ""; } // OK, now the config file has been updated, update our current session with new arrays @@ -110,7 +110,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset fwrite($fConfigSettings, $generalSettingsContents); fclose($fConfigSettings); } else { - echo ""; + echo ""; } $githubAuthTokenSet = $ICEcoder["githubAuthToken"] != "" ? "true" : "false"; @@ -123,5 +123,5 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset // With all that worked out, we can now hide the settings screen and apply the new settings $jsBugFilePaths = "['".str_replace(",","','",str_replace(" ","",$_POST['bugFilePaths']))."']"; - echo ""; + echo ""; } From 3adeacfcdaac9cdf1085c9fbc37311178f87a332 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 29 Feb 2020 10:29:38 +0000 Subject: [PATCH 043/231] Ref fixes in get-branch.php and ice-coder.js --- lib/get-branch.php | 4 ++-- lib/ice-coder.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/get-branch.php b/lib/get-branch.php index 5560f00..cd0be5a 100644 --- a/lib/get-branch.php +++ b/lib/get-branch.php @@ -186,11 +186,11 @@ for ($i=0;$i
              '+file+' '+perms+''; @@ -2921,7 +2921,7 @@ var ICEcoder = { serverMessage: function(message) { var serverMessage; - serverMessage = parent.get('serverMessage'); + serverMessage = get('serverMessage'); if (message) { serverMessage.innerHTML = this.xssClean(message).replace(/\<b\>/g,"").replace(/\<\/b\>/g,"").replace(/\<br\>/g,"
      "); serverMessage.style.left = "0"; From 9274db05e2d73c99720ae8a65bdb846c40d8e019 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 29 Feb 2020 10:39:05 +0000 Subject: [PATCH 044/231] parent. path fixes for DOM elems at level higher --- lib/get-branch.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/get-branch.php b/lib/get-branch.php index cd0be5a..9c5f15d 100644 --- a/lib/get-branch.php +++ b/lib/get-branch.php @@ -186,13 +186,13 @@ for ($i=0;$i        ".xssClean(basename($fileFolderName),"html")." "; if (!isset($ftpSite)) { From 87b32b51e9bf041e2dcfb0c959a069c4d413cd92 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sun, 1 Mar 2020 09:17:10 +0000 Subject: [PATCH 045/231] Fix some refs re minimap --- lib/ice-coder.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index cfc64e8..6e2683d 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -4,7 +4,6 @@ var get = function(elem) { }; var iceLoc = window.location.pathname; -// var iceDir = iceLoc.substring(0, iceLoc.lastIndexOf('/')); // Main ICEcoder object var ICEcoder = { @@ -1506,15 +1505,15 @@ var ICEcoder = { maxHeight = parseInt(get('docExplorer').style.height,10) <= parseInt(get('miniMapContent').getBoundingClientRect().height,10) ? parseInt(get('docExplorer').style.height,10) : parseInt(get('miniMapContent').getBoundingClientRect().height,10); - newPerc = (this.position.y/(maxHeight-this.miniMapBoxHeight)); + newPerc = (this.position.y/(maxHeight-ICEcoder.miniMapBoxHeight)); yPos = (cM.getScrollInfo().height-cM.getScrollInfo().clientHeight)*newPerc; cM.scrollTo(0,yPos); // this.position.y }); draggie.on( 'pointerDown', function( event, pointer ) { - this.mouseDownMinimap = true; + ICEcoder.mouseDownMinimap = true; }); draggie.on( 'pointerUp', function( event, pointer ) { - this.mouseDownMinimap = false; + ICEcoder.mouseDownMinimap = false; }); this.setMinimapLayout(cM); From ffd17ba3f78fd8a4a3a626bc284f477bb93b7d4e Mon Sep 17 00:00:00 2001 From: mattpass Date: Sun, 1 Mar 2020 09:17:45 +0000 Subject: [PATCH 046/231] Simplify adding CM events --- editor.php | 80 ++++++++++++++---------------------------------------- 1 file changed, 20 insertions(+), 60 deletions(-) diff --git a/editor.php b/editor.php index 4fac3fd..db8fb1b 100644 --- a/editor.php +++ b/editor.php @@ -229,71 +229,31 @@ function createNewCMInstance(num) { window['cM'+num+'diff'] = CodeMirror(document.body, cMOptions); // Define actions for those... - - // Focus - window['cM'+num] .on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM,'cM'+num+'diff')}); - - // Blur - window['cM'+num] .on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM,'cM'+num+'diff')}); - - // Keyup - window['cM'+num] .on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM,'cM'+num+'diff')}); - - // Cursor activity - window['cM'+num] .on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM,'cM'+num+'diff')}); - - // Before selection change - window['cM'+num] .on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLine = thisCM.getCursor().line;}); - window['cM'+num+'diff'] .on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLineDiff = thisCM.getCursor().line;}); - - // Change - window['cM'+num] .on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM,'cM'+num,changeObj,CodeMirror)}); - window['cM'+num+'diff'] .on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM,'cM'+num+'diff',changeObj,CodeMirror)}); - - // Before change - window['cM'+num] .on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM,'cM'+num,changeObj,CodeMirror)}); - window['cM'+num+'diff'] .on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM,'cM'+num+'diff',changeObj,CodeMirror)}); - - // Scroll - window['cM'+num] .on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM,'cM'+num+'diff')}); - - // Update - window['cM'+num] .on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM,'cM'+num+'diff')}); - - // Input read - window['cM'+num] .on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM,'cM'+num)}); - window['cM'+num+'diff'] .on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM,'cM'+num+'diff')}); - - // Gutter Click - window['cM'+num] .on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM,line,gutter,evt,'cM'+num)}); - window['cM'+num+'diff'] .on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM,line,gutter,evt,'cM'+num+'diff')}); - - // Mouse Down - window['cM'+num] .on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM,'cM'+num,evt)}); - window['cM'+num+'diff'] .on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM,'cM'+num+'diff',evt)}); - - // Context Menu - window['cM'+num] .on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM,'cM'+num,evt)}); - window['cM'+num+'diff'] .on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM,'cM'+num+'diff',evt)}); - - // Drag Over - window['cM'+num] .on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM,event,'cM'+num)}); - window['cM'+num+'diff'] .on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM,event,'cM'+num+'diff')}); - - // Render line - window['cM'+num] .on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM,'cM'+num,line,element)}); - window['cM'+num+'diff'] .on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM,'cM'+num+'diff',line,element)}); + createNewCMInstanceEvents(num, ''); + createNewCMInstanceEvents(num, 'diff'); // Now create the active lines for them parent.ICEcoder['cMActiveLinecM'+num] = window['cM'+num].addLineClass(0, "background", "cm-s-activeLine"); parent.ICEcoder['cMActiveLinecM'+num+'diff'] = window['cM'+num+'diff'].addLineClass(0, "background", "cm-s-activeLine"); }; + +function createNewCMInstanceEvents(num, pane) { + window['cM'+num+pane].on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM,'cM'+num+pane)}); + window['cM'+num+pane].on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM,'cM'+num+pane)}); + window['cM'+num+pane].on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM,'cM'+num+pane)}); + window['cM'+num+pane].on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM,'cM'+num+pane)}); + window['cM'+num+pane].on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLine = thisCM.getCursor().line;}); + window['cM'+num+pane].on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM,'cM'+num+pane,changeObj,CodeMirror)}); + window['cM'+num+pane].on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM,'cM'+num+pane,changeObj,CodeMirror)}); + window['cM'+num+pane].on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM,'cM'+num+pane)}); + window['cM'+num+pane].on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM,'cM'+num+pane)}); + window['cM'+num+pane].on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM,'cM'+num+pane)}); + window['cM'+num+pane].on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM,line,gutter,evt,'cM'+num+pane)}); + window['cM'+num+pane].on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM,'cM'+num+pane,evt)}); + window['cM'+num+pane].on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM,'cM'+num+pane,evt)}); + window['cM'+num+pane].on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM,event,'cM'+num+pane)}); + window['cM'+num+pane].on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM,'cM'+num+pane,line,element)}); +} From 63ff39d20056342d90931311b367571eec8c2a80 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sun, 1 Mar 2020 09:18:04 +0000 Subject: [PATCH 047/231] Fix path refs for doNext --- lib/file-control-xhr.php | 182 +++++++++++++++++++-------------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/lib/file-control-xhr.php b/lib/file-control-xhr.php index 1f85080..5b27136 100644 --- a/lib/file-control-xhr.php +++ b/lib/file-control-xhr.php @@ -103,7 +103,7 @@ if (isset($ftpSite)) { ftpStart(); // Show user warning if no good connection if (!$ftpConn || !$ftpLogin) { - $doNext .= 'parent.parent.ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");'; + $doNext .= 'ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");'; } } @@ -186,24 +186,24 @@ if (!$error && $_GET['action']=="save") { $fileMDTURLPart = isset($_GET["fileMDT"]) && $_GET["fileMDT"]!="undefined" ? "&fileMDT=".numClean($_GET['fileMDT']) : ""; $fileVersionURLPart = isset($_GET["fileVersion"]) && $_GET["fileVersion"]!="undefined" ? "&fileVersion=".numClean($_GET['fileVersion']) : ""; $doNext .= ' - parent.parent.ICEcoder.serverMessage(); + ICEcoder.serverMessage(); fileLoc = "'.$fileLoc.'"; overwriteOK = false; noConflictSave = false; - newFileName = parent.parent.ICEcoder.getInput("'.$t['Enter filename to...'].' "+(fileLoc!="" ? fileLoc : "/"),""); + newFileName = ICEcoder.getInput("'.$t['Enter filename to...'].' "+(fileLoc!="" ? fileLoc : "/"),""); if (newFileName) { if (newFileName.substr(0,1)!="/") {newFileName = "/" + newFileName}; newFileName = fileLoc + newFileName; /* Check if file/dir exists */ - parent.parent.ICEcoder.lastFileDirCheckStatusObj = false; - parent.parent.ICEcoder.checkExists(newFileName); + ICEcoder.lastFileDirCheckStatusObj = false; + ICEcoder.checkExists(newFileName); var thisInt = setInterval(function() { - if (parent.parent.ICEcoder.lastFileDirCheckStatusObj != false) { + if (ICEcoder.lastFileDirCheckStatusObj != false) { clearInterval(thisInt); - if (ICEcoder.lastFileDirCheckStatusObj.file && parent.parent.ICEcoder.lastFileDirCheckStatusObj.file.exists) { - overwriteOK = parent.parent.ICEcoder.ask("'.$t['That file exists...'].'"); + if (ICEcoder.lastFileDirCheckStatusObj.file && ICEcoder.lastFileDirCheckStatusObj.file.exists) { + overwriteOK = ICEcoder.ask("'.$t['That file exists...'].'"); } else { noConflictSave = true; }; @@ -213,7 +213,7 @@ if (!$error && $_GET['action']=="save") { newFileName = "'.(isset($ftpSite) ? "" : $docRoot).'" + newFileName; saveURL = "lib/file-control-xhr.php?action=save'.$fileMDTURLPart.$fileVersionURLPart.'&csrf='.$_GET["csrf"].'"; - var xhr = parent.parent.ICEcoder.xhrObj(); + var xhr = ICEcoder.xhrObj(); xhr.onreadystatechange=function() { if (xhr.readyState==4 && xhr.status==200) { @@ -225,7 +225,7 @@ if (!$error && $_GET['action']=="save") { /* console.log(statusObj); */ if (statusObj.status.error) { - parent.parent.ICEcoder.message(statusObj.status.errorMsg); + ICEcoder.message(statusObj.status.errorMsg); } else { eval(statusObj.action.doNext); } @@ -235,8 +235,8 @@ if (!$error && $_GET['action']=="save") { /* console.log(\'Calling \'+saveURL+\' via XHR\'); */ xhr.open("POST",saveURL,true); xhr.setRequestHeader(\'Content-type\', \'application/x-www-form-urlencoded\'); - xhr.send(\'timeStart='.numClean($_POST["timeStart"]).'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(parent.parent.ICEcoder.saveAsContent)); - parent.parent.ICEcoder.serverMessage("'.$t['Saving'].'
      " + "'.($finalAction == "Save" ? "newFileName" : "'".$fileName."'").'"); + xhr.send(\'timeStart='.numClean($_POST["timeStart"]).'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(ICEcoder.saveAsContent)); + ICEcoder.serverMessage("'.$t['Saving'].'
      " + "'.($finalAction == "Save" ? "newFileName" : "'".$fileName."'").'"); } } },10); @@ -244,8 +244,8 @@ if (!$error && $_GET['action']=="save") { /* UI dialog cancelling and saving contents for save as looparound */ if (!newFileName || newFileName && !overwriteOK) { - parent.parent.ICEcoder.saveAsContent = document.getElementById(\'saveTemp1\').value; - parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0); + ICEcoder.saveAsContent = document.getElementById(\'saveTemp1\').value; + ICEcoder.serverMessage();ICEcoder.serverQueue("del",0); }'; // =================== @@ -309,10 +309,10 @@ if (!$error && $_GET['action']=="save") { } // Write our file contents if (!ftpWriteFile($ftpConn, $ftpFilepath, $contents, $ftpMode)) { - $doNext .= 'parent.parent.ICEcoder.message("Sorry, could not write '.$ftpFilepath.' at '.$ftpHost.'");'; + $doNext .= 'ICEcoder.message("Sorry, could not write '.$ftpFilepath.' at '.$ftpHost.'");'; } else { - $doNext .= 'parent.parent.ICEcoder.openFileMDTs[parent.parent.ICEcoder.selectedTab-1]="'.$filemtime.'";'; - $doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=parent.parent.ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();parent.parent.ICEcoder.updateVersionsDisplay();'; + $doNext .= 'ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]="'.$filemtime.'";'; + $doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();ICEcoder.updateVersionsDisplay();'; } // Local saving } else { @@ -355,8 +355,8 @@ if (!$error && $_GET['action']=="save") { } clearstatcache(); $filemtime = $serverType=="Linux" ? filemtime($file) : "1000000"; - $doNext .= 'parent.parent.ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]="'.$filemtime.'";'; - $doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=parent.parent.ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();parent.parent.ICEcoder.updateVersionsDisplay();'; + $doNext .= 'ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]="'.$filemtime.'";'; + $doNext .= '(function() {var x=ICEcoder.openFileVersions; var y=ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();ICEcoder.updateVersionsDisplay();'; } // Save a version controlled backup source of the file @@ -445,30 +445,30 @@ if (!$error && $_GET['action']=="save") { // Reload file manager, rename tab & remove old file highlighting if it was a new file if (isset($_POST['newFileName']) && $_POST['newFileName']!="") { - $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'file\');'; - $doNext .= 'parent.parent.ICEcoder.renameTab(parent.parent.ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'file\');'; + $doNext .= 'ICEcoder.renameTab(ICEcoder.selectedTab,\''.$fileLoc."/".$fileName.'\');'; if (!strpos($_REQUEST['file'],"[NEW]")) { // We're saving as a new file, so unhighlight the old name in the file manager if visible $doNext .= "fileLink = ICEcoder.filesFrame.contentWindow.document.getElementById('".str_replace("/","|",$fileLoc)."|".basename($_REQUEST['file'])."');"; - $doNext .= "if (fileLink) {fileLink.style.backgroundColor = parent.parent.ICEcoder.tabBGnormal; fileLink.style.color = parent.parent.ICEcoder.tabFGnormalFile};"; + $doNext .= "if (fileLink) {fileLink.style.backgroundColor = ICEcoder.tabBGnormal; fileLink.style.color = ICEcoder.tabFGnormalFile};"; } } // Reload previewWindow window if not a Markdown file // In doing this, we check on an interval for the page to be complete and if we last saw it loading // When we are done loading, so set the loading status to false and load plugins on.. - $doNext .= 'if (parent.parent.ICEcoder.previewWindow.location && parent.parent.ICEcoder.previewWindow.location.pathname && parent.parent.ICEcoder.previewWindow.location.pathname.indexOf(".md")==-1) { - parent.parent.ICEcoder.previewWindowLoading = false; - parent.parent.ICEcoder.previewWindow.location.reload(true); + $doNext .= 'if (ICEcoder.previewWindow.location && ICEcoder.previewWindow.location.pathname && ICEcoder.previewWindow.location.pathname.indexOf(".md")==-1) { + ICEcoder.previewWindowLoading = false; + ICEcoder.previewWindow.location.reload(true); - parent.parent.ICEcoder.checkPreviewWindowLoadingInt = setInterval(function() { - if (parent.parent.ICEcoder.previewWindow.document.readyState != "loading" && parent.parent.ICEcoder.previewWindowLoading) { - parent.parent.ICEcoder.previewWindowLoading = false; - try {parent.parent.ICEcoder.doPesticide();} catch(err) {}; - try {parent.parent.ICEcoder.doStatsJS(\'save\');} catch(err) {}; - try {parent.parent.ICEcoder.doResponsive();} catch(err) {}; - clearInterval(parent.parent.ICEcoder.checkPreviewWindowLoadingInt); + ICEcoder.checkPreviewWindowLoadingInt = setInterval(function() { + if (ICEcoder.previewWindow.document.readyState != "loading" && ICEcoder.previewWindowLoading) { + ICEcoder.previewWindowLoading = false; + try {ICEcoder.doPesticide();} catch(err) {}; + try {ICEcoder.doStatsJS(\'save\');} catch(err) {}; + try {ICEcoder.doResponsive();} catch(err) {}; + clearInterval(ICEcoder.checkPreviewWindowLoadingInt); } else { - parent.parent.ICEcoder.previewWindowLoading = parent.parent.ICEcoder.previewWindow.document.readyState == "loading" ? true : false; + ICEcoder.previewWindowLoading = ICEcoder.previewWindow.document.readyState == "loading" ? true : false; } },4); @@ -476,20 +476,20 @@ if (!$error && $_GET['action']=="save") { // Copy over content to diff pane if we have that setting on $doNext .= ' - cM = parent.parent.ICEcoder.getcMInstance(); - cMdiff = parent.parent.ICEcoder.getcMdiffInstance(); - if (parent.parent.ICEcoder.updateDiffOnSave) { + cM = ICEcoder.getcMInstance(); + cMdiff = ICEcoder.getcMdiffInstance(); + if (ICEcoder.updateDiffOnSave) { cMdiff.setValue(cM.getValue()); }; '; // Finally, set previous files, indicate changes, set saved points and redo tabs $doNext .= ' - parent.parent.ICEcoder.setPreviousFiles(); + ICEcoder.setPreviousFiles(); setTimeout(function(){ICEcoder.indicateChanges()},4); - parent.parent.ICEcoder.savedPoints[parent.parent.ICEcoder.selectedTab-1] = cM.changeGeneration(); - parent.parent.ICEcoder.savedContents[parent.parent.ICEcoder.selectedTab-1] = cM.getValue(); - parent.parent.ICEcoder.redoTabHighlight(parent.parent.ICEcoder.selectedTab);'; + ICEcoder.savedPoints[ICEcoder.selectedTab-1] = cM.changeGeneration(); + ICEcoder.savedContents[ICEcoder.selectedTab-1] = cM.getValue(); + ICEcoder.redoTabHighlight(ICEcoder.selectedTab);'; // Run our custom processes include_once("../processes/on-file-save.php"); @@ -505,21 +505,21 @@ if (!$error && $_GET['action']=="save") { $doNext .= ' var loadedFile = document.createElement("textarea"); loadedFile.value = "'.str_replace('"','\\\"',str_replace("\r","\\\\r",str_replace("\n","\\\\n",str_replace("","",$loadedFile)))).'"; - var refreshFile = parent.parent.ICEcoder.ask("'.$t['Sorry, this file...'].'\\\n'.$file.'\\\n\\\n'.$t['Reload this file...'].'"); + var refreshFile = ICEcoder.ask("'.$t['Sorry, this file...'].'\\\n'.$file.'\\\n\\\n'.$t['Reload this file...'].'"); if (refreshFile) { - var cM = parent.parent.ICEcoder.getcMInstance(); - var thisTab = parent.parent.ICEcoder.selectedTab; + var cM = ICEcoder.getcMInstance(); + var thisTab = ICEcoder.selectedTab; var userVersionFile = cM.getValue(); /* Revert back to original */ cM.setValue(loadedFile.value); - parent.parent.ICEcoder.savedPoints[thisTab-1] = cM.changeGeneration(); - parent.parent.ICEcoder.savedContents[thisTab-1] = cM.getValue(); - parent.parent.ICEcoder.openFileMDTs[parent.parent.ICEcoder.selectedTab-1] = "'.$filemtime.'"; - parent.parent.ICEcoder.openFileVersions[parent.parent.ICEcoder.selectedTab-1] = "'.$fileCountInfo['count'].'"; + ICEcoder.savedPoints[thisTab-1] = cM.changeGeneration(); + ICEcoder.savedContents[thisTab-1] = cM.getValue(); + ICEcoder.openFileMDTs[ICEcoder.selectedTab-1] = "'.$filemtime.'"; + ICEcoder.openFileVersions[ICEcoder.selectedTab-1] = "'.$fileCountInfo['count'].'"; cM.clearHistory(); /* Now for the new version in the diff pane */ - parent.parent.ICEcoder.setSplitPane(\'on\'); - var cMdiff = parent.parent.ICEcoder.getcMdiffInstance(); + ICEcoder.setSplitPane(\'on\'); + var cMdiff = ICEcoder.getcMdiffInstance(); cMdiff.setValue(userVersionFile); };'; $finalAction = "nothing"; @@ -531,9 +531,9 @@ if (!$error && $_GET['action']=="save") { } else { $finalAction = "nothing"; - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot save']."\\\\n".$file."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot save']."\\\\n".$file."');"; } - $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; } }; @@ -548,7 +548,7 @@ if (!$error && $_GET['action']=="newFolder") { if (isset($ftpSite)) { $ftpFilepath = ltrim($fileLoc."/".$fileName,"/"); if (!ftpMkDir($ftpConn, octdec($ICEcoder['newDirPerms']), $ftpFilepath)) { - $doNext .= 'parent.parent.ICEcoder.message("Sorry, could not create dir '.$ftpFilepath.' at '.$ftpHost.'");'; + $doNext .= 'ICEcoder.message("Sorry, could not create dir '.$ftpFilepath.' at '.$ftpHost.'");'; } else { $updateFM = true; } @@ -560,16 +560,16 @@ if (!$error && $_GET['action']=="newFolder") { } // Update file manager on success if ($updateFM) { - $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'folder\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\',false,false,false,\'folder\');'; } $finalAction = "newFolder"; // Run our custom processes include_once("../processes/on-new-dir.php"); } else { - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot create...']."\\\\n".$fileLoc."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot create...']."\\\\n".$fileLoc."');"; $finalAction = "nothing"; } - $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ================ @@ -590,7 +590,7 @@ if (!$error && $_GET['action']=="move") { // FTP if (isset($ftpSite)) { if (!ftpRename($ftpConn, $srcDir, $tgtDir)) { - $doNext .= 'parent.parent.ICEcoder.message("Sorry, could not rename '.$srcDir.' to '.$tgtDir.'");'; + $doNext .= 'ICEcoder.message("Sorry, could not rename '.$srcDir.' to '.$tgtDir.'");'; } else { $ftpFileDirInfo = ftpGetFileInfo($ftpConn, ltrim($fileLoc,"/"), $fileName); $fileOrFolder = $ftpFileDirInfo['type'] == "directory" ? "folder" : "file"; @@ -606,20 +606,20 @@ if (!$error && $_GET['action']=="move") { } // Update file manager on success if ($updateFM) { - $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'move\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",str_replace("|","/",$_GET['oldFileName'])).'\',false,\''.$fileOrFolder.'\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'move\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",str_replace("|","/",$_GET['oldFileName'])).'\',false,\''.$fileOrFolder.'\');'; } $finalAction = "move"; // Run our custom processes include_once("../processes/on-file-dir-move.php"); } else { - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot move']."\\\\n".str_replace("|","/",$_GET['oldFileName'])."\\\\n\\\\n".$t['Maybe public write...']."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot move']."\\\\n".str_replace("|","/",$_GET['oldFileName'])."\\\\n\\\\n".$t['Maybe public write...']."');"; $finalAction = "nothing"; } } else { $doNext .= ""; $finalAction = "nothing"; } - $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ================== @@ -633,7 +633,7 @@ if (!$error && $_GET['action']=="rename") { if (isset($ftpSite)) { $ftpFilepath = ltrim($fileLoc."/".$fileName,"/"); if (!ftpRename($ftpConn, ltrim($_GET['oldFileName'],"/"), $ftpFilepath)) { - $doNext .= 'parent.parent.ICEcoder.message("Sorry, could not rename '.ltrim($_GET['oldFileName'],"/").' to '.$ftpFilepath.'");'; + $doNext .= 'ICEcoder.message("Sorry, could not rename '.ltrim($_GET['oldFileName'],"/").' to '.$ftpFilepath.'");'; } else { $updateFM = true; } @@ -644,16 +644,16 @@ if (!$error && $_GET['action']=="rename") { } // Update file manager on success if ($updateFM) { - $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",$_GET['oldFileName']).'\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",$_GET['oldFileName']).'\');'; } $finalAction = "rename"; // Run our custom processes include_once("../processes/on-file-dir-rename.php"); } else { - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot rename']."\\\\n".$_GET['oldFileName']."\\\\n\\\\n".$t['Maybe public write...']."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot rename']."\\\\n".$_GET['oldFileName']."\\\\n\\\\n".$t['Maybe public write...']."');"; $finalAction = "nothing"; } - $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ================= @@ -702,15 +702,15 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="paste") { } } // Reload file manager - $doNext .= 'parent.parent.ICEcoder.updateFileManagerList(\'add\',\''.str_replace("|","/",$_GET['location']).'\',\''.basename($dest).'\',false,false,false,\''.$fileOrFolder.'\');'; + $doNext .= 'ICEcoder.updateFileManagerList(\'add\',\''.str_replace("|","/",$_GET['location']).'\',\''.basename($dest).'\',false,false,false,\''.$fileOrFolder.'\');'; $finalAction = "pasteFile"; // Run our custom processes include_once("../processes/on-file-dir-paste.php"); } else { - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot copy']." \\\\n".str_replace($docRoot,"",$source)."\\\\n ".$t['into']." \\\\n".str_replace($docRoot,"",$dest)."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot copy']." \\\\n".str_replace($docRoot,"",$source)."\\\\n ".$t['into']." \\\\n".str_replace($docRoot,"",$dest)."');"; $finalAction = "nothing"; } - $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ============== @@ -734,10 +734,10 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="upload") { $setPerms = $ICEcoder['newFilePerms']; } if ($this->upload($current,$this->uploadFile,$setPerms)) { - $doNext .= 'parent.parent.ICEcoder.updateFileManagerList(\'add\',parent.parent.ICEcoder.selectedFiles[parent.parent.ICEcoder.selectedFiles.length-1].replace(/\|/g,\'/\'),\''.str_replace("'","\'",$fileName).'\',false,false,true,\'file\'); parent.parent.ICEcoder.serverMessage("'.$t['Uploaded file(s) OK'].'");setTimeout(function(){parent.parent.ICEcoder.serverMessage();},2000);'; + $doNext .= 'ICEcoder.updateFileManagerList(\'add\',ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,\'/\'),\''.str_replace("'","\'",$fileName).'\',false,false,true,\'file\'); ICEcoder.serverMessage("'.$t['Uploaded file(s) OK'].'");setTimeout(function(){ICEcoder.serverMessage();},2000);'; $finalAction = "upload"; } else { - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot upload']." \\\\n".$fileName."\\\\n ".$t['into']." \\\\n'+parent.parent.ICEcoder.selectedFiles[parent.parent.ICEcoder.selectedFiles.length-1].replace(/\|/g,'/'));"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot upload']." \\\\n".$fileName."\\\\n ".$t['into']." \\\\n'+ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,'/'));"; $finalAction = "nothing"; } } @@ -768,11 +768,11 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="upload") { // Run our custom processes include_once("../processes/on-file-upload.php"); } else { - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot upload...']."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot upload...']."');"; $finalAction = "nothing"; } - $doNext .= "parent.parent.ICEcoder.hideFileMenu();document.getElementById('fileInput').value='';parent.parent.ICEcoder.showHide('hide',document.getElementById('loadingMask'));"; + $doNext .= "ICEcoder.hideFileMenu();document.getElementById('fileInput').value='';ICEcoder.showHide('hide',document.getElementById('loadingMask'));"; // Upload is not handled by XHR methods, but form post, so we need to manually trigger $doNext in a script tag echo ""; @@ -793,16 +793,16 @@ if (!$error && $_GET['action']=="delete") { if (!$demoMode && ftpDelete($ftpConn,$itemType,$itemPath)) { if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";}; // Reload file manager - $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; $finalAction = "delete"; // Run our custom processes include_once("../processes/on-file-dir-delete.php"); } else { - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".$fileLoc."/".$fileName."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".$fileLoc."/".$fileName."');"; $finalAction = "nothing"; } } else { - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete more...']."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete more...']."');"; $finalAction = "nothing"; } // Local @@ -813,7 +813,7 @@ if (!$error && $_GET['action']=="delete") { $fullPath = $docRoot.$iceRoot.$fullPath; if (rtrim($fullPath,"/") == rtrim($docRoot,"/")) { - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete...']."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete...']."');"; } else if (!$demoMode && is_writable($fullPath)) { if (is_dir($fullPath)) { rrmdir($fullPath); @@ -827,17 +827,17 @@ if (!$error && $_GET['action']=="delete") { $fileLoc = dirname(str_replace($docRoot,"",$fullPath)); if ($fileLoc=="" || $fileLoc=="\\") {$fileLoc="/";}; // Reload file manager - $doNext .= 'parent.parent.ICEcoder.selectedFiles=[];parent.parent.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; + $doNext .= 'ICEcoder.selectedFiles=[];ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');'; $finalAction = "delete"; // Run our custom processes include_once("../processes/on-file-dir-delete.php"); } else { - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".str_replace($docRoot,"",$fullPath)."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot delete']."\\\\n".str_replace($docRoot,"",$fullPath)."');"; $finalAction = "nothing"; } } } - $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // The function to recursively remove folders & files @@ -879,10 +879,10 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="replaceText") { // Run our custom processes include_once("../processes/on-file-replace-text.php"); } else { - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot replace...']."\\\\n".$file."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot replace...']."\\\\n".$file."');"; $finalAction = "nothing"; } - $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ========================== @@ -896,17 +896,17 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="getRemoteFile") { $remoteFile = str_replace("\r\n", $ICEcoder["lineEnding"], $remoteFile); $remoteFile = str_replace("\r", $ICEcoder["lineEnding"], $remoteFile); $remoteFile = str_replace("\n", $ICEcoder["lineEnding"], $remoteFile); - $doNext .= 'parent.parent.ICEcoder.newTab();'; - $doNext .= 'parent.parent.ICEcoder.getcMInstance().setValue(\''.str_replace("\r","",str_replace("\t","\\\\t",str_replace("\n","\\\\n",str_replace("'","\\\\'",str_replace("\\","\\\\",preg_quote($remoteFile)))))).'\');'; - $doNext .= 'parent.parent.ICEcoder.goToLine('.$lineNumber.');'; + $doNext .= 'ICEcoder.newTab();'; + $doNext .= 'ICEcoder.getcMInstance().setValue(\''.str_replace("\r","",str_replace("\t","\\\\t",str_replace("\n","\\\\n",str_replace("'","\\\\'",str_replace("\\","\\\\",preg_quote($remoteFile)))))).'\');'; + $doNext .= 'ICEcoder.goToLine('.$lineNumber.');'; $finalAction = "getRemoteFile"; // Run our custom processes include_once("../processes/on-get-remote-file.php"); } else { $finalAction = "nothing"; - $doNext .= 'parent.parent.ICEcoder.message(\''.$t['Sorry, could not...'].' '.$file.'\');'; + $doNext .= 'ICEcoder.message(\''.$t['Sorry, could not...'].' '.$file.'\');'; } - $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ======================= @@ -920,7 +920,7 @@ if (!$error && $_GET['action']=="perms") { if (isset($ftpSite)) { $ftpFilepath = ltrim($fileLoc."/".$fileName,"/"); if (!ftpPerms($ftpConn, octdec(numClean($_GET['perms'])), $ftpFilepath)) { - $doNext .= 'parent.parent.ICEcoder.message("Sorry, could not set perms on '.$ftpFilepath.' at '.$ftpHost.'");'; + $doNext .= 'ICEcoder.message("Sorry, could not set perms on '.$ftpFilepath.' at '.$ftpHost.'");'; } else { $updateFM = true; } @@ -932,16 +932,16 @@ if (!$error && $_GET['action']=="perms") { } // Update file manager on success if ($updateFM) { - $doNext .= 'parent.parent.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');'; + $doNext .= 'ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');'; } $finalAction = "perms"; // Run our custom processes include_once("../processes/on-file-dir-perms.php"); } else { $finalAction = "nothing"; - $doNext .= "parent.parent.ICEcoder.message('".$t['Sorry, cannot change...']." \\n".$file."');"; + $doNext .= "ICEcoder.message('".$t['Sorry, cannot change...']." \\n".$file."');"; } - $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // ==================== @@ -949,10 +949,10 @@ if (!$error && $_GET['action']=="perms") { // ==================== if (!isset($ftpSite) && !$error && $_GET['action']=="checkExists") { - // This action is called under seperate AJAX call and the responseText object stored in parent.parent.ICEcoder.lastFileDirCheckStatusObj + // This action is called under seperate AJAX call and the responseText object stored in ICEcoder.lastFileDirCheckStatusObj // Nothing really done here though, we do something with the responseText $finalAction = "checkExists"; - $doNext .= 'parent.parent.ICEcoder.serverMessage();parent.parent.ICEcoder.serverQueue("del",0);'; + $doNext .= 'ICEcoder.serverMessage();ICEcoder.serverQueue("del",0);'; }; // =================== @@ -1010,7 +1010,7 @@ echo '{ "timeEnd": 0, "timeTaken": 0, "csrf": "'.xssClean($_GET['csrf'],"html").'", - "doNext" : "'.preg_replace('/\r|\n/','',str_replace(' ','',str_replace('"','\"',$doNext))).'parent.parent.ICEcoder.switchMode();" + "doNext" : "'.preg_replace('/\r|\n/','',str_replace(' ','',str_replace('"','\"',$doNext))).'ICEcoder.switchMode();" }, "status": { "error" : '.($error ? 'true' : 'false').', From 14f7b90b553c122196c50916f4a6cd0062f85b51 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sun, 1 Mar 2020 10:26:28 +0000 Subject: [PATCH 048/231] Can now click outside minimap box to jump to it --- index.php | 4 ++-- lib/ice-coder.js | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 2c4dc26..8cf1278 100644 --- a/index.php +++ b/index.php @@ -155,7 +155,7 @@ $t = $text['index'];

      -
      + @@ -352,7 +352,7 @@ $t = $text['index'];
      -
      +
      diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 6e2683d..89486fc 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1562,6 +1562,20 @@ var ICEcoder = { } }, + jumpMinimapPositon: function(e) { + var cM, mmPosY; + + cM = this.getcMInstance(); + mmPosY = e.y - get('miniMapContent').getBoundingClientRect().top - (get('miniMapBox').getBoundingClientRect().height / 2); + get("miniMapBox").style.top = mmPosY + "px"; + maxHeight = parseInt(get('docExplorer').style.height, 10) <= parseInt(get('miniMapContent').getBoundingClientRect().height, 10) + ? parseInt(get('docExplorer').style.height, 10) + : parseInt(get('miniMapContent').getBoundingClientRect().height, 10); + newPerc = (mmPosY / (maxHeight - ICEcoder.miniMapBoxHeight)); + yPos = (cM.getScrollInfo().height - cM.getScrollInfo().clientHeight) * newPerc; + cM.scrollTo(0, yPos); // this.position.y + }, + // Autocomplete autocomplete: function() { var cM, cMdiff, thisCM; From 391904702e44117fa3734b7fc7a893830e8fe73c Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 7 Mar 2020 08:02:29 +0000 Subject: [PATCH 049/231] Remove draggabilly, jump to position now possible on Minimap --- index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.php b/index.php index 8cf1278..c7e1d0a 100644 --- a/index.php +++ b/index.php @@ -76,7 +76,6 @@ $t = $text['index']; - @@ -352,7 +351,7 @@ $t = $text['index'];
      -
      +
      From 545271d74b2441ac97019ffdf34ef139958bee36 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 7 Mar 2020 08:02:57 +0000 Subject: [PATCH 050/231] Draggabilly removed, not needed now --- lib/draggabilly.pkgd.min.js | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 lib/draggabilly.pkgd.min.js diff --git a/lib/draggabilly.pkgd.min.js b/lib/draggabilly.pkgd.min.js deleted file mode 100644 index 5a796b0..0000000 --- a/lib/draggabilly.pkgd.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! - * Draggabilly PACKAGED v2.1.1 - * Make that shiz draggable - * http://draggabilly.desandro.com - * MIT license - */ - -!function(t,i){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(e){i(t,e)}):"object"==typeof module&&module.exports?module.exports=i(t,require("jquery")):t.jQueryBridget=i(t,t.jQuery)}(window,function(t,i){function e(e,r,a){function d(t,i,n){var o,r="$()."+e+'("'+i+'")';return t.each(function(t,d){var h=a.data(d,e);if(!h)return void s(e+" not initialized. Cannot call methods, i.e. "+r);var u=h[i];if(!u||"_"==i.charAt(0))return void s(r+" is not a valid method");var c=u.apply(h,n);o=void 0===o?c:o}),void 0!==o?o:t}function h(t,i){t.each(function(t,n){var o=a.data(n,e);o?(o.option(i),o._init()):(o=new r(n,i),a.data(n,e,o))})}a=a||i||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[e]=function(t){if("string"==typeof t){var i=o.call(arguments,1);return d(this,t,i)}return h(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=e)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(i||t.jQuery),e}),function(t,i){"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return i()}):"object"==typeof module&&module.exports?module.exports=i():t.getSize=i()}(window,function(){function t(t){var i=parseFloat(t),e=-1==t.indexOf("%")&&!isNaN(i);return e&&i}function i(){}function e(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},i=0;h>i;i++){var e=d[i];t[e]=0}return t}function n(t){var i=getComputedStyle(t);return i||a("Style returned "+i+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),i}function o(){if(!u){u=!0;var i=document.createElement("div");i.style.width="200px",i.style.padding="1px 2px 3px 4px",i.style.borderStyle="solid",i.style.borderWidth="1px 2px 3px 4px",i.style.boxSizing="border-box";var e=document.body||document.documentElement;e.appendChild(i);var o=n(i);r.isBoxSizeOuter=s=200==t(o.width),e.removeChild(i)}}function r(i){if(o(),"string"==typeof i&&(i=document.querySelector(i)),i&&"object"==typeof i&&i.nodeType){var r=n(i);if("none"==r.display)return e();var a={};a.width=i.offsetWidth,a.height=i.offsetHeight;for(var u=a.isBorderBox="border-box"==r.boxSizing,c=0;h>c;c++){var p=d[c],f=r[p],g=parseFloat(f);a[p]=isNaN(g)?0:g}var l=a.paddingLeft+a.paddingRight,v=a.paddingTop+a.paddingBottom,m=a.marginLeft+a.marginRight,y=a.marginTop+a.marginBottom,b=a.borderLeftWidth+a.borderRightWidth,P=a.borderTopWidth+a.borderBottomWidth,E=u&&s,_=t(r.width);_!==!1&&(a.width=_+(E?0:l+b));var x=t(r.height);return x!==!1&&(a.height=x+(E?0:v+P)),a.innerWidth=a.width-(l+b),a.innerHeight=a.height-(v+P),a.outerWidth=a.width+m,a.outerHeight=a.height+y,a}}var s,a="undefined"==typeof console?i:function(t){console.error(t)},d=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],h=d.length,u=!1;return r}),function(t,i){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",i):"object"==typeof module&&module.exports?module.exports=i():t.EvEmitter=i()}("undefined"!=typeof window?window:this,function(){function t(){}var i=t.prototype;return i.on=function(t,i){if(t&&i){var e=this._events=this._events||{},n=e[t]=e[t]||[];return-1==n.indexOf(i)&&n.push(i),this}},i.once=function(t,i){if(t&&i){this.on(t,i);var e=this._onceEvents=this._onceEvents||{},n=e[t]=e[t]||{};return n[i]=!0,this}},i.off=function(t,i){var e=this._events&&this._events[t];if(e&&e.length){var n=e.indexOf(i);return-1!=n&&e.splice(n,1),this}},i.emitEvent=function(t,i){var e=this._events&&this._events[t];if(e&&e.length){var n=0,o=e[n];i=i||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,i),n+=s?0:1,o=e[n]}return this}},t}),function(t,i){"function"==typeof define&&define.amd?define("unipointer/unipointer",["ev-emitter/ev-emitter"],function(e){return i(t,e)}):"object"==typeof module&&module.exports?module.exports=i(t,require("ev-emitter")):t.Unipointer=i(t,t.EvEmitter)}(window,function(t,i){function e(){}function n(){}var o=n.prototype=Object.create(i.prototype);o.bindStartEvent=function(t){this._bindStartEvent(t,!0)},o.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},o._bindStartEvent=function(i,e){e=void 0===e?!0:!!e;var n=e?"addEventListener":"removeEventListener";t.navigator.pointerEnabled?i[n]("pointerdown",this):t.navigator.msPointerEnabled?i[n]("MSPointerDown",this):(i[n]("mousedown",this),i[n]("touchstart",this))},o.handleEvent=function(t){var i="on"+t.type;this[i]&&this[i](t)},o.getTouch=function(t){for(var i=0;i3||Math.abs(t.y)>3},o.pointerUp=function(t,i){this.emitEvent("pointerUp",[t,i]),this._dragPointerUp(t,i)},o._dragPointerUp=function(t,i){this.isDragging?this._dragEnd(t,i):this._staticClick(t,i)},o._dragStart=function(t,e){this.isDragging=!0,this.dragStartPoint=i.getPointerPoint(e),this.isPreventingClicks=!0,this.dragStart(t,e)},o.dragStart=function(t,i){this.emitEvent("dragStart",[t,i])},o._dragMove=function(t,i,e){this.isDragging&&this.dragMove(t,i,e)},o.dragMove=function(t,i,e){t.preventDefault(),this.emitEvent("dragMove",[t,i,e])},o._dragEnd=function(t,i){this.isDragging=!1,setTimeout(function(){delete this.isPreventingClicks}.bind(this)),this.dragEnd(t,i)},o.dragEnd=function(t,i){this.emitEvent("dragEnd",[t,i])},o.onclick=function(t){this.isPreventingClicks&&t.preventDefault()},o._staticClick=function(t,i){if(!this.isIgnoringMouseUp||"mouseup"!=t.type){var e=t.target.nodeName;("INPUT"==e||"TEXTAREA"==e)&&t.target.focus(),this.staticClick(t,i),"mouseup"!=t.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400))}},o.staticClick=function(t,i){this.emitEvent("staticClick",[t,i])},n.getPointerPoint=i.getPointerPoint,n}),function(t,i){"function"==typeof define&&define.amd?define(["get-size/get-size","unidragger/unidragger"],function(e,n){return i(t,e,n)}):"object"==typeof module&&module.exports?module.exports=i(t,require("get-size"),require("unidragger")):t.Draggabilly=i(t,t.getSize,t.Unidragger)}(window,function(t,i,e){function n(){}function o(t,i){for(var e in i)t[e]=i[e];return t}function r(t){return t instanceof HTMLElement}function s(t,i){this.element="string"==typeof t?d.querySelector(t):t,f&&(this.$element=f(this.element)),this.options=o({},this.constructor.defaults),this.option(i),this._create()}function a(t,i,e){return e=e||"round",i?Math[e](t/i)*i:t}var d=t.document,h=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame,u=0;h||(h=function(t){var i=(new Date).getTime(),e=Math.max(0,16-(i-u)),n=setTimeout(t,e);return u=i+e,n});var c=d.documentElement,p="string"==typeof c.style.transform?"transform":"WebkitTransform",f=t.jQuery,g=s.prototype=Object.create(e.prototype);s.defaults={},g.option=function(t){o(this.options,t)};var l={relative:!0,absolute:!0,fixed:!0};return g._create=function(){this.position={},this._getPosition(),this.startPoint={x:0,y:0},this.dragPoint={x:0,y:0},this.startPosition=o({},this.position);var t=getComputedStyle(this.element);l[t.position]||(this.element.style.position="relative"),this.enable(),this.setHandles()},g.setHandles=function(){this.handles=this.options.handle?this.element.querySelectorAll(this.options.handle):[this.element],this.bindHandles()},g.dispatchEvent=function(i,e,n){var o=[e].concat(n);this.emitEvent(i,o);var r=t.jQuery;if(r&&this.$element)if(e){var s=r.Event(e);s.type=i,this.$element.trigger(s,n)}else this.$element.trigger(i,n)},g._getPosition=function(){var t=getComputedStyle(this.element),i=this._getPositionCoord(t.left,"width"),e=this._getPositionCoord(t.top,"height");this.position.x=isNaN(i)?0:i,this.position.y=isNaN(e)?0:e,this._addTransformPosition(t)},g._getPositionCoord=function(t,e){if(-1!=t.indexOf("%")){var n=i(this.element.parentNode);return n?parseFloat(t)/100*n[e]:0}return parseInt(t,10)},g._addTransformPosition=function(t){var i=t[p];if(0===i.indexOf("matrix")){var e=i.split(","),n=0===i.indexOf("matrix3d")?12:4,o=parseInt(e[n],10),r=parseInt(e[n+1],10);this.position.x+=o,this.position.y+=r}},g.pointerDown=function(t,i){this._dragPointerDown(t,i);var e=d.activeElement;e&&e.blur&&e!=d.body&&e.blur(),this._bindPostStartEvents(t),this.element.classList.add("is-pointer-down"),this.dispatchEvent("pointerDown",t,[i])},g.pointerMove=function(t,i){var e=this._dragPointerMove(t,i);this.dispatchEvent("pointerMove",t,[i,e]),this._dragMove(t,i,e)},g.dragStart=function(t,i){this.isEnabled&&(this._getPosition(),this.measureContainment(),this.startPosition.x=this.position.x,this.startPosition.y=this.position.y,this.setLeftTop(),this.dragPoint.x=0,this.dragPoint.y=0,this.element.classList.add("is-dragging"),this.dispatchEvent("dragStart",t,[i]),this.animate())},g.measureContainment=function(){var t=this.options.containment;if(t){var e=r(t)?t:"string"==typeof t?d.querySelector(t):this.element.parentNode,n=i(this.element),o=i(e),s=this.element.getBoundingClientRect(),a=e.getBoundingClientRect(),h=o.borderLeftWidth+o.borderRightWidth,u=o.borderTopWidth+o.borderBottomWidth,c=this.relativeStartPosition={x:s.left-(a.left+o.borderLeftWidth),y:s.top-(a.top+o.borderTopWidth)};this.containSize={width:o.width-h-c.x-n.width,height:o.height-u-c.y-n.height}}},g.dragMove=function(t,i,e){if(this.isEnabled){var n=e.x,o=e.y,r=this.options.grid,s=r&&r[0],d=r&&r[1];n=a(n,s),o=a(o,d),n=this.containDrag("x",n,s),o=this.containDrag("y",o,d),n="y"==this.options.axis?0:n,o="x"==this.options.axis?0:o,this.position.x=this.startPosition.x+n,this.position.y=this.startPosition.y+o,this.dragPoint.x=n,this.dragPoint.y=o,this.dispatchEvent("dragMove",t,[i,e])}},g.containDrag=function(t,i,e){if(!this.options.containment)return i;var n="x"==t?"width":"height",o=this.relativeStartPosition[t],r=a(-o,e,"ceil"),s=this.containSize[n];return s=a(s,e,"floor"),Math.min(s,Math.max(r,i))},g.pointerUp=function(t,i){this.element.classList.remove("is-pointer-down"),this.dispatchEvent("pointerUp",t,[i]),this._dragPointerUp(t,i)},g.dragEnd=function(t,i){this.isEnabled&&(p&&(this.element.style[p]="",this.setLeftTop()),this.element.classList.remove("is-dragging"),this.dispatchEvent("dragEnd",t,[i]))},g.animate=function(){if(this.isDragging){this.positionDrag();var t=this;h(function(){t.animate()})}},g.setLeftTop=function(){this.element.style.left=this.position.x+"px",this.element.style.top=this.position.y+"px"},g.positionDrag=function(){this.element.style[p]="translate3d( "+this.dragPoint.x+"px, "+this.dragPoint.y+"px, 0)"},g.staticClick=function(t,i){this.dispatchEvent("staticClick",t,[i])},g.enable=function(){this.isEnabled=!0},g.disable=function(){this.isEnabled=!1,this.isDragging&&this.dragEnd()},g.destroy=function(){this.disable(),this.element.style[p]="",this.element.style.left="",this.element.style.top="",this.element.style.position="",this.unbindHandles(),this.$element&&this.$element.removeData("draggabilly")},g._init=n,f&&f.bridget&&f.bridget("draggabilly",s),s}); \ No newline at end of file From 05ddbf33eff10653540e2c1f56ea166475d3609f Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 7 Mar 2020 09:11:32 +0000 Subject: [PATCH 051/231] Can now click on minimap to scroll, not using Draggabilly --- index.php | 2 +- lib/ice-coder.js | 61 ++++++++++++++++++------------------------------ 2 files changed, 24 insertions(+), 39 deletions(-) diff --git a/index.php b/index.php index c7e1d0a..4f05931 100644 --- a/index.php +++ b/index.php @@ -351,7 +351,7 @@ $t = $text['index'];
      -
      +
      diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 89486fc..c930830 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1492,29 +1492,7 @@ var ICEcoder = { get('miniMapContainer').innerHTML = '
      '; - - var elem = get('miniMapBox'); - var draggie = new Draggabilly( elem, { - axis: 'y', - containment: true - }); - - draggie.on( 'dragMove', function( event, pointer, moveVector ) { - yPos = this.position.y; - maxHeight = parseInt(get('docExplorer').style.height,10) <= parseInt(get('miniMapContent').getBoundingClientRect().height,10) - ? parseInt(get('docExplorer').style.height,10) - : parseInt(get('miniMapContent').getBoundingClientRect().height,10); - newPerc = (this.position.y/(maxHeight-ICEcoder.miniMapBoxHeight)); - yPos = (cM.getScrollInfo().height-cM.getScrollInfo().clientHeight)*newPerc; - cM.scrollTo(0,yPos); // this.position.y - }); - draggie.on( 'pointerDown', function( event, pointer ) { - ICEcoder.mouseDownMinimap = true; - }); - draggie.on( 'pointerUp', function( event, pointer ) { - ICEcoder.mouseDownMinimap = false; - }); + this.miniMapBoxHeight+'px; background: rgba(0,198,255,0.1); pointer-events: none; z-index: 1" id="miniMapBox">'; this.setMinimapLayout(cM); @@ -1527,11 +1505,9 @@ var ICEcoder = { // If we've got a minimap box ready if (get('miniMapBox') && thisCM) { - // Get CM instance and percentage through document cM = this.getcMInstance(); percThru = thisCM.getScrollInfo().top/(thisCM.getScrollInfo().height-thisCM.getScrollInfo().clientHeight); - // If content to display has a greater height than docExplorer if (parseInt(get('miniMapContent').getBoundingClientRect().height,10) > parseInt(get('docExplorer').style.height,10)) { // Set the minimap container to same height @@ -1555,25 +1531,34 @@ var ICEcoder = { // Set the minimap position to 0 get('miniMapContent').style.marginTop = 0; } - // Can set the Minimap nav position if not dragging it (let Draggabilly handle that) - if (!this.mouseDownMinimap) { - get('miniMapBox').style.top = this.miniMapBoxTop + "px"; - } } }, jumpMinimapPositon: function(e) { var cM, mmPosY; - cM = this.getcMInstance(); - mmPosY = e.y - get('miniMapContent').getBoundingClientRect().top - (get('miniMapBox').getBoundingClientRect().height / 2); - get("miniMapBox").style.top = mmPosY + "px"; - maxHeight = parseInt(get('docExplorer').style.height, 10) <= parseInt(get('miniMapContent').getBoundingClientRect().height, 10) - ? parseInt(get('docExplorer').style.height, 10) - : parseInt(get('miniMapContent').getBoundingClientRect().height, 10); - newPerc = (mmPosY / (maxHeight - ICEcoder.miniMapBoxHeight)); - yPos = (cM.getScrollInfo().height - cM.getScrollInfo().clientHeight) * newPerc; - cM.scrollTo(0, yPos); // this.position.y + if (ICEcoder.mouseDownMinimap) { + // console.log(Date.now() - ICEcoder.lastScrollTS); + cM = this.getcMInstance(); + mmPosY = e.y - get('miniMapContainer').getBoundingClientRect().top - (get('miniMapBox').getBoundingClientRect().height / 2); + if (mmPosY > get('miniMapContainer').getBoundingClientRect().height - get('miniMapBox').getBoundingClientRect().height) { + // console.log("YES"); + mmPosY = get('miniMapContainer').getBoundingClientRect().height - get('miniMapBox').getBoundingClientRect().height; + } + if (mmPosY < 0) { + mmPosY = 0; + } + get("miniMapBox").style.top = mmPosY + "px"; + maxHeight = parseInt(get('docExplorer').style.height, 10) <= parseInt(get('miniMapContainer').getBoundingClientRect().height, 10) + ? parseInt(get('docExplorer').style.height, 10) + : parseInt(get('miniMapContainer').getBoundingClientRect().height, 10); + newPerc = (mmPosY / (maxHeight - ICEcoder.miniMapBoxHeight)); + yPos = (cM.getScrollInfo().height - cM.getScrollInfo().clientHeight) * newPerc; + cM.scrollTo(0, yPos); // this.position.y + } + if (e.buttons === 0) { + ICEcoder.mouseDownMinimap = false; + } }, // Autocomplete From 677c9eee87a03a361b4be7f140612834542fbd46 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 7 Mar 2020 09:33:26 +0000 Subject: [PATCH 052/231] Function cleanup --- lib/ice-coder.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index c930830..0fd29b7 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1538,24 +1538,28 @@ var ICEcoder = { var cM, mmPosY; if (ICEcoder.mouseDownMinimap) { - // console.log(Date.now() - ICEcoder.lastScrollTS); cM = this.getcMInstance(); + // Set mid height position mmPosY = e.y - get('miniMapContainer').getBoundingClientRect().top - (get('miniMapBox').getBoundingClientRect().height / 2); + // Unless it would be beyond bottom, if so, set to bottom if (mmPosY > get('miniMapContainer').getBoundingClientRect().height - get('miniMapBox').getBoundingClientRect().height) { - // console.log("YES"); mmPosY = get('miniMapContainer').getBoundingClientRect().height - get('miniMapBox').getBoundingClientRect().height; } + // Unless it would be beyond top, if so, set to top if (mmPosY < 0) { mmPosY = 0; } get("miniMapBox").style.top = mmPosY + "px"; - maxHeight = parseInt(get('docExplorer').style.height, 10) <= parseInt(get('miniMapContainer').getBoundingClientRect().height, 10) + // Set the max height to be that of doc explorer, or if less, the content height + maxHeight = parseInt(get('docExplorer').style.height, 10) <= parseInt(get('miniMapContent').getBoundingClientRect().height, 10) ? parseInt(get('docExplorer').style.height, 10) - : parseInt(get('miniMapContainer').getBoundingClientRect().height, 10); + : parseInt(get('miniMapContent').getBoundingClientRect().height, 10); + // Work out the new percentag, from that yPos and set CM scroll position to that newPerc = (mmPosY / (maxHeight - ICEcoder.miniMapBoxHeight)); yPos = (cM.getScrollInfo().height - cM.getScrollInfo().clientHeight) * newPerc; cM.scrollTo(0, yPos); // this.position.y } + // If mouse buttons up, we no longer have mouse down on minimap if (e.buttons === 0) { ICEcoder.mouseDownMinimap = false; } From 5e01231c09ca8f0923ba27b66d9916d4ee0d7871 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 7 Mar 2020 10:33:13 +0000 Subject: [PATCH 053/231] Set cursor when over miniMapBox --- index.php | 2 +- lib/ice-coder.js | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 4f05931..e8ba009 100644 --- a/index.php +++ b/index.php @@ -351,7 +351,7 @@ $t = $text['index'];
      -
      +
      diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 0fd29b7..55f3b5e 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1496,6 +1496,9 @@ var ICEcoder = { this.setMinimapLayout(cM); + ICEcoder.mouseDownMinimap = true; + this.jumpMinimapPositon(400, 0); + get('docExplorer').style.right = "-220px"; } }, @@ -1534,13 +1537,13 @@ var ICEcoder = { } }, - jumpMinimapPositon: function(e) { + jumpMinimapPositon: function(yPos, buttons) { var cM, mmPosY; if (ICEcoder.mouseDownMinimap) { cM = this.getcMInstance(); // Set mid height position - mmPosY = e.y - get('miniMapContainer').getBoundingClientRect().top - (get('miniMapBox').getBoundingClientRect().height / 2); + mmPosY = yPos - get('miniMapContainer').getBoundingClientRect().top - (get('miniMapBox').getBoundingClientRect().height / 2); // Unless it would be beyond bottom, if so, set to bottom if (mmPosY > get('miniMapContainer').getBoundingClientRect().height - get('miniMapBox').getBoundingClientRect().height) { mmPosY = get('miniMapContainer').getBoundingClientRect().height - get('miniMapBox').getBoundingClientRect().height; @@ -1560,7 +1563,7 @@ var ICEcoder = { cM.scrollTo(0, yPos); // this.position.y } // If mouse buttons up, we no longer have mouse down on minimap - if (e.buttons === 0) { + if (buttons === 0) { ICEcoder.mouseDownMinimap = false; } }, @@ -2888,6 +2891,16 @@ var ICEcoder = { } this.dragCursorTest(); if (this.mouseY>62) {this.setTabWidths();}; + + if (get("miniMapBox")) { + var mmBoxBCR = get("miniMapBox").getBoundingClientRect(); + if ( + mmBoxBCR.left <= this.mouseX && mmBoxBCR.top <= this.mouseY && + mmBoxBCR.right >= this.mouseX && mmBoxBCR.bottom >= this.mouseY + ) { + document.body.style.cursor = "pointer"; + } + } }, // Test if we need to show a drag cursor or not From f9c62d578c0146bf038beb96c5792d02f3fb3ab3 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 7 Mar 2020 11:14:16 +0000 Subject: [PATCH 054/231] Focus on editor after letting go of minimap --- index.php | 2 +- lib/ice-coder.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index e8ba009..2dfa226 100644 --- a/index.php +++ b/index.php @@ -351,7 +351,7 @@ $t = $text['index'];
      -
      +
      diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 55f3b5e..963d59f 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1496,8 +1496,8 @@ var ICEcoder = { this.setMinimapLayout(cM); - ICEcoder.mouseDownMinimap = true; - this.jumpMinimapPositon(400, 0); + // ICEcoder.mouseDownMinimap = true; + // this.jumpMinimapPositon(400, 0); get('docExplorer').style.right = "-220px"; } From 1ad816a441c52709c9a6f6dd0124d8787b6f1fd0 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sun, 8 Mar 2020 08:58:31 +0000 Subject: [PATCH 055/231] Remove scroll styles from LiquiByte theme --- CodeMirror/theme/liquibyte.css | 36 ---------------------------------- 1 file changed, 36 deletions(-) diff --git a/CodeMirror/theme/liquibyte.css b/CodeMirror/theme/liquibyte.css index 9db8bde..a1cd3c7 100644 --- a/CodeMirror/theme/liquibyte.css +++ b/CodeMirror/theme/liquibyte.css @@ -57,39 +57,3 @@ .cm-s-liquibyte .CodeMirror span.CodeMirror-matchingbracket { color: #0f0; font-weight: bold; } .cm-s-liquibyte .CodeMirror span.CodeMirror-nonmatchingbracket { color: #f00; font-weight: bold; } .CodeMirror-matchingtag { background-color: rgba(150, 255, 0, .3); } -/* Scrollbars */ -/* Simple */ -.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div:hover, div.CodeMirror-simplescroll-vertical div:hover { - background-color: rgba(80, 80, 80, .7); -} -.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div, div.CodeMirror-simplescroll-vertical div { - background-color: rgba(80, 80, 80, .3); - border: 1px solid #404040; - border-radius: 5px; -} -.cm-s-liquibyte div.CodeMirror-simplescroll-vertical div { - border-top: 1px solid #404040; - border-bottom: 1px solid #404040; -} -.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div { - border-left: 1px solid #404040; - border-right: 1px solid #404040; -} -.cm-s-liquibyte div.CodeMirror-simplescroll-vertical { - background-color: #262626; -} -.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal { - background-color: #262626; - border-top: 1px solid #404040; -} -/* Overlay */ -.cm-s-liquibyte div.CodeMirror-overlayscroll-horizontal div, div.CodeMirror-overlayscroll-vertical div { - background-color: #404040; - border-radius: 5px; -} -.cm-s-liquibyte div.CodeMirror-overlayscroll-vertical div { - border: 1px solid #404040; -} -.cm-s-liquibyte div.CodeMirror-overlayscroll-horizontal div { - border: 1px solid #404040; -} From 3897b6ba6fde70b08e30e8bc29dee1bee062bf58 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sun, 8 Mar 2020 08:58:58 +0000 Subject: [PATCH 056/231] Update simplescrollbars.css --- CodeMirror/addon/scroll/simplescrollbars.css | 81 +++++++++----------- 1 file changed, 37 insertions(+), 44 deletions(-) diff --git a/CodeMirror/addon/scroll/simplescrollbars.css b/CodeMirror/addon/scroll/simplescrollbars.css index d8a6d69..5f03ab4 100644 --- a/CodeMirror/addon/scroll/simplescrollbars.css +++ b/CodeMirror/addon/scroll/simplescrollbars.css @@ -1,68 +1,61 @@ -.CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div { - position: absolute; - background: #ccc; - -moz-box-sizing: border-box; - box-sizing: border-box; - border: 1px solid #bbb; - border-radius: 2px; -} +/* General styles */ -.CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical { - position: absolute; - z-index: 6; - background: #eee; +.CodeMirror-simplescroll-horizontal, +.CodeMirror-overlayscroll-horizontal { + bottom: 0; + left: 0; + height: 12px; } - -.CodeMirror-simplescroll-horizontal { - bottom: 0; left: 0; - height: 8px; -} -.CodeMirror-simplescroll-horizontal div { +.CodeMirror-simplescroll-horizontal div, +.CodeMirror-overlayscroll-horizontal div { bottom: 0; height: 100%; } -.CodeMirror-simplescroll-vertical { - right: 0; top: 0; - width: 8px; +.CodeMirror-simplescroll-vertical, +.CodeMirror-overlayscroll-vertical{ + right: 0; + top: 0; + width: 12px; } -.CodeMirror-simplescroll-vertical div { +.CodeMirror-simplescroll-vertical div, +.CodeMirror-overlayscroll-vertical div { right: 0; width: 100%; } +/* Simple specific styles*/ -.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler { - display: none; - background: transparent; -} - -.CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div { +.CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical { position: absolute; - background: rgba(0,198,255,0.1); - border-radius: 0; + background: #222; + z-index: 6; } +.CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div { + position: absolute; + -moz-box-sizing: border-box; + box-sizing: border-box; + background: #888; +} + +.CodeMirror-simplescroll .CodeMirror-scrollbar-filler, .CodeMirror-simplescroll .CodeMirror-gutter-filler { + background: #222; +} + +/* Overlay specific styles */ + .CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical { position: absolute; z-index: 6; } -.CodeMirror-overlayscroll-horizontal { - bottom: 0; left: 0; - height: 12px; -} -.CodeMirror-overlayscroll-horizontal div { - bottom: 0; - height: 100%; +.CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div { + position: absolute; + background: rgba(0,198,255,0.2); } -.CodeMirror-overlayscroll-vertical { - right: 0; top: 0; - width: 6px; -} -.CodeMirror-overlayscroll-vertical div { +.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler { display: none; - right: 0; - width: 100%; + background: transparent; } From 11e8d3aadf6f1b70e26550d4ec8de9a2b73e93b9 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sun, 8 Mar 2020 09:02:12 +0000 Subject: [PATCH 057/231] Remove docexplorer, minimap and class list plus icons --- index.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/index.php b/index.php index 2dfa226..1a7ace1 100644 --- a/index.php +++ b/index.php @@ -323,8 +323,6 @@ $t = $text['index'];
      - - ">
      @@ -350,11 +348,6 @@ $t = $text['index'];
      -
      -
      -
      -
      - '; };?> - -/addon/fold/foldgutter.css?microtime="> -/addon/scroll/simplescrollbars.css?microtime="> '; @@ -54,6 +51,9 @@ if (array_search($ICEcoder["theme"],array("3024-day","base16-light","eclipse","e $activeLineBG = "#000"; } ?>"> + +/addon/fold/foldgutter.css?microtime="> +/addon/scroll/simplescrollbars.css?microtime="> + ICEcoder v <?php echo $ICEcoder["versionNo"];?> file manager + + + + + + + - +
      -parent.ICEcoder.setSplitPane('on');"; - } - echo '
      '; -} -?> From 46f4067511981cba5ca8b9fb1fe6b953c7e7bde1 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 14 Mar 2020 07:41:19 +0000 Subject: [PATCH 077/231] scrollbarStyle added, GitHub removed plus commented services gone --- index.php | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/index.php b/index.php index 0d50872..515099f 100644 --- a/index.php +++ b/index.php @@ -106,6 +106,7 @@ $t = $text['index']; "ICEcoder.indentWithTabs = ".($ICEcoder["indentWithTabs"] ? 'true' : 'false').";". "ICEcoder.indentAuto = ".($ICEcoder["indentAuto"] ? 'true' : 'false').";". "ICEcoder.indentSize = ".$ICEcoder["indentSize"].";". + "ICEcoder.scrollbarStyle = '".$ICEcoder["scrollbarStyle"]."';". "ICEcoder.demoMode = ".($ICEcoder["demoMode"] ? 'true' : 'false').";". "ICEcoder.tagWrapperCommand = '".$ICEcoder["tagWrapperCommand"]."';". "ICEcoder.autoComplete = '".$ICEcoder["autoComplete"]."';". @@ -115,10 +116,6 @@ $t = $text['index']; "ICEcoder.fileDirResOutput = '".$ICEcoder["fileDirResOutput"]."';". "ICEcoder.newDirPerms = ".$ICEcoder["newDirPerms"].";". "ICEcoder.newFilePerms = ".$ICEcoder["newFilePerms"].";"; - if($ICEcoder["githubAuthToken"] != "") { - $_SESSION['githubAuthToken'] = $ICEcoder["githubAuthToken"]; - echo "ICEcoder.githubAuthTokenSet = true;"; - } echo "ICEcoder.csrf = '".$_SESSION["csrf"]."';"; ?>ICEcoder.init();ICEcoder.content.style.visibility='visible';ICEcoder.filesFrame.contentWindow.frames['processControl'].location.href = iceLoc+'/processes/on-load.php';" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="ICEcoder.resetKeys(event);" onBlur="ICEcoder.resetKeys(event);"> @@ -195,11 +192,6 @@ $t = $text['index'];
    -
    -
    Commit
    -
    Selected: 0
    -
    Pull
    -
    From 440c7cbb8b3fa82282b3974ca5c58e0a3a196ac6 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 14 Mar 2020 08:31:20 +0000 Subject: [PATCH 078/231] Backup versions theme and scrollbars set, rejig order --- lib/backup-versions.php | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/lib/backup-versions.php b/lib/backup-versions.php index 0921d02..39aa19d 100644 --- a/lib/backup-versions.php +++ b/lib/backup-versions.php @@ -40,22 +40,14 @@ $versions = $fileCountInfo['count']; .CodeMirror-foldgutter-folded {background: #800; color: #ddd} .CodeMirror-foldgutter-folded:after {position: relative; top: -3px} + /addon/fold/foldgutter.css?microtime="> - -'.PHP_EOL; -} -?> +/addon/scroll/simplescrollbars.css?microtime="> @@ -124,10 +116,11 @@ var editor = CodeMirror.fromTextArea(document.getElementById("code"), { matchBrackets: parent.parent.ICEcoder.matchBrackets, electricChars: false, highlightSelectionMatches: true, + scrollbarStyle: parent.parent.ICEcoder.scrollbarStyle, showTrailingSpace: parent.parent.ICEcoder.showTrailingSpace, lint: false, readOnly: "nocursor", - theme: "" + theme: parent.parent.ICEcoder.theme }); editor.setSize("480px","500px"); From 18e57c4b43df07a16344768a057612ec3cae7193 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 14 Mar 2020 08:33:55 +0000 Subject: [PATCH 079/231] Remove GitHub related items from FTP and FM --- lib/file-control.php | 36 ------------------------------------ lib/ftp-manager.php | 2 +- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/lib/file-control.php b/lib/file-control.php index 8f3475c..fd59340 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -4,10 +4,6 @@ include("settings.php"); include("ftp-control.php"); $t = $text['file-control']; ?> - - - - "; } - $githubAuthTokenSet = $ICEcoder["githubAuthToken"] != "" ? "true" : "false"; - // If we've changed langugage, reload ICEcoder now if ($languageUserChanged) { echo ''; @@ -123,5 +121,5 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset // With all that worked out, we can now hide the settings screen and apply the new settings $jsBugFilePaths = "['".str_replace(",","','",str_replace(" ","",$_POST['bugFilePaths']))."']"; - echo ""; + echo ""; } From 9a809f918150fce5854c83c6ff4f86d319251825 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 14 Mar 2020 08:47:30 +0000 Subject: [PATCH 081/231] Scrollbar style setting added, remove GitHub token setting --- lib/settings-screen.php | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/settings-screen.php b/lib/settings-screen.php index 2619e1c..b3f4a94 100644 --- a/lib/settings-screen.php +++ b/lib/settings-screen.php @@ -55,7 +55,7 @@ for ($i=0;$i
    :
    - https://github.com/mattpass/ICEcoder + https://github.com/icecoder/ICEcoder

    :
    @@ -77,7 +77,7 @@ for ($i=0;$iTwitter
    Facebook
    Google Groups
    - GitHub
    + GitHub
    Email

    @@ -272,6 +272,16 @@ function findSequence(goal) {


    +
    +
    + +
    +

    +


    @@ -328,11 +338,6 @@ function findSequence(goal) { } echo ' onclick="showButton()" id="enableRegistration"> '.$t['Registration'].' '; ?> -

    - -

    github


    - [?]   Personal Access Token   Client/Secret Pair Token
    - " autocomplete="off">
    \n",get("git").innerHTML=a+"

    "},updatePreviewWindow:function(a,b,c,d){ICEcoder.previewWindow.location.pathname== - b?-1<["htm","html","txt"].indexOf(d)?ICEcoder.previewWindow.document.documentElement.innerHTML=a.getValue():-1<["md"].indexOf(d)&&(ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(a.getValue())):-1<["css"].indexOf(d)&&-1/g,""); - a.setValue(b);a.clearHistory();ICEcoder.savedPoints[ICEcoder.selectedTab-1]=a.changeGeneration();ICEcoder.savedContents[ICEcoder.selectedTab-1]=a.getValue()},undo:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.getcMdiffInstance();(-1=f.line;b--)e.replaceRange(e.getLine(b),{line:b+1,ch:0},{line:b+1,ch:1E6});e.replaceRange(l,{line:"up"==a?g.line:f.line,ch:0},{line:"up"==a?g.line:f.line,ch:1E6});e.setSelection({line:f.line+("up"==a?-1:1),ch:f.ch},{line:g.line+("up"==a?-1:1),ch:g.ch})})}},highlightLine:function(a){var b=ICEcoder.getcMInstance();var c= - ICEcoder.getcMdiffInstance();b=-1\n"+ - d.getSelection()+"\n","around");for(var a=e+1;a<=f+1;a++)d.indentLine(a);d.indentLine(f+2,"prev");d.indentLine(f+2,"subtract")})}else-1<["p","a","h1","h2","h3"].indexOf(a)&&d.getSelection().substr(0,a.length+1)=="<"+b&&d.getSelection().substr(-(a.length+3))==""?d.replaceSelection(d.getSelection().substr(d.getSelection().indexOf(">")+1,d.getSelection().length-d.getSelection().indexOf(">")-1-a.length-3),"around"):("a"==a&&(b='a href=""'),d.replaceSelection("<"+b+">"+d.getSelection()+"","around"),"a"==a&&d.setCursor({line:d.getCursor("start").line,ch:d.getCursor("start").ch+9}))},addLineBreakAtEnd:function(a){var b=ICEcoder.getcMInstance();var c=ICEcoder.getcMdiffInstance();b=-1",{line:a,ch:0},{line:a,ch:1E6})},insertLineBefore:function(a){var b=ICEcoder.getcMInstance();var c=ICEcoder.getcMdiffInstance();var d=-1'+ICEcoder.functionClassList[b].name+'
    '+ICEcoder.functionClassList[b].params+"");get("functionClassList").innerHTML=a},0))},updateFunctionClassListItems:function(a){var b=ICEcoder.getcMInstance();var c="";-1< - a.text.indexOf("function ")&&-1'+get("miniMapContent").innerHTML+"";get("miniMapContent").innerHTML=get("miniMapContent").innerHTML.replace(/';var b=get("miniMapBox"); - b=new Draggabilly(b,{axis:"y",containment:!0});b.on("dragMove",function(b,d,e){yPos=this.position.y;maxHeight=parseInt(get("docExplorer").style.height,10)<=parseInt(get("miniMapContent").getBoundingClientRect().height,10)?parseInt(get("docExplorer").style.height,10):parseInt(get("miniMapContent").getBoundingClientRect().height,10);newPerc=this.position.y/(maxHeight-ICEcoder.miniMapBoxHeight);yPos=(a.getScrollInfo().height-a.getScrollInfo().clientHeight)*newPerc;a.scrollTo(0,yPos)});b.on("pointerDown", - function(a,b){ICEcoder.mouseDownMinimap=!0});b.on("pointerUp",function(a,b){ICEcoder.mouseDownMinimap=!1});ICEcoder.setMinimapLayout(a);get("docExplorer").style.right="-220px"}},setMinimapLayout:function(a,b){if(get("miniMapBox")&&a){var c=ICEcoder.getcMInstance();var d=a.getScrollInfo().top/(a.getScrollInfo().height-a.getScrollInfo().clientHeight);parseInt(get("miniMapContent").getBoundingClientRect().height,10)>parseInt(get("docExplorer").style.height,10)?(get("miniMapContainer").style.height=parseInt(get("docExplorer").style.height, - 10)+"px",ICEcoder.miniMapBoxHeight=parseInt(get("docExplorer").style.height,10)/c.defaultTextHeight()*2,get("miniMapBox").style.height=ICEcoder.miniMapBoxHeight+"px",ICEcoder.miniMapBoxTop=d*parseInt(get("docExplorer").style.height,10)-d*ICEcoder.miniMapBoxHeight,get("miniMapContent").style.marginTop=-(parseInt(get("miniMapContent").getBoundingClientRect().height,10)-parseInt(get("docExplorer").style.height,10))*d+"px"):(get("miniMapContainer").style.height=parseInt(get("miniMapContent").getBoundingClientRect().height, - 10)+"px",ICEcoder.miniMapBoxHeight=parseInt(get("docExplorer").style.height,10)/c.defaultTextHeight()*2,get("miniMapBox").style.height=ICEcoder.miniMapBoxHeight+"px",ICEcoder.miniMapBoxTop=d*parseInt(get("miniMapContainer").getBoundingClientRect().height,10)-d*ICEcoder.miniMapBoxHeight,get("miniMapContent").style.marginTop=0);ICEcoder.mouseDownMinimap||(get("miniMapBox").style.top=ICEcoder.miniMapBoxTop+"px")}},autocomplete:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.getcMdiffInstance(); - a=-1g.replace(/\d+/g,f)?d:g;if(0d&&("LI"!=b.childNodes[d].nodeName&&d++,e=b.childNodes[d].childNodes[0].childNodes[1],e.id==c&&(a=!0),1==a&&-1==ICEcoder.selectedFiles.indexOf(e.id)&&(ICEcoder.selectDeselectFile("select",e),ICEcoder.selectedFiles.push(e.id)),e.id!=g);d+=2);else ICEcoder.selectDeselectFile("select",e),ICEcoder.selectedFiles.push(d)}else ICEcoder.deselectAllFiles(),ICEcoder.selectDeselectFile("select",e),ICEcoder.selectedFiles.push(d)}ICEcoder.githubDiff&&(get("githubNavSelectedCount").innerHTML= - "Selected: "+ICEcoder.selectedFiles.length,get("githubNavCommit").style.color=0"+t["Creating Folder"]+"
    "+a)},returnFileAndLine:function(a){var b= - 1,c=/^([^ ]*)\s+(on\s+)?(line\s+)?(\d+)/.exec(a);null!==c?(b=c[4],a=c[1]):0"+t["Opening File"]+"
    "+ICEcoder.shortURL)):ICEcoder.createNewTab("new"),ICEcoder.fMIconVis("fMView",1))}},openFilesFromList:function(a){for(var b=0;b"+t.Getting+"
    "+a)},getChangesToSave:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.savedContents[ICEcoder.selectedTab- - 1];a=difflib.stringAsLines(a.getValue());b=difflib.stringAsLines(b);b=(new difflib.SequenceMatcher(b,a)).get_opcodes();for(var c=0;c"+t.Saving+"
    "+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(iceRoot,""))},renameFile:function(a, - b){if(a)var c=a.replace(/\|/g,"/");else c=ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"),a=ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/");b||(b=ICEcoder.getInput(t["Please enter the..."],c));if(b){var d=ICEcoder.openFiles.indexOf(c.replace(/\|/g,"/"));-1', - c=ICEcoder.openFiles[d],get("tab"+(d+1)).innerHTML=closeTabLink+" "+c.slice(c.lastIndexOf("/")).replace(/\//,""),get("tab"+(d+1)).title=b);ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=rename&oldFileName="+encodeURIComponent(a.replace(/\|/g,"/"))+"&csrf="+ICEcoder.csrf,encodeURIComponent(b));ICEcoder.serverMessage(""+t["Renaming to"]+"
    "+b);ICEcoder.setPreviousFiles()}},moveFile:function(a,b){if(b&&b!=a){var c=ICEcoder.openFiles.indexOf(a.replace(/\|/g,"/"));if(-1< - c){ICEcoder.openFiles[c]=b;closeTabLink='';var d=ICEcoder.openFiles[c];get("tab"+(c+1)).innerHTML=closeTabLink+" "+d.slice(d.lastIndexOf("/")).replace(/\//,"");get("tab"+ - (c+1)).title=b}ICEcoder.ask("Are you sure you want to move file "+a+" to "+b+" ?")&&(ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=move&oldFileName="+encodeURIComponent(a.replace(/\//g,"|"))+"&csrf="+ICEcoder.csrf,encodeURIComponent(b.replace(/\//g,"|"))),ICEcoder.serverMessage(""+t["Moving to"]+"
    "+b));ICEcoder.setPreviousFiles()}},deleteFiles:function(a){a=a?a:ICEcoder.selectedFiles;var b=a.toString().replace(/\|/g,"/").replace(/,/g,"\n");0"+t["Deleting File"]+"
    "+b))},copyFiles:function(a,b,c){ICEcoder.copiedFiles=[];for(var d=0;d"+t["Pasting File"]+"
    "+ICEcoder.copiedFiles[b].toString().replace(/\|/g,"/").replace(/,/g,"\n"))):ICEcoder.message(t["Sorry cannot paste..."]);else ICEcoder.message(t["Nothing to paste..."])},duplicateFiles:function(a){if(ICEcoder.copiedFiles)var b=ICEcoder.copiedFiles;ICEcoder.copyFiles(a,"dontShowPaste","dontHide"); - a=a[0].substr(0,a[0].lastIndexOf("|"));ICEcoder.pasteFiles(a);"undefined"!=typeof b&&(ICEcoder.copiedFiles=b)},uploadFilesSelect:function(a){get("uploadDir").value=a;get("fileInput").click()},uploadFilesSubmit:function(a){""!=get("fileInput").value&&(ICEcoder.showHide("show",get("loadingMask")),get("uploadFilesForm").submit(),event.preventDefault())},showHideFileNav:function(a,b){var c=["optionsFile","optionsEdit","optionsSource","optionsHelp"];if("hide"==a)fileNavInt=setTimeout(function(){for(var a= - 0;ab&&(c-=c+a-b);get("fileMenu").style.top=c+"px"}return!1},showFileMenu:function(){get("fileMenu").style.display="inline-block";setTimeout(function(){get("fileMenu").style.opacity="1"},4)},hideFileMenu:function(){get("fileMenu").style.display="none";get("fileMenu").style.opacity= - "0"},updateFileManagerList:function(a,b,c,d,e,f,g){if("add"==a&&!get("filesFrame").contentWindow.document.getElementById(b.replace(iceRoot,"").replace(/\/$/,"").replace(/\//g,"|")+"|"+c)){var l="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?ICEcoder.newFilePerms:ICEcoder.newDirPerms;b||(b="/");b=b.replace(iceRoot,"/");b=b.replace("//","/");var h=get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));var m=h.parentNode.parentNode.nextSibling; - var n=document.createTextNode("\n");var p=777==d?"background: #800; color: #eee":"color: #888";p='        '+c+' '+d+""; - if(!m||3>m.childNodes.length){var k=document.createElement("ul");m=h.parentNode.parentNode;m.parentNode.insertBefore(k,m.nextSibling);k=document.createElement("li");k.className=l;k.draggable=!1;k.ondragstart=function(a){ICEcoder.addDefaultDragData(this,a)};k.ondrag=function(a){ICEcoder.draggingWithKeyTest(a);ICEcoder.getcMInstance()&&(-1==ICEcoder.editorFocusInstance.indexOf("diff")?ICEcoder.getcMInstance().focus():ICEcoder.getcMdiffInstance().focus())};k.ondragover=function(a){ICEcoder.setDragCursor(a, - "folder"==g?"folder":"file")};k.ondragend=function(){ICEcoder.dropFile(this)};k.innerHTML=p;m.nextSibling.appendChild(k);m.nextSibling.appendChild(n)}else for(h=0;hc||"folder"==g&&"file"==k||h==m.childNodes.length-1){k=document.createElement("li");k.className=l;k.draggable=!1;k.ondragstart=function(a){ICEcoder.addDefaultDragData(this, - a)};k.ondrag=function(a){ICEcoder.draggingWithKeyTest(a);ICEcoder.getcMInstance()&&(-1==ICEcoder.editorFocusInstance.indexOf("diff")?ICEcoder.getcMInstance().focus():ICEcoder.getcMdiffInstance().focus())};k.ondragover=function(a){ICEcoder.setDragCursor(a,"folder"==g?"folder":"file")};k.ondragend=function(){ICEcoder.dropFile(this)};k.innerHTML=p;h==m.childNodes.length-1?(m.appendChild(k),m.appendChild(n)):(m.insertBefore(k,m.childNodes[h]),m.insertBefore(n,m.childNodes[h+1]));break}}"file"!=g||f|| - (ICEcoder.openFiles[ICEcoder.selectedTab-1]=b+c)}"rename"==a&&(f=e.replace(/\//g,"|"),h=get("filesFrame").contentWindow.document.getElementById(f),h.innerHTML=c,h.id=b.replace(/\//g,"|")+"|"+c,h.parentNode.title=h.id.replace(/\|/g,"/"),targetElemPerms=get("filesFrame").contentWindow.document.getElementById(f+"_perms"),targetElemPerms.id=b.replace(/\//g,"|")+"|"+c+"_perms",ICEcoder.renameInChildren(h,e,b,c));"move"==a&&(ICEcoder.updateFileManagerList("add",b,c,!1,!1,!1,g),ICEcoder.updateFileManagerList("delete", - e.substr(0,e.lastIndexOf("/")),c));"chmod"==a&&(f=ICEcoder.selectedFiles[ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"),h=get("filesFrame").contentWindow.document.getElementById(f.replace(/\//g,"|")+"_perms"),h.style.background=777==d?"#800":"none",h.style.color=777==d?"#eee":"#888",h.innerHTML=d);"delete"==a&&(b||(b=""),b=b.replace(iceRoot,"/"),b=b.replace("//","/"),b=b.replace(/\/$/,"").replace(/\//g,"|"),h=(b+"|"+c).replace("||","|"),h=get("filesFrame").contentWindow.document.getElementById(h).parentNode.parentNode, - ICEcoder.openCloseDir(h.childNodes[0],!1),h.parentNode.removeChild(h))},renameInChildren:function(a,b,c,d){if(a.parentNode.parentNode.nextSibling&&"UL"==a.parentNode.parentNode.nextSibling.nodeName){a=a.parentNode.parentNode.nextSibling;for(var e=0;ed.indexFromPos({ch:d.getCursor().ch-1,line:d.getCursor().line})&&ICEcoder.findResult--;else for(f=ICEcoder.findResult=0;fICEcoder.results.length-1&&(ICEcoder.findResult=0);e&&1==ICEcoder.findResult&&(ICEcoder.findResult=ICEcoder.results.length+1);g.innerHTML="Highlighted result "+(ICEcoder.findResult+(e?-1:1))+" of "+ICEcoder.results.length+" results";e?(b=d.getSearchCursor(a,{ch:d.getCursor().ch-1,line:d.getCursor().line},!0),b.findPrevious(),b.from()||(b=d.getSearchCursor(a,{line:1E6,ch:1E6},!0),b.findPrevious())): - (b=d.getSearchCursor(a,{ch:d.getCursor().ch+1,line:d.getCursor().line},!0),b.findNext(),b.from()||(b=d.getSearchCursor(a,{line:0,ch:0},!0),b.findNext()));d.setSelection(b.from(),b.to());ICEcoder.focus();ICEcoder.findMode=!0}a=ICEcoder.scrollBarVisible?parseInt(ICEcoder.content.style.height,10)/d.lineCount():d.defaultTextHeight();b=ICEcoder.scrollBarVisible?0:d.heightAtLine(0);e="";for(f=1;f<=d.lineCount();f++)g=-1';ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML=e;ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="inline-block";return!0}g.innerHTML="No results";ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML="";ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display= - "none";return!1}""!=a&&c?(e=b=d="",document.findAndReplace.connector.value==t.and&&(d="&replace="+f),0<=document.findAndReplace.target.value.indexOf(t.file)&&(b="&target="+document.findAndReplace.target.value.replace(/ /g,"-")),document.findAndReplace.target.value==t["selected files"]&&(e="&selectedFiles="+ICEcoder.selectedFiles.join(":")),a=a.replace(/'/g,"'"),a!=encodeURIComponent(a)?a="ICEcoder:"+encodeURIComponent(a):a,ICEcoder.showHide("show",get("loadingMask")),get("mediaContainer").innerHTML= - ''):(g.innerHTML="No results",ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML="",ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="none")}},replaceInFile:function(a,b,c){ICEcoder.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=replaceText&find="+b+"&replace="+c+"&csrf="+ICEcoder.csrf, - encodeURIComponent(a.replace(/\//g,"|")));ICEcoder.serverMessage(""+t["Replacing text in"]+"
    "+a)},getCaretPosition:function(){var a;var b=ICEcoder.getcMInstance();var c=ICEcoder.getcMdiffInstance();b=-1=b||10<=b)&&ICEcoder.mouseX>parseInt(ICEcoder.files.style.width,10)&&(ICEcoder.tabDragMouseX=ICEcoder.mouseX-parseInt(ICEcoder.files.style.width,10)-ICEcoder.tabDragMouseXStart,ICEcoder.tabDragMove());if(ICEcoder.ready&&(ICEcoder.mouseDown||(ICEcoder.draggingFilesW=!1),b=!ICEcoder.draggingTab&& - (ICEcoder.mouseX>ICEcoder.filesW-7&&ICEcoder.mouseX").replace(/<\/b>/g,"").replace(/<br>/g, - "
    "),b.style.left="0"):setTimeout(function(){b.style.left="2000px"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b;var c=ICEcoder.getcMInstance();var d=ICEcoder.getcMdiffInstance();if(c=-1b.index+b[0].length;);(d=get("content").contentWindow.document.getElementById("cssColor"))&&d.parentNode.removeChild(d); - ICEcoder.codeAssist&&"CSS"==ICEcoder.caretLocType&&(d=document.createElement("div"),d.id="cssColor",d.style.position="absolute",d.style.display="block",d.style.width=d.style.height="20px",d.style.zIndex="1000",d.style.background=b?b[0]:"",d.style.cursor="pointer",d.onclick=function(){ICEcoder.showColorPicker(b[0])},""==d.style.backgroundColor&&(d.style.display="none"),get("header").appendChild(d),c.addWidget(c.getCursor(),get("cssColor"),!0))}},showColorPicker:function(a){get("blackMask").style.visibility= - "visible";get("mediaContainer").innerHTML='



    '; - farbtastic("picker","color");a&&get("picker").farbtastic.setColor(a)},initCanvasImage:function(a){var b=get("canvasPicker").getContext("2d");var c=new Image;c.crossOrigin="Anonymous";c.src=a.src;c.onerror=function(){get("floatingContainer").style.visibility="hidden";get("canvasPickerColorInfo").style.display="none";get("canvasPickerCORSInfo").style.display="block"};c.onload=function(){get("canvasPicker").width=a.width;get("canvasPicker").height=a.height;b.drawImage(c,0,0,a.width,a.height);get("canvasPickerColorInfo").style.display= - "block";get("canvasPickerCORSInfo").style.display="none";get("canvasPicker").onmouseover=function(a){get("floatingContainer").style.visibility="visible"};get("canvasPicker").onmouseout=function(a){get("floatingContainer").style.visibility="hidden"}};document.getElementById("floatingContainer").style.backgroundSize=5*a.naturalWidth+"px "+5*a.naturalHeight+"px"},interactCanvasImage:function(a){var b,c,d,e,f,g,l,h,m,n,p,k;var r=get("canvasPicker").getContext("2d");get("canvasPicker").onmousemove=function(u){b= - u.pageX-this.offsetLeft;c=u.pageY-this.offsetTop;d=r.getImageData(b,c,1,1).data;e=d[0];f=d[1];g=d[2];l=e+","+f+","+g;h=ICEcoder.rgbToHex(e,f,g);get("rgbMouseXY").value=l;get("hexMouseXY").value="#"+h;get("hexMouseXY").style.backgroundColor=get("rgbMouseXY").style.backgroundColor="#"+h;m=128>e||128>f||128>g&&200>e&&200>f&&50'+t["Cancelled tasks"]+"");setTimeout(function(){ICEcoder.serverMessage()},2E3)},setPreviousFiles:function(){var a=ICEcoder.openFiles.join(",").replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g, - "");""==a&&(a="CLEAR");ICEcoder.serverQueue("add",iceLoc+"/lib/settings.php?saveFiles="+encodeURIComponent(a)+"&csrf="+ICEcoder.csrf);ICEcoder.updateLast10List(a)},updateLast10List:function(a){a=a.split(",");for(var b=0;b"+a[b].replace(/\|/g,"/")+"\n";var d=ICEcoder.content.contentWindow.document.getElementById("last10Files"); - if(-1==d.innerHTML.indexOf(c)){var e=d.innerHTML.split("\n");(10<=e.length||'
    [none]


    '==e[0]||""==e[e.length-1])&&e.pop();d.innerHTML=c+e.join("\n")}}},autoOpenFiles:function(){if(0');ICEcoder.showHide(a?"hide":"show",get("blackMask"))},helpScreen:function(){get("mediaContainer").innerHTML='';ICEcoder.showHide("show", - get("blackMask"))},versionsScreen:function(a,b){get("mediaContainer").innerHTML='';ICEcoder.showHide("show",get("blackMask"))},showManual:function(a,b){var c=b?"#"+b:"";get("mediaContainer").innerHTML='';ICEcoder.showHide("show", - get("blackMask"))},propertiesScreen:function(a){get("mediaContainer").innerHTML='';ICEcoder.showHide("show",get("blackMask"))},autoLogoutWarningScreen:function(){get("mediaContainer").innerHTML='';ICEcoder.showHide("show", - get("blackMask"))},pluginsManager:function(){get("mediaContainer").innerHTML='';ICEcoder.showHide("show",get("blackMask"))},goLocalhostRoot:function(){ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href=iceLoc+"/lib/go-localhost-root.php"},githubAction:function(a){get("mediaContainer").innerHTML='';ICEcoder.showHide("show",get("blackMask"))},githubTokenAsk:function(a){if(githubAuthToken=ICEcoder.getInput(t["Please enter your..."],""))ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href=iceLoc+"/lib/github.php?action=auth&token="+githubAuthToken+"&goNext="+a+"&csrf="+ICEcoder.csrf,githubAuthToken=""},showHideGithubNav:function(a){get("githubNav").style.display="show"==a?"block":"none";get("fileNav").style.display= - "show"==a?"none":"block"},githubManager:function(){ICEcoder.githubAuthTokenSet?(get("mediaContainer").innerHTML='',ICEcoder.showHide("show",get("blackMask"))):ICEcoder.githubTokenAsk("showManager")},githubDiffToggle:function(){if(!ICEcoder.githubAuthTokenSet)ICEcoder.githubTokenAsk("loadFiles");else if(ICEcoder.githubDiff||ICEcoder.ask(t["This will compare..."])){ICEcoder.githubDiff=!ICEcoder.githubDiff; - var a=ICEcoder.githubDiff?"true":"false";ICEcoder.filesFrame.src="files.php?githubDiff="+a+"&csrf="+ICEcoder.csrf}},ftpManager:function(){get("mediaContainer").innerHTML='';ICEcoder.showHide("show",get("blackMask"))},useNewSettings:function(a,b,c,d,e,f,g,l,h,m,n,p,k,r,u,x,w,y,z,A,B,C,D,E){var v=a.slice(0,a.lastIndexOf("?"));v=v.slice(v.lastIndexOf("/")+1,v.lastIndexOf("."));if(ICEcoder.theme!== - v){ICEcoder.theme=v;"editor"==ICEcoder.theme&&(ICEcoder.theme="icecoder");var q=document.createElement("link");q.setAttribute("rel","stylesheet");q.setAttribute("type","text/css");q.setAttribute("href",a);ICEcoder.content.contentWindow.document.getElementsByTagName("head")[0].appendChild(q);q=document.createElement("link");q.setAttribute("rel","stylesheet");q.setAttribute("type","text/css");q.setAttribute("href",a);document.getElementsByTagName("head")[0].appendChild(q);q=-1<"3024-day base16-light eclipse elegant mdn-like neat neo paraiso-light solarized the-matrix xq-light".split(" ").indexOf(ICEcoder.theme)? - "#ccc":-1<"3024-night blackboard colorforth liquibyte night tomorrow-night-bright tomorrow-night-eighties vibrant-ink".split(" ").indexOf(ICEcoder.theme)?"#888":"#000";ICEcoder.switchTab(ICEcoder.selectedTab)}b!=ICEcoder.codeAssist&&(get("codeAssist").checked=b,ICEcoder.codeAssistToggle());c!=ICEcoder.lockedNav&&(ICEcoder.lockUnlockNav(),ICEcoder.changeFilesW(c?"expand":"contract"),ICEcoder.hideFileMenu());a=document.styleSheets[0];b=a.rules?"rules":"cssRules";a[b][0].style.fontSize=g;a=ICEcoder.filesFrame.contentWindow.document.styleSheets[3]; - b=a.rules?"rules":"cssRules";a[b][0].style.fontSize=g;a=ICEcoder.content.contentWindow.document.styleSheets[6];b=a.rules?"rules":"cssRules";a[b][0].style.fontSize=g;a[b][4].style["border-left-width"]=f?"1px":"0";a[b][4].style["margin-left"]=f?"-1px":"0";a[b][2].style.cssText="background-color: "+q+" !important";ICEcoder.lineWrapping=l;ICEcoder.lineNumbers=h;ICEcoder.showTrailingSpace=m;ICEcoder.matchBrackets=n;ICEcoder.autoCloseTags=p;ICEcoder.autoCloseBrackets=k;ICEcoder.indentWithTabs=r;ICEcoder.indentSize= - x;ICEcoder.indentAuto=u;for(f=0;fchMod "+b+" on
    "+ - a.replace(/\|/g,"/"))},openPreviewWindow:function(){if(060*ICEcoder.autoLogoutMins-60&&ICEcoder.showHide("hide",get("blackMask"));ICEcoder.autoLogoutTimer=0},logout:function(a){window.location=window.location+ - "?logout&"+(a?"type="+a+"&":"")+"csrf="+ICEcoder.csrf},outputMsg:function(a){ICEcoder.output.innerHTML+=a+"
    "},message:function(a){alert(a)},ask:function(a){return confirm(a)},getInput:function(a,b){return prompt(a,b)},dataMessage:function(a){var b=ICEcoder.content.contentWindow.document.getElementById("dataMessage");b.style.display="block";b.innerHTML=a},update:function(){confirm(t["Please note for..."])?(ICEcoder.showHide("show",get("loadingMask")),window.location=iceLoc+"/lib/updater.php"): - window.open("https://icecoder.net")},updated:function(){get("blackMask").style.visibility="visible";get("mediaContainer").innerHTML='

    Thanks for updating to v'+ICEcoder.versionNo+'!

    Click anywhere to continue using ICEcoder...

    '},xhrObj:function(){try{return new XMLHttpRequest}catch(a){}try{return new ActiveXObject("Msxml3.XMLHTTP")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}return null}, - openBugReport:function(){"off"==ICEcoder.bugReportStatus&&ICEcoder.message(t["You can start..."]);"error"==ICEcoder.bugReportStatus&&ICEcoder.message(t["Error cannot find..."]);"ok"==ICEcoder.bugReportStatus&&ICEcoder.message(t["No new errors..."]);if("bugs"==ICEcoder.bugReportStatus){var a=ICEcoder.openFiles.indexOf(ICEcoder.bugReportPath.replace(/\|/g,"/"));-1/g,">").replace(/"/g,""").replace(/'/g,"'")},printCode:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.getcMdiffInstance();a=-1ICEcoder code output
    '+ICEcoder.xssClean(a.getValue())+"
    ";b.focus();b.print();a.focus()},indicateChanges:function(){if(!ICEcoder.loadingFile){var a="ICEcoder v "+ICEcoder.versionNo;for(var b=1;b<=ICEcoder.savedPoints.length;b++)if(ICEcoder.savedPoints[b-1]!=ICEcoder.getcMInstance(b).changeGeneration()){a+= - " \u2744";break}document.title=a}},switchTab:function(a,b){a!==ICEcoder.selectedTab&&(ICEcoder.prevTab=ICEcoder.selectedTab);ICEcoder.selectedTab=a;var c=ICEcoder.getcMInstance();var d=ICEcoder.getcMdiffInstance();if(-1';get("tab"+ICEcoder.openFiles.length).style.display="inline-block";var c=ICEcoder.openFiles[ICEcoder.openFiles.length-1];get("tab"+ICEcoder.openFiles.length).innerHTML= - b+" "+c.slice(c.lastIndexOf("/")).replace(/\//,"");get("tab"+ICEcoder.openFiles.length).title="/"+ICEcoder.openFiles[ICEcoder.openFiles.length-1].replace(/\//,"");ICEcoder.setTabWidths();ICEcoder.redoTabHighlight(ICEcoder.openFiles.length);ICEcoder.selectedTab=ICEcoder.openFiles.length;ICEcoder.savedPoints.push(0);ICEcoder.savedContents.push("");a||ICEcoder.setPreviousFiles()},nextTab:function(){ICEcoder.switchTab(ICEcoder.selectedTab+1<=ICEcoder.openFiles.length?ICEcoder.selectedTab+1:1,"noFocus")}, - previousTab:function(){ICEcoder.switchTab(1<=ICEcoder.selectedTab-1?ICEcoder.selectedTab-1:ICEcoder.openFiles.length,"noFocus")},renameTab:function(a,b){ICEcoder.openFiles[a-1]=b;var c=''; - var d=ICEcoder.openFiles[a-1];get("tab"+a).innerHTML=c+" "+d.slice(d.lastIndexOf("/")).replace(/\//,"");get("tab"+a).title="/"+ICEcoder.openFiles[a-1].replace(/\//,"")},redoTabHighlight:function(a){for(var b,c,d=1;d<=ICEcoder.savedPoints.length;d++)get("tab"+d).childNodes[0]&&(get("tab"+d).childNodes[0].childNodes[0].style.backgroundColor=ICEcoder.savedPoints[d-1]!=ICEcoder.getcMInstance(d).changeGeneration()?"#b00":"transparent"),b=d==a?ICEcoder.tabFGselected:ICEcoder.tabFGnormalTab,"undefined"!= - typeof ICEcoder.openFiles[d-1]&&"/[NEW]"!=ICEcoder.openFiles[d-1]&&(c=ICEcoder.filesFrame.contentWindow.document.getElementById(ICEcoder.openFiles[d-1].replace(/\//g,"|")))&&(c.style.backgroundColor=d==a?ICEcoder.tabBGcurrent:ICEcoder.tabBGopen,c.style.color=d==a?ICEcoder.tabFGcurrent:ICEcoder.tabFGopenFile),get("tab"+d).style.color=b,get("tab"+d).style.background=d==a?ICEcoder.tabBGcurrent:ICEcoder.tabBGopen},closeTab:function(a,b,c){a||(a=ICEcoder.selectedTab);ICEcoder.getcMInstance();ICEcoder.getcMdiffInstance(); - var d=!0;c||ICEcoder.savedPoints[a-1]==ICEcoder.getcMInstance(a).changeGeneration()||(d=ICEcoder.ask(t["You have made..."]));if(d){c=ICEcoder.openFiles[a-1];for(d=a;db?parseInt(c*g,10)-parseInt(c*(g-1),10):150,e=0==g?53:parseInt(get("tab"+g).style.left,10),f=0==g?0:parseInt(get("tab"+g).style.width,10)+18,a?d=-18:(get("tab"+(g+1)).style.left=e+f+"px",get("tab"+(g+1)).style.width=d+"px"),ICEcoder.tabLeftPos.push(e+f);get("newTab").style.left=e+f+d+18+"px"}}, - tabDragStart:function(a){ICEcoder.draggingTab=a;ICEcoder.diffStartX=ICEcoder.mouseX;ICEcoder.tabDragMouseXStart=(ICEcoder.mouseX-(parseInt(ICEcoder.files.style.width,10)+53+18))%150;get("tab"+a).style.zIndex=2;for(var b=1;b<=ICEcoder.openFiles.length;b++)get("tab"+b).className=b!==a?"tab tabSlide":"tab tabDrag"},tabDragMove:function(){var a=parseInt(get("tab"+ICEcoder.openFiles.length).style.width,10)+18;ICEcoder.thisLeft=a=53<=ICEcoder.tabDragMouseX?ICEcoder.tabDragMouseX<=parseInt(get("newTab").style.left, - 10)-a?ICEcoder.tabDragMouseX:parseInt(get("newTab").style.left,10)-a:53;get("tab"+ICEcoder.draggingTab).style.left=a+"px";ICEcoder.dragTabNo=ICEcoder.draggingTab;for(var b=1;b<=ICEcoder.openFiles.length;b++){get("tab"+b).style.opacity=b==ICEcoder.draggingTab?1:.5;var c=ICEcoder.tabLeftPos[b]?ICEcoder.tabLeftPos[b]-ICEcoder.tabLeftPos[b-1]:c;b!=ICEcoder.draggingTab&&(b=ICEcoder.tabLeftPos[b-1]?ICEcoder.tabLeftPos[b-1]-c:ICEcoder.tabLeftPos[b-1])}},tabDragEnd:function(){var a;ICEcoder.setTabWidths();for(var b=1;b<=ICEcoder.openFiles.length;b++)ICEcoder.thisLeft>=ICEcoder.tabLeftPos[b-1]&&(a=ICEcoder.thisLeft==ICEcoder.tabLeftPos[0]?1:ICEcoder.dragTabNo>b?b+1:b),get("tab"+b).className="tab",get("tab"+b).style.opacity=1,b!=ICEcoder.dragTabNo?get("tab"+b).style.zIndex=1:setTimeout(function(){get("tab"+b).style.zIndex=1},150);if(ICEcoder.thisLeft&&!1!== - ICEcoder.thisLeft){var c=[];for(b=1;b<=ICEcoder.openFiles.length;b++)c.push(b);c.splice(ICEcoder.dragTabNo-1,1);c.splice(a-1,0,ICEcoder.dragTabNo);ICEcoder.sortTabs(c)}ICEcoder.setTabWidths();ICEcoder.draggingTab=!1;ICEcoder.thisLeft=!1},sortTabs:function(a){var b;var c=[ICEcoder.savedPoints,ICEcoder.savedContents,ICEcoder.openFiles,ICEcoder.openFileMDTs,ICEcoder.openFileVersions,ICEcoder.cMInstances];var d=[[],[],[],[],[],[]];for(var e=0;eb-5;)e.undo(),a++;if(ICEcoder.savedPoints[ICEcoder.selectedTab-1]==e.changeGeneration())ICEcoder.startSnake();else for(b=1;b<=a;b++)e.redo()}, - 0);if(ICEcoder.snakePlaying)return 37==d&&(ICEcoder.snakeDir="left"),39==d&&(ICEcoder.snakeDir="right"),38==d&&(ICEcoder.snakeDir="up"),40==d&&(ICEcoder.snakeDir="down"),!1;if(224==d||91==d||93==d)ICEcoder.cmdKey=!0;if(112===d){if(ICEcoder.codeZoomedOut)return;ICEcoder.codeZoomedOut=!0;var e=ICEcoder.getcMInstance();for(d=0;dLet\'s play
    snake


    Use arrow keys to eat your code

    (it returns afterwards of course) :-)
    '; - setTimeout(function(){ICEcoder.showHide("hide",get("blackMask"));get("mediaContainer").innerHTML="";ICEcoder.playSnake()},2E3)},playSnake:function(){var a=ICEcoder.getcMInstance();a.setOption("readOnly","nocursor");a.focus();ICEcoder.snakePreHistory=a.getHistory();ICEcoder.snakePreContent=a.getValue();ICEcoder.snakePreCursor=a.getCursor();a=Math.floor(50*Math.random());ICEcoder.snakePos=[[a,0],[a,-1],[a,-2],[a,-3],[a,-4]];ICEcoder.content.contentWindow.document.getElementById("game").style.display= - "block";ICEcoder.snakeDir="down";ICEcoder.doSnake();ICEcoder.snakeInt=setInterval(function(){var a=[];a[0]=ICEcoder.snakePos[0][0]+("right"==ICEcoder.snakeDir?1:"left"==ICEcoder.snakeDir?-1:0);a[1]=ICEcoder.snakePos[0][1]+("down"==ICEcoder.snakeDir?1:"up"==ICEcoder.snakeDir?-1:0);ICEcoder.snakePos.unshift(a);ICEcoder.snakePos.pop();ICEcoder.doSnake()},100)},doSnake:function(){var a;var b=ICEcoder.getcMInstance();var c=b.defaultCharWidth();var d=b.defaultTextHeight();var e=ICEcoder.content.contentWindow.document.getElementById("game").innerHTML= - "";for(a=0;a';ICEcoder.content.contentWindow.document.getElementById("game").innerHTML=e;e=b.coordsChar({top:ICEcoder.snakePos[0][1]*d+4,left:ICEcoder.snakePos[0][0]*c+60});var f=b.getLine(e.line);if(ICEcoder.snakePos[0][0]-1<=f.length-2){var g="";if("\t"===f.substr(e.ch, - 1))for(a=0;aICEcoder.snakePos[0][0]||0>ICEcoder.snakePos[0][1]||ICEcoder.snakePos[0][0]*c+60>a.clientWidth||ICEcoder.snakePos[0][1]*d+4>a.clientHeight||e)clearInterval(ICEcoder.snakeInt),ICEcoder.content.contentWindow.document.getElementById("game").style.display="none",b.setValue(ICEcoder.snakePreContent),ICEcoder.savedPoints[ICEcoder.selectedTab-1]=b.changeGeneration(),ICEcoder.savedContents[ICEcoder.selectedTab- - 1]=ICEcoder.snakePreContent,b.setHistory(ICEcoder.snakePreHistory),ICEcoder.indicateChanges(),ICEcoder.redoTabHighlight(ICEcoder.selectedTab),b.setOption("readOnly",!1),b.setCursor(ICEcoder.snakePreCursor),b.focus(),ICEcoder.snakePlaying=!1}}; \ No newline at end of file From afd63b5cdbb8f6dfafc6ab6fcf30d186318fc026 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 14 Mar 2020 09:24:23 +0000 Subject: [PATCH 086/231] devMode removed --- editor.php | 6 ------ lib/template-system.php | 1 - 2 files changed, 7 deletions(-) diff --git a/editor.php b/editor.php index d75b030..72c32d9 100644 --- a/editor.php +++ b/editor.php @@ -154,12 +154,6 @@ h2 {color: rgba(0,198,255,0.7)} } },1000); -
    -

    - :
    - [?] -
    -
    - - + + diff --git a/files.php b/files.php index 0615040..80e785f 100644 --- a/files.php +++ b/files.php @@ -9,9 +9,9 @@ $t = $text['files']; ICEcoder v <?php echo $ICEcoder["versionNo"];?> file manager - - - + + + -/addon/fold/foldgutter.css?microtime="> -/addon/scroll/simplescrollbars.css?microtime="> + + @@ -100,7 +100,7 @@ var highlightVersion = function(elem) { var editor = CodeMirror.fromTextArea(document.getElementById("code"), { diff --git a/lib/database.php b/lib/database.php index a4c8960..22887b8 100644 --- a/lib/database.php +++ b/lib/database.php @@ -1560,7 +1560,7 @@ csp(){return csp();}function head(){return true;}function -css(){$I=array();$Wc="adminer.css";if(file_exists($Wc))$I[]="$Wc?v=".crc32(file_get_contents($Wc));return$I;}function +css(){$I=array();$Wc="../assets/css/database.css";if(file_exists($Wc))$I[]="$Wc?v=".crc32(file_get_contents($Wc));return$I;}function loginForm(){global$gc;echo"\n",$this->loginFormField('driver','
    '.lang(34).'',html_select("auth[driver]",$gc,DRIVER,"loginDriver(this);")."\n"),$this->loginFormField('server','
    '.lang(35).'',''."\n"),$this->loginFormField('username','
    '.lang(36).'',''.script("focus(qs('#username')); qs('#username').form['auth[driver]'].onchange();")),$this->loginFormField('password','
    '.lang(37).'',''."\n"),$this->loginFormField('db','
    '.lang(38).'',''."\n"),"
    \n","

    \n",checkbox("auth[permanent]",1,$_COOKIE["adminer_permanent"],lang(40))."\n";}function loginFormField($C,$zd,$Y){return$zd.$Y;}function login($Ae,$F){if($F=="")return @@ -2037,4 +2037,4 @@ as$J){$C=($J["SPECIFIC_NAME"]==$J["ROUTINE_NAME"]?"":"&name=".urlencode($J["ROUT as$X)echo"".h($X)."\n";echo"\n";}echo"

    ".lang(26)."

    \n";$Vi=types();if($Vi){echo"\n","\n";odd('');foreach($Vi as$X)echo"
    ".lang(183)."
    ".h($X)."\n";echo"
    \n";}echo"

    ".lang(144)."

    \n";$K=get_rows("SHOW EVENTS");if($K){echo"\n","\n";foreach($K as$J){echo"","
    ".lang(183)."".lang(286)."".lang(210)."".lang(211)."
    ".h($J["Name"]),"".($J["Execute at"]?lang(287)."".$J["Execute at"]:lang(212)." ".$J["Interval value"]." ".$J["Interval field"]."$J[Starts]"),"$J[Ends]",''.lang(136).'';}echo"
    \n";$Bc=$h->result("SELECT @@event_scheduler");if($Bc&&$Bc!="ON")echo"

    event_scheduler: ".h($Bc)."\n";}echo'

    " + "" + "

    " + From e7034bd30d2c560204ded2eb3a0b17c788781678 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 21 Mar 2020 08:06:12 +0000 Subject: [PATCH 111/231] Asset path changes in 6 x lib files --- lib/ftp-manager.php | 2 +- lib/help.php | 2 +- lib/login.php | 6 +++--- lib/multiple-results.php | 2 +- lib/plugins-manager.php | 2 +- lib/requirements.php | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/ftp-manager.php b/lib/ftp-manager.php index c311e55..aeb7924 100644 --- a/lib/ftp-manager.php +++ b/lib/ftp-manager.php @@ -124,7 +124,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset ICEcoder <?php echo $ICEcoder["versionNo"];?> FTP manager - + diff --git a/lib/help.php b/lib/help.php index 163a666..ad999a7 100644 --- a/lib/help.php +++ b/lib/help.php @@ -10,7 +10,7 @@ $t = $text['help']; ICEcoder <?php echo $ICEcoder["versionNo"];?> help - + diff --git a/lib/login.php b/lib/login.php index 028a015..1dde86c 100644 --- a/lib/login.php +++ b/lib/login.php @@ -16,8 +16,8 @@ echo $ICEcoder["password"] == "" && !$ICEcoder["multiUser"] ? "Setup" : "Login"; - - + + setTimeout(function(){document.getElementById('screenContainer').style.opacity=1},50)"> @@ -25,7 +25,7 @@ echo $ICEcoder["password"] == "" && !$ICEcoder["multiUser"] ? "Setup" : "Login";
    - ICEcoder + ICEcoder
    v
    onsubmit="return checkCanSubmit();"> diff --git a/lib/multiple-results.php b/lib/multiple-results.php index 6036b76..5861d68 100644 --- a/lib/multiple-results.php +++ b/lib/multiple-results.php @@ -15,7 +15,7 @@ if(isset($_GET['selectedFiles'])) { ICEcoder <?php echo $ICEcoder["versionNo"];?> multiple results screen - + diff --git a/lib/plugins-manager.php b/lib/plugins-manager.php index 931982b..0be07b4 100644 --- a/lib/plugins-manager.php +++ b/lib/plugins-manager.php @@ -177,7 +177,7 @@ function deletePlugin($dir) { ICEcoder <?php echo $ICEcoder["versionNo"];?> plugins manager - + diff --git a/lib/requirements.php b/lib/requirements.php index b6a45a8..cfafea6 100644 --- a/lib/requirements.php +++ b/lib/requirements.php @@ -42,8 +42,8 @@ if (!$reqsPassed) { - - + + @@ -51,7 +51,7 @@ if (!$reqsPassed) {
    - ICEcoder + ICEcoder
    v
    From 0277e36168d06692ff9d82cbe92fc720134b17d0 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 21 Mar 2020 08:09:19 +0000 Subject: [PATCH 112/231] Asset path changes in 2 x lib files --- lib/properties.php | 2 +- lib/settings-update.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/properties.php b/lib/properties.php index e8fa294..25406f0 100644 --- a/lib/properties.php +++ b/lib/properties.php @@ -17,7 +17,7 @@ if (!file_exists($fileName) || strpos(str_replace("\\","/",$fileName),$docRoot) ICEcoder <?php echo $ICEcoder["versionNo"];?> file/folder properties - + diff --git a/lib/settings-update.php b/lib/settings-update.php index dce662f..90e2425 100644 --- a/lib/settings-update.php +++ b/lib/settings-update.php @@ -104,7 +104,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && } // Work out the theme to use now - $ICEcoder["theme"]=="default" ? $themeURL = 'lib/editor.css' : $themeURL = $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css'; + $ICEcoder["theme"]=="default" ? $themeURL = 'assets/css/editor.css' : $themeURL = 'assets/css/theme/'.$ICEcoder["theme"].'.css'; $themeURL .= "?microtime=".microtime(true); // Do we need a file manager refresh? From 8de55467c11eaf23e0f794c468b44cbfa5d64869 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 21 Mar 2020 08:10:00 +0000 Subject: [PATCH 113/231] Asset path changes in 2 x files --- processes/on-editor-load.php | 2 +- terminal.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/processes/on-editor-load.php b/processes/on-editor-load.php index 2db6fc2..5306471 100644 --- a/processes/on-editor-load.php +++ b/processes/on-editor-load.php @@ -31,7 +31,7 @@ ICEcoder.switchMode = function(mode) { cMdiff.setOption("mode",mode); } } else if (cM && fileName) { - + if (mode != cM.getOption("mode")) { cM.setOption("mode",mode); diff --git a/terminal.php b/terminal.php index 2a7cf2b..6703c12 100644 --- a/terminal.php +++ b/terminal.php @@ -9,7 +9,7 @@ include("lib/settings.php"); - + + + + - + '.PHP_EOL; + echo ''.PHP_EOL; } ?> -/addon/scroll/simplescrollbars.css?microtime="> +
    - +

    @@ -58,10 +58,6 @@ for ($i=0;$ihttps://github.com/icecoder/ICEcoder

    - :
    - -

    - :
    From d4fecff67902f0e50d6ebcce9316694c7611cc49 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 21 Mar 2020 11:54:30 +0000 Subject: [PATCH 120/231] Update lang files, keys to match english.php, comma postfixes --- lang/chinese-simplified.php | 143 +++++++++++++++++++++----- lang/chinese-traditional.php | 149 ++++++++++++++++++++++----- lang/dutch.php | 61 ++++++++--- lang/english.php | 36 +++---- lang/french.php | 144 ++++++++++++++++++++------ lang/german.php | 184 ++++++++++++++++++++++++++++------ lang/italian.php | 114 +++++++++++++++++---- lang/norwegian.php | 141 ++++++++++++++++++++++---- lang/persian.php | 157 +++++++++++++++++++++++------ lang/portuguese-brazilian.php | 122 ++++++++++++++++++---- lang/spanish.php | 88 +++++++++++++--- 11 files changed, 1095 insertions(+), 244 deletions(-) diff --git a/lang/chinese-simplified.php b/lang/chinese-simplified.php index c594dbb..6630913 100644 --- a/lang/chinese-simplified.php +++ b/lang/chinese-simplified.php @@ -11,7 +11,6 @@ $text = [ "editor" => [ - "Click icons for..." => "点击图标
    求助 &
    使用信息
    ", "server" => "服务器", "Server name, OS..." => "服务器名称, OS & IP:", "Root" => "根目录:", @@ -24,14 +23,14 @@ $text = [ "files" => "文件", "Last 10 files..." => "最后10个打开的文件:", "none" => "[none]", - "results" => "结果" ], "files" => [ "Lock" => "锁定", "Refresh" => "刷新", - "ROOT" => "[ROOT]" + "Plugins" => "Plugins", + "ROOT" => "[ROOT]", ], "index" => @@ -41,9 +40,10 @@ $text = [ "Your version is" => "你的版本是", "Update now" => "现在更新", "You have some..." => "你有一些未保存的更改", - "Are you sure you want to close?" => "Are you sure you want to close?", + "Are you sure..." => "Are you sure you want to close?", "working" => "载入中", "Color picker" => "颜色选择器", + "Plugins Manager" => "Plugins Manager", "New File" => "新建文件", "New Folder" => "新建文件夹", "Upload File(s)" => "上传文件", @@ -58,7 +58,7 @@ $text = [ "Properties" => "属性", "File" => "文件", "Edit" => "编辑", - "Remote" => "远程", + "Source" => "Source", "Help" => "帮助", "Save" => "保存", "Save As" => "另存为", @@ -82,29 +82,46 @@ $text = [ "website" => "网站", "Close all tabs" => "关闭所有选项卡", "Alphabetize tabs" => "按字母顺序排列的选项卡", -// "Find" => "搜索", -// "in" => "in", -// "and" => "and", -// "replace" => "替换", -// "replace all" => "替换所有", -// "this document" => "当前文件", -// "open documents" => "打开的文件", -// "all files" => "所有文件", -// "all filenames" => "所有文件名", + "Find" => "搜索", + "in" => "in", + "and" => "and", + "replace" => "替换", + "replace all" => "替换所有", + "this document" => "当前文件", + "open documents" => "打开的文件", + "all files" => "所有文件", + "all filenames" => "所有文件名", "Go to Line" => "转到行", "View" => "预览", - "Bug reporting not active" => "错误报告没有激活" + "Bug reporting not active" => "错误报告没有激活", + "Single pane" => "Single pane", + "Diff pane also" => "Diff pane also", ], // /LIB + "auto-logout-warning" => + [ + "Auto Logout Warning" => "Auto logout warning", + "You will be..." => "You will be logged out after", + "seconds due to..." => "seconds due to inactivity, for security purposes. Use the mouse or hit a key to continue.

    You can adjust or disable this from the Edit > Settings section.", + ], + + "backup-versions" => + [ + "backup" => "backup", + "backups" => "backups", + "available for" => "available for", + ], + "bug-files-check" => [ - "Found in" => "搜索到:" + "Found in" => "搜索到:", ], "file-control" => [ + "Sorry, bad filename..." => "Sorry, bad filename provided. Check the dev tools console for more info?", "Sorry" => "抱歉", "does not seem..." => "服务器上不存在", "Sorry, could not..." => "抱歉, 不能得到的内容", @@ -120,6 +137,7 @@ $text = [ "Sorry, cannot save" => "抱歉, 不能保存", "Sorry, cannot replace..." => "抱歉, 目标不能替换文本", "Sorry, cannot change..." => "抱歉, 目标不能更改权限", + "Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode", "Sorry, cannot delete..." => "抱歉, 不能删除根级别ROOT", "Sorry, cannot delete" => "抱歉, 不能删除", "Sorry, this file..." => "抱歉, 此文件已更改, 不能保存", @@ -128,14 +146,45 @@ $text = [ "displayed at" => "显示在", "Enter filename to..." => "输入文件名并保存到", "That file exists..." => "该文件已存在, 要覆盖吗?", - "Saving" => "正在保存" + "Saving" => "正在保存", + ], + + "ftp-manager" => + [ + "Saving FTP sites" => "Saving FTP sites", + "Cannot update config..." => "Cannot update config file. Please set public write permissions on", + "and try again" => "and try again", + "ftp manager" => "ftp manager", + "Choose existing site" => "Choose existing site", + "Are you sure..." => "Are you sure you wish to remove this site?", + "Add new site" => "Add new site", + "Edit site" => "Edit site", + "Site base" => "Site base", + "Host" => "Host", + "Username" => "Username", + "Password" => "Password", + "PASV and mode" => "PASV and mode", + "Root" => "Root", + "eg http://yourdomain.com" => "eg http://yourdomain.com", + "eg ftp.yourdomain.com" => "eg ftp.yourdomain.com", + "eg user123" => "eg user123", + "eg pass123" => "eg pass123", + "Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary", + "eg /htdocs" => "eg /htdocs", + "PASV connection off" => "PASV connection off", + "PASV connection on" => "PASV connection on", + "ASCII transfer" => "ASCII transfer", + "Binary transfer" => "Binary transfer", + "Add" => "Add", + "Choose" => "Choose", + "Update" => "Update", ], "get-branch" => [], "headers" => [ - "Bad CSRF token..." => "错误的 CSRF token. 请在 https://github.com/icecoder/ICEcoder 报告错误信息, 以便我们修复它." + "Bad CSRF token..." => "错误的 CSRF token. 请在 https://github.com/icecoder/ICEcoder 报告错误信息, 以便我们修复它.", ], "help" => @@ -166,6 +215,8 @@ $text = [ "Jump to definition" => "跳转到 / 跳转回", "Comment uncomment" => "注释 / 清除注释", "Insert tab indent" => "插入tab / 插入选择", + "Insert more" => "Indent more", + "Insert less" => "Indent less", "Wrap with div" => "封装 <div>", "Wrap with span" => "封装 <span>", "Wrap unwrap p" => "封装 / 撤销封装 <p>", @@ -190,6 +241,7 @@ $text = [ "Close current tab" => "关闭当前选项卡", "Open file prompt" => "打开文件的提示", "Find" => "搜索", + "Previous" => "Previous", "Focus on Go..." => "光标定位到转到行的输入框", "Save" => "保存", "Save as" => "另存为...", @@ -197,17 +249,26 @@ $text = [ "Contract expand file..." => "收缩 / 扩展文件管理器", "Fold unfold current..." => "折叠 / 展开当前行", "Refocus on document" => "光标重新聚焦于文档", - "Cancel tasks" => "取消任务" + "Cancel tasks" => "取消任务", + "Zoom out" => "Zoom out all non-function/class declarations", + "Jump to" => "Jump to declaration of class/function", + "Jump to previous tab" => "Jump to previous tab", ], "icecoder" => [ + "results" => "results", "No text selected..." => "搜索中没有选中的文本", + "all files" => "all files", + "all filenames" => "all filenames", + "selected files" => "selected files", + "selected filenames" => "selected filenames", "Creating Folder" => "正在创建文件夹", "Sorry you can..." => "抱歉, 只能同时打开100个文件!", "Opening File" => "正在打开文件", "Enter relative file..." => "输入本地相对路径 (前缀 /) 或远程 URL", "Getting" => "正在获取", + "Saving" => "Saving:", "Please enter the..." => "请输入新的名称为", "Renaming to" => "正在重命名", "Moving to" => "正在移动到", @@ -215,7 +276,13 @@ $text = [ "Pasting File" => "正在粘贴文件", "Sorry cannot paste..." => "抱歉, 无法粘贴到根路径", "Nothing to paste..." => "粘贴失败, 请先复制一个文件 / 文件夹!", + "and" => "and", + "this document" => "this document", + "replace" => "replace", + "replace all" => "replace all", + "file" => "file", "Replacing text in" => "正在替换文本", + "Sorry there was..." => "Sorry, there was an error with your request.\\n\\nPlease check your dev tools console for more info.", "Cancelled tasks" => "取消任务", "Open previous files" => "打开以前的文件?", "Please note for..." => "请注意: 需要更新才能正常工作, 你需要为所有 ICEcoder 文件和文件夹设置写入和删除权限. 如果您需要恢复 ICEcoder 到这个版本, 你可以在 /tmp 目录找到它们. 点击 OK 继续使用自动升级或点击 cancel 访问 ICEcoder 网站, 您也可以到 grab 的项目首页下载 zip 来进行手动更新.", @@ -223,7 +290,7 @@ $text = [ "Error cannot find..." => "错误: 无法找到/进入错误文件路径", "No new errors..." => "没有新的错误被找到", "You have made..." => "您已做的更改未保存。您确定要关闭它而不保存吗?", - "Close all tabs" => "是否关闭所有选项卡?" + "Close all tabs" => "是否关闭所有选项卡?", ], "login" => @@ -232,6 +299,7 @@ $text = [ "login" => "登陆", "To disable registration..." => "要禁用注册模式, 请打开设置或打开文件 data/config-settings.php 并更改 enableRegistration 为 false , 并重新载入本页面", "Registration mode enabled" => "注册模式已启用", + "disable further registrations" => "disable further registrations", "auto-check for updates" => "自动检测更新", "To put into..." => "要禁用多用户模式, 请打开设置或打开文件 data/config-settings.php 并更改 multiUser 为 true , 并重新载入本页面", "multi-user" => "多用户" @@ -294,7 +362,7 @@ $text = [ "Write" => "写入", "Execute" => "执行", "Change to" => "更改为", - "update" => "更新" + "update" => "更新", ], "settings-common" => @@ -316,7 +384,15 @@ $text = [ "git" => "git", "codemirror version" => "codemirror 版本", "file manager root" => "文件管理器的根目录ROOT", - "Free to use..." => "您可以自由使用它, 无论商业与否, 只需让我知道有任何很酷的使用或有定制的:)同样我们无任何责任和任何担保, 使用所有的责任是你的. 很多个人和公司为 ICEcoder 作出过贡献, 在此篇幅有限无法一一列举, 请访问贡献者详细列表", + "backups" => "backups", + "keep version control..." => "keep version control backups for", + "day" => "day", + "days" => "days", + "of backups stored..." => "of backups stored currently", + "deleting actually moves..." => "deleting actually moves to ICEcoder's tmp dir", + "local/server items..." => "local/server items only", + "Get in contact..." => "Get in contact by...", + "You may use..." => "You may use ICEcoder for your own purposes, commercial or not, just let us know of any cool uses or customisations. :)

    No warranty or liability accepted for anything, all responsibility of use is your own.", "functionality" => "功能", "check for updates..." => "启动时检查更新", "auto open last..." => "启动时自动载入最后打开的文件", @@ -335,19 +411,27 @@ $text = [ "banned paths" => "禁止路径", "ip addresses" => "ip 地址", "Slash prefixed comma..." => "斜线前缀, 以半角逗号分隔", + "auto-logout after" => "auto-logout after", + "mins of inactivity..." => "mins of inactivity if no unsaved files", "Comma delimited" => "以半角逗号分隔", "style" => "样式", "theme" => "主题", "line wrapping" => "换行", + "line numbers" => "line numbers", "scrollbars" => "滚动条", "indent type" => "缩进类型", "indent size" => "缩进大小", + "match brackets" => "match brackets", + "show trailing space" => "show trailing space", "font size" => "字体大小", "auto indent" => "auto indent", + "auto close tags" => "auto close tags", + "auto close brackets" => "auto close brackets", "layout" => "布局", "plugin panel aligned" => "插件板对齐", "file manager" => "文件管理器", "root" => "root", + "Set 0 to..." => "Set 0 to disable", "Slash prefixed" => "斜线前缀", "bug reporting" => "错误报告", "check in files" => "检查文件", @@ -370,6 +454,19 @@ $text = [ "updater" => [ "Update appears to..." => "更新似乎是成功的" - ] + ], + + "find-in-files" => + [ + "Enter path to search in" => "Enter path to search in", + "Enter semicolon-separated masks..." => "Enter semicolon-separated masks of files to look at (e.g. *.php;*.html;*.js)", + "Type of text" => "Type of text", + "Fixed text" => "Fixed text", + "Regular expression" => "Regular expression", + "Case sensitive" => "Case sensitive", + "Yes" => "Yes", + "No" => "No", + "Search" => "Search", + ], ]; diff --git a/lang/chinese-traditional.php b/lang/chinese-traditional.php index f333da5..607c949 100644 --- a/lang/chinese-traditional.php +++ b/lang/chinese-traditional.php @@ -11,7 +11,6 @@ $text = [ "editor" => [ - "Click icons for..." => "點擊圖標
    求助 &
    實用信息
    ", "server" => "伺服器", "Server name, OS..." => "伺服器名稱, OS & IP:", "Root" => "根目錄:", @@ -24,13 +23,13 @@ $text = [ "files" => "文件", "Last 10 files..." => "最後10個打開的文件:", "none" => "[none]", - "results" => "結果" ], "files" => [ "Lock" => "鎖定", "Refresh" => "刷新", + "Plugins" => "Plugins", "ROOT" => "[ROOT]" ], @@ -41,9 +40,10 @@ $text = [ "Your version is" => "你的版本是", "Update now" => "現在更新", "You have some..." => "你有一些未保存的更改", - "Are you sure you want to close?" => "Are you sure you want to close?", + "Are you sure..." => "Are you sure you want to close?", "working" => "裝載中", "Color picker" => "顔色選擇器", + "Plugins Manager" => "Plugins Manager", "New File" => "新建文件", "New Folder" => "新建文件夾", "Upload File(s)" => "上傳文件", @@ -58,7 +58,7 @@ $text = [ "Properties" => "屬性", "File" => "文件", "Edit" => "編輯", - "Remote" => "遠程", + "Source" => "Source", "Help" => "幫助", "Save" => "保存", "Save As" => "另存爲", @@ -82,29 +82,46 @@ $text = [ "website" => "網站", "Close all tabs" => "關閉所有選項卡", "Alphabetize tabs" => "按字母順序排序選項卡", -// "Find" => "檢索", -// "in" => "in", -// "and" => "and", -// "replace" => "替換", -// "replace all" => "替換所有", -// "this document" => "當前文件", -// "open documents" => "打開的文件", -// "all files" => "所有文件", -// "all filenames" => "所有文件名", + "Find" => "檢索", + "in" => "in", + "and" => "and", + "replace" => "替換", + "replace all" => "替換所有", + "this document" => "當前文件", + "open documents" => "打開的文件", + "all files" => "所有文件", + "all filenames" => "所有文件名", "Go to Line" => "轉到行", "View" => "預覽", - "Bug reporting not active" => "錯誤報告沒有激活" + "Bug reporting not active" => "錯誤報告沒有激活", + "Single pane" => "Single pane", + "Diff pane also" => "Diff pane also", ], // /LIB + "auto-logout-warning" => + [ + "Auto Logout Warning" => "Auto logout warning", + "You will be..." => "You will be logged out after", + "seconds due to..." => "seconds due to inactivity, for security purposes. Use the mouse or hit a key to continue.

    You can adjust or disable this from the Edit > Settings section.", + ], + + "backup-versions" => + [ + "backup" => "backup", + "backups" => "backups", + "available for" => "available for", + ], + "bug-files-check" => [ - "Found in" => "檢索到:" + "Found in" => "檢索到:", ], "file-control" => [ + "Sorry, bad filename..." => "Sorry, bad filename provided. Check the dev tools console for more info?", "Sorry" => "抱歉", "does not seem..." => "服務器上不存在", "Sorry, could not..." => "抱歉, 不能獲取内容", @@ -121,6 +138,7 @@ $text = [ "Sorry, cannot replace..." => "抱歉, 目標不能替換文本", "Sorry, cannot change..." => "抱歉, 目標不能更改權限", "Sorry, cannot delete..." => "抱歉, 不能刪除根級別ROOT", + "Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode", "Sorry, cannot delete" => "抱歉, 不能刪除", "Sorry, this file..." => "抱歉, 此文件已更改, 不能保存", "Reload this file..." => "重新加載該文件, 你的版本複製到一個新文件?", @@ -128,14 +146,45 @@ $text = [ "displayed at" => "顯示在", "Enter filename to..." => "輸入文件名并保存到", "That file exists..." => "該文件已存在, 要覆蓋嗎?", - "Saving" => "正在保存" + "Saving" => "正在保存", + ], + + "ftp-manager" => + [ + "Saving FTP sites" => "Saving FTP sites", + "Cannot update config..." => "Cannot update config file. Please set public write permissions on", + "and try again" => "and try again", + "ftp manager" => "ftp manager", + "Choose existing site" => "Choose existing site", + "Are you sure..." => "Are you sure you wish to remove this site?", + "Add new site" => "Add new site", + "Edit site" => "Edit site", + "Site base" => "Site base", + "Host" => "Host", + "Username" => "Username", + "Password" => "Password", + "PASV and mode" => "PASV and mode", + "Root" => "Root", + "eg http://yourdomain.com" => "eg http://yourdomain.com", + "eg ftp.yourdomain.com" => "eg ftp.yourdomain.com", + "eg user123" => "eg user123", + "eg pass123" => "eg pass123", + "Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary", + "eg /htdocs" => "eg /htdocs", + "PASV connection off" => "PASV connection off", + "PASV connection on" => "PASV connection on", + "ASCII transfer" => "ASCII transfer", + "Binary transfer" => "Binary transfer", + "Add" => "Add", + "Choose" => "Choose", + "Update" => "Update", ], "get-branch" => [], "headers" => [ - "Bad CSRF token..." => "錯誤的 CSRF token. 請在 https://github.com/icecoder/ICEcoder 報告錯誤信息, 以便我們修復它." + "Bad CSRF token..." => "錯誤的 CSRF token. 請在 https://github.com/icecoder/ICEcoder 報告錯誤信息, 以便我們修復它.", ], "help" => @@ -166,6 +215,8 @@ $text = [ "Jump to definition" => "跳轉到 / 跳轉回", "Comment uncomment" => "注釋 / 清楚注釋", "Insert tab indent" => "插入tab / 插入選擇", + "Insert more" => "Indent more", + "Insert less" => "Indent less", "Wrap with div" => "封裝 <div>", "Wrap with span" => "封裝 <span>", "Wrap unwrap p" => "封裝 / 撤銷封裝 <p>", @@ -190,6 +241,7 @@ $text = [ "Close current tab" => "關閉當前選項卡", "Open file prompt" => "打開文件的提示", "Find" => "檢索", + "Previous" => "Previous", "Focus on Go..." => "光標定位到轉到行的輸入框", "Save" => "保存", "Save as" => "另存爲...", @@ -197,17 +249,26 @@ $text = [ "Contract expand file..." => "收縮 / 擴展文件管理器", "Fold unfold current..." => "摺叠 / 展開當前行", "Refocus on document" => "光標重新聚焦到文檔", - "Cancel tasks" => "取消任务" + "Cancel tasks" => "取消任务", + "Zoom out" => "Zoom out all non-function/class declarations", + "Jump to" => "Jump to declaration of class/function", + "Jump to previous tab" => "Jump to previous tab", ], "icecoder" => [ + "results" => "results", "No text selected..." => "搜索中沒有選中的文件", + "all files" => "all files", + "all filenames" => "all filenames", + "selected files" => "selected files", + "selected filenames" => "selected filenames", "Creating Folder" => "正在創建文件夾", "Sorry you can..." => "抱歉, 衹能同時打開100個文件!", "Opening File" => "正在打開文件", "Enter relative file..." => "輸入本地相對路徑 (前綴 /) 或遠程 URL", "Getting" => "正在獲取", + "Saving" => "Saving:", "Please enter the..." => "請輸入新的名稱爲", "Renaming to" => "正在重命名", "Moving to" => "正在移動到", @@ -215,7 +276,13 @@ $text = [ "Pasting File" => "正在粘貼文件", "Sorry cannot paste..." => "抱歉, 無法粘貼到根路徑", "Nothing to paste..." => "粘貼失敗, 請先複製一個文件 / 文件夾!", + "and" => "and", + "this document" => "this document", + "replace" => "replace", + "replace all" => "replace all", + "file" => "file", "Replacing text in" => "正在替換文本", + "Sorry there was..." => "Sorry, there was an error with your request.\\n\\nPlease check your dev tools console for more info.", "Cancelled tasks" => "取消任務", "Open previous files" => "打開以前的文件?", "Please note for..." => "請注意: 需要更新才能工作, 您需要爲所有 ICEcoder 文件和文件夾設置寫如何刪除權限. 如果您需要恢復 ICEcoder 到這個版本, 您可以在 /tmp 目錄找到它們. 點擊 OK 繼續使用自動升級或點擊 cancel 訪問 ICEcoder 官方網站, 您也可以到 GitHub 的項目首頁下載 zip 來手動進行更新.", @@ -223,7 +290,7 @@ $text = [ "Error cannot find..." => "錯誤: 無法找到和進入錯誤日志文件路徑", "No new errors..." => "沒有新的錯誤被找到", "You have made..." => "您已做的更改未保存。您確定要關閉它而不保存嗎?", - "Close all tabs" => "是否關閉所有選項卡?" + "Close all tabs" => "是否關閉所有選項卡?", ], "login" => @@ -232,9 +299,10 @@ $text = [ "login" => "登錄", "To disable registration..." => "要禁用注冊模式, 請進入選項或打開文件 data/config-settings.php 并更改 enableRegistration 爲 false , 并重新載入本頁面", "Registration mode enabled" => "注冊模式已啓用", + "disable further registrations" => "disable further registrations", "auto-check for updates" => "自動檢測更新", "To put into..." => "要禁用多用戶模式, 請進入選項或打開文件 data/config-settings.php 并更改 multiUser 爲 true , 并重新載入本頁面", - "multi-user" => "多用戶" + "multi-user" => "多用戶", ], "multiple-results" => @@ -272,7 +340,7 @@ $text = [ "Update" => "更新", "Install" => "安裝", "Uninstall" => "卸載", - "Reload after install..." => "安裝后需要刷新" + "Reload after install..." => "安裝后需要刷新", ], "properties" => @@ -294,18 +362,18 @@ $text = [ "Write" => "寫入", "Execute" => "執行", "Change to" => "更改爲", - "update" => "更新" + "update" => "更新", ], "settings-common" => [ - "Your document does..." => "你的文檔不是 UTF-8 編碼, 它將被轉換" + "Your document does..." => "你的文檔不是 UTF-8 編碼, 它將被轉換", ], "settings-save-current-files" => [ "Cannot update config..." => "不能更新配置文件. 請爲", - "and try again" => "增加寫入權限并再次嘗試" + "and try again" => "增加寫入權限并再次嘗試", ], "settings-screen" => @@ -316,7 +384,15 @@ $text = [ "git" => "git", "codemirror version" => "codemirror 版本", "file manager root" => "文件管理器的根目錄 ROOT", - "Free to use..." => "您可以免費使用它, 無論商業與否, 衹需讓我知道任何很酷的或有定製的:)同樣我們無任何責任和任何擔保, 使用所有的責任都是你的. 很多個人和公司爲 ICEcoder 作出過貢獻, 在此篇幅有限無法一一列舉, 請訪問貢獻者詳細列表", + "backups" => "backups", + "keep version control..." => "keep version control backups for", + "day" => "day", + "days" => "days", + "of backups stored..." => "of backups stored currently", + "deleting actually moves..." => "deleting actually moves to ICEcoder's tmp dir", + "local/server items..." => "local/server items only", + "Get in contact..." => "Get in contact by...", + "You may use..." => "You may use ICEcoder for your own purposes, commercial or not, just let us know of any cool uses or customisations. :)

    No warranty or liability accepted for anything, all responsibility of use is your own.", "functionality" => "功能", "check for updates..." => "啓動時檢查更新", "auto open last..." => "啓動時自動載入最后打開的文件", @@ -334,20 +410,28 @@ $text = [ "banned files/folders" => "禁止文件 / 文件夾", "banned paths" => "禁止路徑", "ip addresses" => "ip 地址", + "auto-logout after" => "auto-logout after", + "mins of inactivity..." => "mins of inactivity if no unsaved files", "Slash prefixed comma..." => "斜綫前綴, 以半角逗號分隔", "Comma delimited" => "以半角逗號分隔", "style" => "樣式", "theme" => "主題", "line wrapping" => "換行", + "line numbers" => "line numbers", "scrollbars" => "滾動條", "indent type" => "縮進類型", "indent size" => "縮進大小", + "match brackets" => "match brackets", + "show trailing space" => "show trailing space", "font size" => "字體大小", "auto indent" => "auto indent", + "auto close tags" => "auto close tags", + "auto close brackets" => "auto close brackets", "layout" => "佈局", "plugin panel aligned" => "插件版對齊", "file manager" => "文件管理器", "root" => "root", + "Set 0 to..." => "Set 0 to disable", "Slash prefixed" => "斜綫前綴", "bug reporting" => "報告錯誤", "check in files" => "檢查文件", @@ -370,6 +454,19 @@ $text = [ "updater" => [ "Update appears to..." => "更新似乎是成功的" - ] + ], + + "find-in-files" => + [ + "Enter path to search in" => "Enter path to search in", + "Enter semicolon-separated masks..." => "Enter semicolon-separated masks of files to look at (e.g. *.php;*.html;*.js)", + "Type of text" => "Type of text", + "Fixed text" => "Fixed text", + "Regular expression" => "Regular expression", + "Case sensitive" => "Case sensitive", + "Yes" => "Yes", + "No" => "No", + "Search" => "Search", + ], ]; diff --git a/lang/dutch.php b/lang/dutch.php index d127e2d..fc6ad00 100644 --- a/lang/dutch.php +++ b/lang/dutch.php @@ -4,7 +4,6 @@ // @JpaKaagman (GitHub) // Please preserve formatting, line breaks, special characters, anything in and HTML equivalents (eg &). Translations on right side. -// Special chars: http://www.ascii.cl/htmlcodes.htm $text = [ @@ -31,7 +30,7 @@ $text = [ "Lock" => "Vergrendelen", "Refresh" => "Vernieuwen", "Plugins" => "Plugins", - "ROOT" => "[ROOT]" + "ROOT" => "[ROOT]", ], "index" => @@ -96,7 +95,7 @@ $text = [ "View" => "Beeld", "Bug reporting not active" => "Bug rapportage niet actief", "Single pane" => "Enkel pane", - "Diff pane also" => "Ook diff pane" + "Diff pane also" => "Ook diff pane", ], // /LIB @@ -105,19 +104,19 @@ $text = [ [ "Auto Logout Warning" => "Auto logout waarschuwing", "You will be..." => "U wordt uitgelogd na", - "seconds due to..." => "seconden ivm inactiviteit, voor veiligheids doeleinden. Gebruik de muis of druk op een toets om door te gaan.

    U kunt deze functie aanpassen of uitschakelen in Bewerken > Opties." + "seconds due to..." => "seconden ivm inactiviteit, voor veiligheids doeleinden. Gebruik de muis of druk op een toets om door te gaan.

    U kunt deze functie aanpassen of uitschakelen in Bewerken > Opties.", ], "backup-versions" => [ "backup" => "backup", "backups" => "backups", - "available for" => "beschikbaar voor" + "available for" => "beschikbaar voor", ], "bug-files-check" => [ - "Found in" => "Gevonden in:" + "Found in" => "Gevonden in:", ], "file-control" => @@ -150,6 +149,37 @@ $text = [ "Saving" => "Opslaan" ], + "ftp-manager" => + [ + "Saving FTP sites" => "Saving FTP sites", + "Cannot update config..." => "Cannot update config file. Please set public write permissions on", + "and try again" => "and try again", + "ftp manager" => "ftp manager", + "Choose existing site" => "Choose existing site", + "Are you sure..." => "Are you sure you wish to remove this site?", + "Add new site" => "Add new site", + "Edit site" => "Edit site", + "Site base" => "Site base", + "Host" => "Host", + "Username" => "Username", + "Password" => "Password", + "PASV and mode" => "PASV and mode", + "Root" => "Root", + "eg http://yourdomain.com" => "eg http://yourdomain.com", + "eg ftp.yourdomain.com" => "eg ftp.yourdomain.com", + "eg user123" => "eg user123", + "eg pass123" => "eg pass123", + "Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary", + "eg /htdocs" => "eg /htdocs", + "PASV connection off" => "PASV connection off", + "PASV connection on" => "PASV connection on", + "ASCII transfer" => "ASCII transfer", + "Binary transfer" => "Binary transfer", + "Add" => "Add", + "Choose" => "Choose", + "Update" => "Update", + ], + "get-branch" => [], "headers" => @@ -219,7 +249,10 @@ $text = [ "Contract expand file..." => "Inklappen / uitklappen bestandsbeheer", "Fold unfold current..." => "Vouwen / uitvouwen huidige regel", "Refocus on document" => "Herfocus op document", - "Cancel tasks" => "Annuleer taken" + "Cancel tasks" => "Annuleer taken", + "Zoom out" => "Zoom out all non-function/class declarations", + "Jump to" => "Jump to declaration of class/function", + "Jump to previous tab" => "Jump to previous tab", ], "icecoder" => @@ -257,7 +290,7 @@ $text = [ "Error cannot find..." => "Fout: kan geen toegang krijgen of de bestands paden vinden", "No new errors..." => "Geen nieuwe fouten gevonden", "You have made..." => "Er zijn wijzigingen aangetroffen. Wilt u verder gaan zonder op te slaan?", - "Close all tabs" => "Sluit alle tabbladen?" + "Close all tabs" => "Sluit alle tabbladen?", ], "login" => @@ -269,7 +302,7 @@ $text = [ "disable further registrations" => "uitschakelen van verdere registraties", "auto-check for updates" => "automatisch controleren op updates", "To put into..." => "Om de multi-user modus te gebruiken, open het menu opties of open data/config-settings.php en verander multiUser naar true", - "multi-user" => "multi-user" + "multi-user" => "multi-user", ], "multiple-results" => @@ -287,7 +320,7 @@ $text = [ "No matches found" => "Geen overeenkomsten gevonden", "selected" => "geselecteerd", "found in" => "gevonden in", - "Replaced" => "Vervangen" + "Replaced" => "Vervangen", ], "plugins-manager" => @@ -307,7 +340,7 @@ $text = [ "Update" => "Update", "Install" => "Installeren", "Uninstall" => "DeÏnstalleren", - "Reload after install..." => "Opnieuw laden na installatie vereist" + "Reload after install..." => "Opnieuw laden na installatie vereist", ], "properties" => @@ -329,7 +362,7 @@ $text = [ "Write" => "Schrijven", "Execute" => "Uitvoeren", "Change to" => "Veranderen naar", - "update" => "update" + "update" => "update", ], "settings-common" => @@ -356,6 +389,8 @@ $text = [ "day" => "dag", "days" => "dagen", "of backups stored..." => "of backups stored currently", + "deleting actually moves..." => "deleting actually moves to ICEcoder's tmp dir", + "local/server items..." => "local/server items only", "Get in contact..." => "Kom in contact via...", "You may use..." => "Vrij voor eigen gebruik, commercieel of persoonlijk. Laat het ons weten als je toffe aanpassingen maakt :)

    Wij zijn niet aansprakelijk en bieden geen garantie, gebruik op eigen risico.", "functionality" => "functionaliteit", @@ -432,6 +467,6 @@ $text = [ "Yes" => "Ja", "No" => "Nee", "Search" => "Zoek", - ] + ], ]; diff --git a/lang/english.php b/lang/english.php index 9497c74..b284544 100644 --- a/lang/english.php +++ b/lang/english.php @@ -30,7 +30,7 @@ $text = [ "Lock" => "Lock", "Refresh" => "Refresh", "Plugins" => "Plugins", - "ROOT" => "[ROOT]" + "ROOT" => "[ROOT]", ], "index" => @@ -95,7 +95,7 @@ $text = [ "View" => "View", "Bug reporting not active" => "Bug reporting not active", "Single pane" => "Single pane", - "Diff pane also" => "Diff pane also" + "Diff pane also" => "Diff pane also", ], // /LIB @@ -104,19 +104,19 @@ $text = [ [ "Auto Logout Warning" => "Auto logout warning", "You will be..." => "You will be logged out after", - "seconds due to..." => "seconds due to inactivity, for security purposes. Use the mouse or hit a key to continue.

    You can adjust or disable this from the Edit > Settings section." + "seconds due to..." => "seconds due to inactivity, for security purposes. Use the mouse or hit a key to continue.

    You can adjust or disable this from the Edit > Settings section.", ], "backup-versions" => [ "backup" => "backup", "backups" => "backups", - "available for" => "available for" + "available for" => "available for", ], "bug-files-check" => [ - "Found in" => "Found in:" + "Found in" => "Found in:", ], "file-control" => @@ -146,7 +146,7 @@ $text = [ "displayed at" => "displayed at", "Enter filename to..." => "Enter filename to save at", "That file exists..." => "That file exists already, overwrite?", - "Saving" => "Saving" + "Saving" => "Saving", ], "ftp-manager" => @@ -177,14 +177,14 @@ $text = [ "Binary transfer" => "Binary transfer", "Add" => "Add", "Choose" => "Choose", - "Update" => "Update" + "Update" => "Update", ], "get-branch" => [], "headers" => [ - "Bad CSRF token..." => "Bad CSRF token. Please report the error info at https://github.com/icecoder/ICEcoder so it can be fixed." + "Bad CSRF token..." => "Bad CSRF token. Please report the error info at https://github.com/icecoder/ICEcoder so it can be fixed.", ], "help" => @@ -252,7 +252,7 @@ $text = [ "Cancel tasks" => "Cancel tasks", "Zoom out" => "Zoom out all non-function/class declarations", "Jump to" => "Jump to declaration of class/function", - "Jump to previous tab" => "Jump to previous tab" + "Jump to previous tab" => "Jump to previous tab", ], "icecoder" => @@ -290,7 +290,7 @@ $text = [ "Error cannot find..." => "Error: cannot find/access the error file paths", "No new errors..." => "No new errors found", "You have made..." => "You have made changes. Are you sure you want to close without saving?", - "Close all tabs" => "Close all tabs?" + "Close all tabs" => "Close all tabs?", ], "login" => @@ -302,7 +302,7 @@ $text = [ "disable further registrations" => "disable further registrations", "auto-check for updates" => "auto-check for updates", "To put into..." => "To put into multi-user mode, open the settings menu or open data/config-settings.php and change multiUser to true then reload this page", - "multi-user" => "multi-user" + "multi-user" => "multi-user", ], "multiple-results" => @@ -320,7 +320,7 @@ $text = [ "No matches found" => "No matches found", "selected" => "selected", "found in" => "found in", - "Replaced" => "Replaced" + "Replaced" => "Replaced", ], "plugins-manager" => @@ -362,7 +362,7 @@ $text = [ "Write" => "Write", "Execute" => "Execute", "Change to" => "Change to", - "update" => "update" + "update" => "update", ], "settings-common" => @@ -373,7 +373,7 @@ $text = [ "settings-save-current-files" => [ "Cannot update config..." => "Cannot update config file. Please set public write permissions on", - "and try again" => "and try again" + "and try again" => "and try again", ], "settings-screen" => @@ -441,19 +441,19 @@ $text = [ "multi-user" => "multi-user", "Make sure you..." => "Make sure you do not lock yourself out", "Registration" => "Registration", - "update" => "update" + "update" => "update", ], "settings-update" => [ "Cannot update config..." => "Cannot update config file. Please set public write permissions on", "and try again" => "and try again", - "and press refresh" => "and press refresh" + "and press refresh" => "and press refresh", ], "updater" => [ - "Update appears to..." => "Update appears to be successful" + "Update appears to..." => "Update appears to be successful", ], "find-in-files" => @@ -467,6 +467,6 @@ $text = [ "Yes" => "Yes", "No" => "No", "Search" => "Search", - ] + ], ]; diff --git a/lang/french.php b/lang/french.php index 54b8ab0..cea6793 100644 --- a/lang/french.php +++ b/lang/french.php @@ -11,7 +11,6 @@ $text = [ "editor" => [ - "Click icons for..." => "Cliquez sur les icônes
    pour l'aide &
    et infos d'utilisation
    ", "server" => "Serveur", "Server name, OS..." => "Nom du serveur, OS & IP :", "Root" => "Racine :", @@ -24,13 +23,13 @@ $text = [ "files" => "Fichiers", "Last 10 files..." => "10 derniers fichiers ouverts :", "none" => "[aucun]", - "results" => "résultats" ], "files" => [ "Lock" => "Verrouiller", "Refresh" => "Rafraîchir", + "Plugins" => "Plugins", "ROOT" => "[RACINE]" ], @@ -44,6 +43,7 @@ $text = [ "Are you sure you want to close?" => "Are you sure you want to close?", "working" => "en progression", "Color picker" => "Sélecteur de couleur", + "Plugins Manager" => "Plugins Manager", "New File" => "Nouveau fichier", "New Folder" => "Nouveau dossier", "Upload File(s)" => "Télécharger le(s) Fichier(s)", @@ -58,7 +58,7 @@ $text = [ "Properties" => "Propriétés", "File" => "Fichier", "Edit" => "Editer", - "Remote" => "Distant", + "Source" => "Source", "Help" => "Aide", "Save" => "Enregistrer", "Save As" => "Enregistrer sous", @@ -82,22 +82,38 @@ $text = [ "website" => "Site internet", "Close all tabs" => "Fermer les onglets", "Alphabetize tabs" => "Onglets par ordre alphabétique", -// "Find" => "Chercher", -// "in" => "dans", -// "and" => "et", -// "replace" => "remplacer", -// "replace all" => "remplacer tout", -// "this document" => "ce document", -// "open documents" => "les documents ouverts", -// "all files" => "tous les fichiers", -// "all filenames" => "tous les noms de fichiers", + "Find" => "Chercher", + "in" => "dans", + "and" => "et", + "replace" => "remplacer", + "replace all" => "remplacer tout", + "this document" => "ce document", + "open documents" => "les documents ouverts", + "all files" => "tous les fichiers", + "all filenames" => "tous les noms de fichiers", "Go to Line" => "Aller à la ligne", "View" => "Afficher", - "Bug reporting not active" => "Le signalement de dysfonctionnement n'est pas actif" + "Bug reporting not active" => "Le signalement de dysfonctionnement n'est pas actif", + "Single pane" => "Single pane", + "Diff pane also" => "Diff pane also", ], // /LIB + "auto-logout-warning" => + [ + "Auto Logout Warning" => "Auto logout warning", + "You will be..." => "You will be logged out after", + "seconds due to..." => "seconds due to inactivity, for security purposes. Use the mouse or hit a key to continue.

    You can adjust or disable this from the Edit > Settings section.", + ], + +"backup-versions" => + [ + "backup" => "backup", + "backups" => "backups", + "available for" => "available for", + ], + "bug-files-check" => [ "Found in" => "Trouvé dans :" @@ -105,6 +121,7 @@ $text = [ "file-control" => [ + "Sorry, bad filename..." => "Sorry, bad filename provided. Check the dev tools console for more info?", "Sorry" => "Désolé", "does not seem..." => "ne semble pas exister sur le serveur", "Sorry, could not..." => "Désolé, impossibilité de récupérer le contenu de", @@ -120,6 +137,7 @@ $text = [ "Sorry, cannot save" => "Désolé, impossibilité de sauvegarder", "Sorry, cannot replace..." => "Désolé, impossibilité de remplacer le texte dans ", "Sorry, cannot change..." => "Désolé, impossibilité de changer les permissions sur", + "Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode", "Sorry, cannot delete..." => "Désolé, imossibilité de supprimer le dossier racine", "Sorry, cannot delete" => "Désolé, impossibilité d'effacer", "Sorry, this file..." => "Désolé, le fichier a été modifié, impossibilité de sauvegarder", @@ -128,14 +146,45 @@ $text = [ "displayed at" => "affiché sur", "Enter filename to..." => "Saisissez le nom du fichier à enregistrer sur", "That file exists..." => "Ce fichier existe déjà, voulez vous l'écraser ?", - "Saving" => "Sauvegardé" + "Saving" => "Sauvegardé", ], + "ftp-manager" => + [ + "Saving FTP sites" => "Saving FTP sites", + "Cannot update config..." => "Cannot update config file. Please set public write permissions on", + "and try again" => "and try again", + "ftp manager" => "ftp manager", + "Choose existing site" => "Choose existing site", + "Are you sure..." => "Are you sure you wish to remove this site?", + "Add new site" => "Add new site", + "Edit site" => "Edit site", + "Site base" => "Site base", + "Host" => "Host", + "Username" => "Username", + "Password" => "Password", + "PASV and mode" => "PASV and mode", + "Root" => "Root", + "eg http://yourdomain.com" => "eg http://yourdomain.com", + "eg ftp.yourdomain.com" => "eg ftp.yourdomain.com", + "eg user123" => "eg user123", + "eg pass123" => "eg pass123", + "Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary", + "eg /htdocs" => "eg /htdocs", + "PASV connection off" => "PASV connection off", + "PASV connection on" => "PASV connection on", + "ASCII transfer" => "ASCII transfer", + "Binary transfer" => "Binary transfer", + "Add" => "Add", + "Choose" => "Choose", + "Update" => "Update", + ], + "get-branch" => [], "headers" => [ - "Bad CSRF token..." => "Mauvais jeton CSRF. S'il vous plaît, envoyer un rapport de l'erreur à https://github.com/icecoder/ICEcoder si vous désirez qu'il soit corrigé." + "Bad CSRF token..." => "Mauvais jeton CSRF. S'il vous plaît, envoyer un rapport de l'erreur à https://github.com/icecoder/ICEcoder si vous désirez qu'il soit corrigé.", ], "help" => @@ -166,6 +215,8 @@ $text = [ "Jump to definition" => "Aller à la définition / revenir en arrière", "Comment uncomment" => "Commenter / Décommenter", "Insert tab indent" => "Insérer un tableau / indent selected", + "Insert more" => "Indent more", + "Insert less" => "Indent less", "Wrap with div" => "Plier avec <div>", "Wrap with span" => "Plier avec <span>", "Wrap unwrap p" => "Plier / déplier avec <p>", @@ -174,6 +225,7 @@ $text = [ "Wrap unwrap i" => "Plier / déplier avec <i>", "Wrap unwrap strong" => "Plier / déplier avec <strong>", "Wrap unwrap em" => "Plier / déplier avec <em>", + "Wrap unwrap li" => "Wrap / unwrap with <li>", "Wrap unwrap h1..." => "Plier / déplier avec <h1> - <h3>", "End line with..." => "Fin de ligne avec <br>", "Close tab" => "Fermer l'onglet", @@ -189,6 +241,7 @@ $text = [ "Close current tab" => "Fermer l'onglet courant", "Open file prompt" => "Ouvrir une invite de fichier", "Find" => "Chercher", + "Previous" => "Previous", "Focus on Go..." => " Focus sur le début de ligne", "Save" => "Enregistrer", "Save as" => "Enregistrer sous...", @@ -196,11 +249,15 @@ $text = [ "Contract expand file..." => "Réduire / agrandir le gestionnaire de fichiers", "Fold unfold current..." => "Plier / déplier la ligne courante", "Refocus on document" => "Revenir sur le document", - "Cancel tasks" => "Quitter les tâches" + "Cancel tasks" => "Quitter les tâches", + "Zoom out" => "Zoom out all non-function/class declarations", + "Jump to" => "Jump to declaration of class/function", + "Jump to previous tab" => "Jump to previous tab", ], "icecoder" => [ + "results" => "results", "No text selected..." => "Aucun texte sélectionné pour la recherche sur", "all files" => "tous les fichiers", "all filenames" => "tous les noms de fichiers", @@ -211,6 +268,7 @@ $text = [ "Opening File" => "Ouverture de fichier", "Enter relative file..." => "Entrez le chemin relatif du fichier (préfixé avec un /) ou l'URL distante", "Getting" => "Obtention", + "Saving" => "Saving:", "Please enter the..." => "S'il vous plait, saisissez le nouveau nom pour", "Renaming to" => "Renommé en", "Moving to" => "Déplacé vers", @@ -224,6 +282,7 @@ $text = [ "replace all" => "tout remplacer", "file" => "fichier", "Replacing text in" => "Remplacement de texte dans", + "Sorry there was..." => "Sorry, there was an error with your request.\\n\\nPlease check your dev tools console for more info.", "Cancelled tasks" => "Tâches annulés", "Open previous files" => "Ouvrir les fichiers précédents ?", "Please note for..." => "S'il vous plaît, noter : la mise à jour fonctionne correctement, vous devez avoir les permissions d'écriture / suppression à tous les répertoires et fichiers d'ICEcoder. Si vous avez besoin de récupérer cette version d'ICEcoder pour une raison quelconque, vous la trouverez dans le répertoire / tmp. Cliquez sur OK pour procéder à une mise à jour automatique, ou annuler et visiter le site d'ICEcoder de sorte que vous pouvez récupérer le fichier zip et mettre à jour manuellement.", @@ -232,7 +291,6 @@ $text = [ "No new errors..." => "Aucune nouvelle erreur trouvée", "You have made..." => "Vous avez réalisé des modifications. Etes vous sûr(e) de désirer quitter sans sauvegarder ?", "Close all tabs" => "Fermer tous les onglets?", - "results" => "résultats" ], "login" => @@ -241,9 +299,10 @@ $text = [ "login" => "Connexion", "To disable registration..." => "Pour désactiver le mode 'enregsitrement', ouvrir le menu des préférences ou le fichier data/config-settings.php et modifier enableRegistration à 'false', puis recharger cette page", "Registration mode enabled" => "Mode Enregistrement activé", + "disable further registrations" => "disable further registrations", "auto-check for updates" => "Vérification automatique des mises à jour", "To put into..." => "Pour passer en mode 'multi-utilisateur', ouvrir le menu des preférences ou le ifchier data/config-settings.php et modifier multiUser à 'true', puis recharger cette page", - "multi-user" => "Multi-utilisateur" + "multi-user" => "Multi-utilisateur", ], "multiple-results" => @@ -261,7 +320,7 @@ $text = [ "No matches found" => "Aucun résultat de trouver", "selected" => "sélectionné", "found in" => "trouvé dans", - "Replaced" => "Remplacé" + "Replaced" => "Remplacé", ], "plugins-manager" => @@ -281,7 +340,7 @@ $text = [ "Update" => "Mise à jour", "Install" => "Installation", "Uninstall" => "Désinstallation", - "Reload after install..." => "Une reconnexion est nécessaire après l'installation" + "Reload after install..." => "Une reconnexion est nécessaire après l'installation", ], "properties" => @@ -303,18 +362,18 @@ $text = [ "Write" => "Ecrire", "Execute" => "Exécuter", "Change to" => "Modifier en", - "update" => "mise à jour" + "update" => "mise à jour", ], "settings-common" => [ - "Your document does..." => "Votre document ne semble pas être en UTF-8 et a donc été converti" + "Your document does..." => "Votre document ne semble pas être en UTF-8 et a donc été converti", ], "settings-save-current-files" => [ "Cannot update config..." => "Impossibilité de mettre à jour le fichier de configuration. Vérifiez les permissions d'écriture sur celui-ci", - "and try again" => "et essayez de nouveau" + "and try again" => "et essayez de nouveau", ], "settings-screen" => @@ -325,7 +384,15 @@ $text = [ "git" => "git", "codemirror version" => "version de codemirror ", "file manager root" => "racine du gestionnaire de fichiers", - "Free to use..." => "Libre de l'utiliser pour vos propres fins, commerciales ou non, faites moi juste savoir de toute utilisation sympa ou personnalisations. :)

    Aucune garantie ou responsabilité est acceptées de notre part, toute responsabilité d'utilisation est de votre ressort.

    De nombreuses personnes fantastiques et d'entreprises ont contribué à réaliser ICEcoder et il est important de les remercier ici. S'il vous plaît, parcourez la liste complète sur", + "backups" => "backups", + "keep version control..." => "keep version control backups for", + "day" => "day", + "days" => "days", + "of backups stored..." => "of backups stored currently", + "deleting actually moves..." => "deleting actually moves to ICEcoder's tmp dir", + "local/server items..." => "local/server items only", + "Get in contact..." => "Get in contact by...", + "You may use..." => "You may use ICEcoder for your own purposes, commercial or not, just let us know of any cool uses or customisations. :)

    No warranty or liability accepted for anything, all responsibility of use is your own.", "functionality" => "fonctionnalités", "check for updates..." => "Vérifier les mises à jour", "auto open last..." => "affichage des derniers fichiers", @@ -343,20 +410,28 @@ $text = [ "banned files/folders" => "fichiers/dossiers bannis", "banned paths" => "chemins bannis", "ip addresses" => "adresses ip", + "auto-logout after" => "auto-logout after", + "mins of inactivity..." => "mins of inactivity if no unsaved files", "Slash prefixed comma..." => "Slash préfixé, séparées par des virgules", "Comma delimited" => "Délimité par des virgules", "style" => "style", "theme" => "thème", "line wrapping" => "retour à la ligne", + "line numbers" => "line numbers", "scrollbars" => "barres de défilement", "indent type" => "indent type", "indent size" => "indent size", + "match brackets" => "match brackets", + "show trailing space" => "show trailing space", "font size" => "font size", "auto indent" => "auto indent", + "auto close tags" => "auto close tags", + "auto close brackets" => "auto close brackets", "layout" => "disposition", "plugin panel aligned" => "panneau des plugins aligné", "file manager" => "gestionnaire de fichiers", "root" => "racine", + "Set 0 to..." => "Set 0 to disable", "Slash prefixed" => "Slash préfixé", "bug reporting" => "Rapport de dysfonctionnement", "check in files" => "vérifier dans les fichiers", @@ -366,19 +441,32 @@ $text = [ "multi-user" => "multi-utilisateurs", "Make sure you..." => "Assurez-vous que vous ne vous bloquez pas sur", "Registration" => "Enregistrement", - "update" => "Mise à jour" + "update" => "Mise à jour", ], "settings-update" => [ "Cannot update config..." => "Impossibilité de mettre à jour le fichier de configuration. Vérifiez les permissions d'écriture sur celui-ci", "and try again" => "et essayez de nouveau", - "and press refresh" => "et pressez le rafraîchissement de la page" + "and press refresh" => "et pressez le rafraîchissement de la page", ], "updater" => [ - "Update appears to..." => "La mise à jour semble s'être réalisée avec succès" - ] + "Update appears to..." => "La mise à jour semble s'être réalisée avec succès", + ], + + "find-in-files" => + [ + "Enter path to search in" => "Enter path to search in", + "Enter semicolon-separated masks..." => "Enter semicolon-separated masks of files to look at (e.g. *.php;*.html;*.js)", + "Type of text" => "Type of text", + "Fixed text" => "Fixed text", + "Regular expression" => "Regular expression", + "Case sensitive" => "Case sensitive", + "Yes" => "Yes", + "No" => "No", + "Search" => "Search", + ], ]; diff --git a/lang/german.php b/lang/german.php index 64fc4d8..5f4135c 100644 --- a/lang/german.php +++ b/lang/german.php @@ -11,7 +11,6 @@ $text = [ "editor" => [ - "Click icons for..." => "Klick auf das Icon
    für Hilfe &
    Anwendungsbeispielen
    ", "server" => "Server", "Server name, OS..." => "Servername, OS & IP:", "Root" => "Root:", @@ -24,14 +23,14 @@ $text = [ "files" => "Dateien", "Last 10 files..." => "Die letzten 10 geöffneten Dateien:", "none" => "[nichts]", - "results" => "Ergebnis" ], "files" => [ "Lock" => "Sperren", "Refresh" => "Erneueren", - "ROOT" => "[ROOT]" + "Plugins" => "Plugins", + "ROOT" => "[ROOT]", ], "index" => @@ -41,9 +40,10 @@ $text = [ "Your version is" => "Deine Version ist", "Update now" => "Jetzt aktualisieren", "You have some..." => "Du hast einige nicht gespeicherete Dateien", - "Are you sure you want to close?" => "Are you sure you want to close?", + "Are you sure..." => "Are you sure you want to close?", "working" => "arbeite", "Color picker" => "Farbauswahl", + "Plugins Manager" => "Plugins Manager", "New File" => "Neue Datei", "New Folder" => "Neuer Ordner", "Upload File(s)" => "Datei(en) hochladen", @@ -58,7 +58,7 @@ $text = [ "Properties" => "Einstellungen", "File" => "Datei", "Edit" => "Editieren", - "Remote" => "Fernzugriff", + "Source" => "Source", "Help" => "Hilfe", "Save" => "Speichern", "Save As" => "Speichern als", @@ -82,29 +82,46 @@ $text = [ "website" => "Website", "Close all tabs" => "Alle Tabs schließen", "Alphabetize tabs" => "Tabs alphabetisch sortieren", -// "Find" => "Finden", -// "in" => "in", -// "and" => "und", -// "replace" => "ersetzen", -// "replace all" => "alle ersetzen", -// "this document" => "dieses Dokument", -// "open documents" => "geöffnete Dokumente", -// "all files" => "Alle Dateien", -// "all filenames" => "Alle Dateinamen", + "Find" => "Finden", + "in" => "in", + "and" => "und", + "replace" => "ersetzen", + "replace all" => "alle ersetzen", + "this document" => "dieses Dokument", + "open documents" => "geöffnete Dokumente", + "all files" => "Alle Dateien", + "all filenames" => "Alle Dateinamen", "Go to Line" => "Geh zur Zeile", "View" => "Anzeigen", - "Bug reporting not active" => "Fehlermeldungen sind nicht aktiv" + "Bug reporting not active" => "Fehlermeldungen sind nicht aktiv", + "Single pane" => "Single pane", + "Diff pane also" => "Diff pane also", ], // /LIB + "auto-logout-warning" => + [ + "Auto Logout Warning" => "Auto logout warning", + "You will be..." => "You will be logged out after", + "seconds due to..." => "seconds due to inactivity, for security purposes. Use the mouse or hit a key to continue.

    You can adjust or disable this from the Edit > Settings section.", + ], + + "backup-versions" => + [ + "backup" => "backup", + "backups" => "backups", + "available for" => "available for", + ], + "bug-files-check" => [ - "Found in" => "Gefunden in:" + "Found in" => "Gefunden in:", ], "file-control" => [ + "Sorry, bad filename..." => "Sorry, bad filename provided. Check the dev tools console for more info?", "Sorry" => "Entschuldigung", "does not seem..." => "Es scheint auf dem Server nicht zu existieren", "Sorry, could not..." => "Entschuldigung, kann den Inhalte von", @@ -120,6 +137,7 @@ $text = [ "Sorry, cannot save" => "Entschuldigung, kann nicht speichern", "Sorry, cannot replace..." => "Entschuldigung, kann den Text nicht ersetzen", "Sorry, cannot change..." => "Entschuldigung, kann die Berechtigung nicht ändern für", + "Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode", "Sorry, cannot delete..." => "Entschuldigung, kann das Hauptverzeichnis nicht löschen", "Sorry, cannot delete" => "Entschuldigung, kann nicht löschen", "Sorry, this file..." => "Entschuldigung, die Datei wurde geändert, kann nicht speichern", @@ -128,14 +146,45 @@ $text = [ "displayed at" => "angezeigt bei", "Enter filename to..." => "Dateinamen eingeben um es zu speichern", "That file exists..." => "Die Datei existiert bereits, überschreiben?", - "Saving" => "Speichere" + "Saving" => "Speichere", + ], + + "ftp-manager" => + [ + "Saving FTP sites" => "Saving FTP sites", + "Cannot update config..." => "Cannot update config file. Please set public write permissions on", + "and try again" => "and try again", + "ftp manager" => "ftp manager", + "Choose existing site" => "Choose existing site", + "Are you sure..." => "Are you sure you wish to remove this site?", + "Add new site" => "Add new site", + "Edit site" => "Edit site", + "Site base" => "Site base", + "Host" => "Host", + "Username" => "Username", + "Password" => "Password", + "PASV and mode" => "PASV and mode", + "Root" => "Root", + "eg http://yourdomain.com" => "eg http://yourdomain.com", + "eg ftp.yourdomain.com" => "eg ftp.yourdomain.com", + "eg user123" => "eg user123", + "eg pass123" => "eg pass123", + "Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary", + "eg /htdocs" => "eg /htdocs", + "PASV connection off" => "PASV connection off", + "PASV connection on" => "PASV connection on", + "ASCII transfer" => "ASCII transfer", + "Binary transfer" => "Binary transfer", + "Add" => "Add", + "Choose" => "Choose", + "Update" => "Update", ], "get-branch" => [], "headers" => [ - "Bad CSRF token..." => "Fehlerhafter CSRF Token. Bitte den Fehler an https://github.com/icecoder/ICEcoder damit das Problem gelöst werden kann." + "Bad CSRF token..." => "Fehlerhafter CSRF Token. Bitte den Fehler an https://github.com/icecoder/ICEcoder damit das Problem gelöst werden kann.", ], "help" => @@ -166,6 +215,8 @@ $text = [ "Jump to definition" => "Zur Definition springen / zur¨ck springen", "Comment uncomment" => "Kommentieren / Auskommentieren", "Insert tab indent" => "Tab einfügen / Gedankenstrich selektiert", + "Insert more" => "Indent more", + "Insert less" => "Indent less", "Wrap with div" => "Mit <div> umschließen", "Wrap with span" => "Mit <span> umschließen", "Wrap unwrap p" => "Umschließen / unwrap with <p>", @@ -174,6 +225,7 @@ $text = [ "Wrap unwrap i" => "Umschließen / Mit <i> auschließen", "Wrap unwrap strong" => "Umschließen / Mit <strong> auschließen", "Wrap unwrap em" => "Umschließen / Mit <em> auschließen", + "Wrap unwrap li" => "Wrap / unwrap with <li>", "Wrap unwrap h1..." => "Umschließen / Mit <h1> - <h3> auschließen", "End line with..." => "Zeile abschließen mit <br>", "Close tab" => "Tab schließen", @@ -189,6 +241,7 @@ $text = [ "Close current tab" => "Aktuellen Tab schließen", "Open file prompt" => "Datei öffnen Dialog anzeigen", "Find" => "Finden", + "Previous" => "Previous", "Focus on Go..." => "Fokus auf Gehe zu Zeile Feld setzen", "Save" => "Speichern", "Save as" => "Speichern als ...", @@ -196,7 +249,48 @@ $text = [ "Contract expand file..." => "Alle Dateien / Verzeichnisse anzeigen", "Fold unfold current..." => "Aktuelle Zeile einklappen", "Refocus on document" => "Erneut den Fokus auf das Dokument setzen", - "Cancel tasks" => "Vorgang abbrechen" + "Cancel tasks" => "Vorgang abbrechen", + "Zoom out" => "Zoom out all non-function/class declarations", + "Jump to" => "Jump to declaration of class/function", + "Jump to previous tab" => "Jump to previous tab", + ], + + "icecoder" => + [ + "results" => "results", + "No text selected..." => "No text selected to search on", + "all files" => "all files", + "all filenames" => "all filenames", + "selected files" => "selected files", + "selected filenames" => "selected filenames", + "Creating Folder" => "Creating Folder", + "Sorry you can..." => "Sorry, you can only have 100 files open at a time!", + "Opening File" => "Opening File", + "Enter relative file..." => "Enter relative file path (prefixed with /) or remote URL\\nYou can enter \\n'/path/file:123' or \\n'/path/file(123)' or \\n'/path/file.ext line 123' \\nto go directly to particular line", + "Getting" => "Getting", + "Saving" => "Saving:", + "Please enter the..." => "Please enter the new name for", + "Renaming to" => "Renaming to", + "Moving to" => "Moving to", + "Deleting File" => "Deleting File", + "Pasting File" => "Pasting File", + "Sorry cannot paste..." => "Sorry, cannot paste a whole root", + "Nothing to paste..." => "Nothing to paste, copy a file/folder first!", + "and" => "and", + "this document" => "this document", + "replace" => "replace", + "replace all" => "replace all", + "file" => "file", + "Replacing text in" => "Replacing text in", + "Sorry there was..." => "Sorry, there was an error with your request.\\n\\nPlease check your dev tools console for more info.", + "Cancelled tasks" => "Cancelled tasks", + "Open previous files" => "Open previous files?", + "Please note for..." => "Please note: for updating to work properly, you need to have write access on all ICEcoder dirs & files. It will first check if this is the case and list any unwriteable (and therefore unmoveable) files.\\n\\nIf you need to recover this version of ICEcoder for any reason, you'll find it in the /tmp dir.\\n\\nClick OK to proceed with the check and auto-update, or cancel to visit the ICEcoder site so you can grab the zip and update manually.", + "You can start..." => "You can start bug reporting in Help > Settings", + "Error cannot find..." => "Error: cannot find/access the error file paths", + "No new errors..." => "No new errors found", + "You have made..." => "You have made changes. Are you sure you want to close without saving?", + "Close all tabs" => "Close all tabs?", ], "login" => @@ -205,9 +299,10 @@ $text = [ "login" => "Login", "To disable registration..." => "Um den Registrierungsmodus zu deaktivieren, öffne im Menü die Einstellungen oder die Datein data/config-settings.php und setze unter enableRegistration auf false, danach lade die Seite erneut.", "Registration mode enabled" => "Registrierungsmodus aktiviert", + "disable further registrations" => "disable further registrations", "auto-check for updates" => "Automatisch nach Update suchen", "To put into..." => "Um den Mehrbenutzermodus zu aktivieren, öffne im Menü die Einstellungen oder die Datein data/config-settings.php und setze unter multiUser auf true, danach lade die Seite erneut", - "multi-user" => "Mehrbenutzermodus" + "multi-user" => "Mehrbenutzermodus", ], "multiple-results" => @@ -225,7 +320,7 @@ $text = [ "No matches found" => "Nichts gefunden", "selected" => "Ausgewählte", "found in" => "Gefunden in", - "Replaced" => "Ersetzen" + "Replaced" => "Ersetzen", ], "plugins-manager" => @@ -245,7 +340,7 @@ $text = [ "Update" => "Update", "Install" => "Installieren", "Uninstall" => "Deinstallieren", - "Reload after install..." => "Neuladen nach der Installation erforderlich" + "Reload after install..." => "Neuladen nach der Installation erforderlich", ], "properties" => @@ -267,18 +362,18 @@ $text = [ "Write" => "Schreiben", "Execute" => "Ausführen", "Change to" => "Ändern um", - "update" => "aktualisieren" + "update" => "aktualisieren", ], "settings-common" => [ - "Your document does..." => "Das Dokument scheint nicht in UTF-8 codiert zu sein, darum wurde es angepasst" + "Your document does..." => "Das Dokument scheint nicht in UTF-8 codiert zu sein, darum wurde es angepasst", ], "settings-save-current-files" => [ "Cannot update config..." => "Kann Konfigurationsdatei nicht aktualisieren. Bitte Schreibrechte vergeben", - "and try again" => "und versuch es noch mal" + "and try again" => "und versuch es noch mal", ], "settings-screen" => @@ -289,7 +384,15 @@ $text = [ "git" => "git", "codemirror version" => "CodeMirror Version", "file manager root" => "Stammverzeichnis vom Dateimanager", - "Free to use..." => "Kostenfrei nutzbar, kommerziell oder nicht. Gebt mir Bescheid über eure Nutzung oder Anpassungen. :)

    Keine Garantie oder Haftung, Nutzung auf eigene Gefahr.

    Viele fantastische Leute und Unternehmen haben dabei geholfen ICEcoder zu dem zu machen, was es heute ist. Und es sind zu viele um ihnen einzelen zu danken. Eine vollständige Liste gibt es unter", + "backups" => "backups", + "keep version control..." => "keep version control backups for", + "day" => "day", + "days" => "days", + "of backups stored..." => "of backups stored currently", + "deleting actually moves..." => "deleting actually moves to ICEcoder's tmp dir", + "local/server items..." => "local/server items only", + "Get in contact..." => "Get in contact by...", + "You may use..." => "You may use ICEcoder for your own purposes, commercial or not, just let us know of any cool uses or customisations. :)

    No warranty or liability accepted for anything, all responsibility of use is your own.", "functionality" => "Funktionalität", "check for updates..." => "Bei jedem Ladem nach Updates suchen", "auto open last..." => "Lade automatisch alle zuletzt geöffneten Datein beim Login", @@ -307,20 +410,28 @@ $text = [ "banned files/folders" => "verbannte Dateien/Verzeichnisse", "banned paths" => "verbannte Verzeichnisse", "ip addresses" => "IP Adressen", + "auto-logout after" => "auto-logout after", + "mins of inactivity..." => "mins of inactivity if no unsaved files", "Slash prefixed comma..." => "Schrägstrich vorangestellt, durch Komma getrennt", "Comma delimited" => "Komma getrennt", "style" => "Style", "theme" => "Theme", "line wrapping" => "Zeilenumbruch", + "line numbers" => "line numbers", "scrollbars" => "Bildlaufleisten", "indent type" => "Einrückung mit", "indent size" => "Tabweite", + "match brackets" => "match brackets", + "show trailing space" => "show trailing space", "font size" => "Schriftgröße", "auto indent" => "auto indent", + "auto close tags" => "auto close tags", + "auto close brackets" => "auto close brackets", "layout" => "Layout", "plugin panel aligned" => "Ausrichtung Plugin-Panel", "file manager" => "Dateimanager", "root" => "Stammordner", + "Set 0 to..." => "Set 0 to disable", "Slash prefixed" => "Schrägstrich vorangestellt", "bug reporting" => "Fehlermeldung", "check in files" => "Dateien einchecken", @@ -330,19 +441,32 @@ $text = [ "multi-user" => "Mehrbenutzer", "Make sure you..." => "Sei sicher, dass du dich nicht selber aussperrst", "Registration" => "Registrieren", - "update" => "aktualisieren" + "update" => "aktualisieren", ], "settings-update" => [ "Cannot update config..." => "Kann Konfigurationsdatei nicht aktualisieren. Bitte Schreibrechte vergeben", "and try again" => "und versuch es noch einmal", - "and press refresh" => "und drück Neu laden" + "and press refresh" => "und drück Neu laden", ], "updater" => [ - "Update appears to..." => "Update scheint erolgreich gelaufen zu sein" - ] + "Update appears to..." => "Update scheint erolgreich gelaufen zu sein", + ], + + "find-in-files" => + [ + "Enter path to search in" => "Enter path to search in", + "Enter semicolon-separated masks..." => "Enter semicolon-separated masks of files to look at (e.g. *.php;*.html;*.js)", + "Type of text" => "Type of text", + "Fixed text" => "Fixed text", + "Regular expression" => "Regular expression", + "Case sensitive" => "Case sensitive", + "Yes" => "Yes", + "No" => "No", + "Search" => "Search", + ], ]; diff --git a/lang/italian.php b/lang/italian.php index 57637fa..03ca588 100644 --- a/lang/italian.php +++ b/lang/italian.php @@ -2,7 +2,6 @@ // Italian language translation // by: @pietrondo (GitHub) // @pietrobravo (Twitter) -// blog.pietrocapriata.me (sito web) // Please preserve formatting, line breaks, special characters, anything in and HTML equivalents (eg &). Translations on right side. @@ -12,9 +11,9 @@ $text = [ "editor" => [ - "server" => "server", - "Server name, OS..." => "Nome server, Sistema operativo e indirizzo IP...", - "Root" => "Root:", + "server" => "server", + "Server name, OS..." => "Nome server, Sistema operativo e indirizzo IP...", + "Root" => "Root:", "ICEcoder root" => "ICEcoder root:", "PHP version" => "Versione PHP", "Date & time" => "Ora e data:", @@ -31,7 +30,7 @@ $text = [ "Lock" => "Blocca", "Refresh" => "Aggiorna", "Plugins" => "Plugins", - "ROOT" => "[ROOT]" + "ROOT" => "[ROOT]", ], "index" => @@ -96,18 +95,33 @@ $text = [ "View" => "Visualizza", "Bug reporting not active" => "Segnalazione bug non attiva", "Single pane" => "Pannello singolo", - "Diff pane also" => "Pannello delle differenze" + "Diff pane also" => "Pannello delle differenze", ], // /LIB + "auto-logout-warning" => + [ + "Auto Logout Warning" => "Auto logout warning", + "You will be..." => "You will be logged out after", + "seconds due to..." => "seconds due to inactivity, for security purposes. Use the mouse or hit a key to continue.

    You can adjust or disable this from the Edit > Settings section.", + ], + + "backup-versions" => + [ + "backup" => "backup", + "backups" => "backups", + "available for" => "available for", + ], + "bug-files-check" => [ - "Found in" => "Trovato in:" + "Found in" => "Trovato in:", ], "file-control" => [ + "Sorry, bad filename..." => "Sorry, bad filename provided. Check the dev tools console for more info?", "Sorry" => "Spiacente", "does not seem..." => "non sembra esistere sul server", "Sorry, could not..." => "Siamo spiacenti, non è possibile ottenere i contenuti di", @@ -123,6 +137,7 @@ $text = [ "Sorry, cannot save" => "Siamo spiacenti, non è possibile salvare", "Sorry, cannot replace..." => "Siamo spiacenti, non è possibile sostituire il testo", "Sorry, cannot change..." => "Siamo spiacenti, non è possibile cambiare i permessi", + "Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode", "Sorry, cannot delete..." => "Siamo spiacenti, non è possibile cancellare la cartella root", "Sorry, cannot delete" => "Siamo spiacenti, non è possibile cancellare", "Sorry, this file..." => "Siamo spiacenti, questo file è stato cambiato, non è possibile salvarlo", @@ -131,14 +146,45 @@ $text = [ "displayed at" => "visualizzato in", "Enter filename to..." => "Inserisci il nome del file da salvare in", "That file exists..." => "Questo file esiste già, sovrascrivere??", - "Saving" => "Stiamo salvando" + "Saving" => "Stiamo salvando", + ], + + "ftp-manager" => + [ + "Saving FTP sites" => "Saving FTP sites", + "Cannot update config..." => "Cannot update config file. Please set public write permissions on", + "and try again" => "and try again", + "ftp manager" => "ftp manager", + "Choose existing site" => "Choose existing site", + "Are you sure..." => "Are you sure you wish to remove this site?", + "Add new site" => "Add new site", + "Edit site" => "Edit site", + "Site base" => "Site base", + "Host" => "Host", + "Username" => "Username", + "Password" => "Password", + "PASV and mode" => "PASV and mode", + "Root" => "Root", + "eg http://yourdomain.com" => "eg http://yourdomain.com", + "eg ftp.yourdomain.com" => "eg ftp.yourdomain.com", + "eg user123" => "eg user123", + "eg pass123" => "eg pass123", + "Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary", + "eg /htdocs" => "eg /htdocs", + "PASV connection off" => "PASV connection off", + "PASV connection on" => "PASV connection on", + "ASCII transfer" => "ASCII transfer", + "Binary transfer" => "Binary transfer", + "Add" => "Add", + "Choose" => "Choose", + "Update" => "Update", ], "get-branch" => [], "headers" => [ - "Bad CSRF token..." => "Bad CSRF token. Per favore riporta l\'errore a https://github.com/icecoder/ICEcoder così che possa essere fixato." + "Bad CSRF token..." => "Bad CSRF token. Per favore riporta l\'errore a https://github.com/icecoder/ICEcoder così che possa essere fixato.", ], "help" => @@ -169,6 +215,8 @@ $text = [ "Jump to definition" => "Vai a definizione / torna indietro", "Comment uncomment" => "Commento / decommenta", "Insert tab indent" => "Inserisci tab / rientro selezionato", + "Insert more" => "Indent more", + "Insert less" => "Indent less", "Wrap with div" => "Includi con <div>", "Wrap with span" => "Includi <span>", "Wrap unwrap p" => "Includi / escludi con <p>", @@ -193,6 +241,7 @@ $text = [ "Close current tab" => "Chiudi tab corrente", "Open file prompt" => "Open file prompt", "Find" => "Trova", + "Previous" => "Previous", "Focus on Go..." => "Focus on Go to line input", "Save" => "Salva", "Save as" => "Salva come...", @@ -200,7 +249,10 @@ $text = [ "Contract expand file..." => "Contrai / espandi file manager", "Fold unfold current..." => "Piega / dispiega riga corrente", "Refocus on document" => "Refocus sul documento", - "Cancel tasks" => "Cancella compito" + "Cancel tasks" => "Cancella compito", + "Zoom out" => "Zoom out all non-function/class declarations", + "Jump to" => "Jump to declaration of class/function", + "Jump to previous tab" => "Jump to previous tab", ], "icecoder" => @@ -216,6 +268,7 @@ $text = [ "Opening File" => "Apertura file", "Enter relative file..." => "Digita il percorso relativo (con / di prefisso) o l\'url remoto", "Getting" => "Getting", + "Saving" => "Saving:", "Please enter the..." => "Per favore digita un nuovo nome per", "Renaming to" => "Rinominando a ", "Moving to" => "Muovendo a", @@ -229,6 +282,7 @@ $text = [ "replace all" => "sostituisci tutto", "file" => "file", "Replacing text in" => "Sostituisci il testo con", + "Sorry there was..." => "Sorry, there was an error with your request.\\n\\nPlease check your dev tools console for more info.", "Cancelled tasks" => "Compiti cancellati", "Open previous files" => "Aprire i file precedenti?", "Please note for..." => "Si prega di notare: affinche l\'aggiornamento funzioni correttamente, è necessario disporre dei permessi di scrittura e cancellazione su tutti le cartelle e file di ICEcoder e. Se è necessario ripristinare questa versione di ICEcoder per qualsiasi motivo, lo troverete nella directory / tmp dir. Fare clic su OK per procedere con l\'aggiornamento automatico o annullare a visitare il sito ICEcoder in modo da poter utilizzare la zip e aggiornare manualmente.", @@ -237,7 +291,6 @@ $text = [ "No new errors..." => "Nessun nuovo errore trovato", "You have made..." => "Hai fatto alcuni cambiamenti. Sei sicuro che vuoi chiudere senza prima salvare?", "Close all tabs" => "Chiudere tutte le tabs?", - "results" => "risultati" ], "login" => @@ -246,9 +299,10 @@ $text = [ "login" => "login", "To disable registration..." => "Per disattivare la modalità di registrazione, apri il menu delle impostazioni o aprire data/config-settings.php e cambia enableRegistration in false quindi ricarica questa pagina", "Registration mode enabled" => "Modalità di registrazione abilitata", + "disable further registrations" => "disable further registrations", "auto-check for updates" => "auto-check per aggiornamenti", "To put into..." => "Per mettere in modalità multi-utente, aprire il menu delle impostazioni o apri data/config-settings.php e cambiare multiutente su true quindi ricarica questa pagina", - "multi-user" => "multi-user" + "multi-user" => "multi-user", ], "multiple-results" => @@ -266,7 +320,7 @@ $text = [ "No matches found" => "No matches found", "selected" => "selected", "found in" => "found in", - "Replaced" => "Replaced" + "Replaced" => "Replaced", ], "plugins-manager" => @@ -286,7 +340,7 @@ $text = [ "Update" => "Update", "Install" => "Install", "Uninstall" => "Uninstall", - "Reload after install..." => "Reload after install required" + "Reload after install..." => "Reload after install required", ], "properties" => @@ -308,18 +362,18 @@ $text = [ "Write" => "Scrittura", "Execute" => "Esecuzione", "Change to" => "Cambia a", - "update" => "aggiorna" + "update" => "aggiorna", ], "settings-common" => [ - "Your document does..." => "Il tuo documento non sembra essere in formato UTF-8 per questo viene corretto" + "Your document does..." => "Il tuo documento non sembra essere in formato UTF-8 per questo viene corretto", ], "settings-save-current-files" => [ "Cannot update config..." => "Impossibile aggiornare il file di configurazione. Si prega di impostare i permessi di scrittura pubblica su", - "and try again" => "e prova ancora" + "and try again" => "e prova ancora", ], "settings-screen" => @@ -330,7 +384,15 @@ $text = [ "git" => "git", "codemirror version" => "versione codemirror ", "file manager root" => "root di file manager ", - "Free to use..." => "Libero di usarlo per i propri scopi, commerciali e non, facendomelo solo sapere per eventuali nuovi e interessanti utilizzi o personalizzazioni. :)
    Nessuna garanzia o responsabilità, tutte le responsabilità di utilizzo è vostra.
    Un sacco di aziende e persone fantastiche hanno contribuito a costruire ICEcoder e ce ne sarebbero troppi da ringraziare. Si prega di consultare la lista completa a", + "backups" => "backups", + "keep version control..." => "keep version control backups for", + "day" => "day", + "days" => "days", + "of backups stored..." => "of backups stored currently", + "deleting actually moves..." => "deleting actually moves to ICEcoder's tmp dir", + "local/server items..." => "local/server items only", + "Get in contact..." => "Get in contact by...", + "You may use..." => "You may use ICEcoder for your own purposes, commercial or not, just let us know of any cool uses or customisations. :)

    No warranty or liability accepted for anything, all responsibility of use is your own.", "functionality" => "funzionalità", "check for updates..." => "controlla aggiornamenti all\'avvio", "auto open last..." => "Apri automaticamente ultimi file al login", @@ -348,20 +410,28 @@ $text = [ "banned files/folders" => "file e cartelle vietati", "banned paths" => "percorsi vietati", "ip addresses" => "indirizzo ip", + "auto-logout after" => "auto-logout after", + "mins of inactivity..." => "mins of inactivity if no unsaved files", "Slash prefixed comma..." => "slash di prefisso, delimitato da virgole", "Comma delimited" => "delimitato da virgole", "style" => "style", "theme" => "tema", "line wrapping" => "a capo automatico", + "line numbers" => "line numbers", "scrollbars" => "barre di scorrimento", "indent type" => "tipo di rientro", "indent size" => "dimensioni rientro", + "match brackets" => "match brackets", "font size" => "dimensione font ", + "show trailing space" => "show trailing space", "auto indent" => "auto indent", + "auto close tags" => "auto close tags", + "auto close brackets" => "auto close brackets", "layout" => "layout", "plugin panel aligned" => "Pannello plug inallineato", "file manager" => "file manager", "root" => "root", + "Set 0 to..." => "Set 0 to disable", "Slash prefixed" => "barra obliqua prefisso", "bug reporting" => "bug reporting", "check in files" => "check in files", @@ -371,19 +441,19 @@ $text = [ "multi-user" => "multi-user", "Make sure you..." => "Assicurati di non bloccarti fuori", "Registration" => "Registrazione", - "update" => "aggiorna" + "update" => "aggiorna", ], "settings-update" => [ "Cannot update config..." => "Non posso aggiornare il file config. Per favore permetti l\'accesso pubblico di scrittura", "and try again" => "e prova ancora", - "and press refresh" => "e premi aggiorna" + "and press refresh" => "e premi aggiorna", ], "updater" => [ - "Update appears to..." => "L\'aggiornamento sembra andato bene" + "Update appears to..." => "L\'aggiornamento sembra andato bene", ], "find-in-files" => @@ -397,6 +467,6 @@ $text = [ "Yes" => "Si", "No" => "No", "Search" => "Cerca", - ] + ], ]; diff --git a/lang/norwegian.php b/lang/norwegian.php index d23d0e0..28b3e01 100644 --- a/lang/norwegian.php +++ b/lang/norwegian.php @@ -11,7 +11,6 @@ $text = [ "editor" => [ - "Click icons for..." => "Klikk på ikoner
    for hjelp &
    bruk av info
    ", "server" => "server", "Server name, OS..." => "Server navn, OS & IP:", "Root" => "Root:", @@ -24,14 +23,14 @@ $text = [ "files" => "filer", "Last 10 files..." => "Siste 10 åpne filer:", "none" => "[none]", - "results" => "resultater" ], "files" => [ "Lock" => "Steng", "Refresh" => "Last igjen", - "ROOT" => "[ROOT]" + "Plugins" => "Plugins", + "ROOT" => "[ROOT]", ], "index" => @@ -41,9 +40,10 @@ $text = [ "Your version is" => "Din versjon er", "Update now" => "Oppdater nå", "You have some..." => "Du har noe ulagrede endringer", - "Are you sure you want to close?" => "Are you sure you want to close?", + "Are you sure..." => "Are you sure you want to close?", "working" => "arbeider", "Color picker" => "Fargevelger", + "Plugins Manager" => "Plugins Manager", "New File" => "Ny Fil", "New Folder" => "Ny Mappe", "Upload File(s)" => "Last opp Fil(er)", @@ -58,7 +58,7 @@ $text = [ "Properties" => "Egenskaper", "File" => "Fil", "Edit" => "Redigere", - "Remote" => "Ekstern", + "Source" => "Source", "Help" => "Hjelp", "Save" => "Lagre", "Save As" => "Lagre Som", @@ -93,18 +93,35 @@ $text = [ "all filenames" => "alle filenavn", "Go to Line" => "Gå til Linje", "View" => "Vis", - "Bug reporting not active" => "Bug rapportering ikke aktiv" + "Bug reporting not active" => "Bug rapportering ikke aktiv", + "Single pane" => "Single pane", + "Diff pane also" => "Diff pane also", ], // /LIB + "auto-logout-warning" => + [ + "Auto Logout Warning" => "Auto logout warning", + "You will be..." => "You will be logged out after", + "seconds due to..." => "seconds due to inactivity, for security purposes. Use the mouse or hit a key to continue.

    You can adjust or disable this from the Edit > Settings section.", + ], + +"backup-versions" => + [ + "backup" => "backup", + "backups" => "backups", + "available for" => "available for", + ], + "bug-files-check" => [ - "Found in" => "Funnet i:" + "Found in" => "Funnet i:", ], "file-control" => [ + "Sorry, bad filename..." => "Sorry, bad filename provided. Check the dev tools console for more info?", "Sorry" => "Beklager", "does not seem..." => "synes ikke å eksistere på serveren", "Sorry, could not..." => "Beklager, kunne ikke få innholdet i", @@ -120,6 +137,7 @@ $text = [ "Sorry, cannot save" => "Beklager, kan ikke lagre", "Sorry, cannot replace..." => "Beklager, kan ikke erstatte tekst i", "Sorry, cannot change..." => "Beklager, kan ikke endre tillatelser på", + "Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode", "Sorry, cannot delete..." => "Beklager, kan ikke slette rotnivå", "Sorry, cannot delete" => "Beklager, kan ikke slette", "Sorry, this file..." => "Beklager, denne filen er endret, kan ikke lagre", @@ -128,7 +146,38 @@ $text = [ "displayed at" => "vises på", "Enter filename to..." => "Skriv inn filnavnet for å lagre på", "That file exists..." => "Denne filen eksisterer allerede, skriv over?", - "Saving" => "Lagring" + "Saving" => "Lagring", + ], + + "ftp-manager" => + [ + "Saving FTP sites" => "Saving FTP sites", + "Cannot update config..." => "Cannot update config file. Please set public write permissions on", + "and try again" => "and try again", + "ftp manager" => "ftp manager", + "Choose existing site" => "Choose existing site", + "Are you sure..." => "Are you sure you wish to remove this site?", + "Add new site" => "Add new site", + "Edit site" => "Edit site", + "Site base" => "Site base", + "Host" => "Host", + "Username" => "Username", + "Password" => "Password", + "PASV and mode" => "PASV and mode", + "Root" => "Root", + "eg http://yourdomain.com" => "eg http://yourdomain.com", + "eg ftp.yourdomain.com" => "eg ftp.yourdomain.com", + "eg user123" => "eg user123", + "eg pass123" => "eg pass123", + "Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary", + "eg /htdocs" => "eg /htdocs", + "PASV connection off" => "PASV connection off", + "PASV connection on" => "PASV connection on", + "ASCII transfer" => "ASCII transfer", + "Binary transfer" => "Binary transfer", + "Add" => "Add", + "Choose" => "Choose", + "Update" => "Update", ], "get-branch" => [], @@ -166,6 +215,8 @@ $text = [ "Jump to definition" => "Hopp til definisjon/hopp tilbake", "Comment uncomment" => "Kommentar/fjern kommentar", "Insert tab indent" => "Sett inn innrykk/valgt innrykk", + "Insert more" => "Indent more", + "Insert less" => "Indent less", "Wrap with div" => "Wrap med
    ", "Wrap with span" => "Wrap med ", "Wrap unwrap p" => "Wrap/uwrap med

    ", @@ -190,6 +241,7 @@ $text = [ "Close current tab" => "Lukk gjeldende fane", "Open file prompt" => "Åpne fil prompt", "Find" => "Finn", + "Previous" => "Previous", "Focus on Go..." => "Fokus på Gå til linje inndata", "Save" => "Lagre", "Save as" => "Lagre som...", @@ -197,17 +249,26 @@ $text = [ "Contract expand file..." => "Trekk sammen/utvid filbehandler", "Fold unfold current..." => "Brett/utfold gjeldende linje", "Refocus on document" => "Refokusere på dokument", - "Cancel tasks" => "Avbryt oppgaver" + "Cancel tasks" => "Avbryt oppgaver", + "Zoom out" => "Zoom out all non-function/class declarations", + "Jump to" => "Jump to declaration of class/function", + "Jump to previous tab" => "Jump to previous tab", ], "icecoder" => [ + "results" => "results", "No text selected..." => "Ingen tekst valgt til å søke på", + "all files" => "all files", + "all filenames" => "all filenames", + "selected files" => "selected files", + "selected filenames" => "selected filenames", "Creating Folder" => "Lage mappe", "Sorry you can..." => "Beklager, du kan bare ha 100 filer åpne samtidig!", "Opening File" => "Åpner Fil", "Enter relative file..." => "Oppgi den relative filstien (med prefiks /) eller ekstern URL", "Getting" => "Får", + "Saving" => "Saving:", "Please enter the..." => "Skriv inn det nye navnet på", "Renaming to" => "Endre navn til", "Moving to" => "Flytt til", @@ -215,7 +276,13 @@ $text = [ "Pasting File" => "Lim inn Fil", "Sorry cannot paste..." => "Beklager, kan ikke lime inn en hel rot mappe", "Nothing to paste..." => "Ingenting å lime inn, kopiere en fil/mappe først!", - "Replacing text in" => "Erstatte tekst i", + "and" => "and", + "this document" => "this document", + "replace" => "replace", + "replace all" => "replace all", + "file" => "file", + "Replacing text in" => "Replacing text in","Replacing text in" => "Erstatte tekst i", + "Sorry there was..." => "Sorry, there was an error with your request.\\n\\nPlease check your dev tools console for more info.", "Cancelled tasks" => "Kansellerte oppgaver", "Open previous files" => "Åpne siste filer?", "Please note for..." => "Vennligst merk: for at oppdatering skal fungere skikkelig, må du ha skrive/slette tilgang til alle ICEcoder kataloger og filer. Hvis du trenger å gjenopprette denne versjonen av ICEcoder av en eller annen grunn, vil du finne den i /tmp mappen. Klikk OK for å fortsette med en auto-oppdatering eller avbryt for å besøke ICEcoder området slik at du kan ta tak i zip-filen og oppdatere manuelt.", @@ -223,7 +290,7 @@ $text = [ "Error cannot find..." => "Feil: kan ikke finne/få tilgang til feil filstier", "No new errors..." => "Ingen feil funnet", "You have made..." => "Du har gjort endringer. Er du sikker på, at du vil lukke uten å lagre?", - "Close all tabs" => "Lukk alle faner?" + "Close all tabs" => "Lukk alle faner?", ], "login" => @@ -232,9 +299,10 @@ $text = [ "login" => "logginn", "To disable registration..." => "Hvis du vil deaktivere registreringsmodus, åpne innstillingsmenyen eller åpne data/config-settings.php og endre/aktiver Påmelding til 'false', deretter laste siden om igjen", "Registration mode enabled" => "Registreringsmodus aktivert", + "disable further registrations" => "disable further registrations", "auto-check for updates" => "auto-sjekk for oppdateringer", "To put into..." => "Å sette til flerbrukermodus, åpne innstillingsmenyen eller åpne data/config-settings.php og endre flerbruker til 'true', deretter laste siden om igjen", - "multi-user" => "flerbruker" + "multi-user" => "flerbruker", ], "multiple-results" => @@ -252,7 +320,7 @@ $text = [ "No matches found" => "Ingen treff", "selected" => "valgt", "found in" => "funnet i", - "Replaced" => "Erstattet" + "Replaced" => "Erstattet", ], "plugins-manager" => @@ -272,7 +340,7 @@ $text = [ "Update" => "Oppdater", "Install" => "Installer", "Uninstall" => "Avinstaller", - "Reload after install..." => "Omstart etter installasjon nødvendig" + "Reload after install..." => "Omstart etter installasjon nødvendig", ], "properties" => @@ -294,18 +362,18 @@ $text = [ "Write" => "Skrive", "Execute" => "Kjøre", "Change to" => "Endre til", - "update" => "oppdatere" + "update" => "oppdatere", ], "settings-common" => [ - "Your document does..." => "Dokumentet ser ikke ut til å være i UTF-8 koding, derfor har det blitt omgjort" + "Your document does..." => "Dokumentet ser ikke ut til å være i UTF-8 koding, derfor har det blitt omgjort", ], "settings-save-current-files" => [ "Cannot update config..." => "Kan ikke oppdatere konfigurasjonsfilen. Vennligst sett offentlige skriverettigheter", - "and try again" => "og prøv igjen" + "and try again" => "og prøv igjen", ], "settings-screen" => @@ -316,7 +384,15 @@ $text = [ "git" => "git", "codemirror version" => "codemirror versjon", "file manager root" => "filbehandler root", - "Free to use..." => "Gratis å bruke den til eget formål, kommersielle eller ikke, bare gi meg beskjed om eventuelle kule bruk eller tilpasninger. :)
    Ingen garanti eller erstatningsansvar aksepteres for noe som helst, det er ditt eget ansvar for all bruk.
    Mange fantastiske mennesker og bedrifter har bidratt til å bygge ICEcoder og det er for mange å takke her. Vennligst se hele listen på", + "backups" => "backups", + "keep version control..." => "keep version control backups for", + "day" => "day", + "days" => "days", + "of backups stored..." => "of backups stored currently", + "deleting actually moves..." => "deleting actually moves to ICEcoder's tmp dir", + "local/server items..." => "local/server items only", + "Get in contact..." => "Get in contact by...", + "You may use..." => "You may use ICEcoder for your own purposes, commercial or not, just let us know of any cool uses or customisations. :)

    No warranty or liability accepted for anything, all responsibility of use is your own.", "functionality" => "funksjonalitet", "check for updates..." => "se etter oppdateringer ved start", "auto open last..." => "åpne automatisk siste filer ved innlogging", @@ -334,20 +410,28 @@ $text = [ "banned files/folders" => "forbudte filer/mapper", "banned paths" => "forbudte stier", "ip addresses" => "ip adresser", + "auto-logout after" => "auto-logout after", + "mins of inactivity..." => "mins of inactivity if no unsaved files", "Slash prefixed comma..." => "Slash som prefiks, komma som skille", "Comma delimited" => "Skilled med komma", "style" => "stil", "theme" => "tema", "line wrapping" => "linjebryting", + "line numbers" => "line numbers", "scrollbars" => "rullefelt", "indent type" => "innrykk type", "indent size" => "innrykk størr.", + "match brackets" => "match brackets", + "show trailing space" => "show trailing space", "font size" => "skrift størr.", "auto indent" => "auto indent", + "auto close tags" => "auto close tags", + "auto close brackets" => "auto close brackets", "layout" => "layout", "plugin panel aligned" => "programtilleggspanel justert", "file manager" => "filbehandler", "root" => "root", + "Set 0 to..." => "Set 0 to disable", "Slash prefixed" => "Slash prefiks", "bug reporting" => "feil rapportering", "check in files" => "sjekke blant filer", @@ -357,19 +441,32 @@ $text = [ "multi-user" => "flerbruker", "Make sure you..." => "Pass på, at du ikke stenger deg ut selv", "Registration" => "Registrering", - "update" => "oppdatere" + "update" => "oppdatere", ], "settings-update" => [ "Cannot update config..." => "Kan ikke oppdatere konfigurasjonsfilen. Vennligst sett offentlige skriverettigheter;", "and try again" => "og prøv igjen", - "and press refresh" => "og trykk refresh" + "and press refresh" => "og trykk refresh", ], "updater" => [ - "Update appears to..." => "Oppdatering synes å være vellykket" - ] + "Update appears to..." => "Oppdatering synes å være vellykket", + ], + + "find-in-files" => + [ + "Enter path to search in" => "Enter path to search in", + "Enter semicolon-separated masks..." => "Enter semicolon-separated masks of files to look at (e.g. *.php;*.html;*.js)", + "Type of text" => "Type of text", + "Fixed text" => "Fixed text", + "Regular expression" => "Regular expression", + "Case sensitive" => "Case sensitive", + "Yes" => "Yes", + "No" => "No", + "Search" => "Search", + ], ]; diff --git a/lang/persian.php b/lang/persian.php index ee323d7..3447581 100644 --- a/lang/persian.php +++ b/lang/persian.php @@ -11,7 +11,6 @@ $text = [ "editor" => [ - "Click icons for..." => "بر روی آیکن ها کلیک کنید
    برای راهنمایی &
    اطلاعات استفاده
    ", "server" => "سرور", "Server name, OS..." => "نام سرور ، سیستم عامل و آی پی :", "Root" => "روت:", @@ -24,14 +23,14 @@ $text = [ "files" => "فایل ها", "Last 10 files..." => "آخرین ۱۰ فایل باز شده", "none" => "[پوچ]", - "results" => "نتایج" ], "files" => [ "Lock" => "قفل", "Refresh" => "بارگذاری مجدد", - "ROOT" => "[ریشه]" + "Plugins" => "Plugins", + "ROOT" => "[ریشه]", ], "index" => @@ -41,9 +40,10 @@ $text = [ "Your version is" => "نسخه مورد استفاده شما", "Update now" => "به روز کنید", "You have some..." => "شما چند تغییر ذخیره نشده دارید", - "Are you sure you want to close?" => "Are you sure you want to close?", + "Are you sure..." => "Are you sure you want to close?", "working" => "در حال کار", "Color picker" => "اشاره گر رنگ", + "Plugins Manager" => "Plugins Manager", "New File" => "فایل جدید", "New Folder" => "پوشه جدید", "Upload File(s)" => "بارگذاری فایل", @@ -58,7 +58,7 @@ $text = [ "Properties" => "ویژگی ها", "File" => "فایل", "Edit" => "ویرایش", - "Remote" => "کنترل از راه دور", + "Source" => "Source", "Help" => "کمک", "Save" => "ذخیره", "Save As" => "ذخیره به عنوان", @@ -82,29 +82,46 @@ $text = [ "website" => "وب سایت", "Close all tabs" => "بستن همه پنجره ها", "Alphabetize tabs" => "مرتب سازی پنجره ها بر اساس حروف الفبا", -// "Find" => "یافتن", -// "in" => "در", -// "and" => "و", -// "replace" => "جایگزین کردن", -// "replace all" => "جایگزین کردن همه", -// "this document" => "این سند", -// "open documents" => "سند های باز", -// "all files" => "همه فایل ها", -// "all filenames" => "همه نام فایل ها", + "Find" => "یافتن", + "in" => "در", + "and" => "و", + "replace" => "جایگزین کردن", + "replace all" => "جایگزین کردن همه", + "this document" => "این سند", + "open documents" => "سند های باز", + "all files" => "همه فایل ها", + "all filenames" => "همه نام فایل ها", "Go to Line" => "برو به خط", "View" => "نمایش", - "Bug reporting not active" => "گزارش اشکال فعال نیست" + "Bug reporting not active" => "گزارش اشکال فعال نیست", + "Single pane" => "Single pane", + "Diff pane also" => "Diff pane also", ], // /LIB + "auto-logout-warning" => + [ + "Auto Logout Warning" => "Auto logout warning", + "You will be..." => "You will be logged out after", + "seconds due to..." => "seconds due to inactivity, for security purposes. Use the mouse or hit a key to continue.

    You can adjust or disable this from the Edit > Settings section.", + ], + + "backup-versions" => + [ + "backup" => "backup", + "backups" => "backups", + "available for" => "available for", + ], + "bug-files-check" => [ - "Found in" => "یافتن در :" + "Found in" => "یافتن در :", ], "file-control" => [ + "Sorry, bad filename..." => "Sorry, bad filename provided. Check the dev tools console for more info?", "Sorry" => "متاسفیم", "does not seem..." => "به نظر می رسد بر روی سرور موجود نیست", "Sorry, could not..." => "متاسفانه نمی توانیم اطلاعات را دریافت کنیم", @@ -120,6 +137,7 @@ $text = [ "Sorry, cannot save" => "متاسفانه نمی توانیم ذخیره کنیم", "Sorry, cannot replace..." => "متاسفانه نمی نمی توانیم جایگزین کنیم", "Sorry, cannot change..." => "متاسفانه نمی توانیم دسترسی را تغییر دهیم", + "Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode", "Sorry, cannot delete..." => "متاسفانه نمی توانیم دسترسی ریشه را تغییر دهیم", "Sorry, cannot delete" => "متاسفانه نمی توانیم تغییر دهیم", "Sorry, this file..." => "متاسفانه این فایل تغییر دارد و نمی توانیم آن را ذخیره کنیم", @@ -128,7 +146,38 @@ $text = [ "displayed at" => "نمایش داده شده در", "Enter filename to..." => "نام فایل را برای ذخیره وارد کنید", "That file exists..." => "این فایل هم اکنون موجود است ، جایگزین شود؟", - "Saving" => "در حال ذخره" + "Saving" => "در حال ذخره", + ], + + "ftp-manager" => + [ + "Saving FTP sites" => "Saving FTP sites", + "Cannot update config..." => "Cannot update config file. Please set public write permissions on", + "and try again" => "and try again", + "ftp manager" => "ftp manager", + "Choose existing site" => "Choose existing site", + "Are you sure..." => "Are you sure you wish to remove this site?", + "Add new site" => "Add new site", + "Edit site" => "Edit site", + "Site base" => "Site base", + "Host" => "Host", + "Username" => "Username", + "Password" => "Password", + "PASV and mode" => "PASV and mode", + "Root" => "Root", + "eg http://yourdomain.com" => "eg http://yourdomain.com", + "eg ftp.yourdomain.com" => "eg ftp.yourdomain.com", + "eg user123" => "eg user123", + "eg pass123" => "eg pass123", + "Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary", + "eg /htdocs" => "eg /htdocs", + "PASV connection off" => "PASV connection off", + "PASV connection on" => "PASV connection on", + "ASCII transfer" => "ASCII transfer", + "Binary transfer" => "Binary transfer", + "Add" => "Add", + "Choose" => "Choose", + "Update" => "Update", ], "get-branch" => [], @@ -166,6 +215,8 @@ $text = [ "Jump to definition" => "برو به تعریف / برو عقب", "Comment uncomment" => "کامتی / حذف کامیت", "Insert tab indent" => "وارد کردن تب / انتخاب شده داخل است", + "Insert more" => "Indent more", + "Insert less" => "Indent less", "Wrap with div" => "قرار دادن با <div>", "Wrap with span" => "قرار دادن با <span>", "Wrap unwrap p" => "قرار دادن / باز کردن با <p>", @@ -190,6 +241,7 @@ $text = [ "Close current tab" => "بستن تب فعلی", "Open file prompt" => "باز کردن سریع فایل", "Find" => "یافتن", + "Previous" => "Previous", "Focus on Go..." => "فکوس کن برای رفتن به خط ورود", "Save" => "ذخیره", "Save as" => "ذخیره به عنوان ...", @@ -197,17 +249,26 @@ $text = [ "Contract expand file..." => "قرارداد / گسترش مدیریت فایل", "Fold unfold current..." => "ریختن (فولد) / آشکار شدن فایل فعلی", "Refocus on document" => "فوکوس مجدد در سند", - "Cancel tasks" => "لغو تسک" + "Cancel tasks" => "لغو تسک", + "Zoom out" => "Zoom out all non-function/class declarations", + "Jump to" => "Jump to declaration of class/function", + "Jump to previous tab" => "Jump to previous tab", ], "icecoder" => [ + "results" => "results", "No text selected..." => "هیچ متنی برای جستجو انتخاب نشده است", + "all files" => "all files", + "all filenames" => "all filenames", + "selected files" => "selected files", + "selected filenames" => "selected filenames", "Creating Folder" => "در حال ساخت پوشه", "Sorry you can..." => "متاسفانه ، شما می توانید حداکثر ۱۰۰ فایل را هم زمان باز کنید !", "Opening File" => "در حال باز کردن فایل", "Enter relative file..." => "قراردادن مسیر فایل مشابه ( ابتدا با / ) یا لینک ریموت", "Getting" => "دریافت", + "Saving" => "Saving:", "Please enter the..." => "لطفا یک نام جدید وارد کنید برای", "Renaming to" => "تغییر نام به", "Moving to" => "انتقال به", @@ -215,7 +276,13 @@ $text = [ "Pasting File" => "در حال پست کردن فایل", "Sorry cannot paste..." => "متاسفانه نمی توان به ریشه چیزی اضافه کرد", "Nothing to paste..." => "هیچ چیش برای چسباندن نیست ! ابتدا فایل / پوشه را کپی کنید", + "and" => "and", + "this document" => "this document", + "replace" => "replace", + "replace all" => "replace all", + "file" => "file", "Replacing text in" => "جایگزین کردن متن در", + "Sorry there was..." => "Sorry, there was an error with your request.\\n\\nPlease check your dev tools console for more info.", "Cancelled tasks" => "تسک های لغو شده ", "Open previous files" => "بازکردن فایل های قبلی؟", "Please note for..." => "Please note: for updating to work properly, you need to have write/delete access on all ICEcoder dirs & files. If you need to recover this version of ICEcoder for any reason, you'll find it in the /tmp dir. Click OK to proceed with an auto-update or cancel to visit the ICEcoder site so you can grab the zip and update manually.", @@ -223,7 +290,7 @@ $text = [ "Error cannot find..." => "خطا : نمی توانید به فایل / مسیر فایل های خطا دسترسی پیدا کنید.", "No new errors..." => "هیچ خطای جدیدی پیدا نشد", "You have made..." => "شما تغییراتی اعمال کرده اید. آیا اطمینان دارید که میخواهید بدون ذخیره کردن فایل را ببندید؟", - "Close all tabs" => "بستن همه تب ها؟" + "Close all tabs" => "بستن همه تب ها؟", ], "login" => @@ -232,9 +299,10 @@ $text = [ "login" => "ورود", "To disable registration..." => "برای غیر فعال کردن حالت ثبت نام ، منوی تنظیمات را باز کنید و یا فایل data/config-settings.php را باز کنید و گزینه enableRegistration را به false تغییر دهید. سپس این صفحه را بارگذاری مجدد نمایید", "Registration mode enabled" => "حالت ثبت نام فعال است", + "disable further registrations" => "disable further registrations", "auto-check for updates" => "بررسی خودکار برای به روز رسانی", "To put into..." => "برای وارد شدن به حالت چند کاربره ، منوی تنظیمات را باز کنید و یا فایل data/config-settings.php و گزینه multiUser را به true تغییر دهید و و ذخیره کنید. سپس این صفحه را بارگذاری مجدد نمایید", - "multi-user" => "چند کاربره" + "multi-user" => "چند کاربره", ], "multiple-results" => @@ -252,7 +320,7 @@ $text = [ "No matches found" => "جستجو نتیجه ای نداشت", "selected" => "انتخاب شده", "found in" => "یافتن در", - "Replaced" => "جایگزین شود" + "Replaced" => "جایگزین شود", ], "plugins-manager" => @@ -272,7 +340,7 @@ $text = [ "Update" => "آپدیت", "Install" => "اینستال", "Uninstall" => "آن انیستال", - "Reload after install..." => "بارگذاری مجدد بعد از نصب لازم است" + "Reload after install..." => "بارگذاری مجدد بعد از نصب لازم است", ], "properties" => @@ -294,7 +362,7 @@ $text = [ "Write" => "نوشتن", "Execute" => "اجرا", "Change to" => "تغییر به", - "update" => "به روز کردن" + "update" => "به روز کردن", ], "settings-common" => @@ -305,7 +373,7 @@ $text = [ "settings-save-current-files" => [ "Cannot update config..." => "نمیتوان فایل تنظیمات را به روز کرد ، لطفا دسترسی نوشتن را بررسی کنید در", - "and try again" => "و مجددا تلاش نمایید" + "and try again" => "و مجددا تلاش نمایید", ], "settings-screen" => @@ -316,7 +384,15 @@ $text = [ "git" => "گیت", "codemirror version" => "نسخه کد آینه", "file manager root" => "ریشه مسیر مدیریت فایل", - "Free to use..." => "Free to use it for your own purposes, commercial or not, just let me know of any cool uses or customisations. :)

    No warranty or liability accepted for anything, all responsibility of use is your own.

    A lot of fantastic people and companies have helped build ICEcoder and there is too many to thank here. Please see the full list at", + "backups" => "backups", + "keep version control..." => "keep version control backups for", + "day" => "day", + "days" => "days", + "of backups stored..." => "of backups stored currently", + "deleting actually moves..." => "deleting actually moves to ICEcoder's tmp dir", + "local/server items..." => "local/server items only", + "Get in contact..." => "Get in contact by...", + "You may use..." => "You may use ICEcoder for your own purposes, commercial or not, just let us know of any cool uses or customisations. :)

    No warranty or liability accepted for anything, all responsibility of use is your own.", "functionality" => "تابع بندی", "check for updates..." => "بررسی برای به روز رسانی در هنگام بارگذاری", "auto open last..." => "باز کردن خودکار آخرین فایل ها در هنگامک بارگذاری", @@ -334,20 +410,28 @@ $text = [ "banned files/folders" => "فایل ها / پوشه های مسدود شده", "banned paths" => "مسیر های مسدود شده", "ip addresses" => "آدرس آی پی", + "auto-logout after" => "auto-logout after", + "mins of inactivity..." => "mins of inactivity if no unsaved files", "Slash prefixed comma..." => "پیشوند اسلش, با کاما از هم جدا کنید", "Comma delimited" => "با کما جدا شوند", "style" => "استایل", "theme" => "قالب", "line wrapping" => "وارپینگ خط", + "line numbers" => "line numbers", "scrollbars" => "نوارهای پیمایش", "indent type" => "نوع برجسته کردن", "indent size" => "اندازه برجسته کردن", + "match brackets" => "match brackets", + "show trailing space" => "show trailing space", "font size" => "اندازه فونت", "auto indent" => "auto indent", + "auto close tags" => "auto close tags", + "auto close brackets" => "auto close brackets", "layout" => "لایه", "plugin panel aligned" => "تراز پنل پلاگین", "file manager" => "مدیریت فایل", "root" => "ریشه", + "Set 0 to..." => "Set 0 to disable", "Slash prefixed" => "پیشوند اسلش", "bug reporting" => "گزارش باگ", "check in files" => "فایل های چک این", @@ -357,19 +441,32 @@ $text = [ "multi-user" => "چند کاربره", "Make sure you..." => "مطمئن شوید خود را خاریج از اینجا قفل نکرده اید", "Registration" => "ثبت نام", - "update" => "به روز کردن" + "update" => "به روز کردن", ], "settings-update" => [ "Cannot update config..." => "نمی توان فایل تنظیمات را به روز کرد ، لطفا دسترسی نوشتن را اعمال کنید در", "and try again" => "و مجدد تلاش کنید", - "and press refresh" => "و صفحه را مجدد بارگذاری کنید" + "and press refresh" => "و صفحه را مجدد بارگذاری کنید", ], "updater" => [ - "Update appears to..." => "با موفقیت به روز شد" - ] -]; + "Update appears to..." => "با موفقیت به روز شد", + ], + "find-in-files" => + [ + "Enter path to search in" => "Enter path to search in", + "Enter semicolon-separated masks..." => "Enter semicolon-separated masks of files to look at (e.g. *.php;*.html;*.js)", + "Type of text" => "Type of text", + "Fixed text" => "Fixed text", + "Regular expression" => "Regular expression", + "Case sensitive" => "Case sensitive", + "Yes" => "Yes", + "No" => "No", + "Search" => "Search", + ], + +]; diff --git a/lang/portuguese-brazilian.php b/lang/portuguese-brazilian.php index 609a45d..56621d5 100644 --- a/lang/portuguese-brazilian.php +++ b/lang/portuguese-brazilian.php @@ -2,6 +2,7 @@ // Português do Brasil // by: @leonardoroese (GitHub) + // Please preserve formatting, line breaks, special characters, anything in and HTML equivalents (eg &). Translations on right side. $text = [ @@ -10,7 +11,6 @@ $text = [ "editor" => [ - "Click icons for..." => "Ícones
    para ajuda &
    info. utilização
    ", "server" => "Servidor", "Server name, OS..." => "Nome do Servidor, OS & IP:", "Root" => "Raiz:", @@ -29,7 +29,8 @@ $text = [ [ "Lock" => "Trava", "Refresh" => "Atualizar", - "ROOT" => "[RAIZ]" + "Plugins" => "Plugins", + "ROOT" => "[RAIZ]", ], "index" => @@ -92,18 +93,35 @@ $text = [ "all filenames" => "todos nomes de arquivo", "Go to Line" => "Ir para linha", "View" => "Exibir", - "Bug reporting not active" => "Relatório de Bug desativado" + "Bug reporting not active" => "Relatório de Bug desativado", + "Single pane" => "Single pane", + "Diff pane also" => "Diff pane also", ], // /LIB + "auto-logout-warning" => + [ + "Auto Logout Warning" => "Auto logout warning", + "You will be..." => "You will be logged out after", + "seconds due to..." => "seconds due to inactivity, for security purposes. Use the mouse or hit a key to continue.

    You can adjust or disable this from the Edit > Settings section.", + ], + + "backup-versions" => + [ + "backup" => "backup", + "backups" => "backups", + "available for" => "available for", + ], + "bug-files-check" => [ - "Found in" => "Encontrado em:" + "Found in" => "Encontrado em:", ], "file-control" => [ + "Sorry, bad filename..." => "Sorry, bad filename provided. Check the dev tools console for more info?", "Sorry" => "Desculpe", "does not seem..." => "Não encontrado no servidor", "Sorry, could not..." => "Desculpe, conteudo não encontrado para", @@ -119,6 +137,7 @@ $text = [ "Sorry, cannot save" => "Desculpe, não é possível salvar", "Sorry, cannot replace..." => "Desculpe, não é possível substituir texto em", "Sorry, cannot change..." => "Desculpe, não é possível mudar permissões para", + "Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode", "Sorry, cannot delete..." => "Desculpe, não é possível excluir nível raiz", "Sorry, cannot delete" => "Desculpe, não é possível remover", "Sorry, this file..." => "Desculpe, este arquivo foi modificado, não é possível salvar", @@ -127,7 +146,38 @@ $text = [ "displayed at" => "exibido em", "Enter filename to..." => "Informe o nome do aquivo para salvar", "That file exists..." => "Este arquivo jã existe, sobrescrever?", - "Saving" => "Salvando" + "Saving" => "Salvando", + ], + + "ftp-manager" => + [ + "Saving FTP sites" => "Saving FTP sites", + "Cannot update config..." => "Cannot update config file. Please set public write permissions on", + "and try again" => "and try again", + "ftp manager" => "ftp manager", + "Choose existing site" => "Choose existing site", + "Are you sure..." => "Are you sure you wish to remove this site?", + "Add new site" => "Add new site", + "Edit site" => "Edit site", + "Site base" => "Site base", + "Host" => "Host", + "Username" => "Username", + "Password" => "Password", + "PASV and mode" => "PASV and mode", + "Root" => "Root", + "eg http://yourdomain.com" => "eg http://yourdomain.com", + "eg ftp.yourdomain.com" => "eg ftp.yourdomain.com", + "eg user123" => "eg user123", + "eg pass123" => "eg pass123", + "Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary", + "eg /htdocs" => "eg /htdocs", + "PASV connection off" => "PASV connection off", + "PASV connection on" => "PASV connection on", + "ASCII transfer" => "ASCII transfer", + "Binary transfer" => "Binary transfer", + "Add" => "Add", + "Choose" => "Choose", + "Update" => "Update", ], "get-branch" => [], @@ -191,6 +241,7 @@ $text = [ "Close current tab" => "Fechar aba atual", "Open file prompt" => "Abrir prompt de comando", "Find" => "Buscar", + "Previous" => "Previous", "Focus on Go..." => "Foco campo ir para linha", "Save" => "Salvar", "Save as" => "Salvar como...", @@ -198,11 +249,15 @@ $text = [ "Contract expand file..." => "Contrair / expandir gerenciador de arquivos", "Fold unfold current..." => "Contrair / expandir linha atual", "Refocus on document" => "Foco no documento", - "Cancel tasks" => "Cancelar tarefas" + "Cancel tasks" => "Cancelar tarefas", + "Zoom out" => "Zoom out all non-function/class declarations", + "Jump to" => "Jump to declaration of class/function", + "Jump to previous tab" => "Jump to previous tab", ], "icecoder" => [ + "results" => "results", "No text selected..." => "Sem texto selecionado para buscar", "all files" => "todos arquivos", "all filenames" => "todos nomes de arquivos", @@ -213,6 +268,7 @@ $text = [ "Opening File" => "Abrindo arquivo", "Enter relative file..." => "Informe caminho relativo (prefixado por /) ou URL remota", "Getting" => "Selecionando", + "Saving" => "Saving:", "Please enter the..." => "Informe novo nome para", "Renaming to" => "Renomeando para", "Moving to" => "Movendo para", @@ -226,6 +282,7 @@ $text = [ "replace all" => "substituir tudo", "file" => "arquivo", "Replacing text in" => "Substituindo texto em", + "Sorry there was..." => "Sorry, there was an error with your request.\\n\\nPlease check your dev tools console for more info.", "Cancelled tasks" => "Tarefas canceladas", "Open previous files" => "Abrir arquivos anteriores?", "Please note for..." => "Atenção: para atualizar corretamente, é necessãrio permissão de escrita em todos os diretórios/arquivos do ICEcoder. \\n\\nSe por algum motivo necessite recuperar esta versão do ICEcoder, estarã disponível na pasta /tmp.\\n\\nClique OK para prosseguir com a atualização, ou cancelar para visitar a pãgina do ICEcoder na internet onde poderã baixar a atualização manualmente.", @@ -234,7 +291,6 @@ $text = [ "No new errors..." => "Nenhum erro encontrado", "You have made..." => "Voce fez alterações. Deseja realmente fechar sem salvar?", "Close all tabs" => "Fechar todas as abas?", - "results" => "resultados" ], "login" => @@ -243,9 +299,10 @@ $text = [ "login" => "login", "To disable registration..." => "Para desabilitar modo registro, acesse menu/configurações ou em data/config-settings.php altere enableRegistration para false e recarregue esta pãgina", "Registration mode enabled" => "Modo registro habilitado", + "disable further registrations" => "disable further registrations", "auto-check for updates" => "verificar atualizações auto.", "To put into..." => "Para habilitar multi-usuãrios, acesse menu/configurações ou em data/config-settings.php altere multiUser para true e recarregue esta pãgina", - "multi-user" => "multi-usuãrios" + "multi-user" => "multi-usuãrios", ], "multiple-results" => @@ -263,7 +320,7 @@ $text = [ "No matches found" => "Nenhum resultado encontrado", "selected" => "selecionado", "found in" => "encontrado em", - "Replaced" => "Substituído(s)" + "Replaced" => "Substituído(s)", ], "plugins-manager" => @@ -283,7 +340,7 @@ $text = [ "Update" => "Atualizar", "Install" => "Instalar", "Uninstall" => "Desinstalar", - "Reload after install..." => "Atualização necessãria após instalação" + "Reload after install..." => "Atualização necessãria após instalação", ], "properties" => @@ -305,18 +362,18 @@ $text = [ "Write" => "Salvar", "Execute" => "Executar", "Change to" => "Alterar para", - "update" => "atualizar" + "update" => "atualizar", ], "settings-common" => [ - "Your document does..." => "Seu arquivo não estã no formato UTF-8, deve ser convertido" + "Your document does..." => "Seu arquivo não estã no formato UTF-8, deve ser convertido", ], "settings-save-current-files" => [ "Cannot update config..." => "Não foi possível atualizar arquivo de configuração. Verifique permissões de acesso (públicas)", - "and try again" => "e tente novamente" + "and try again" => "e tente novamente", ], "settings-screen" => @@ -327,7 +384,15 @@ $text = [ "git" => "git", "codemirror version" => "versão codemirror", "file manager root" => "Raiz gerenciador de arquivos", - "Free to use..." => "Livre para utilização para seus propósitos, comercial ou não, mas aviseme sobre sua implementação se puder. :)

    Sem garantias, Muitas empresas e pessoas fantãsticas contribuiram para desenvolver o ICEcoder, hã muito o que agradecermos aqui. Veja a lista completa aqui", + "backups" => "backups", + "keep version control..." => "keep version control backups for", + "day" => "day", + "days" => "days", + "of backups stored..." => "of backups stored currently", + "deleting actually moves..." => "deleting actually moves to ICEcoder's tmp dir", + "local/server items..." => "local/server items only", + "Get in contact..." => "Get in contact by...", + "You may use..." => "You may use ICEcoder for your own purposes, commercial or not, just let us know of any cool uses or customisations. :)

    No warranty or liability accepted for anything, all responsibility of use is your own.", "functionality" => "funcionalidade", "check for updates..." => "verificar atualizações ao iniciar", "auto open last..." => "carregar últimos arquvos abertos ao iniciar", @@ -345,20 +410,28 @@ $text = [ "banned files/folders" => "arquivos/pastas bloqueados", "banned paths" => "caminhos bloqueados", "ip addresses" => "endereços IP", + "auto-logout after" => "auto-logout after", + "mins of inactivity..." => "mins of inactivity if no unsaved files", "Slash prefixed comma..." => "Prefixo barra, separado por vígula", "Comma delimited" => "Separado por vírgula", "style" => "estilo", "theme" => "tema", "line wrapping" => "quebra de linha", + "line numbers" => "line numbers", "scrollbars" => "barras de rolagem", "indent type" => "indent type", "indent size" => "indent size", + "match brackets" => "match brackets", + "show trailing space" => "show trailing space", "font size" => "tam. fonte", "auto indent" => "auto indent", + "auto close tags" => "auto close tags", + "auto close brackets" => "auto close brackets", "layout" => "layout", "plugin panel aligned" => "painel plugin alinhado", "file manager" => "gerenciador de arquivos", "root" => "raiz", + "Set 0 to..." => "Set 0 to disable", "Slash prefixed" => "Prefixo barra", "bug reporting" => "reportar erro", "check in files" => "verificar em arquivos", @@ -368,19 +441,32 @@ $text = [ "multi-user" => "multi-usuário", "Make sure you..." => "Cuidado para não travar seu usuãrio", "Registration" => "Cadastro", - "update" => "atualizar" + "update" => "atualizar", ], "settings-update" => [ "Cannot update config..." => "Não foi possível atualizar arquivo de configuração. Verifique permissões de acesso (públicas)", "and try again" => "e tentar novamente", - "and press refresh" => "e pressione atulizar" + "and press refresh" => "e pressione atulizar", ], "updater" => [ - "Update appears to..." => "Atualização completada" - ] + "Update appears to..." => "Atualização completada", + ], + + "find-in-files" => + [ + "Enter path to search in" => "Enter path to search in", + "Enter semicolon-separated masks..." => "Enter semicolon-separated masks of files to look at (e.g. *.php;*.html;*.js)", + "Type of text" => "Type of text", + "Fixed text" => "Fixed text", + "Regular expression" => "Regular expression", + "Case sensitive" => "Case sensitive", + "Yes" => "Yes", + "No" => "No", + "Search" => "Search", + ], ]; diff --git a/lang/spanish.php b/lang/spanish.php index 9a65664..3a2b66d 100644 --- a/lang/spanish.php +++ b/lang/spanish.php @@ -2,6 +2,7 @@ // Spanish language translation // by: @unix4you2 (GitHub) + // Please preserve formatting, line breaks, special characters, anything in and HTML equivalents (eg &). Translations on right side. $text = [ @@ -10,7 +11,6 @@ $text = [ "editor" => [ - "Click icons for..." => "Clic en los iconos
    para ayuda &
    modo de uso
    ", "server" => "servidor", "Server name, OS..." => "Nombre del servidor, OS & IP:", "Root" => "Raiz:", @@ -100,6 +100,20 @@ $text = [ // /LIB + "auto-logout-warning" => + [ + "Auto Logout Warning" => "Auto logout warning", + "You will be..." => "You will be logged out after", + "seconds due to..." => "seconds due to inactivity, for security purposes. Use the mouse or hit a key to continue.

    You can adjust or disable this from the Edit > Settings section.", + ], + + "backup-versions" => + [ + "backup" => "backup", + "backups" => "backups", + "available for" => "available for", + ], + "bug-files-check" => [ "Found in" => "Encontrado en:" @@ -135,11 +149,42 @@ $text = [ "Saving" => "Guardando" ], + "ftp-manager" => + [ + "Saving FTP sites" => "Saving FTP sites", + "Cannot update config..." => "Cannot update config file. Please set public write permissions on", + "and try again" => "and try again", + "ftp manager" => "ftp manager", + "Choose existing site" => "Choose existing site", + "Are you sure..." => "Are you sure you wish to remove this site?", + "Add new site" => "Add new site", + "Edit site" => "Edit site", + "Site base" => "Site base", + "Host" => "Host", + "Username" => "Username", + "Password" => "Password", + "PASV and mode" => "PASV and mode", + "Root" => "Root", + "eg http://yourdomain.com" => "eg http://yourdomain.com", + "eg ftp.yourdomain.com" => "eg ftp.yourdomain.com", + "eg user123" => "eg user123", + "eg pass123" => "eg pass123", + "Use PASV mode..." => "Use PASV mode if your FTP site requires it and choose the data transfer type - ASCII or binary", + "eg /htdocs" => "eg /htdocs", + "PASV connection off" => "PASV connection off", + "PASV connection on" => "PASV connection on", + "ASCII transfer" => "ASCII transfer", + "Binary transfer" => "Binary transfer", + "Add" => "Add", + "Choose" => "Choose", + "Update" => "Update", + ], + "get-branch" => [], "headers" => [ - "Bad CSRF token..." => "Token CSRF incorrecto. Por favor reporte este error en https://github.com/icecoder/ICEcoder para que pueda ser solucionado." + "Bad CSRF token..." => "Token CSRF incorrecto. Por favor reporte este error en https://github.com/icecoder/ICEcoder para que pueda ser solucionado.", ], "help" => @@ -204,7 +249,10 @@ $text = [ "Contract expand file..." => "Contraer / expandir administrador de archivos", "Fold unfold current..." => "Contraer / expandir línea actual", "Refocus on document" => "Reasignar foco al documento", - "Cancel tasks" => "Cancelar tareas" + "Cancel tasks" => "Cancelar tareas", + "Zoom out" => "Zoom out all non-function/class declarations", + "Jump to" => "Jump to declaration of class/function", + "Jump to previous tab" => "Jump to previous tab", ], "icecoder" => @@ -242,7 +290,7 @@ $text = [ "Error cannot find..." => "Error: no puedo encontrar o accesar las rutas de archivos de error", "No new errors..." => "No fueron encontrados nuevos errores", "You have made..." => "Usted ha realizado cambios. Esta seguro que quiere cerrar sin guardar?", - "Close all tabs" => "Cerrar todas las fichas?" + "Close all tabs" => "Cerrar todas las fichas?", ], "login" => @@ -251,9 +299,10 @@ $text = [ "login" => "ingreso", "To disable registration..." => "Para deshabilitar el modo de registro, vaya a la opción de Configuración or abra el archivo data/config-settings.php y cambie enableRegistration a false y recargue la página", "Registration mode enabled" => "Modo de registro activado", + "disable further registrations" => "disable further registrations", "auto-check for updates" => "auto-buscar por actualizaciones", "To put into..." => "Para usar el modo multiusuario, vaya a la opcion de Configuración o abra el archivo data/config-settings.php y cambie multiUser a true y recargue la página", - "multi-user" => "multi-usuario" + "multi-user" => "multi-usuario", ], "multiple-results" => @@ -271,7 +320,7 @@ $text = [ "No matches found" => "No se encontraron coincidencias", "selected" => "seleccionado", "found in" => "encontrado en", - "Replaced" => "Reemplezado" + "Replaced" => "Reemplezado", ], "plugins-manager" => @@ -291,7 +340,7 @@ $text = [ "Update" => "Actualizar", "Install" => "Instalar", "Uninstall" => "Desinstalar", - "Reload after install..." => "Se requiere recargar después de instalar" + "Reload after install..." => "Se requiere recargar después de instalar", ], "properties" => @@ -313,18 +362,18 @@ $text = [ "Write" => "Escribir", "Execute" => "Ejecutar", "Change to" => "Cambiar a", - "update" => "actualizar" + "update" => "actualizar", ], "settings-common" => [ - "Your document does..." => "Su documento no parece estar en UTF-8 entonces se ha convertido" + "Your document does..." => "Su documento no parece estar en UTF-8 entonces se ha convertido", ], "settings-save-current-files" => [ "Cannot update config..." => "No puedo actualizar el archivo de configuracion. Por favor establezca permisos publicos sobre", - "and try again" => "e intente de nuevo" + "and try again" => "e intente de nuevo", ], "settings-screen" => @@ -335,12 +384,14 @@ $text = [ "git" => "git", "codemirror version" => "version codemirror", "file manager root" => "administrador de archivos raiz", - "Get in contact..." => "Pongase en contacto...", "backups" => "respaldos", "keep version control..." => "mantener control de versiones de respaldo para", "day" => "dia", "days" => "dias", "of backups stored..." => "de respaldos almacenados actualmente", + "deleting actually moves..." => "deleting actually moves to ICEcoder's tmp dir", + "local/server items..." => "local/server items only", + "Get in contact..." => "Pongase en contacto...", "You may use..." => "Libre para usarlo para cualquier propósito, comercial o no, solo dejeme saber cualquier uso o mejora. :)

    No se da garantia de ningun tipo, su uso se encuentra bajo su responsabilidad.", "functionality" => "funcionalidad", "check for updates..." => "verificar por actualizaciones en la carga", @@ -359,19 +410,28 @@ $text = [ "banned files/folders" => "archivos/carpetas prohibidos", "banned paths" => "rutas prohibidas", "ip addresses" => "direcciones ip", + "auto-logout after" => "auto-logout after", + "mins of inactivity..." => "mins of inactivity if no unsaved files", "Slash prefixed comma..." => "Prefijo slash, delimitado por comas", "Comma delimited" => "Delimitado por comas", "style" => "estilo", "theme" => "tema", "line wrapping" => "ajuste de línea", + "line numbers" => "line numbers", "scrollbars" => "barras de desplazamiento", "indent type" => "tipode sangría", "indent size" => "Tamaño de sangría", + "match brackets" => "match brackets", + "show trailing space" => "show trailing space", "font size" => "tamaño de letra", + "auto indent" => "auto indent", + "auto close tags" => "auto close tags", + "auto close brackets" => "auto close brackets", "layout" => "disposición", "plugin panel aligned" => "alineacion del panel de plugins", "file manager" => "administrador de archivos", "root" => "raiz", + "Set 0 to..." => "Set 0 to disable", "Slash prefixed" => "Prefijo Slash", "bug reporting" => "reporte de errores", "check in files" => "chequear en archivos", @@ -381,7 +441,7 @@ $text = [ "multi-user" => "multi-usuario", "Make sure you..." => "Este seguro de no bloquearse a sí mismo", "Registration" => "Registro", - "update" => "actualizar" + "update" => "actualizar", ], "settings-update" => @@ -393,7 +453,7 @@ $text = [ "updater" => [ - "Update appears to..." => "La actualización parece haber sido satisfactoria" + "Update appears to..." => "La actualización parece haber sido satisfactoria", ], "find-in-files" => @@ -407,6 +467,6 @@ $text = [ "Yes" => "Si", "No" => "No", "Search" => "Buscar", - ] + ], ]; From 94590871a64f7f8ab97ef7c70aa6c888c0fb20b1 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sun, 29 Mar 2020 09:06:53 +0100 Subject: [PATCH 121/231] Tweak and simplify CSS --- assets/css/auto-logout-warning.css | 30 ++-------- assets/css/backup-versions.css | 28 ++-------- assets/css/editor.css | 46 +++++++-------- assets/css/farbtastic.css | 2 +- assets/css/file-types.css | 12 ++-- assets/css/files.css | 35 +++--------- assets/css/ftp-manager.css | 39 +++---------- assets/css/help.css | 28 ++-------- assets/css/icecoder.css | 90 ++++++++++++------------------ assets/css/lint.css | 13 ++--- assets/css/multiple-results.css | 28 ++-------- assets/css/plugins-manager.css | 37 +++--------- assets/css/properties.css | 22 +------- assets/css/settings-screen.css | 30 +++++----- assets/css/terminal.css | 14 ++--- 15 files changed, 142 insertions(+), 312 deletions(-) diff --git a/assets/css/auto-logout-warning.css b/assets/css/auto-logout-warning.css index ced1d29..a66c5cd 100644 --- a/assets/css/auto-logout-warning.css +++ b/assets/css/auto-logout-warning.css @@ -1,28 +1,10 @@ -/* First, reset everything to a standard */ -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; -} - body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - text-align: center; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + text-align: center; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} -.auto-logout-warning {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff; padding: 20px} \ No newline at end of file +.auto-logout-warning {background-color: #1c1c19; color: #fff; padding: 20px} \ No newline at end of file diff --git a/assets/css/backup-versions.css b/assets/css/backup-versions.css index 3320dca..c777be0 100644 --- a/assets/css/backup-versions.css +++ b/assets/css/backup-versions.css @@ -1,30 +1,12 @@ -/* First, reset everything to a standard */ -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; -} - body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} a {color: #fff; text-decoration: none} -.backup-versions {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff; padding: 20px} +.backup-versions {background-color: #1c1c19; color: #fff; padding: 20px} .button {padding: 5px 10px; font-size: 14px; background-color: rgba(0,198,255,0.7); margin-bottom: 20px; text-align: center; cursor: pointer} \ No newline at end of file diff --git a/assets/css/editor.css b/assets/css/editor.css index b31b8d3..13f5863 100644 --- a/assets/css/editor.css +++ b/assets/css/editor.css @@ -2,36 +2,36 @@ .cm-s-icecoder {color: #666; background: #1d1d1b} -.cm-s-icecoder span.cm-keyword {color: #eee; font-weight:bold} /* off-white 1 */ -.cm-s-icecoder span.cm-atom {color: #e1c76e} /* yellow */ -.cm-s-icecoder span.cm-number {color: #6cb5d9} /* blue */ -.cm-s-icecoder span.cm-def {color: #b9ca4a} /* green */ +.cm-s-icecoder span.cm-keyword {color: #eee; font-weight: bold} /* off-white 1 */ +.cm-s-icecoder span.cm-atom {color: #e1c76e} /* yellow */ +.cm-s-icecoder span.cm-number {color: #6cb5d9} /* blue */ +.cm-s-icecoder span.cm-def {color: #b9ca4a} /* green */ -.cm-s-icecoder span.cm-variable {color: #6cb5d9} /* blue */ -.cm-s-icecoder span.cm-variable-2 {color: #cc1e5c} /* pink */ -.cm-s-icecoder span.cm-variable-3 {color: #f9602c} /* orange */ +.cm-s-icecoder span.cm-variable {color: #6cb5d9} /* blue */ +.cm-s-icecoder span.cm-variable-2 {color: #cc1e5c} /* pink */ +.cm-s-icecoder span.cm-variable-3 {color: #f9602c} /* orange */ -.cm-s-icecoder span.cm-property {color: #eee} /* off-white 1 */ -.cm-s-icecoder span.cm-operator {color: #9179bb} /* purple */ -.cm-s-icecoder span.cm-comment {color: #97a3aa} /* grey-blue */ +.cm-s-icecoder span.cm-property {color: #eee} /* off-white 1 */ +.cm-s-icecoder span.cm-operator {color: #9179bb} /* purple */ +.cm-s-icecoder span.cm-comment {color: #97a3aa} /* grey-blue */ -.cm-s-icecoder span.cm-string {color: #b9ca4a} /* green */ -.cm-s-icecoder span.cm-string-2 {color: #6cb5d9} /* blue */ +.cm-s-icecoder span.cm-string {color: #b9ca4a} /* green */ +.cm-s-icecoder span.cm-string-2 {color: #6cb5d9} /* blue */ -.cm-s-icecoder span.cm-meta {color: #555} /* grey */ +.cm-s-icecoder span.cm-meta {color: #555} /* grey */ -.cm-s-icecoder span.cm-qualifier {color: #555} /* grey */ -.cm-s-icecoder span.cm-builtin {color: #214e7b} /* bright blue */ -.cm-s-icecoder span.cm-bracket {color: #cc7} /* grey-yellow */ +.cm-s-icecoder span.cm-qualifier {color: #555} /* grey */ +.cm-s-icecoder span.cm-builtin {color: #214e7b} /* bright blue */ +.cm-s-icecoder span.cm-bracket {color: #cc7} /* grey-yellow */ -.cm-s-icecoder span.cm-tag {color: #e8e8e8} /* off-white 2 */ -.cm-s-icecoder span.cm-attribute {color: #099} /* teal */ +.cm-s-icecoder span.cm-tag {color: #e8e8e8} /* off-white 2 */ +.cm-s-icecoder span.cm-attribute {color: #099} /* teal */ -.cm-s-icecoder span.cm-header {color: #6a0d6a} /* purple-pink */ -.cm-s-icecoder span.cm-quote {color: #186718} /* dark green */ -.cm-s-icecoder span.cm-hr {color: #888} /* mid-grey */ -.cm-s-icecoder span.cm-link {color: #e1c76e} /* yellow */ -.cm-s-icecoder span.cm-error {color: #d00} /* red */ +.cm-s-icecoder span.cm-header {color: #6a0d6a} /* purple-pink */ +.cm-s-icecoder span.cm-quote {color: #186718} /* dark green */ +.cm-s-icecoder span.cm-hr {color: #888} /* mid-grey */ +.cm-s-icecoder span.cm-link {color: #e1c76e} /* yellow */ +.cm-s-icecoder span.cm-error {color: #d00} /* red */ .cm-s-icecoder .CodeMirror-cursor {border-left: 1px solid white !important} .cm-s-icecoder .CodeMirror-selected {color: #fff !important; background: #037 !important} diff --git a/assets/css/farbtastic.css b/assets/css/farbtastic.css index 5d1573e..97ca221 100644 --- a/assets/css/farbtastic.css +++ b/assets/css/farbtastic.css @@ -31,7 +31,7 @@ height: 17px; margin: -8px 0 0 -8px; overflow: hidden; - background: url('../assets/images/marker.png') no-repeat; + background: url('../images/marker.png') no-repeat; } .colorValue { border: 0; diff --git a/assets/css/file-types.css b/assets/css/file-types.css index 4f71d6e..c8cca44 100644 --- a/assets/css/file-types.css +++ b/assets/css/file-types.css @@ -1,9 +1,9 @@ .fileManager { - margin: 0 0 15px 20px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + margin: 0 0 15px 20px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } .fileManager span {font-family: helvetica, arial, swiss, verdana; padding: 1px 3px; border-radius: 3px} @@ -13,7 +13,7 @@ /* Default file */ .fileManager LI.pft-directory:before, .fileManager LI.pft-file:before { - position: absolute; width: 16px; height: 16px; content: ""; margin-top: -2px; margin-left: -20px; background:url(../images/file-folder-icons.png) no-repeat 0 0; + position: absolute; width: 16px; height: 16px; content: ""; margin-top: -2px; margin-left: -20px; background:url('../images/file-folder-icons.png') no-repeat 0 0; } .fileManager LI.dirOpen:before {background-position: -16px 0} .fileManager LI.pft-file:before {background-position: -32px 0} diff --git a/assets/css/files.css b/assets/css/files.css index 8fb6e35..def9027 100644 --- a/assets/css/files.css +++ b/assets/css/files.css @@ -1,40 +1,21 @@ -/* First, reset everything to a standard */ -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - font-family: arial, verdana, helvetica, sans-serif; - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; -} - ::-webkit-scrollbar {width: 12px; height: 12px} ::-webkit-scrollbar-thumb {background: rgba(0,198,255,0.1)} ::-webkit-scrollbar-corner, ::-webkit-scrollbar-resizer {background: transparent} body {margin: 0; overflow: auto; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } .lock {position: fixed; display: inline-block; width: 12px; height: 16px; background: url('../images/file-manager-icons.png') 0 0 no-repeat; right: 0; margin-right: 16px; top: 0; cursor: pointer} .refresh {position: fixed; display: inline-block; width: 14px; height: 14px; background: url('../images/file-manager-icons.png') -32px 0 no-repeat; right: 0; margin-right: 15px; top: 25px; cursor: pointer} .plugins {position: fixed; display: inline-block; width: 16px; height: 16px; background: url('../images/file-manager-icons.png') -64px 0 no-repeat; right: 0; margin-right: 15px; top: 47px; cursor: pointer} .fmDragBox {position: absolute; display: inline-block; width: 0; height: 0; top: 0; left: 0; background: rgba(0,198,255,0.3); - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } li a span:first-of-type {white-space: pre} \ No newline at end of file diff --git a/assets/css/ftp-manager.css b/assets/css/ftp-manager.css index 1cbae57..1a9e0ea 100644 --- a/assets/css/ftp-manager.css +++ b/assets/css/ftp-manager.css @@ -1,37 +1,16 @@ -/* First, reset everything to a standard */ -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; -} - body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} a {color: #2187e7; text-decoration: none} -input {padding: 4px; border: 1px solid #555; background-color: #444; color: #fff} -input:focus { - outline: none; - -webkit-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); - -moz-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); - box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); -} +input {padding: 4px; border: 0; background-color: #444; color: #fff} +select {padding: 3px 4px; border: 0; background-color: #444; color: #fff} +input:focus {outline: none; background: rgba(0,198,255,0.5); color: #fff} +select:focus {outline: none} -.ftpManager {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff; padding: 20px} +.ftpManager {background-color: #1c1c19; color: #fff; padding: 20px} .ftpManager .info {font-size: 10px; color: rgba(0,198,255,0.7); cursor: help} \ No newline at end of file diff --git a/assets/css/help.css b/assets/css/help.css index 0f5e0d5..4092506 100644 --- a/assets/css/help.css +++ b/assets/css/help.css @@ -1,32 +1,14 @@ -/* First, reset everything to a standard */ -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; -} - body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} a {color: #fff; text-decoration: none} -.help {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff; padding: 20px} +.help {background-color: #1c1c19; color: #fff; padding: 20px} .key {display: inline-block; width: 175px; text-align: right; margin-right: 5px; float: left} .key .plus {color: #888} .shortcut {display: inline-block; width: 195px; color: #888; margin-left: 5px; float: left} diff --git a/assets/css/icecoder.css b/assets/css/icecoder.css index b6086a7..2cfebf4 100644 --- a/assets/css/icecoder.css +++ b/assets/css/icecoder.css @@ -1,28 +1,9 @@ -/* First, reset everything to a standard */ -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - font-family: arial, verdana, helvetica, sans-serif; - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; -} - body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - background-color: #1d1d1b; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-color: #1d1d1b; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} @@ -36,20 +17,20 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .whiteGlow {box-shadow: 0 0 8px 2px rgba(255,255,255,0.6)} .spinner {width: 50px; height: 50px; margin: 20px auto; background: #fff; - -webkit-animation: rotateplane 1.2s infinite ease-in-out; - animation: rotateplane 1.2s infinite ease-in-out; + -webkit-animation: rotateplane 1.2s infinite ease-in-out; + animation: rotateplane 1.2s infinite ease-in-out; } @-webkit-keyframes rotateplane { - 0% {-webkit-transform: perspective(120px)} - 50% {-webkit-transform: perspective(120px) rotateY(180deg)} - 100% {-webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)} + 0% {-webkit-transform: perspective(120px)} + 50% {-webkit-transform: perspective(120px) rotateY(180deg)} + 100% {-webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)} } @keyframes rotateplane { - 0% {transform: perspective(120px) rotateX(0deg) rotateY(0deg)} - 50% {transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)} - 100% {transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg)} + 0% {transform: perspective(120px) rotateX(0deg) rotateY(0deg)} + 50% {transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)} + 100% {transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg)} } .infoBlackMask {position: fixed; display: none; width: 0; height: 0; top: 0; left: 0; border: solid 10000px rgba(0,0,0,0); transition: all 0.5s ease; z-index: 100} @@ -59,22 +40,22 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .infoMessage .button {position: absolute; bottom: 0; left: 190px; width: 100px; padding: 5px 10px; font-size: 18px; background-color: rgba(0,198,255,0.7); cursor: pointer} .plugins {position: absolute; display: inline-block; width: 3px; height: 100%; top: 0; background: transparent; overflow: hidden; z-index: 3; - transition: all 0.07s ease-out; + transition: all 0.07s ease-out; } .header {position: absolute; display: inline-block; top: 0; left: 0; width: 100%; height: 15px; background-color: #fff; text-align: right; z-index: 1} -.files {position: absolute; display: inline-block; top: 0; left: 0; height: 100%; width: 250px; background-color: #444; background-image: url('../images/files-arrow.png'); background-repeat: no-repeat; background-position: 100% 50%; overflow: hidden; z-index: 2; - transition: background 0.2s ease-out; +.files {position: absolute; display: inline-block; top: 0; left: 0; height: 100%; width: 250px; background-color: #444; overflow: hidden; z-index: 2; + transition: background 0.2s ease-out; } .files .fileNav {display: block; height: 36px} -.files .fileNav ul {list-style-type: none; line-height: 22px; padding-left: 15px} +.files .fileNav ul {list-style-type: none; line-height: 20px; padding-left: 15px} .files .fileNav li {display: inline-block; padding: 18px 15px 0 0} .files .fileNav a {color: #666; text-decoration: none} .files .fileNav a:hover {color: #fff; cursor: pointer} .files .options { - transition: opacity 0.15s ease-in-out; + transition: opacity 0.15s ease-in-out; } .files .options .optionsList {position: absolute; display: inline-block; visibility: hidden; background: #383838; height: 100%; padding: 23px 15px 15px 15px} .files .options .optionsList ul {list-style-type: none; line-height: 24px} @@ -85,7 +66,7 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .files .button:hover {background-color: #1d1d1b; color: #eee} .files .frame {display: inline-block; width: 250px; margin-top: 24px} .files .serverMessage {position: absolute; display: inline-block; width: 450px; bottom: 0; background-color: rgba(255,255,255,0.8); font-size: 10px; padding: 4px 12px 1px 12px; opacity: 0; - transition: opacity 0.2s; + transition: opacity 0.2s; } .files .serverMessage b {font-size: 10px} @@ -96,44 +77,45 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .editor {position: absolute; display: inline-block; top: 0; left: 15px; width: 2400px} .editor .tabsBar {display: inline-block; height: 27px; width: 2400px; margin-top: 15px; padding-left: 53px; background: #fff} .tabsBar .tab {position: absolute; display: none; height: 15px; padding: 6px 8px 6px 9px; border-right: 1px solid #ddd; color: #fff; white-space: nowrap; overflow: hidden; cursor: pointer; z-index: 1; - transition: width 0.15s ease-in-out; - transition: left 0.15s ease-in-out; + transition: width 0.15s ease-in-out; + transition: left 0.15s ease-in-out; } .tabsBar .tabSlide { - transition: left 0.15s ease-in-out; + transition: left 0.15s ease-in-out; } .tabsBar .tabDrag { - transition: left 0s ease-in-out; + transition: left 0s ease-in-out; } -.tabsBar .tab .closeTab, .tabsBar .closeAllTabs {margin: 1px 0 0 5px; border-radius: 6px; cursor: pointer} +.tabsBar .tab .closeTab, .tabsBar .closeAllTabs {margin: 2px 0 0 5px; border-radius: 6px; cursor: pointer} .tabsBar .tab .closeTab {position: absolute; right: 7px} -.tabsBar .alphaTabs {position: absolute; margin: 6px 0 0 -20px; border-radius: 6px; cursor: pointer} +.tabsBar .alphaTabs {position: absolute; margin: 8px 0 0 -20px; border-radius: 6px; cursor: pointer} .tabsBar .alphaTabs:hover {background: #ccc} -.tabsBar .closeAllTabs {position: absolute; margin: 6px 0 0 -36px} +.tabsBar .closeAllTabs {position: absolute; margin: 8px 0 0 -36px} .tabsBar .closeAllTabs:hover {background: #ccc} .tabsBar .newTab {position: absolute; display: inline-block; height: 15px; padding: 7px 7px 5px 7px; cursor: pointer; z-index: 0; - transition: left 0.15s ease-in-out; + transition: left 0.15s ease-in-out; } .editor .findBar {display: inline-block; height: 28px; width: 2400px; color: #fff; background-color: #1d1d1b} .findBar .findReplace {position: absolute; padding-top: 2px; z-index: 1} .findReplace .selectWrapper {position: relative; display: inline-block; margin-top: -6px} .findReplace .selectWrapper select {position: relative; padding: 1px; border: 0; background: url('../images/select-arrow.gif') no-repeat right #1d1d1b; color: #fff; font-size: 10px; height: 28px; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; } .findReplace .selectWrapper select:focus {outline: 0} .findReplace .findText {display: inline-block; height: 28px; font-size: 10px; margin: 7px 3px 0 27px} .findReplace .find {position: relative; width: 167px; height: 28px; border: 0; top: -2px; font-size: 12px; padding-left: 5px; margin-right: 3px; background: #444; color: #eee} -.findReplace .replaceText {height: 28px; font-size: 10px; margin: 7px 3px 0 2px} +.findReplace .replaceText {height: 28px; font-size: 10px; margin: 6px 3px 0 2px} .findReplace .replace {position: relative; width: 167px; height: 28px; border: 0; top: -2px; font-size: 12px; padding-left: 5px; background: #444; color: #eee} +.findReplace .withText {display: inline-block; height: 28px; font-size: 10px; margin-top: 1px} .findReplace .targetText {height: 28px; font-size: 10px; margin: 7px 3px 0 2px} .findReplace .submit {position: relative; top: -2px; height: 28px; padding-top: 2px; border: 0; background-color: #1d1d1b; color: #eee; font-size: 10px; margin-left: 2px; cursor: pointer} .findReplace .submit:hover {background-color: #2187e7; color: #eee} .findReplace .results {position: relative; display: inline-block; width: 200px; height: 20px; font-size: 10px; margin: 7px 0 0 20px} .findBar .goLine {position: fixed; display: inline-block; width: 120px; right: 65px; top: 49px; height: 21px; font-size: 10px; color: #eee; cursor: default; z-index: 1} .goLine .goToLine {width: 50px; height: 28px; border: 0; font-size: 12px; margin: -7px 0 0 3px; padding-left: 4px; background: #333; color: #eee} -.findReplace input:focus, .goLine .goToLine:focus {outline: none; background: rgba(0,198,255,0.5); color: #000} +.findReplace input:focus, .goLine .goToLine:focus {outline: none; background: rgba(0,198,255,0.5); color: #fff} .findBar .view {position: fixed; display: inline-block; width: 16px; height: 16px; right: 40px; top: 49px; background: url('../images/file-manager-icons.png') 0 0 no-repeat; cursor: pointer; background-position: -48px 0; opacity: 0.3} .findBar .bug {position: fixed; display: inline-block; width: 16px; height: 16px; right: 15px; top: 48px; background: url('../images/bug-reporting-icons.png') 0 0 no-repeat; cursor: pointer; background-position: 0 0} .editor .terminal {position: fixed; top: 10000px; transition: top 0.2s ease; z-index: 2} @@ -149,15 +131,15 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .footer {position: fixed; display: inline-block; width: 100%; height: 30px; bottom: 0; background-color: rgba(0,0,0,0.15); left: 0; z-index: 1} .footer .nesting {position: absolute; display: inline-block; padding: 5px; margin-top: 10px; left: 260px; border-radius: 5px; background-color: #0b0; cursor: default} -.footer .versionsDisplay {position: absolute; display: inline-block; padding: 5px; margin-top: 3px; left: 275px; color: #fff; font-weight: bold; cursor: pointer} +.footer .versionsDisplay {position: absolute; display: inline-block; padding: 5px; margin-top: 3px; left: 275px; color: #fff; cursor: pointer} .footer .splitPaneControls {position: absolute; display: inline-block; width: 50px; text-align: center; padding: 6px} .footer .splitPaneControls .off {display: inline-block; width: 18px; height: 18px; margin-right: 10px; background: url('../images/split-pane-controls.gif') no-repeat 0 0; cursor: pointer} .footer .splitPaneControls .on {display: inline-block; width: 19px; height: 18px; background: url('../images/split-pane-controls.gif') no-repeat -18px 0; cursor: pointer} .footer .splitPaneNames {position: absolute; display: inline-block; width: 100px; text-align: center; margin-top: 9px; color: #555; opacity: 0; transition: opacity 0.3s ease-in-out} -.footer .charDisplay, .footer .byteDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 3px; margin-right: 10px; right: 0; font-weight: bold; font-size: 12px; color: #fff; text-align: right; text-align: right; cursor: pointer} +.footer .charDisplay, .footer .byteDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 3px; margin-right: 10px; right: 0; font-size: 12px; color: #fff; text-align: right; text-align: right; cursor: pointer} .fileMenu {position: absolute; display: none; left: 0; top: 0; background-color: #333; z-index: 10; - transition: opacity 0.15s; + transition: opacity 0.15s; } .fileMenu a {display: block; padding: 2px 5px; background-color: #333; color: #eee; text-decoration: none} .fileMenu a:hover {background-color: #666} diff --git a/assets/css/lint.css b/assets/css/lint.css index b6b42c2..a7fcd50 100644 --- a/assets/css/lint.css +++ b/assets/css/lint.css @@ -4,14 +4,13 @@ } .CodeMirror-lint-tooltip { - background-color: infobackground; - border: 1px solid black; - border-radius: 4px 4px 4px 4px; - color: infotext; - font-family: monospace; - font-size: 10pt; + background-color: #444; + border: 0; + color: #bbb; + font-family: arial, verdana, helvetica, sans-serif; + font-size: 13px; overflow: hidden; - padding: 2px 5px; + padding: 5px; position: fixed; white-space: pre; white-space: pre-wrap; diff --git a/assets/css/multiple-results.css b/assets/css/multiple-results.css index d642b49..7eab7bd 100644 --- a/assets/css/multiple-results.css +++ b/assets/css/multiple-results.css @@ -1,33 +1,15 @@ -/* First, reset everything to a standard */ -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; -} - body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } h1 {font-size: 36px; font-weight: normal; color: #888; margin: 20px 20px 0 20px} h2 {font-size: 18px; font-weight: normal; color: #fff} hr {border: 0; height: 1px; background-color: #888} -.results {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff} +.results {background-color: #1c1c19; color: #fff} .results .resultsPane {position: relative; width: 660px; height: 340px; overflow: auto; font-size: 10px; padding: 20px; float: left} .results .resultsPane a {color: rgba(0,198,255,0.7); text-decoration: none} .results .resultsPane a:hover {text-decoration: underline} diff --git a/assets/css/plugins-manager.css b/assets/css/plugins-manager.css index 2ce6793..6b2a015 100644 --- a/assets/css/plugins-manager.css +++ b/assets/css/plugins-manager.css @@ -1,36 +1,13 @@ -/* First, reset everything to a standard */ -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; -} - body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} a {color: #fff; text-decoration: none} -input {padding: 4px; border: 1px solid #555; background-color: #444; color: #fff} -input:focus { - outline: none; - -webkit-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); - -moz-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); - box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); -} +input {margin-top: 3px; padding: 4px; border: 0; background-color: #444; color: #fff} +input:focus {outline: none; background: rgba(0,198,255,0.5); color: #fff} -.pluginsManager {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff; padding: 20px} \ No newline at end of file +.pluginsManager {background-color: #1c1c19; color: #fff; padding: 20px} \ No newline at end of file diff --git a/assets/css/properties.css b/assets/css/properties.css index 13c8930..babdfbf 100644 --- a/assets/css/properties.css +++ b/assets/css/properties.css @@ -1,28 +1,12 @@ -/* First, reset everything to a standard */ -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; -} - body {overflow: hidden;} h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} th {padding-left: 23px; padding-bottom: 5px} th, td {text-align: left; font-size: 10px} -.properties {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff; padding: 20px} +.properties {background-color: #1c1c19; color: #fff; padding: 20px} .properties .column {display: inline-block; width: 210px; font-size: 10px; float: left} +.properties .permText {margin-top: 3px; padding: 4px; border: 0; background-color: #444; color: #fff} +.properties .permText:focus {outline: none; background: rgba(0,198,255,0.5); color: #fff} .properties .update {position: absolute; bottom: 0; right: 20px; padding: 5px 10px; font-size: 18px; background-color: rgba(0,198,255,0.7); opacity: 0.1; cursor: pointer} \ No newline at end of file diff --git a/assets/css/settings-screen.css b/assets/css/settings-screen.css index 532461c..99b657b 100644 --- a/assets/css/settings-screen.css +++ b/assets/css/settings-screen.css @@ -8,20 +8,20 @@ b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { - border: 0; - margin: 0; - padding: 0; - outline: 0; - /*font-size: 12px;*/ - vertical-align: top; + border: 0; + margin: 0; + padding: 0; + outline: 0; + /*font-size: 12px;*/ + vertical-align: top; } body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select:none; - user-select: none; - font-size: 12px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select:none; + user-select: none; + font-size: 12px; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} @@ -39,10 +39,10 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .settings .section {width: 640px; height: 450px; padding: 20px; margin-top: 10px; float: left} .settings input, .settings textarea {border: 1px solid #555; background-color: #444; color: #fff} .settings input:focus, .settings textarea:focus { - outline: none; - -webkit-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); - -moz-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); - box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); + outline: none; + -webkit-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); + -moz-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); + box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); } .settings input[type="text"]:disabled {opacity: 0.5} .settings .info {font-size: 10px; color: rgba(0,198,255,0.7); cursor: help} diff --git a/assets/css/terminal.css b/assets/css/terminal.css index b860b3b..2387889 100644 --- a/assets/css/terminal.css +++ b/assets/css/terminal.css @@ -8,13 +8,13 @@ b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, input, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { - font-family: monospace, courier, sans-serif; - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; + font-family: monospace, courier, sans-serif; + border: 0; + margin: 0; + padding: 0; + outline: 0; + font-size: 12px; + vertical-align: top; } /* Box sizing */ From 3c6a0200f9f51e7f5ffeedc6d1b258a715800802 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sun, 29 Mar 2020 09:44:42 +0100 Subject: [PATCH 122/231] Indent 4 spaces, add resets.css --- assets/css/auto-logout-warning.css | 10 +- assets/css/backup-versions.css | 8 +- assets/css/codemirror.css | 264 ++++++++++++++--------------- assets/css/farbtastic.css | 58 +++---- assets/css/file-types.css | 12 +- assets/css/files.css | 16 +- assets/css/foldgutter.css | 18 +- assets/css/ftp-manager.css | 8 +- assets/css/help.css | 8 +- assets/css/icecoder.css | 52 +++--- assets/css/lint.css | 84 ++++----- assets/css/multiple-results.css | 8 +- assets/css/plugins-manager.css | 8 +- assets/css/resets.css | 18 ++ assets/css/settings-screen.css | 30 ++-- assets/css/show-hint.css | 52 +++--- assets/css/simplescrollbars.css | 52 +++--- assets/css/terminal.css | 14 +- 18 files changed, 369 insertions(+), 351 deletions(-) create mode 100644 assets/css/resets.css diff --git a/assets/css/auto-logout-warning.css b/assets/css/auto-logout-warning.css index a66c5cd..51f0506 100644 --- a/assets/css/auto-logout-warning.css +++ b/assets/css/auto-logout-warning.css @@ -1,9 +1,9 @@ body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - text-align: center; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + text-align: center; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} diff --git a/assets/css/backup-versions.css b/assets/css/backup-versions.css index c777be0..92602de 100644 --- a/assets/css/backup-versions.css +++ b/assets/css/backup-versions.css @@ -1,8 +1,8 @@ body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} diff --git a/assets/css/codemirror.css b/assets/css/codemirror.css index ebfe4f6..65a7ef3 100644 --- a/assets/css/codemirror.css +++ b/assets/css/codemirror.css @@ -1,39 +1,39 @@ /* BASICS */ .CodeMirror { - /* Set height, width, borders, and global font properties here */ - font-family: monospace; - height: 300px; - color: black; + /* Set height, width, borders, and global font properties here */ + font-family: monospace; + height: 300px; + color: black; } /* PADDING */ .CodeMirror-lines { - padding: 4px 0; /* Vertical padding around content */ + padding: 4px 0; /* Vertical padding around content */ } .CodeMirror pre { - padding: 0 4px; /* Horizontal padding of content */ + padding: 0 4px; /* Horizontal padding of content */ } .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { - background-color: white; /* The little square between H and V scrollbars */ + background-color: white; /* The little square between H and V scrollbars */ } /* GUTTER */ .CodeMirror-gutters { - border-right: 1px solid #ddd; - background-color: #f7f7f7; - white-space: nowrap; + border-right: 1px solid #ddd; + background-color: #f7f7f7; + white-space: nowrap; } .CodeMirror-linenumbers {} .CodeMirror-linenumber { - padding: 0 3px 0 5px; - min-width: 20px; - text-align: right; - color: #999; - white-space: nowrap; + padding: 0 3px 0 5px; + min-width: 20px; + text-align: right; + color: #999; + white-space: nowrap; } .CodeMirror-guttermarker { color: black; } @@ -42,45 +42,45 @@ /* CURSOR */ .CodeMirror-cursor { - border-left: 1px solid black; - border-right: none; - width: 0; + border-left: 1px solid black; + border-right: none; + width: 0; } /* Shown when moving in bi-directional text */ .CodeMirror div.CodeMirror-secondarycursor { - border-left: 1px solid silver; + border-left: 1px solid silver; } .cm-fat-cursor .CodeMirror-cursor { - width: auto; - border: 0; - background: #7e7; + width: auto; + border: 0; + background: #7e7; } .cm-fat-cursor div.CodeMirror-cursors { - z-index: 1; + z-index: 1; } .cm-animate-fat-cursor { - width: auto; - border: 0; - -webkit-animation: blink 1.06s steps(1) infinite; - -moz-animation: blink 1.06s steps(1) infinite; - animation: blink 1.06s steps(1) infinite; - background-color: #7e7; + width: auto; + border: 0; + -webkit-animation: blink 1.06s steps(1) infinite; + -moz-animation: blink 1.06s steps(1) infinite; + animation: blink 1.06s steps(1) infinite; + background-color: #7e7; } @-moz-keyframes blink { - 0% {} - 50% { background-color: transparent; } - 100% {} + 0% {} + 50% { background-color: transparent; } + 100% {} } @-webkit-keyframes blink { - 0% {} - 50% { background-color: transparent; } - 100% {} + 0% {} + 50% { background-color: transparent; } + 100% {} } @keyframes blink { - 0% {} - 50% { background-color: transparent; } - 100% {} + 0% {} + 50% { background-color: transparent; } + 100% {} } /* Can style cursor different in overwrite (non-insert) mode */ @@ -89,8 +89,8 @@ .cm-tab { display: inline-block; text-decoration: inherit; } .CodeMirror-ruler { - border-left: 1px solid #ccc; - position: absolute; + border-left: 1px solid #ccc; + position: absolute; } /* DEFAULT THEME */ @@ -144,130 +144,130 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} the editor. You probably shouldn't touch them. */ .CodeMirror { - position: relative; - overflow: hidden; - background: white; + position: relative; + overflow: hidden; + background: white; } .CodeMirror-scroll { - overflow: scroll !important; /* Things will break if this is overridden */ - /* 30px is the magic margin used to hide the element's real scrollbars */ - /* See overflow: hidden in .CodeMirror */ - margin-bottom: -30px; margin-right: -30px; - padding-bottom: 30px; - height: 100%; - outline: none; /* Prevent dragging from highlighting the element */ - position: relative; + overflow: scroll !important; /* Things will break if this is overridden */ + /* 30px is the magic margin used to hide the element's real scrollbars */ + /* See overflow: hidden in .CodeMirror */ + margin-bottom: -30px; margin-right: -30px; + padding-bottom: 30px; + height: 100%; + outline: none; /* Prevent dragging from highlighting the element */ + position: relative; } .CodeMirror-sizer { - position: relative; - border-right: 30px solid transparent; + position: relative; + border-right: 30px solid transparent; } /* The fake, visible scrollbars. Used to force redraw during scrolling before actual scrolling happens, thus preventing shaking and flickering artifacts. */ .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { - position: absolute; - z-index: 6; - display: none; + position: absolute; + z-index: 6; + display: none; } .CodeMirror-vscrollbar { - right: 0; top: 0; - overflow-x: hidden; - overflow-y: scroll; + right: 0; top: 0; + overflow-x: hidden; + overflow-y: scroll; } .CodeMirror-hscrollbar { - bottom: 0; left: 0; - overflow-y: hidden; - overflow-x: scroll; + bottom: 0; left: 0; + overflow-y: hidden; + overflow-x: scroll; } .CodeMirror-scrollbar-filler { - right: 0; bottom: 0; + right: 0; bottom: 0; } .CodeMirror-gutter-filler { - left: 0; bottom: 0; + left: 0; bottom: 0; } .CodeMirror-gutters { - position: absolute; left: 0; top: 0; - z-index: 3; + position: absolute; left: 0; top: 0; + z-index: 3; } .CodeMirror-gutter { - white-space: normal; - height: 100%; - display: inline-block; - vertical-align: top; - margin-bottom: -30px; - /* Hack to make IE7 behave */ - *zoom:1; - *display:inline; + white-space: normal; + height: 100%; + display: inline-block; + vertical-align: top; + margin-bottom: -30px; + /* Hack to make IE7 behave */ + *zoom:1; + *display:inline; } .CodeMirror-gutter-wrapper { - position: absolute; - z-index: 4; - background: none !important; - border: none !important; + position: absolute; + z-index: 4; + background: none !important; + border: none !important; } .CodeMirror-gutter-background { - position: absolute; - top: 0; bottom: 0; - z-index: 4; + position: absolute; + top: 0; bottom: 0; + z-index: 4; } .CodeMirror-gutter-elt { - position: absolute; - cursor: default; - z-index: 4; + position: absolute; + cursor: default; + z-index: 4; } .CodeMirror-gutter-wrapper { - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; } .CodeMirror-lines { - cursor: text; - min-height: 1px; /* prevents collapsing before first draw */ + cursor: text; + min-height: 1px; /* prevents collapsing before first draw */ } .CodeMirror pre { - /* Reset some styles that the rest of the page might have set */ - -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; - border-width: 0; - background: transparent; - font-family: inherit; - font-size: inherit; - margin: 0; - white-space: pre; - word-wrap: normal; - line-height: inherit; - color: inherit; - z-index: 2; - position: relative; - overflow: visible; - -webkit-tap-highlight-color: transparent; + /* Reset some styles that the rest of the page might have set */ + -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; + border-width: 0; + background: transparent; + font-family: inherit; + font-size: inherit; + margin: 0; + white-space: pre; + word-wrap: normal; + line-height: inherit; + color: inherit; + z-index: 2; + position: relative; + overflow: visible; + -webkit-tap-highlight-color: transparent; } .CodeMirror-wrap pre { - word-wrap: break-word; - white-space: pre-wrap; - word-break: normal; + word-wrap: break-word; + white-space: pre-wrap; + word-break: normal; } .CodeMirror-linebackground { - position: absolute; - left: 0; right: 0; top: 0; bottom: 0; - z-index: 0; + position: absolute; + left: 0; right: 0; top: 0; bottom: 0; + z-index: 0; } .CodeMirror-linewidget { - position: relative; - z-index: 2; - overflow: auto; + position: relative; + z-index: 2; + overflow: auto; } .CodeMirror-widget {} .CodeMirror-code { - outline: none; + outline: none; } /* Force content-box sizing for the elements where we expect it */ @@ -276,32 +276,32 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} .CodeMirror-gutter, .CodeMirror-gutters, .CodeMirror-linenumber { - -moz-box-sizing: content-box; - box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; } .CodeMirror-measure { - position: absolute; - width: 100%; - height: 0; - overflow: hidden; - visibility: hidden; + position: absolute; + width: 100%; + height: 0; + overflow: hidden; + visibility: hidden; } .CodeMirror-cursor { position: absolute; } .CodeMirror-measure pre { position: static; } div.CodeMirror-cursors { - visibility: hidden; - position: relative; - z-index: 3; + visibility: hidden; + position: relative; + z-index: 3; } div.CodeMirror-dragcursors { - visibility: visible; + visibility: visible; } .CodeMirror-focused div.CodeMirror-cursors { - visibility: visible; + visibility: visible; } .CodeMirror-selected { background: #d9d9d9; } @@ -311,8 +311,8 @@ div.CodeMirror-dragcursors { .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; } .cm-searching { - background: #ffa; - background: rgba(255, 255, 0, .4); + background: #ffa; + background: rgba(255, 255, 0, .4); } /* IE7 hack to prevent it from returning funny offsetTops on the spans */ @@ -322,10 +322,10 @@ div.CodeMirror-dragcursors { .cm-force-border { padding-right: .1px; } @media print { - /* Hide the cursor when printing */ - .CodeMirror div.CodeMirror-cursors { - visibility: hidden; - } + /* Hide the cursor when printing */ + .CodeMirror div.CodeMirror-cursors { + visibility: hidden; + } } /* See issue #2901 */ diff --git a/assets/css/farbtastic.css b/assets/css/farbtastic.css index 97ca221..b32cbd0 100644 --- a/assets/css/farbtastic.css +++ b/assets/css/farbtastic.css @@ -1,49 +1,49 @@ .picker { - display: inline-block; + display: inline-block; } .farbtastic { - position: relative; + position: relative; } .farbtastic * { - position: absolute; - cursor: crosshair; + position: absolute; + cursor: crosshair; } .farbtastic, .farbtastic .wheel { - width: 195px; - height: 195px; + width: 195px; + height: 195px; } .farbtastic .color, .farbtastic .overlay { - top: 47px; - left: 47px; - width: 101px; - height: 101px; + top: 47px; + left: 47px; + width: 101px; + height: 101px; } .farbtastic .wheel { - background: url('../images/wheel.png') no-repeat; - width: 195px; - height: 195px; + background: url('../images/wheel.png') no-repeat; + width: 195px; + height: 195px; } .farbtastic .overlay { - background: url('../images/mask.png') no-repeat; + background: url('../images/mask.png') no-repeat; } .farbtastic .marker { - width: 17px; - height: 17px; - margin: -8px 0 0 -8px; - overflow: hidden; - background: url('../images/marker.png') no-repeat; + width: 17px; + height: 17px; + margin: -8px 0 0 -8px; + overflow: hidden; + background: url('../images/marker.png') no-repeat; } .colorValue { - border: 0; - width: 105px; - padding-left: 5px + border: 0; + width: 105px; + padding-left: 5px } .insertColorValue { - background: #888; - color: #fff; - height: 18px; - width: 60px; - border: 0; - margin-left: 5px; - cursor: pointer + background: #888; + color: #fff; + height: 18px; + width: 60px; + border: 0; + margin-left: 5px; + cursor: pointer } \ No newline at end of file diff --git a/assets/css/file-types.css b/assets/css/file-types.css index c8cca44..88a7912 100644 --- a/assets/css/file-types.css +++ b/assets/css/file-types.css @@ -1,9 +1,9 @@ .fileManager { - margin: 0 0 15px 20px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + margin: 0 0 15px 20px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } .fileManager span {font-family: helvetica, arial, swiss, verdana; padding: 1px 3px; border-radius: 3px} @@ -13,7 +13,7 @@ /* Default file */ .fileManager LI.pft-directory:before, .fileManager LI.pft-file:before { - position: absolute; width: 16px; height: 16px; content: ""; margin-top: -2px; margin-left: -20px; background:url('../images/file-folder-icons.png') no-repeat 0 0; + position: absolute; width: 16px; height: 16px; content: ""; margin-top: -2px; margin-left: -20px; background:url('../images/file-folder-icons.png') no-repeat 0 0; } .fileManager LI.dirOpen:before {background-position: -16px 0} .fileManager LI.pft-file:before {background-position: -32px 0} diff --git a/assets/css/files.css b/assets/css/files.css index def9027..d6b7c7a 100644 --- a/assets/css/files.css +++ b/assets/css/files.css @@ -3,19 +3,19 @@ ::-webkit-scrollbar-corner, ::-webkit-scrollbar-resizer {background: transparent} body {margin: 0; overflow: auto; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } .lock {position: fixed; display: inline-block; width: 12px; height: 16px; background: url('../images/file-manager-icons.png') 0 0 no-repeat; right: 0; margin-right: 16px; top: 0; cursor: pointer} .refresh {position: fixed; display: inline-block; width: 14px; height: 14px; background: url('../images/file-manager-icons.png') -32px 0 no-repeat; right: 0; margin-right: 15px; top: 25px; cursor: pointer} .plugins {position: fixed; display: inline-block; width: 16px; height: 16px; background: url('../images/file-manager-icons.png') -64px 0 no-repeat; right: 0; margin-right: 15px; top: 47px; cursor: pointer} .fmDragBox {position: absolute; display: inline-block; width: 0; height: 0; top: 0; left: 0; background: rgba(0,198,255,0.3); - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } li a span:first-of-type {white-space: pre} \ No newline at end of file diff --git a/assets/css/foldgutter.css b/assets/css/foldgutter.css index ad19ae2..4b87b6a 100644 --- a/assets/css/foldgutter.css +++ b/assets/css/foldgutter.css @@ -1,20 +1,20 @@ .CodeMirror-foldmarker { - color: blue; - text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; - font-family: arial; - line-height: .3; - cursor: pointer; + color: blue; + text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; + font-family: arial; + line-height: .3; + cursor: pointer; } .CodeMirror-foldgutter { - width: .7em; + width: .7em; } .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded { - cursor: pointer; + cursor: pointer; } .CodeMirror-foldgutter-open:after { - content: "\25BE"; + content: "\25BE"; } .CodeMirror-foldgutter-folded:after { - content: "\25B8"; + content: "\25B8"; } diff --git a/assets/css/ftp-manager.css b/assets/css/ftp-manager.css index 1a9e0ea..c44357f 100644 --- a/assets/css/ftp-manager.css +++ b/assets/css/ftp-manager.css @@ -1,8 +1,8 @@ body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} diff --git a/assets/css/help.css b/assets/css/help.css index 4092506..af8cbd0 100644 --- a/assets/css/help.css +++ b/assets/css/help.css @@ -1,8 +1,8 @@ body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} diff --git a/assets/css/icecoder.css b/assets/css/icecoder.css index 2cfebf4..0f95f57 100644 --- a/assets/css/icecoder.css +++ b/assets/css/icecoder.css @@ -1,9 +1,9 @@ body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - background-color: #1d1d1b; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-color: #1d1d1b; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} @@ -17,20 +17,20 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .whiteGlow {box-shadow: 0 0 8px 2px rgba(255,255,255,0.6)} .spinner {width: 50px; height: 50px; margin: 20px auto; background: #fff; - -webkit-animation: rotateplane 1.2s infinite ease-in-out; - animation: rotateplane 1.2s infinite ease-in-out; + -webkit-animation: rotateplane 1.2s infinite ease-in-out; + animation: rotateplane 1.2s infinite ease-in-out; } @-webkit-keyframes rotateplane { - 0% {-webkit-transform: perspective(120px)} - 50% {-webkit-transform: perspective(120px) rotateY(180deg)} - 100% {-webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)} + 0% {-webkit-transform: perspective(120px)} + 50% {-webkit-transform: perspective(120px) rotateY(180deg)} + 100% {-webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)} } @keyframes rotateplane { - 0% {transform: perspective(120px) rotateX(0deg) rotateY(0deg)} - 50% {transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)} - 100% {transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg)} + 0% {transform: perspective(120px) rotateX(0deg) rotateY(0deg)} + 50% {transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)} + 100% {transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg)} } .infoBlackMask {position: fixed; display: none; width: 0; height: 0; top: 0; left: 0; border: solid 10000px rgba(0,0,0,0); transition: all 0.5s ease; z-index: 100} @@ -40,13 +40,13 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .infoMessage .button {position: absolute; bottom: 0; left: 190px; width: 100px; padding: 5px 10px; font-size: 18px; background-color: rgba(0,198,255,0.7); cursor: pointer} .plugins {position: absolute; display: inline-block; width: 3px; height: 100%; top: 0; background: transparent; overflow: hidden; z-index: 3; - transition: all 0.07s ease-out; + transition: all 0.07s ease-out; } .header {position: absolute; display: inline-block; top: 0; left: 0; width: 100%; height: 15px; background-color: #fff; text-align: right; z-index: 1} .files {position: absolute; display: inline-block; top: 0; left: 0; height: 100%; width: 250px; background-color: #444; overflow: hidden; z-index: 2; - transition: background 0.2s ease-out; + transition: background 0.2s ease-out; } .files .fileNav {display: block; height: 36px} .files .fileNav ul {list-style-type: none; line-height: 20px; padding-left: 15px} @@ -55,7 +55,7 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .files .fileNav a:hover {color: #fff; cursor: pointer} .files .options { - transition: opacity 0.15s ease-in-out; + transition: opacity 0.15s ease-in-out; } .files .options .optionsList {position: absolute; display: inline-block; visibility: hidden; background: #383838; height: 100%; padding: 23px 15px 15px 15px} .files .options .optionsList ul {list-style-type: none; line-height: 24px} @@ -66,7 +66,7 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .files .button:hover {background-color: #1d1d1b; color: #eee} .files .frame {display: inline-block; width: 250px; margin-top: 24px} .files .serverMessage {position: absolute; display: inline-block; width: 450px; bottom: 0; background-color: rgba(255,255,255,0.8); font-size: 10px; padding: 4px 12px 1px 12px; opacity: 0; - transition: opacity 0.2s; + transition: opacity 0.2s; } .files .serverMessage b {font-size: 10px} @@ -77,14 +77,14 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .editor {position: absolute; display: inline-block; top: 0; left: 15px; width: 2400px} .editor .tabsBar {display: inline-block; height: 27px; width: 2400px; margin-top: 15px; padding-left: 53px; background: #fff} .tabsBar .tab {position: absolute; display: none; height: 15px; padding: 6px 8px 6px 9px; border-right: 1px solid #ddd; color: #fff; white-space: nowrap; overflow: hidden; cursor: pointer; z-index: 1; - transition: width 0.15s ease-in-out; - transition: left 0.15s ease-in-out; + transition: width 0.15s ease-in-out; + transition: left 0.15s ease-in-out; } .tabsBar .tabSlide { - transition: left 0.15s ease-in-out; + transition: left 0.15s ease-in-out; } .tabsBar .tabDrag { - transition: left 0s ease-in-out; + transition: left 0s ease-in-out; } .tabsBar .tab .closeTab, .tabsBar .closeAllTabs {margin: 2px 0 0 5px; border-radius: 6px; cursor: pointer} .tabsBar .tab .closeTab {position: absolute; right: 7px} @@ -93,15 +93,15 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .tabsBar .closeAllTabs {position: absolute; margin: 8px 0 0 -36px} .tabsBar .closeAllTabs:hover {background: #ccc} .tabsBar .newTab {position: absolute; display: inline-block; height: 15px; padding: 7px 7px 5px 7px; cursor: pointer; z-index: 0; - transition: left 0.15s ease-in-out; + transition: left 0.15s ease-in-out; } .editor .findBar {display: inline-block; height: 28px; width: 2400px; color: #fff; background-color: #1d1d1b} .findBar .findReplace {position: absolute; padding-top: 2px; z-index: 1} .findReplace .selectWrapper {position: relative; display: inline-block; margin-top: -6px} .findReplace .selectWrapper select {position: relative; padding: 1px; border: 0; background: url('../images/select-arrow.gif') no-repeat right #1d1d1b; color: #fff; font-size: 10px; height: 28px; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; } .findReplace .selectWrapper select:focus {outline: 0} .findReplace .findText {display: inline-block; height: 28px; font-size: 10px; margin: 7px 3px 0 27px} @@ -139,7 +139,7 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .footer .charDisplay, .footer .byteDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 3px; margin-right: 10px; right: 0; font-size: 12px; color: #fff; text-align: right; text-align: right; cursor: pointer} .fileMenu {position: absolute; display: none; left: 0; top: 0; background-color: #333; z-index: 10; - transition: opacity 0.15s; + transition: opacity 0.15s; } .fileMenu a {display: block; padding: 2px 5px; background-color: #333; color: #eee; text-decoration: none} .fileMenu a:hover {background-color: #666} diff --git a/assets/css/lint.css b/assets/css/lint.css index a7fcd50..079faf3 100644 --- a/assets/css/lint.css +++ b/assets/css/lint.css @@ -1,72 +1,72 @@ /* The lint marker gutter */ .CodeMirror-lint-markers { - width: 12px; margin-left: 2px; + width: 12px; margin-left: 2px; } .CodeMirror-lint-tooltip { - background-color: #444; - border: 0; - color: #bbb; - font-family: arial, verdana, helvetica, sans-serif; - font-size: 13px; - overflow: hidden; - padding: 5px; - position: fixed; - white-space: pre; - white-space: pre-wrap; - z-index: 100; - max-width: 600px; - opacity: 0; - transition: opacity .4s; - -moz-transition: opacity .4s; - -webkit-transition: opacity .4s; - -o-transition: opacity .4s; - -ms-transition: opacity .4s; + background-color: #444; + border: 0; + color: #bbb; + font-family: arial, verdana, helvetica, sans-serif; + font-size: 13px; + overflow: hidden; + padding: 5px; + position: fixed; + white-space: pre; + white-space: pre-wrap; + z-index: 100; + max-width: 600px; + opacity: 0; + transition: opacity .4s; + -moz-transition: opacity .4s; + -webkit-transition: opacity .4s; + -o-transition: opacity .4s; + -ms-transition: opacity .4s; } .CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning { - background-position: left bottom; - background-repeat: repeat-x; + background-position: left bottom; + background-repeat: repeat-x; } .CodeMirror-lint-mark-error { - background-image: - url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==") - ; + background-image: + url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==") +; } .CodeMirror-lint-mark-warning { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII="); + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII="); } .CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning { - background-position: center center; - background-repeat: no-repeat; - cursor: help; - display: inline-block; - height: 16px; - width: 16px; - vertical-align: middle; - position: relative; + background-position: center center; + background-repeat: no-repeat; + cursor: help; + display: inline-block; + height: 16px; + width: 16px; + vertical-align: middle; + position: relative; } .CodeMirror-lint-message-error, .CodeMirror-lint-message-warning { - padding-left: 18px; - background-position: top left; - background-repeat: no-repeat; + padding-left: 18px; + background-position: top left; + background-repeat: no-repeat; } .CodeMirror-lint-marker-error, .CodeMirror-lint-message-error { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII="); + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII="); } .CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII="); + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII="); } .CodeMirror-lint-marker-multiple { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC"); - background-repeat: no-repeat; - background-position: right bottom; - width: 100%; height: 100%; + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC"); + background-repeat: no-repeat; + background-position: right bottom; + width: 100%; height: 100%; } diff --git a/assets/css/multiple-results.css b/assets/css/multiple-results.css index 7eab7bd..aaffeaa 100644 --- a/assets/css/multiple-results.css +++ b/assets/css/multiple-results.css @@ -1,8 +1,8 @@ body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } h1 {font-size: 36px; font-weight: normal; color: #888; margin: 20px 20px 0 20px} diff --git a/assets/css/plugins-manager.css b/assets/css/plugins-manager.css index 6b2a015..268be35 100644 --- a/assets/css/plugins-manager.css +++ b/assets/css/plugins-manager.css @@ -1,8 +1,8 @@ body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} diff --git a/assets/css/resets.css b/assets/css/resets.css new file mode 100644 index 0000000..41dc070 --- /dev/null +++ b/assets/css/resets.css @@ -0,0 +1,18 @@ +/* Reset everything to a standard */ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + font-family: arial, verdana, helvetica, sans-serif; + border: 0; + margin: 0; + padding: 0; + outline: 0; + font-size: 12px; + vertical-align: top; +} \ No newline at end of file diff --git a/assets/css/settings-screen.css b/assets/css/settings-screen.css index 99b657b..ac2d72e 100644 --- a/assets/css/settings-screen.css +++ b/assets/css/settings-screen.css @@ -8,20 +8,20 @@ b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { - border: 0; - margin: 0; - padding: 0; - outline: 0; - /*font-size: 12px;*/ - vertical-align: top; + border: 0; + margin: 0; + padding: 0; + outline: 0; + /*font-size: 12px;*/ + vertical-align: top; } body {overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select:none; - user-select: none; - font-size: 12px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select:none; + user-select: none; + font-size: 12px; } h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px} @@ -39,10 +39,10 @@ h2 {font-size: 18px; font-weight: normal; color: #fff} .settings .section {width: 640px; height: 450px; padding: 20px; margin-top: 10px; float: left} .settings input, .settings textarea {border: 1px solid #555; background-color: #444; color: #fff} .settings input:focus, .settings textarea:focus { - outline: none; - -webkit-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); - -moz-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); - box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); + outline: none; + -webkit-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); + -moz-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); + box-shadow: 0 0 10px 1px rgba(0,198,255,0.7); } .settings input[type="text"]:disabled {opacity: 0.5} .settings .info {font-size: 10px; color: rgba(0,198,255,0.7); cursor: help} diff --git a/assets/css/show-hint.css b/assets/css/show-hint.css index 924e638..dd26dd3 100644 --- a/assets/css/show-hint.css +++ b/assets/css/show-hint.css @@ -1,38 +1,38 @@ .CodeMirror-hints { - position: absolute; - z-index: 10; - overflow: hidden; - list-style: none; + position: absolute; + z-index: 10; + overflow: hidden; + list-style: none; - margin: 0; - padding: 2px; + margin: 0; + padding: 2px; - -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); - -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); - box-shadow: 2px 3px 5px rgba(0,0,0,.2); - border-radius: 3px; - border: 1px solid silver; + -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + box-shadow: 2px 3px 5px rgba(0,0,0,.2); + border-radius: 3px; + border: 1px solid silver; - background: white; - font-size: 90%; - font-family: monospace; + background: white; + font-size: 90%; + font-family: monospace; - max-height: 20em; - overflow-y: auto; + max-height: 20em; + overflow-y: auto; } .CodeMirror-hint { - margin: 0; - padding: 0 4px; - border-radius: 2px; - max-width: 19em; - overflow: hidden; - white-space: pre; - color: black; - cursor: pointer; + margin: 0; + padding: 0 4px; + border-radius: 2px; + max-width: 19em; + overflow: hidden; + white-space: pre; + color: black; + cursor: pointer; } li.CodeMirror-hint-active { - background: #08f; - color: white; + background: #08f; + color: white; } diff --git a/assets/css/simplescrollbars.css b/assets/css/simplescrollbars.css index 5ce2b79..bf1137d 100644 --- a/assets/css/simplescrollbars.css +++ b/assets/css/simplescrollbars.css @@ -2,68 +2,68 @@ .CodeMirror-simplescroll-horizontal, .CodeMirror-overlayscroll-horizontal { - bottom: 0; - left: 0; - height: 12px; + bottom: 0; + left: 0; + height: 12px; } .CodeMirror-simplescroll-horizontal div, .CodeMirror-overlayscroll-horizontal div { - bottom: 0; - height: 100%; + bottom: 0; + height: 100%; } .CodeMirror-simplescroll-vertical, .CodeMirror-overlayscroll-vertical{ - right: 0; - top: 0; - width: 12px; + right: 0; + top: 0; + width: 12px; } .CodeMirror-simplescroll-vertical div, .CodeMirror-overlayscroll-vertical div { - right: 0; - width: 100%; + right: 0; + width: 100%; } /* Simple specific styles*/ .CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical { - position: absolute; - background: #222; - z-index: 6; + position: absolute; + background: #222; + z-index: 6; } .CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div { - position: absolute; - -moz-box-sizing: border-box; - box-sizing: border-box; - background: rgba(0,198,255,0.2); + position: absolute; + -moz-box-sizing: border-box; + box-sizing: border-box; + background: rgba(0,198,255,0.2); } .CodeMirror-simplescroll-horizontal div:hover, .CodeMirror-simplescroll-vertical div:hover { - background: rgba(0,198,255,0.8); + background: rgba(0,198,255,0.8); } .CodeMirror-simplescroll .CodeMirror-scrollbar-filler, .CodeMirror-simplescroll .CodeMirror-gutter-filler { - background: #222; + background: #222; } /* Overlay specific styles */ .CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical { - position: absolute; - z-index: 6; + position: absolute; + z-index: 6; } .CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div { - position: absolute; - background: rgba(0,198,255,0.2); + position: absolute; + background: rgba(0,198,255,0.2); } .CodeMirror-overlayscroll-horizontal div:hover, .CodeMirror-overlayscroll-vertical div:hover { - background: rgba(0,198,255,0.8); + background: rgba(0,198,255,0.8); } .CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler { - display: none; - background: transparent; + display: none; + background: transparent; } diff --git a/assets/css/terminal.css b/assets/css/terminal.css index 2387889..8bfd23c 100644 --- a/assets/css/terminal.css +++ b/assets/css/terminal.css @@ -8,13 +8,13 @@ b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, input, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { - font-family: monospace, courier, sans-serif; - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; + font-family: monospace, courier, sans-serif; + border: 0; + margin: 0; + padding: 0; + outline: 0; + font-size: 12px; + vertical-align: top; } /* Box sizing */ From a62c08820dd08e1842ec8ec3e3a05e5c04bd35aa Mon Sep 17 00:00:00 2001 From: mattpass Date: Mon, 13 Apr 2020 08:29:06 +0100 Subject: [PATCH 123/231] Default template tweaks, JS tidy in 2 x libs --- assets/css/editor.css | 6 +- assets/js/difflib.js | 772 ++++++++++++++++++++-------------------- assets/js/farbtastic.js | 454 +++++++++++------------ 3 files changed, 616 insertions(+), 616 deletions(-) diff --git a/assets/css/editor.css b/assets/css/editor.css index 13f5863..d5cf8ea 100644 --- a/assets/css/editor.css +++ b/assets/css/editor.css @@ -1,6 +1,6 @@ /* ICEcoder default theme by Matt Pass */ -.cm-s-icecoder {color: #666; background: #1d1d1b} +.cm-s-icecoder {color: #888; background: #1d1d1b} .cm-s-icecoder span.cm-keyword {color: #eee; font-weight: bold} /* off-white 1 */ .cm-s-icecoder span.cm-atom {color: #e1c76e} /* yellow */ @@ -13,12 +13,12 @@ .cm-s-icecoder span.cm-property {color: #eee} /* off-white 1 */ .cm-s-icecoder span.cm-operator {color: #9179bb} /* purple */ -.cm-s-icecoder span.cm-comment {color: #97a3aa} /* grey-blue */ +.cm-s-icecoder span.cm-comment {color: #444; font-style: italic} /* grey-blue */ .cm-s-icecoder span.cm-string {color: #b9ca4a} /* green */ .cm-s-icecoder span.cm-string-2 {color: #6cb5d9} /* blue */ -.cm-s-icecoder span.cm-meta {color: #555} /* grey */ +.cm-s-icecoder span.cm-meta {color: #888} /* grey */ .cm-s-icecoder span.cm-qualifier {color: #555} /* grey */ .cm-s-icecoder span.cm-builtin {color: #214e7b} /* bright blue */ diff --git a/assets/js/difflib.js b/assets/js/difflib.js index ee40ba2..b733c99 100644 --- a/assets/js/difflib.js +++ b/assets/js/difflib.js @@ -7,14 +7,14 @@ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Snowtide Informatics Systems nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Snowtide Informatics Systems nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -31,382 +31,382 @@ DAMAGE. var __whitespace = {" ":true, "\t":true, "\n":true, "\f":true, "\r":true}; var difflib = { - defaultJunkFunction: function (c) { - return __whitespace.hasOwnProperty(c); - }, - - stripLinebreaks: function (str) { return str.replace(/^[\n\r]*|[\n\r]*$/g, ""); }, - - stringAsLines: function (str) { - var lfpos = str.indexOf("\n"); - var crpos = str.indexOf("\r"); - var linebreak = ((lfpos > -1 && crpos > -1) || crpos < 0) ? "\n" : "\r"; - - var lines = str.split(linebreak); - for (var i = 0; i < lines.length; i++) { - lines[i] = difflib.stripLinebreaks(lines[i]); - } - - return lines; - }, - - // iteration-based reduce implementation - __reduce: function (func, list, initial) { - if (initial != null) { - var value = initial; - var idx = 0; - } else if (list) { - var value = list[0]; - var idx = 1; - } else { - return null; - } - - for (; idx < list.length; idx++) { - value = func(value, list[idx]); - } - - return value; - }, - - // comparison function for sorting lists of numeric tuples - __ntuplecomp: function (a, b) { - var mlen = Math.max(a.length, b.length); - for (var i = 0; i < mlen; i++) { - if (a[i] < b[i]) return -1; - if (a[i] > b[i]) return 1; - } - - return a.length == b.length ? 0 : (a.length < b.length ? -1 : 1); - }, - - __calculate_ratio: function (matches, length) { - return length ? 2.0 * matches / length : 1.0; - }, - - // returns a function that returns true if a key passed to the returned function - // is in the dict (js object) provided to this function; replaces being able to - // carry around dict.has_key in python... - __isindict: function (dict) { - return function (key) { return dict.hasOwnProperty(key); }; - }, - - // replacement for python's dict.get function -- need easy default values - __dictget: function (dict, key, defaultValue) { - return dict.hasOwnProperty(key) ? dict[key] : defaultValue; - }, - - SequenceMatcher: function (a, b, isjunk) { - this.set_seqs = function (a, b) { - this.set_seq1(a); - this.set_seq2(b); - } - - this.set_seq1 = function (a) { - if (a == this.a) return; - this.a = a; - this.matching_blocks = this.opcodes = null; - } - - this.set_seq2 = function (b) { - if (b == this.b) return; - this.b = b; - this.matching_blocks = this.opcodes = this.fullbcount = null; - this.__chain_b(); - } - - this.__chain_b = function () { - var b = this.b; - var n = b.length; - var b2j = this.b2j = {}; - var populardict = {}; - for (var i = 0; i < b.length; i++) { - var elt = b[i]; - if (b2j.hasOwnProperty(elt)) { - var indices = b2j[elt]; - if (n >= 200 && indices.length * 100 > n) { - populardict[elt] = 1; - delete b2j[elt]; - } else { - indices.push(i); - } - } else { - b2j[elt] = [i]; - } - } - - for (var elt in populardict) { - if (populardict.hasOwnProperty(elt)) { - delete b2j[elt]; - } - } - - var isjunk = this.isjunk; - var junkdict = {}; - if (isjunk) { - for (var elt in populardict) { - if (populardict.hasOwnProperty(elt) && isjunk(elt)) { - junkdict[elt] = 1; - delete populardict[elt]; - } - } - for (var elt in b2j) { - if (b2j.hasOwnProperty(elt) && isjunk(elt)) { - junkdict[elt] = 1; - delete b2j[elt]; - } - } - } - - this.isbjunk = difflib.__isindict(junkdict); - this.isbpopular = difflib.__isindict(populardict); - } - - this.find_longest_match = function (alo, ahi, blo, bhi) { - var a = this.a; - var b = this.b; - var b2j = this.b2j; - var isbjunk = this.isbjunk; - var besti = alo; - var bestj = blo; - var bestsize = 0; - var j = null; - var k; - - var j2len = {}; - var nothing = []; - for (var i = alo; i < ahi; i++) { - var newj2len = {}; - var jdict = difflib.__dictget(b2j, a[i], nothing); - for (var jkey in jdict) { - if (jdict.hasOwnProperty(jkey)) { - j = jdict[jkey]; - if (j < blo) continue; - if (j >= bhi) break; - newj2len[j] = k = difflib.__dictget(j2len, j - 1, 0) + 1; - if (k > bestsize) { - besti = i - k + 1; - bestj = j - k + 1; - bestsize = k; - } - } - } - j2len = newj2len; - } - - while (besti > alo && bestj > blo && !isbjunk(b[bestj - 1]) && a[besti - 1] == b[bestj - 1]) { - besti--; - bestj--; - bestsize++; - } - - while (besti + bestsize < ahi && bestj + bestsize < bhi && - !isbjunk(b[bestj + bestsize]) && - a[besti + bestsize] == b[bestj + bestsize]) { - bestsize++; - } - - while (besti > alo && bestj > blo && isbjunk(b[bestj - 1]) && a[besti - 1] == b[bestj - 1]) { - besti--; - bestj--; - bestsize++; - } - - while (besti + bestsize < ahi && bestj + bestsize < bhi && isbjunk(b[bestj + bestsize]) && - a[besti + bestsize] == b[bestj + bestsize]) { - bestsize++; - } - - return [besti, bestj, bestsize]; - } - - this.get_matching_blocks = function () { - if (this.matching_blocks != null) return this.matching_blocks; - var la = this.a.length; - var lb = this.b.length; - - var queue = [[0, la, 0, lb]]; - var matching_blocks = []; - var alo, ahi, blo, bhi, qi, i, j, k, x; - while (queue.length) { - qi = queue.pop(); - alo = qi[0]; - ahi = qi[1]; - blo = qi[2]; - bhi = qi[3]; - x = this.find_longest_match(alo, ahi, blo, bhi); - i = x[0]; - j = x[1]; - k = x[2]; - - if (k) { - matching_blocks.push(x); - if (alo < i && blo < j) - queue.push([alo, i, blo, j]); - if (i+k < ahi && j+k < bhi) - queue.push([i + k, ahi, j + k, bhi]); - } - } - - matching_blocks.sort(difflib.__ntuplecomp); - - var i1 = 0, j1 = 0, k1 = 0, block = 0; - var i2, j2, k2; - var non_adjacent = []; - for (var idx in matching_blocks) { - if (matching_blocks.hasOwnProperty(idx)) { - block = matching_blocks[idx]; - i2 = block[0]; - j2 = block[1]; - k2 = block[2]; - if (i1 + k1 == i2 && j1 + k1 == j2) { - k1 += k2; - } else { - if (k1) non_adjacent.push([i1, j1, k1]); - i1 = i2; - j1 = j2; - k1 = k2; - } - } - } - - if (k1) non_adjacent.push([i1, j1, k1]); - - non_adjacent.push([la, lb, 0]); - this.matching_blocks = non_adjacent; - return this.matching_blocks; - } - - this.get_opcodes = function () { - if (this.opcodes != null) return this.opcodes; - var i = 0; - var j = 0; - var answer = []; - this.opcodes = answer; - var block, ai, bj, size, tag; - var blocks = this.get_matching_blocks(); - for (var idx in blocks) { - if (blocks.hasOwnProperty(idx)) { - block = blocks[idx]; - ai = block[0]; - bj = block[1]; - size = block[2]; - tag = ''; - if (i < ai && j < bj) { - tag = 'replace'; - } else if (i < ai) { - tag = 'delete'; - } else if (j < bj) { - tag = 'insert'; - } - if (tag) answer.push([tag, i, ai, j, bj]); - i = ai + size; - j = bj + size; - - if (size) answer.push(['equal', ai, i, bj, j]); - } - } - - return answer; - } - - // this is a generator function in the python lib, which of course is not supported in javascript - // the reimplementation builds up the grouped opcodes into a list in their entirety and returns that. - this.get_grouped_opcodes = function (n) { - if (!n) n = 3; - var codes = this.get_opcodes(); - if (!codes) codes = [["equal", 0, 1, 0, 1]]; - var code, tag, i1, i2, j1, j2; - if (codes[0][0] == 'equal') { - code = codes[0]; - tag = code[0]; - i1 = code[1]; - i2 = code[2]; - j1 = code[3]; - j2 = code[4]; - codes[0] = [tag, Math.max(i1, i2 - n), i2, Math.max(j1, j2 - n), j2]; - } - if (codes[codes.length - 1][0] == 'equal') { - code = codes[codes.length - 1]; - tag = code[0]; - i1 = code[1]; - i2 = code[2]; - j1 = code[3]; - j2 = code[4]; - codes[codes.length - 1] = [tag, i1, Math.min(i2, i1 + n), j1, Math.min(j2, j1 + n)]; - } - - var nn = n + n; - var group = []; - var groups = []; - for (var idx in codes) { - if (codes.hasOwnProperty(idx)) { - code = codes[idx]; - tag = code[0]; - i1 = code[1]; - i2 = code[2]; - j1 = code[3]; - j2 = code[4]; - if (tag == 'equal' && i2 - i1 > nn) { - group.push([tag, i1, Math.min(i2, i1 + n), j1, Math.min(j2, j1 + n)]); - groups.push(group); - group = []; - i1 = Math.max(i1, i2-n); - j1 = Math.max(j1, j2-n); - } - - group.push([tag, i1, i2, j1, j2]); - } - } - - if (group && !(group.length == 1 && group[0][0] == 'equal')) groups.push(group) - - return groups; - } - - this.ratio = function () { - matches = difflib.__reduce( - function (sum, triple) { return sum + triple[triple.length - 1]; }, - this.get_matching_blocks(), 0); - return difflib.__calculate_ratio(matches, this.a.length + this.b.length); - } - - this.quick_ratio = function () { - var fullbcount, elt; - if (this.fullbcount == null) { - this.fullbcount = fullbcount = {}; - for (var i = 0; i < this.b.length; i++) { - elt = this.b[i]; - fullbcount[elt] = difflib.__dictget(fullbcount, elt, 0) + 1; - } - } - fullbcount = this.fullbcount; - - var avail = {}; - var availhas = difflib.__isindict(avail); - var matches = numb = 0; - for (var i = 0; i < this.a.length; i++) { - elt = this.a[i]; - if (availhas(elt)) { - numb = avail[elt]; - } else { - numb = difflib.__dictget(fullbcount, elt, 0); - } - avail[elt] = numb - 1; - if (numb > 0) matches++; - } - - return difflib.__calculate_ratio(matches, this.a.length + this.b.length); - } - - this.real_quick_ratio = function () { - var la = this.a.length; - var lb = this.b.length; - return _calculate_ratio(Math.min(la, lb), la + lb); - } - - this.isjunk = isjunk ? isjunk : difflib.defaultJunkFunction; - this.a = this.b = null; - this.set_seqs(a, b); - } + defaultJunkFunction: function (c) { + return __whitespace.hasOwnProperty(c); + }, + + stripLinebreaks: function (str) { return str.replace(/^[\n\r]*|[\n\r]*$/g, ""); }, + + stringAsLines: function (str) { + var lfpos = str.indexOf("\n"); + var crpos = str.indexOf("\r"); + var linebreak = ((lfpos > -1 && crpos > -1) || crpos < 0) ? "\n" : "\r"; + + var lines = str.split(linebreak); + for (var i = 0; i < lines.length; i++) { + lines[i] = difflib.stripLinebreaks(lines[i]); + } + + return lines; + }, + + // iteration-based reduce implementation + __reduce: function (func, list, initial) { + if (initial != null) { + var value = initial; + var idx = 0; + } else if (list) { + var value = list[0]; + var idx = 1; + } else { + return null; + } + + for (; idx < list.length; idx++) { + value = func(value, list[idx]); + } + + return value; + }, + + // comparison function for sorting lists of numeric tuples + __ntuplecomp: function (a, b) { + var mlen = Math.max(a.length, b.length); + for (var i = 0; i < mlen; i++) { + if (a[i] < b[i]) return -1; + if (a[i] > b[i]) return 1; + } + + return a.length == b.length ? 0 : (a.length < b.length ? -1 : 1); + }, + + __calculate_ratio: function (matches, length) { + return length ? 2.0 * matches / length : 1.0; + }, + + // returns a function that returns true if a key passed to the returned function + // is in the dict (js object) provided to this function; replaces being able to + // carry around dict.has_key in python... + __isindict: function (dict) { + return function (key) { return dict.hasOwnProperty(key); }; + }, + + // replacement for python's dict.get function -- need easy default values + __dictget: function (dict, key, defaultValue) { + return dict.hasOwnProperty(key) ? dict[key] : defaultValue; + }, + + SequenceMatcher: function (a, b, isjunk) { + this.set_seqs = function (a, b) { + this.set_seq1(a); + this.set_seq2(b); + } + + this.set_seq1 = function (a) { + if (a == this.a) return; + this.a = a; + this.matching_blocks = this.opcodes = null; + } + + this.set_seq2 = function (b) { + if (b == this.b) return; + this.b = b; + this.matching_blocks = this.opcodes = this.fullbcount = null; + this.__chain_b(); + } + + this.__chain_b = function () { + var b = this.b; + var n = b.length; + var b2j = this.b2j = {}; + var populardict = {}; + for (var i = 0; i < b.length; i++) { + var elt = b[i]; + if (b2j.hasOwnProperty(elt)) { + var indices = b2j[elt]; + if (n >= 200 && indices.length * 100 > n) { + populardict[elt] = 1; + delete b2j[elt]; + } else { + indices.push(i); + } + } else { + b2j[elt] = [i]; + } + } + + for (var elt in populardict) { + if (populardict.hasOwnProperty(elt)) { + delete b2j[elt]; + } + } + + var isjunk = this.isjunk; + var junkdict = {}; + if (isjunk) { + for (var elt in populardict) { + if (populardict.hasOwnProperty(elt) && isjunk(elt)) { + junkdict[elt] = 1; + delete populardict[elt]; + } + } + for (var elt in b2j) { + if (b2j.hasOwnProperty(elt) && isjunk(elt)) { + junkdict[elt] = 1; + delete b2j[elt]; + } + } + } + + this.isbjunk = difflib.__isindict(junkdict); + this.isbpopular = difflib.__isindict(populardict); + } + + this.find_longest_match = function (alo, ahi, blo, bhi) { + var a = this.a; + var b = this.b; + var b2j = this.b2j; + var isbjunk = this.isbjunk; + var besti = alo; + var bestj = blo; + var bestsize = 0; + var j = null; + var k; + + var j2len = {}; + var nothing = []; + for (var i = alo; i < ahi; i++) { + var newj2len = {}; + var jdict = difflib.__dictget(b2j, a[i], nothing); + for (var jkey in jdict) { + if (jdict.hasOwnProperty(jkey)) { + j = jdict[jkey]; + if (j < blo) continue; + if (j >= bhi) break; + newj2len[j] = k = difflib.__dictget(j2len, j - 1, 0) + 1; + if (k > bestsize) { + besti = i - k + 1; + bestj = j - k + 1; + bestsize = k; + } + } + } + j2len = newj2len; + } + + while (besti > alo && bestj > blo && !isbjunk(b[bestj - 1]) && a[besti - 1] == b[bestj - 1]) { + besti--; + bestj--; + bestsize++; + } + + while (besti + bestsize < ahi && bestj + bestsize < bhi && + !isbjunk(b[bestj + bestsize]) && + a[besti + bestsize] == b[bestj + bestsize]) { + bestsize++; + } + + while (besti > alo && bestj > blo && isbjunk(b[bestj - 1]) && a[besti - 1] == b[bestj - 1]) { + besti--; + bestj--; + bestsize++; + } + + while (besti + bestsize < ahi && bestj + bestsize < bhi && isbjunk(b[bestj + bestsize]) && + a[besti + bestsize] == b[bestj + bestsize]) { + bestsize++; + } + + return [besti, bestj, bestsize]; + } + + this.get_matching_blocks = function () { + if (this.matching_blocks != null) return this.matching_blocks; + var la = this.a.length; + var lb = this.b.length; + + var queue = [[0, la, 0, lb]]; + var matching_blocks = []; + var alo, ahi, blo, bhi, qi, i, j, k, x; + while (queue.length) { + qi = queue.pop(); + alo = qi[0]; + ahi = qi[1]; + blo = qi[2]; + bhi = qi[3]; + x = this.find_longest_match(alo, ahi, blo, bhi); + i = x[0]; + j = x[1]; + k = x[2]; + + if (k) { + matching_blocks.push(x); + if (alo < i && blo < j) + queue.push([alo, i, blo, j]); + if (i+k < ahi && j+k < bhi) + queue.push([i + k, ahi, j + k, bhi]); + } + } + + matching_blocks.sort(difflib.__ntuplecomp); + + var i1 = 0, j1 = 0, k1 = 0, block = 0; + var i2, j2, k2; + var non_adjacent = []; + for (var idx in matching_blocks) { + if (matching_blocks.hasOwnProperty(idx)) { + block = matching_blocks[idx]; + i2 = block[0]; + j2 = block[1]; + k2 = block[2]; + if (i1 + k1 == i2 && j1 + k1 == j2) { + k1 += k2; + } else { + if (k1) non_adjacent.push([i1, j1, k1]); + i1 = i2; + j1 = j2; + k1 = k2; + } + } + } + + if (k1) non_adjacent.push([i1, j1, k1]); + + non_adjacent.push([la, lb, 0]); + this.matching_blocks = non_adjacent; + return this.matching_blocks; + } + + this.get_opcodes = function () { + if (this.opcodes != null) return this.opcodes; + var i = 0; + var j = 0; + var answer = []; + this.opcodes = answer; + var block, ai, bj, size, tag; + var blocks = this.get_matching_blocks(); + for (var idx in blocks) { + if (blocks.hasOwnProperty(idx)) { + block = blocks[idx]; + ai = block[0]; + bj = block[1]; + size = block[2]; + tag = ''; + if (i < ai && j < bj) { + tag = 'replace'; + } else if (i < ai) { + tag = 'delete'; + } else if (j < bj) { + tag = 'insert'; + } + if (tag) answer.push([tag, i, ai, j, bj]); + i = ai + size; + j = bj + size; + + if (size) answer.push(['equal', ai, i, bj, j]); + } + } + + return answer; + } + + // this is a generator function in the python lib, which of course is not supported in javascript + // the reimplementation builds up the grouped opcodes into a list in their entirety and returns that. + this.get_grouped_opcodes = function (n) { + if (!n) n = 3; + var codes = this.get_opcodes(); + if (!codes) codes = [["equal", 0, 1, 0, 1]]; + var code, tag, i1, i2, j1, j2; + if (codes[0][0] == 'equal') { + code = codes[0]; + tag = code[0]; + i1 = code[1]; + i2 = code[2]; + j1 = code[3]; + j2 = code[4]; + codes[0] = [tag, Math.max(i1, i2 - n), i2, Math.max(j1, j2 - n), j2]; + } + if (codes[codes.length - 1][0] == 'equal') { + code = codes[codes.length - 1]; + tag = code[0]; + i1 = code[1]; + i2 = code[2]; + j1 = code[3]; + j2 = code[4]; + codes[codes.length - 1] = [tag, i1, Math.min(i2, i1 + n), j1, Math.min(j2, j1 + n)]; + } + + var nn = n + n; + var group = []; + var groups = []; + for (var idx in codes) { + if (codes.hasOwnProperty(idx)) { + code = codes[idx]; + tag = code[0]; + i1 = code[1]; + i2 = code[2]; + j1 = code[3]; + j2 = code[4]; + if (tag == 'equal' && i2 - i1 > nn) { + group.push([tag, i1, Math.min(i2, i1 + n), j1, Math.min(j2, j1 + n)]); + groups.push(group); + group = []; + i1 = Math.max(i1, i2-n); + j1 = Math.max(j1, j2-n); + } + + group.push([tag, i1, i2, j1, j2]); + } + } + + if (group && !(group.length == 1 && group[0][0] == 'equal')) groups.push(group) + + return groups; + } + + this.ratio = function () { + matches = difflib.__reduce( + function (sum, triple) { return sum + triple[triple.length - 1]; }, + this.get_matching_blocks(), 0); + return difflib.__calculate_ratio(matches, this.a.length + this.b.length); + } + + this.quick_ratio = function () { + var fullbcount, elt; + if (this.fullbcount == null) { + this.fullbcount = fullbcount = {}; + for (var i = 0; i < this.b.length; i++) { + elt = this.b[i]; + fullbcount[elt] = difflib.__dictget(fullbcount, elt, 0) + 1; + } + } + fullbcount = this.fullbcount; + + var avail = {}; + var availhas = difflib.__isindict(avail); + var matches = numb = 0; + for (var i = 0; i < this.a.length; i++) { + elt = this.a[i]; + if (availhas(elt)) { + numb = avail[elt]; + } else { + numb = difflib.__dictget(fullbcount, elt, 0); + } + avail[elt] = numb - 1; + if (numb > 0) matches++; + } + + return difflib.__calculate_ratio(matches, this.a.length + this.b.length); + } + + this.real_quick_ratio = function () { + var la = this.a.length; + var lb = this.b.length; + return _calculate_ratio(Math.min(la, lb), la + lb); + } + + this.isjunk = isjunk ? isjunk : difflib.defaultJunkFunction; + this.a = this.b = null; + this.set_seqs(a, b); + } }; \ No newline at end of file diff --git a/assets/js/farbtastic.js b/assets/js/farbtastic.js index 9e1bb0d..93a2158 100644 --- a/assets/js/farbtastic.js +++ b/assets/js/farbtastic.js @@ -6,248 +6,248 @@ */ farbtasticFunc = function (options) { - farbtastic(this, options); - return this; + farbtastic(this, options); + return this; }; -farbtastic = function (container, callback) { - var container = document.getElementById(container); - var callback = document.getElementById(callback); - return container.farbtastic || (container.farbtastic = new _farbtastic(container, callback)); +farbtastic = function (cont, cb) { + var container = document.getElementById(cont); + var callback = document.getElementById(cb); + return container.farbtastic || (container.farbtastic = new _farbtastic(container, callback)); }; _farbtastic = function (container, callback) { - // Store farbtastic object - var fb = this; + // Store farbtastic object + var fb = this; - // Insert markup - container.innerHTML = '

    '; - fb.wheel = document.getElementsByClassName('wheel')[0]; - // Dimensions - fb.radius = 84; - fb.square = 100; - fb.width = 194; + // Insert markup + container.innerHTML = '
    '; + fb.wheel = document.getElementsByClassName('wheel')[0]; + // Dimensions + fb.radius = 84; + fb.square = 100; + fb.width = 194; - /** - * Link to the given element(s) or callback. - */ - fb.linkTo = function (callback) { - // Unbind previous nodes - if (typeof fb.callback == 'object') { - console.log("Doesn't do anything?"); - fb.callback.removeEventListener('keyup', fb.updateValue); - } - - // Reset color - fb.color = null; - - // Bind callback or elements - if (typeof callback == 'function') { - fb.callback = callback; - } - else if (typeof callback == 'object' || typeof callback == 'string') { - fb.callback = callback; - fb.callback.addEventListener('keyup',fb.updateValue); - if (fb.callback.value) { - fb.setColor(fb.callback.value); - } - } - return this; - }; - fb.updateValue = function (event) { - if (this.value && this.value != fb.color) { - fb.setColor(this.value); - } - }; - - /** - * Change color with HTML syntax #123456 - */ - fb.setColor = function (color) { - var unpack = fb.unpack(color); - if (fb.color != color && unpack) { - fb.color = color; - fb.rgb = unpack; - fb.hsl = fb.RGBToHSL(fb.rgb); - fb.updateDisplay(); - } - return this; - }; - - /** - * Change color with HSL triplet [0..1, 0..1, 0..1] - */ - fb.setHSL = function (hsl) { - fb.hsl = hsl; - fb.rgb = fb.HSLToRGB(hsl); - fb.color = fb.pack(fb.rgb); - fb.updateDisplay(); - return this; - }; - - ///////////////////////////////////////////////////// - - /** - * Retrieve the coordinates of the given event relative to the center - * of the widget. - */ - fb.widgetCoords = function (event) { - return { x: (event.pageX - fb.wheel.offsetParent.offsetLeft) - fb.width / 2, y: (event.pageY - fb.wheel.offsetParent.offsetTop) - fb.width / 2 }; - }; - - /** - * Mousedown handler - */ - fb.mousedown = function (event) { - // Capture mouse - if (!document.dragging) { - document.addEventListener('mousemove', fb.mousemove); - document.addEventListener('mouseup', fb.mouseup); - document.dragging = true; - } - - // Check which area is being dragged - var pos = fb.widgetCoords(event); - fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square; - - // Process - fb.mousemove(event); - return false; - }; - - /** - * Mousemove handler - */ - fb.mousemove = function (event) { - // Get coordinates relative to color picker center - var pos = fb.widgetCoords(event); - - // Set new HSL parameters - if (fb.circleDrag) { - var hue = Math.atan2(pos.x, -pos.y) / 6.28; - if (hue < 0) hue += 1; - fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]); - } - else { - var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5)); - var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5)); - fb.setHSL([fb.hsl[0], sat, lum]); - } - return false; - }; - - /** - * Mouseup handler - */ - fb.mouseup = function () { - // Uncapture mouse - document.removeEventListener('mousemove', fb.mousemove); - document.removeEventListener('mouseup', fb.mouseup); - document.dragging = false; - }; - - /** - * Update the markers and styles - */ - fb.updateDisplay = function () { - // Markers - var angle = fb.hsl[0] * 6.28; - document.getElementsByClassName('h-marker')[0].style.left = Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px'; - document.getElementsByClassName('h-marker')[0].style.top = Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'; - - document.getElementsByClassName('sl-marker')[0].style.left = Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px'; - document.getElementsByClassName('sl-marker')[0].style.top = Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'; - - // Saturation/Luminance gradient - document.getElementsByClassName('color')[0].style.backgroundColor = fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])); - - // Linked elements or callback - if (typeof fb.callback == 'object') { - // Set background/foreground color - document.getElementById(fb.callback.id).style.backgroundColor = document.getElementById(fb.callback.id + 'RGB').style.backgroundColor = fb.color; - document.getElementById(fb.callback.id).style.color = document.getElementById(fb.callback.id + 'RGB').style.color = fb.hsl[2] > 0.5 ? '#000' : '#fff'; - document.getElementById('colorRGB').value = document.getElementById(fb.callback.id).style.backgroundColor.replace(/\s/g,''); - - // Change linked value - if (callback.value && callback.value != fb.color) { - callback.value = fb.color; + /** + * Link to the given element(s) or callback. + */ + fb.linkTo = function (callback) { + // Unbind previous nodes + if (typeof fb.callback == 'object') { + console.log("Doesn't do anything?"); + fb.callback.removeEventListener('keyup', fb.updateValue); } - } - else if (typeof fb.callback == 'function') { - fb.callback.call(fb, fb.color); - } - }; - /* Various color utility functions */ - fb.pack = function (rgb) { - var r = Math.round(rgb[0] * 255); - var g = Math.round(rgb[1] * 255); - var b = Math.round(rgb[2] * 255); - return '#' + (r < 16 ? '0' : '') + r.toString(16) + - (g < 16 ? '0' : '') + g.toString(16) + - (b < 16 ? '0' : '') + b.toString(16); - }; + // Reset color + fb.color = null; - fb.unpack = function (color) { - if (color.length == 7) { - return [parseInt('0x' + color.substring(1, 3)) / 255, - parseInt('0x' + color.substring(3, 5)) / 255, - parseInt('0x' + color.substring(5, 7)) / 255]; - } - else if (color.length == 4) { - return [parseInt('0x' + color.substring(1, 2)) / 15, - parseInt('0x' + color.substring(2, 3)) / 15, - parseInt('0x' + color.substring(3, 4)) / 15]; - } - }; + // Bind callback or elements + if (typeof callback == 'function') { + fb.callback = callback; + } + else if (typeof callback == 'object' || typeof callback == 'string') { + fb.callback = callback; + fb.callback.addEventListener('keyup',fb.updateValue); + if (fb.callback.value) { + fb.setColor(fb.callback.value); + } + } + return this; + }; + fb.updateValue = function (event) { + if (this.value && this.value != fb.color) { + fb.setColor(this.value); + } + }; - fb.HSLToRGB = function (hsl) { - var m1, m2, r, g, b; - var h = hsl[0], s = hsl[1], l = hsl[2]; - m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s; - m1 = l * 2 - m2; - return [this.hueToRGB(m1, m2, h+0.33333), - this.hueToRGB(m1, m2, h), - this.hueToRGB(m1, m2, h-0.33333)]; - }; + /** + * Change color with HTML syntax #123456 + */ + fb.setColor = function (color) { + var unpack = fb.unpack(color); + if (fb.color != color && unpack) { + fb.color = color; + fb.rgb = unpack; + fb.hsl = fb.RGBToHSL(fb.rgb); + fb.updateDisplay(); + } + return this; + }; - fb.hueToRGB = function (m1, m2, h) { - h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h); - if (h * 6 < 1) return m1 + (m2 - m1) * h * 6; - if (h * 2 < 1) return m2; - if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6; - return m1; - }; + /** + * Change color with HSL triplet [0..1, 0..1, 0..1] + */ + fb.setHSL = function (hsl) { + fb.hsl = hsl; + fb.rgb = fb.HSLToRGB(hsl); + fb.color = fb.pack(fb.rgb); + fb.updateDisplay(); + return this; + }; - fb.RGBToHSL = function (rgb) { - var min, max, delta, h, s, l; - var r = rgb[0], g = rgb[1], b = rgb[2]; - min = Math.min(r, Math.min(g, b)); - max = Math.max(r, Math.max(g, b)); - delta = max - min; - l = (min + max) / 2; - s = 0; - if (l > 0 && l < 1) { - s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l)); - } - h = 0; - if (delta > 0) { - if (max == r && max != g) h += (g - b) / delta; - if (max == g && max != b) h += (2 + (b - r) / delta); - if (max == b && max != r) h += (4 + (r - g) / delta); - h /= 6; - } - return [h, s, l]; - }; + ///////////////////////////////////////////////////// - // Install mousedown handler (the others are set on the document on-demand) - document.getElementsByClassName('farbtastic')[0].onmousedown = fb.mousedown; + /** + * Retrieve the coordinates of the given event relative to the center + * of the widget. + */ + fb.widgetCoords = function (event) { + return { x: (event.pageX - fb.wheel.offsetParent.offsetLeft) - fb.width / 2, y: (event.pageY - fb.wheel.offsetParent.offsetTop) - fb.width / 2 }; + }; + + /** + * Mousedown handler + */ + fb.mousedown = function (event) { + // Capture mouse + if (!document.dragging) { + document.addEventListener('mousemove', fb.mousemove); + document.addEventListener('mouseup', fb.mouseup); + document.dragging = true; + } + + // Check which area is being dragged + var pos = fb.widgetCoords(event); + fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square; + + // Process + fb.mousemove(event); + return false; + }; + + /** + * Mousemove handler + */ + fb.mousemove = function (event) { + // Get coordinates relative to color picker center + var pos = fb.widgetCoords(event); + + // Set new HSL parameters + if (fb.circleDrag) { + var hue = Math.atan2(pos.x, -pos.y) / 6.28; + if (hue < 0) hue += 1; + fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]); + } + else { + var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5)); + var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5)); + fb.setHSL([fb.hsl[0], sat, lum]); + } + return false; + }; + + /** + * Mouseup handler + */ + fb.mouseup = function () { + // Uncapture mouse + document.removeEventListener('mousemove', fb.mousemove); + document.removeEventListener('mouseup', fb.mouseup); + document.dragging = false; + }; + + /** + * Update the markers and styles + */ + fb.updateDisplay = function () { + // Markers + var angle = fb.hsl[0] * 6.28; + document.getElementsByClassName('h-marker')[0].style.left = Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px'; + document.getElementsByClassName('h-marker')[0].style.top = Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'; + + document.getElementsByClassName('sl-marker')[0].style.left = Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px'; + document.getElementsByClassName('sl-marker')[0].style.top = Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'; + + // Saturation/Luminance gradient + document.getElementsByClassName('color')[0].style.backgroundColor = fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])); + + // Linked elements or callback + if (typeof fb.callback == 'object') { + // Set background/foreground color + document.getElementById(fb.callback.id).style.backgroundColor = document.getElementById(fb.callback.id + 'RGB').style.backgroundColor = fb.color; + document.getElementById(fb.callback.id).style.color = document.getElementById(fb.callback.id + 'RGB').style.color = fb.hsl[2] > 0.5 ? '#000' : '#fff'; + document.getElementById('colorRGB').value = document.getElementById(fb.callback.id).style.backgroundColor.replace(/\s/g,''); + + // Change linked value + if (callback.value && callback.value != fb.color) { + callback.value = fb.color; + } + } + else if (typeof fb.callback == 'function') { + fb.callback.call(fb, fb.color); + } + }; + + /* Various color utility functions */ + fb.pack = function (rgb) { + var r = Math.round(rgb[0] * 255); + var g = Math.round(rgb[1] * 255); + var b = Math.round(rgb[2] * 255); + return '#' + (r < 16 ? '0' : '') + r.toString(16) + + (g < 16 ? '0' : '') + g.toString(16) + + (b < 16 ? '0' : '') + b.toString(16); + }; + + fb.unpack = function (color) { + if (color.length == 7) { + return [parseInt('0x' + color.substring(1, 3)) / 255, + parseInt('0x' + color.substring(3, 5)) / 255, + parseInt('0x' + color.substring(5, 7)) / 255]; + } + else if (color.length == 4) { + return [parseInt('0x' + color.substring(1, 2)) / 15, + parseInt('0x' + color.substring(2, 3)) / 15, + parseInt('0x' + color.substring(3, 4)) / 15]; + } + }; + + fb.HSLToRGB = function (hsl) { + var m1, m2, r, g, b; + var h = hsl[0], s = hsl[1], l = hsl[2]; + m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s; + m1 = l * 2 - m2; + return [this.hueToRGB(m1, m2, h+0.33333), + this.hueToRGB(m1, m2, h), + this.hueToRGB(m1, m2, h-0.33333)]; + }; + + fb.hueToRGB = function (m1, m2, h) { + h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h); + if (h * 6 < 1) return m1 + (m2 - m1) * h * 6; + if (h * 2 < 1) return m2; + if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6; + return m1; + }; + + fb.RGBToHSL = function (rgb) { + var min, max, delta, h, s, l; + var r = rgb[0], g = rgb[1], b = rgb[2]; + min = Math.min(r, Math.min(g, b)); + max = Math.max(r, Math.max(g, b)); + delta = max - min; + l = (min + max) / 2; + s = 0; + if (l > 0 && l < 1) { + s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l)); + } + h = 0; + if (delta > 0) { + if (max == r && max != g) h += (g - b) / delta; + if (max == g && max != b) h += (2 + (b - r) / delta); + if (max == b && max != r) h += (4 + (r - g) / delta); + h /= 6; + } + return [h, s, l]; + }; + + // Install mousedown handler (the others are set on the document on-demand) + document.getElementsByClassName('farbtastic')[0].onmousedown = fb.mousedown; // Init color - fb.setColor('#000000'); + fb.setColor('#000000'); - // Set linked elements/callback - if (callback) { - fb.linkTo(callback); - } + // Set linked elements/callback + if (callback) { + fb.linkTo(callback); + } }; \ No newline at end of file From 9fde76ff8c39167fdcd99eeba6db8b2b9e3486ab Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 18 Apr 2020 09:40:24 +0100 Subject: [PATCH 124/231] Re-intent icecoder.js --- assets/js/icecoder.js | 9204 ++++++++++++++++++++--------------------- 1 file changed, 4602 insertions(+), 4602 deletions(-) diff --git a/assets/js/icecoder.js b/assets/js/icecoder.js index 7f17e03..20acc89 100644 --- a/assets/js/icecoder.js +++ b/assets/js/icecoder.js @@ -1,6 +1,6 @@ // Get any elem by ID var get = function(elem) { - return document.getElementById(elem); + return document.getElementById(elem); }; var iceLoc = window.location.pathname; @@ -12,4825 +12,4825 @@ var ICEcoder = { // INIT // ============== - // Define settings - filesW: 250, // Width of files pane - minFilesW: 14, // Min width of files pane - maxFilesW: 250, // Max width of files pane - selectedTab: 0, // The tab that's currently selected - savedPoints: [], // Ints array to indicate save points for docs - savedContents: [], // Array of last known saved contents - canSwitchTabs: true, // Stops switching of tabs when trying to close - openFiles: [], // Array of open file URLs - openFileMDTs: [], // Array of open file modification datetimes - openFileVersions: [], // Array of open file version counts - cMInstances: [], // List of CodeMirror instance no's - nextcMInstance: 1, // Next available CodeMirror instance no - selectedFiles: [], // Array of selected files - findMode: false, // States if we're in find/replace mode - scrollbarVisible: false, // Indicates if the main pane has a scrollbar - mouseDown: false, // If the mouse is down - mouseDownInCM: false, // If the mouse is down within CodeMirror instance (can be false, 'editor' or 'gutter') - draggingFilesW: false, // If we're dragging the file manager width - draggingTab: false, // If we're dragging a tab - draggingWithKey: false, // The key that's down while dragging, false if no key - tabLeftPos: [], // Array of left positions of tabs inside content area - tabBGcurrent: '#1d1d1b', // BG of current tab - tabBGselected: '#49d', // BG of selected tab - tabBGopen: '#c3c3c3', // BG of open tab - tabBGnormal: 'transparent', // BG of normal tab - tabFGcurrent: '#fff', // FG of selected tab - tabFGselected: '#fff', // FG of selected tab - tabFGopenFile: '#000', // FG of open file - tabFGnormalFile: '#eee', // FG of normal file - tabFGnormalTab: '#888', // FG of normal tab - prevTab: 0, // Previous tab to current - serverQueueItems: [], // Array of URLs to call in order - previewWindow: false, // Target variable for the preview window - previewWindowLoading: false, // Loading state of preview window - pluginIntervalRefs: [], // Array of plugin interval refs - overPopup: false, // Indicates if we're over a popup or not - cmdKey: false, // Tracking apple Command key up/down state - codeZoomedOut: false, // If true, code on non declaration lines is zoomed out - showingTool: false, // Which tool is showing right now (terminal, output, database, git etc) - oppTagReplaceData: [], // Will contain data for automatic opposite tag replacement to sync them - fmReady: false, // Indicates if the file manager is ready for action - bugReportStatus: "off", // Values of: off, error, ok, bugs - bugReportPath: "", // Bug report file path - bugFilesSizesSeen: [], // Array of last seen sizes of bug files - bugFilesSizesActual: [], // Array of actual sizes of bug files - splitPane: false, // Single or split pane editing - splitPaneLeftPerc: 100, // Width of left pane as a percentage - renderLineStyle: [], // Array of styles to apply on renderLine event - renderPaneShiftAmount: 0, // Shift comparison main (negative) vs diff pane (positive) - debounce: "", // Contains debounce timeout object - editorFocusInstance: "", // Name of editor instance that has focus - openSeconds: 0, // Number of seconds ICEcoder has been open for - indexing: false, // Indicates if ICEcoder is currently indexing - ready: false, // Indicates if ICEcoder is ready for action + // Define settings + filesW: 250, // Width of files pane + minFilesW: 14, // Min width of files pane + maxFilesW: 250, // Max width of files pane + selectedTab: 0, // The tab that's currently selected + savedPoints: [], // Ints array to indicate save points for docs + savedContents: [], // Array of last known saved contents + canSwitchTabs: true, // Stops switching of tabs when trying to close + openFiles: [], // Array of open file URLs + openFileMDTs: [], // Array of open file modification datetimes + openFileVersions: [], // Array of open file version counts + cMInstances: [], // List of CodeMirror instance no's + nextcMInstance: 1, // Next available CodeMirror instance no + selectedFiles: [], // Array of selected files + findMode: false, // States if we're in find/replace mode + scrollbarVisible: false, // Indicates if the main pane has a scrollbar + mouseDown: false, // If the mouse is down + mouseDownInCM: false, // If the mouse is down within CodeMirror instance (can be false, 'editor' or 'gutter') + draggingFilesW: false, // If we're dragging the file manager width + draggingTab: false, // If we're dragging a tab + draggingWithKey: false, // The key that's down while dragging, false if no key + tabLeftPos: [], // Array of left positions of tabs inside content area + tabBGcurrent: '#1d1d1b', // BG of current tab + tabBGselected: '#49d', // BG of selected tab + tabBGopen: '#c3c3c3', // BG of open tab + tabBGnormal: 'transparent', // BG of normal tab + tabFGcurrent: '#fff', // FG of selected tab + tabFGselected: '#fff', // FG of selected tab + tabFGopenFile: '#000', // FG of open file + tabFGnormalFile: '#eee', // FG of normal file + tabFGnormalTab: '#888', // FG of normal tab + prevTab: 0, // Previous tab to current + serverQueueItems: [], // Array of URLs to call in order + previewWindow: false, // Target variable for the preview window + previewWindowLoading: false, // Loading state of preview window + pluginIntervalRefs: [], // Array of plugin interval refs + overPopup: false, // Indicates if we're over a popup or not + cmdKey: false, // Tracking apple Command key up/down state + codeZoomedOut: false, // If true, code on non declaration lines is zoomed out + showingTool: false, // Which tool is showing right now (terminal, output, database, git etc) + oppTagReplaceData: [], // Will contain data for automatic opposite tag replacement to sync them + fmReady: false, // Indicates if the file manager is ready for action + bugReportStatus: "off", // Values of: off, error, ok, bugs + bugReportPath: "", // Bug report file path + bugFilesSizesSeen: [], // Array of last seen sizes of bug files + bugFilesSizesActual: [], // Array of actual sizes of bug files + splitPane: false, // Single or split pane editing + splitPaneLeftPerc: 100, // Width of left pane as a percentage + renderLineStyle: [], // Array of styles to apply on renderLine event + renderPaneShiftAmount: 0, // Shift comparison main (negative) vs diff pane (positive) + debounce: "", // Contains debounce timeout object + editorFocusInstance: "", // Name of editor instance that has focus + openSeconds: 0, // Number of seconds ICEcoder has been open for + indexing: false, // Indicates if ICEcoder is currently indexing + ready: false, // Indicates if ICEcoder is ready for action - // Set our aliases - initAliases: function() { - var aliasArray = ["header","files", "fileOptions", "optionsFile", "optionsEdit", "optionsSource", "optionsHelp", "filesFrame", "editor", "tabsBar", "findBar", "terminal", "output", "database", "git", "content", "tools", "footer", "nestValid", "versionsDisplay", "splitPaneControls", "splitPaneNamesMain", "splitPaneNamesDiff", "charDisplay", "byteDisplay"]; + // Set our aliases + initAliases: function() { + var aliasArray = ["header","files", "fileOptions", "optionsFile", "optionsEdit", "optionsSource", "optionsHelp", "filesFrame", "editor", "tabsBar", "findBar", "terminal", "output", "database", "git", "content", "tools", "footer", "nestValid", "versionsDisplay", "splitPaneControls", "splitPaneNamesMain", "splitPaneNamesDiff", "charDisplay", "byteDisplay"]; - // Create our ID aliases - for (var i=0;i
    " + - "\n"; - get("git").innerHTML = gitDiffList + "

    "; - } - }, - - // Update preview window content - updatePreviewWindow: function(thisCM,filepath,filename,fileExt) { - if (this.previewWindow.location.pathname==filepath) { - if (["htm","html","txt"].indexOf(fileExt) > -1) { - this.previewWindow.document.documentElement.innerHTML = thisCM.getValue(); - } else if (["md"].indexOf(fileExt) > -1) { - this.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()); - } - } else if (["css"].indexOf(fileExt) > -1) { - if (this.previewWindow.document.documentElement.innerHTML.indexOf(filename) > -1) { - var css = thisCM.getValue(); - var style = document.createElement('style'); - style.type = 'text/css'; - style.id = "ICEcoder"+filepath.replace(/\//g,"_"); - if (style.styleSheet){ - style.styleSheet.cssText = css; - } else { - style.appendChild(document.createTextNode(css)); - } - if (this.previewWindow.document.getElementById(style.id)) { - this.previewWindow.document.documentElement.removeChild(this.previewWindow.document.getElementById(style.id)); - } - this.previewWindow.document.documentElement.appendChild(style); - } - } - // Do the pesticide plugin if it exists - try {this.doPesticide();} catch(err) {}; - // Do the stats.js plugin if it exists - try {this.doStatsJS('update');} catch(err) {}; - // Do the responsive plugin if it exists - try {this.doResponsive();} catch(err) {}; - }, - - // Clean up our loaded code - contentCleanUp: function() { - var cM, cMdiff, thisCM, content; - - // Replace any temp /textarea value - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - content = thisCM.getValue(); - content = content.replace(//g,'<\/textarea>'); - - // Then set the content in the editor & clear the history - thisCM.setValue(content); - thisCM.clearHistory(); - this.savedPoints[this.selectedTab-1] = thisCM.changeGeneration(); - this.savedContents[this.selectedTab-1] = thisCM.getValue(); - }, - - // Undo last change - undo: function() { - var cM, cMdiff, thisCM; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - thisCM.undo(); - }, - - // Redo change - redo: function() { - var cM, cMdiff, thisCM; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - thisCM.redo(); - }, - - // Indent more/less - indent: function(moreLess) { - var cM, cMdiff, thisCM; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (moreLess=="more") { - this.content.contentWindow.CodeMirror.commands.indentMore(thisCM); - } else { - this.content.contentWindow.CodeMirror.commands.indentLess(thisCM); - } - }, - - // Move current line up/down - moveLines: function(dir) { - var cM, cMdiff, thisCM, lineStart, lineEnd, swapLineNo, swapLine; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - - // Get start & end lines plus the line we'll swap with - lineStart = thisCM.getCursor('start'); - lineEnd = thisCM.getCursor('end'); - if (dir=="up" && lineStart.line>0) {swapLineNo = lineStart.line-1} - if (dir=="down" && lineEnd.line=lineStart.line; i--) { - thisCM.replaceRange(thisCM.getLine(i),{line:i+1,ch:0},{line:i+1,ch:1000000}); - } - } - // Now swap our final line with the swap line to complete the move - thisCM.replaceRange(swapLine,{line: dir=="up" ? lineEnd.line : lineStart.line, ch: 0},{line: dir=="up" ? lineEnd.line : lineStart.line, ch:1000000}); - // Finally set the moved selection - thisCM.setSelection( - {line: lineStart.line+(dir=="up" ? -1 : 1), ch: lineStart.ch}, - {line: lineEnd.line+(dir=="up" ? -1 : 1), ch: lineEnd.ch} - ); - }); - } - }, - - // Highlight specified line - highlightLine: function(line) { - var cM, cMdiff, thisCM; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - thisCM.setSelection({line:line,ch:0}, {line:line,ch:thisCM.lineInfo(line).text.length}); - }, - - // Focus the editor - focus: function(diff) { - var cM, cMdiff, thisCM; - - if (!(/iPhone|iPad|iPod/i.test(navigator.userAgent))) { - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = diff ? cMdiff : cM; - if (thisCM) { - thisCM.focus(); - } - } - }, - - // Go to a specific line number - goToLine: function(lineNo, charNo, noFocus) { - var cM, cMdiff, thisCM; - - lineNo = lineNo ? lineNo-1 : get('goToLineNo').value-1; - charNo = charNo ? charNo : 0; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - - this.scrollingOnLine = thisCM.getCursor().line; - - // Scroll cursor into middle of view - if ("undefined" != typeof this.scrollInt) { - clearInterval(this.scrollInt); - } - - this.scrollInt = setInterval(function(ic) { - ic.scrollingOnLine = ic.scrollingOnLine+((lineNo-ic.scrollingOnLine)/5); - thisCM.scrollTo(0,(thisCM.defaultTextHeight()*ic.scrollingOnLine)-(thisCM.getScrollInfo().clientHeight/10)); - if (Math.round(ic.scrollingOnLine) == lineNo) { - clearInterval(ic.scrollInt); - } - },10,this); - - thisCM.setCursor(lineNo, charNo); - if (!noFocus) { - this.focus(); - // Also do this after a 0ms tickover incase DOM wasn't ready - setTimeout(function(ic){ic.focus();},0,this); - } - return false; - }, - - // Comment/uncomment line or selected range on keypress - lineCommentToggle: function() { - var cM, cMdiff, thisCM, cursorPos, linePos, lineContent, lCLen; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - - cursorPos = thisCM.getCursor().ch; - linePos = thisCM.getCursor().line; - lineContent = thisCM.getLine(linePos); - lCLen = lineContent.length; - - this.lineCommentToggleSub(thisCM, cursorPos, linePos, lineContent, lCLen); - }, - - // Wrap our selected text/cursor with tags - tagWrapper: function(tag) { - var cM, cMdiff, thisCM, tagStart, tagEnd, startLine, endLine; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - tagStart = tag; - tagEnd = tag; - if (tag=='div') { - startLine = thisCM.getCursor('start').line; - endLine = thisCM.getCursor().line; - thisCM.operation(function() { - thisCM.replaceSelection("
    \n"+thisCM.getSelection()+"\n
    ","around"); - for (var i=startLine+1; i<=endLine+1; i++) { - thisCM.indentLine(i); - } - thisCM.indentLine(endLine+2,'prev'); - thisCM.indentLine(endLine+2,'subtract'); - }); - } else { - if ( ['p','a','h1','h2','h3'].indexOf(tag)>-1 && - thisCM.getSelection().substr(0,tag.length+1) == "<"+tagStart && - thisCM.getSelection().substr(-(tag.length+3)) == "") { - // Undo wrapper - thisCM.replaceSelection(thisCM.getSelection().substr(thisCM.getSelection().indexOf(">")+1,thisCM.getSelection().length-thisCM.getSelection().indexOf(">")-1-tag.length-3),"around"); - } else { - if (tag=='a') {tagStart='a href=""';} - // Do wrapper - thisCM.replaceSelection("<"+tagStart+">"+thisCM.getSelection()+"","around"); - if (tag=='a') {thisCM.setCursor({line:thisCM.getCursor('start').line,ch:thisCM.getCursor('start').ch+9})} - } - } - }, - - // Add a line break at end of current or specified line - addLineBreakAtEnd: function(line) { - var cM,cMdiff, thisCM; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (!line) {line = thisCM.getCursor().line}; - thisCM.replaceRange(thisCM.getLine(line)+"
    ",{line:line,ch:0},{line:line,ch:1000000}); - }, - - // Insert a line before and auto-indent - insertLineBefore: function(line) { - var cM, cMdiff, thisCM; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (!line) {line = thisCM.getCursor().line}; - thisCM.operation(function() { - thisCM.replaceRange("\n"+thisCM.getLine(line),{line:line,ch:0},{line:line,ch:1000000}); - thisCM.setCursor({line: thisCM.getCursor().line-1, ch: 0}); - thisCM.execCommand('indentAuto'); - }); - }, - - // Insert a line after and auto-indent - insertLineAfter: function(line) { - var cM, cMdiff, thisCM; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (!line) {line = thisCM.getCursor().line}; - thisCM.operation(function() { - thisCM.replaceRange(thisCM.getLine(line)+"\n",{line:line,ch:0},{line:line,ch:1000000}); - thisCM.execCommand('indentAuto'); - }); - }, - - // Duplicate line - duplicateLines: function(line) { - var cM, cMdiff, thisCM, ch, lineExtra, userSelStart, userSelEnd, lineBreak; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (!line && thisCM.somethingSelected()) { - userSelStart = thisCM.getCursor('start'); - userSelEnd = thisCM.getCursor('end'); - lineExtra = userSelStart.line != userSelEnd.line && userSelEnd.ch == thisCM.getLine(userSelEnd.line).length ? "\n" : ""; - thisCM.replaceSelection(thisCM.getSelection()+lineExtra+thisCM.getSelection(), "end"); - thisCM.setSelection(userSelStart, userSelEnd); - } else { - if (!line) {line = thisCM.getCursor().line}; - ch = thisCM.getCursor().ch; - thisCM.replaceRange(thisCM.getLine(line)+"\n"+thisCM.getLine(line),{line:line,ch:0},{line:line,ch:1000000}); - thisCM.setCursor(line+1,ch); - } - }, - - // Remove line - removeLines: function(line) { - var cM, cMdiff, thisCM, ch; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (!line && thisCM.somethingSelected()) { - thisCM.replaceSelection("","end"); - } else { - if (!line) {line = thisCM.getCursor().line}; - ch = thisCM.getCursor().ch; - thisCM.execCommand('deleteLine'); - thisCM.setCursor(line-1,ch); - } - }, - - // Jump to and highlight the function definition current token - jumpToDefinition: function() { - var cM, cMdiff, thisCM, tokenString, defVars; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - tokenString = thisCM.getTokenAt(thisCM.getCursor()).string; - - if (thisCM.somethingSelected() && this.origCurorPos) { - thisCM.setCursor(this.origCurorPos); - } else { - this.origCurorPos = thisCM.getCursor(); - defVars = [ - "var "+tokenString, - "function "+tokenString, - tokenString+"=function", tokenString+"= function", tokenString+" =function", tokenString+" = function", - tokenString+"=new function", tokenString+"= new function", tokenString+" =new function", tokenString+" = new function", - "window['"+tokenString+"']", "window[\""+tokenString+"\"]", - "this['"+tokenString+"']", "this[\""+tokenString+"\"]", - tokenString+":", tokenString+" :", - "def "+tokenString, - "class "+tokenString]; - for (var i=0; i -1 && handle.text.replace(/\$function/g,"").indexOf("function ") > -1) { - functionClassText = handle.text.substring(handle.text.indexOf("function ") + 9); - } - // Get class declaration lines - if (handle.text.indexOf("class ") > -1 && handle.text.replace(/\$class/g,"").indexOf("class ") > -1) { - functionClassText = handle.text.substring(handle.text.indexOf("class ") + 6); - } - // Get just the name of the function/class - functionClassText = functionClassText.trim().split("{")[0].split("("); - - // Push items into array - if (functionClassText[0] != "") { - this.functionClassList.push({ - line: cM.getLineNumber(handle), - name: functionClassText[0], - params: "("+(functionClassText[1] ? functionClassText[1].replace(/[,]/g,", ") : ""), - verified: false - }); - // After a 0ms tickover, verify the item - setTimeout(function(ic) { - // If we're defining a function/class - if (!handle.styles || (handle.styles && handle.styles.indexOf('def') > -1 && cM.getLineNumber(handle))) { - // Find our item in the array and mark it as verified - for (var i=0; i< ic.functionClassList.length; i++) { - if (ic.functionClassList[i]['line'] == cM.getLineNumber(handle)) { - ic.functionClassList[i]['verified'] = true; - } - }; - } - },0,this); - } - }, - - // Autocomplete - autocomplete: function() { - var cM, cMdiff, thisCM; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - this.content.contentWindow.CodeMirror.commands.autocomplete(thisCM); - }, - - // Paste a URL, locally or absolutely if CTRL/Cmd key down - pasteURL: function(url) { - var cM, cMdiff, thisCM; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if(this.draggingWithKey == "CTRL") { - url = window.location.protocol + "//" + window.location.hostname + url; - } - thisCM.replaceSelection(url,"around"); - }, - - // Search for selected text online - searchForSelected: function() { - var cM, cMdiff, thisCM; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (this.caretLocType) { - if (thisCM.getSelection() != "") { - var searchPrefix = this.caretLocType.toLowerCase()+" "; - if (this.caretLocType=="Content") { - searchPrefix = ""; - } - window.open("http://www.google.com/#output=search&q="+searchPrefix+thisCM.getSelection()); - } else { - this.message(t['No text selected...']); - } - } - }, + } + }, + + // Find diffs between 2 strings + findStringDiffs: function(a, b) { + if ("undefined" == typeof a) {a = ""}; + if ("undefined" == typeof b) {b = ""}; + for (var c = 0, // start from the first character + d = a.length, e = b.length; // and from the last characters of both strings + a[c] && // if not at the end of the string and + a[c] == b[c]; // if both strings are equal at this position + c++); // go forward + for (; d > c & e > c & // stop at the position found by the first loop + a[d - 1] == b[e - 1]; // if both strings are equal at this position + d--) e--; // go backward + return[c, d - c, e - c] // return position and lengths of the two substrings found + }, + + // Highlight git diffs (between what is in browser and in Git commits) + highlightGitDiffs: function() { + // Clear the timeout if we have one already + if ("undefined" != typeof highlightGitDiffTimeout) { + clearTimeout(highlightGitDiffTimeout); + } + // If we have index data & Git data, after a timeout, if we have a matching path in that Git data + if (this.indexData && this.indexData.gitContent) { + highlightGitDiffTimeout = setTimeout(function(ic) { + if (ic.indexData.gitContent[docRoot+ic.openFiles[ic.selectedTab-1]]) { + // Get the CodeMirror instance and clear the gutter for it + cM = ic.getcMInstance(); + cM.clearGutter("CodeMirror-linenumbers"); + // Get the baseText and gitText values from the two sources, and split them into lines + var mainText = cM ? difflib.stringAsLines(cM.getValue()) : ""; + var gitText = difflib.stringAsLines(ic.indexData.gitContent[docRoot+ic.openFiles[ic.selectedTab-1]].lastHashContent ?? ""); + + // Create a SequenceMatcher instance that diffs the two sets of lines + var sm = new difflib.SequenceMatcher(gitText, mainText); + + // Get the opcodes from the SequenceMatcher instance + // Opcodes is a list of 3-tuples describing what changes should be made to the base text in order to yield the new text + var opcodes = sm.get_opcodes(); + + // For each opcode returned by jsdifflib + for (var i=0; i opcodes[i][3]) { + elem.style.borderTop = "solid #b00 1px"; + elem.innerHTML = opcodes[i][3]+1; + cM.setGutterMarker(opcodes[i][3], "CodeMirror-linenumbers", elem); + // Otherwise, line is below last number + } else { + elem.style.borderBottom = "solid #b00 1px"; + elem.innerHTML = opcodes[i][3]; + cM.setGutterMarker(opcodes[i][3]-1, "CodeMirror-linenumbers", elem); + } + } + } + } + } + },this.loadingFile ? 100 : 0, this); + } + }, + + // Update Git diff pane (the diffs between saved content and git commits) + updateGitDiffPane: function() { + var gitDiffList = ""; + for (var i=0; i" + + this.indexData.gitDiff.paths[i] + + "
    " + + "\n"; + get("git").innerHTML = gitDiffList + "

    "; + } + }, + + // Update preview window content + updatePreviewWindow: function(thisCM,filepath,filename,fileExt) { + if (this.previewWindow.location.pathname==filepath) { + if (["htm","html","txt"].indexOf(fileExt) > -1) { + this.previewWindow.document.documentElement.innerHTML = thisCM.getValue(); + } else if (["md"].indexOf(fileExt) > -1) { + this.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()); + } + } else if (["css"].indexOf(fileExt) > -1) { + if (this.previewWindow.document.documentElement.innerHTML.indexOf(filename) > -1) { + var css = thisCM.getValue(); + var style = document.createElement('style'); + style.type = 'text/css'; + style.id = "ICEcoder"+filepath.replace(/\//g,"_"); + if (style.styleSheet){ + style.styleSheet.cssText = css; + } else { + style.appendChild(document.createTextNode(css)); + } + if (this.previewWindow.document.getElementById(style.id)) { + this.previewWindow.document.documentElement.removeChild(this.previewWindow.document.getElementById(style.id)); + } + this.previewWindow.document.documentElement.appendChild(style); + } + } + // Do the pesticide plugin if it exists + try {this.doPesticide();} catch(err) {}; + // Do the stats.js plugin if it exists + try {this.doStatsJS('update');} catch(err) {}; + // Do the responsive plugin if it exists + try {this.doResponsive();} catch(err) {}; + }, + + // Clean up our loaded code + contentCleanUp: function() { + var cM, cMdiff, thisCM, content; + + // Replace any temp /textarea value + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + content = thisCM.getValue(); + content = content.replace(//g,'<\/textarea>'); + + // Then set the content in the editor & clear the history + thisCM.setValue(content); + thisCM.clearHistory(); + this.savedPoints[this.selectedTab-1] = thisCM.changeGeneration(); + this.savedContents[this.selectedTab-1] = thisCM.getValue(); + }, + + // Undo last change + undo: function() { + var cM, cMdiff, thisCM; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM.undo(); + }, + + // Redo change + redo: function() { + var cM, cMdiff, thisCM; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM.redo(); + }, + + // Indent more/less + indent: function(moreLess) { + var cM, cMdiff, thisCM; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if (moreLess=="more") { + this.content.contentWindow.CodeMirror.commands.indentMore(thisCM); + } else { + this.content.contentWindow.CodeMirror.commands.indentLess(thisCM); + } + }, + + // Move current line up/down + moveLines: function(dir) { + var cM, cMdiff, thisCM, lineStart, lineEnd, swapLineNo, swapLine; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + + // Get start & end lines plus the line we'll swap with + lineStart = thisCM.getCursor('start'); + lineEnd = thisCM.getCursor('end'); + if (dir=="up" && lineStart.line>0) {swapLineNo = lineStart.line-1} + if (dir=="down" && lineEnd.line=lineStart.line; i--) { + thisCM.replaceRange(thisCM.getLine(i),{line:i+1,ch:0},{line:i+1,ch:1000000}); + } + } + // Now swap our final line with the swap line to complete the move + thisCM.replaceRange(swapLine,{line: dir=="up" ? lineEnd.line : lineStart.line, ch: 0},{line: dir=="up" ? lineEnd.line : lineStart.line, ch:1000000}); + // Finally set the moved selection + thisCM.setSelection( + {line: lineStart.line+(dir=="up" ? -1 : 1), ch: lineStart.ch}, + {line: lineEnd.line+(dir=="up" ? -1 : 1), ch: lineEnd.ch} + ); + }); + } + }, + + // Highlight specified line + highlightLine: function(line) { + var cM, cMdiff, thisCM; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + thisCM.setSelection({line:line,ch:0}, {line:line,ch:thisCM.lineInfo(line).text.length}); + }, + + // Focus the editor + focus: function(diff) { + var cM, cMdiff, thisCM; + + if (!(/iPhone|iPad|iPod/i.test(navigator.userAgent))) { + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = diff ? cMdiff : cM; + if (thisCM) { + thisCM.focus(); + } + } + }, + + // Go to a specific line number + goToLine: function(lineNo, charNo, noFocus) { + var cM, cMdiff, thisCM; + + lineNo = lineNo ? lineNo-1 : get('goToLineNo').value-1; + charNo = charNo ? charNo : 0; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + + this.scrollingOnLine = thisCM.getCursor().line; + + // Scroll cursor into middle of view + if ("undefined" != typeof this.scrollInt) { + clearInterval(this.scrollInt); + } + + this.scrollInt = setInterval(function(ic) { + ic.scrollingOnLine = ic.scrollingOnLine+((lineNo-ic.scrollingOnLine)/5); + thisCM.scrollTo(0,(thisCM.defaultTextHeight()*ic.scrollingOnLine)-(thisCM.getScrollInfo().clientHeight/10)); + if (Math.round(ic.scrollingOnLine) == lineNo) { + clearInterval(ic.scrollInt); + } + },10,this); + + thisCM.setCursor(lineNo, charNo); + if (!noFocus) { + this.focus(); + // Also do this after a 0ms tickover incase DOM wasn't ready + setTimeout(function(ic){ic.focus();},0,this); + } + return false; + }, + + // Comment/uncomment line or selected range on keypress + lineCommentToggle: function() { + var cM, cMdiff, thisCM, cursorPos, linePos, lineContent, lCLen; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + + cursorPos = thisCM.getCursor().ch; + linePos = thisCM.getCursor().line; + lineContent = thisCM.getLine(linePos); + lCLen = lineContent.length; + + this.lineCommentToggleSub(thisCM, cursorPos, linePos, lineContent, lCLen); + }, + + // Wrap our selected text/cursor with tags + tagWrapper: function(tag) { + var cM, cMdiff, thisCM, tagStart, tagEnd, startLine, endLine; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + tagStart = tag; + tagEnd = tag; + if (tag=='div') { + startLine = thisCM.getCursor('start').line; + endLine = thisCM.getCursor().line; + thisCM.operation(function() { + thisCM.replaceSelection("
    \n"+thisCM.getSelection()+"\n
    ","around"); + for (var i=startLine+1; i<=endLine+1; i++) { + thisCM.indentLine(i); + } + thisCM.indentLine(endLine+2,'prev'); + thisCM.indentLine(endLine+2,'subtract'); + }); + } else { + if ( ['p','a','h1','h2','h3'].indexOf(tag)>-1 && + thisCM.getSelection().substr(0,tag.length+1) == "<"+tagStart && + thisCM.getSelection().substr(-(tag.length+3)) == "") { + // Undo wrapper + thisCM.replaceSelection(thisCM.getSelection().substr(thisCM.getSelection().indexOf(">")+1,thisCM.getSelection().length-thisCM.getSelection().indexOf(">")-1-tag.length-3),"around"); + } else { + if (tag=='a') {tagStart='a href=""';} + // Do wrapper + thisCM.replaceSelection("<"+tagStart+">"+thisCM.getSelection()+"","around"); + if (tag=='a') {thisCM.setCursor({line:thisCM.getCursor('start').line,ch:thisCM.getCursor('start').ch+9})} + } + } + }, + + // Add a line break at end of current or specified line + addLineBreakAtEnd: function(line) { + var cM,cMdiff, thisCM; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if (!line) {line = thisCM.getCursor().line}; + thisCM.replaceRange(thisCM.getLine(line)+"
    ",{line:line,ch:0},{line:line,ch:1000000}); + }, + + // Insert a line before and auto-indent + insertLineBefore: function(line) { + var cM, cMdiff, thisCM; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if (!line) {line = thisCM.getCursor().line}; + thisCM.operation(function() { + thisCM.replaceRange("\n"+thisCM.getLine(line),{line:line,ch:0},{line:line,ch:1000000}); + thisCM.setCursor({line: thisCM.getCursor().line-1, ch: 0}); + thisCM.execCommand('indentAuto'); + }); + }, + + // Insert a line after and auto-indent + insertLineAfter: function(line) { + var cM, cMdiff, thisCM; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if (!line) {line = thisCM.getCursor().line}; + thisCM.operation(function() { + thisCM.replaceRange(thisCM.getLine(line)+"\n",{line:line,ch:0},{line:line,ch:1000000}); + thisCM.execCommand('indentAuto'); + }); + }, + + // Duplicate line + duplicateLines: function(line) { + var cM, cMdiff, thisCM, ch, lineExtra, userSelStart, userSelEnd, lineBreak; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if (!line && thisCM.somethingSelected()) { + userSelStart = thisCM.getCursor('start'); + userSelEnd = thisCM.getCursor('end'); + lineExtra = userSelStart.line != userSelEnd.line && userSelEnd.ch == thisCM.getLine(userSelEnd.line).length ? "\n" : ""; + thisCM.replaceSelection(thisCM.getSelection()+lineExtra+thisCM.getSelection(), "end"); + thisCM.setSelection(userSelStart, userSelEnd); + } else { + if (!line) {line = thisCM.getCursor().line}; + ch = thisCM.getCursor().ch; + thisCM.replaceRange(thisCM.getLine(line)+"\n"+thisCM.getLine(line),{line:line,ch:0},{line:line,ch:1000000}); + thisCM.setCursor(line+1,ch); + } + }, + + // Remove line + removeLines: function(line) { + var cM, cMdiff, thisCM, ch; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if (!line && thisCM.somethingSelected()) { + thisCM.replaceSelection("","end"); + } else { + if (!line) {line = thisCM.getCursor().line}; + ch = thisCM.getCursor().ch; + thisCM.execCommand('deleteLine'); + thisCM.setCursor(line-1,ch); + } + }, + + // Jump to and highlight the function definition current token + jumpToDefinition: function() { + var cM, cMdiff, thisCM, tokenString, defVars; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + tokenString = thisCM.getTokenAt(thisCM.getCursor()).string; + + if (thisCM.somethingSelected() && this.origCurorPos) { + thisCM.setCursor(this.origCurorPos); + } else { + this.origCurorPos = thisCM.getCursor(); + defVars = [ + "var "+tokenString, + "function "+tokenString, + tokenString+"=function", tokenString+"= function", tokenString+" =function", tokenString+" = function", + tokenString+"=new function", tokenString+"= new function", tokenString+" =new function", tokenString+" = new function", + "window['"+tokenString+"']", "window[\""+tokenString+"\"]", + "this['"+tokenString+"']", "this[\""+tokenString+"\"]", + tokenString+":", tokenString+" :", + "def "+tokenString, + "class "+tokenString]; + for (var i=0; i -1 && handle.text.replace(/\$function/g,"").indexOf("function ") > -1) { + functionClassText = handle.text.substring(handle.text.indexOf("function ") + 9); + } + // Get class declaration lines + if (handle.text.indexOf("class ") > -1 && handle.text.replace(/\$class/g,"").indexOf("class ") > -1) { + functionClassText = handle.text.substring(handle.text.indexOf("class ") + 6); + } + // Get just the name of the function/class + functionClassText = functionClassText.trim().split("{")[0].split("("); + + // Push items into array + if (functionClassText[0] != "") { + this.functionClassList.push({ + line: cM.getLineNumber(handle), + name: functionClassText[0], + params: "("+(functionClassText[1] ? functionClassText[1].replace(/[,]/g,", ") : ""), + verified: false + }); + // After a 0ms tickover, verify the item + setTimeout(function(ic) { + // If we're defining a function/class + if (!handle.styles || (handle.styles && handle.styles.indexOf('def') > -1 && cM.getLineNumber(handle))) { + // Find our item in the array and mark it as verified + for (var i=0; i< ic.functionClassList.length; i++) { + if (ic.functionClassList[i]['line'] == cM.getLineNumber(handle)) { + ic.functionClassList[i]['verified'] = true; + } + }; + } + },0,this); + } + }, + + // Autocomplete + autocomplete: function() { + var cM, cMdiff, thisCM; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + this.content.contentWindow.CodeMirror.commands.autocomplete(thisCM); + }, + + // Paste a URL, locally or absolutely if CTRL/Cmd key down + pasteURL: function(url) { + var cM, cMdiff, thisCM; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if(this.draggingWithKey == "CTRL") { + url = window.location.protocol + "//" + window.location.hostname + url; + } + thisCM.replaceSelection(url,"around"); + }, + + // Search for selected text online + searchForSelected: function() { + var cM, cMdiff, thisCM; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if (this.caretLocType) { + if (thisCM.getSelection() != "") { + var searchPrefix = this.caretLocType.toLowerCase()+" "; + if (this.caretLocType=="Content") { + searchPrefix = ""; + } + window.open("http://www.google.com/#output=search&q="+searchPrefix+thisCM.getSelection()); + } else { + this.message(t['No text selected...']); + } + } + }, // ============== // FILES // ============== - // Actions on file manager - fmAction: function(evt,action) { - var selElem, sPN, fileFolder, goElem, - - // Get selected elem, the parent node of that, if it's a file/folder and set elem to go to next - selElem = get('filesFrame').contentWindow.document.getElementById(this.selectedFiles[this.selectedFiles.length-1]+"_perms").parentNode; - sPN = selElem.parentNode; - fileFolder = selElem.onmouseover.toString().indexOf("'folder'") > -1 ? "folder" : "file"; - goElem = false; - - if (action == "up") { - if (sPN.previousSibling && sPN.previousSibling.previousSibling) { - goElem = sPN.previousSibling.previousSibling; // Jump to previous sibling - if (goElem.tagName == "UL") { - goElem = goElem.childNodes[goElem.childNodes.length-1]; // Jump to last item in previous sibling dir - } - } else if (sPN.parentNode.previousSibling) { - goElem = sPN.parentNode.previousSibling; // Jump to parent dir - } - if (goElem) {goElem = goElem.childNodes[0]}; - } - if (action == "down") { - if (sPN.nextSibling && sPN.nextSibling.childNodes[0]) { - goElem = sPN.nextSibling.childNodes[0]; // Jump to first item in dir - } else if (sPN.nextSibling && sPN.nextSibling.nextSibling) { - goElem = sPN.nextSibling.nextSibling; // Jump to next sibling - } else if (sPN.parentNode.nextSibling) { - goElem = sPN.parentNode.nextSibling.nextSibling; // Jump to next parent sibling item - } - if (goElem) {goElem = goElem.childNodes[0]}; - } - if (action == "left") { - if (fileFolder == "folder" && sPN.parentNode.previousSibling) { - this.openCloseDir(selElem,false); // contract dir - } - } - if (action == "right" || action == "enter") { - fileFolder == "folder" - ? this.openCloseDir(selElem,true) // expand dir - : this.openFile(selElem.childNodes[1].id.replace(/\|/g,"/")); // open file - } - if (goElem && goElem.childNodes[1]) { - this.overFileFolder(fileFolder, goElem.childNodes[1].id); // If we have an elem to go to, select it - this.selectFileFolder(evt); - } - }, - - // Open/close dirs on demand - openCloseDir: function(dir,load) { - var node, d; - - dir.onclick = function(event) { - if(!event.ctrlKey && !this.cmdKey) { - ICEcoder.openCloseDir(this,!load); - } - }; - node = dir.parentNode; - if (node.nextSibling) {node = node.nextSibling}; - if (node && node.tagName=="UL") { - d = node.style.display=="none"; - d ? load = true : node.style.display = "none"; - dir.parentNode.className = dir.className = d ? "pft-directory dirOpen" : "pft-directory"; - } - if (load) { - this.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/get-branch.php?location="+dir.childNodes[1].id+"&csrf="+this.csrf; - } else if(node.tagName == "UL") { - node.parentNode.removeChild(node); - } - return false; - }, - - // Note which files or folders we are over on mouseover/mouseout - overFileFolder: function(type, link) { - this.thisFileFolderType=type; - this.thisFileFolderLink=link; - }, - - // Detect and return dir/file/false for this DOM ref (false for not found) - isFileFolder: function(ref) { - var domElem; - - domElem = get('filesFrame').contentWindow.document.getElementById(ref.replace(iceRoot,"").replace(/\/$/, "").replace(/\//g,"|")); - if (domElem) { - return domElem.parentNode.parentNode.className.indexOf("directory") > -1 - ? "folder" - : "file"; - } else { - return false; - } - }, - - // Select file or folder on demand - selectFileFolder: function(evt,ctrlSim,shiftSim) { - var tgtFile, shortURL, selecting, dirList, lastFileClicked, startFile, endFile, thisFileObj; - - // If we've clicked somewhere other than a file/folder - if (this.thisFileFolderLink=="") { - if (!ctrlSim && !evt.ctrlKey && !this.cmdKey) { - this.deselectAllFiles(); - } - } else if (this.thisFileFolderLink) { - // Get file URL, with pipes instead of slashes & target DOM elem - shortURL = this.thisFileFolderLink.replace(/\//g,"|"); - tgtFile = this.filesFrame.contentWindow.document.getElementById(shortURL); - - // If we have the CTRL/Cmd key down - if (ctrlSim || evt.ctrlKey || this.cmdKey) { - // Deselect or select file - if (this.selectedFiles.indexOf(shortURL)>-1) { - this.selectDeselectFile('deselect',tgtFile); - this.selectedFiles.splice(this.selectedFiles.indexOf(shortURL),1); - } else { - this.selectDeselectFile('select',tgtFile); - this.selectedFiles.push(shortURL); - } - // Select from last click to this one - } else if (shiftSim || evt.shiftKey) { - selecting = false; - dirList = tgtFile.parentNode.parentNode.parentNode; - lastFileClicked = this.selectedFiles[this.selectedFiles.length-1]; - - // Prefix numbers with up to 20 leading zeros - // This is so we can have some kind of natural comparison on the regex below - function prefixer(match, p1, offset, string) { - return ('00000000000000000000'+match).substr(-20); - } - - startFile = shortURL.replace(/\d+/g, prefixer) < lastFileClicked.replace(/\d+/g, prefixer) ? shortURL : lastFileClicked; - endFile = shortURL.replace(/\d+/g, prefixer) > lastFileClicked.replace(/\d+/g, prefixer) ? shortURL : lastFileClicked; - - if (this.selectedFiles.length > 0 && startFile.substr(0,startFile.lastIndexOf("|")) == endFile.substr(0,endFile.lastIndexOf("|"))) { - for (var i=0; i<1000000; i+=2) { - if(dirList.childNodes[i].nodeName != "LI") {i++;}; - thisFileObj = dirList.childNodes[i].childNodes[0].childNodes[1]; - if (thisFileObj.id == startFile) { - selecting = true; - } - if (selecting==true && this.selectedFiles.indexOf(thisFileObj.id)==-1) { - this.selectDeselectFile('select',thisFileObj); - this.selectedFiles.push(thisFileObj.id); - } - if (thisFileObj.id == endFile) { - break; - } - } - } else { - this.selectDeselectFile('select',tgtFile); - this.selectedFiles.push(shortURL); - } - // We are single clicking - } else { - this.deselectAllFiles(); - - // Add our URL and highlight the file - this.selectDeselectFile('select',tgtFile); - this.selectedFiles.push(shortURL); - } - } - - // Adjust the file & replace select dropdown values accordingly - document.findAndReplace.target[2].innerHTML = !this.selectedFiles[0] ? t['all files'] : t['selected files']; - document.findAndReplace.target[3].innerHTML = !this.selectedFiles[0] ? t['all filenames'] : t['selected filenames']; - - // Hide the file menu incase it's showing - this.hideFileMenu(); - }, - - // Deselect all files - deselectAllFiles: function() { - var tgtFile; - - for (var i=0;i -1 ? true : false; - - if (this.openFiles[this.selectedTab-1] == file.id.replace(/\|/g,"/")) { - file.style.backgroundColor = action=="select" - ? this.tabBGselected : this.tabBGcurrent; - } else { - file.style.backgroundColor = action=="select" - ? this.tabBGselected : file.style.backgroundColor = isOpen - ? this.tabBGopen : this.tabBGnormal; - } - file.style.color = action=="select" ? this.tabFGselected : this.tabFGnormalFile; - } - }, - - // Box select files - boxSelect: function(evt, mouseAction) { - var fmDragBox, positive; - - fmDragBox = this.filesFrame.contentWindow.document.getElementById('fmDragBox'); - - // On mouse down, set start X & Y and reset first and last items in box area select - if (mouseAction == "down") { - this.fmDragBoxStartX = this.mouseX; - this.fmDragBoxStartY = this.mouseY; - this.fmDragSelectFirst = ""; - this.fmDragSelectLast = ""; - } - - // On mouse drag, state we're dragging, set the box size and position properties and select files - if(this.mouseDown && !this.mouseDownInCM && mouseAction == "drag") { - this.fmDraggedBox = true; - - // Handle X-axis properties - positive = this.mouseX-this.fmDragBoxStartX > 0; - fmDragBox.style.left = (positive ? this.fmDragBoxStartX : this.mouseX) + "px"; - fmDragBox.style.width = Math.abs(this.mouseX-this.fmDragBoxStartX) + "px"; - - // Handle Y-axis properties - positive = this.mouseY-this.fmDragBoxStartY > 0; - fmDragBox.style.top = (positive ? this.fmDragBoxStartY-70 : this.mouseY-70) + "px"; - fmDragBox.style.height = Math.abs(this.mouseY-this.fmDragBoxStartY) + "px"; - - // Select the files - if (this.thisFileFolderLink != "") { - if (this.fmDragSelectFirst == "") { - this.fmDragSelectFirst = this.thisFileFolderLink; - this.overFileFolder(this.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', this.fmDragSelectFirst); - this.selectFileFolder(evt); - } else { - this.fmDragSelectLast = this.thisFileFolderLink; - this.overFileFolder(this.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', this.fmDragSelectLast); - this.selectFileFolder(evt,false,'shiftSim'); - } - } - } - - // On mouse up, set width and height to 0 to hide - if(mouseAction == "up") { - fmDragBox.style.width = 0; - fmDragBox.style.height = 0; - } - }, - - // Create a new file (start & instant save) - newFile: function() { - this.newTab('alsoSave'); - }, - - // Create a new folder - newFolder: function() { - var shortURL, newFolder; - - shortURL = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); - newFolder = this.getInput('Enter new folder name at '+shortURL,''); - if (newFolder) { - newFolder = (shortURL + "/" + newFolder).replace(/\/\//,"/"); - this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=newFolder&csrf="+this.csrf,encodeURIComponent(newFolder.replace(/\//g,"|"))); - this.serverMessage(''+t['Creating Folder']+'
    '+newFolder); - } - }, - - // Provide a path and line ref and we return the seperate pieces - returnFileAndLine: function(fileLink) { - var line = 1; - var re = /^([^ ]*)\s+(on\s+)?(line\s+)?(\d+)/; - var reMatch = re.exec(fileLink); - - if (null !== reMatch) { - line = reMatch[4]; - fileLink = reMatch[1]; - } else if (fileLink.indexOf('://') > 0){ - if (fileLink.lastIndexOf(':') !== fileLink.indexOf('://')) { - line = fileLink.split(':')[2]; - fileLink = fileLink.substr(0,fileLink.lastIndexOf(":")); - } - } else if (fileLink.indexOf(':') > 0){ - line = fileLink.split(':')[1]; - fileLink = fileLink.split(':')[0]; - } - if ((fileLink.indexOf('(') > 0) && (fileLink.indexOf(')') > 0)){ - line = fileLink.split('(')[1].split(')')[0]; - fileLink = fileLink.split('(')[0]; - } - return [fileLink,line]; - }, - - // Open a file - openFile: function(fileLink) { - var flSplit, line, shortURL, canOpenFile; - - if ("undefined" != typeof fileLink) { - flSplit = this.returnFileAndLine(fileLink); - fileLink = flSplit[0]; - line = flSplit[1]; - } - - if (fileLink) { - this.thisFileFolderLink=fileLink; - this.thisFileFolderType="file"; - } - if (this.thisFileFolderLink != "/[NEW]" && this.isOpen(this.thisFileFolderLink)!==false) { - this.switchTab(this.isOpen(this.thisFileFolderLink)+1); - if (line > 1){ - this.goToLine(line); - } - } else if (this.thisFileFolderLink!="" && this.thisFileFolderType=="file") { - - // work out a shortened URL for the file - shortURL = this.thisFileFolderLink.replace(/\|/g,"/"); - // No reason why we can't open a file (so far) - canOpenFile = true; - // Limit to 100 files open at a time - if (this.openFiles.length>=100) { - this.message(t['Sorry you can...']); - canOpenFile = false; - } - - // if we're still OK to open it... - if (canOpenFile) { - this.shortURL = shortURL; - - if (shortURL!="/[NEW]") { - 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); - this.serverMessage(''+t['Opening File']+'
    '+this.shortURL); - } else { - this.createNewTab('new'); - } - this.fMIconVis('fMView',1); - } - } - }, - - // Open selected files - openFilesFromList: function(fileList) { - for (var i=0;i-1 - ? this.getRemoteFile(fileLink) - : this.openFile(fileLink); - } - }, - - // Get remote file contents - getRemoteFile: function(remoteFile) { - var flSplit, line; - - if ("undefined" != typeof remoteFile) { - flSplit = this.returnFileAndLine(remoteFile); - remoteFile = flSplit[0]; - line = flSplit[1]; - } - - this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=getRemoteFile&csrf="+this.csrf+"&lineNumber="+line,encodeURIComponent(remoteFile)); - this.serverMessage(''+t['Getting']+'
    '+remoteFile); - }, - - // Get changes to save (used when simply saving, gets diff changes between current and last known version) - getChangesToSave: function() { - var cM, savedText, newText, sm, opcodes; - - cM = this.getcMInstance(); - - // Get the last known saved version of file from array - savedText = this.savedContents[this.selectedTab-1]; - - // Get the text values and split it into lines - newText = difflib.stringAsLines(cM.getValue()); - savedText = difflib.stringAsLines(savedText); - - // Create a SequenceMatcher instance that diffs the two sets of lines - sm = new difflib.SequenceMatcher(savedText, newText); - - // Get the opcodes from the SequenceMatcher instance - // Opcodes is a list of 3-tuples describing what changes should be made to the base text in order to yield the new text - opcodes = sm.get_opcodes(); - - for (var i=0; i0) { - pathPrefix = this.selectedFiles[0]; - filePath = pathPrefix.lastIndexOf(".") == -1 || pathPrefix.lastIndexOf(".") < pathPrefix.lastIndexOf("|") - ? pathPrefix+filePath - : "|[NEW]"; - } - filePath = filePath.replace("||","|"); - this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=save&fileMDT="+this.openFileMDTs[this.selectedTab-1]+"&fileVersion="+this.openFileVersions[this.selectedTab-1]+"&saveType="+saveType+"&csrf="+this.csrf,encodeURIComponent(filePath),changes); - this.serverMessage(''+t['Saving']+'
    '+this.openFiles[this.selectedTab-1].replace(iceRoot,"")); - }, - - // Prompt a rename dialog - renameFile: function(oldName,newName) { - var shortURL, fileName, i; - - if (!oldName) { - shortURL = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); - oldName = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); - } else { - shortURL = oldName.replace(/\|/g,"/"); - } - if (!newName) { - newName = this.getInput(t['Please enter the...'],shortURL); - } - if (newName) { - i = this.openFiles.indexOf(shortURL.replace(/\|/g,"/")); - if(i>-1) { - // rename array item and the tab - this.openFiles[i] = newName; - closeTabLink = ''; - fileName = this.openFiles[i]; - get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); - get('tab'+(i+1)).title = newName; - } - this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=rename&oldFileName="+encodeURIComponent(oldName.replace(/\|/g,"/"))+"&csrf="+this.csrf,encodeURIComponent(newName)); - this.serverMessage(''+t['Renaming to']+'
    '+newName); - - this.setPreviousFiles(); - } - }, - - // Move a file from old location to new - moveFile: function(oldName,newName) { - var fileName, i; - - if (newName && newName != oldName) { - i = this.openFiles.indexOf(oldName.replace(/\|/g,"/")); - if(i>-1) { - // rename array item and the tab - this.openFiles[i] = newName; - closeTabLink = ''; - fileName = this.openFiles[i]; - get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); - get('tab'+(i+1)).title = newName; - } - if (this.ask("Are you sure you want to move file " + oldName + " to " + newName + " ?")){ - this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=move&oldFileName="+encodeURIComponent(oldName.replace(/\//g,"|"))+"&csrf="+this.csrf,encodeURIComponent(newName.replace(/\//g,"|"))); - this.serverMessage(''+t['Moving to']+'
    '+newName); - } - - this.setPreviousFiles(); - } - }, - - // Delete a file - deleteFiles: function(fileList) { - var tgtFiles, tgtListDisplay; - - tgtFiles = fileList ? fileList : this.selectedFiles; - tgtListDisplay = tgtFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n"); - if (tgtFiles.length>0 && this.ask('Delete:\n\n'+tgtListDisplay+'?')) { - this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=delete&&csrf="+this.csrf,encodeURIComponent(tgtFiles.join(";"))); - this.serverMessage(''+t['Deleting File']+'
    '+tgtListDisplay); - }; - }, - - // Copy files - copyFiles: function(fileList,dontShowPaste,dontHide) { - this.copiedFiles = []; - for (var i=0; i'+t['Pasting File']+'
    '+this.copiedFiles[i].toString().replace(/\|/g,"/").replace(/,/g,"\n")); - } else { - this.message(t['Sorry cannot paste...']); - } - } - } else { - this.message(t['Nothing to paste...']); - } - }, - - // Duplicate (copy & paste) files - duplicateFiles: function(fileList) { - var copiedFiles, location; - - // Take a snapshot of copied files - if (this.copiedFiles) { - copiedFiles = this.copiedFiles; - } - - this.copyFiles(fileList,'dontShowPaste','dontHide'); - location = fileList[0].substr(0,fileList[0].lastIndexOf("|")); - this.pasteFiles(location); - - // Restore copied files back to the snapshot - if ("undefined" != typeof copiedFiles) { - this.copiedFiles = copiedFiles; - } - }, - - // Upload file(s) - select & submit - uploadFilesSelect: function(location) { - get('uploadDir').value = location; - get("fileInput").click(); - }, - uploadFilesSubmit: function(obj) { - if (get('fileInput').value!="") { - this.showHide('show',get('loadingMask')); - get('uploadFilesForm').submit(); - event.preventDefault(); - } - }, - - // Show/hide file manager nav options - showHideFileNav: function(vis,elem) { - var options = ["optionsFile","optionsEdit","optionsSource","optionsHelp"]; - if (vis=="hide") { - fileNavInt = setTimeout(function(ic) { - for (var i=0; i= 0) { - console.log(xhr.responseText); - } - // User wanted object (or both) output of the response? - if (["object","both"].indexOf(this.fileDirResOutput) >= 0) { - console.log(statusObj); - } - - // Also store the statusObj - this.lastFileDirCheckStatusObj = statusObj; - - // If error, show that, otherwise do whatever we're required to do next - if (statusObj.status.error) { - this.message(statusObj.status.errorMsg); - console.log("ICEcoder error info for your request..."); - console.log(statusObj); - this.serverMessage(); - this.serverQueue('del',0); - } else { - eval(statusObj.action.doNext); - } - // Some other response? Display a message about that - } else { - this.message(t['Sorry there was...']); - console.log("ICEcoder error info for your request..."); - console.log(statusObj); - this.serverMessage(); - this.serverQueue('del',0); - } - } - }; - xhr.open("POST",iceLoc+"/lib/file-control-xhr.php?action=checkExists&csrf="+this.csrf,true); - xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - timeStart = new Date().getTime(); - xhr.send('timeStart='+timeStart+'&file='+encodeURIComponent(path)); - }, - - // Show menu on right clicking in file manager - showMenu: function(evt) { - var menuType, menuHeight, winH, fmYPos; - - if ( this.selectedFiles.length == 0 || - this.selectedFiles.indexOf(this.selectedFiles[this.selectedFiles.length-1].replace(/\//g,"|")) == -1) { - this.selectFileFolder(evt); - } - - menuHeight = 124+5; // general options height in px plus 5px space - winH = window.innerHeight; - if ("undefined" != typeof this.thisFileFolderLink && this.thisFileFolderLink!="") { - menuType = this.isPathFolder(this.selectedFiles[0]) ? "folder" : "file"; - get('folderMenuItems').style.display = menuType == "folder" && this.selectedFiles.length == 1 ? "block" : "none"; - if (menuType == "folder" && this.selectedFiles.length == 1) { - menuHeight += 20+20+1+23+1+2; // new file, new folder, hr, upload files(s), hr, padding - if (get('fmMenuPasteOption').style.display == "block") { - menuHeight += 19; - } - } - get('singleFileMenuItems').style.display = this.selectedFiles.length > 1 ? "none" : "block"; - if (this.selectedFiles.length == 1) { - menuHeight += 43; - } - get('fileMenu').style.display = "inline-block"; - setTimeout(function() {get('fileMenu').style.opacity = "1"},4); - get('fileMenu').style.left = (this.mouseX+20) + "px"; - fmYPos = this.mouseY-this.filesFrame.contentWindow.document.body.scrollTop-10; - if (fmYPos+menuHeight > winH) { - fmYPos -= (fmYPos+menuHeight-winH); - } - get('fileMenu').style.top = fmYPos + "px"; - } - return false; - }, - - // Continue to show the file manager - showFileMenu: function() { - get('fileMenu').style.display='inline-block'; - setTimeout(function() {get('fileMenu').style.opacity = "1"},4); - }, - - // Hide the file manager - hideFileMenu: function() { - get('fileMenu').style.display='none'; - get('fileMenu').style.opacity = "0"; - }, - - // Update the file manager tree list on demand - updateFileManagerList: function(action,location,file,perms,oldName,uploaded,fileOrFolder) { - var actionElemType, cssStyle, perms, targetElem, locNest, newText, innerLI, permColors, newUL, newLI, elemType, nameLI, shortURL, newMouseOver; - - // Adding files - if (action=="add" && !get('filesFrame').contentWindow.document.getElementById(location.replace(iceRoot,"").replace(/\/$/, "").replace(/\//g,"|")+"|"+file)) { - // Is this is a file or folder and based on that, set the CSS styling & link - actionElemType = fileOrFolder; - cssStyle = actionElemType=="file" ? "pft-file ext-" + file.substr(file.indexOf(".")+1) : "pft-directory"; - perms = actionElemType=="file" ? this.newFilePerms : this.newDirPerms; - - // Identify our target element & the first child element in it's location - if (!location) {location="/"} - location = location.replace(iceRoot,"/"); - location = location.replace("//","/"); - targetElem = get('filesFrame').contentWindow.document.getElementById(location.replace(/\//g,"|")); - locNest = targetElem.parentNode.parentNode.nextSibling; - newText = document.createTextNode("\n"); - permColors = perms == 777 ? 'background: #800; color: #eee' : 'color: #888'; - innerLI = '        '+file+' '+perms+''; - - // If we don't have a locNest or at least 3 DOM items in there, it's an empty folder - if(!locNest || locNest.childNodes.length<3) { - // We now need to begin a new UL list - newUL = document.createElement("ul"); - locNest = targetElem.parentNode.parentNode; - locNest.parentNode.insertBefore(newUL,locNest.nextSibling); - - // Now we can add the first LI for this file/folder we're adding - newLI = document.createElement("li"); - newLI.className = cssStyle; - newLI.draggable = false; - newLI.ondragstart = function(event) {this.addDefaultDragData(this,event)}; - newLI.ondrag = function(event) {this.draggingWithKeyTest(event);if(this.getcMInstance()){this.editorFocusInstance.indexOf('diff') == -1 ? this.getcMInstance().focus() : this.getcMdiffInstance().focus()}}; - newLI.ondragover = function(event) {this.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; - newLI.ondragend = function() {this.dropFile(this)}; - newLI.innerHTML = innerLI - locNest.nextSibling.appendChild(newLI); - locNest.nextSibling.appendChild(newText); - - // There are items in that location, so add our new item in the right position - } else { - for (var i=0;i0 ? "folder" : "file"; - - // Get the name of the item - nameLI = locNest.childNodes[i].getElementsByTagName('span')[0].innerHTML; - - // If it's of the same type & the name is greater, or we're adding a folder and it's a file or if we're at the end of the list - if ((elemType==actionElemType && nameLI > file) || (actionElemType=="folder" && elemType=="file") || i==locNest.childNodes.length-1) { - newLI = document.createElement("li"); - newLI.className = cssStyle; - newLI.draggable = false; - newLI.ondragstart = function(event) {this.addDefaultDragData(this,event)}; - newLI.ondrag = function(event) {this.draggingWithKeyTest(event);if(this.getcMInstance()){this.editorFocusInstance.indexOf('diff') == -1 ? this.getcMInstance().focus() : this.getcMdiffInstance().focus()}}; - newLI.ondragover = function(event) {this.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; - newLI.ondragend = function() {this.dropFile(this)}; - newLI.innerHTML = innerLI; - // Append or insert depending on which of the above if statements is true - if (i==locNest.childNodes.length-1) { - locNest.appendChild(newLI); - locNest.appendChild(newText); - } else { - locNest.insertBefore(newLI,locNest.childNodes[i]); - locNest.insertBefore(newText,locNest.childNodes[i+1]); - } - break; - } - } - } - } - // If we added a new file, we've saved it under a new filename, so set that - if (actionElemType=="file" && !uploaded) { - this.openFiles[this.selectedTab-1]=location+file; - } - } - - // Renaming files - if (action=="rename") { - // Get short URL of our right clicked file and get target elem based on this - shortURL = oldName.replace(/\//g,"|"); - targetElem = get('filesFrame').contentWindow.document.getElementById(shortURL); - // Set the name to be as per our new file/folder name - targetElem.innerHTML = file; - // Update the ID of the target & set a new title and perms ID - targetElem.id = location.replace(/\//g,"|") + "|" + file; - targetElem.parentNode.title = targetElem.id.replace(/\|/g,"/"); - targetElemPerms = get('filesFrame').contentWindow.document.getElementById(shortURL+"_perms"); - targetElemPerms.id = location.replace(/\//g,"|") + "|" + file + "_perms"; - // Finally, rename also within any children - this.renameInChildren(targetElem, oldName, location, file); - } - - // Moving files - if (action=="move") { - this.updateFileManagerList("add",location,file,false,false,false,fileOrFolder); - this.updateFileManagerList("delete",oldName.substr(0,oldName.lastIndexOf("/")),file); - } - - // Chmod on files - if (action=="chmod") { - // Get short URL for our file and get our target elem based on this - shortURL = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); - targetElem = get('filesFrame').contentWindow.document.getElementById(shortURL.replace(/\//g,"|")+"_perms"); - // Set the color for the perms - targetElem.style.background = perms == 777 ? '#800' : 'none'; - targetElem.style.color = perms == 777 ? '#eee' : '#888'; - // Set the new perms - targetElem.innerHTML = perms; - } - - // Deleting files - if (action=="delete") { - if (!location) {location=""} - location = location.replace(iceRoot,"/"); - location = location.replace("//","/"); - location = location.replace(/\/$/, "").replace(/\//g,"|"); - targetElem = (location +"|"+file).replace("||","|"); - targetElem = get('filesFrame').contentWindow.document.getElementById(targetElem).parentNode.parentNode; - this.openCloseDir(targetElem.childNodes[0],false); - targetElem.parentNode.removeChild(targetElem); - } - }, - - // Rename node attributes within any renamed dirs recursively - renameInChildren: function(elem, oldName, location, file) { - var innerItems, targetElem, targetElemPerms; - - // If our elem has a sibling and it's a UL, we renamed a dir - if(elem.parentNode.parentNode.nextSibling && elem.parentNode.parentNode.nextSibling.nodeName == "UL") { - innerItems = elem.parentNode.parentNode.nextSibling; - - // For each one of the children in the UL, if it's a LI (may be a file or dir) - for (var i=0; i -1 ? "folder" : "file"; + goElem = false; + + if (action == "up") { + if (sPN.previousSibling && sPN.previousSibling.previousSibling) { + goElem = sPN.previousSibling.previousSibling; // Jump to previous sibling + if (goElem.tagName == "UL") { + goElem = goElem.childNodes[goElem.childNodes.length-1]; // Jump to last item in previous sibling dir + } + } else if (sPN.parentNode.previousSibling) { + goElem = sPN.parentNode.previousSibling; // Jump to parent dir + } + if (goElem) {goElem = goElem.childNodes[0]}; + } + if (action == "down") { + if (sPN.nextSibling && sPN.nextSibling.childNodes[0]) { + goElem = sPN.nextSibling.childNodes[0]; // Jump to first item in dir + } else if (sPN.nextSibling && sPN.nextSibling.nextSibling) { + goElem = sPN.nextSibling.nextSibling; // Jump to next sibling + } else if (sPN.parentNode.nextSibling) { + goElem = sPN.parentNode.nextSibling.nextSibling; // Jump to next parent sibling item + } + if (goElem) {goElem = goElem.childNodes[0]}; + } + if (action == "left") { + if (fileFolder == "folder" && sPN.parentNode.previousSibling) { + this.openCloseDir(selElem,false); // contract dir + } + } + if (action == "right" || action == "enter") { + fileFolder == "folder" + ? this.openCloseDir(selElem,true) // expand dir + : this.openFile(selElem.childNodes[1].id.replace(/\|/g,"/")); // open file + } + if (goElem && goElem.childNodes[1]) { + this.overFileFolder(fileFolder, goElem.childNodes[1].id); // If we have an elem to go to, select it + this.selectFileFolder(evt); + } + }, + + // Open/close dirs on demand + openCloseDir: function(dir,load) { + var node, d; + + dir.onclick = function(event) { + if(!event.ctrlKey && !this.cmdKey) { + ICEcoder.openCloseDir(this,!load); + } + }; + node = dir.parentNode; + if (node.nextSibling) {node = node.nextSibling}; + if (node && node.tagName=="UL") { + d = node.style.display=="none"; + d ? load = true : node.style.display = "none"; + dir.parentNode.className = dir.className = d ? "pft-directory dirOpen" : "pft-directory"; + } + if (load) { + this.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/get-branch.php?location="+dir.childNodes[1].id+"&csrf="+this.csrf; + } else if(node.tagName == "UL") { + node.parentNode.removeChild(node); + } + return false; + }, + + // Note which files or folders we are over on mouseover/mouseout + overFileFolder: function(type, link) { + this.thisFileFolderType=type; + this.thisFileFolderLink=link; + }, + + // Detect and return dir/file/false for this DOM ref (false for not found) + isFileFolder: function(ref) { + var domElem; + + domElem = get('filesFrame').contentWindow.document.getElementById(ref.replace(iceRoot,"").replace(/\/$/, "").replace(/\//g,"|")); + if (domElem) { + return domElem.parentNode.parentNode.className.indexOf("directory") > -1 + ? "folder" + : "file"; + } else { + return false; + } + }, + + // Select file or folder on demand + selectFileFolder: function(evt,ctrlSim,shiftSim) { + var tgtFile, shortURL, selecting, dirList, lastFileClicked, startFile, endFile, thisFileObj; + + // If we've clicked somewhere other than a file/folder + if (this.thisFileFolderLink=="") { + if (!ctrlSim && !evt.ctrlKey && !this.cmdKey) { + this.deselectAllFiles(); + } + } else if (this.thisFileFolderLink) { + // Get file URL, with pipes instead of slashes & target DOM elem + shortURL = this.thisFileFolderLink.replace(/\//g,"|"); + tgtFile = this.filesFrame.contentWindow.document.getElementById(shortURL); + + // If we have the CTRL/Cmd key down + if (ctrlSim || evt.ctrlKey || this.cmdKey) { + // Deselect or select file + if (this.selectedFiles.indexOf(shortURL)>-1) { + this.selectDeselectFile('deselect',tgtFile); + this.selectedFiles.splice(this.selectedFiles.indexOf(shortURL),1); + } else { + this.selectDeselectFile('select',tgtFile); + this.selectedFiles.push(shortURL); + } + // Select from last click to this one + } else if (shiftSim || evt.shiftKey) { + selecting = false; + dirList = tgtFile.parentNode.parentNode.parentNode; + lastFileClicked = this.selectedFiles[this.selectedFiles.length-1]; + + // Prefix numbers with up to 20 leading zeros + // This is so we can have some kind of natural comparison on the regex below + function prefixer(match, p1, offset, string) { + return ('00000000000000000000'+match).substr(-20); + } + + startFile = shortURL.replace(/\d+/g, prefixer) < lastFileClicked.replace(/\d+/g, prefixer) ? shortURL : lastFileClicked; + endFile = shortURL.replace(/\d+/g, prefixer) > lastFileClicked.replace(/\d+/g, prefixer) ? shortURL : lastFileClicked; + + if (this.selectedFiles.length > 0 && startFile.substr(0,startFile.lastIndexOf("|")) == endFile.substr(0,endFile.lastIndexOf("|"))) { + for (var i=0; i<1000000; i+=2) { + if(dirList.childNodes[i].nodeName != "LI") {i++;}; + thisFileObj = dirList.childNodes[i].childNodes[0].childNodes[1]; + if (thisFileObj.id == startFile) { + selecting = true; + } + if (selecting==true && this.selectedFiles.indexOf(thisFileObj.id)==-1) { + this.selectDeselectFile('select',thisFileObj); + this.selectedFiles.push(thisFileObj.id); + } + if (thisFileObj.id == endFile) { + break; + } + } + } else { + this.selectDeselectFile('select',tgtFile); + this.selectedFiles.push(shortURL); + } + // We are single clicking + } else { + this.deselectAllFiles(); + + // Add our URL and highlight the file + this.selectDeselectFile('select',tgtFile); + this.selectedFiles.push(shortURL); + } + } + + // Adjust the file & replace select dropdown values accordingly + document.findAndReplace.target[2].innerHTML = !this.selectedFiles[0] ? t['all files'] : t['selected files']; + document.findAndReplace.target[3].innerHTML = !this.selectedFiles[0] ? t['all filenames'] : t['selected filenames']; + + // Hide the file menu incase it's showing + this.hideFileMenu(); + }, + + // Deselect all files + deselectAllFiles: function() { + var tgtFile; + + for (var i=0;i -1 ? true : false; + + if (this.openFiles[this.selectedTab-1] == file.id.replace(/\|/g,"/")) { + file.style.backgroundColor = action=="select" + ? this.tabBGselected : this.tabBGcurrent; + } else { + file.style.backgroundColor = action=="select" + ? this.tabBGselected : file.style.backgroundColor = isOpen + ? this.tabBGopen : this.tabBGnormal; + } + file.style.color = action=="select" ? this.tabFGselected : this.tabFGnormalFile; + } + }, + + // Box select files + boxSelect: function(evt, mouseAction) { + var fmDragBox, positive; + + fmDragBox = this.filesFrame.contentWindow.document.getElementById('fmDragBox'); + + // On mouse down, set start X & Y and reset first and last items in box area select + if (mouseAction == "down") { + this.fmDragBoxStartX = this.mouseX; + this.fmDragBoxStartY = this.mouseY; + this.fmDragSelectFirst = ""; + this.fmDragSelectLast = ""; + } + + // On mouse drag, state we're dragging, set the box size and position properties and select files + if(this.mouseDown && !this.mouseDownInCM && mouseAction == "drag") { + this.fmDraggedBox = true; + + // Handle X-axis properties + positive = this.mouseX-this.fmDragBoxStartX > 0; + fmDragBox.style.left = (positive ? this.fmDragBoxStartX : this.mouseX) + "px"; + fmDragBox.style.width = Math.abs(this.mouseX-this.fmDragBoxStartX) + "px"; + + // Handle Y-axis properties + positive = this.mouseY-this.fmDragBoxStartY > 0; + fmDragBox.style.top = (positive ? this.fmDragBoxStartY-70 : this.mouseY-70) + "px"; + fmDragBox.style.height = Math.abs(this.mouseY-this.fmDragBoxStartY) + "px"; + + // Select the files + if (this.thisFileFolderLink != "") { + if (this.fmDragSelectFirst == "") { + this.fmDragSelectFirst = this.thisFileFolderLink; + this.overFileFolder(this.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', this.fmDragSelectFirst); + this.selectFileFolder(evt); + } else { + this.fmDragSelectLast = this.thisFileFolderLink; + this.overFileFolder(this.thisFileFolderLink.indexOf('.') > 0 ? 'file' : 'folder', this.fmDragSelectLast); + this.selectFileFolder(evt,false,'shiftSim'); + } + } + } + + // On mouse up, set width and height to 0 to hide + if(mouseAction == "up") { + fmDragBox.style.width = 0; + fmDragBox.style.height = 0; + } + }, + + // Create a new file (start & instant save) + newFile: function() { + this.newTab('alsoSave'); + }, + + // Create a new folder + newFolder: function() { + var shortURL, newFolder; + + shortURL = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); + newFolder = this.getInput('Enter new folder name at '+shortURL,''); + if (newFolder) { + newFolder = (shortURL + "/" + newFolder).replace(/\/\//,"/"); + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=newFolder&csrf="+this.csrf,encodeURIComponent(newFolder.replace(/\//g,"|"))); + this.serverMessage(''+t['Creating Folder']+'
    '+newFolder); + } + }, + + // Provide a path and line ref and we return the seperate pieces + returnFileAndLine: function(fileLink) { + var line = 1; + var re = /^([^ ]*)\s+(on\s+)?(line\s+)?(\d+)/; + var reMatch = re.exec(fileLink); + + if (null !== reMatch) { + line = reMatch[4]; + fileLink = reMatch[1]; + } else if (fileLink.indexOf('://') > 0){ + if (fileLink.lastIndexOf(':') !== fileLink.indexOf('://')) { + line = fileLink.split(':')[2]; + fileLink = fileLink.substr(0,fileLink.lastIndexOf(":")); + } + } else if (fileLink.indexOf(':') > 0){ + line = fileLink.split(':')[1]; + fileLink = fileLink.split(':')[0]; + } + if ((fileLink.indexOf('(') > 0) && (fileLink.indexOf(')') > 0)){ + line = fileLink.split('(')[1].split(')')[0]; + fileLink = fileLink.split('(')[0]; + } + return [fileLink,line]; + }, + + // Open a file + openFile: function(fileLink) { + var flSplit, line, shortURL, canOpenFile; + + if ("undefined" != typeof fileLink) { + flSplit = this.returnFileAndLine(fileLink); + fileLink = flSplit[0]; + line = flSplit[1]; + } + + if (fileLink) { + this.thisFileFolderLink=fileLink; + this.thisFileFolderType="file"; + } + if (this.thisFileFolderLink != "/[NEW]" && this.isOpen(this.thisFileFolderLink)!==false) { + this.switchTab(this.isOpen(this.thisFileFolderLink)+1); + if (line > 1){ + this.goToLine(line); + } + } else if (this.thisFileFolderLink!="" && this.thisFileFolderType=="file") { + + // work out a shortened URL for the file + shortURL = this.thisFileFolderLink.replace(/\|/g,"/"); + // No reason why we can't open a file (so far) + canOpenFile = true; + // Limit to 100 files open at a time + if (this.openFiles.length>=100) { + this.message(t['Sorry you can...']); + canOpenFile = false; + } + + // if we're still OK to open it... + if (canOpenFile) { + this.shortURL = shortURL; + + if (shortURL!="/[NEW]") { + 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); + this.serverMessage(''+t['Opening File']+'
    '+this.shortURL); + } else { + this.createNewTab('new'); + } + this.fMIconVis('fMView',1); + } + } + }, + + // Open selected files + openFilesFromList: function(fileList) { + for (var i=0;i-1 + ? this.getRemoteFile(fileLink) + : this.openFile(fileLink); + } + }, + + // Get remote file contents + getRemoteFile: function(remoteFile) { + var flSplit, line; + + if ("undefined" != typeof remoteFile) { + flSplit = this.returnFileAndLine(remoteFile); + remoteFile = flSplit[0]; + line = flSplit[1]; + } + + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=getRemoteFile&csrf="+this.csrf+"&lineNumber="+line,encodeURIComponent(remoteFile)); + this.serverMessage(''+t['Getting']+'
    '+remoteFile); + }, + + // Get changes to save (used when simply saving, gets diff changes between current and last known version) + getChangesToSave: function() { + var cM, savedText, newText, sm, opcodes; + + cM = this.getcMInstance(); + + // Get the last known saved version of file from array + savedText = this.savedContents[this.selectedTab-1]; + + // Get the text values and split it into lines + newText = difflib.stringAsLines(cM.getValue()); + savedText = difflib.stringAsLines(savedText); + + // Create a SequenceMatcher instance that diffs the two sets of lines + sm = new difflib.SequenceMatcher(savedText, newText); + + // Get the opcodes from the SequenceMatcher instance + // Opcodes is a list of 3-tuples describing what changes should be made to the base text in order to yield the new text + opcodes = sm.get_opcodes(); + + for (var i=0; i0) { + pathPrefix = this.selectedFiles[0]; + filePath = pathPrefix.lastIndexOf(".") == -1 || pathPrefix.lastIndexOf(".") < pathPrefix.lastIndexOf("|") + ? pathPrefix+filePath + : "|[NEW]"; + } + filePath = filePath.replace("||","|"); + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=save&fileMDT="+this.openFileMDTs[this.selectedTab-1]+"&fileVersion="+this.openFileVersions[this.selectedTab-1]+"&saveType="+saveType+"&csrf="+this.csrf,encodeURIComponent(filePath),changes); + this.serverMessage(''+t['Saving']+'
    '+this.openFiles[this.selectedTab-1].replace(iceRoot,"")); + }, + + // Prompt a rename dialog + renameFile: function(oldName,newName) { + var shortURL, fileName, i; + + if (!oldName) { + shortURL = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); + oldName = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); + } else { + shortURL = oldName.replace(/\|/g,"/"); + } + if (!newName) { + newName = this.getInput(t['Please enter the...'],shortURL); + } + if (newName) { + i = this.openFiles.indexOf(shortURL.replace(/\|/g,"/")); + if(i>-1) { + // rename array item and the tab + this.openFiles[i] = newName; + closeTabLink = ''; + fileName = this.openFiles[i]; + get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); + get('tab'+(i+1)).title = newName; + } + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=rename&oldFileName="+encodeURIComponent(oldName.replace(/\|/g,"/"))+"&csrf="+this.csrf,encodeURIComponent(newName)); + this.serverMessage(''+t['Renaming to']+'
    '+newName); + + this.setPreviousFiles(); + } + }, + + // Move a file from old location to new + moveFile: function(oldName,newName) { + var fileName, i; + + if (newName && newName != oldName) { + i = this.openFiles.indexOf(oldName.replace(/\|/g,"/")); + if(i>-1) { + // rename array item and the tab + this.openFiles[i] = newName; + closeTabLink = ''; + fileName = this.openFiles[i]; + get('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); + get('tab'+(i+1)).title = newName; + } + if (this.ask("Are you sure you want to move file " + oldName + " to " + newName + " ?")){ + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=move&oldFileName="+encodeURIComponent(oldName.replace(/\//g,"|"))+"&csrf="+this.csrf,encodeURIComponent(newName.replace(/\//g,"|"))); + this.serverMessage(''+t['Moving to']+'
    '+newName); + } + + this.setPreviousFiles(); + } + }, + + // Delete a file + deleteFiles: function(fileList) { + var tgtFiles, tgtListDisplay; + + tgtFiles = fileList ? fileList : this.selectedFiles; + tgtListDisplay = tgtFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n"); + if (tgtFiles.length>0 && this.ask('Delete:\n\n'+tgtListDisplay+'?')) { + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=delete&&csrf="+this.csrf,encodeURIComponent(tgtFiles.join(";"))); + this.serverMessage(''+t['Deleting File']+'
    '+tgtListDisplay); + }; + }, + + // Copy files + copyFiles: function(fileList,dontShowPaste,dontHide) { + this.copiedFiles = []; + for (var i=0; i'+t['Pasting File']+'
    '+this.copiedFiles[i].toString().replace(/\|/g,"/").replace(/,/g,"\n")); + } else { + this.message(t['Sorry cannot paste...']); + } + } + } else { + this.message(t['Nothing to paste...']); + } + }, + + // Duplicate (copy & paste) files + duplicateFiles: function(fileList) { + var copiedFiles, location; + + // Take a snapshot of copied files + if (this.copiedFiles) { + copiedFiles = this.copiedFiles; + } + + this.copyFiles(fileList,'dontShowPaste','dontHide'); + location = fileList[0].substr(0,fileList[0].lastIndexOf("|")); + this.pasteFiles(location); + + // Restore copied files back to the snapshot + if ("undefined" != typeof copiedFiles) { + this.copiedFiles = copiedFiles; + } + }, + + // Upload file(s) - select & submit + uploadFilesSelect: function(location) { + get('uploadDir').value = location; + get("fileInput").click(); + }, + uploadFilesSubmit: function(obj) { + if (get('fileInput').value!="") { + this.showHide('show',get('loadingMask')); + get('uploadFilesForm').submit(); + event.preventDefault(); + } + }, + + // Show/hide file manager nav options + showHideFileNav: function(vis,elem) { + var options = ["optionsFile","optionsEdit","optionsSource","optionsHelp"]; + if (vis=="hide") { + fileNavInt = setTimeout(function(ic) { + for (var i=0; i= 0) { + console.log(xhr.responseText); + } + // User wanted object (or both) output of the response? + if (["object","both"].indexOf(this.fileDirResOutput) >= 0) { + console.log(statusObj); + } + + // Also store the statusObj + this.lastFileDirCheckStatusObj = statusObj; + + // If error, show that, otherwise do whatever we're required to do next + if (statusObj.status.error) { + this.message(statusObj.status.errorMsg); + console.log("ICEcoder error info for your request..."); + console.log(statusObj); + this.serverMessage(); + this.serverQueue('del',0); + } else { + eval(statusObj.action.doNext); + } + // Some other response? Display a message about that + } else { + this.message(t['Sorry there was...']); + console.log("ICEcoder error info for your request..."); + console.log(statusObj); + this.serverMessage(); + this.serverQueue('del',0); + } + } + }; + xhr.open("POST",iceLoc+"/lib/file-control-xhr.php?action=checkExists&csrf="+this.csrf,true); + xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + timeStart = new Date().getTime(); + xhr.send('timeStart='+timeStart+'&file='+encodeURIComponent(path)); + }, + + // Show menu on right clicking in file manager + showMenu: function(evt) { + var menuType, menuHeight, winH, fmYPos; + + if ( this.selectedFiles.length == 0 || + this.selectedFiles.indexOf(this.selectedFiles[this.selectedFiles.length-1].replace(/\//g,"|")) == -1) { + this.selectFileFolder(evt); + } + + menuHeight = 124+5; // general options height in px plus 5px space + winH = window.innerHeight; + if ("undefined" != typeof this.thisFileFolderLink && this.thisFileFolderLink!="") { + menuType = this.isPathFolder(this.selectedFiles[0]) ? "folder" : "file"; + get('folderMenuItems').style.display = menuType == "folder" && this.selectedFiles.length == 1 ? "block" : "none"; + if (menuType == "folder" && this.selectedFiles.length == 1) { + menuHeight += 20+20+1+23+1+2; // new file, new folder, hr, upload files(s), hr, padding + if (get('fmMenuPasteOption').style.display == "block") { + menuHeight += 19; + } + } + get('singleFileMenuItems').style.display = this.selectedFiles.length > 1 ? "none" : "block"; + if (this.selectedFiles.length == 1) { + menuHeight += 43; + } + get('fileMenu').style.display = "inline-block"; + setTimeout(function() {get('fileMenu').style.opacity = "1"},4); + get('fileMenu').style.left = (this.mouseX+20) + "px"; + fmYPos = this.mouseY-this.filesFrame.contentWindow.document.body.scrollTop-10; + if (fmYPos+menuHeight > winH) { + fmYPos -= (fmYPos+menuHeight-winH); + } + get('fileMenu').style.top = fmYPos + "px"; + } + return false; + }, + + // Continue to show the file manager + showFileMenu: function() { + get('fileMenu').style.display='inline-block'; + setTimeout(function() {get('fileMenu').style.opacity = "1"},4); + }, + + // Hide the file manager + hideFileMenu: function() { + get('fileMenu').style.display='none'; + get('fileMenu').style.opacity = "0"; + }, + + // Update the file manager tree list on demand + updateFileManagerList: function(action,location,file,perms,oldName,uploaded,fileOrFolder) { + var actionElemType, cssStyle, perms, targetElem, locNest, newText, innerLI, permColors, newUL, newLI, elemType, nameLI, shortURL, newMouseOver; + + // Adding files + if (action=="add" && !get('filesFrame').contentWindow.document.getElementById(location.replace(iceRoot,"").replace(/\/$/, "").replace(/\//g,"|")+"|"+file)) { + // Is this is a file or folder and based on that, set the CSS styling & link + actionElemType = fileOrFolder; + cssStyle = actionElemType=="file" ? "pft-file ext-" + file.substr(file.indexOf(".")+1) : "pft-directory"; + perms = actionElemType=="file" ? this.newFilePerms : this.newDirPerms; + + // Identify our target element & the first child element in it's location + if (!location) {location="/"} + location = location.replace(iceRoot,"/"); + location = location.replace("//","/"); + targetElem = get('filesFrame').contentWindow.document.getElementById(location.replace(/\//g,"|")); + locNest = targetElem.parentNode.parentNode.nextSibling; + newText = document.createTextNode("\n"); + permColors = perms == 777 ? 'background: #800; color: #eee' : 'color: #888'; + innerLI = '        '+file+' '+perms+''; + + // If we don't have a locNest or at least 3 DOM items in there, it's an empty folder + if(!locNest || locNest.childNodes.length<3) { + // We now need to begin a new UL list + newUL = document.createElement("ul"); + locNest = targetElem.parentNode.parentNode; + locNest.parentNode.insertBefore(newUL,locNest.nextSibling); + + // Now we can add the first LI for this file/folder we're adding + newLI = document.createElement("li"); + newLI.className = cssStyle; + newLI.draggable = false; + newLI.ondragstart = function(event) {this.addDefaultDragData(this,event)}; + newLI.ondrag = function(event) {this.draggingWithKeyTest(event);if(this.getcMInstance()){this.editorFocusInstance.indexOf('diff') == -1 ? this.getcMInstance().focus() : this.getcMdiffInstance().focus()}}; + newLI.ondragover = function(event) {this.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; + newLI.ondragend = function() {this.dropFile(this)}; + newLI.innerHTML = innerLI + locNest.nextSibling.appendChild(newLI); + locNest.nextSibling.appendChild(newText); + + // There are items in that location, so add our new item in the right position + } else { + for (var i=0;i0 ? "folder" : "file"; + + // Get the name of the item + nameLI = locNest.childNodes[i].getElementsByTagName('span')[0].innerHTML; + + // If it's of the same type & the name is greater, or we're adding a folder and it's a file or if we're at the end of the list + if ((elemType==actionElemType && nameLI > file) || (actionElemType=="folder" && elemType=="file") || i==locNest.childNodes.length-1) { + newLI = document.createElement("li"); + newLI.className = cssStyle; + newLI.draggable = false; + newLI.ondragstart = function(event) {this.addDefaultDragData(this,event)}; + newLI.ondrag = function(event) {this.draggingWithKeyTest(event);if(this.getcMInstance()){this.editorFocusInstance.indexOf('diff') == -1 ? this.getcMInstance().focus() : this.getcMdiffInstance().focus()}}; + newLI.ondragover = function(event) {this.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')}; + newLI.ondragend = function() {this.dropFile(this)}; + newLI.innerHTML = innerLI; + // Append or insert depending on which of the above if statements is true + if (i==locNest.childNodes.length-1) { + locNest.appendChild(newLI); + locNest.appendChild(newText); + } else { + locNest.insertBefore(newLI,locNest.childNodes[i]); + locNest.insertBefore(newText,locNest.childNodes[i+1]); + } + break; + } + } + } + } + // If we added a new file, we've saved it under a new filename, so set that + if (actionElemType=="file" && !uploaded) { + this.openFiles[this.selectedTab-1]=location+file; + } + } + + // Renaming files + if (action=="rename") { + // Get short URL of our right clicked file and get target elem based on this + shortURL = oldName.replace(/\//g,"|"); + targetElem = get('filesFrame').contentWindow.document.getElementById(shortURL); + // Set the name to be as per our new file/folder name + targetElem.innerHTML = file; + // Update the ID of the target & set a new title and perms ID + targetElem.id = location.replace(/\//g,"|") + "|" + file; + targetElem.parentNode.title = targetElem.id.replace(/\|/g,"/"); + targetElemPerms = get('filesFrame').contentWindow.document.getElementById(shortURL+"_perms"); + targetElemPerms.id = location.replace(/\//g,"|") + "|" + file + "_perms"; + // Finally, rename also within any children + this.renameInChildren(targetElem, oldName, location, file); + } + + // Moving files + if (action=="move") { + this.updateFileManagerList("add",location,file,false,false,false,fileOrFolder); + this.updateFileManagerList("delete",oldName.substr(0,oldName.lastIndexOf("/")),file); + } + + // Chmod on files + if (action=="chmod") { + // Get short URL for our file and get our target elem based on this + shortURL = this.selectedFiles[this.selectedFiles.length-1].replace(/\|/g,"/"); + targetElem = get('filesFrame').contentWindow.document.getElementById(shortURL.replace(/\//g,"|")+"_perms"); + // Set the color for the perms + targetElem.style.background = perms == 777 ? '#800' : 'none'; + targetElem.style.color = perms == 777 ? '#eee' : '#888'; + // Set the new perms + targetElem.innerHTML = perms; + } + + // Deleting files + if (action=="delete") { + if (!location) {location=""} + location = location.replace(iceRoot,"/"); + location = location.replace("//","/"); + location = location.replace(/\/$/, "").replace(/\//g,"|"); + targetElem = (location +"|"+file).replace("||","|"); + targetElem = get('filesFrame').contentWindow.document.getElementById(targetElem).parentNode.parentNode; + this.openCloseDir(targetElem.childNodes[0],false); + targetElem.parentNode.removeChild(targetElem); + } + }, + + // Rename node attributes within any renamed dirs recursively + renameInChildren: function(elem, oldName, location, file) { + var innerItems, targetElem, targetElemPerms; + + // If our elem has a sibling and it's a UL, we renamed a dir + if(elem.parentNode.parentNode.nextSibling && elem.parentNode.parentNode.nextSibling.nodeName == "UL") { + innerItems = elem.parentNode.parentNode.nextSibling; + + // For each one of the children in the UL, if it's a LI (may be a file or dir) + for (var i=0; i -1 ? cMdiff : cM; - if (thisCM && find.length>0 && document.findAndReplace.target.value==t['this document']) { - content = thisCM.getValue().toLowerCase(); - // Find & replace the next instance, or all? - if (document.findAndReplace.connector.value==t['and'] && buttonClick) { - if (document.findAndReplace.replaceAction.value==t['replace'] && thisCM.getSelection().toLowerCase()==find) { - thisCM.replaceSelection(replace,"around"); - } else if (document.findAndReplace.replaceAction.value==t['replace all']) { - var rExp = new RegExp(find,"gi"); - thisCM.setValue(thisCM.getValue().replace(rExp,replace)); - } - } + // If we have something to find in currrent document + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + if (thisCM && find.length>0 && document.findAndReplace.target.value==t['this document']) { + content = thisCM.getValue().toLowerCase(); + // Find & replace the next instance, or all? + if (document.findAndReplace.connector.value==t['and'] && buttonClick) { + if (document.findAndReplace.replaceAction.value==t['replace'] && thisCM.getSelection().toLowerCase()==find) { + thisCM.replaceSelection(replace,"around"); + } else if (document.findAndReplace.replaceAction.value==t['replace all']) { + var rExp = new RegExp(find,"gi"); + thisCM.setValue(thisCM.getValue().replace(rExp,replace)); + } + } - // Get the content again, as it might of changed - content = thisCM.getValue().toLowerCase(); - if (!this.findMode||find!=this.lastsearch) { - this.results = []; - this.resultsLines = []; + // Get the content again, as it might of changed + content = thisCM.getValue().toLowerCase(); + if (!this.findMode||find!=this.lastsearch) { + this.results = []; + this.resultsLines = []; - for (var i=0;i0) { + // If we have results + if (this.results.length>0) { - // Show results only - if (resultsOnly) { - results.innerHTML = this.results.length + " results"; - // We need to take action instead - } else { - // Find our cursor position relative to results - // Go next - if (!findPrevious) { - this.findResult = 0; - for (var i=0;i=0;i--) { - if (this.results[i]>thisCM.indexFromPos({"ch": thisCM.getCursor().ch-1, "line": thisCM.getCursor().line})) { - this.findResult--; - } - } - } + // Show results only + if (resultsOnly) { + results.innerHTML = this.results.length + " results"; + // We need to take action instead + } else { + // Find our cursor position relative to results + // Go next + if (!findPrevious) { + this.findResult = 0; + for (var i=0;i=0;i--) { + if (this.results[i]>thisCM.indexFromPos({"ch": thisCM.getCursor().ch-1, "line": thisCM.getCursor().line})) { + this.findResult--; + } + } + } - // Loop round to start - if (!findPrevious && this.findResult>this.results.length-1) { - this.findResult = 0 - } - // Loop round to end - if (findPrevious && this.findResult==1) { - this.findResult = this.results.length+1; - } + // Loop round to start + if (!findPrevious && this.findResult>this.results.length-1) { + this.findResult = 0 + } + // Loop round to end + if (findPrevious && this.findResult==1) { + this.findResult = this.results.length+1; + } - // Update results display - results.innerHTML = "Highlighted result "+(this.findResult+(!findPrevious ? 1 : -1))+" of "+this.results.length+" results"; + // Update results display + results.innerHTML = "Highlighted result "+(this.findResult+(!findPrevious ? 1 : -1))+" of "+this.results.length+" results"; - // Now actually perform the movement in the editor - if (!findPrevious) { - // Find next instance - cursor = thisCM.getSearchCursor(find,{"ch": thisCM.getCursor().ch+1, "line": thisCM.getCursor().line},true); - cursor.findNext(); - // Find next from start of doc - if (!cursor.from()) { - cursor = thisCM.getSearchCursor(find,{line:0,ch:0},true); - cursor.findNext(); - } - } else { - // Find previous instance - cursor = thisCM.getSearchCursor(find,{"ch": thisCM.getCursor().ch-1, "line": thisCM.getCursor().line},true); - cursor.findPrevious(); - // Find previous from end of doc - if (!cursor.from()) { - cursor = thisCM.getSearchCursor(find,{line:1000000,ch:1000000},true); - cursor.findPrevious(); - } - } - // Finally, highlight our selection - thisCM.setSelection(cursor.from(), cursor.to()); - this.focus(); - this.findMode = true; - } + // Now actually perform the movement in the editor + if (!findPrevious) { + // Find next instance + cursor = thisCM.getSearchCursor(find,{"ch": thisCM.getCursor().ch+1, "line": thisCM.getCursor().line},true); + cursor.findNext(); + // Find next from start of doc + if (!cursor.from()) { + cursor = thisCM.getSearchCursor(find,{line:0,ch:0},true); + cursor.findNext(); + } + } else { + // Find previous instance + cursor = thisCM.getSearchCursor(find,{"ch": thisCM.getCursor().ch-1, "line": thisCM.getCursor().line},true); + cursor.findPrevious(); + // Find previous from end of doc + if (!cursor.from()) { + cursor = thisCM.getSearchCursor(find,{line:1000000,ch:1000000},true); + cursor.findPrevious(); + } + } + // Finally, highlight our selection + thisCM.setSelection(cursor.from(), cursor.to()); + this.focus(); + this.findMode = true; + } - // Display the find results bar - // The avg block is either line height or fraction of space available - avgBlockH = !this.scrollBarVisible ? thisCM.defaultTextHeight() : parseInt(this.content.style.height,10)/thisCM.lineCount(); - // Need to add padding if there's no scrollbar, so current line highlighting lines up with it - addPadding = !this.scrollBarVisible ? thisCM.heightAtLine(0) : 0; - rBlocks = ""; - for (var i=1; i<=thisCM.lineCount(); i++) { - blockColor = this.resultsLines.indexOf(i)>-1 ? thisCM.getCursor().line+1 == i ? "rgba(192,0,0,0.3)" : "rgba(128,128,128,0.3)" : "transparent"; - rBlocks += '
    '; - } - this.content.contentWindow.document.getElementById('resultsBar').innerHTML = rBlocks; - this.content.contentWindow.document.getElementById('resultsBar').style.display = "inline-block"; - return true; + // Display the find results bar + // The avg block is either line height or fraction of space available + avgBlockH = !this.scrollBarVisible ? thisCM.defaultTextHeight() : parseInt(this.content.style.height,10)/thisCM.lineCount(); + // Need to add padding if there's no scrollbar, so current line highlighting lines up with it + addPadding = !this.scrollBarVisible ? thisCM.heightAtLine(0) : 0; + rBlocks = ""; + for (var i=1; i<=thisCM.lineCount(); i++) { + blockColor = this.resultsLines.indexOf(i)>-1 ? thisCM.getCursor().line+1 == i ? "rgba(192,0,0,0.3)" : "rgba(128,128,128,0.3)" : "transparent"; + rBlocks += '
    '; + } + this.content.contentWindow.document.getElementById('resultsBar').innerHTML = rBlocks; + this.content.contentWindow.document.getElementById('resultsBar').style.display = "inline-block"; + return true; - } else { - results.innerHTML = "No results"; - this.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; - this.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; - return false; - } - } else { - // Show the relevant multiple results popup - if (find != "" && buttonClick) { - replaceQS = ""; - targetQS = ""; - filesQS = ""; - if (document.findAndReplace.connector.value==t['and']) { - replaceQS = "&replace="+replace; - } - if (document.findAndReplace.target.value.indexOf(t['file'])>=0) { - targetQS = "&target="+document.findAndReplace.target.value.replace(/ /g,"-"); - } - if (document.findAndReplace.target.value==t['selected files']) { - filesQS = "&selectedFiles="+this.selectedFiles.join(":"); - } - find = find.replace(/\'/g, '\''); - find != encodeURIComponent(find) ? find = 'ICEcoder:'+encodeURIComponent(find) : find; - this.showHide('show',get('loadingMask')); - get('mediaContainer').innerHTML = ''; - // We have nothing to search for, blank it all out - } else { - results.innerHTML = "No results"; - this.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; - this.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; - } - } - }, + } else { + results.innerHTML = "No results"; + this.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; + this.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; + return false; + } + } else { + // Show the relevant multiple results popup + if (find != "" && buttonClick) { + replaceQS = ""; + targetQS = ""; + filesQS = ""; + if (document.findAndReplace.connector.value==t['and']) { + replaceQS = "&replace="+replace; + } + if (document.findAndReplace.target.value.indexOf(t['file'])>=0) { + targetQS = "&target="+document.findAndReplace.target.value.replace(/ /g,"-"); + } + if (document.findAndReplace.target.value==t['selected files']) { + filesQS = "&selectedFiles="+this.selectedFiles.join(":"); + } + find = find.replace(/\'/g, '\''); + find != encodeURIComponent(find) ? find = 'ICEcoder:'+encodeURIComponent(find) : find; + this.showHide('show',get('loadingMask')); + get('mediaContainer').innerHTML = ''; + // We have nothing to search for, blank it all out + } else { + results.innerHTML = "No results"; + this.content.contentWindow.document.getElementById('resultsBar').innerHTML = ""; + this.content.contentWindow.document.getElementById('resultsBar').style.display = "none"; + } + } + }, - // Replace text in a file - replaceInFile: function(fileRef,find,replace) { - this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=replaceText&find="+find+"&replace="+replace+"&csrf="+this.csrf,encodeURIComponent(fileRef.replace(/\//g,"|"))); - this.serverMessage(''+t['Replacing text in']+'
    '+fileRef); - }, + // Replace text in a file + replaceInFile: function(fileRef,find,replace) { + this.serverQueue("add",iceLoc+"/lib/file-control-xhr.php?action=replaceText&find="+find+"&replace="+replace+"&csrf="+this.csrf,encodeURIComponent(fileRef.replace(/\//g,"|"))); + this.serverMessage(''+t['Replacing text in']+'
    '+fileRef); + }, // ============== // INFO & DISPLAY // ============== - // Get the caret position - getCaretPosition: function() { - var cM, cMdiff, thisCM, line, ch, chPos; + // Get the caret position + getCaretPosition: function() { + var cM, cMdiff, thisCM, line, ch, chPos; - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - line = thisCM.getCursor().line; - ch = thisCM.getCursor().ch; - chPos = 0; - for (var i=0;i -1 ? cMdiff : cM; - this.caretLocationType(); - this.charDisplay.innerHTML = this.caretLocType + ", Line: " + (thisCM.getCursor().line+1) + ", Char: " + thisCM.getCursor().ch; - }, + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + this.caretLocationType(); + this.charDisplay.innerHTML = this.caretLocType + ", Line: " + (thisCM.getCursor().line+1) + ", Char: " + thisCM.getCursor().ch; + }, - // Update version display - updateVersionsDisplay: function() { - var versionsCount = this.openFileVersions[this.selectedTab-1]; + // Update version display + updateVersionsDisplay: function() { + var versionsCount = this.openFileVersions[this.selectedTab-1]; - get('versionsDisplay').innerHTML = "undefined" != typeof versionsCount - ? this.openFileVersions[this.selectedTab-1] + " backup" + - (versionsCount != 1 ? "s" : "") - : ""; - }, + get('versionsDisplay').innerHTML = "undefined" != typeof versionsCount + ? this.openFileVersions[this.selectedTab-1] + " backup" + + (versionsCount != 1 ? "s" : "") + : ""; + }, - // Update the byte display - updateByteDisplay: function() { - var cM, cMdiff, thisCM; + // Update the byte display + updateByteDisplay: function() { + var cM, cMdiff, thisCM; - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - this.byteDisplay.innerHTML = thisCM.getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " bytes"; - }, + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + this.byteDisplay.innerHTML = thisCM.getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " bytes"; + }, - // Toggle the char/byte display - showDisplay: function(show) { - this.byteDisplay.style.display = show == "byte" ? "inline-block" : "none"; - this.charDisplay.style.display = show == "char" ? "inline-block" : "none"; - }, + // Toggle the char/byte display + showDisplay: function(show) { + this.byteDisplay.style.display = show == "byte" ? "inline-block" : "none"; + this.charDisplay.style.display = show == "char" ? "inline-block" : "none"; + }, - // Show & hide target element - showHide: function(doVis,elem) { - elem.style.visibility = doVis=="show" ? 'visible' : 'hidden'; - }, + // Show & hide target element + showHide: function(doVis,elem) { + elem.style.visibility = doVis=="show" ? 'visible' : 'hidden'; + }, - // Determine the CodeMirror instance we're using - getcMInstance: function(tab) { - ic = this; - if (!ic.content) { - ic = parent.ICEcoder; - } - if (!ic.content) { - ic = parent.ICEcoder; - } - return ic.content.contentWindow[ - // target specific tab - !isNaN(tab) - ? 'cM'+ICEcoder.cMInstances[tab-1] - // new tab or selected tab - : tab=="new"||(tab!="new" && this.openFiles.length>0) - ? 'cM'+ICEcoder.cMInstances[this.selectedTab-1] - // fallback to first tab - : 'cM1' - ]; - }, + // Determine the CodeMirror instance we're using + getcMInstance: function(tab) { + ic = this; + if (!ic.content) { + ic = parent.ICEcoder; + } + if (!ic.content) { + ic = parent.ICEcoder; + } + return ic.content.contentWindow[ + // target specific tab + !isNaN(tab) + ? 'cM'+ICEcoder.cMInstances[tab-1] + // new tab or selected tab + : tab=="new"||(tab!="new" && this.openFiles.length>0) + ? 'cM'+ICEcoder.cMInstances[this.selectedTab-1] + // fallback to first tab + : 'cM1' + ]; + }, - // Determine the CodeMirror instance we're using - getcMdiffInstance: function(tab, context) { - if ("undefined" === typeof context) { - context = ICEcoder; - } - return context.content.contentWindow[ - (// target specific tab - !isNaN(tab) - ? 'cM'+ICEcoder.cMInstances[tab-1] - // new tab or selected tab - : tab=="new"||(tab!="new" && this.openFiles.length>0) - ? 'cM'+ICEcoder.cMInstances[this.selectedTab-1] - // fallback to first tab - : 'cM1') - + 'diff' - ]; - }, + // Determine the CodeMirror instance we're using + getcMdiffInstance: function(tab, context) { + if ("undefined" === typeof context) { + context = ICEcoder; + } + return context.content.contentWindow[ + (// target specific tab + !isNaN(tab) + ? 'cM'+ICEcoder.cMInstances[tab-1] + // new tab or selected tab + : tab=="new"||(tab!="new" && this.openFiles.length>0) + ? 'cM'+ICEcoder.cMInstances[this.selectedTab-1] + // fallback to first tab + : 'cM1') + + 'diff' + ]; + }, - // Get the mouse position - getMouseXY: function(e,area) { - var tempX, tempY; + // Get the mouse position + getMouseXY: function(e,area) { + var tempX, tempY; - this.mouseX = e.pageX ? e.pageX : e.clientX + document.body.scrollLeft; - this.mouseY = e.pageY ? e.pageY : e.clientY + document.body.scrollTop; + this.mouseX = e.pageX ? e.pageX : e.clientX + document.body.scrollLeft; + this.mouseY = e.pageY ? e.pageY : e.clientY + document.body.scrollTop; - this.area = area; - if (area!="top") { - this.mouseY += 25 + 45; - } - if (area=="editor") { - this.mouseX += this.filesW; - } - this.dragCursorTest(); - if (this.mouseY>62) {this.setTabWidths();}; - }, + this.area = area; + if (area!="top") { + this.mouseY += 25 + 45; + } + if (area=="editor") { + this.mouseX += this.filesW; + } + this.dragCursorTest(); + if (this.mouseY>62) {this.setTabWidths();}; + }, - // Test if we need to show a drag cursor or not - dragCursorTest: function() { - var diffX, winH, cursorName, zone; + // Test if we need to show a drag cursor or not + dragCursorTest: function() { + var diffX, winH, cursorName, zone; - // Dragging tabs, started after dragging for 10px from origin - diffX = this.mouseX - this.diffStartX; - if (this.draggingTab!==false && this.diffStartX && (diffX <= -10 || diffX >= 10)) { - if (this.mouseX > parseInt(this.files.style.width,10)) { - this.tabDragMouseX = this.mouseX - parseInt(this.files.style.width,10) - this.tabDragMouseXStart; - this.tabDragMove(); - } - } + // Dragging tabs, started after dragging for 10px from origin + diffX = this.mouseX - this.diffStartX; + if (this.draggingTab!==false && this.diffStartX && (diffX <= -10 || diffX >= 10)) { + if (this.mouseX > parseInt(this.files.style.width,10)) { + this.tabDragMouseX = this.mouseX - parseInt(this.files.style.width,10) - this.tabDragMouseXStart; + this.tabDragMove(); + } + } - // Dragging file manager, possible within 7px of file manager edge - if (this.ready) { - winH = window.innerHeight; - if (!this.mouseDown) {this.draggingFilesW = false}; + // Dragging file manager, possible within 7px of file manager edge + if (this.ready) { + winH = window.innerHeight; + if (!this.mouseDown) {this.draggingFilesW = false}; - cursorName = (!this.draggingTab && ((this.mouseX > this.filesW-7 && this.mouseX < this.filesW+7) || this.draggingFilesW)) - ? "w-resize" - : "auto"; - if (this.content.contentWindow.document && this.filesFrame.contentWindow) { - document.body.style.cursor = cursorName; - if (zone = this.content.contentWindow.document.body) {zone.style.cursor = cursorName}; - if (zone = this.filesFrame.contentWindow.document.body) {zone.style.cursor = cursorName}; - } - } - }, + cursorName = (!this.draggingTab && ((this.mouseX > this.filesW-7 && this.mouseX < this.filesW+7) || this.draggingFilesW)) + ? "w-resize" + : "auto"; + if (this.content.contentWindow.document && this.filesFrame.contentWindow) { + document.body.style.cursor = cursorName; + if (zone = this.content.contentWindow.document.body) {zone.style.cursor = cursorName}; + if (zone = this.filesFrame.contentWindow.document.body) {zone.style.cursor = cursorName}; + } + } + }, - // Show or hide a server message - serverMessage: function(message) { - var serverMessage; + // Show or hide a server message + serverMessage: function(message) { + var serverMessage; - serverMessage = get('serverMessage'); - if (message) { - serverMessage.innerHTML = this.xssClean(message).replace(/\<b\>/g,"").replace(/\<\/b\>/g,"").replace(/\<br\>/g,"
    "); - serverMessage.style.left = "0"; - } else { - setTimeout(function() {serverMessage.style.left = "2000px";},200); - } - serverMessage.style.opacity = message ? 1 : 0; - }, + serverMessage = get('serverMessage'); + if (message) { + serverMessage.innerHTML = this.xssClean(message).replace(/\<b\>/g,"").replace(/\<\/b\>/g,"").replace(/\<br\>/g,"
    "); + serverMessage.style.left = "0"; + } else { + setTimeout(function() {serverMessage.style.left = "2000px";},200); + } + serverMessage.style.opacity = message ? 1 : 0; + }, - // Show a CSS color block next to our text cursor - cssColorPreview: function() { - var cM, cMdiff, thisCM, string, rx, match, oldBlock, newBlock; + // Show a CSS color block next to our text cursor + cssColorPreview: function() { + var cM, cMdiff, thisCM, string, rx, match, oldBlock, newBlock; - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (thisCM) { - string = thisCM.getLine(thisCM.getCursor().line); - rx = /(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi; + if (thisCM) { + string = thisCM.getLine(thisCM.getCursor().line); + rx = /(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi; - while((match = rx.exec(string)) && thisCM.getCursor().ch > match.index+match[0].length); + while((match = rx.exec(string)) && thisCM.getCursor().ch > match.index+match[0].length); - oldBlock = get('content').contentWindow.document.getElementById('cssColor'); - if (oldBlock) {oldBlock.parentNode.removeChild(oldBlock)}; - if (this.codeAssist && this.caretLocType=="CSS") { - newBlock = document.createElement("div"); - newBlock.id = "cssColor"; - newBlock.style.position = "absolute"; - newBlock.style.display = "block"; - newBlock.style.width = newBlock.style.height = "20px"; - newBlock.style.zIndex = "1000"; - newBlock.style.background = match ? match[0] : ''; - newBlock.style.cursor = "pointer"; - newBlock.onclick = function() {ICEcoder.showColorPicker(match[0])}; - if (newBlock.style.backgroundColor=="") {newBlock.style.display = "none"}; - get('header').appendChild(newBlock); - thisCM.addWidget(thisCM.getCursor(), get('cssColor'), true); - } - } - }, + oldBlock = get('content').contentWindow.document.getElementById('cssColor'); + if (oldBlock) {oldBlock.parentNode.removeChild(oldBlock)}; + if (this.codeAssist && this.caretLocType=="CSS") { + newBlock = document.createElement("div"); + newBlock.id = "cssColor"; + newBlock.style.position = "absolute"; + newBlock.style.display = "block"; + newBlock.style.width = newBlock.style.height = "20px"; + newBlock.style.zIndex = "1000"; + newBlock.style.background = match ? match[0] : ''; + newBlock.style.cursor = "pointer"; + newBlock.onclick = function() {ICEcoder.showColorPicker(match[0])}; + if (newBlock.style.backgroundColor=="") {newBlock.style.display = "none"}; + get('header').appendChild(newBlock); + thisCM.addWidget(thisCM.getCursor(), get('cssColor'), true); + } + } + }, - // Show color picker - showColorPicker: function(color) { - get('blackMask').style.visibility = "visible"; - get('mediaContainer').innerHTML = '


    '+ - ''+ - '
    '+ - ''+ - ''; - farbtastic('picker','color'); - if (color) { - get('picker').farbtastic.setColor(color); - } - }, + // Show color picker + showColorPicker: function(color) { + get('blackMask').style.visibility = "visible"; + get('mediaContainer').innerHTML = '


    '+ + ''+ + '
    '+ + ''+ + ''; + farbtastic('picker','color'); + if (color) { + get('picker').farbtastic.setColor(color); + } + }, - // Init the canvas by drawing the image and setting the floating containers background size (5x zoom) - initCanvasImage: function (imgThis) { - var canvas, img; + // Init the canvas by drawing the image and setting the floating containers background size (5x zoom) + initCanvasImage: function (imgThis) { + var canvas, img; - canvas = get('canvasPicker').getContext('2d'); + canvas = get('canvasPicker').getContext('2d'); - img = new Image(); - img.crossOrigin = "Anonymous"; - img.src = imgThis.src; + img = new Image(); + img.crossOrigin = "Anonymous"; + img.src = imgThis.src; - // Issue with loading, display CORS error info - img.onerror = function() { - get('floatingContainer').style.visibility = "hidden"; - get('canvasPickerColorInfo').style.display = "none"; - get('canvasPickerCORSInfo').style.display = "block"; - } + // Issue with loading, display CORS error info + img.onerror = function() { + get('floatingContainer').style.visibility = "hidden"; + get('canvasPickerColorInfo').style.display = "none"; + get('canvasPickerCORSInfo').style.display = "block"; + } - // On image load - img.onload = function() { - // Get width and height and draw this image into the canvas - get('canvasPicker').width = imgThis.width; - get('canvasPicker').height = imgThis.height; - canvas.drawImage(img,0,0,imgThis.width,imgThis.height); + // On image load + img.onload = function() { + // Get width and height and draw this image into the canvas + get('canvasPicker').width = imgThis.width; + get('canvasPicker').height = imgThis.height; + canvas.drawImage(img,0,0,imgThis.width,imgThis.height); - // Display color picker info and hide CORS message - get('canvasPickerColorInfo').style.display = "block"; - get('canvasPickerCORSInfo').style.display = "none"; + // Display color picker info and hide CORS message + get('canvasPickerColorInfo').style.display = "block"; + get('canvasPickerCORSInfo').style.display = "none"; - // Show image preview box on mouse over - get('canvasPicker').onmouseover = function(event) { - get('floatingContainer').style.visibility = "visible"; - }; - // Hide image preview box on mouse out - get('canvasPicker').onmouseout = function(event) { - get('floatingContainer').style.visibility = "hidden"; - }; - } + // Show image preview box on mouse over + get('canvasPicker').onmouseover = function(event) { + get('floatingContainer').style.visibility = "visible"; + }; + // Hide image preview box on mouse out + get('canvasPicker').onmouseout = function(event) { + get('floatingContainer').style.visibility = "hidden"; + }; + } - document.getElementById('floatingContainer').style.backgroundSize = (imgThis.naturalWidth*5)+"px "+(imgThis.naturalHeight*5)+"px"; - }, + document.getElementById('floatingContainer').style.backgroundSize = (imgThis.naturalWidth*5)+"px "+(imgThis.naturalHeight*5)+"px"; + }, - // Interact with the canvas image - interactCanvasImage: function (imgThis) { - var canvas, x, y, imgData, R, G, B, rgb, hex, textColor, fcElem, fcBGX, fcBGY; + // Interact with the canvas image + interactCanvasImage: function (imgThis) { + var canvas, x, y, imgData, R, G, B, rgb, hex, textColor, fcElem, fcBGX, fcBGY; - canvas = get('canvasPicker').getContext('2d'); + canvas = get('canvasPicker').getContext('2d'); - // Show pointer colors on mouse move over canvas - get('canvasPicker').onmousemove = function(event) { - // get mouse x & y - x = event.pageX - this.offsetLeft; - y = event.pageY - this.offsetTop; - // get image data & then RGB values - imgData = canvas.getImageData(x, y, 1, 1).data; - R = imgData[0]; - G = imgData[1]; - B = imgData[2]; - rgb = R+','+G+','+B; - // Get hex from RGB value - hex = this.rgbToHex(R,G,B); - // set the values & BG colours of the input boxes - get('rgbMouseXY').value = rgb; - get('hexMouseXY').value = '#' + hex; - get('hexMouseXY').style.backgroundColor = get('rgbMouseXY').style.backgroundColor = '#' + hex; - textColor = R<128 || G<128 || B<128 && (R<200 && G<200 && B>50) ? '#fff' : '#000'; - get('hexMouseXY').style.color = get('rgbMouseXY').style.color = textColor; + // Show pointer colors on mouse move over canvas + get('canvasPicker').onmousemove = function(event) { + // get mouse x & y + x = event.pageX - this.offsetLeft; + y = event.pageY - this.offsetTop; + // get image data & then RGB values + imgData = canvas.getImageData(x, y, 1, 1).data; + R = imgData[0]; + G = imgData[1]; + B = imgData[2]; + rgb = R+','+G+','+B; + // Get hex from RGB value + hex = this.rgbToHex(R,G,B); + // set the values & BG colours of the input boxes + get('rgbMouseXY').value = rgb; + get('hexMouseXY').value = '#' + hex; + get('hexMouseXY').style.backgroundColor = get('rgbMouseXY').style.backgroundColor = '#' + hex; + textColor = R<128 || G<128 || B<128 && (R<200 && G<200 && B>50) ? '#fff' : '#000'; + get('hexMouseXY').style.color = get('rgbMouseXY').style.color = textColor; - // Move the floating container to follow mouse pointer - fcElem = get('floatingContainer'); - fcElem.style.left = this.mouseX+20 + "px"; - fcElem.style.top = this.mouseY + "px"; - // Move the background image for the container to match also - // 5 x zoom, account for scaling down of large images and shift 25px of the hover div size - // (55px is the 11x11 grid of pixels), minus 5px for centre row/col - fcBGX = -((x*5)*(imgThis.naturalWidth/imgThis.width))+25; - fcBGY = -((y*5)*(imgThis.naturalHeight/imgThis.height))+25; - fcElem.style.backgroundPosition = fcBGX+"px "+fcBGY+"px"; - }; + // Move the floating container to follow mouse pointer + fcElem = get('floatingContainer'); + fcElem.style.left = this.mouseX+20 + "px"; + fcElem.style.top = this.mouseY + "px"; + // Move the background image for the container to match also + // 5 x zoom, account for scaling down of large images and shift 25px of the hover div size + // (55px is the 11x11 grid of pixels), minus 5px for centre row/col + fcBGX = -((x*5)*(imgThis.naturalWidth/imgThis.width))+25; + fcBGY = -((y*5)*(imgThis.naturalHeight/imgThis.height))+25; + fcElem.style.backgroundPosition = fcBGX+"px "+fcBGY+"px"; + }; - // Set pointer colors on clicking canvas - get('canvasPicker').onclick = function() { - get('rgb').value = get('rgbMouseXY').value; - get('hex').value = get('hexMouseXY').value; - get('hex').style.backgroundColor = get('rgb').style.backgroundColor = get('hex').value; - get('hex').style.color = get('rgb').style.color = textColor; - } - }, + // Set pointer colors on clicking canvas + get('canvasPicker').onclick = function() { + get('rgb').value = get('rgbMouseXY').value; + get('hex').value = get('hexMouseXY').value; + get('hex').style.backgroundColor = get('rgb').style.backgroundColor = get('hex').value; + get('hex').style.color = get('rgb').style.color = textColor; + } + }, - // Convert RGB values to Hex - rgbToHex: function(R,G,B) { - return this.toHex(R)+this.toHex(G)+this.toHex(B); - }, + // Convert RGB values to Hex + rgbToHex: function(R,G,B) { + return this.toHex(R)+this.toHex(G)+this.toHex(B); + }, - // Return numbers as hex equivalent - toHex: function(n) { - n = parseInt(n,10); - if (isNaN(n)) return "00"; - n = Math.max(0,Math.min(n,255)); - return "0123456789abcdef".charAt((n-n%16)/16) + "0123456789abcdef".charAt(n%16); - }, + // Return numbers as hex equivalent + toHex: function(n) { + n = parseInt(n,10); + if (isNaN(n)) return "00"; + n = Math.max(0,Math.min(n,255)); + return "0123456789abcdef".charAt((n-n%16)/16) + "0123456789abcdef".charAt(n%16); + }, - // Insert new color value - insertColorValue: function(color) { - var cM, cMdiff, thisCM, cursor; + // Insert new color value + insertColorValue: function(color) { + var cM, cMdiff, thisCM, cursor; - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - cursor = thisCM.getTokenAt(thisCM.getCursor()); - thisCM.replaceRange(color,{line:thisCM.getCursor().line,ch:cursor.start},{line:thisCM.getCursor().line,ch:1000000}); - }, + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + cursor = thisCM.getTokenAt(thisCM.getCursor()); + thisCM.replaceRange(color,{line:thisCM.getCursor().line,ch:cursor.start},{line:thisCM.getCursor().line,ch:1000000}); + }, - // Change opacity of the file manager icons - fMIconVis: function(icon, vis) { - var i; + // Change opacity of the file manager icons + fMIconVis: function(icon, vis) { + var i; - if (i = get(icon)) { - i.style.opacity = vis; - } - }, + if (i = get(icon)) { + i.style.opacity = vis; + } + }, - // Check if a file is already open - isOpen: function(file) { - var i; + // Check if a file is already open + isOpen: function(file) { + var i; - file = file.replace(/\|/g, "/").replace(docRoot+iceRoot,""); - i = this.openFiles.indexOf(file); - // return the array position or false - return i!=-1 ? i : false; - }, + file = file.replace(/\|/g, "/").replace(docRoot+iceRoot,""); + i = this.openFiles.indexOf(file); + // return the array position or false + return i!=-1 ? i : false; + }, // ============== // SYSTEM // ============== - // Start running plugin intervals according to given specifics - startPluginIntervals: function(plugRef,plugURL,plugTarget,plugTimer) { - // Add CSRF to URL if it has QS params - if (plugURL.indexOf("?") > -1) { - plugURL = plugURL+"&csrf="+this.csrf; - } - this['plugTimer'+plugRef] = - // This window instances - ["_parent","_top","_self",""].indexOf(plugTarget) > -1 - ? this['plugTimer'+plugRef] = setInterval('window.location=\''+plugURL+'\'',plugTimer*1000*60) - // fileControl iframe instances - : plugTarget.indexOf("fileControl") == 0 - ? this['plugTimer'+plugRef] = setInterval(function(ic) { - ic.serverQueue("add",plugURL);ic.serverMessage(plugTarget.split(":")[1]); - },plugTimer*1000*60,this) - // _blank or named target window instances - : this['plugTimer'+plugRef] = setInterval('window.open(\''+plugURL+'\',\''+plugTarget+'\')',plugTimer*1000*60); - - // push the plugin ref into our array - this.pluginIntervalRefs.push(plugRef); - }, - - // Turning on/off the Code Assist - codeAssistToggle: function() { - var cM, cMdiff, fileName, fileExt; - - this.codeAssist = !this.codeAssist; - this.cssColorPreview(); - this.focus(this.editorFocusInstance.indexOf('diff') > -1 ? 'diff' : false); - - for (i=0;i0) { - nextSaveID++; - } - } - nextSaveID++; - // Add to end of array or remove from beginning on demand, plus add or remove if necessary - if (action=="add") { - this.serverQueueItems.push(item); - if (item.indexOf('action=save')>0) { - txtArea = document.createElement('textarea'); - txtArea.setAttribute('id', 'saveTemp'+nextSaveID); - document.body.appendChild(txtArea); - // If we're saving as or the file version is undefined, set the temp save value as the contents - if (item.indexOf('saveType=saveAs')>0 || item.indexOf('fileVersion=undefined')>0) { - get('saveTemp'+nextSaveID).value = cM.getValue(); - // Else we can save the JSON version of the changes to implement - } else { - get('saveTemp'+nextSaveID).value = changes; - } - } - } else if (action=="del") { - // console.log(this); - if (this.serverQueueItems[0] && this.serverQueueItems[0].indexOf('action=save')>0) { - topSaveID = nextSaveID-1; - for (var i=1;i=1 || this.serverQueueItems.length==1) { - // If we have an item, we're not saving previous file refs and not loading - if (item && (item.indexOf('saveFiles=')==-1 && item.indexOf('action=load')==-1)) { - xhr = this.xhrObj(); - xhr.onreadystatechange=function() { - if (xhr.readyState==4) { - // OK reponse? - if (xhr.status==200) { - // Parse the response as a JSON object - statusObj = JSON.parse(xhr.responseText); - - // Set the action end time and time taken in JSON object - statusObj.action.timeEnd = new Date().getTime(); - statusObj.action.timeTaken = statusObj.action.timeEnd - statusObj.action.timeStart; - - // User wanted raw (or both) output of the response? - if (["raw","both"].indexOf(this.fileDirResOutput) >= 0) { - console.log(xhr.responseText); - } - // User wanted object (or both) output of the response? - if (["object","both"].indexOf(this.fileDirResOutput) >= 0) { - console.log(statusObj); - } - // If error, show that, otherwise do whatever we're required to do next - if (statusObj.status.error) { - this.message(statusObj.status.errorMsg); - console.log("ICEcoder error info for your request..."); - console.log(statusObj); - this.serverMessage(); - this.serverQueue('del',0); - } else { - eval(statusObj.action.doNext); - } - // Some other response? Display a message about that - } else { - this.message(t['Sorry there was...']); - console.log("ICEcoder error info for your request..."); - console.log(statusObj); - this.serverMessage(); - this.serverQueue('del',0); - } - } - }; - xhr.open("POST",this.serverQueueItems[0],true); - xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - timeStart = new Date().getTime(); - - // Save as events need to send all contents - if (item.indexOf('action=saveAs')>0) { - xhr.send('timeStart='+timeStart+'&file='+file+'&contents='+encodeURIComponent(document.getElementById('saveTemp1').value)); - // Save evens can just sent the changes - } else if (item.indexOf('action=save')>0) { - xhr.send('timeStart='+timeStart+'&file='+file+'&changes='+encodeURIComponent(document.getElementById('saveTemp1').value)); - // Another type of event - } else { - xhr.send('timeStart='+timeStart+'&file='+file); - } - } else { - - setTimeout(function(ic) { - if ("undefined" != typeof ic.serverQueueItems[0]) { - ic.filesFrame.contentWindow.frames['fileControl'].location.href=ic.serverQueueItems[0]; - } - },1,this); - - } - } - }, - - // Cancel all actions on pressing Esc in non content areas - cancelAllActions: function() { - // Stop whatever the parent may be loading and clear tasks other than the current one - window.stop(); - if (this.serverQueueItems.length>0) { - this.serverQueueItems.splice(1,this.serverQueueItems.length); - } - this.showHide('hide',get('loadingMask')); - this.serverMessage(''+t['Cancelled tasks']+''); - setTimeout(function(ic) {ic.serverMessage();},2000,this); - }, - - // Set the current previousFiles in the settings file - setPreviousFiles: function() { - var previousFiles; - - previousFiles = this.openFiles.join(',').replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,""); - if (previousFiles=="") {previousFiles="CLEAR"}; - // Then send through to the settings page to update setting - this.serverQueue("add",iceLoc+"/lib/settings.php?saveFiles="+encodeURIComponent(previousFiles)+"&csrf="+this.csrf); - this.updateLast10List(previousFiles); - }, - - // Update the list of 10 previous files in browser - updateLast10List: function(previousFiles) { - var newFile, last10Files, last10FilesList; - - // Split our previous files string into an array - previousFiles = previousFiles.split(','); - // For each one of those, if it's not 'CLEAR' we can maybe rotate the list - for (var i=0; i"+previousFiles[i].replace(/\|/g,"/")+"\n"; - - // Get DOM elem for last 10 files - last10Files = this.content.contentWindow.document.getElementById('last10Files'); - - // If the innerHTML of that doesn't contain our new item, we can insert it - if(last10Files.innerHTML.indexOf(newFile) == -1) { - // Get the last 10 files list, pop the last one off and add newFile at start - last10FilesList = last10Files.innerHTML.split("\n"); - if ( - last10FilesList.length >= 10 || // No more than 10 - last10FilesList[0] == '
    [none]


    ' || // Clear out placeholder - last10FilesList[last10FilesList.length-1] == "" // No empty array items - ) { - last10FilesList.pop(); - } - // Update the list - last10Files.innerHTML = newFile + (last10FilesList.join("\n")); - } - } - } - }, - - // Opens the last files we had open - 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'; - } - this.showHide(hide?'hide':'show',get('blackMask')); - }, - - // Show the help screen - helpScreen: function() { - get('mediaContainer').innerHTML = ''; - this.showHide('show',get('blackMask')); - }, - - // Show the backup versions screen - versionsScreen: function(file,versions) { - get('mediaContainer').innerHTML = ''; - this.showHide('show',get('blackMask')); - }, - - // Show the ICEcoder manual, loaded remotely - showManual: function(version,section) { - var sectionExtra; - - sectionExtra = section ? "#"+section : ""; - get('mediaContainer').innerHTML = ''; - this.showHide('show',get('blackMask')); - }, - - // Show the properties screen - propertiesScreen: function(fileName) { - get('mediaContainer').innerHTML = ''; - this.showHide('show',get('blackMask')); - }, - - // Show the auto-logout warning screen - autoLogoutWarningScreen: function() { - get('mediaContainer').innerHTML = ''; - this.showHide('show',get('blackMask')); - }, - - // Show the plugins manager - pluginsManager: function() { - get('mediaContainer').innerHTML = ''; - this.showHide('show',get('blackMask')); - }, - - // Go to localhost root - goLocalhostRoot: function() { - this.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/go-localhost-root.php"; - }, - - // Show the FTP manager - ftpManager: function() { - get('mediaContainer').innerHTML = ''; - this.showHide('show',get('blackMask')); - }, - - // Update the settings used when we make a change to them - useNewSettings: function(themeURL,codeAssist,lockedNav,tagWrapperCommand,autoComplete,visibleTabs,fontSize,lineWrapping,lineNumbers,showTrailingSpace,matchBrackets,autoCloseTags,autoCloseBrackets,indentWithTabs,indentAuto,indentSize,pluginPanelAligned,scrollbarStyle,bugFilePaths,bugFileCheckTimer,bugFileMaxLines,updateDiffOnSave,autoLogoutMins,refreshFM) { - var styleNode, thisCSS, strCSS, activeLineBG; - - // cut out ?microtime= at the end - var cleanThemeUrl = themeURL.slice(0, themeURL.lastIndexOf("?")); - // find out new theme name without leading path and trailing ".css" - var newTheme = cleanThemeUrl.slice(cleanThemeUrl.lastIndexOf("/")+1,cleanThemeUrl.lastIndexOf(".")); - // if theme was not changed - no need to do all these tricks - if (this.theme !== newTheme){ - // Add new stylesheet for selected theme to editor - this.theme = newTheme; - if (this.theme=="editor") {this.theme="icecoder"}; - styleNode = document.createElement('link'); - styleNode.setAttribute('rel', 'stylesheet'); - styleNode.setAttribute('type', 'text/css'); - styleNode.setAttribute('href', themeURL); - this.content.contentWindow.document.getElementsByTagName('head')[0].appendChild(styleNode); - if (["3024-day","base16-light","eclipse","elegant","mdn-like","neat","neo","paraiso-light","solarized","the-matrix","xq-light"].indexOf(this.theme)>-1) { - activeLineBG = "#ccc"; - } else if (["3024-night","blackboard","colorforth","liquibyte","night","tomorrow-night-bright","tomorrow-night-eighties","vibrant-ink"].indexOf(this.theme)>-1) { - activeLineBG = "#888"; - } else { - activeLineBG = "#000"; - } - this.switchTab(this.selectedTab); - } - - // Check/uncheck Code Assist setting - if (codeAssist != this.codeAssist) { - this.codeAssistToggle(); - } - - // Unlock/lock the file manager - if (lockedNav != this.lockedNav) { - this.lockUnlockNav(); - this.changeFilesW(!lockedNav ? 'contract' : 'expand'); - this.hideFileMenu(); - }; - - // Update font size at top level - thisCSS = document.styleSheets[0]; - strCSS = thisCSS.rules ? 'rules' : 'cssRules'; - thisCSS[strCSS][0].style['fontSize'] = fontSize; - - // Update font size in file manager - thisCSS = this.filesFrame.contentWindow.document.styleSheets[3]; - strCSS = thisCSS.rules ? 'rules' : 'cssRules'; - thisCSS[strCSS][0].style['fontSize'] = fontSize; - - // Update styles in editor - thisCSS = this.content.contentWindow.document.styleSheets[6]; - strCSS = thisCSS.rules ? 'rules' : 'cssRules'; - thisCSS[strCSS][0].style['fontSize'] = fontSize; - thisCSS[strCSS][4].style['border-left-width'] = visibleTabs ? '1px' : '0'; - thisCSS[strCSS][4].style['margin-left'] = visibleTabs ? '-1px' : '0'; - thisCSS[strCSS][2].style.cssText = "background-color: " + activeLineBG + " !important"; - - this.lineWrapping = lineWrapping; - this.lineNumbers = lineNumbers; - this.showTrailingSpace = showTrailingSpace; - this.matchBrackets = matchBrackets; - this.autoCloseTags = autoCloseTags; - this.autoCloseBrackets = autoCloseBrackets; - this.indentWithTabs = indentWithTabs; - this.indentSize = indentSize; - this.indentAuto = indentAuto; - this.scrollbarStyle = scrollbarStyle; - for (var i=0;ichMod '+perms+' on
    '+file.replace(/\|/g,"/")); - }, - - // Open/show the preview window - openPreviewWindow: function() { - if (this.openFiles.length>0) { - var cM, cMdiff, thisCM, filepath, filename, fileExt; - - filepath = this.openFiles[this.selectedTab-1]; - filename = filepath.substr(filepath.lastIndexOf("/")+1); - fileExt = filename.substr(filename.lastIndexOf(".")+1); - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - - this.previewWindowLoading = true; - this.previewWindow = window.open(filepath,"previewWindow",500,500); - if (["md"].indexOf(fileExt) > -1) { - this.previewWindow.onload = function() { - this.previewWindowLoading = false; - this.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()) - }; - } else { - this.previewWindow.onload = function() { - this.previewWindowLoading = false; - // Do the pesticide plugin if it exists - try {this.doPesticide();} catch(err) {}; - // Do the stats.js plugin if it exists - try {this.doStatsJS('open');} catch(err) {}; - // Do the responsive plugin if it exists - try {this.doResponsive();} catch(err) {}; - } - } - } - }, - - // Reset auto-logout timer - resetAutoLogoutTimer: function() { - if(this.autoLogoutMins > 1 && this.autoLogoutTimer > (this.autoLogoutMins*60)-60) { - this.showHide('hide',get('blackMask')); - } - this.autoLogoutTimer = 0; - }, - - // Logout of ICEcoder - logout: function(type) { - window.location = window.location + "?logout&"+(type ? "type="+type+"&" : "")+"csrf="+this.csrf; - }, - - // Show a message - outputMsg: function(msg) { - this.output.innerHTML += msg + "
    "; - }, - - // Show a message - message: function(msg) { - alert(msg); - }, - - // Ask for confirmation - ask: function(question) { - return confirm(question); - }, - - // Get the users input - getInput: function(question,defaultValue) { - return prompt(question,defaultValue); - }, - - // Show a data screen message - dataMessage: function(message) { - var dM; - - dM = this.content.contentWindow.document.getElementById('dataMessage'); - dM.style.display = "block"; - dM.innerHTML = message; - }, - - // Update ICEcoder - update: function() { - var autoUpdate; - - autoUpdate = confirm(t['Please note for...']); - if (autoUpdate) { - this.showHide('show',get('loadingMask')); - window.location = iceLoc+"/lib/updater.php"; - } else { - window.open("https://this.net"); - } - }, - - // ICEcoder just updated - updated: function() { - get('blackMask').style.visibility = "visible"; - get('mediaContainer').innerHTML = '

    Thanks for updating to v'+this.versionNo+'!

    ' - + '

    Click anywhere to continue using this...

    '; - }, - - // XHR object - xhrObj: function(){ - try {return new XMLHttpRequest();}catch(e){} - try {return new ActiveXObject("Msxml3.XMLHTTP");}catch(e){} - try {return new ActiveXObject("Msxml2.XMLHTTP.6.0");}catch(e){} - try {return new ActiveXObject("Msxml2.XMLHTTP.3.0");}catch(e){} - try {return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){} - try {return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){} - return null; - }, - - // Open bug report - openBugReport: function() { - var bugReportOpenFilePos; - - if(this.bugReportStatus=="off") { - this.message(t['You can start...']); - } - if(this.bugReportStatus=="error") { - this.message(t['Error cannot find...']); - } - if(this.bugReportStatus=="ok") { - this.message(t['No new errors...']); - } - if(this.bugReportStatus=="bugs") { - // Close bug-report without saving previousFiles and without confirming close if we made changes on the bug report - var bugReportOpenFilePos = this.openFiles.indexOf(this.bugReportPath.replace(/\|/g,"/")); - if (bugReportOpenFilePos > -1) { - this.closeTab(bugReportOpenFilePos+1,'dontSetPV','dontAsk'); - } - this.openFile(this.bugReportPath); - this.bugFilesSizesSeen = this.bugFilesSizesActual; - } - }, - - // Start bug checking by looking in bug file paths on a timer - startBugChecking: function() { - var bugCheckURL; - - if (this.bugFileCheckTimer !== 0) { - // Clear any existing interval - if ("undefined" != typeof this.bugFileCheckInt) { - clearInterval(this.bugFileCheckInt); - } - // Start a new timer - this.bugFilesSizesSeen = []; - this.bugFileCheckInt = setInterval(function(ic) { - bugCheckURL = iceLoc+"/lib/bug-files-check.php?"; - bugCheckURL += "files="+(ic.bugFilePaths[0] !== "" ? ic.bugFilePaths.join() : "null").replace(/\//g,"|"); - bugCheckURL += "&filesSizesSeen="; - if (ic.bugFilesSizesSeen.length != ic.bugFilePaths.length) { - // Fill the array with nulls - for (var i=0; i/g, ">") - .replace(/"/g, """) - .replace(/'/g, "'"); - }, - - // Print code of current tab - printCode: function() { - var cM, cMdiff, thisCM, printIFrame; - - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - printIFrame = this.filesFrame.contentWindow.frames['fileControl']; - // Print page content injected into iFrame, escaped with pre and xssClean - printIFrame.window.document.body.innerHTML = 'ICEcoder code output
    '+this.xssClean(thisCM.getValue())+'
    '; - printIFrame.focus(); - printIFrame.print(); - // Focus back on code - thisCM.focus(); - }, - - // Update the title tag to indicate any changes - indicateChanges: function() { - var winTitle; - - if (!this.loadingFile) { - winTitle = "ICEcoder v "+this.versionNo; - for(var i=1;i<=this.savedPoints.length;i++) { - if (this.savedPoints[i-1]!=this.getcMInstance(i).changeGeneration()) { - // We have an unsaved tab, indicate that in the title - winTitle += " \u2744"; - break; - } - } - document.title = winTitle; - } - }, + // Start running plugin intervals according to given specifics + startPluginIntervals: function(plugRef,plugURL,plugTarget,plugTimer) { + // Add CSRF to URL if it has QS params + if (plugURL.indexOf("?") > -1) { + plugURL = plugURL+"&csrf="+this.csrf; + } + this['plugTimer'+plugRef] = + // This window instances + ["_parent","_top","_self",""].indexOf(plugTarget) > -1 + ? this['plugTimer'+plugRef] = setInterval('window.location=\''+plugURL+'\'',plugTimer*1000*60) + // fileControl iframe instances + : plugTarget.indexOf("fileControl") == 0 + ? this['plugTimer'+plugRef] = setInterval(function(ic) { + ic.serverQueue("add",plugURL);ic.serverMessage(plugTarget.split(":")[1]); + },plugTimer*1000*60,this) + // _blank or named target window instances + : this['plugTimer'+plugRef] = setInterval('window.open(\''+plugURL+'\',\''+plugTarget+'\')',plugTimer*1000*60); + + // push the plugin ref into our array + this.pluginIntervalRefs.push(plugRef); + }, + + // Turning on/off the Code Assist + codeAssistToggle: function() { + var cM, cMdiff, fileName, fileExt; + + this.codeAssist = !this.codeAssist; + this.cssColorPreview(); + this.focus(this.editorFocusInstance.indexOf('diff') > -1 ? 'diff' : false); + + for (i=0;i0) { + nextSaveID++; + } + } + nextSaveID++; + // Add to end of array or remove from beginning on demand, plus add or remove if necessary + if (action=="add") { + this.serverQueueItems.push(item); + if (item.indexOf('action=save')>0) { + txtArea = document.createElement('textarea'); + txtArea.setAttribute('id', 'saveTemp'+nextSaveID); + document.body.appendChild(txtArea); + // If we're saving as or the file version is undefined, set the temp save value as the contents + if (item.indexOf('saveType=saveAs')>0 || item.indexOf('fileVersion=undefined')>0) { + get('saveTemp'+nextSaveID).value = cM.getValue(); + // Else we can save the JSON version of the changes to implement + } else { + get('saveTemp'+nextSaveID).value = changes; + } + } + } else if (action=="del") { + // console.log(this); + if (this.serverQueueItems[0] && this.serverQueueItems[0].indexOf('action=save')>0) { + topSaveID = nextSaveID-1; + for (var i=1;i=1 || this.serverQueueItems.length==1) { + // If we have an item, we're not saving previous file refs and not loading + if (item && (item.indexOf('saveFiles=')==-1 && item.indexOf('action=load')==-1)) { + xhr = this.xhrObj(); + xhr.onreadystatechange=function() { + if (xhr.readyState==4) { + // OK reponse? + if (xhr.status==200) { + // Parse the response as a JSON object + statusObj = JSON.parse(xhr.responseText); + + // Set the action end time and time taken in JSON object + statusObj.action.timeEnd = new Date().getTime(); + statusObj.action.timeTaken = statusObj.action.timeEnd - statusObj.action.timeStart; + + // User wanted raw (or both) output of the response? + if (["raw","both"].indexOf(this.fileDirResOutput) >= 0) { + console.log(xhr.responseText); + } + // User wanted object (or both) output of the response? + if (["object","both"].indexOf(this.fileDirResOutput) >= 0) { + console.log(statusObj); + } + // If error, show that, otherwise do whatever we're required to do next + if (statusObj.status.error) { + this.message(statusObj.status.errorMsg); + console.log("ICEcoder error info for your request..."); + console.log(statusObj); + this.serverMessage(); + this.serverQueue('del',0); + } else { + eval(statusObj.action.doNext); + } + // Some other response? Display a message about that + } else { + this.message(t['Sorry there was...']); + console.log("ICEcoder error info for your request..."); + console.log(statusObj); + this.serverMessage(); + this.serverQueue('del',0); + } + } + }; + xhr.open("POST",this.serverQueueItems[0],true); + xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + timeStart = new Date().getTime(); + + // Save as events need to send all contents + if (item.indexOf('action=saveAs')>0) { + xhr.send('timeStart='+timeStart+'&file='+file+'&contents='+encodeURIComponent(document.getElementById('saveTemp1').value)); + // Save evens can just sent the changes + } else if (item.indexOf('action=save')>0) { + xhr.send('timeStart='+timeStart+'&file='+file+'&changes='+encodeURIComponent(document.getElementById('saveTemp1').value)); + // Another type of event + } else { + xhr.send('timeStart='+timeStart+'&file='+file); + } + } else { + + setTimeout(function(ic) { + if ("undefined" != typeof ic.serverQueueItems[0]) { + ic.filesFrame.contentWindow.frames['fileControl'].location.href=ic.serverQueueItems[0]; + } + },1,this); + + } + } + }, + + // Cancel all actions on pressing Esc in non content areas + cancelAllActions: function() { + // Stop whatever the parent may be loading and clear tasks other than the current one + window.stop(); + if (this.serverQueueItems.length>0) { + this.serverQueueItems.splice(1,this.serverQueueItems.length); + } + this.showHide('hide',get('loadingMask')); + this.serverMessage(''+t['Cancelled tasks']+''); + setTimeout(function(ic) {ic.serverMessage();},2000,this); + }, + + // Set the current previousFiles in the settings file + setPreviousFiles: function() { + var previousFiles; + + previousFiles = this.openFiles.join(',').replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,""); + if (previousFiles=="") {previousFiles="CLEAR"}; + // Then send through to the settings page to update setting + this.serverQueue("add",iceLoc+"/lib/settings.php?saveFiles="+encodeURIComponent(previousFiles)+"&csrf="+this.csrf); + this.updateLast10List(previousFiles); + }, + + // Update the list of 10 previous files in browser + updateLast10List: function(previousFiles) { + var newFile, last10Files, last10FilesList; + + // Split our previous files string into an array + previousFiles = previousFiles.split(','); + // For each one of those, if it's not 'CLEAR' we can maybe rotate the list + for (var i=0; i"+previousFiles[i].replace(/\|/g,"/")+"\n"; + + // Get DOM elem for last 10 files + last10Files = this.content.contentWindow.document.getElementById('last10Files'); + + // If the innerHTML of that doesn't contain our new item, we can insert it + if(last10Files.innerHTML.indexOf(newFile) == -1) { + // Get the last 10 files list, pop the last one off and add newFile at start + last10FilesList = last10Files.innerHTML.split("\n"); + if ( + last10FilesList.length >= 10 || // No more than 10 + last10FilesList[0] == '
    [none]


    ' || // Clear out placeholder + last10FilesList[last10FilesList.length-1] == "" // No empty array items + ) { + last10FilesList.pop(); + } + // Update the list + last10Files.innerHTML = newFile + (last10FilesList.join("\n")); + } + } + } + }, + + // Opens the last files we had open + 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'; + } + this.showHide(hide?'hide':'show',get('blackMask')); + }, + + // Show the help screen + helpScreen: function() { + get('mediaContainer').innerHTML = ''; + this.showHide('show',get('blackMask')); + }, + + // Show the backup versions screen + versionsScreen: function(file,versions) { + get('mediaContainer').innerHTML = ''; + this.showHide('show',get('blackMask')); + }, + + // Show the ICEcoder manual, loaded remotely + showManual: function(version,section) { + var sectionExtra; + + sectionExtra = section ? "#"+section : ""; + get('mediaContainer').innerHTML = ''; + this.showHide('show',get('blackMask')); + }, + + // Show the properties screen + propertiesScreen: function(fileName) { + get('mediaContainer').innerHTML = ''; + this.showHide('show',get('blackMask')); + }, + + // Show the auto-logout warning screen + autoLogoutWarningScreen: function() { + get('mediaContainer').innerHTML = ''; + this.showHide('show',get('blackMask')); + }, + + // Show the plugins manager + pluginsManager: function() { + get('mediaContainer').innerHTML = ''; + this.showHide('show',get('blackMask')); + }, + + // Go to localhost root + goLocalhostRoot: function() { + this.filesFrame.contentWindow.frames['fileControl'].location.href = iceLoc+"/lib/go-localhost-root.php"; + }, + + // Show the FTP manager + ftpManager: function() { + get('mediaContainer').innerHTML = ''; + this.showHide('show',get('blackMask')); + }, + + // Update the settings used when we make a change to them + useNewSettings: function(themeURL,codeAssist,lockedNav,tagWrapperCommand,autoComplete,visibleTabs,fontSize,lineWrapping,lineNumbers,showTrailingSpace,matchBrackets,autoCloseTags,autoCloseBrackets,indentWithTabs,indentAuto,indentSize,pluginPanelAligned,scrollbarStyle,bugFilePaths,bugFileCheckTimer,bugFileMaxLines,updateDiffOnSave,autoLogoutMins,refreshFM) { + var styleNode, thisCSS, strCSS, activeLineBG; + + // cut out ?microtime= at the end + var cleanThemeUrl = themeURL.slice(0, themeURL.lastIndexOf("?")); + // find out new theme name without leading path and trailing ".css" + var newTheme = cleanThemeUrl.slice(cleanThemeUrl.lastIndexOf("/")+1,cleanThemeUrl.lastIndexOf(".")); + // if theme was not changed - no need to do all these tricks + if (this.theme !== newTheme){ + // Add new stylesheet for selected theme to editor + this.theme = newTheme; + if (this.theme=="editor") {this.theme="icecoder"}; + styleNode = document.createElement('link'); + styleNode.setAttribute('rel', 'stylesheet'); + styleNode.setAttribute('type', 'text/css'); + styleNode.setAttribute('href', themeURL); + this.content.contentWindow.document.getElementsByTagName('head')[0].appendChild(styleNode); + if (["3024-day","base16-light","eclipse","elegant","mdn-like","neat","neo","paraiso-light","solarized","the-matrix","xq-light"].indexOf(this.theme)>-1) { + activeLineBG = "#ccc"; + } else if (["3024-night","blackboard","colorforth","liquibyte","night","tomorrow-night-bright","tomorrow-night-eighties","vibrant-ink"].indexOf(this.theme)>-1) { + activeLineBG = "#888"; + } else { + activeLineBG = "#000"; + } + this.switchTab(this.selectedTab); + } + + // Check/uncheck Code Assist setting + if (codeAssist != this.codeAssist) { + this.codeAssistToggle(); + } + + // Unlock/lock the file manager + if (lockedNav != this.lockedNav) { + this.lockUnlockNav(); + this.changeFilesW(!lockedNav ? 'contract' : 'expand'); + this.hideFileMenu(); + }; + + // Update font size at top level + thisCSS = document.styleSheets[0]; + strCSS = thisCSS.rules ? 'rules' : 'cssRules'; + thisCSS[strCSS][0].style['fontSize'] = fontSize; + + // Update font size in file manager + thisCSS = this.filesFrame.contentWindow.document.styleSheets[3]; + strCSS = thisCSS.rules ? 'rules' : 'cssRules'; + thisCSS[strCSS][0].style['fontSize'] = fontSize; + + // Update styles in editor + thisCSS = this.content.contentWindow.document.styleSheets[6]; + strCSS = thisCSS.rules ? 'rules' : 'cssRules'; + thisCSS[strCSS][0].style['fontSize'] = fontSize; + thisCSS[strCSS][4].style['border-left-width'] = visibleTabs ? '1px' : '0'; + thisCSS[strCSS][4].style['margin-left'] = visibleTabs ? '-1px' : '0'; + thisCSS[strCSS][2].style.cssText = "background-color: " + activeLineBG + " !important"; + + this.lineWrapping = lineWrapping; + this.lineNumbers = lineNumbers; + this.showTrailingSpace = showTrailingSpace; + this.matchBrackets = matchBrackets; + this.autoCloseTags = autoCloseTags; + this.autoCloseBrackets = autoCloseBrackets; + this.indentWithTabs = indentWithTabs; + this.indentSize = indentSize; + this.indentAuto = indentAuto; + this.scrollbarStyle = scrollbarStyle; + for (var i=0;ichMod '+perms+' on
    '+file.replace(/\|/g,"/")); + }, + + // Open/show the preview window + openPreviewWindow: function() { + if (this.openFiles.length>0) { + var cM, cMdiff, thisCM, filepath, filename, fileExt; + + filepath = this.openFiles[this.selectedTab-1]; + filename = filepath.substr(filepath.lastIndexOf("/")+1); + fileExt = filename.substr(filename.lastIndexOf(".")+1); + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + + this.previewWindowLoading = true; + this.previewWindow = window.open(filepath,"previewWindow",500,500); + if (["md"].indexOf(fileExt) > -1) { + this.previewWindow.onload = function() { + this.previewWindowLoading = false; + this.previewWindow.document.documentElement.innerHTML = mmd(thisCM.getValue()) + }; + } else { + this.previewWindow.onload = function() { + this.previewWindowLoading = false; + // Do the pesticide plugin if it exists + try {this.doPesticide();} catch(err) {}; + // Do the stats.js plugin if it exists + try {this.doStatsJS('open');} catch(err) {}; + // Do the responsive plugin if it exists + try {this.doResponsive();} catch(err) {}; + } + } + } + }, + + // Reset auto-logout timer + resetAutoLogoutTimer: function() { + if(this.autoLogoutMins > 1 && this.autoLogoutTimer > (this.autoLogoutMins*60)-60) { + this.showHide('hide',get('blackMask')); + } + this.autoLogoutTimer = 0; + }, + + // Logout of ICEcoder + logout: function(type) { + window.location = window.location + "?logout&"+(type ? "type="+type+"&" : "")+"csrf="+this.csrf; + }, + + // Show a message + outputMsg: function(msg) { + this.output.innerHTML += msg + "
    "; + }, + + // Show a message + message: function(msg) { + alert(msg); + }, + + // Ask for confirmation + ask: function(question) { + return confirm(question); + }, + + // Get the users input + getInput: function(question,defaultValue) { + return prompt(question,defaultValue); + }, + + // Show a data screen message + dataMessage: function(message) { + var dM; + + dM = this.content.contentWindow.document.getElementById('dataMessage'); + dM.style.display = "block"; + dM.innerHTML = message; + }, + + // Update ICEcoder + update: function() { + var autoUpdate; + + autoUpdate = confirm(t['Please note for...']); + if (autoUpdate) { + this.showHide('show',get('loadingMask')); + window.location = iceLoc+"/lib/updater.php"; + } else { + window.open("https://this.net"); + } + }, + + // ICEcoder just updated + updated: function() { + get('blackMask').style.visibility = "visible"; + get('mediaContainer').innerHTML = '

    Thanks for updating to v'+this.versionNo+'!

    ' + + '

    Click anywhere to continue using this...

    '; + }, + + // XHR object + xhrObj: function(){ + try {return new XMLHttpRequest();}catch(e){} + try {return new ActiveXObject("Msxml3.XMLHTTP");}catch(e){} + try {return new ActiveXObject("Msxml2.XMLHTTP.6.0");}catch(e){} + try {return new ActiveXObject("Msxml2.XMLHTTP.3.0");}catch(e){} + try {return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){} + try {return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){} + return null; + }, + + // Open bug report + openBugReport: function() { + var bugReportOpenFilePos; + + if(this.bugReportStatus=="off") { + this.message(t['You can start...']); + } + if(this.bugReportStatus=="error") { + this.message(t['Error cannot find...']); + } + if(this.bugReportStatus=="ok") { + this.message(t['No new errors...']); + } + if(this.bugReportStatus=="bugs") { + // Close bug-report without saving previousFiles and without confirming close if we made changes on the bug report + var bugReportOpenFilePos = this.openFiles.indexOf(this.bugReportPath.replace(/\|/g,"/")); + if (bugReportOpenFilePos > -1) { + this.closeTab(bugReportOpenFilePos+1,'dontSetPV','dontAsk'); + } + this.openFile(this.bugReportPath); + this.bugFilesSizesSeen = this.bugFilesSizesActual; + } + }, + + // Start bug checking by looking in bug file paths on a timer + startBugChecking: function() { + var bugCheckURL; + + if (this.bugFileCheckTimer !== 0) { + // Clear any existing interval + if ("undefined" != typeof this.bugFileCheckInt) { + clearInterval(this.bugFileCheckInt); + } + // Start a new timer + this.bugFilesSizesSeen = []; + this.bugFileCheckInt = setInterval(function(ic) { + bugCheckURL = iceLoc+"/lib/bug-files-check.php?"; + bugCheckURL += "files="+(ic.bugFilePaths[0] !== "" ? ic.bugFilePaths.join() : "null").replace(/\//g,"|"); + bugCheckURL += "&filesSizesSeen="; + if (ic.bugFilesSizesSeen.length != ic.bugFilePaths.length) { + // Fill the array with nulls + for (var i=0; i/g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); + }, + + // Print code of current tab + printCode: function() { + var cM, cMdiff, thisCM, printIFrame; + + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + printIFrame = this.filesFrame.contentWindow.frames['fileControl']; + // Print page content injected into iFrame, escaped with pre and xssClean + printIFrame.window.document.body.innerHTML = 'ICEcoder code output
    '+this.xssClean(thisCM.getValue())+'
    '; + printIFrame.focus(); + printIFrame.print(); + // Focus back on code + thisCM.focus(); + }, + + // Update the title tag to indicate any changes + indicateChanges: function() { + var winTitle; + + if (!this.loadingFile) { + winTitle = "ICEcoder v "+this.versionNo; + for(var i=1;i<=this.savedPoints.length;i++) { + if (this.savedPoints[i-1]!=this.getcMInstance(i).changeGeneration()) { + // We have an unsaved tab, indicate that in the title + winTitle += " \u2744"; + break; + } + } + document.title = winTitle; + } + }, // ============== // TABS // ============== - // Change tabs by switching visibility of instances - switchTab: function(newTab,noFocus) { - var cM, cMdiff, thisCM; + // Change tabs by switching visibility of instances + switchTab: function(newTab,noFocus) { + var cM, cMdiff, thisCM; - // If we're not switching to same tab (for some reason), note the previous tab - if (newTab !== this.selectedTab) { - this.prevTab = this.selectedTab; - } + // If we're not switching to same tab (for some reason), note the previous tab + if (newTab !== this.selectedTab) { + this.prevTab = this.selectedTab; + } - // Identify tab that's currently selected & get the instance - this.selectedTab = newTab; - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + // Identify tab that's currently selected & get the instance + this.selectedTab = newTab; + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - if (thisCM) { - // Switch mode to HTML, PHP, CSS etc - this.switchMode(); + if (thisCM) { + // Switch mode to HTML, PHP, CSS etc + this.switchMode(); - // Set all cM instances to be hidden, then make our selected instance visible - for (var i=0;i thisCM.getScrollInfo().clientHeight; - ic.setLayout(); - },0,this); + // Detect if we have a scrollbar & set layout again + setTimeout(function(ic) { + ic.scrollBarVisible = thisCM.getScrollInfo().height > thisCM.getScrollInfo().clientHeight; + ic.setLayout(); + },0,this); - // Finally, update the cursor display - this.getCaretPosition(); - this.updateCharDisplay(); - this.updateByteDisplay(); - } - }, + // Finally, update the cursor display + this.getCaretPosition(); + this.updateCharDisplay(); + this.updateByteDisplay(); + } + }, - // Starts a new file by setting a few vars & creating a new cM instance - newTab: function(alsoSave) { - var cM; + // Starts a new file by setting a few vars & creating a new cM instance + newTab: function(alsoSave) { + var cM; - this.cMInstances.push(this.nextcMInstance); - this.selectedTab = this.cMInstances.length; - this.showHide('show',this.content); - this.content.contentWindow.createNewCMInstance(this.nextcMInstance); - this.setLayout(); + this.cMInstances.push(this.nextcMInstance); + this.selectedTab = this.cMInstances.length; + this.showHide('show',this.content); + this.content.contentWindow.createNewCMInstance(this.nextcMInstance); + this.setLayout(); - this.thisFileFolderType='file'; - this.thisFileFolderLink='/[NEW]'; - this.openFile(); + this.thisFileFolderType='file'; + this.thisFileFolderLink='/[NEW]'; + this.openFile(); - cM = this.getcMInstance('new'); - this.switchTab(this.openFiles.length); + cM = this.getcMInstance('new'); + this.switchTab(this.openFiles.length); - cM.removeLineClass(this['cMActiveLinecM'+this.cMInstances[this.selectedTab-1]], "background"); - this['cMActiveLinecM'+this.selectedTab] = cM.addLineClass(0, "background", "cm-s-activeLine"); - this.nextcMInstance++; + cM.removeLineClass(this['cMActiveLinecM'+this.cMInstances[this.selectedTab-1]], "background"); + this['cMActiveLinecM'+this.selectedTab] = cM.addLineClass(0, "background", "cm-s-activeLine"); + this.nextcMInstance++; - // Also save? - if (alsoSave) { - this.saveFile(); - } - }, + // Also save? + if (alsoSave) { + this.saveFile(); + } + }, - // Create a new tab for a file - createNewTab: function(isNew) { - var closeTabLink, fileName; + // Create a new tab for a file + createNewTab: function(isNew) { + var closeTabLink, fileName; - // Push new file into array - this.openFiles.push(this.shortURL); + // Push new file into array + this.openFiles.push(this.shortURL); - // Setup a new tab - closeTabLink = ''; - get('tab'+(this.openFiles.length)).style.display = "inline-block"; - fileName = this.openFiles[this.openFiles.length-1]; - get('tab'+(this.openFiles.length)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); - get('tab'+(this.openFiles.length)).title = "/" + this.openFiles[this.openFiles.length-1].replace(/\//,""); + // Setup a new tab + closeTabLink = ''; + get('tab'+(this.openFiles.length)).style.display = "inline-block"; + fileName = this.openFiles[this.openFiles.length-1]; + get('tab'+(this.openFiles.length)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); + get('tab'+(this.openFiles.length)).title = "/" + this.openFiles[this.openFiles.length-1].replace(/\//,""); - // Set the widths - this.setTabWidths(); + // Set the widths + this.setTabWidths(); - // Highlight it and state it's selected - this.redoTabHighlight(this.openFiles.length); - this.selectedTab=this.openFiles.length; + // Highlight it and state it's selected + this.redoTabHighlight(this.openFiles.length); + this.selectedTab=this.openFiles.length; - // Add a new value ready to indicate if this content has been changed - this.savedPoints.push(0); - this.savedContents.push(""); + // Add a new value ready to indicate if this content has been changed + this.savedPoints.push(0); + this.savedContents.push(""); - if (!isNew) { - this.setPreviousFiles(); - } - }, + if (!isNew) { + this.setPreviousFiles(); + } + }, - // Cycle to next tab - nextTab: function() { - var goToTab; + // Cycle to next tab + nextTab: function() { + var goToTab; - goToTab = this.selectedTab+1 <= this.openFiles.length ? this.selectedTab+1 : 1; - this.switchTab(goToTab,'noFocus'); - }, + goToTab = this.selectedTab+1 <= this.openFiles.length ? this.selectedTab+1 : 1; + this.switchTab(goToTab,'noFocus'); + }, - // Cycle to next tab - previousTab: function() { - var goToTab; + // Cycle to next tab + previousTab: function() { + var goToTab; - goToTab = this.selectedTab-1 >= 1 ? this.selectedTab-1 : this.openFiles.length; - this.switchTab(goToTab,'noFocus'); - }, + goToTab = this.selectedTab-1 >= 1 ? this.selectedTab-1 : this.openFiles.length; + this.switchTab(goToTab,'noFocus'); + }, - // Create a new tab for a file - renameTab: function(tabNum,newName) { - var closeTabLink, fileName; + // Create a new tab for a file + renameTab: function(tabNum,newName) { + var closeTabLink, fileName; - // Push new file into array - this.openFiles[tabNum-1] = newName; + // Push new file into array + this.openFiles[tabNum-1] = newName; - // Setup a new tab - closeTabLink = ''; - fileName = this.openFiles[tabNum-1]; - get('tab'+tabNum).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); - get('tab'+tabNum).title = "/" + this.openFiles[tabNum-1].replace(/\//,""); - }, + // Setup a new tab + closeTabLink = ''; + fileName = this.openFiles[tabNum-1]; + get('tab'+tabNum).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,""); + get('tab'+tabNum).title = "/" + this.openFiles[tabNum-1].replace(/\//,""); + }, - // Reset all tabs to be without a highlight and then highlight the selected - redoTabHighlight: function(selectedTab) { - var tColor, fileLink; + // Reset all tabs to be without a highlight and then highlight the selected + redoTabHighlight: function(selectedTab) { + var tColor, fileLink; - for(var i=1;i<=this.savedPoints.length;i++) { - if (get('tab'+i).childNodes[0]) { - get('tab'+i).childNodes[0].childNodes[0].style.backgroundColor = this.savedPoints[i-1]!=this.getcMInstance(i).changeGeneration() - ? "#b00" : "transparent"; - } + for(var i=1;i<=this.savedPoints.length;i++) { + if (get('tab'+i).childNodes[0]) { + get('tab'+i).childNodes[0].childNodes[0].style.backgroundColor = this.savedPoints[i-1]!=this.getcMInstance(i).changeGeneration() + ? "#b00" : "transparent"; + } - tColor = i==selectedTab ? this.tabFGselected : this.tabFGnormalTab; - if ("undefined" != typeof this.openFiles[i-1] && this.openFiles[i-1] != "/[NEW]") { - fileLink = this.filesFrame.contentWindow.document.getElementById(this.openFiles[i-1].replace(/\//g,"|")); - if (fileLink) { - fileLink.style.backgroundColor = i==selectedTab ? this.tabBGcurrent : this.tabBGopen; - fileLink.style.color = i==selectedTab ? this.tabFGcurrent : this.tabFGopenFile; - }; - } - get('tab'+i).style.color = tColor; - get('tab'+i).style.background = i==selectedTab ? this.tabBGcurrent : this.tabBGopen; - } - }, + tColor = i==selectedTab ? this.tabFGselected : this.tabFGnormalTab; + if ("undefined" != typeof this.openFiles[i-1] && this.openFiles[i-1] != "/[NEW]") { + fileLink = this.filesFrame.contentWindow.document.getElementById(this.openFiles[i-1].replace(/\//g,"|")); + if (fileLink) { + fileLink.style.backgroundColor = i==selectedTab ? this.tabBGcurrent : this.tabBGopen; + fileLink.style.color = i==selectedTab ? this.tabFGcurrent : this.tabFGopenFile; + }; + } + get('tab'+i).style.color = tColor; + get('tab'+i).style.background = i==selectedTab ? this.tabBGcurrent : this.tabBGopen; + } + }, - // Close the tab upon request - closeTab: function(closeTabNum, dontSetPV, dontAsk) { - var cM, cMdiff, thisCM, okToRemove, closeFileName; + // Close the tab upon request + closeTab: function(closeTabNum, dontSetPV, dontAsk) { + var cM, cMdiff, thisCM, okToRemove, closeFileName; - // If we haven't specified, close current tab - if (!closeTabNum) {closeTabNum = this.selectedTab}; + // If we haven't specified, close current tab + if (!closeTabNum) {closeTabNum = this.selectedTab}; - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - okToRemove = true; - if (!dontAsk && this.savedPoints[closeTabNum-1]!=this.getcMInstance(closeTabNum).changeGeneration()) { - okToRemove = this.ask(t['You have made...']); - } + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + okToRemove = true; + if (!dontAsk && this.savedPoints[closeTabNum-1]!=this.getcMInstance(closeTabNum).changeGeneration()) { + okToRemove = this.ask(t['You have made...']); + } - if (okToRemove) { - // Get the filename of tab we're closing - closeFileName = this.openFiles[closeTabNum-1]; + if (okToRemove) { + // Get the filename of tab we're closing + closeFileName = this.openFiles[closeTabNum-1]; - // recursively copy over all tabs & data from the tab to the right, if there is one - for (var i=closeTabNum;i0 ? this.selectedTab-=1 : this.selectedTab = 0; - } - if (this.openFiles.length>0 && this.selectedTab==0) {this.selectedTab=1}; + // recursively copy over all tabs & data from the tab to the right, if there is one + for (var i=closeTabNum;i0 ? this.selectedTab-=1 : this.selectedTab = 0; + } + if (this.openFiles.length>0 && this.selectedTab==0) {this.selectedTab=1}; - // grey out the view icon - if (this.openFiles.length==0) { - this.fMIconVis('fMView',0.3); - } else { - // Switch the mode & the tab - this.switchMode(); - this.switchTab(this.selectedTab); - } - // Highlight the selected tab after splicing the change state out of the array - this.savedPoints.splice(closeTabNum-1,1); - this.savedContents.splice(closeTabNum-1,1); - this.redoTabHighlight(this.selectedTab); + // grey out the view icon + if (this.openFiles.length==0) { + this.fMIconVis('fMView',0.3); + } else { + // Switch the mode & the tab + this.switchMode(); + this.switchTab(this.selectedTab); + } + // Highlight the selected tab after splicing the change state out of the array + this.savedPoints.splice(closeTabNum-1,1); + this.savedContents.splice(closeTabNum-1,1); + this.redoTabHighlight(this.selectedTab); - // Remove any highlighting from the file manager - this.selectDeselectFile('deselect',this.filesFrame.contentWindow.document.getElementById(closeFileName.replace(/\//g,"|"))); + // Remove any highlighting from the file manager + this.selectDeselectFile('deselect',this.filesFrame.contentWindow.document.getElementById(closeFileName.replace(/\//g,"|"))); - if (!dontSetPV) { - this.setPreviousFiles(); - } + if (!dontSetPV) { + this.setPreviousFiles(); + } - // Update the versions display - this.updateVersionsDisplay(); + // Update the versions display + this.updateVersionsDisplay(); - // Update the title tag to indicate any changes - this.indicateChanges(); - } - // Lastly, stop it from trying to also switch tab - this.canSwitchTabs=false; - // and set the widths - this.setTabWidths('posOnlyNewTab'); - setTimeout(function(ic) {ic.canSwitchTabs=true;},100,this); - }, + // Update the title tag to indicate any changes + this.indicateChanges(); + } + // Lastly, stop it from trying to also switch tab + this.canSwitchTabs=false; + // and set the widths + this.setTabWidths('posOnlyNewTab'); + setTimeout(function(ic) {ic.canSwitchTabs=true;},100,this); + }, - // Close all tabs - closeAllTabs: function() { - if (this.cMInstances.length>0 && this.ask(t['Close all tabs'])) { - for (var i=this.cMInstances.length; i>0; i--) { - this.closeTab(i, i>1? true:false); - } - } - // Update the title tag to indicate any changes - this.indicateChanges(); - }, + // Close all tabs + closeAllTabs: function() { + if (this.cMInstances.length>0 && this.ask(t['Close all tabs'])) { + for (var i=this.cMInstances.length; i>0; i--) { + this.closeTab(i, i>1? true:false); + } + } + // Update the title tag to indicate any changes + this.indicateChanges(); + }, - // Set the tabs width - setTabWidths: function(posOnlyNewTab) { - var availWidth, avgWidth, tabWidth, lastLeft, lastWidth; + // Set the tabs width + setTabWidths: function(posOnlyNewTab) { + var availWidth, avgWidth, tabWidth, lastLeft, lastWidth; - if (this.ready) { - availWidth = parseInt(this.content.style.width,10)-53-22-10; // - left margin - new tab - right margin - avgWidth = (availWidth/this.openFiles.length)-18; - tabWidth = -18; // Incl 18px offset - lastLeft = 53; - lastWidth = 0; - this.tabLeftPos = []; - for (var i=0;i availWidth ? parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10) : 150; - lastLeft = i==0 ? 53 : parseInt(get('tab'+(i)).style.left,10); - lastWidth = i==0 ? 0 : parseInt(get('tab'+(i)).style.width,10)+18; - if (!posOnlyNewTab) { - get('tab'+(i+1)).style.left = (lastLeft+lastWidth) + "px"; - get('tab'+(i+1)).style.width = tabWidth + "px"; - } else { - tabWidth = -18; - } - this.tabLeftPos.push(lastLeft+lastWidth); - } - get('newTab').style.left = (lastLeft+lastWidth+tabWidth+18) + "px"; - } - }, + if (this.ready) { + availWidth = parseInt(this.content.style.width,10)-53-22-10; // - left margin - new tab - right margin + avgWidth = (availWidth/this.openFiles.length)-18; + tabWidth = -18; // Incl 18px offset + lastLeft = 53; + lastWidth = 0; + this.tabLeftPos = []; + for (var i=0;i availWidth ? parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10) : 150; + lastLeft = i==0 ? 53 : parseInt(get('tab'+(i)).style.left,10); + lastWidth = i==0 ? 0 : parseInt(get('tab'+(i)).style.width,10)+18; + if (!posOnlyNewTab) { + get('tab'+(i+1)).style.left = (lastLeft+lastWidth) + "px"; + get('tab'+(i+1)).style.width = tabWidth + "px"; + } else { + tabWidth = -18; + } + this.tabLeftPos.push(lastLeft+lastWidth); + } + get('newTab').style.left = (lastLeft+lastWidth+tabWidth+18) + "px"; + } + }, - // Tab dragging start - tabDragStart: function(tab) { - this.draggingTab = tab; - this.diffStartX = this.mouseX; - this.tabDragMouseXStart = (this.mouseX - (parseInt(this.files.style.width,10)+53+18)) % 150; - // Put tab we're dragging over others - get('tab'+tab).style.zIndex = 2; - // Set classes for other tabs (tabSlide) and the one we're dragging (tabDrag) - for (var i=1; i<=this.openFiles.length; i++) { - get('tab'+i).className = i!==tab - ? "tab tabSlide" - : "tab tabDrag"; - } - }, + // Tab dragging start + tabDragStart: function(tab) { + this.draggingTab = tab; + this.diffStartX = this.mouseX; + this.tabDragMouseXStart = (this.mouseX - (parseInt(this.files.style.width,10)+53+18)) % 150; + // Put tab we're dragging over others + get('tab'+tab).style.zIndex = 2; + // Set classes for other tabs (tabSlide) and the one we're dragging (tabDrag) + for (var i=1; i<=this.openFiles.length; i++) { + get('tab'+i).className = i!==tab + ? "tab tabSlide" + : "tab tabDrag"; + } + }, - // Tab dragging - tabDragMove: function() { - var lastTabWidth, thisLeft, dragTabNo, tabWidth; + // Tab dragging + tabDragMove: function() { + var lastTabWidth, thisLeft, dragTabNo, tabWidth; - lastTabWidth = parseInt(get('tab'+this.openFiles.length).style.width,10)+18; + lastTabWidth = parseInt(get('tab'+this.openFiles.length).style.width,10)+18; - // Set the left position but stay within left side (53) and new tab - this.thisLeft = thisLeft = this.tabDragMouseX >= 53 - ? this.tabDragMouseX <= parseInt(get('newTab').style.left,10) - lastTabWidth - ? this.tabDragMouseX : (parseInt(get('newTab').style.left,10) - lastTabWidth) : 53; + // Set the left position but stay within left side (53) and new tab + this.thisLeft = thisLeft = this.tabDragMouseX >= 53 + ? this.tabDragMouseX <= parseInt(get('newTab').style.left,10) - lastTabWidth + ? this.tabDragMouseX : (parseInt(get('newTab').style.left,10) - lastTabWidth) : 53; - get('tab'+this.draggingTab).style.left = thisLeft + "px"; + get('tab'+this.draggingTab).style.left = thisLeft + "px"; - this.dragTabNo = dragTabNo = this.draggingTab; + this.dragTabNo = dragTabNo = this.draggingTab; - // Set the opacities of tabs then positions of tabs we're not dragging - for (var i=1; i<=this.openFiles.length; i++) { - get('tab'+i).style.opacity = i == this.draggingTab ? 1 : 0.5; - tabWidth = this.tabLeftPos[i] ? this.tabLeftPos[i] - this.tabLeftPos[i-1] : tabWidth; - if (i!=this.draggingTab) { - if (i < this.draggingTab) { - get('tab'+i).style.left = thisLeft <= this.tabLeftPos[i-1] - ? this.tabLeftPos[i-1]+tabWidth - : this.tabLeftPos[i-1]; - } else { - get('tab'+i).style.left = thisLeft >= this.tabLeftPos[i-1] - ? this.tabLeftPos[i-1]-tabWidth - : this.tabLeftPos[i-1]; - } - } - } - }, + // Set the opacities of tabs then positions of tabs we're not dragging + for (var i=1; i<=this.openFiles.length; i++) { + get('tab'+i).style.opacity = i == this.draggingTab ? 1 : 0.5; + tabWidth = this.tabLeftPos[i] ? this.tabLeftPos[i] - this.tabLeftPos[i-1] : tabWidth; + if (i!=this.draggingTab) { + if (i < this.draggingTab) { + get('tab'+i).style.left = thisLeft <= this.tabLeftPos[i-1] + ? this.tabLeftPos[i-1]+tabWidth + : this.tabLeftPos[i-1]; + } else { + get('tab'+i).style.left = thisLeft >= this.tabLeftPos[i-1] + ? this.tabLeftPos[i-1]-tabWidth + : this.tabLeftPos[i-1]; + } + } + } + }, - // Tab dragging end - tabDragEnd: function() { - var swapWith, tempArray; + // Tab dragging end + tabDragEnd: function() { + var swapWith, tempArray; - // Set the tab widths - this.setTabWidths(); - // Determin what tabs we've swapped and reset classname, opacity & z-index for all - for (var i=1; i<=this.openFiles.length; i++) { - if (this.thisLeft >= this.tabLeftPos[i-1]) { - swapWith = this.thisLeft == this.tabLeftPos[0] ? 1 : this.dragTabNo > i ? i+1 : i; - } - get('tab'+i).className = "tab"; - get('tab'+i).style.opacity = 1; - if (i!=this.dragTabNo) { - get('tab'+i).style.zIndex = 1; - } else { - setTimeout(function() { - get('tab'+i).style.zIndex = 1; - },150); - } - } - if (this.thisLeft && this.thisLeft!==false) { - // Make a number ascending array - tempArray = []; - for (var i=1;i<=this.openFiles.length;i++) { - tempArray.push(i); - } - // Then swap our tab numbers - tempArray.splice(this.dragTabNo-1,1); - tempArray.splice(swapWith-1,0,this.dragTabNo); - // Now we have an order to sort against - this.sortTabs(tempArray); - } - this.setTabWidths(); - this.draggingTab = false; - this.thisLeft = false; - }, + // Set the tab widths + this.setTabWidths(); + // Determin what tabs we've swapped and reset classname, opacity & z-index for all + for (var i=1; i<=this.openFiles.length; i++) { + if (this.thisLeft >= this.tabLeftPos[i-1]) { + swapWith = this.thisLeft == this.tabLeftPos[0] ? 1 : this.dragTabNo > i ? i+1 : i; + } + get('tab'+i).className = "tab"; + get('tab'+i).style.opacity = 1; + if (i!=this.dragTabNo) { + get('tab'+i).style.zIndex = 1; + } else { + setTimeout(function() { + get('tab'+i).style.zIndex = 1; + },150); + } + } + if (this.thisLeft && this.thisLeft!==false) { + // Make a number ascending array + tempArray = []; + for (var i=1;i<=this.openFiles.length;i++) { + tempArray.push(i); + } + // Then swap our tab numbers + tempArray.splice(this.dragTabNo-1,1); + tempArray.splice(swapWith-1,0,this.dragTabNo); + // Now we have an order to sort against + this.sortTabs(tempArray); + } + this.setTabWidths(); + this.draggingTab = false; + this.thisLeft = false; + }, - // Sort tabs into new order - sortTabs: function(newOrder) { - var a, b, savedPoints = [], savedContents = [], openFiles = [], openFileMDTs = [], openFileVersions = [], cMInstances = [], selectedTabWillBe; + // Sort tabs into new order + sortTabs: function(newOrder) { + var a, b, savedPoints = [], savedContents = [], openFiles = [], openFileMDTs = [], openFileVersions = [], cMInstances = [], selectedTabWillBe; - // Setup an array of our actual arrays and the blank ones - a = [this.savedPoints, this.savedContents, this.openFiles, this.openFileMDTs, this.openFileVersions, this.cMInstances]; - b = [savedPoints, savedContents, openFiles, openFileMDTs, openFileVersions, cMInstances]; - // Push the new order values into array b then set into array a - for (var i=0;i0) { - var currentArray, currentArrayFull, alphaArray, nextValue, nextPos; + // Alphabetize tabs + alphaTabs: function() { + if (this.openFiles.length>0) { + var currentArray, currentArrayFull, alphaArray, nextValue, nextPos; - currentArray = []; - currentArrayFull = []; - alphaArray = []; - // Get filenames, full paths and set classname for sliding - for (var i=0;i0) { - nextValue = currentArray[0]; - nextValueFull = currentArrayFull[0]; - nextPos = 0; - for (var i=0;i0) { + nextValue = currentArray[0]; + nextValueFull = currentArrayFull[0]; + nextPos = 0; + for (var i=0;i startCG-5) { - cM.undo(); - undoCounts++; - } - // If we have content saved - if (ic.savedPoints[ic.selectedTab-1] == cM.changeGeneration()) { - // Start snake game - ic.startSnake(); - // If we don't, redo snake word - } else { - for (var i=1; i<=undoCounts; i++) { - cM.redo(); - } - } - },0,this); - } - - // Detect arrow keys if playing snake - if (this.snakePlaying) { - if (key==37) {this.snakeDir = 'left'} - if (key==39) {this.snakeDir = 'right'} - if (key==38) {this.snakeDir = 'up'} - if (key==40) {this.snakeDir = 'down'} - return false; - } - - // Mac command key handling (224 = Moz, 91/93 = Webkit Left/Right Apple) - if (key==224 || key==91 || key==93) { - this.cmdKey = true; - } - - // F1 (zoom code out non declaration lines) - if (key === 112) { - if (this.codeZoomedOut) { - return; - } - this.codeZoomedOut = true; - - cM = this.getcMInstance(); - // For every line in the current editor, add code-zoomed-out class if not a function/class declaration line - for (var i=0; i -1 ? true : false);return false;} - else {return key;} - // Alt+Enter (Insert Line After) - } else if (key==13) { - this.insertLineAfter(); - return false; - } else {return key;} - - } else { - - // Shift+Enter (Insert Line Before) - if(key==13 && evt.shiftKey) { - this.insertLineBefore(); - return false; - - // CTRL/Cmd+F (Find next) - // and - // CTRL/Cmd+G (Find previous) - } else if((key==70||key==71) && (evt.ctrlKey||this.cmdKey)) { - var find = get('find'); - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - var selections = thisCM.getSelections(); - if (selections.length > 0){ - if (selections[0].length > 0){ - find.value = selections[0]; - } - } - find.select(); - // this is trick for Chrome - after you have used Ctrl-F once, when - // you try using Ctrl-F another time, somewhy Chrome still thinks, - // that find has focus and refuses to give it focus second time. - get('goToLineNo').focus(); - find.focus(); - // Trigger the find/replace operation - if(key==70) { - // Find next - get('findReplaceSubmit').click(); - } else { - // Find previous - this.findReplace(document.getElementById('find').value,false,true,false,'findPrevious'); - } - return false; - - // CTRL/Cmd+L (Go to line) - } else if(key==76 && (evt.ctrlKey||this.cmdKey)) { - var goToLineInput = get('goToLineNo'); - goToLineInput.select(); - // this is trick for Chrome - after you have used Ctrl-F once, when - // you try using Ctrl-F another time, somewhy Chrome still thinks, - // that find has focus and refuses to give it focus second time. - get('find').focus(); - goToLineInput.focus(); - return false; - - // CTRL/Cmd+I (Get info) - } else if(key==73 && (evt.ctrlKey||this.cmdKey) && area == "content") { - this.searchForSelected(); - return false; - - // CTRL/Cmd+backspace arrow (Go to previous tab selected) - } else if(key==8 && (evt.ctrlKey||this.cmdKey)) { - if (this.prevTab !== 0) { - this.switchTab(this.prevTab); - } - return false; - - // CTRL/Cmd+right arrow (Tab to right) - } else if(key==39 && (evt.ctrlKey||this.cmdKey) && area!="content") { - this.nextTab(); - return false; - - // CTRL/Cmd+left arrow (Tab to left) - } else if(key==37 && (evt.ctrlKey||this.cmdKey) && area!="content") { - this.previousTab(); - return false; - - // CTRL/Cmd+up arrow (Move line up) - } else if(key==38 && (evt.ctrlKey||this.cmdKey) && area=="content") { - this.moveLines('up'); - return false; - - // CTRL/Cmd+down arrow (Move line down) - } else if(key==40 && (evt.ctrlKey||this.cmdKey) && area=="content") { - this.moveLines('down'); - return false; - - // CTRL/Cmd+numeric plus (New tab) - } else if((key==107 || key==187) && (evt.ctrlKey||this.cmdKey)) { - area=="content" - ? this.duplicateLines() - : this.newTab(); - return false; - - // CTRL/Cmd+numeric minus (Close tab) - } else if((key==109 || key==189) && (evt.ctrlKey||this.cmdKey)) { - area=="content" - ? this.removeLines() - : this.closeTab(this.selectedTab); - return false; - - // CTRL/Cmd+S (Save), CTRL/Cmd+Shift+S (Save As) - } else if(key==83 && (evt.ctrlKey||this.cmdKey)) { - if(evt.shiftKey) { - this.saveFile('saveAs'); - } else { - this.saveFile(); - } - return false; - - // CTRL/Cmd+Enter (Open Webpage) - } else if(key==13 && (evt.ctrlKey||this.cmdKey) && this.openFiles[this.selectedTab-1] != "/[NEW]") { - this.resetKeys(evt); - window.open(this.openFiles[this.selectedTab-1]); - return false; - - // Enter (Expand dir/open file) - } else if(key==13 && area=="files") { - if(!evt.ctrlKey && !this.cmdKey) { - if (this.selectedFiles.length == 0) { - this.overFileFolder('folder', '|'); - this.selectFileFolder('init'); - } - this.fmAction(evt,'enter'); - } - return false; - - // Up/down/left/right arrows (Traverse files) - } else if((key==38||key==40||key==37||key==39) && area=="files") { - if(!evt.ctrlKey && !this.cmdKey) { - if (this.selectedFiles.length == 0) { - this.overFileFolder('folder', '|'); - this.selectFileFolder('init'); - } - this.fmAction(evt, - key==38 ? 'up' : - key==40 ? 'down' : - key==37 ? 'left' : - 'right'); - } - return false; - - // CTRL/Cmd+O (Open Prompt) - } else if(key==79 && (evt.ctrlKey||this.cmdKey)) { - this.openPrompt(); - return false; - - // CTRL/Cmd+Space (Add snippet) - } else if(key==32 && (evt.ctrlKey||this.cmdKey) && area=="content") { - this.addSnippet(); - return false; - - // CTRL/Cmd+J (Jump to definition/back again) - } else if(key==74 && (evt.ctrlKey||this.cmdKey) && area=="content") { - this.jumpToDefinition(); - return false; - - // CTRL + Tab (lock/unlock file manager) - } else if(key==223 && (evt.ctrlKey||this.cmdKey)) { - this.lockUnlockNav(); - this.changeFilesW(this.lockedNav ? 'expand' : 'contract'); - return false; - - // CTRL + . (Fold/unfold current line) - } else if(key==190 && (evt.ctrlKey||this.cmdKey)) { - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - var line = thisCM.getCursor().line; - - return false; - - // ESC in content area (Comment/Uncomment line) - } else if(key==27 && area == "content") { - cM = this.getcMInstance(); - cMdiff = this.getcMdiffInstance(); - thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; - - if (thisCM.getSelections().length > 1) { - thisCM.execCommand("singleSelection"); - } else { - this.lineCommentToggle(); - } - return false; - - // ESC not in content area (Cancel all actions) - } else if(key==27 && area != "content") { - this.cancelAllActions(); - return false; - - // Any other key - } else { - return key; - } - } - }, - - // Reset the state of keys back to the normal state - resetKeys: function(evt) { - var key, cM; - - key = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode; - - if (key == 112 && this.codeZoomedOut) { - cM = this.getcMInstance(); - // For every line in the current editor, remove code-zoomed-out class if not a function/class declaration line - for (var i=0; i -1 ? cMdiff : cM; - lineNo = thisCM.getCursor().line; - whiteSpace = thisCM.getLine(lineNo).length - thisCM.getLine(lineNo).replace(/^\s\s*/, '').length; - content = thisCM.getLine(lineNo).slice(whiteSpace); - // function snippet - if (content.slice(0,8)=="function") { - this.doSnippet('function','function VAR() {\nINDENT\tCURSOR\nINDENT}'); - // if snippet - } else if (content.slice(0,2)=="if") { - this.doSnippet('if','if (CURSOR) {\nINDENT\t\nINDENT}'); - // for snippet - } else if (content.slice(0,3)=="for") { - this.doSnippet('for','for (var i=0; i -1 ? cMdiff : cM; - lineNo = thisCM.getCursor().line; - lineContents = thisCM.getLine(lineNo); - - // Find our target string - if (lineContents.indexOf(tgtString)>-1) { - // Get text on the line from our target to the end - remainder = thisCM.getLine(lineNo); - strPos = remainder.indexOf(tgtString); - remainder = remainder.slice(remainder.indexOf(tgtString)+tgtString.length+1); - // Replace the function name if any - replaceString = replaceString.replace(/VAR/g,remainder); - // Get replaced string from start to our strPos - replacedLine = thisCM.getLine(lineNo).slice(0,strPos); - // Trim whitespace from start - whiteSpace = thisCM.getLine(lineNo).length - thisCM.getLine(lineNo).replace(/^\s\s*/, '').length; - whiteSpace = thisCM.getLine(lineNo).slice(0,whiteSpace); - // Replace indent with whatever whitespace we have - replaceString = replaceString.replace(/INDENT/g,whiteSpace); - replacedLine += replaceString; - // Get cursor position - curPos = replacedLine.indexOf("CURSOR"); - sPos = 0; - lineNoCount = lineNo; - for (i=0;i -1 ? true : false); - } - }, - - viewTutorial: function(step, delay) { - var winW, winH; - - winW = window.innerWidth; - winH = window.innerHeight; - - var steps = { - 0: { - "width": 250, - "height": 55, - "top": -55, - "left": 0, - "title": "

    Code editor awesomeness ...in your browser", - "message": "View the quick start tutorial? (Well worthwhile!) or skip it", - "button": "view tutorial" - }, - 1: { - "width": 250, - "height": 55, - "top": 0, - "left": 0, - "title": "Options and settings", - "message": "Here you can perform file and editor content actions, plus also customise ICEcoders' settings, switch to other file manager sources, view help, search for info and more.", - "button": "next >" - }, - 2: { - "width": 250, - "height": winH - 85, - "top": 50, - "left": 0, - "title": "File manager", - "message": "This is the file manager. Click a dir to open/close, double click a file to open it and right click on dirs/files to get relevant options. You can drag and drop too.", - "button": "next >" - }, - 3: { - "width": 45, - "height": 85, - "top": 50, - "left": 205, - "title": "File manager options and plugins", - "message": "Here you can unlock/lock the file manager to collapse/expand it, refresh the file manager plus view and install plugins. (Also, move your mouse to left edge of file manager for quick access to the plugins).", - "button": "next >" - }, - 4: { - "width": 250, - "height": 35, - "top": winH - 35, - "left": 0, - "title": "Extra tools", - "message": "Get access to the terminal, output, database and Git interfaces here, displayed as an overlay to get the largest display, click option again to slide overlay out.", - "button": "next >" - }, - 5: { - "width": winW - 250, - "height": 42, - "top": 0, - "left": 250, - "title": "Editor tabs", - "message": "Your opened tabs will appear here. Icons displayed are to close all, alphabetize tabs and add new tab. You can drag your open tabs left/right to sort them too.", - "button": "next >" - }, - 6: { - "width": 440, - "height": 28, - "top": 42, - "left": 250, - "title": "Find and replace builder", - "message": "This is the find and replace builder. Here you can use the text fields and dropdown menus to build up sentences of what you'd like to do, such as find and replace in editor content, files and filenames.", - "button": "next >" - }, - 7: { - "width": 200, - "height": 28, - "top": 42, - "left": winW - 200, - "title": "Editor options and bug reporting", - "message": "Here you can specify the line to jump to (editor jumps as you type, hit Enter to focus on editor), plus options to view the current tab as a webpage in new browser window and view bugs as you code (once targeted at error logs).", - "button": "next >" - }, - 8: { - "width": 520, - "height": 380, - "top": 70, - "left": 250, - "title": "System info", - "message": "This is general info about your server, paths, browser and more. Worth noting to ensure settings seem correct.", - "button": "next >" - }, - 9: { - "width": 32, - "height": 30, - "top": winH - 30, - "left": 250, - "title": "Editor content error indicator and version control", - "message": "Error indicator for syntax or structural issues in the editor content. Also, when you have a tab open, on every save, it makes a copy - click the number of backups it indicates, to view differences and options to restore old versions.", - "button": "next >" - }, - 10: { - "width": 100, - "height": 30, - "top": winH - 30, - "left": (((winW + 250) / 2) - 50), - "title": "Editor pane mode", - "message": "Switch between single pane and diff pane modes. The diff pane automatically sets a copy on each save, so you can undo/redo to cycle through those. The gutters indicate additions, changes and deletions on each line.", - "button": "next >" - }, - 11: { - "width": 100, - "height": 30, - "top": winH, - "left": (((winW + 250) / 2) - 50), - "title": "Let's get started!", - "message": "This really only scratches the surface of what ICEcoder can do. Have a look around, test out the features and don't forget to checkout the website for more advanced tips & tricks. You can get to this tutorial again under Help > Tutorial.", - "button": "start!" - }, - }; - - // Make both the info black mask and message display - get("infoBlackMask").style.display = "block"; - get("infoMessageContainer").style.display = "block"; - - // No step specified means starting from beginning - if (false === step) { - // Set margin-top to be above screen - get("infoMessageContainer").style.marginTop = -300 + "px"; - // After 100ms show border and message text (still above screen) - setTimeout(function() { - get("infoBlackMask").style.border = "solid 10000px rgba(0,0,0,0.8)"; - get("infoMessageContainer").style.opacity = "1"; - }, 100); - // After requested delay, slide in message but account for logo - setTimeout(function() { - get("infoMessageContainer").style.marginTop = (winH / 2) + 70 + "px"; - }, delay); - // Set message text and return to go no further - ICEcoder.viewTutorial(0); - return; - } - - // If we're going beyond the last step, we're finishing - if (11 < step) { - // Reset styles ready for next time - get("infoBlackMask").style.border = "solid 10000px rgba(0,0,0,0)"; - get("infoMessageContainer").style.opacity = "0"; - setTimeout(function() { - get("infoBlackMask").style.display = "none"; - get("infoMessageContainer").style.display = "none"; - }, 500); - // Mark tutorial as done in users settings and return - xhr = this.xhrObj(); - xhr.open("POST",iceLoc+"/lib/settings.php?action=turnOffTutorialOnLogin&csrf="+this.csrf,true); - xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - xhr.send(); - return; - } - - // Steps 1 onwards have no logo, normal margin-top needed - if (1 <= step) { - get("infoMessageContainer").style.marginTop = (winH / 2) + "px"; - } - - // We have something do display, so set info black mask to highlight item - get("infoBlackMask").style.height = steps[step].height; - get("infoBlackMask").style.width = steps[step].width; - get("infoBlackMask").style.top = -10000 + steps[step].top + "px"; - get("infoBlackMask").style.left = -10000 + steps[step].left + "px"; - // Set info title, message and button - get("infoMessage").innerHTML = '
    ' + steps[step].title + '
    ' + steps[step].message + '

    ' + steps[step].button + '
    '; - }, - - // Snart snake - startSnake: function() { - this.snakePlaying = true; - this.showHide('show',get('blackMask')); - get('mediaContainer').innerHTML = 'Let\'s play
    snake


    Use arrow keys to eat your code

    (it returns afterwards of course) :-)
    '; - setTimeout(function(ic) { - ic.showHide('hide',get('blackMask')); - get('mediaContainer').innerHTML = ''; - ic.playSnake(); - },2000,this); - }, - - // Play snake - playSnake: function() { - var cM; - - cM = this.getcMInstance(); - cM.setOption('readOnly', 'nocursor'); - cM.focus(); - - // Get state of editor at present - this.snakePreHistory = cM.getHistory(); - this.snakePreContent = cM.getValue(); - this.snakePreCursor = cM.getCursor(); - - // Pick a random point for snake to come in and set head and 4 body parts off screen - var randPos = Math.floor(Math.random()*50); - this.snakePos = [ - [randPos,0], - [randPos,-1], - [randPos,-2], - [randPos,-3], - [randPos,-4] - ]; - - // Show game layer, set direction and do 1st frame of snake - this.content.contentWindow.document.getElementById('game').style.display = 'block'; - this.snakeDir = "down"; - this.doSnake(); - - // Every 0.1s, move snake - this.snakeInt = setInterval(function(ic) { - // Set new head X & Y pos according to direction - var newHead = []; - newHead[0] = ic.snakePos[0][0]+(ic.snakeDir == "right" ? 1 : ic.snakeDir == "left" ? -1 : 0); - newHead[1] = ic.snakePos[0][1]+(ic.snakeDir == "down" ? 1 : ic.snakeDir == "up" ? -1 : 0); - // Add new head and remove tail - ic.snakePos.unshift(newHead); - ic.snakePos.pop(); - // Do next frame of snake - ic.doSnake(); - },100,this); - }, - - doSnake: function() { - var cM, cW, cH, newInnerHTML, lineData, lineContent, spaceReplaceChars, collision, scrollInfo; - - // Get CodeMirror instance, plus char width and height - cM = this.getcMInstance(); - cW = cM.defaultCharWidth(); - cH = cM.defaultTextHeight(); - - // Clear content of game layer - this.content.contentWindow.document.getElementById('game').innerHTML = ""; - // Start a new set of contents - newInnerHTML = ""; - // For every part of snake, draw it's block in position - for (var i=0; i
    '; - } - // Set new content in game layer - this.content.contentWindow.document.getElementById('game').innerHTML = newInnerHTML; - - // Get line & ch value under snake head then line content - lineData = cM.coordsChar({top: ((this.snakePos[0][1]*cH)+4), left: ((this.snakePos[0][0]*cW)+60)}); - lineContent = cM.getLine(lineData.line); - - // If not the last char on the line - if (this.snakePos[0][0]-1 <= lineContent.length-2) { - spaceReplaceChars = ""; - // If char under snake head is a tab, replace string contains spaces of same width - if (lineContent.substr(lineData.ch,1) === "\t") { - for (var i=0; i= 5) { - this.snakePos.pop(); - } - } - // Detect if snake head has collided into itself - collision = false; - for (var i=1; i scrollInfo.clientWidth || ((this.snakePos[0][1]*cH)+4) > scrollInfo.clientHeight || - collision - ) { - // Clear interval and hide game layer - clearInterval(this.snakeInt); - this.content.contentWindow.document.getElementById('game').style.display = 'none'; - // Set content, saved point, saved contents and history back to what they were pre game - cM.setValue(this.snakePreContent); - this.savedPoints[this.selectedTab-1] = cM.changeGeneration(); - this.savedContents[this.selectedTab-1] = this.snakePreContent; - cM.setHistory(this.snakePreHistory); - // Redo changes indicator in title tag and tab highlight save indicator also to what they are now (pre game state) - this.indicateChanges(); - this.redoTabHighlight(this.selectedTab); - // Set editor to be editable again - cM.setOption('readOnly', false); - // Set cursor back to what it was pre game and focus on editor - cM.setCursor(this.snakePreCursor); - cM.focus(); - // State we are no longer playing snake - this.snakePlaying = false; - } - - } + // Detect keys/combos plus identify our area and set the vars, perform actions + interceptKeys: function(area, evt) { + var key, cM, cMdiff, thisCM; + + key = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode; + + // Reset the auto-logout timer + this.resetAutoLogoutTimer(); + + // Detect if we type s,n,a,k,e keys with content saved, if so start snake game + if (!this.last5Keys) {this.last5Keys = [];} + this.last5Keys.push(key); + if (this.last5Keys.length == 6) { + this.last5Keys.shift(); + } + if (this.last5Keys.join() == "83,78,65,75,69") { + setTimeout(function(ic) { + // Undo back to pre 'snake' word + cM = ic.getcMInstance(); + var undoCounts = 0; + var startCG = cM.changeGeneration(); + while (cM.changeGeneration() > startCG-5) { + cM.undo(); + undoCounts++; + } + // If we have content saved + if (ic.savedPoints[ic.selectedTab-1] == cM.changeGeneration()) { + // Start snake game + ic.startSnake(); + // If we don't, redo snake word + } else { + for (var i=1; i<=undoCounts; i++) { + cM.redo(); + } + } + },0,this); + } + + // Detect arrow keys if playing snake + if (this.snakePlaying) { + if (key==37) {this.snakeDir = 'left'} + if (key==39) {this.snakeDir = 'right'} + if (key==38) {this.snakeDir = 'up'} + if (key==40) {this.snakeDir = 'down'} + return false; + } + + // Mac command key handling (224 = Moz, 91/93 = Webkit Left/Right Apple) + if (key==224 || key==91 || key==93) { + this.cmdKey = true; + } + + // F1 (zoom code out non declaration lines) + if (key === 112) { + if (this.codeZoomedOut) { + return; + } + this.codeZoomedOut = true; + + cM = this.getcMInstance(); + // For every line in the current editor, add code-zoomed-out class if not a function/class declaration line + for (var i=0; i -1 ? true : false);return false;} + else {return key;} + // Alt+Enter (Insert Line After) + } else if (key==13) { + this.insertLineAfter(); + return false; + } else {return key;} + + } else { + + // Shift+Enter (Insert Line Before) + if(key==13 && evt.shiftKey) { + this.insertLineBefore(); + return false; + + // CTRL/Cmd+F (Find next) + // and + // CTRL/Cmd+G (Find previous) + } else if((key==70||key==71) && (evt.ctrlKey||this.cmdKey)) { + var find = get('find'); + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + var selections = thisCM.getSelections(); + if (selections.length > 0){ + if (selections[0].length > 0){ + find.value = selections[0]; + } + } + find.select(); + // this is trick for Chrome - after you have used Ctrl-F once, when + // you try using Ctrl-F another time, somewhy Chrome still thinks, + // that find has focus and refuses to give it focus second time. + get('goToLineNo').focus(); + find.focus(); + // Trigger the find/replace operation + if(key==70) { + // Find next + get('findReplaceSubmit').click(); + } else { + // Find previous + this.findReplace(document.getElementById('find').value,false,true,false,'findPrevious'); + } + return false; + + // CTRL/Cmd+L (Go to line) + } else if(key==76 && (evt.ctrlKey||this.cmdKey)) { + var goToLineInput = get('goToLineNo'); + goToLineInput.select(); + // this is trick for Chrome - after you have used Ctrl-F once, when + // you try using Ctrl-F another time, somewhy Chrome still thinks, + // that find has focus and refuses to give it focus second time. + get('find').focus(); + goToLineInput.focus(); + return false; + + // CTRL/Cmd+I (Get info) + } else if(key==73 && (evt.ctrlKey||this.cmdKey) && area == "content") { + this.searchForSelected(); + return false; + + // CTRL/Cmd+backspace arrow (Go to previous tab selected) + } else if(key==8 && (evt.ctrlKey||this.cmdKey)) { + if (this.prevTab !== 0) { + this.switchTab(this.prevTab); + } + return false; + + // CTRL/Cmd+right arrow (Tab to right) + } else if(key==39 && (evt.ctrlKey||this.cmdKey) && area!="content") { + this.nextTab(); + return false; + + // CTRL/Cmd+left arrow (Tab to left) + } else if(key==37 && (evt.ctrlKey||this.cmdKey) && area!="content") { + this.previousTab(); + return false; + + // CTRL/Cmd+up arrow (Move line up) + } else if(key==38 && (evt.ctrlKey||this.cmdKey) && area=="content") { + this.moveLines('up'); + return false; + + // CTRL/Cmd+down arrow (Move line down) + } else if(key==40 && (evt.ctrlKey||this.cmdKey) && area=="content") { + this.moveLines('down'); + return false; + + // CTRL/Cmd+numeric plus (New tab) + } else if((key==107 || key==187) && (evt.ctrlKey||this.cmdKey)) { + area=="content" + ? this.duplicateLines() + : this.newTab(); + return false; + + // CTRL/Cmd+numeric minus (Close tab) + } else if((key==109 || key==189) && (evt.ctrlKey||this.cmdKey)) { + area=="content" + ? this.removeLines() + : this.closeTab(this.selectedTab); + return false; + + // CTRL/Cmd+S (Save), CTRL/Cmd+Shift+S (Save As) + } else if(key==83 && (evt.ctrlKey||this.cmdKey)) { + if(evt.shiftKey) { + this.saveFile('saveAs'); + } else { + this.saveFile(); + } + return false; + + // CTRL/Cmd+Enter (Open Webpage) + } else if(key==13 && (evt.ctrlKey||this.cmdKey) && this.openFiles[this.selectedTab-1] != "/[NEW]") { + this.resetKeys(evt); + window.open(this.openFiles[this.selectedTab-1]); + return false; + + // Enter (Expand dir/open file) + } else if(key==13 && area=="files") { + if(!evt.ctrlKey && !this.cmdKey) { + if (this.selectedFiles.length == 0) { + this.overFileFolder('folder', '|'); + this.selectFileFolder('init'); + } + this.fmAction(evt,'enter'); + } + return false; + + // Up/down/left/right arrows (Traverse files) + } else if((key==38||key==40||key==37||key==39) && area=="files") { + if(!evt.ctrlKey && !this.cmdKey) { + if (this.selectedFiles.length == 0) { + this.overFileFolder('folder', '|'); + this.selectFileFolder('init'); + } + this.fmAction(evt, + key==38 ? 'up' : + key==40 ? 'down' : + key==37 ? 'left' : + 'right'); + } + return false; + + // CTRL/Cmd+O (Open Prompt) + } else if(key==79 && (evt.ctrlKey||this.cmdKey)) { + this.openPrompt(); + return false; + + // CTRL/Cmd+Space (Add snippet) + } else if(key==32 && (evt.ctrlKey||this.cmdKey) && area=="content") { + this.addSnippet(); + return false; + + // CTRL/Cmd+J (Jump to definition/back again) + } else if(key==74 && (evt.ctrlKey||this.cmdKey) && area=="content") { + this.jumpToDefinition(); + return false; + + // CTRL + Tab (lock/unlock file manager) + } else if(key==223 && (evt.ctrlKey||this.cmdKey)) { + this.lockUnlockNav(); + this.changeFilesW(this.lockedNav ? 'expand' : 'contract'); + return false; + + // CTRL + . (Fold/unfold current line) + } else if(key==190 && (evt.ctrlKey||this.cmdKey)) { + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + var line = thisCM.getCursor().line; + + return false; + + // ESC in content area (Comment/Uncomment line) + } else if(key==27 && area == "content") { + cM = this.getcMInstance(); + cMdiff = this.getcMdiffInstance(); + thisCM = this.editorFocusInstance.indexOf('diff') > -1 ? cMdiff : cM; + + if (thisCM.getSelections().length > 1) { + thisCM.execCommand("singleSelection"); + } else { + this.lineCommentToggle(); + } + return false; + + // ESC not in content area (Cancel all actions) + } else if(key==27 && area != "content") { + this.cancelAllActions(); + return false; + + // Any other key + } else { + return key; + } + } + }, + + // Reset the state of keys back to the normal state + resetKeys: function(evt) { + var key, cM; + + key = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode; + + if (key == 112 && this.codeZoomedOut) { + cM = this.getcMInstance(); + // For every line in the current editor, remove code-zoomed-out class if not a function/class declaration line + for (var i=0; i -1 ? cMdiff : cM; + lineNo = thisCM.getCursor().line; + whiteSpace = thisCM.getLine(lineNo).length - thisCM.getLine(lineNo).replace(/^\s\s*/, '').length; + content = thisCM.getLine(lineNo).slice(whiteSpace); + // function snippet + if (content.slice(0,8)=="function") { + this.doSnippet('function','function VAR() {\nINDENT\tCURSOR\nINDENT}'); + // if snippet + } else if (content.slice(0,2)=="if") { + this.doSnippet('if','if (CURSOR) {\nINDENT\t\nINDENT}'); + // for snippet + } else if (content.slice(0,3)=="for") { + this.doSnippet('for','for (var i=0; i -1 ? cMdiff : cM; + lineNo = thisCM.getCursor().line; + lineContents = thisCM.getLine(lineNo); + + // Find our target string + if (lineContents.indexOf(tgtString)>-1) { + // Get text on the line from our target to the end + remainder = thisCM.getLine(lineNo); + strPos = remainder.indexOf(tgtString); + remainder = remainder.slice(remainder.indexOf(tgtString)+tgtString.length+1); + // Replace the function name if any + replaceString = replaceString.replace(/VAR/g,remainder); + // Get replaced string from start to our strPos + replacedLine = thisCM.getLine(lineNo).slice(0,strPos); + // Trim whitespace from start + whiteSpace = thisCM.getLine(lineNo).length - thisCM.getLine(lineNo).replace(/^\s\s*/, '').length; + whiteSpace = thisCM.getLine(lineNo).slice(0,whiteSpace); + // Replace indent with whatever whitespace we have + replaceString = replaceString.replace(/INDENT/g,whiteSpace); + replacedLine += replaceString; + // Get cursor position + curPos = replacedLine.indexOf("CURSOR"); + sPos = 0; + lineNoCount = lineNo; + for (i=0;i -1 ? true : false); + } + }, + + viewTutorial: function(step, delay) { + var winW, winH; + + winW = window.innerWidth; + winH = window.innerHeight; + + var steps = { + 0: { + "width": 250, + "height": 55, + "top": -55, + "left": 0, + "title": "

    Code editor awesomeness ...in your browser", + "message": "View the quick start tutorial? (Well worthwhile!) or skip it", + "button": "view tutorial" + }, + 1: { + "width": 250, + "height": 55, + "top": 0, + "left": 0, + "title": "Options and settings", + "message": "Here you can perform file and editor content actions, plus also customise ICEcoders' settings, switch to other file manager sources, view help, search for info and more.", + "button": "next >" + }, + 2: { + "width": 250, + "height": winH - 85, + "top": 50, + "left": 0, + "title": "File manager", + "message": "This is the file manager. Click a dir to open/close, double click a file to open it and right click on dirs/files to get relevant options. You can drag and drop too.", + "button": "next >" + }, + 3: { + "width": 45, + "height": 85, + "top": 50, + "left": 205, + "title": "File manager options and plugins", + "message": "Here you can unlock/lock the file manager to collapse/expand it, refresh the file manager plus view and install plugins. (Also, move your mouse to left edge of file manager for quick access to the plugins).", + "button": "next >" + }, + 4: { + "width": 250, + "height": 35, + "top": winH - 35, + "left": 0, + "title": "Extra tools", + "message": "Get access to the terminal, output, database and Git interfaces here, displayed as an overlay to get the largest display, click option again to slide overlay out.", + "button": "next >" + }, + 5: { + "width": winW - 250, + "height": 42, + "top": 0, + "left": 250, + "title": "Editor tabs", + "message": "Your opened tabs will appear here. Icons displayed are to close all, alphabetize tabs and add new tab. You can drag your open tabs left/right to sort them too.", + "button": "next >" + }, + 6: { + "width": 440, + "height": 28, + "top": 42, + "left": 250, + "title": "Find and replace builder", + "message": "This is the find and replace builder. Here you can use the text fields and dropdown menus to build up sentences of what you'd like to do, such as find and replace in editor content, files and filenames.", + "button": "next >" + }, + 7: { + "width": 200, + "height": 28, + "top": 42, + "left": winW - 200, + "title": "Editor options and bug reporting", + "message": "Here you can specify the line to jump to (editor jumps as you type, hit Enter to focus on editor), plus options to view the current tab as a webpage in new browser window and view bugs as you code (once targeted at error logs).", + "button": "next >" + }, + 8: { + "width": 520, + "height": 380, + "top": 70, + "left": 250, + "title": "System info", + "message": "This is general info about your server, paths, browser and more. Worth noting to ensure settings seem correct.", + "button": "next >" + }, + 9: { + "width": 32, + "height": 30, + "top": winH - 30, + "left": 250, + "title": "Editor content error indicator and version control", + "message": "Error indicator for syntax or structural issues in the editor content. Also, when you have a tab open, on every save, it makes a copy - click the number of backups it indicates, to view differences and options to restore old versions.", + "button": "next >" + }, + 10: { + "width": 100, + "height": 30, + "top": winH - 30, + "left": (((winW + 250) / 2) - 50), + "title": "Editor pane mode", + "message": "Switch between single pane and diff pane modes. The diff pane automatically sets a copy on each save, so you can undo/redo to cycle through those. The gutters indicate additions, changes and deletions on each line.", + "button": "next >" + }, + 11: { + "width": 100, + "height": 30, + "top": winH, + "left": (((winW + 250) / 2) - 50), + "title": "Let's get started!", + "message": "This really only scratches the surface of what ICEcoder can do. Have a look around, test out the features and don't forget to checkout the website for more advanced tips & tricks. You can get to this tutorial again under Help > Tutorial.", + "button": "start!" + }, + }; + + // Make both the info black mask and message display + get("infoBlackMask").style.display = "block"; + get("infoMessageContainer").style.display = "block"; + + // No step specified means starting from beginning + if (false === step) { + // Set margin-top to be above screen + get("infoMessageContainer").style.marginTop = -300 + "px"; + // After 100ms show border and message text (still above screen) + setTimeout(function() { + get("infoBlackMask").style.border = "solid 10000px rgba(0,0,0,0.8)"; + get("infoMessageContainer").style.opacity = "1"; + }, 100); + // After requested delay, slide in message but account for logo + setTimeout(function() { + get("infoMessageContainer").style.marginTop = (winH / 2) + 70 + "px"; + }, delay); + // Set message text and return to go no further + ICEcoder.viewTutorial(0); + return; + } + + // If we're going beyond the last step, we're finishing + if (11 < step) { + // Reset styles ready for next time + get("infoBlackMask").style.border = "solid 10000px rgba(0,0,0,0)"; + get("infoMessageContainer").style.opacity = "0"; + setTimeout(function() { + get("infoBlackMask").style.display = "none"; + get("infoMessageContainer").style.display = "none"; + }, 500); + // Mark tutorial as done in users settings and return + xhr = this.xhrObj(); + xhr.open("POST",iceLoc+"/lib/settings.php?action=turnOffTutorialOnLogin&csrf="+this.csrf,true); + xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xhr.send(); + return; + } + + // Steps 1 onwards have no logo, normal margin-top needed + if (1 <= step) { + get("infoMessageContainer").style.marginTop = (winH / 2) + "px"; + } + + // We have something do display, so set info black mask to highlight item + get("infoBlackMask").style.height = steps[step].height; + get("infoBlackMask").style.width = steps[step].width; + get("infoBlackMask").style.top = -10000 + steps[step].top + "px"; + get("infoBlackMask").style.left = -10000 + steps[step].left + "px"; + // Set info title, message and button + get("infoMessage").innerHTML = '
    ' + steps[step].title + '
    ' + steps[step].message + '

    ' + steps[step].button + '
    '; + }, + + // Snart snake + startSnake: function() { + this.snakePlaying = true; + this.showHide('show',get('blackMask')); + get('mediaContainer').innerHTML = 'Let\'s play
    snake


    Use arrow keys to eat your code

    (it returns afterwards of course) :-)
    '; + setTimeout(function(ic) { + ic.showHide('hide',get('blackMask')); + get('mediaContainer').innerHTML = ''; + ic.playSnake(); + },2000,this); + }, + + // Play snake + playSnake: function() { + var cM; + + cM = this.getcMInstance(); + cM.setOption('readOnly', 'nocursor'); + cM.focus(); + + // Get state of editor at present + this.snakePreHistory = cM.getHistory(); + this.snakePreContent = cM.getValue(); + this.snakePreCursor = cM.getCursor(); + + // Pick a random point for snake to come in and set head and 4 body parts off screen + var randPos = Math.floor(Math.random()*50); + this.snakePos = [ + [randPos,0], + [randPos,-1], + [randPos,-2], + [randPos,-3], + [randPos,-4] + ]; + + // Show game layer, set direction and do 1st frame of snake + this.content.contentWindow.document.getElementById('game').style.display = 'block'; + this.snakeDir = "down"; + this.doSnake(); + + // Every 0.1s, move snake + this.snakeInt = setInterval(function(ic) { + // Set new head X & Y pos according to direction + var newHead = []; + newHead[0] = ic.snakePos[0][0]+(ic.snakeDir == "right" ? 1 : ic.snakeDir == "left" ? -1 : 0); + newHead[1] = ic.snakePos[0][1]+(ic.snakeDir == "down" ? 1 : ic.snakeDir == "up" ? -1 : 0); + // Add new head and remove tail + ic.snakePos.unshift(newHead); + ic.snakePos.pop(); + // Do next frame of snake + ic.doSnake(); + },100,this); + }, + + doSnake: function() { + var cM, cW, cH, newInnerHTML, lineData, lineContent, spaceReplaceChars, collision, scrollInfo; + + // Get CodeMirror instance, plus char width and height + cM = this.getcMInstance(); + cW = cM.defaultCharWidth(); + cH = cM.defaultTextHeight(); + + // Clear content of game layer + this.content.contentWindow.document.getElementById('game').innerHTML = ""; + // Start a new set of contents + newInnerHTML = ""; + // For every part of snake, draw it's block in position + for (var i=0; i
    '; + } + // Set new content in game layer + this.content.contentWindow.document.getElementById('game').innerHTML = newInnerHTML; + + // Get line & ch value under snake head then line content + lineData = cM.coordsChar({top: ((this.snakePos[0][1]*cH)+4), left: ((this.snakePos[0][0]*cW)+60)}); + lineContent = cM.getLine(lineData.line); + + // If not the last char on the line + if (this.snakePos[0][0]-1 <= lineContent.length-2) { + spaceReplaceChars = ""; + // If char under snake head is a tab, replace string contains spaces of same width + if (lineContent.substr(lineData.ch,1) === "\t") { + for (var i=0; i= 5) { + this.snakePos.pop(); + } + } + // Detect if snake head has collided into itself + collision = false; + for (var i=1; i scrollInfo.clientWidth || ((this.snakePos[0][1]*cH)+4) > scrollInfo.clientHeight || + collision + ) { + // Clear interval and hide game layer + clearInterval(this.snakeInt); + this.content.contentWindow.document.getElementById('game').style.display = 'none'; + // Set content, saved point, saved contents and history back to what they were pre game + cM.setValue(this.snakePreContent); + this.savedPoints[this.selectedTab-1] = cM.changeGeneration(); + this.savedContents[this.selectedTab-1] = this.snakePreContent; + cM.setHistory(this.snakePreHistory); + // Redo changes indicator in title tag and tab highlight save indicator also to what they are now (pre game state) + this.indicateChanges(); + this.redoTabHighlight(this.selectedTab); + // Set editor to be editable again + cM.setOption('readOnly', false); + // Set cursor back to what it was pre game and focus on editor + cM.setCursor(this.snakePreCursor); + cM.focus(); + // State we are no longer playing snake + this.snakePlaying = false; + } + + } }; From b35211af984cf9a5bb32b37f4c9e3458f28b4c26 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 18 Apr 2020 09:49:39 +0100 Subject: [PATCH 125/231] Tidy language partials JS --- assets/js/language-modes-partial.js | 49 +++++++++++++++-------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/assets/js/language-modes-partial.js b/assets/js/language-modes-partial.js index 5d520ec..4f7df4e 100644 --- a/assets/js/language-modes-partial.js +++ b/assets/js/language-modes-partial.js @@ -3,27 +3,28 @@ fileExt = fileName.split("."); fileExt = fileExt[fileExt.length-1]; var mode = - fileExt == "js" || fileExt == "json" ? "text/javascript" - : fileExt == "coffee" ? "text/x-coffeescript" - : fileExt == "ts" ? "application/typescript" - : fileExt == "rb" ? "text/x-ruby" - : fileExt == "py" ? "text/x-python" - : fileExt == "mpy" ? "text/x-python" - : fileExt == "css" ? "text/css" - : fileExt == "less" ? "text/x-less" - : fileExt == "md" ? "text/x-markdown" - : fileExt == "xml" ? "application/xml" - : fileExt == "sql" ? "text/x-mysql" // also text/x-sql, text/x-mariadb, text/x-cassandra or text/x-plsql - : fileExt == "erl" ? "text/x-erlang" - : fileExt == "yaml" ? "text/x-yaml" - : fileExt == "java" ? "text/x-java" - : fileExt == "jl" ? "text/x-julia" - : fileExt == "c" ? "text/x-csrc" - : fileExt == "cpp" ? "text/x-c++src" - : fileExt == "ino" ? "text/x-c++src" - : fileExt == "cs" ? "text/x-csharp" - : fileExt == "go" ? "text/x-go" - : fileExt == "lua" ? "text/x-lua" - : fileExt == "pl" ? "text/x-perl" - : fileExt == "scss" ? "text/x-sass" - : "application/x-httpd-php"; + fileExt == "js" ? "text/javascript" + : fileExt == "json" ? "text/javascript" + : fileExt == "coffee" ? "text/x-coffeescript" + : fileExt == "ts" ? "application/typescript" + : fileExt == "rb" ? "text/x-ruby" + : fileExt == "py" ? "text/x-python" + : fileExt == "mpy" ? "text/x-python" + : fileExt == "css" ? "text/css" + : fileExt == "less" ? "text/x-less" + : fileExt == "md" ? "text/x-markdown" + : fileExt == "xml" ? "application/xml" + : fileExt == "sql" ? "text/x-mysql" // also text/x-sql, text/x-mariadb, text/x-cassandra or text/x-plsql + : fileExt == "erl" ? "text/x-erlang" + : fileExt == "yaml" ? "text/x-yaml" + : fileExt == "java" ? "text/x-java" + : fileExt == "jl" ? "text/x-julia" + : fileExt == "c" ? "text/x-csrc" + : fileExt == "cpp" ? "text/x-c++src" + : fileExt == "ino" ? "text/x-c++src" + : fileExt == "cs" ? "text/x-csharp" + : fileExt == "go" ? "text/x-go" + : fileExt == "lua" ? "text/x-lua" + : fileExt == "pl" ? "text/x-perl" + : fileExt == "scss" ? "text/x-sass" + : "application/x-httpd-php"; From 36690e496cb4b18784910abebeb67a2bf71a4491 Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 18 Apr 2020 12:44:01 +0100 Subject: [PATCH 126/231] icecoder.js updates & fixes first third --- assets/js/icecoder.js | 1112 ++++++++++++++++++++--------------------- 1 file changed, 532 insertions(+), 580 deletions(-) diff --git a/assets/js/icecoder.js b/assets/js/icecoder.js index 20acc89..b43471e 100644 --- a/assets/js/icecoder.js +++ b/assets/js/icecoder.js @@ -1,87 +1,87 @@ // Get any elem by ID -var get = function(elem) { +const get = function(elem) { return document.getElementById(elem); }; -var iceLoc = window.location.pathname; +// URL we're viewing ICEcoder from +const iceLoc = window.location.pathname; // Main ICEcoder object var ICEcoder = { -// ============== -// INIT -// ============== + // ==== + // INIT + // ==== // Define settings - filesW: 250, // Width of files pane - minFilesW: 14, // Min width of files pane - maxFilesW: 250, // Max width of files pane - selectedTab: 0, // The tab that's currently selected - savedPoints: [], // Ints array to indicate save points for docs - savedContents: [], // Array of last known saved contents - canSwitchTabs: true, // Stops switching of tabs when trying to close - openFiles: [], // Array of open file URLs - openFileMDTs: [], // Array of open file modification datetimes - openFileVersions: [], // Array of open file version counts - cMInstances: [], // List of CodeMirror instance no's - nextcMInstance: 1, // Next available CodeMirror instance no - selectedFiles: [], // Array of selected files - findMode: false, // States if we're in find/replace mode - scrollbarVisible: false, // Indicates if the main pane has a scrollbar - mouseDown: false, // If the mouse is down - mouseDownInCM: false, // If the mouse is down within CodeMirror instance (can be false, 'editor' or 'gutter') - draggingFilesW: false, // If we're dragging the file manager width - draggingTab: false, // If we're dragging a tab - draggingWithKey: false, // The key that's down while dragging, false if no key - tabLeftPos: [], // Array of left positions of tabs inside content area - tabBGcurrent: '#1d1d1b', // BG of current tab - tabBGselected: '#49d', // BG of selected tab - tabBGopen: '#c3c3c3', // BG of open tab - tabBGnormal: 'transparent', // BG of normal tab - tabFGcurrent: '#fff', // FG of selected tab - tabFGselected: '#fff', // FG of selected tab - tabFGopenFile: '#000', // FG of open file - tabFGnormalFile: '#eee', // FG of normal file - tabFGnormalTab: '#888', // FG of normal tab - prevTab: 0, // Previous tab to current - serverQueueItems: [], // Array of URLs to call in order - previewWindow: false, // Target variable for the preview window - previewWindowLoading: false, // Loading state of preview window - pluginIntervalRefs: [], // Array of plugin interval refs - overPopup: false, // Indicates if we're over a popup or not - cmdKey: false, // Tracking apple Command key up/down state - codeZoomedOut: false, // If true, code on non declaration lines is zoomed out - showingTool: false, // Which tool is showing right now (terminal, output, database, git etc) - oppTagReplaceData: [], // Will contain data for automatic opposite tag replacement to sync them - fmReady: false, // Indicates if the file manager is ready for action - bugReportStatus: "off", // Values of: off, error, ok, bugs - bugReportPath: "", // Bug report file path - bugFilesSizesSeen: [], // Array of last seen sizes of bug files - bugFilesSizesActual: [], // Array of actual sizes of bug files - splitPane: false, // Single or split pane editing - splitPaneLeftPerc: 100, // Width of left pane as a percentage - renderLineStyle: [], // Array of styles to apply on renderLine event - renderPaneShiftAmount: 0, // Shift comparison main (negative) vs diff pane (positive) - debounce: "", // Contains debounce timeout object - editorFocusInstance: "", // Name of editor instance that has focus - openSeconds: 0, // Number of seconds ICEcoder has been open for - indexing: false, // Indicates if ICEcoder is currently indexing - ready: false, // Indicates if ICEcoder is ready for action + filesW: 250, // Width of files pane + minFilesW: 14, // Min width of files pane + maxFilesW: 250, // Max width of files pane + selectedTab: 0, // The tab that's currently selected + savedPoints: [], // Ints array to indicate save points for docs + savedContents: [], // Array of last known saved contents + canSwitchTabs: true, // Stops switching of tabs when trying to close + openFiles: [], // Array of open file URLs + openFileMDTs: [], // Array of open file modification datetimes + openFileVersions: [], // Array of open file version counts + cMInstances: [], // List of CodeMirror instance no's + nextcMInstance: 1, // Next available CodeMirror instance no + selectedFiles: [], // Array of selected files + findMode: false, // States if we're in find/replace mode + scrollbarVisible: false, // Indicates if the main pane has a scrollbar + mouseDown: false, // If the mouse is down + mouseDownInCM: false, // If the mouse is down within CodeMirror instance (can be false, 'editor' or 'gutter') + draggingFilesW: false, // If we're dragging the file manager width + draggingTab: false, // If we're dragging a tab + draggingWithKey: false, // The key that's down while dragging, false if no key + tabLeftPos: [], // Array of left positions of tabs inside content area + tabBGcurrent: '#1d1d1b', // BG of current tab + tabBGselected: '#49d', // BG of selected tab + tabBGopen: '#c3c3c3', // BG of open tab + tabBGnormal: 'transparent', // BG of normal tab + tabFGcurrent: '#fff', // FG of selected tab + tabFGselected: '#fff', // FG of selected tab + tabFGopenFile: '#000', // FG of open file + tabFGnormalFile: '#eee', // FG of normal file + tabFGnormalTab: '#888', // FG of normal tab + prevTab: 0, // Previous tab to current + serverQueueItems: [], // Array of URLs to call in order + previewWindow: false, // Target variable for the preview window + previewWindowLoading: false, // Loading state of preview window + pluginIntervalRefs: [], // Array of plugin interval refs + overPopup: false, // Indicates if we're over a popup or not + cmdKey: false, // Tracking apple Command key up/down state + codeZoomedOut: false, // If true, code on non declaration lines is zoomed out + showingTool: false, // Which tool is showing right now (terminal, output, database, git etc) + oppTagReplaceData: [], // Will contain data for automatic opposite tag replacement to sync them + fmReady: false, // Indicates if the file manager is ready for action + bugReportStatus: "off", // Values of: off, error, ok, bugs + bugReportPath: "", // Bug report file path + bugFilesSizesSeen: [], // Array of last seen sizes of bug files + bugFilesSizesActual: [], // Array of actual sizes of bug files + splitPane: false, // Single or split pane editing + splitPaneLeftPerc: 100, // Width of left pane as a percentage + renderLineStyle: [], // Array of styles to apply on renderLine event + renderPaneShiftAmount: 0, // Shift comparison main (negative) vs diff pane (positive) + editorFocusInstance: "", // Name of editor instance that has focus + openSeconds: 0, // Number of seconds ICEcoder has been open for + indexing: false, // Indicates if ICEcoder is currently indexing + ready: false, // Indicates if ICEcoder is ready for action // Set our aliases initAliases: function() { - var aliasArray = ["header","files", "fileOptions", "optionsFile", "optionsEdit", "optionsSource", "optionsHelp", "filesFrame", "editor", "tabsBar", "findBar", "terminal", "output", "database", "git", "content", "tools", "footer", "nestValid", "versionsDisplay", "splitPaneControls", "splitPaneNamesMain", "splitPaneNamesDiff", "charDisplay", "byteDisplay"]; + const aliasArray = ["header", "files", "fileOptions", "optionsFile", "optionsEdit", "optionsSource", "optionsHelp", "filesFrame", "editor", "tabsBar", "findBar", "terminal", "output", "database", "git", "content", "tools", "footer", "versionsDisplay", "splitPaneControls", "splitPaneNamesMain", "splitPaneNamesDiff", "charDisplay", "byteDisplay"]; // Create our ID aliases - for (var i=0;i
    -
    +