Compare commits

...

37 Commits
v5.6 ... v5.7

Author SHA1 Message Date
Matt Pass
0027259e67 Version 5.7 2016-08-26 09:40:45 +01:00
Matt Pass
5337ff5fe9 Don't get this via CURL 2016-08-26 09:24:17 +01:00
Matt Pass
749dc212d9 Need to replace \ with / in fileLoc 2016-08-25 21:28:51 +01:00
Matt Pass
9d7565c317 Close tag on same line needs extra adjustment + 1 2016-08-25 19:46:56 +01:00
Matt Pass
9efbe9a9bf Make 0 smallest number, to avoid negative numbers 2016-08-25 17:03:35 +01:00
Matt Pass
67e929dc75 injClean function added 2016-08-25 17:02:56 +01:00
Matt Pass
a0e48b5088 injClean inputs 2016-08-25 17:02:39 +01:00
Matt Pass
667417262c injClean and numClean inputs 2016-08-25 17:02:16 +01:00
Matt Pass
83e7c62b9b numClean and xssClean inputs 2016-08-25 17:01:23 +01:00
Matt Pass
8797e8f5e0 Simpler code moved to settings.php 2016-08-25 16:59:28 +01:00
Matt Pass
ee90c48a1c Pane names pos & opac added & diff on/off fixes 2016-08-25 15:04:45 +01:00
Matt Pass
93c33162a1 CSS added for 2 x pane names as labels 2016-08-25 14:57:44 +01:00
Matt Pass
068ec67c9d getData used and 2 x split pane names added 2016-08-25 14:57:11 +01:00
Matt Pass
761f39407a Use getData now, first couple as curl & die message 2016-08-25 14:55:48 +01:00
Matt Pass
227eefa332 Can pass text as 3rd param now for die message 2016-08-25 14:54:38 +01:00
Matt Pass
1d6c60c19a Get data now via getData 2016-08-25 14:50:10 +01:00
Matt Pass
a9402eb4ae getData used 2 x via curl and 1 x via default 2016-08-25 14:48:21 +01:00
Matt Pass
d449623153 Use getData with curl param 2016-08-25 14:46:42 +01:00
Matt Pass
31d96eca3b Using getData now and fix to issue #652 2016-08-25 14:45:33 +01:00
Matt Pass
3d8644ae4c Using getData function now 2016-08-25 14:44:18 +01:00
Matt Pass
893894f97b Get data via new function 2016-08-25 14:39:19 +01:00
Matt Pass
d992173967 Function to get data via fopen or curl & used 2016-08-25 14:37:18 +01:00
Matt Pass
483ac6cd6c Fix to backup files in root - // to / in path 2016-08-19 12:47:39 +01:00
Matt Pass
e3868fb285 Editor consistant, restore button added & mode set
CSS and JS files added plus settings added to make consistant with main
editor
Restore as new version button added
Load in new partial JS file to set the correct mode
2016-08-19 12:46:48 +01:00
Matt Pass
410ef385d5 Load partial JS file in now 2016-08-19 12:44:09 +01:00
Matt Pass
d5c019d05a Define laanguage modes in new partial JS file 2016-08-19 12:43:53 +01:00
Matt Pass
76b782535c Tag syncing now implemented & working
Replaced previous system which had some issues with a much more reliable
system and in less code too
2016-08-19 11:10:45 +01:00
Matt Pass
2a998016eb CodeMirror instance passed as 4th param 2016-08-19 11:04:54 +01:00
Matt Pass
f1a4710aea Tag replacement syncing improved & available again 2016-08-12 18:56:57 +01:00
Matt Pass
f8bbe45de7 Clearer wording on popup re changed file 2016-08-12 11:03:37 +01:00
Matt Pass
f5d8384469 Prefix URL with HTTP_HOST 2016-08-12 11:03:07 +01:00
Matt Pass
1266f73f64 Unescape short PHP and ASP tags
They are interpreted otherwise and JS modified to produce false
positive.
2016-08-09 09:55:31 +01:00
Matt Pass
cfee2c0182 Handle CORS errors & display info plus rejig events 2016-08-02 12:04:21 +01:00
Matt Pass
afe4222eb6 Colors wrapped in DIV and CORS wrapper added 2016-08-02 11:33:55 +01:00
Matt Pass
f2017c17b3 Change to site base & adjust help info also 2016-08-02 11:30:12 +01:00
Matt Pass
f15a1b1d8e Replacing alerts with ICEcoder.message 2016-08-01 08:39:48 +01:00
Matt Pass
41f52cc3be Animate diff pane in/out 2016-07-31 12:59:12 +01:00
29 changed files with 461 additions and 365 deletions

View File

@@ -3,7 +3,7 @@
ICEcoder is a web IDE / browser based code editor, which allows you to develop websites directly within the web browser. It uses the brilliant CodeMirror for code highlighting & editing, with a slick IDE wrapped around it to make the whole thing work.
<img src="https://icecoder.net/images/icecoder-v5-6-browser-code-editor.png" alt="ICEcoder web IDE">
<img src="https://icecoder.net/images/icecoder-v5-7-browser-code-editor.png" alt="ICEcoder web IDE">
###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).

View File

@@ -273,8 +273,8 @@ function createNewCMInstance(num) {
window['cM'+num+'diff'] .on("beforeSelectionChange", function(thisCM, changeObj) {top.ICEcoder.prevLineDiff = thisCM.getCursor().line;});
// Change
window['cM'+num] .on("change", function(thisCM, changeObj) {top.ICEcoder.cMonChange(thisCM,'cM'+num,changeObj)});
window['cM'+num+'diff'] .on("change", function(thisCM, changeObj) {top.ICEcoder.cMonChange(thisCM,'cM'+num+'diff',changeObj)});
window['cM'+num] .on("change", function(thisCM, changeObj) {top.ICEcoder.cMonChange(thisCM,'cM'+num,changeObj,CodeMirror)});
window['cM'+num+'diff'] .on("change", function(thisCM, changeObj) {top.ICEcoder.cMonChange(thisCM,'cM'+num+'diff',changeObj,CodeMirror)});
// Before change
window['cM'+num] .on("beforeChange", function(thisCM, changeObj) {top.ICEcoder.cMonBeforeChange(thisCM,'cM'+num,changeObj,CodeMirror)});

View File

@@ -3,28 +3,11 @@ include("lib/headers.php");
include("lib/settings.php");
$t = $text['index'];
// Check IP permissions
if (!in_array($_SERVER["REMOTE_ADDR"], $_SESSION['allowedIPs']) && !in_array("*", $_SESSION['allowedIPs'])) {
header('Location: /');
die("Sorry, not in allowed IPs list");
};
$updateMsg = '';
// Check for updates
if ($ICEcoder["checkUpdates"]) {
$icv_url = "https://icecoder.net/latest-version?thisVersion=".$ICEcoder["versionNo"];
if (ini_get('allow_url_fopen')) {
$icvInfo = @file_get_contents($icv_url,false,$context);
if (!$icvInfo) {
$icvInfo = file_get_contents(str_replace("https:","http:",$icv_url), false, $context);
}
$icvInfo = explode("\n",$icvInfo);
} elseif (function_exists('curl_init')) {
$ch = curl_init($icv_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$icvInfo = explode("\n", curl_exec($ch));
}
$icvInfo = explode("\n", getData($icv_url,'curl'));
$icv = $icvInfo[0];
$icvI = str_replace('"','\\\'',$icvInfo[1]);
$thisV = $ICEcoder["versionNo"];
@@ -175,7 +158,7 @@ $t = $text['index'];
<span id="singleFileMenuItems">
<a href="javascript:top.ICEcoder.renameFile(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1])" onMouseOver="ICEcoder.showFileMenu()"><?php echo $t['Rename'];?></a>
<div onMouseOver="ICEcoder.showFileMenu()" style="padding: 2px 0"><hr></div>
<a nohref onClick="window.open(iceRoot + top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,'/'))" onMouseOver="ICEcoder.showFileMenu()" style="cursor: pointer"><?php echo $t['View Webpage'];?></a>
<a nohref onClick="window.open('//<?php echo $_SERVER['HTTP_HOST'];?>' + iceRoot + top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,'/'))" onMouseOver="ICEcoder.showFileMenu()" style="cursor: pointer"><?php echo $t['View Webpage'];?></a>
</span>
<div onMouseOver="ICEcoder.showFileMenu()" style="padding: 2px 0"><hr></div>
<?php
@@ -330,6 +313,8 @@ $t = $text['index'];
<div class="nesting" id="nestValid"></div>
<div class="versionsDisplay" id="versionsDisplay" onclick="top.ICEcoder.versionsScreen(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1].replace(/\//g,'|'))"></div>
<div class="splitPaneControls" id="splitPaneControls"><div class="off" id="splitPaneControlsOff" title="<?php echo $t['Single pane'];?>" onclick="top.ICEcoder.setSplitPane('off')"></div><div class="on" id="splitPaneControlsOn" title="<?php echo $t['Diff pane also'];?>" onclick="top.ICEcoder.setSplitPane('on')" style="opacity: 0.5"></div></div>
<div class="splitPaneNames" id="splitPaneNamesMain">Main Pane</div>
<div class="splitPaneNames" id="splitPaneNamesDiff">Diff Pane</div>
<div class="byteDisplay" id="byteDisplay" style="display: none" onClick="top.ICEcoder.showDisplay('char')"></div>
<div class="charDisplay" id="charDisplay" style="display: inline-block" onClick="top.ICEcoder.showDisplay('byte')"></div>
</div>

View File

@@ -152,8 +152,8 @@ $text = array(
"Sorry, cannot delete more..." => "Sorry, cannot delete more then one item at a time under FTP mode",
"Sorry, cannot delete..." => "Sorry, cannot delete the root level",
"Sorry, cannot delete" => "Sorry, cannot delete",
"Sorry, this file..." => "Sorry, this file has changed, cannot save",
"Reload this file..." => "Reload this file and copy your version to a diff pane?",
"Sorry, this file..." => "Sorry, this file has changed outside of ICEcoder, cannot save",
"Reload this file..." => "Reload this file and copy your version to a diff pane?\\\\n(left side = file from server, right side = unsaved file)",
"There was a..." => "There was a tech hiccup, likely something was not quite ready. So ICEcoder reloaded its file control again.",
"displayed at" => "displayed at",
"Enter filename to..." => "Enter filename to save at",
@@ -171,13 +171,13 @@ $text = array(
"Are you sure..." => "Are you sure you wish to remove this site?",
"Add new site" => "Add new site",
"Edit site" => "Edit site",
"Site name" => "Site name",
"Site base" => "Site base",
"Host" => "Host",
"Username" => "Username",
"Password" => "Password",
"PASV and mode" => "PASV and mode",
"Root" => "Root",
"eg My Site" => "eg My Site",
"eg http://yourdomain.com" => "eg http://yourdomain.com",
"eg ftp.yourdomain.com" => "eg ftp.yourdomain.com",
"eg user123" => "eg user123",
"eg pass123" => "eg pass123",

View File

@@ -6,7 +6,7 @@ include("settings.php");
$file = str_replace("|","/",xssClean($_GET['file'],'html'));
// Get contents
$loadedFile = toUTF8noBOM(file_get_contents("../backups/".$file,false,$context),true);
$loadedFile = toUTF8noBOM(getData("../backups/".$file),true);
$encoding=ini_get("default_charset");
if($encoding=="")
$encoding="UTF-8";

View File

@@ -24,8 +24,25 @@ $versions = $fileCountInfo['count'];
.CodeMirror {position: absolute; width: 409px; height: 180px; font-size: <?php echo $ICEcoder["fontSize"];?>}
.CodeMirror-scroll {overflow: hidden}
/* Make sure this next one remains the 3rd item, updated with JS */
.cm-tab {border-left-width: <?php echo $ICEcoder["visibleTabs"] ? "1px" : "0";?>; margin-left: <?php echo $ICEcoder["visibleTabs"] ? "-1px" : "0";?>; border-left-style: solid; border-left-color: rgba(255,255,255,0.2)}
.cm-tab {border-left-width: <?php echo $ICEcoder["visibleTabs"] ? "1px" : "0";?>; margin-left: <?php echo $ICEcoder["visibleTabs"] ? "-1px" : "0";?>; border-left-style: solid; border-left-color: rgba(255,255,255,0.15)}
.cm-trailingspace {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg==);
background-position: bottom left;
background-repeat: repeat-x;
}
.CodeMirror-foldmarker {font-family: arial; line-height: .3; color: #b00; cursor: pointer;
text-shadow: #fff 1px 1px 2px, #fff -1px -1px 2px, #fff 1px -1px 2px, #fff -1px 1px 2px;
}
.CodeMirror-foldgutter {display: inline-block; width: 13px}
.CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded {position: absolute; display: inline-block; width: 13px; height: 13px; font-size: 14px; text-align: center; cursor: pointer}
.CodeMirror-foldgutter-open {background: rgba(255,255,255,0.04); color: #666}
.CodeMirror-foldgutter-open:after {position: relative; top: -2px}
.CodeMirror-foldgutter-folded {background: #800; color: #ddd}
.CodeMirror-foldgutter-folded:after {position: relative; top: -3px}
</style>
<script src="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/addon/fold/foldcode.js?microtime=<?php echo microtime(true);?>"></script>
<script src="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/addon/fold/foldgutter.js?microtime=<?php echo microtime(true);?>"></script>
<link rel="stylesheet" href="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/addon/fold/foldgutter.css?microtime=<?php echo microtime(true);?>">
<link rel="stylesheet" href="editor.css?microtime=<?php echo microtime(true);?>">
<?php
$themeArray = array();
@@ -74,9 +91,7 @@ foreach ($dateCounts as $key => $value) {
<div style="display: none; width: 180px; margin-left: 30px" id="buttonsContainer">
<div class="button" onclick="openNew()">Open in new tab</div>
<div class="button" onclick="openDiff()">Open in diff mode</div>
<!--
<div class="button" onclick="alert('Function not available yet - Coming in v5.4')">Restore as new version</div>
//-->
<div class="button" onclick="restoreVersion()">Restore as new version</div>
<div id="infoContainer"></div>
</div>
<div style="display: none">
@@ -93,12 +108,27 @@ var highlightVersion = function(elem) {
}
}
<?php
echo "fileName = '".basename($file)."';";
include(dirname(__FILE__)."/language-modes-partial.js");
?>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: mode,
lineNumbers: top.ICEcoder.lineNumbers,
readOnly: "nocursor",
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,
mode: "javascript",
matchBrackets: top.ICEcoder.matchBrackets,
electricChars: false,
highlightSelectionMatches: true,
showTrailingSpace: top.ICEcoder.showTrailingSpace,
lint: false,
readOnly: "nocursor",
theme: "<?php echo $ICEcoder["theme"]=="default" ? 'icecoder' : $ICEcoder["theme"];?>"
});
editor.setSize("480px","500px");
@@ -121,6 +151,18 @@ var openDiff = function() {
top.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();
cM.setValue(editor.getValue());
top.ICEcoder.saveFile();
}
}
</script>
</body>

View File

@@ -1,6 +1,6 @@
<?php
$ICEcoderUserSettings = array(
"versionNo" => "5.6",
"versionNo" => "5.7",
"licenseEmail" => "",
"licenseCode" => "",
"configCreateDate" => 0,

View File

@@ -6,7 +6,7 @@ include("settings.php");
$file = realpath($docRoot.$iceRoot.str_replace("|","/",strClean($_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("<script>alert('Sorry, that file doesn\'t appear to exist');</script>");
die("<script>top.ICEcoder.message('Sorry, that file doesn\'t appear to exist');</script>");
}
if (file_exists($file)) {

View File

@@ -230,7 +230,7 @@ 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='.$_POST["timeStart"].'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(top.ICEcoder.saveAsContent));
xhr.send(\'timeStart='.numClean($_POST["timeStart"]).'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(top.ICEcoder.saveAsContent));
top.ICEcoder.serverMessage("<b>'.$t['Saving'].'</b><br>" + "'.($finalAction == "Save" ? "newFileName" : "'".$fileName."'").'");
}
}
@@ -319,7 +319,7 @@ if (!$error && $_GET['action']=="save") {
// get old file contents, and count stats on usage \n and \r there
// in this case we can keep line endings, which file had before, without
// making code version control systems going crazy about line endings change in whole file.
$oldContents = file_exists($file)?file_get_contents($file):'';
$oldContents = file_exists($file)?getData($file):'';
$unixNewLines = preg_match_all('/[^\r][\n]/u', $oldContents);
$windowsNewLines = preg_match_all('/[\r][\n]/u', $oldContents);
} else {
@@ -399,7 +399,7 @@ if (!$error && $_GET['action']=="save") {
// Have a version index already? Update contents
if (file_exists($backupIndex)) {
$versionsInfo = "";
$versionsInfoOrig = file_get_contents($backupIndex,false,$context);
$versionsInfoOrig = getData($backupIndex);
$versionsInfoOrig = explode("\n",$versionsInfoOrig);
$replacedLine = false;
// For each line, either re-set number or simply include the line
@@ -451,7 +451,7 @@ if (!$error && $_GET['action']=="save") {
// 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.indexOf(".md")==-1) {
$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);
@@ -495,7 +495,7 @@ if (!$error && $_GET['action']=="save") {
} else {
// Only applicable for local files
$loadedFile = toUTF8noBOM(file_get_contents($file,false,$context),true);
$loadedFile = toUTF8noBOM(getData($file),true);
$fileCountInfo = getVersionsCount($fileLoc,$fileName);
$doNext .= '
var loadedFile = document.createElement("textarea");
@@ -852,7 +852,7 @@ function rrmdir($dir) {
if (!isset($ftpSite) && !$error && $_GET['action']=="replaceText") {
if (!$demoMode && is_writable($file)) {
$loadedFile = toUTF8noBOM(file_get_contents($file,false,$context),true);
$loadedFile = toUTF8noBOM(getData($file),true);
$newContent = str_replace(strClean($_GET['find']),strClean($_GET['replace']),$loadedFile);
$fh = fopen($file, 'w') or die($t['Sorry, cannot save']);
fwrite($fh, $newContent);
@@ -873,7 +873,7 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="replaceText") {
if (!isset($ftpSite) && !$error && $_GET['action']=="getRemoteFile") {
$lineNumber = max(isset($_REQUEST['lineNumber'])?intval($_REQUEST['lineNumber']):1, 1);
if ($remoteFile = toUTF8noBOM(file_get_contents($file,false,$context),true)) {
if ($remoteFile = toUTF8noBOM(getData($file,'curl'),true)) {
// replace \r\n (Windows), \r (old Mac) and \n (Linux) line endings with whatever we chose to be lineEnding
$remoteFile = str_replace("\r\n", $ICEcoder["lineEnding"], $remoteFile);
$remoteFile = str_replace("\r", $ICEcoder["lineEnding"], $remoteFile);
@@ -946,7 +946,7 @@ if (!isset($filemtime) && !is_dir($file)) {
$filemtime = $serverType=="Linux" ? filemtime($file) : "1000000";
}
// Set $timeStart, use 0 if not available
$timeStart = isset($_POST["timeStart"]) ? $_POST["timeStart"] : 0;
$timeStart = isset($_POST["timeStart"]) ? numClean($_POST["timeStart"]) : 0;
if (isset($ftpSite)) {
// Get info on dir/file now
@@ -979,12 +979,12 @@ echo '{
"exists": '.$itemExists.'
},
"action": {
"initial" : "'.$_GET["action"].'",
"initial" : "'.xssClean($_GET['action'],"html").'",
"final" : "'.$finalAction.'",
"timeStart": '.$timeStart.',
"timeEnd": 0,
"timeTaken": 0,
"csrf": "'.$_GET["csrf"].'",
"csrf": "'.xssClean($_GET['csrf'],"html").'",
"doNext" : "'.preg_replace('/\r|\n/','',str_replace(' ','',str_replace('"','\"',$doNext))).'top.ICEcoder.switchMode();"
},
"status": {

View File

@@ -59,7 +59,7 @@ for ($i=0; $i<count($allFiles); $i++) {
// Or a remote URL that doesn't start http
($_GET['action']=="getRemoteFile" && strpos($allFiles[$i],"http") !== 0)
) {
die("alert('Sorry! - problem with file requested');</script>");
die("top.ICEcoder.message('Sorry! - problem with file requested');</script>");
};
}
@@ -97,7 +97,7 @@ if ($_GET['action']=="load") {
ftpStart();
// Show user warning if no good connection
if (!$ftpConn || !$ftpLogin) {
die('alert("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>');
die('top.ICEcoder.message("Sorry, no FTP connection to '.$ftpHost.' for user '.$ftpUser.'");top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>');
exit;
}
// Get our file contents and close the FTP connection
@@ -105,7 +105,7 @@ if ($_GET['action']=="load") {
ftpEnd();
// Get local file
} else {
$loadedFile = toUTF8noBOM(file_get_contents($file,false,$context),true);
$loadedFile = toUTF8noBOM(getData($file),true);
}
$encoding=ini_get("default_charset");
if($encoding=="")
@@ -216,10 +216,13 @@ if (action=="load") {
"<div class=\"whiteGlow\" style=\"display: inline-block; margin-top: -10px; border: solid 10px #fff; color: #000; background-color: #fff\" id=\"imgInfo\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\">" +
"<b><?php echo $fileLoc."/".$fileName;?></b>" +
"</div><br>" +
"<div id=\"canvasPickerColorInfo\">"+
"<input type=\"text\" id=\"hexMouseXY\" style=\"border: 1px solid #888; border-right: 0; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" +
"<input type=\"text\" id=\"rgbMouseXY\" style=\"border: 1px solid #888; margin-right: 10px; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" +
"<input type=\"text\" id=\"hex\" style=\"border: 1px solid #888; border-right: 0; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>" +
"<input type=\"text\" id=\"rgb\" style=\"border: 1px solid #888; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>";
"<input type=\"text\" id=\"rgb\" style=\"border: 1px solid #888; width: 70px\" onmouseover=\"top.ICEcoder.overPopup=true\" onmouseout=\"top.ICEcoder.overPopup=false\"></input>"+
"</div>"+
"<div id=\"canvasPickerCORSInfo\" style=\"display: none; padding-top: 4px\">CORS not enabled on resource site</div>";
top.document.getElementById('floatingContainer').style.background = "#fff url('<?php echo $fileLoc."/".$fileName;?>') no-repeat 0 0";
}

View File

@@ -8,7 +8,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Get our old FTP sites & user settings
$oldFTPSites = $ICEcoder["ftpSites"];
$settingsContents = file_get_contents($settingsFile,false,$context);
$settingsContents = getData($settingsFile);
// ========
// CHOOSING
@@ -34,13 +34,13 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Add the new FTP site
if ($_POST['ftpSiteNEW'] != "") {
$settingsNew .= ' array(
"site" => "'.$_POST['ftpSiteNEW'].'",
"host" => "'.$_POST['ftpHostNEW'].'",
"user" => "'.$_POST['ftpUserNEW'].'",
"pass" => "'.$_POST['ftpPassNEW'].'",
"pasv" => '.$_POST['ftpPASVNEW'].',
"mode" => "'.$_POST['ftpModeNEW'].'",
"root" => "'.$_POST['ftpRootNEW'].'"
"site" => "'.injClean($_POST['ftpSiteNEW']).'",
"host" => "'.injClean($_POST['ftpHostNEW']).'",
"user" => "'.injClean($_POST['ftpUserNEW']).'",
"pass" => "'.injClean($_POST['ftpPassNEW']).'",
"pasv" => '.injClean($_POST['ftpPASVNEW']).',
"mode" => "'.injClean($_POST['ftpModeNEW']).'",
"root" => "'.injClean($_POST['ftpRootNEW']).'"
),
';
}
@@ -59,13 +59,13 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Updating
if ($_GET['action']=="update" && $i == $_GET['ftpSiteRef']) {
$settingsNew .= ' array(
"site" => "'.$_POST['ftpSiteNEW'].'",
"host" => "'.$_POST['ftpHostNEW'].'",
"user" => "'.$_POST['ftpUserNEW'].'",
"pass" => "'.$_POST['ftpPassNEW'].'",
"pasv" => '.$_POST['ftpPASVNEW'].',
"mode" => "'.$_POST['ftpModeNEW'].'",
"root" => "'.$_POST['ftpRootNEW'].'"
"site" => "'.injClean($_POST['ftpSiteNEW']).'",
"host" => "'.injClean($_POST['ftpHostNEW']).'",
"user" => "'.injClean($_POST['ftpUserNEW']).'",
"pass" => "'.injClean($_POST['ftpPassNEW']).'",
"pasv" => '.injClean($_POST['ftpPASVNEW']).',
"mode" => "'.injClean($_POST['ftpModeNEW']).'",
"root" => "'.injClean($_POST['ftpRootNEW']).'"
),
';
// Deleting
@@ -163,23 +163,23 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
<div style="display: inline-block; width: 600px">
<h2><?php echo isset($_GET['action']) && $_GET['action']=="edit" ? $t['Edit site'] : $t['Add new site'];?></h2><br>
<form id="ftpAddEditForm" action="ftp-manager.php?action=<?php echo isset($_GET['action']) && $_GET['action']=="edit" ? "update&ftpSiteRef=".$_GET['ftpSiteRef'] : "add";?>" method="POST">
<form id="ftpAddEditForm" action="ftp-manager.php?action=<?php echo isset($_GET['action']) && $_GET['action']=="edit" ? "update&ftpSiteRef=".numClean($_GET['ftpSiteRef']) : "add";?>" method="POST">
<table>
<tr>
<td style="padding-left: 5px"><?php echo $t['Site name'];?> <span class="info" title="<?php echo $t['eg My Site'];?>">[?]</span></td>
<td style="padding-left: 5px"><?php echo $t['Site base'];?> <span class="info" title="<?php echo $t['eg http://yourdomain.com'];?>">[?]</span></td>
<td style="padding-left: 5px"><?php echo $t['Host'];?> <span class="info" title="<?php echo $t['eg ftp.yourdomain.com'];?>">[?]</span></td>
</tr>
<tr>
<td style="padding: 0 10px 8px 0"><input type="text" name="ftpSiteNEW" value="<?php if (isset($_GET['action']) && $_GET['action']=="edit") {echo $ICEcoder['ftpSites'][$_GET['ftpSiteRef']]['site'];};?>" style="width: 272px"></td>
<td style="padding: 0 0 8px 0"><input type="text" name="ftpHostNEW" value="<?php if (isset($_GET['action']) && $_GET['action']=="edit") {echo $ICEcoder['ftpSites'][$_GET['ftpSiteRef']]['host'];};?>" style="width: 272px"></td>
<td style="padding: 0 10px 8px 0"><input type="text" name="ftpSiteNEW" value="<?php if (isset($_GET['action']) && $_GET['action']=="edit") {echo $ICEcoder['ftpSites'][numClean($_GET['ftpSiteRef'])]['site'];};?>" style="width: 272px"></td>
<td style="padding: 0 0 8px 0"><input type="text" name="ftpHostNEW" value="<?php if (isset($_GET['action']) && $_GET['action']=="edit") {echo $ICEcoder['ftpSites'][numClean($_GET['ftpSiteRef'])]['host'];};?>" style="width: 272px"></td>
</tr>
<tr>
<td style="padding-left: 5px"><?php echo $t['Username'];?> <span class="info" title="<?php echo $t['eg user123'];?>">[?]</span></td>
<td style="padding-left: 5px"><?php echo $t['Password'];?> <span class="info" title="<?php echo $t['eg pass123'];?>">[?]</span></td>
</tr>
<tr>
<td style="padding: 0 10px 8px 0"><input type="text" name="ftpUserNEW" value="<?php if (isset($_GET['action']) && $_GET['action']=="edit") {echo $ICEcoder['ftpSites'][$_GET['ftpSiteRef']]['user'];};?>" style="width: 272px"></td>
<td style="padding: 0 0 8px 0"><input type="password" name="ftpPassNEW" value="<?php if (isset($_GET['action']) && $_GET['action']=="edit") {echo $ICEcoder['ftpSites'][$_GET['ftpSiteRef']]['pass'];};?>" style="width: 272px"></td>
<td style="padding: 0 10px 8px 0"><input type="text" name="ftpUserNEW" value="<?php if (isset($_GET['action']) && $_GET['action']=="edit") {echo $ICEcoder['ftpSites'][numClean($_GET['ftpSiteRef'])]['user'];};?>" style="width: 272px"></td>
<td style="padding: 0 0 8px 0"><input type="password" name="ftpPassNEW" value="<?php if (isset($_GET['action']) && $_GET['action']=="edit") {echo $ICEcoder['ftpSites'][numClean($_GET['ftpSiteRef'])]['pass'];};?>" style="width: 272px"></td>
</tr>
<tr>
<td style="padding-left: 5px"><?php echo $t['PASV and mode'];?> <span class="info" title="<?php echo $t['Use PASV mode...'];?>">[?]</span></td>
@@ -196,7 +196,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
<option value="FTP_BINARY"<?php echo isset($_GET['action']) && $_GET['action']=="edit" && $ICEcoder['ftpSites'][$_GET['ftpSiteRef']]['mode'] == "FTP_BINARY" ? " selected" : "";?>><?php echo $t['Binary transfer'];?></option>
</select>
</td>
<td style="padding: 0 0 8px 0"><input type="text" name="ftpRootNEW" value="<?php if (isset($_GET['action']) && $_GET['action']=="edit") {echo $ICEcoder['ftpSites'][$_GET['ftpSiteRef']]['root'];};?>" style="width: 272px"></td>
<td style="padding: 0 0 8px 0"><input type="text" name="ftpRootNEW" value="<?php if (isset($_GET['action']) && $_GET['action']=="edit") {echo $ICEcoder['ftpSites'][numClean($_GET['ftpSiteRef'])]['root'];};?>" style="width: 272px"></td>
</tr>
<tr>
<td colspan="2" style="padding: 3px 0 8px 0; text-align: right"><div style="display: inline-block; padding: 5px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="document.getElementById('ftpAddEditForm').submit()"><?php echo isset($_GET['action']) && $_GET['action']=="edit" ? $t['Update'] : $t['Add'];?></div></td>

View File

@@ -230,7 +230,7 @@ if (!isset($ftpSite) && $_SESSION['githubDiff']) {
// If we're not looking at a .git dir, it's not a .gitignore excluded path and not a dir
if (strpos($fileFolderName,".git/") == false && !in_array($docRoot.$iceRoot.$fileFolderName, $excluded) && !is_dir($docRoot.$iceRoot.$fileFolderName)) {
// Get contents of file
$contents = file_get_contents($docRoot.$iceRoot.$fileFolderName);
$contents = getData($docRoot.$iceRoot.$fileFolderName);
$finfo = "text";
// Determine if we should remove \r line endings based on mime type (text files yes, others no)

View File

@@ -9,7 +9,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Get our old paths & user settings
$oldLocal = $ICEcoder["githubLocalPaths"];
$oldRemote = $ICEcoder["githubRemotePaths"];
$settingsContents = file_get_contents($settingsFile,false,$context);
$settingsContents = getData($settingsFile);
// ========
// CHOOSING
@@ -77,7 +77,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Add the new one
if ($_POST['githubLocalPathNEW'] != "" && $_POST['githubRemotePathNEW'] != "") {
$settingsNew .= '"'.xssClean($_POST['githubLocalPathNEW'],"html").'",';
$settingsNew .= '"'.injClean(xssClean($_POST['githubLocalPathNEW'],"html")).'",';
}
// Then set all the old local paths
@@ -93,7 +93,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Add the new one
if ($_POST['githubLocalPathNEW'] != "" && $_POST['githubRemotePathNEW'] != "") {
$settingsNew .= '"'.xssClean($_POST['githubRemotePathNEW'],"html").'",';
$settingsNew .= '"'.injClean(xssClean($_POST['githubRemotePathNEW'],"html")).'",';
}
// Then set all the old remote paths
@@ -118,7 +118,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Redo the arrays using the form data
for ($i=0; $i<count($oldLocal); $i++) {
if ($_POST['githubLocalPath'.$i] != "") {
$settingsNew .= '"'.xssClean($_POST['githubLocalPath'.$i],"html").'",';
$settingsNew .= '"'.injClean(xssClean($_POST['githubLocalPath'.$i],"html")).'",';
}
}
// Rtrim off the last comma
@@ -131,7 +131,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Redo the arrays using the form data
for ($i=0; $i<count($oldRemote); $i++) {
if ($_POST['githubRemotePath'.$i] != "") {
$settingsNew .= '"'.xssClean($_POST['githubRemotePath'.$i],"html").'",';
$settingsNew .= '"'.injClean(xssClean($_POST['githubRemotePath'.$i],"html")).'",';
}
}
// Rtrim off the last comma

View File

@@ -88,14 +88,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
$zipURL = $iceGithubRemotePaths[$pathPos].'/zipball/master';
$zipFile = "../tmp/".basename($zipURL);
if (ini_get('allow_url_fopen')) {
$fileData = file_get_contents($zipURL, false, $context);
} elseif (function_exists('curl_init')) {
$client = curl_init($zipURL);
curl_setopt($client, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($client, CURLOPT_RETURNTRANSFER, 1); //fixed this line
$fileData = curl_exec($client);
}
$fileData = getData($zipURL,'curl');
file_put_contents($zipFile, $fileData);
// Now unpack the zip
@@ -189,10 +182,10 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Only get the file if it exists and begins with our $docRoot
if (file_exists($file) && strpos($file,$docRoot) === 0) {
$loadedFile = toUTF8noBOM(file_get_contents($file,false,$context),true);
$loadedFile = toUTF8noBOM(getData($file),true);
echo '<textarea name="loadedFile'.$i.'" id="loadedFile'.$i.'" style="display: none">'.str_replace("</textarea>","<ICEcoder:/:textarea>",str_replace("&","&amp;",$loadedFile)).'</textarea><br><br>'.PHP_EOL.PHP_EOL;
} else {
die("<script>alert('Sorry, that file doesn\'t appear to exist');</script>");
die("<script>top.ICEcoder.message('Sorry, that file doesn\'t appear to exist');</script>");
}
}
?>

View File

@@ -6,7 +6,7 @@ $t = $text['settings-update'];
// Update our 'root' value to be blank
// which resets the file manager to localhost root again
if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn']) {
$settingsContents = file_get_contents($settingsFile,false,$context);
$settingsContents = getData($settingsFile);
// Replace our root var
$repPosStart = strpos($settingsContents,'"root"');
$repPosEnd = strpos($settingsContents,'"checkUpdates"');

View File

@@ -141,6 +141,7 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
.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}
.fileMenu {position: absolute; display: none; left: 0; top: 0; background-color: #333; z-index: 10;

View File

@@ -47,7 +47,7 @@ var ICEcoder = {
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
endTagReplaceData: [], // Will contain data for automatic end tag replacement
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
@@ -56,6 +56,7 @@ var ICEcoder = {
githubDiff: false, // Toggle for viewing GitHub/FM diff view
githubAuthTokenSet: false, // Has the user set their GitHub token yet
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
@@ -65,7 +66,7 @@ var ICEcoder = {
// Set our aliases
initAliases: function() {
var aliasArray = ["header","files", "fileOptions", "optionsFile", "optionsEdit", "optionsSource", "optionsHelp", "filesFrame","editor","tabsBar","findBar","content","footer","nestValid","versionsDisplay","splitPaneControls","charDisplay","byteDisplay"];
var aliasArray = ["header","files", "fileOptions", "optionsFile", "optionsEdit", "optionsSource", "optionsHelp", "filesFrame", "editor", "tabsBar", "findBar", "content", "footer", "nestValid", "versionsDisplay", "splitPaneControls", "splitPaneNamesMain", "splitPaneNamesDiff", "charDisplay", "byteDisplay"];
// Create our ID aliases
for (var i=0;i<aliasArray.length;i++) {
@@ -164,6 +165,8 @@ var ICEcoder = {
this.nestValid.style.left = (this.filesW+10) + "px";
this.versionsDisplay.style.left = (this.filesW+25) + "px";
this.splitPaneControls.style.left = (parseInt((winW-this.filesW)/2,10)-25-4+this.filesW) + "px";
this.splitPaneNamesMain.style.left = (parseInt((winW-this.filesW)*0.25,10)-50+this.filesW) + "px";
this.splitPaneNamesDiff.style.left = (parseInt((winW-this.filesW)*0.75,10)-50+this.filesW) + "px";
top.ICEcoder.setTabWidths();
// If we need to set the editor sizes
@@ -175,12 +178,13 @@ var ICEcoder = {
setTimeout(function(){
for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
// Done the long way here as we need to call them in specific order to stop showing background and so avoiding a flicker effect
if (!top.ICEcoder.splitPane) {
top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]].setSize(top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.content.style.height);
}
top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]+'diff'].setSize((100-top.ICEcoder.splitPaneLeftPerc)+"%",top.ICEcoder.content.style.height);
top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]+'diff'].getWrapperElement().style.left = top.ICEcoder.splitPaneLeftPerc+"%";
if (top.ICEcoder.splitPane) {
top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]+'diff'].setSize("50%",top.ICEcoder.content.style.height);
top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]].setSize("50%",top.ICEcoder.content.style.height);
} else {
top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]].setSize("100%",top.ICEcoder.content.style.height);
top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]+'diff'].setSize("0",top.ICEcoder.content.style.height);
top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]].setSize(top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.content.style.height);
}
}
// Place resultsBar to edge of pane or it's scrollbar
@@ -200,6 +204,7 @@ var ICEcoder = {
top.ICEcoder.splitPane = onOff == "on" ? true : false;
top.get('splitPaneControlsOff').style.opacity = top.ICEcoder.splitPane ? 0.5 : 1;
top.get('splitPaneControlsOn').style.opacity = top.ICEcoder.splitPane ? 1 : 0.5;
top.get('splitPaneNamesMain').style.opacity = top.get('splitPaneNamesDiff').style.opacity = top.ICEcoder.splitPane ? 1 : 0;
top.ICEcoder.setLayout();
// Also clear marks (if going to a single pane) or redo the marks (if split pane)
@@ -212,17 +217,40 @@ var ICEcoder = {
cM = top.ICEcoder.getcMInstance();
cMdiff = top.ICEcoder.getcMdiffInstance();
// Clear all main pane marks
cMmarks = cM.getAllMarks();
for (var i=0; i<cMmarks.length; i++) {
cMmarks[i].clear();
}
// Clear all diff pane marks
cMdiffMarks = cMdiff.getAllMarks();
for (var i=0; i<cMdiffMarks.length; i++) {
cMdiffMarks[i].clear();
if (cM) {
// Clear all main pane marks
cMmarks = cM.getAllMarks();
for (var i=0; i<cMmarks.length; i++) {
cMmarks[i].clear();
}
// Clear all diff pane marks
cMdiffMarks = cMdiff.getAllMarks();
for (var i=0; i<cMdiffMarks.length; i++) {
cMdiffMarks[i].clear();
}
}
}
// Animate in/out the split pane
// First, clear any existing split pane interval anim
if ("undefined" != typeof top.ICEcoder.animSplitPaneInt) {
clearInterval(top.ICEcoder.animSplitPaneInt);
}
// Now set the interval to animate it in/out
top.ICEcoder.animSplitPaneInt = setInterval(function() {
// Animate split pane in
if (top.ICEcoder.splitPane && top.ICEcoder.splitPaneLeftPerc > 50.1) {
top.ICEcoder.splitPaneLeftPerc = ((top.ICEcoder.splitPaneLeftPerc-50)/1.8)+50;
// Animate split pane out
} else if (!top.ICEcoder.splitPane && top.ICEcoder.splitPaneLeftPerc < 99.9) {
top.ICEcoder.splitPaneLeftPerc = (50-((100-top.ICEcoder.splitPaneLeftPerc)/1.8))+50;
// Finish animating split pane in/out
} else {
top.ICEcoder.splitPaneLeftPerc = top.ICEcoder.splitPane ? 50 : 100;
clearInterval(top.ICEcoder.animSplitPaneInt);
}
top.ICEcoder.setLayout();
},4);
},
// Set the width of the file manager on demand
@@ -366,34 +394,25 @@ var ICEcoder = {
// On before change
cMonBeforeChange: function(thisCM,cMinstance,changeObj,cM) {
var sels, tokenString, range, canMaybeReplace, thisData;
var sels, tagInfo, tagOpp, thisData;
// Get the selections
sels = thisCM.listSelections();
// For each of the user selections
sels = thisCM.listSelections();
for (var i=0; i<sels.length; i++) {
// Get the token at the cursor start (anchor) position
tokenString = thisCM.getTokenAt(sels[i].anchor);
// If we're just inside a tag, move along 1 char pos and get token info at that position
if (tokenString.type == "tag bracket" && tokenString.string == "<") {
tokenString = thisCM.getTokenAt({line: sels[i].anchor.line, ch: sels[i].anchor.ch+1});
}
// If we're inside a tag now
if (tokenString.type == "tag") {
// Test for range info
range = cM.fold['xml'](thisCM, sels[i].anchor);
canMaybeReplace = true;
for (var j=0; j<top.ICEcoder.endTagReplaceData.length; j++) {
// If we have range info and we're start and end are on the same line
if ("undefined" != typeof range && top.ICEcoder.endTagReplaceData[j].split(";")[1] == range.to.line + ":" + range.to.ch) {
canMaybeReplace = false;
}
}
// If we can still replace and have range info and not undoing/redoing (as that replaces chunks itself)
if (canMaybeReplace && "undefined" != typeof range && changeObj.origin != "undo" && changeObj.origin != "redo") {
// Work out the data string to set and if not in array, push in ready to handle on change event
thisData = tokenString.string + ";" + range.to.line + ":" + range.to.ch;
if (top.ICEcoder.endTagReplaceData.indexOf(thisData) == -1) {
top.ICEcoder.endTagReplaceData.push(thisData);
// Get the matching tagInfo for current cursor position
tagInfo = cM.findMatchingTag(thisCM, sels[i].anchor);
// If we're not ending a tag (autocompletion) and we have tagInfo and not undoing/redoing (which handles changes itself)
if (changeObj.text[0].indexOf(">") !== 0 && "undefined" != typeof tagInfo && changeObj.origin != "undo" && changeObj.origin != "redo") {
// If we also have both open and close tag info
if ("undefined" != typeof tagInfo.open && "undefined" != typeof tagInfo.close) {
// Log the opposite tag info
tagOpp = tagInfo.at == "open" ? "close" : "open";
thisData = tagInfo[tagOpp].tag + ";" + tagInfo[tagOpp].from.line + ":" + tagInfo[tagOpp].from.ch;
// Check that string firstly isn't in array and if not, push it in
if (top.ICEcoder.oppTagReplaceData.indexOf(thisData) == -1) {
top.ICEcoder.oppTagReplaceData.push(thisData);
}
}
}
@@ -401,8 +420,11 @@ var ICEcoder = {
},
// On change
cMonChange: function(thisCM,cMinstance,changeObj) {
var rData, thisToken, repl1, repl2, tTS, filepath, filename, fileExt;
cMonChange: function(thisCM,cMinstance,changeObj,cM) {
var sels, rData, theTag, thisLine, thisChar, tagInfo, charDiff, closeDiff, repl1, repl2, thisToken, tTS, filepath, filename, fileExt;
// Get the selections
sels = thisCM.listSelections();
// If we're not loading the file, it's a change, so update tab
if (!top.ICEcoder.loadingFile) {
@@ -415,34 +437,55 @@ var ICEcoder = {
top.ICEcoder.setLayout();
},0);
// If we're replacing end tag strings, do that
if (top.ICEcoder.endTagReplaceData.length > 0) {
// If we're replacing opposite tag strings, do that
if ("undefined" != typeof top.ICEcoder.oppTagReplaceData[0]) {
// For each one of them, grab our data to work with
for (var i=0; i<top.ICEcoder.endTagReplaceData.length; i++) {
rData = top.ICEcoder.endTagReplaceData[i].split(";");
for (var i=0; i<top.ICEcoder.oppTagReplaceData.length; i++) {
// Extract data from that string
rData = top.ICEcoder.oppTagReplaceData[i].split(";");
theTag = rData[0];
thisLine = rData[1].split(":")[0]*1;
thisChar = rData[1].split(":")[1]*1;
// Don't do anything if it's the same line, as we can't rely on fold range data due to nested tags
if (rData[1].split(":")[0]*1 == changeObj.from.line) {
continue;
// Get the tag info for matching tag
if (sels[i]) {
tagInfo = cM.findMatchingTag(thisCM, sels[i].anchor);
}
// Otherwise, work out the replace ranges
repl1 = {line: rData[1].split(":")[0]*1, ch: (rData[1].split(":")[1]*1)+2};
repl2 = {line: rData[1].split(":")[0]*1, ch: (rData[1].split(":")[1]*1)+2+rData[0].length};
// Establish the string to replace with
thisToken = thisCM.getTokenAt(thisCM.listSelections()[i].anchor);
tTS = thisToken.string;
if (tTS == "<" ) {
tTS = "";
// If we have tagInfo
if ("undefined" != typeof tagInfo) {
// Get the opposite tag string
theTag = tagInfo.at == "open" ? tagInfo.open.tag : tagInfo.close.tag;
// If we have changeObj.from info to work with
if ("undefined" != typeof changeObj.from) {
// Same line changing needs a chararacter pos shift
charDiff = thisLine == changeObj.from.line
? changeObj.text[0].length - changeObj.removed[0].length
: 0;
// Also need to adjust if we're in the close tag on same line
closeDiff = tagInfo.at == "close" && thisLine == changeObj.from.line
? changeObj.removed[0].length - changeObj.text[0].length + 1
: 1
// Work out the replace from and to positions
repl1 = {line: thisLine, ch: thisChar+charDiff+(tagInfo.at == "open" ? 2 : closeDiff)};
repl2 = {line: thisLine, ch: thisChar+charDiff+(tagInfo.at == "open" ? 2 : closeDiff)+rData[0].length};
}
}
// Replace our string over the range
// Disabled for now, as buggy
// thisCM.replaceRange(tTS, repl1, repl2);
// Replace our string over the range, if this token string isn't blank and the end tag matches our original tag
if (theTag.trim() != "" && "undefined" != typeof repl1 && "undefined" != typeof repl2 && thisCM.getRange(repl1,repl2) == rData[0]) {
thisCM.replaceRange(theTag, repl1, repl2);
// If at the close tag, don't autocomplete
if (tagInfo.at == "close") {
top.ICEcoder.autocompleteSkip = true;
}
}
}
}
// Reset the array ready for next time
top.ICEcoder.endTagReplaceData = [];
// Reset our array for next time
top.ICEcoder.oppTagReplaceData = [];
top.ICEcoder.getCaretPosition();
top.ICEcoder.updateCharDisplay();
@@ -484,8 +527,10 @@ var ICEcoder = {
cMdiff = top.ICEcoder.getcMdiffInstance();
otherCM = cMinstance.indexOf('diff') > -1 ? cM : cMdiff;
// Scroll other pane x & y to match this one we're scrolling, after a 0ms tickover to avoid judder
setTimeout(function(){otherCM.scrollTo(thisCM.getScrollInfo().left, thisCM.getScrollInfo().top);},0);
if (cM) {
// Scroll other pane x & y to match this one we're scrolling, after a 0ms tickover to avoid judder
setTimeout(function(){otherCM.scrollTo(thisCM.getScrollInfo().left, thisCM.getScrollInfo().top);},0);
}
}
},
@@ -497,7 +542,11 @@ var ICEcoder = {
// clearTimeout(top.ICEcoder.debounce);
if (!thisCM.state.completionActive) {
// top.ICEcoder.debounce = setTimeout(function() {
top.ICEcoder.autocomplete();
if (!top.ICEcoder.autocompleteSkip) {
top.ICEcoder.autocomplete();
} else {
top.ICEcoder.autocompleteSkip = false;
}
// },0);
}
}
@@ -2421,10 +2470,33 @@ var ICEcoder = {
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";
}
// 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;
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";
// Show image preview box on mouse over
top.get('canvasPicker').onmouseover = function(event) {
get('floatingContainer').style.visibility = "visible";
};
// Hide image preview box on mouse out
top.get('canvasPicker').onmouseout = function(event) {
get('floatingContainer').style.visibility = "hidden";
};
}
top.document.getElementById('floatingContainer').style.backgroundSize = (imgThis.naturalWidth*5)+"px "+(imgThis.naturalHeight*5)+"px";
@@ -2467,18 +2539,11 @@ var ICEcoder = {
fcBGY = -((y*5)*(imgThis.naturalHeight/imgThis.height))+25;
fcElem.style.backgroundPosition = fcBGX+"px "+fcBGY+"px";
};
// Show image preview box on mouse over
top.get('canvasPicker').onmouseover = function(event) {
get('floatingContainer').style.visibility = "visible";
};
// Hide image preview box on mouse out
top.get('canvasPicker').onmouseout = function(event) {
get('floatingContainer').style.visibility = "hidden";
};
// 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').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;
}

209
lib/ice-coder.min.js vendored
View File

@@ -1,46 +1,49 @@
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,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",serverQueueItems:[],previewWindow:!1,previewWindowLoading:!1,pluginIntervalRefs:[],overPopup:!1,cmdKey:!1,endTagReplaceData:[],fmReady:!1,bugReportStatus:"off",bugReportPath:"",bugFilesSizesSeen:[],bugFilesSizesActual:[],githubDiff:!1,githubAuthTokenSet:!1,splitPane:!1,renderLineStyle:[],renderPaneShiftAmount:0,debounce:"",editorFocusInstance:"",openSeconds:0,ready:!1,initAliases:function(){for(var a="header files fileOptions optionsFile optionsEdit optionsSource optionsHelp filesFrame editor tabsBar findBar content footer nestValid versionsDisplay splitPaneControls charDisplay byteDisplay".split(" "),
b=0;b<a.length;b++)ICEcoder[a[b]]=top.get(a[b])},init:function(){top.ICEcoder.lockedNav||(top.ICEcoder.filesW=ICEcoder.minFilesW);ICEcoder.setLayout();top.ICEcoder.overFileFolder("folder","|");top.ICEcoder.selectFileFolder("init");top.ICEcoder.filesFrame.contentWindow.focus();top.ICEcoder.showHide("hide",top.get("loadingMask"));top.ICEcoder.autoOpenInt=setInterval(function(){top.ICEcoder.fmReady&&(top.ICEcoder.openLastFiles&&setTimeout(function(){top.ICEcoder.autoOpenFiles()},200),clearInterval(top.ICEcoder.autoOpenInt))},
4);setInterval(ICEcoder.updateNestingIndicator,30);top.ICEcoder.startBugChecking();top.ICEcoder.autoLogoutTimer=0;top.ICEcoder.oneSecondInt=setInterval(function(){top.ICEcoder.autoLogoutTimer++;for(var a=!1,b=1;b<=ICEcoder.savedPoints.length;b++)ICEcoder.savedPoints[b-1]!=top.ICEcoder.getcMInstance(b).changeGeneration()&&(a=!0);!a&&1<top.ICEcoder.autoLogoutMins&&top.ICEcoder.autoLogoutTimer==60*top.ICEcoder.autoLogoutMins-60&&top.ICEcoder.autoLogoutWarningScreen();get("autoLogoutIFrame")&&get("autoLogoutIFrame").contentWindow.document.getElementById("timeRemaning")&&
(get("autoLogoutIFrame").contentWindow.document.getElementById("timeRemaning").innerHTML=0<top.ICEcoder.autoLogoutTimer?60*top.ICEcoder.autoLogoutMins-top.ICEcoder.autoLogoutTimer:0);!a&&0<ICEcoder.autoLogoutMins&&top.ICEcoder.autoLogoutTimer>=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")},1E3);top.ICEcoder.ready=!0},
setLayout:function(a){var b,c;b=window.innerWidth;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+"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,10)-25-4+this.filesW+"px";top.ICEcoder.setTabWidths();a||(this.editor.style.width=ICEcoder.content.style.width=b-this.filesW+"px",ICEcoder.content.style.height=c-25-21-28-26+"px",setTimeout(function(){for(var a=0;a<top.ICEcoder.openFiles.length;a++)top.ICEcoder.splitPane?(top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]+"diff"].setSize("50%",top.ICEcoder.content.style.height),top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]].setSize("50%",top.ICEcoder.content.style.height)):
(top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]].setSize("100%",top.ICEcoder.content.style.height),top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]+"diff"].setSize("0",top.ICEcoder.content.style.height));top.ICEcoder.splitPane?top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.right=top.ICEcoder.scrollBarVisible?parseInt(parseInt(ICEcoder.content.style.width,10)/2,10)+17+"px":parseInt(parseInt(ICEcoder.content.style.width,10)/2,10)+"px":
top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.right=top.ICEcoder.scrollBarVisible?"17px":"0"},4))},setSplitPane:function(a){var b;top.ICEcoder.splitPane="on"==a?!0:!1;top.get("splitPaneControlsOff").style.opacity=top.ICEcoder.splitPane?.5:1;top.get("splitPaneControlsOn").style.opacity=top.ICEcoder.splitPane?1:.5;top.ICEcoder.setLayout();if(top.ICEcoder.splitPane)top.ICEcoder.updateDiffs(),b=top.ICEcoder.getcMInstance(),top.ICEcoder.cMonScroll(b,"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-
1]);else{b=top.ICEcoder.getcMInstance();a=top.ICEcoder.getcMdiffInstance();cMmarks=b.getAllMarks();for(b=0;b<cMmarks.length;b++)cMmarks[b].clear();cMdiffMarks=a.getAllMarks();for(b=0;b<cMdiffMarks.length;b++)cMdiffMarks[b].clear()}},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.filesW<ICEcoder.maxFilesW-1?ICEcoder.filesW+=Math.ceil((ICEcoder.maxFilesW-ICEcoder.filesW)/2):ICEcoder.filesW=ICEcoder.maxFilesW:ICEcoder.filesW>ICEcoder.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;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){var c;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();c=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.prevLineDiff:top.ICEcoder.prevLine;c!=a.getCursor().line&&a.getLine(c)&&0<a.getLine(c).length&&0==a.getLine(c).replace(/\s/g,"").length&&a.replaceRange("",{line:c,ch:0},{line:c,ch:1E6});setTimeout(function(){for(var c,e=0;e<top.ICEcoder.renderLineStyle.length;e++){c=
!1;if("diff"!=top.ICEcoder.renderLineStyle[e][0]&&-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[e][0]&&-1<b.indexOf("diff"))c=!0;c&&a.getCursor().line+1==top.ICEcoder.renderLineStyle[e][1]?a.setOption("cursorHeight",a.defaultTextHeight()/a.lineInfo(a.getCursor().line).handle.height):a.setOption("cursorHeight",1)}},0)},cMonBeforeChange:function(a,b,c,d){var e,f,g;b=a.listSelections();for(var k=0;k<b.length;k++)if(e=a.getTokenAt(b[k].anchor),"tag bracket"==e.type&&"<"==e.string&&(e=a.getTokenAt({line:b[k].anchor.line,
ch:b[k].anchor.ch+1})),"tag"==e.type){f=d.fold.xml(a,b[k].anchor);g=!0;for(var h=0;h<top.ICEcoder.endTagReplaceData.length;h++)"undefined"!=typeof f&&top.ICEcoder.endTagReplaceData[h].split(";")[1]==f.to.line+":"+f.to.ch&&(g=!1);g&&"undefined"!=typeof f&&"undo"!=c.origin&&"redo"!=c.origin&&(e=e.string+";"+f.to.line+":"+f.to.ch,-1==top.ICEcoder.endTagReplaceData.indexOf(e)&&top.ICEcoder.endTagReplaceData.push(e))}},cMonChange:function(a,b,c){var d,e,f;top.ICEcoder.loadingFile||top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);
setTimeout(function(){top.ICEcoder.scrollBarVisible=a.getScrollInfo().height>a.getScrollInfo().clientHeight;top.ICEcoder.setLayout()},0);if(0<top.ICEcoder.endTagReplaceData.length)for(b=0;b<top.ICEcoder.endTagReplaceData.length;b++)d=top.ICEcoder.endTagReplaceData[b].split(";"),1*d[1].split(":")[0]!=c.from.line&&(d[1].split(":"),d[1].split(":"),d[1].split(":"),d[1].split(":"),d=a.getTokenAt(a.listSelections()[b].anchor),d=d.string,"<"==d&&(d=""));top.ICEcoder.endTagReplaceData=[];top.ICEcoder.getCaretPosition();
top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay();top.ICEcoder.updateNestingIndicator();top.ICEcoder.findMode&&(top.ICEcoder.results.splice(top.ICEcoder.findResult,1),top.get("results").innerHTML=top.ICEcoder.results.length+" "+top.t.results,top.ICEcoder.findMode=!1);if(c=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1])e=c.substr(c.lastIndexOf("/")+1),f=e.substr(e.lastIndexOf(".")+1);top.ICEcoder.splitPane&&setTimeout(function(){top.ICEcoder.updateDiffs()},0);c&&top.ICEcoder.previewWindow.location&&
"/[NEW]"!=c&&top.ICEcoder.updatePreviewWindow(a,c,e,f);top.ICEcoder.indicateChanges()},cMonScroll:function(a,b){var c,d,e;top.ICEcoder.mouseDown=!1;top.ICEcoder.mouseDownInCM=!1;top.ICEcoder.splitPane&&(c=top.ICEcoder.getcMInstance(),d=top.ICEcoder.getcMdiffInstance(),e=-1<b.indexOf("diff")?c:d,setTimeout(function(){e.scrollTo(a.getScrollInfo().left,a.getScrollInfo().top)},0))},cMonInputRead:function(a,b){"keypress"==top.ICEcoder.autoComplete&&top.ICEcoder.codeAssist&&(a.state.completionActive||top.ICEcoder.autocomplete())},
cMonGutterClick:function(a,b,c,d,e){top.ICEcoder.mouseDownInCM="gutter"},cMonMouseDown:function(a,b){top.ICEcoder.mouseDownInCM="editor"},cMonDragOver:function(a,b,c){top.ICEcoder.setDragCursor(b,"editor")},cMonRenderLine:function(a,b,c,d){for(var e,f=0;f<top.ICEcoder.renderLineStyle.length;f++){e=!1;if("diff"!=top.ICEcoder.renderLineStyle[f][0]&&-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[f][0]&&-1<b.indexOf("diff"))e=!0;e&&a.lineInfo(c).line+1==top.ICEcoder.renderLineStyle[f][1]&&
(d.style[top.ICEcoder.renderLineStyle[f][2]]=top.ICEcoder.renderLineStyle[f][3])}},updateDiffs:function(){var a,b,c,d,e,f;top.ICEcoder.renderLineStyle=[];top.ICEcoder.renderPaneShiftAmount=0;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();c=a?difflib.stringAsLines(a.getValue()):"";d=b?difflib.stringAsLines(b.getValue()):"";c=(new difflib.SequenceMatcher(c,d)).get_opcodes();if(a){e=a.getAllMarks();for(d=0;d<e.length;d++)e[d].clear();e=b.getAllMarks();for(d=0;d<e.length;d++)e[d].clear()}if(a&&
""!=b.getValue())for(d=0;d<c.length;d++)if("equal"!==c[d][0]){if("replace"==c[d][0]){f=(c[d][4]-c[d][2]+1+top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)b.getLineHandle(e).height>a.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;e<c[d][2]-c[d][1];e++)f=top.ICEcoder.findStringDiffs(a.getLine(c[d][1]+e),b.getLine(c[d][3]+e)),a.markText({line:c[d][1]+
e,ch:0},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:f[0]},{className:"diffGreyLighter"}),a.markText({line:c[d][1]+e,ch:f[0]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:f[0]+f[1]},{className:"diffGrey"}),a.markText({line:c[d][1]+e,ch:f[0]+f[1]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:1E6},{className:"diffGreyLighter"})}else a.markText({line:c[d][1],ch:0},{line:c[d][2]-1,ch:1E6},{className:"diffGreen"});"replace"!=c[d][0]&&c[d][1]==c[d][2]&&(top.ICEcoder.renderLineStyle.push(["main",
c[d][2],"height",(c[d][4]-c[d][3]+1)*a.defaultTextHeight()+"px"]),a.markText({line:c[d][2]-1,ch:0},{line:c[d][2]-1,ch:1E6},{className:"diffNone"}));if("replace"==c[d][0]){f=(c[d][2]-c[d][4]+1-top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)a.getLineHandle(e).height>a.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;e<c[d][4]-c[d][3];e++)f=
top.ICEcoder.findStringDiffs(a.getLine(c[d][1]+e),b.getLine(c[d][3]+e)),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:0},{line:c[d][3]+e,ch:f[0]},{className:"diffGreyLighter"}),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:f[0]},{line:c[d][3]+e,ch:f[0]+f[2]},{className:"diffGrey"}),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:f[0]+f[2]},{line:c[d][3]+e,ch:1E6},{className:"diffGreyLighter"})}else b.markText({line:c[d][3],ch:0},{line:c[d][4]-
1,ch:1E6},{className:"diffRed"});"replace"!=c[d][0]&&c[d][3]==c[d][4]&&(top.ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",(c[d][2]-c[d][1]+1)*a.defaultTextHeight()+"px"]),b.markText({line:c[d][4]-1,ch:0},{line:c[d][4]-1,ch:1E6},{className:"diffNone"}));top.ICEcoder.renderPaneShiftAmount=c[d][2]-c[d][4]}},findStringDiffs:function(a,b){"undefined"==typeof a&&(a="");"undefined"==typeof b&&(b="");for(var c=0,d=a.length,e=b.length;a[c]&&a[c]==b[c];c++);for(;d>c&e>c&a[d-1]==b[e-1];d--)e--;return[c,
d-c,e-c]},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<top.ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(c)&&(a=a.getValue(),c=document.createElement("style"),c.type="text/css",c.id="ICEcoder"+b.replace(/\//g,
"_"),c.styleSheet?c.styleSheet.cssText=a:c.appendChild(document.createTextNode(a)),top.ICEcoder.previewWindow.document.getElementById(c.id)&&top.ICEcoder.previewWindow.document.documentElement.removeChild(top.ICEcoder.previewWindow.document.getElementById(c.id)),top.ICEcoder.previewWindow.document.documentElement.appendChild(c));try{top.ICEcoder.doPesticide()}catch(e){}try{top.ICEcoder.doStatsJS("update")}catch(e){}try{top.ICEcoder.doResponsive()}catch(e){}},contentCleanUp:function(){var a,b;a=ICEcoder.getcMInstance();
b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getValue();b=b.replace(/<ICEcoder:\/:textarea>/g,"</textarea>");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,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a).undo()},redo:function(){var a,
b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a).redo()},indent:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;"more"==a?top.ICEcoder.content.contentWindow.CodeMirror.commands.indentMore(b):top.ICEcoder.content.contentWindow.CodeMirror.commands.indentLess(b)},moveLines:function(a){var b,c,d,e,f,g,k;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();
d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;e=d.getCursor("start");f=d.getCursor("end");"up"==a&&0<e.line&&(g=e.line-1);"down"==a&&f.line<d.lineCount()-1&&(g=f.line+1);isNaN(g)||(k=d.getLine(g),d.operation(function(){if("up"==a)for(var b=e.line;b<=f.line;b++)d.replaceRange(d.getLine(b),{line:b-1,ch:0},{line:b-1,ch:1E6});else for(b=f.line;b>=e.line;b--)d.replaceRange(d.getLine(b),{line:b+1,ch:0},{line:b+1,ch:1E6});d.replaceRange(k,{line:"up"==a?f.line:e.line,ch:0},{line:"up"==a?f.line:
e.line,ch:1E6});d.setSelection({line:e.line+("up"==a?-1:1),ch:e.ch},{line:f.line+("up"==a?-1:1),ch:f.ch})}))},highlightLine:function(a){var b,c;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;b.setSelection({line:a,ch:0},{line:a,ch:b.lineInfo(a).text.length})},focus:function(a){var b,c;/iPhone|iPad|iPod/i.test(navigator.userAgent)||(b=top.ICEcoder.getcMInstance(),c=top.ICEcoder.getcMdiffInstance(),(a=a?c:b)&&a.focus())},goToLine:function(a){var b,
c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b).setCursor(a?a-1:top.get("goToLineNo").value-1);top.ICEcoder.focus();setTimeout(function(){top.ICEcoder.focus()},0);return!1},lineCommentToggle:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getCursor().ch;c=a.getCursor().line;d=a.getLine(c);ICEcoder.lineCommentToggleSub(a,b,c,d,d.length)},
tagWrapper:function(a){var b,c,d,e,f;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;b=a;"div"==a?(e=d.getCursor("start").line,f=d.getCursor().line,d.operation(function(){d.replaceSelection("<div>\n"+d.getSelection()+"\n</div>","around");for(var a=e+1;a<=f+1;a++)d.indentLine(a);d.indentLine(f+2,"prev");d.indentLine(f+2,"subtract")})):-1<["p","a","h1","h2","h3"].indexOf(a)&&d.getSelection().substr(0,a.length+1)=="<"+b&&d.getSelection().substr(-(a.length+
3))=="</"+a+">"?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()+"</"+a+">","around"),"a"==a&&d.setCursor({line:d.getCursor("start").line,ch:d.getCursor("start").ch+9}))},addLineBreakAtEnd:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||
(a=b.getCursor().line);b.replaceRange(b.getLine(a)+"<br>",{line:a,ch:0},{line:a,ch:1E6})},insertLineBefore:function(a){var b,c,d;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||(a=d.getCursor().line);d.operation(function(){d.replaceRange("\n"+d.getLine(a),{line:a,ch:0},{line:a,ch:1E6});d.setCursor({line:d.getCursor().line-1,ch:0});d.execCommand("indentAuto")})},insertLineAfter:function(a){var b,c,d;b=ICEcoder.getcMInstance();c=
ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||(a=d.getCursor().line);d.operation(function(){d.replaceRange(d.getLine(a)+"\n",{line:a,ch:0},{line:a,ch:1E6});d.execCommand("indentAuto")})},duplicateLines:function(a){var b,c,d;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;!a&&b.somethingSelected()?(c=b.getCursor("start"),d=b.getCursor("end"),a=c.line!=d.line&&d.ch==b.getLine(d.line).length?
"\n":"",b.replaceSelection(b.getSelection()+a+b.getSelection(),"end"),b.setSelection(c,d)):(a||(a=b.getCursor().line),c=b.getCursor().ch,b.replaceRange(b.getLine(a)+"\n"+b.getLine(a),{line:a,ch:0},{line:a,ch:1E6}),b.setCursor(a+1,c))},removeLines:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;!a&&b.somethingSelected()?b.replaceSelection("","end"):(a||(a=b.getCursor().line),c=b.getCursor().ch,b.execCommand("deleteLine"),
b.setCursor(a-1,c))},jumpToDefinition:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getTokenAt(a.getCursor()).string;if(a.somethingSelected()&&top.ICEcoder.origCurorPos)a.setCursor(top.ICEcoder.origCurorPos);else for(top.ICEcoder.origCurorPos=a.getCursor(),a=["var "+b,"function "+b,b+"=function",b+"= function",b+" =function",b+" = function",b+"=new function",b+"= new function",b+" =new function",b+" = new function",
"window['"+b+"']",'window["'+b+'"]',"this['"+b+"']",'this["'+b+'"]',b+":",b+" :","def "+b,"class "+b],b=0;b<a.length&&!top.ICEcoder.findReplace(a[b],!1,!1);b++);},autocomplete:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.content.contentWindow.CodeMirror.commands.autocomplete(a)},pasteURL:function(a){var b,c;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?
c:b;"CTRL"==top.ICEcoder.draggingWithKey&&(a=window.location.protocol+"//"+window.location.hostname+a);b.replaceSelection(a,"around")},searchForSelected:function(){var a,b;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.caretLocType&&(""!=a.getSelection()?(b=top.ICEcoder.caretLocType.toLowerCase()+" ","Content"==top.ICEcoder.caretLocType&&(b=""),window.open("http://www.google.com/#output=search&q="+b+a.getSelection())):
top.ICEcoder.message(top.t["No text selected..."]))},fmAction:function(a,b){var c,d,e,f;c=top.get("filesFrame").contentWindow.document.getElementById(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1]+"_perms").parentNode;d=c.parentNode;e=-1<c.onmouseover.toString().indexOf("'folder'")?"folder":"file";f=!1;"up"==b&&(d.previousSibling&&d.previousSibling.previousSibling?(f=d.previousSibling.previousSibling,"UL"==f.tagName&&(f=f.childNodes[f.childNodes.length-1])):d.parentNode.previousSibling&&
tabFGselected:"#fff",tabFGopenFile:"#000",tabFGnormalFile:"#eee",tabFGnormalTab:"#888",serverQueueItems:[],previewWindow:!1,previewWindowLoading:!1,pluginIntervalRefs:[],overPopup:!1,cmdKey:!1,oppTagReplaceData:[],fmReady:!1,bugReportStatus:"off",bugReportPath:"",bugFilesSizesSeen:[],bugFilesSizesActual:[],githubDiff:!1,githubAuthTokenSet:!1,splitPane:!1,splitPaneLeftPerc:100,renderLineStyle:[],renderPaneShiftAmount:0,debounce:"",editorFocusInstance:"",openSeconds:0,ready:!1,initAliases:function(){for(var a=
"header files fileOptions optionsFile optionsEdit optionsSource optionsHelp filesFrame editor tabsBar findBar content footer nestValid versionsDisplay splitPaneControls splitPaneNamesMain splitPaneNamesDiff charDisplay byteDisplay".split(" "),b=0;b<a.length;b++)ICEcoder[a[b]]=top.get(a[b])},init:function(){top.ICEcoder.lockedNav||(top.ICEcoder.filesW=ICEcoder.minFilesW);ICEcoder.setLayout();top.ICEcoder.overFileFolder("folder","|");top.ICEcoder.selectFileFolder("init");top.ICEcoder.filesFrame.contentWindow.focus();
top.ICEcoder.showHide("hide",top.get("loadingMask"));top.ICEcoder.autoOpenInt=setInterval(function(){top.ICEcoder.fmReady&&(top.ICEcoder.openLastFiles&&setTimeout(function(){top.ICEcoder.autoOpenFiles()},200),clearInterval(top.ICEcoder.autoOpenInt))},4);setInterval(ICEcoder.updateNestingIndicator,30);top.ICEcoder.startBugChecking();top.ICEcoder.autoLogoutTimer=0;top.ICEcoder.oneSecondInt=setInterval(function(){top.ICEcoder.autoLogoutTimer++;for(var a=!1,b=1;b<=ICEcoder.savedPoints.length;b++)ICEcoder.savedPoints[b-
1]!=top.ICEcoder.getcMInstance(b).changeGeneration()&&(a=!0);!a&&1<top.ICEcoder.autoLogoutMins&&top.ICEcoder.autoLogoutTimer==60*top.ICEcoder.autoLogoutMins-60&&top.ICEcoder.autoLogoutWarningScreen();get("autoLogoutIFrame")&&get("autoLogoutIFrame").contentWindow.document.getElementById("timeRemaning")&&(get("autoLogoutIFrame").contentWindow.document.getElementById("timeRemaning").innerHTML=0<top.ICEcoder.autoLogoutTimer?60*top.ICEcoder.autoLogoutMins-top.ICEcoder.autoLogoutTimer:0);!a&&0<ICEcoder.autoLogoutMins&&
top.ICEcoder.autoLogoutTimer>=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")},1E3);top.ICEcoder.ready=!0},setLayout:function(a){var b,c;b=window.innerWidth;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+"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,10)-25-4+this.filesW+"px";this.splitPaneNamesMain.style.left=parseInt(.25*(b-this.filesW),10)-50+this.filesW+"px";this.splitPaneNamesDiff.style.left=parseInt(.75*
(b-this.filesW),10)-50+this.filesW+"px";top.ICEcoder.setTabWidths();a||(this.editor.style.width=ICEcoder.content.style.width=b-this.filesW+"px",ICEcoder.content.style.height=c-25-21-28-26+"px",setTimeout(function(){for(var a=0;a<top.ICEcoder.openFiles.length;a++)top.ICEcoder.splitPane||top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]].setSize(top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.content.style.height),top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]+"diff"].setSize(100-
top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.content.style.height),top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]+"diff"].getWrapperElement().style.left=top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.splitPane&&top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]].setSize(top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.content.style.height);top.ICEcoder.splitPane?top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.right=top.ICEcoder.scrollBarVisible?
parseInt(parseInt(ICEcoder.content.style.width,10)/2,10)+17+"px":parseInt(parseInt(ICEcoder.content.style.width,10)/2,10)+"px":top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.right=top.ICEcoder.scrollBarVisible?"17px":"0"},4))},setSplitPane:function(a){var b;top.ICEcoder.splitPane="on"==a?!0:!1;top.get("splitPaneControlsOff").style.opacity=top.ICEcoder.splitPane?.5:1;top.get("splitPaneControlsOn").style.opacity=top.ICEcoder.splitPane?1:.5;top.get("splitPaneNamesMain").style.opacity=
top.get("splitPaneNamesDiff").style.opacity=top.ICEcoder.splitPane?1:0;top.ICEcoder.setLayout();if(top.ICEcoder.splitPane)top.ICEcoder.updateDiffs(),b=top.ICEcoder.getcMInstance(),top.ICEcoder.cMonScroll(b,"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]);else if(b=top.ICEcoder.getcMInstance(),a=top.ICEcoder.getcMdiffInstance(),b){cMmarks=b.getAllMarks();for(b=0;b<cMmarks.length;b++)cMmarks[b].clear();cMdiffMarks=a.getAllMarks();for(b=0;b<cMdiffMarks.length;b++)cMdiffMarks[b].clear()}"undefined"!=
typeof top.ICEcoder.animSplitPaneInt&&clearInterval(top.ICEcoder.animSplitPaneInt);top.ICEcoder.animSplitPaneInt=setInterval(function(){top.ICEcoder.splitPane&&50.1<top.ICEcoder.splitPaneLeftPerc?top.ICEcoder.splitPaneLeftPerc=(top.ICEcoder.splitPaneLeftPerc-50)/1.8+50:!top.ICEcoder.splitPane&&99.9>top.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)},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.filesW<ICEcoder.maxFilesW-1?ICEcoder.filesW+=Math.ceil((ICEcoder.maxFilesW-ICEcoder.filesW)/2):ICEcoder.filesW=ICEcoder.maxFilesW:ICEcoder.filesW>ICEcoder.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;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){var c;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();c=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.prevLineDiff:
top.ICEcoder.prevLine;c!=a.getCursor().line&&a.getLine(c)&&0<a.getLine(c).length&&0==a.getLine(c).replace(/\s/g,"").length&&a.replaceRange("",{line:c,ch:0},{line:c,ch:1E6});setTimeout(function(){for(var c,e=0;e<top.ICEcoder.renderLineStyle.length;e++){c=!1;if("diff"!=top.ICEcoder.renderLineStyle[e][0]&&-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[e][0]&&-1<b.indexOf("diff"))c=!0;c&&a.getCursor().line+1==top.ICEcoder.renderLineStyle[e][1]?a.setOption("cursorHeight",a.defaultTextHeight()/
a.lineInfo(a.getCursor().line).handle.height):a.setOption("cursorHeight",1)}},0)},cMonBeforeChange:function(a,b,c,d){var e,f;b=a.listSelections();for(var g=0;g<b.length;g++)e=d.findMatchingTag(a,b[g].anchor),0!==c.text[0].indexOf(">")&&"undefined"!=typeof e&&"undo"!=c.origin&&"redo"!=c.origin&&"undefined"!=typeof e.open&&"undefined"!=typeof e.close&&(f="open"==e.at?"close":"open",e=e[f].tag+";"+e[f].from.line+":"+e[f].from.ch,-1==top.ICEcoder.oppTagReplaceData.indexOf(e)&&top.ICEcoder.oppTagReplaceData.push(e))},
cMonChange:function(a,b,c,d){var e,f,g,k,h,l,p,n,m,q;b=a.listSelections();top.ICEcoder.loadingFile||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 r=0;r<top.ICEcoder.oppTagReplaceData.length;r++)e=top.ICEcoder.oppTagReplaceData[r].split(";"),f=e[0],g=1*e[1].split(":")[0],k=1*e[1].split(":")[1],
b[r]&&(h=d.findMatchingTag(a,b[r].anchor)),"undefined"!=typeof h&&(f="open"==h.at?h.open.tag:h.close.tag,"undefined"!=typeof c.from&&(l=g==c.from.line?c.text[0].length-c.removed[0].length:0,p="close"==h.at&&g==c.from.line?c.removed[0].length-c.text[0].length+1:1,n={line:g,ch:k+l+("open"==h.at?2:p)},l={line:g,ch:k+l+("open"==h.at?2:p)+e[0].length})),""!=f.trim()&&"undefined"!=typeof n&&"undefined"!=typeof l&&a.getRange(n,l)==e[0]&&(a.replaceRange(f,n,l),"close"==h.at&&(top.ICEcoder.autocompleteSkip=
!0));top.ICEcoder.oppTagReplaceData=[];top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay();top.ICEcoder.updateNestingIndicator();top.ICEcoder.findMode&&(top.ICEcoder.results.splice(top.ICEcoder.findResult,1),top.get("results").innerHTML=top.ICEcoder.results.length+" "+top.t.results,top.ICEcoder.findMode=!1);if(c=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1])m=c.substr(c.lastIndexOf("/")+1),q=m.substr(m.lastIndexOf(".")+1);top.ICEcoder.splitPane&&
setTimeout(function(){top.ICEcoder.updateDiffs()},0);c&&top.ICEcoder.previewWindow.location&&"/[NEW]"!=c&&top.ICEcoder.updatePreviewWindow(a,c,m,q);top.ICEcoder.indicateChanges()},cMonScroll:function(a,b){var c,d,e;top.ICEcoder.mouseDown=!1;top.ICEcoder.mouseDownInCM=!1;top.ICEcoder.splitPane&&(c=top.ICEcoder.getcMInstance(),d=top.ICEcoder.getcMdiffInstance(),e=-1<b.indexOf("diff")?c:d,c&&setTimeout(function(){e.scrollTo(a.getScrollInfo().left,a.getScrollInfo().top)},0))},cMonInputRead:function(a,
b){"keypress"==top.ICEcoder.autoComplete&&top.ICEcoder.codeAssist&&!a.state.completionActive&&(top.ICEcoder.autocompleteSkip?top.ICEcoder.autocompleteSkip=!1:top.ICEcoder.autocomplete())},cMonGutterClick:function(a,b,c,d,e){top.ICEcoder.mouseDownInCM="gutter"},cMonMouseDown:function(a,b){top.ICEcoder.mouseDownInCM="editor"},cMonDragOver:function(a,b,c){top.ICEcoder.setDragCursor(b,"editor")},cMonRenderLine:function(a,b,c,d){for(var e,f=0;f<top.ICEcoder.renderLineStyle.length;f++){e=!1;if("diff"!=
top.ICEcoder.renderLineStyle[f][0]&&-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[f][0]&&-1<b.indexOf("diff"))e=!0;e&&a.lineInfo(c).line+1==top.ICEcoder.renderLineStyle[f][1]&&(d.style[top.ICEcoder.renderLineStyle[f][2]]=top.ICEcoder.renderLineStyle[f][3])}},updateDiffs:function(){var a,b,c,d,e,f;top.ICEcoder.renderLineStyle=[];top.ICEcoder.renderPaneShiftAmount=0;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();c=a?difflib.stringAsLines(a.getValue()):"";d=b?difflib.stringAsLines(b.getValue()):
"";c=(new difflib.SequenceMatcher(c,d)).get_opcodes();if(a){e=a.getAllMarks();for(d=0;d<e.length;d++)e[d].clear();e=b.getAllMarks();for(d=0;d<e.length;d++)e[d].clear()}if(a&&""!=b.getValue())for(d=0;d<c.length;d++)if("equal"!==c[d][0]){if("replace"==c[d][0]){f=(c[d][4]-c[d][2]+1+top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)b.getLineHandle(e).height>a.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;e<c[d][2]-c[d][1];e++)f=top.ICEcoder.findStringDiffs(a.getLine(c[d][1]+e),b.getLine(c[d][3]+e)),a.markText({line:c[d][1]+e,ch:0},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:f[0]},{className:"diffGreyLighter"}),a.markText({line:c[d][1]+e,ch:f[0]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:f[0]+f[1]},{className:"diffGrey"}),a.markText({line:c[d][1]+e,ch:f[0]+f[1]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:1E6},{className:"diffGreyLighter"})}else a.markText({line:c[d][1],
ch:0},{line:c[d][2]-1,ch:1E6},{className:"diffGreen"});"replace"!=c[d][0]&&c[d][1]==c[d][2]&&(top.ICEcoder.renderLineStyle.push(["main",c[d][2],"height",(c[d][4]-c[d][3]+1)*a.defaultTextHeight()+"px"]),a.markText({line:c[d][2]-1,ch:0},{line:c[d][2]-1,ch:1E6},{className:"diffNone"}));if("replace"==c[d][0]){f=(c[d][2]-c[d][4]+1-top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)a.getLineHandle(e).height>a.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;e<c[d][4]-c[d][3];e++)f=top.ICEcoder.findStringDiffs(a.getLine(c[d][1]+e),b.getLine(c[d][3]+e)),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:0},{line:c[d][3]+e,ch:f[0]},{className:"diffGreyLighter"}),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:f[0]},{line:c[d][3]+e,ch:f[0]+f[2]},{className:"diffGrey"}),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,
ch:f[0]+f[2]},{line:c[d][3]+e,ch:1E6},{className:"diffGreyLighter"})}else b.markText({line:c[d][3],ch:0},{line:c[d][4]-1,ch:1E6},{className:"diffRed"});"replace"!=c[d][0]&&c[d][3]==c[d][4]&&(top.ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",(c[d][2]-c[d][1]+1)*a.defaultTextHeight()+"px"]),b.markText({line:c[d][4]-1,ch:0},{line:c[d][4]-1,ch:1E6},{className:"diffNone"}));top.ICEcoder.renderPaneShiftAmount=c[d][2]-c[d][4]}},findStringDiffs:function(a,b){"undefined"==typeof a&&(a="");"undefined"==
typeof b&&(b="");for(var c=0,d=a.length,e=b.length;a[c]&&a[c]==b[c];c++);for(;d>c&e>c&a[d-1]==b[e-1];d--)e--;return[c,d-c,e-c]},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<top.ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(c)&&
(a=a.getValue(),c=document.createElement("style"),c.type="text/css",c.id="ICEcoder"+b.replace(/\//g,"_"),c.styleSheet?c.styleSheet.cssText=a:c.appendChild(document.createTextNode(a)),top.ICEcoder.previewWindow.document.getElementById(c.id)&&top.ICEcoder.previewWindow.document.documentElement.removeChild(top.ICEcoder.previewWindow.document.getElementById(c.id)),top.ICEcoder.previewWindow.document.documentElement.appendChild(c));try{top.ICEcoder.doPesticide()}catch(e){}try{top.ICEcoder.doStatsJS("update")}catch(e){}try{top.ICEcoder.doResponsive()}catch(e){}},
contentCleanUp:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getValue();b=b.replace(/<ICEcoder:\/:textarea>/g,"</textarea>");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,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?
b:a).undo()},redo:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a).redo()},indent:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;"more"==a?top.ICEcoder.content.contentWindow.CodeMirror.commands.indentMore(b):top.ICEcoder.content.contentWindow.CodeMirror.commands.indentLess(b)},moveLines:function(a){var b,c,d,e,f,g,k;b=top.ICEcoder.getcMInstance();
c=top.ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;e=d.getCursor("start");f=d.getCursor("end");"up"==a&&0<e.line&&(g=e.line-1);"down"==a&&f.line<d.lineCount()-1&&(g=f.line+1);isNaN(g)||(k=d.getLine(g),d.operation(function(){if("up"==a)for(var b=e.line;b<=f.line;b++)d.replaceRange(d.getLine(b),{line:b-1,ch:0},{line:b-1,ch:1E6});else for(b=f.line;b>=e.line;b--)d.replaceRange(d.getLine(b),{line:b+1,ch:0},{line:b+1,ch:1E6});d.replaceRange(k,{line:"up"==a?f.line:
e.line,ch:0},{line:"up"==a?f.line:e.line,ch:1E6});d.setSelection({line:e.line+("up"==a?-1:1),ch:e.ch},{line:f.line+("up"==a?-1:1),ch:f.ch})}))},highlightLine:function(a){var b,c;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;b.setSelection({line:a,ch:0},{line:a,ch:b.lineInfo(a).text.length})},focus:function(a){var b,c;/iPhone|iPad|iPod/i.test(navigator.userAgent)||(b=top.ICEcoder.getcMInstance(),c=top.ICEcoder.getcMdiffInstance(),
(a=a?c:b)&&a.focus())},goToLine:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b).setCursor(a?a-1:top.get("goToLineNo").value-1);top.ICEcoder.focus();setTimeout(function(){top.ICEcoder.focus()},0);return!1},lineCommentToggle:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getCursor().ch;c=a.getCursor().line;d=a.getLine(c);
ICEcoder.lineCommentToggleSub(a,b,c,d,d.length)},tagWrapper:function(a){var b,c,d,e,f;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;b=a;"div"==a?(e=d.getCursor("start").line,f=d.getCursor().line,d.operation(function(){d.replaceSelection("<div>\n"+d.getSelection()+"\n</div>","around");for(var a=e+1;a<=f+1;a++)d.indentLine(a);d.indentLine(f+2,"prev");d.indentLine(f+2,"subtract")})):-1<["p","a","h1","h2","h3"].indexOf(a)&&d.getSelection().substr(0,
a.length+1)=="<"+b&&d.getSelection().substr(-(a.length+3))=="</"+a+">"?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()+"</"+a+">","around"),"a"==a&&d.setCursor({line:d.getCursor("start").line,ch:d.getCursor("start").ch+9}))},addLineBreakAtEnd:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<
top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||(a=b.getCursor().line);b.replaceRange(b.getLine(a)+"<br>",{line:a,ch:0},{line:a,ch:1E6})},insertLineBefore:function(a){var b,c,d;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||(a=d.getCursor().line);d.operation(function(){d.replaceRange("\n"+d.getLine(a),{line:a,ch:0},{line:a,ch:1E6});d.setCursor({line:d.getCursor().line-1,ch:0});d.execCommand("indentAuto")})},insertLineAfter:function(a){var b,
c,d;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||(a=d.getCursor().line);d.operation(function(){d.replaceRange(d.getLine(a)+"\n",{line:a,ch:0},{line:a,ch:1E6});d.execCommand("indentAuto")})},duplicateLines:function(a){var b,c,d;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;!a&&b.somethingSelected()?(c=b.getCursor("start"),d=b.getCursor("end"),a=c.line!=d.line&&
d.ch==b.getLine(d.line).length?"\n":"",b.replaceSelection(b.getSelection()+a+b.getSelection(),"end"),b.setSelection(c,d)):(a||(a=b.getCursor().line),c=b.getCursor().ch,b.replaceRange(b.getLine(a)+"\n"+b.getLine(a),{line:a,ch:0},{line:a,ch:1E6}),b.setCursor(a+1,c))},removeLines:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;!a&&b.somethingSelected()?b.replaceSelection("","end"):(a||(a=b.getCursor().line),c=b.getCursor().ch,
b.execCommand("deleteLine"),b.setCursor(a-1,c))},jumpToDefinition:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getTokenAt(a.getCursor()).string;if(a.somethingSelected()&&top.ICEcoder.origCurorPos)a.setCursor(top.ICEcoder.origCurorPos);else for(top.ICEcoder.origCurorPos=a.getCursor(),a=["var "+b,"function "+b,b+"=function",b+"= function",b+" =function",b+" = function",b+"=new function",b+"= new function",
b+" =new function",b+" = new function","window['"+b+"']",'window["'+b+'"]',"this['"+b+"']",'this["'+b+'"]',b+":",b+" :","def "+b,"class "+b],b=0;b<a.length&&!top.ICEcoder.findReplace(a[b],!1,!1);b++);},autocomplete:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.content.contentWindow.CodeMirror.commands.autocomplete(a)},pasteURL:function(a){var b,c;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();
b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;"CTRL"==top.ICEcoder.draggingWithKey&&(a=window.location.protocol+"//"+window.location.hostname+a);b.replaceSelection(a,"around")},searchForSelected:function(){var a,b;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.caretLocType&&(""!=a.getSelection()?(b=top.ICEcoder.caretLocType.toLowerCase()+" ","Content"==top.ICEcoder.caretLocType&&(b=""),window.open("http://www.google.com/#output=search&q="+
b+a.getSelection())):top.ICEcoder.message(top.t["No text selected..."]))},fmAction:function(a,b){var c,d,e,f;c=top.get("filesFrame").contentWindow.document.getElementById(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1]+"_perms").parentNode;d=c.parentNode;e=-1<c.onmouseover.toString().indexOf("'folder'")?"folder":"file";f=!1;"up"==b&&(d.previousSibling&&d.previousSibling.previousSibling?(f=d.previousSibling.previousSibling,"UL"==f.tagName&&(f=f.childNodes[f.childNodes.length-1])):d.parentNode.previousSibling&&
(f=d.parentNode.previousSibling),f&&(f=f.childNodes[0]));"down"==b&&(d.nextSibling&&d.nextSibling.childNodes[0]?f=d.nextSibling.childNodes[0]:d.nextSibling&&d.nextSibling.nextSibling?f=d.nextSibling.nextSibling:d.parentNode.nextSibling&&(f=d.parentNode.nextSibling.nextSibling),f&&(f=f.childNodes[0]));"left"==b&&"folder"==e&&d.parentNode.previousSibling&&top.ICEcoder.openCloseDir(c,!1);if("right"==b||"enter"==b)"folder"==e?top.ICEcoder.openCloseDir(c,!0):top.ICEcoder.openFile(c.childNodes[1].id.replace(/\|/g,
"/"));f&&f.childNodes[1]&&(top.ICEcoder.overFileFolder(e,f.childNodes[1].id),top.ICEcoder.selectFileFolder(a))},openCloseDir:function(a,b){var c,d;a.onclick=function(a){a.ctrlKey||top.ICEcoder.cmdKey||top.ICEcoder.openCloseDir(this,!b)};c=a.parentNode;c.nextSibling&&(c=c.nextSibling);c&&"UL"==c.tagName&&((d="none"==c.style.display)?b=!0:c.style.display="none",a.parentNode.className=a.className=d?"pft-directory dirOpen":"pft-directory");b?top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href=
"lib/get-branch.php?location="+a.childNodes[1].id+"&csrf="+top.ICEcoder.csrf:"UL"==c.tagName&&c.parentNode.removeChild(c);return!1},overFileFolder:function(a,b){ICEcoder.thisFileFolderType=a;ICEcoder.thisFileFolderLink=b},isFileFolder:function(a){return(a=top.get("filesFrame").contentWindow.document.getElementById(a.replace(top.iceRoot,"").replace(/\/$/,"").replace(/\//g,"|")))?-1<a.parentNode.parentNode.className.indexOf("directory")?"folder":"file":!1},selectFileFolder:function(a,b,c){var d,e,f;
@@ -73,13 +76,13 @@ b.onreadystatechange=function(){4==b.readyState&&(200==b.status?(c=JSON.parse(b.
console.log(c),top.ICEcoder.serverMessage(),top.ICEcoder.serverQueue("del",0)):eval(c.action.doNext)):(top.ICEcoder.message(top.t["Sorry there was..."]),console.log("ICEcoder error info for your request..."),console.log(c),top.ICEcoder.serverMessage(),top.ICEcoder.serverQueue("del",0)))};b.open("POST","lib/file-control-xhr.php?action=checkExists&csrf="+top.ICEcoder.csrf,!0);b.setRequestHeader("Content-type","application/x-www-form-urlencoded");d=(new Date).getTime();b.send("timeStart="+d+"&file="+
a.replace(/\+/g,"%2B"))},showMenu:function(a){var b,c;0!=top.ICEcoder.selectedFiles.length&&-1!=top.ICEcoder.selectedFiles.indexOf(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\//g,"|"))||top.ICEcoder.selectFileFolder(a);a=129;c=window.innerHeight;"undefined"!=typeof top.ICEcoder.thisFileFolderLink&&""!=top.ICEcoder.thisFileFolderLink&&(b=this.isPathFolder(top.ICEcoder.selectedFiles[0])?"folder":"file",top.get("folderMenuItems").style.display="folder"==b&&1==top.ICEcoder.selectedFiles.length?
"block":"none","folder"==b&&1==top.ICEcoder.selectedFiles.length&&(a+=67,"block"==top.get("fmMenuPasteOption").style.display&&(a+=19)),top.get("singleFileMenuItems").style.display=1<top.ICEcoder.selectedFiles.length?"none":"block",1==top.ICEcoder.selectedFiles.length&&(a+=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",b=top.ICEcoder.mouseY-top.ICEcoder.filesFrame.contentWindow.document.body.scrollTop-
10,b+a>c&&(b-=b+a-c),top.get("fileMenu").style.top=b+"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){var k,h,m,p,n,l,q;if("add"==a&&!top.get("filesFrame").contentWindow.document.getElementById(b.replace(top.iceRoot,"").replace(/\/$/,"").replace(/\//g,
"|")+"|"+c)){k="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("//","/");h=top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));m=h.parentNode.parentNode.nextSibling;p=document.createTextNode("\n");n=777==d?"background: #800; color: #eee":"color: #888";n='<a nohref title="'+b.replace(/\/$/,"")+"/"+c+'" onMouseOver="parentNode.draggable=true;top.ICEcoder.overFileFolder(\''+
10,b+a>c&&(b-=b+a-c),top.get("fileMenu").style.top=b+"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){var k,h,l,p,n,m,q;if("add"==a&&!top.get("filesFrame").contentWindow.document.getElementById(b.replace(top.iceRoot,"").replace(/\/$/,"").replace(/\//g,
"|")+"|"+c)){k="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("//","/");h=top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));l=h.parentNode.parentNode.nextSibling;p=document.createTextNode("\n");n=777==d?"background: #800; color: #eee":"color: #888";n='<a nohref title="'+b.replace(/\/$/,"")+"/"+c+'" onMouseOver="parentNode.draggable=true;top.ICEcoder.overFileFolder(\''+
g+"',this.childNodes[1].id)\" onMouseOut=\"parentNode.draggable=false;top.ICEcoder.overFileFolder('"+g+"','')\" "+("folder"==g?"ondragover=\"if(parentNode.nextSibling && parentNode.nextSibling.tagName != 'UL' && top.ICEcoder.thisFileFolderLink != this.childNodes[1].id) {top.ICEcoder.openCloseDir(this,true);}\"":"")+' onClick="if(!event.ctrlKey && !top.ICEcoder.cmdKey) {'+("folder"==g?"top.ICEcoder.openCloseDir(this,"+("folder"==g?"true":"false")+");":"")+' if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {top.ICEcoder.openFile()}}" style="position: relative; left:-22px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="'+
b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'">'+c+'</span> <span style="'+n+'; font-size: 8px" id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'_perms">'+d+"</span></a>";if(!m||3>m.childNodes.length)l=document.createElement("ul"),m=h.parentNode.parentNode,m.parentNode.insertBefore(l,m.nextSibling),l=document.createElement("li"),l.className=k,l.draggable=!1,l.ondragstart=function(a){top.ICEcoder.addDefaultDragData(this,a)},l.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&
(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())},l.ondragover=function(a){top.ICEcoder.setDragCursor(a,"folder"==g?"folder":"file")},l.ondragend=function(){top.ICEcoder.dropFile(this)},l.innerHTML=n,m.nextSibling.appendChild(l),m.nextSibling.appendChild(p);else for(h=0;h<m.childNodes.length;h++)if(m.childNodes[h].className&&(l=0<m.childNodes[h].className.indexOf("directory")?"folder":"file",q=m.childNodes[h].getElementsByTagName("span")[0].innerHTML,
l==g&&q>c||"folder"==g&&"file"==l||h==m.childNodes.length-1)){l=document.createElement("li");l.className=k;l.draggable=!1;l.ondragstart=function(a){top.ICEcoder.addDefaultDragData(this,a)};l.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())};l.ondragover=function(a){top.ICEcoder.setDragCursor(a,"folder"==g?"folder":"file")};l.ondragend=
function(){top.ICEcoder.dropFile(this)};l.innerHTML=n;h==m.childNodes.length-1?(m.appendChild(l),m.appendChild(p)):(m.insertBefore(l,m.childNodes[h]),m.insertBefore(p,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+
b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'">'+c+'</span> <span style="'+n+'; font-size: 8px" id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'_perms">'+d+"</span></a>";if(!l||3>l.childNodes.length)m=document.createElement("ul"),l=h.parentNode.parentNode,l.parentNode.insertBefore(m,l.nextSibling),m=document.createElement("li"),m.className=k,m.draggable=!1,m.ondragstart=function(a){top.ICEcoder.addDefaultDragData(this,a)},m.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&
(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())},m.ondragover=function(a){top.ICEcoder.setDragCursor(a,"folder"==g?"folder":"file")},m.ondragend=function(){top.ICEcoder.dropFile(this)},m.innerHTML=n,l.nextSibling.appendChild(m),l.nextSibling.appendChild(p);else for(h=0;h<l.childNodes.length;h++)if(l.childNodes[h].className&&(m=0<l.childNodes[h].className.indexOf("directory")?"folder":"file",q=l.childNodes[h].getElementsByTagName("span")[0].innerHTML,
m==g&&q>c||"folder"==g&&"file"==m||h==l.childNodes.length-1)){m=document.createElement("li");m.className=k;m.draggable=!1;m.ondragstart=function(a){top.ICEcoder.addDefaultDragData(this,a)};m.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())};m.ondragover=function(a){top.ICEcoder.setDragCursor(a,"folder"==g?"folder":"file")};m.ondragend=
function(){top.ICEcoder.dropFile(this)};m.innerHTML=n;h==l.childNodes.length-1?(l.appendChild(m),l.appendChild(p)):(l.insertBefore(m,l.childNodes[h]),l.insertBefore(p,l.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){var e,f;if(a.parentNode.parentNode.nextSibling&&"UL"==a.parentNode.parentNode.nextSibling.nodeName){a=a.parentNode.parentNode.nextSibling;
for(var g=0;g<a.childNodes.length;g++)"LI"==a.childNodes[g].nodeName&&(e=a.childNodes[g].childNodes[0].childNodes[1],e.id=e.id.replace(b.replace(/\//g,"|"),c.replace(/\//g,"|")+"|"+d),e.parentNode.title=e.id.replace(/\|/g,"/"),f=top.get("filesFrame").contentWindow.document.getElementById(e.id).nextSibling.nextSibling,f.id=e.id+"_perms",top.ICEcoder.renameInChildren(e,b,c,d))}},refreshFileManager:function(){top.ICEcoder.showHide("show",top.get("loadingMask"));top.ICEcoder.filesFrame.contentWindow.location.reload(!0);
@@ -103,61 +106,61 @@ top.ICEcoder.area=b;"top"!=b&&(top.ICEcoder.mouseY+=70);"editor"==b&&(top.ICEcod
a}},serverMessage:function(a){var b;b=top.get("serverMessage");a?(b.innerHTML=top.ICEcoder.xssClean(a).replace(/\&lt;b\&gt;/g,"<b>").replace(/\&lt;\/b\&gt;/g,"</b>").replace(/\&lt;br\&gt;/g,"<br>"),b.style.left="0"):setTimeout(function(){b.style.left="2000px"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();if(a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a){b=a.getLine(a.getCursor().line);for(c=/(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi;(d=
c.exec(b))&&a.getCursor().ch>d.index+d[0].length;);(b=top.get("content").contentWindow.document.getElementById("cssColor"))&&b.parentNode.removeChild(b);top.ICEcoder.codeAssist&&"CSS"==top.ICEcoder.caretLocType&&(b=top.document.createElement("div"),b.id="cssColor",b.style.position="absolute",b.style.display="block",b.style.width=b.style.height="20px",b.style.zIndex="1000",b.style.background=d?d[0]:"",b.style.cursor="pointer",b.onclick=function(){top.ICEcoder.showColorPicker(d[0])},""==b.style.backgroundColor&&
(b.style.display="none"),top.get("header").appendChild(b),a.addWidget(a.getCursor(),top.get("cssColor"),!0))}},showColorPicker:function(a){top.get("blackMask").style.visibility="visible";top.get("mediaContainer").innerHTML='<div id="picker" class="picker"></div><br><br><input type="text" id="color" name="color" value="#000" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'color\').value)" value="insert &gt;" class="insertColorValue"><br><input type="text" id="colorRGB" name="colorRGB" value="rgb(0,0,0)" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'colorRGB\').value)" value="insert &gt;" class="insertColorValue">';
farbtastic("picker","color");a&&top.get("picker").farbtastic.setColor(a)},initCanvasImage:function(a){var b,c;b=top.get("canvasPicker").getContext("2d");c=new Image;c.crossOrigin="Anonymous";c.src=a.src;c.onload=function(){top.get("canvasPicker").width=a.width;top.get("canvasPicker").height=a.height;b.drawImage(c,0,0,a.width,a.height)};top.document.getElementById("floatingContainer").style.backgroundSize=5*a.naturalWidth+"px "+5*a.naturalHeight+"px"},interactCanvasImage:function(a){var b,c,d,e,f,
g,k,h,m,p,n,l,q;b=top.get("canvasPicker").getContext("2d");top.get("canvasPicker").onmousemove=function(u){c=u.pageX-this.offsetLeft;d=u.pageY-this.offsetTop;e=b.getImageData(c,d,1,1).data;f=e[0];g=e[1];k=e[2];h=f+","+g+","+k;m=top.ICEcoder.rgbToHex(f,g,k);top.get("rgbMouseXY").value=h;top.get("hexMouseXY").value="#"+m;top.get("hexMouseXY").style.backgroundColor=top.get("rgbMouseXY").style.backgroundColor="#"+m;p=128>f||128>g||128>k&&200>f&&200>g&&50<k?"#fff":"#000";top.get("hexMouseXY").style.color=
top.get("rgbMouseXY").style.color=p;n=get("floatingContainer");n.style.left=top.ICEcoder.mouseX+20+"px";n.style.top=top.ICEcoder.mouseY+"px";l=-(a.naturalWidth/a.width*c*5)+25;q=-(a.naturalHeight/a.height*d*5)+25;n.style.backgroundPosition=l+"px "+q+"px"};top.get("canvasPicker").onmouseover=function(a){get("floatingContainer").style.visibility="visible"};top.get("canvasPicker").onmouseout=function(a){get("floatingContainer").style.visibility="hidden"};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=p}},rgbToHex:function(a,b,c){return top.ICEcoder.toHex(a)+top.ICEcoder.toHex(b)+top.ICEcoder.toHex(c)},toHex:function(a){a=parseInt(a,10);if(isNaN(a))return"00";a=Math.max(0,Math.min(a,255));return"0123456789abcdef".charAt((a-a%16)/16)+"0123456789abcdef".charAt(a%16)},insertColorValue:function(a){var b,
c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;c=b.getTokenAt(b.getCursor());b.replaceRange(a,{line:b.getCursor().line,ch:c.start},{line:b.getCursor().line,ch:1E6})},fMIconVis:function(a,b){var c;if(c=top.get(a))c.style.opacity=b},isOpen:function(a){a=a.replace(/\|/g,"/").replace(top.docRoot+top.iceRoot,"");a=top.ICEcoder.openFiles.indexOf(a);return-1!=a?a:!1},startPluginIntervals:function(a,b,c,d){-1<b.indexOf("?")&&(b=b+"&csrf="+
top.ICEcoder.csrf);top.ICEcoder["plugTimer"+a]=-1<["_parent","_top","_self",""].indexOf(c)?top.ICEcoder["plugTimer"+a]=setInterval("window.location='"+b+"'",6E4*d):0==c.indexOf("fileControl")?top.ICEcoder["plugTimer"+a]=setInterval(function(){top.ICEcoder.serverQueue("add",b);top.ICEcoder.serverMessage(c.split(":")[1])},6E4*d):top.ICEcoder["plugTimer"+a]=setInterval("window.open('"+b+"','"+c+"')",6E4*d);top.ICEcoder.pluginIntervalRefs.push(a)},codeAssistToggle:function(){var a,b;top.ICEcoder.codeAssist=
!top.ICEcoder.codeAssist;top.get("codeAssistDisplay").style.backgroundPosition=top.ICEcoder.codeAssist?"0 0":"-16px 0";top.ICEcoder.cssColorPreview();top.ICEcoder.focus(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?"diff":!1);for(i=0;i<top.ICEcoder.cMInstances.length;i++)if(a=top.ICEcoder.openFiles[i],a=a.split("."),a=a[a.length-1],"js"==a||"json"==a)a=top.ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[i]],b=top.ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[i]+"diff"],
top.ICEcoder.codeAssist?(a.setOption("lint",!0),b.setOption("lint",!0)):(a.clearGutter("CodeMirror-lint-markers"),a.setOption("lint",!1),b.clearGutter("CodeMirror-lint-markers"),b.setOption("lint",!1))},serverQueue:function(a,b,c,d){var e,f,g,k,h;if(-1!==ICEcoder.serverQueueItems.indexOf(b))top.ICEcoder.serverMessage(),top.ICEcoder.serverQueue("del",0);else{e=ICEcoder.getcMInstance();for(g=f=0;g<ICEcoder.serverQueueItems.length;g++)0<ICEcoder.serverQueueItems[g].indexOf("action=save")&&f++;f++;if("add"==
a)ICEcoder.serverQueueItems.push(b),0<b.indexOf("action=save")&&(g=document.createElement("textarea"),g.setAttribute("id","saveTemp"+f),document.body.appendChild(g),0<b.indexOf("saveType=saveAs")||0<b.indexOf("fileVersion=undefined")?top.get("saveTemp"+f).value=e.getValue():top.get("saveTemp"+f).value=d);else if("del"==a){if(ICEcoder.serverQueueItems[0]&&0<ICEcoder.serverQueueItems[0].indexOf("action=save")){d=f-1;for(g=1;g<d;g++)top.get("saveTemp"+g).value=top.get("saveTemp"+(g+1)).value;d=top.get("saveTemp"+
d);d.parentNode.removeChild(d)}ICEcoder.serverQueueItems.splice(0,1)}if("del"==a&&1<=ICEcoder.serverQueueItems.length||1==ICEcoder.serverQueueItems.length)b&&-1==b.indexOf("saveFiles=")&&-1==b.indexOf("action=load")?(k=top.ICEcoder.xhrObj(),k.onreadystatechange=function(){4==k.readyState&&(200==k.status?(h=JSON.parse(k.responseText),h.action.timeEnd=(new Date).getTime(),h.action.timeTaken=h.action.timeEnd-h.action.timeStart,0<=["raw","both"].indexOf(top.ICEcoder.fileDirResOutput)&&console.log(k.responseText),
0<=["object","both"].indexOf(top.ICEcoder.fileDirResOutput)&&console.log(h),h.status.error?(top.ICEcoder.message(h.status.errorMsg),console.log("ICEcoder error info for your request..."),console.log(h),top.ICEcoder.serverMessage(),top.ICEcoder.serverQueue("del",0)):eval(h.action.doNext)):(top.ICEcoder.message(top.t["Sorry there was..."]),console.log("ICEcoder error info for your request..."),console.log(h),top.ICEcoder.serverMessage(),top.ICEcoder.serverQueue("del",0)))},k.open("POST",ICEcoder.serverQueueItems[0],
!0),k.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a=(new Date).getTime(),0<b.indexOf("action=saveAs")?k.send("timeStart="+a+"&file="+c+"&contents="+encodeURIComponent(top.document.getElementById("saveTemp1").value)):0<b.indexOf("action=save")?k.send("timeStart="+a+"&file="+c+"&changes="+encodeURIComponent(top.document.getElementById("saveTemp1").value)):k.send("timeStart="+a+"&file="+c)):setTimeout(function(){"undefined"!=typeof ICEcoder.serverQueueItems[0]&&(top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href=
ICEcoder.serverQueueItems[0])},1)}},cancelAllActions:function(){window.stop();0<ICEcoder.serverQueueItems.length&&ICEcoder.serverQueueItems.splice(1,ICEcoder.serverQueueItems.length);top.ICEcoder.showHide("hide",top.get("loadingMask"));top.ICEcoder.serverMessage('<b style="color: #d00">'+top.t["Cancelled tasks"]+"</b>");setTimeout(function(){top.ICEcoder.serverMessage()},2E3)},setPreviousFiles:function(){var a;a=top.ICEcoder.openFiles.join(",").replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,
"").replace(/(^,)|(,$)/g,"");""==a&&(a="CLEAR");top.ICEcoder.serverQueue("add","lib/settings.php?saveFiles="+a+"&csrf="+top.ICEcoder.csrf);top.ICEcoder.updateLast10List(a)},updateLast10List:function(a){var b,c,d;a=a.split(",");for(var e=0;e<a.length;e++)"CLEAR"!=a[e]&&(b='<li class="pft-file ext-'+a[e].substring(a[e].lastIndexOf(".")+1)+'" style="margin-left: -21px"><a style="cursor:pointer" onclick="top.ICEcoder.openFile(\''+a[e].replace(/\|/g,"/")+"')\">"+a[e].replace(/\|/g,"/")+"</a></li>\n",c=
top.ICEcoder.content.contentWindow.document.getElementById("last10Files"),-1==c.innerHTML.indexOf(b)&&(d=c.innerHTML.split("\n"),(10<=d.length||'<div style="display: inline-block; margin-left: -39px; margin-top: -4px">[none]</div><br><br>'==d[0]||""==d[d.length-1])&&d.pop(),c.innerHTML=b+d.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.previousFiles.length;a++)top.ICEcoder.thisFileFolderLink=top.ICEcoder.previousFiles[a].replace("|","/"),top.ICEcoder.thisFileFolderType="file",top.ICEcoder.openFile()},settingsScreen:function(a){a||(top.get("mediaContainer").innerHTML='<iframe src="lib/settings-screen.php" class="whiteGlow" style="width: 970px; height: 610px"></iframe>');top.ICEcoder.showHide(a?"hide":"show",top.get("blackMask"))},helpScreen:function(){top.get("mediaContainer").innerHTML=
'<iframe src="lib/help.php" class="whiteGlow" style="width: 840px; height: 465px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},versionsScreen:function(a,b){top.get("mediaContainer").innerHTML='<iframe src="lib/backup-versions.php?file='+a+"&csrf="+top.ICEcoder.csrf+'" class="whiteGlow" style="width: 970px; height: 640px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},showManual:function(a,b){var c;c=b?"#"+b:"";top.get("mediaContainer").innerHTML='<iframe src="https://icecoder.net/manual?version='+
a+c+'" class="whiteGlow" style="width: 800px; height: 470px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},propertiesScreen:function(a){top.get("mediaContainer").innerHTML='<iframe src="lib/properties.php?fileName='+a.replace(/\//g,"|")+"&csrf="+top.ICEcoder.csrf+'" class="whiteGlow" style="width: 660px; height: 330px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},autoLogoutWarningScreen:function(){top.get("mediaContainer").innerHTML='<iframe src="lib/auto-logout-warning.php" id="autoLogoutIFrame" class="whiteGlow" style="width: 400px; height: 160px"></iframe>';
top.ICEcoder.showHide("show",top.get("blackMask"))},pluginsManager:function(){top.get("mediaContainer").innerHTML='<iframe src="lib/plugins-manager.php" class="whiteGlow" style="width: 800px; height: 450px"></iframe>';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='<iframe src="lib/github.php?action='+a+"&selectedFiles="+
top.ICEcoder.selectedFiles.join(";")+"&csrf="+top.ICEcoder.csrf+'" class="whiteGlow" style="width: 340px; height: 340px"></iframe>';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='<iframe src="lib/github-manager.php" class="whiteGlow" style="width: 660px; height: 450px"></iframe>',top.ICEcoder.showHide("show",top.get("blackMask"))):top.ICEcoder.githubTokenAsk("showManager")},githubDiffToggle:function(){var a;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,a=top.ICEcoder.githubDiff?"true":"false",top.ICEcoder.filesFrame.src="files.php?githubDiff="+a+"&csrf="+top.ICEcoder.csrf},ftpManager:function(){top.get("mediaContainer").innerHTML='<iframe src="lib/ftp-manager.php" class="whiteGlow" style="width: 660px; height: 550px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},useNewSettings:function(a,b,c,d,e,f,g,k,h,m,p,n,l,q,u,w,v,x,y,z,A,B,C,D){var r,
t=a.slice(0,a.lastIndexOf("?")),t=t.slice(t.lastIndexOf("/")+1,t.lastIndexOf("."));top.ICEcoder.theme!==t&&(top.ICEcoder.theme=t,"editor"==top.ICEcoder.theme&&(top.ICEcoder.theme="icecoder"),r=document.createElement("link"),r.setAttribute("rel","stylesheet"),r.setAttribute("type","text/css"),r.setAttribute("href",a),top.ICEcoder.content.contentWindow.document.getElementsByTagName("head")[0].appendChild(r),r=-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[4];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: "+r+" !important";top.ICEcoder.lineWrapping=k;top.ICEcoder.lineNumbers=h;top.ICEcoder.showTrailingSpace=m;top.ICEcoder.matchBrackets=
p;top.ICEcoder.autoCloseTags=n;top.ICEcoder.autoCloseBrackets=l;top.ICEcoder.indentWithTabs=q;top.ICEcoder.indentSize=w;top.ICEcoder.indentAuto=u;for(f=0;f<ICEcoder.cMInstances.length;f++)ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("lineWrapping",top.ICEcoder.lineWrapping),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("lineNumbers",top.ICEcoder.lineNumbers),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("showTrailingSpace",
top.ICEcoder.showTrailingSpace),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("matchBrackets",top.ICEcoder.matchBrackets),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("autoCloseTags",top.ICEcoder.autoCloseTags),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("autoCloseBrackets",top.ICEcoder.autoCloseBrackets),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("indentWithTabs",top.ICEcoder.indentWithTabs),
ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("indentUnit",top.ICEcoder.indentSize),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("tabSize",top.ICEcoder.indentSize),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].refresh(),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("lineWrapping",top.ICEcoder.lineWrapping),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("lineNumbers",top.ICEcoder.lineNumbers),
ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("showTrailingSpace",top.ICEcoder.showTrailingSpace),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("matchBrackets",top.ICEcoder.matchBrackets),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("autoCloseTags",top.ICEcoder.autoCloseTags),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("autoCloseBrackets",top.ICEcoder.autoCloseBrackets),
ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("indentWithTabs",top.ICEcoder.indentWithTabs),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("indentUnit",top.ICEcoder.indentSize),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("tabSize",top.ICEcoder.indentSize),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].refresh();d!=top.ICEcoder.tagWrapperCommand&&(top.ICEcoder.tagWrapperCommand=d);
e!=top.ICEcoder.autoComplete&&(top.ICEcoder.autoComplete=e);top.get("plugins").style.left="left"==v?"0":"auto";top.get("plugins").style.right="right"==v?"0":"auto";top.ICEcoder.bugFilePaths=x;top.ICEcoder.bugFileCheckTimer=y;top.ICEcoder.bugFileMaxLines=z;""!=top.ICEcoder.bugFilePaths[0]?top.ICEcoder.startBugChecking():"undefined"!=typeof top.ICEcoder.bugFileCheckInt&&clearInterval(top.ICEcoder.bugFileCheckInt);top.ICEcoder.splitPane&&top.ICEcoder.updateDiffs();top.ICEcoder.githubAuthTokenSet=A;top.ICEcoder.updateDiffOnSave=
B;top.ICEcoder.autoLogoutMins=C;D&&top.ICEcoder.refreshFileManager()},updateResultsDisplay:function(a){ICEcoder.findReplace(top.get("find").value,!0,!1);top.get("results").style.display="show"==a?"inline-block":"none"},fullScreenSwitcher:function(){"undefined"!=typeof document.cancelFullScreen?document.fullScreen?document.cancelFullScreen():document.body.requestFullScreen():"undefined"!=typeof document.mozCancelFullScreen?document.mozFullScreen?document.mozCancelFullScreen():document.body.mozRequestFullScreen():
"undefined"!=typeof document.webkitCancelFullScreen&&(document.webkitIsFullScreen?document.webkitCancelFullScreen():document.body.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT))},zipIt:function(a){a=a.replace(/\//g,"|");top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="plugins/zip-it/index.php?zip="+a+"&csrf="+top.ICEcoder.csrf},downloadFile:function(a){a=a.replace(/\//g,"|");top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="lib/download.php?file="+
a+"&csrf="+top.ICEcoder.csrf},chmod:function(a,b){a=a.replace(top.iceRoot,"");top.ICEcoder.showHide("hide",top.get("blackMask"));top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=perms&perms="+b+"&csrf="+top.ICEcoder.csrf,a.replace(/\+/g,"%2B"));top.ICEcoder.serverMessage("<b>chMod "+b+" on </b><br>"+a.replace(/\|/g,"/"))},openPreviewWindow:function(){if(0<top.ICEcoder.openFiles.length){var a,b,c,d,e;d=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];a=d.substr(d.lastIndexOf("/")+
1);e=a.substr(a.lastIndexOf(".")+1);a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();c=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.previewWindowLoading=!0;top.ICEcoder.previewWindow=window.open(d,"previewWindow",500,500);-1<["md"].indexOf(e)?top.ICEcoder.previewWindow.onload=function(){top.ICEcoder.previewWindowLoading=!1;top.ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(c.getValue())}:top.ICEcoder.previewWindow.onload=function(){top.ICEcoder.previewWindowLoading=
!1;try{top.ICEcoder.doPesticide()}catch(a){}try{top.ICEcoder.doStatsJS("open")}catch(a){}try{top.ICEcoder.doResponsive()}catch(a){}}}},resetAutoLogoutTimer:function(){1<top.ICEcoder.autoLogoutMins&&top.ICEcoder.autoLogoutTimer>60*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},message:function(a){alert(a)},ask:function(a){return confirm(a)},
getInput:function(a,b){return prompt(a,b)},dataMessage:function(a){var b;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='<h1 style="color: #fff; cursor: default">Thanks for updating to v'+
top.ICEcoder.versionNo+'!</h1><h2 style="color: #888; cursor: default">Click anywhere to continue using ICEcoder...</h2>'},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(){var a;
"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..."]);"bugs"==top.ICEcoder.bugReportStatus&&(a=top.ICEcoder.openFiles.indexOf(top.ICEcoder.bugReportPath.replace(/\|/g,"/")),-1<a&&top.ICEcoder.closeTab(a+1,"dontSetPV","dontAsk"),top.ICEcoder.openFile(top.ICEcoder.bugReportPath),top.ICEcoder.bugFilesSizesSeen=
top.ICEcoder.bugFilesSizesActual)},startBugChecking:function(){var a;0!==top.ICEcoder.bugFileCheckTimer?("undefined"!=typeof top.ICEcoder.bugFileCheckInt&&clearInterval(top.ICEcoder.bugFileCheckInt),top.ICEcoder.bugFilesSizesSeen=[],top.ICEcoder.bugFileCheckInt=setInterval(function(){a="lib/bug-files-check.php?";a+="files="+(""!==top.ICEcoder.bugFilePaths[0]?top.ICEcoder.bugFilePaths.join():"null").replace(/\//g,"|");a+="&filesSizesSeen=";if(top.ICEcoder.bugFilesSizesSeen.length!=top.ICEcoder.bugFilePaths.length)for(var b=
0;b<top.ICEcoder.bugFilePaths.length;b++)top.ICEcoder.bugFilesSizesSeen[b]="null";a+=top.ICEcoder.bugFilesSizesSeen.join();a+="&maxLines="+top.ICEcoder.bugFileMaxLines;a+="&csrf="+top.ICEcoder.csrf;var c=top.ICEcoder.xhrObj();c.onreadystatechange=function(){if(4==c.readyState&&200==c.status){var a=JSON.parse(c.responseText);top.get("bugIcon").style.backgroundPosition="off"==a.result?"0 0":"ok"==a.result?"-32px 0":"bugs"==a.result?"-48px 0":"-16px 0";top.ICEcoder.bugReportStatus=a.result;"null"==top.ICEcoder.bugFilesSizesSeen[0]&&
(top.ICEcoder.bugFilesSizesSeen=a.filesSizesSeen);top.ICEcoder.bugFilesSizesActual=a.filesSizesSeen;top.ICEcoder.bugReportPath=a.bugReportPath}};c.open("GET",a,!0);c.send()},parseInt(1E3*top.ICEcoder.bugFileCheckTimer,10)),top.ICEcoder.bugReportStatus="ok"):"undefined"!=typeof top.ICEcoder.bugFileCheckInt&&clearInterval(top.ICEcoder.bugFileCheckInt)},xssClean:function(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},printCode:function(){var a,
b;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=top.ICEcoder.filesFrame.contentWindow.frames.fileControl;b.window.document.body.innerHTML='<!DOCTYPE html><head><title>ICEcoder code output</title></head><body><pre style="white-space: pre-wrap">'+top.ICEcoder.xssClean(a.getValue())+"</pre></body></html>";b.focus();b.print();a.focus()},indicateChanges:function(){var a;if(!top.ICEcoder.loadingFile){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){var c,d;ICEcoder.selectedTab=a;c=ICEcoder.getcMInstance();d=ICEcoder.getcMdiffInstance();if(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?d:c){ICEcoder.switchMode();for(var e=0;e<ICEcoder.cMInstances.length;e++)ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[e]].getWrapperElement().style.display=
"none",ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[e]+"diff"].getWrapperElement().style.display="none";c.setOption("theme",top.ICEcoder.theme);d.setOption("theme",top.ICEcoder.theme+" diff");c.getWrapperElement().style.display="block";d.getWrapperElement().style.display="block";top.ICEcoder.splitPane&&top.ICEcoder.updateDiffs();b||setTimeout(function(){top.ICEcoder.focus()},4);c.refresh();d.refresh();ICEcoder.redoTabHighlight(ICEcoder.selectedTab);top.ICEcoder.findMode=!1;ICEcoder.findReplace(top.get("find").value,
!0,!1);top.ICEcoder.updateVersionsDisplay();top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay()}},newTab:function(a){var b;ICEcoder.cMInstances.push(ICEcoder.nextcMInstance);ICEcoder.selectedTab=ICEcoder.cMInstances.length;ICEcoder.showHide("show",ICEcoder.content);ICEcoder.content.contentWindow.createNewCMInstance(ICEcoder.nextcMInstance);ICEcoder.setLayout();ICEcoder.thisFileFolderType="file";ICEcoder.thisFileFolderLink="/[NEW]";ICEcoder.openFile();
b=ICEcoder.getcMInstance("new");ICEcoder.switchTab(ICEcoder.openFiles.length);b.removeLineClass(ICEcoder["cMActiveLinecM"+ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]],"background");ICEcoder["cMActiveLinecM"+ICEcoder.selectedTab]=b.addLineClass(0,"background","cm-s-activeLine");ICEcoder.nextcMInstance++;a&&top.ICEcoder.saveFile()},createNewTab:function(a){var b;top.ICEcoder.openFiles.push(top.ICEcoder.shortURL);top.get("tab"+top.ICEcoder.openFiles.length).style.display="inline-block";b=top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-
1];top.get("tab"+top.ICEcoder.openFiles.length).innerHTML='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a> '+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){var c;top.ICEcoder.openFiles[a-1]=b;c=top.ICEcoder.openFiles[a-1];top.get("tab"+a).innerHTML='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a> '+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){var d;a||(a=top.ICEcoder.selectedTab);ICEcoder.getcMInstance();ICEcoder.getcMdiffInstance();
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;d<ICEcoder.openFiles.length;d++)top.get("tab"+d).innerHTML=top.get("tab"+(d+1)).innerHTML,top.get("tab"+d).title=top.get("tab"+(d+1)).title,ICEcoder.openFiles[d-1]=ICEcoder.openFiles[d],ICEcoder.openFileMDTs[d-1]=ICEcoder.openFileMDTs[d],ICEcoder.openFileVersions[d-1]=ICEcoder.openFileVersions[d];ICEcoder.content.contentWindow["cM"+
top.ICEcoder.cMInstances[a-1]].getWrapperElement().style.display="none";ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[a-1]+"diff"].getWrapperElement().style.display="none";top.ICEcoder.cMInstances.splice(a-1,1);top.get("tab"+ICEcoder.openFiles.length).style.display="none";top.get("tab"+ICEcoder.openFiles.length).innerHTML="";top.get("tab"+ICEcoder.openFiles.length).title="";ICEcoder.openFiles.pop();ICEcoder.openFileMDTs.pop();ICEcoder.openFileVersions.pop();ICEcoder.selectedTab==a&&
(0<ICEcoder.openFiles.length?--ICEcoder.selectedTab:ICEcoder.selectedTab=0);0<ICEcoder.openFiles.length&&0==ICEcoder.selectedTab&&(ICEcoder.selectedTab=1);0==ICEcoder.openFiles.length?top.ICEcoder.fMIconVis("fMView",.3):(ICEcoder.switchMode(),ICEcoder.switchTab(ICEcoder.selectedTab));top.ICEcoder.savedPoints.splice(a-1,1);top.ICEcoder.savedContents.splice(a-1,1);top.ICEcoder.redoTabHighlight(ICEcoder.selectedTab);top.ICEcoder.selectDeselectFile("deselect",top.ICEcoder.filesFrame.contentWindow.document.getElementById(c.replace(/\//g,
farbtastic("picker","color");a&&top.get("picker").farbtastic.setColor(a)},initCanvasImage:function(a){var b,c;b=top.get("canvasPicker").getContext("2d");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,k,h,l,p,n,m,q;b=top.get("canvasPicker").getContext("2d");
top.get("canvasPicker").onmousemove=function(r){c=r.pageX-this.offsetLeft;d=r.pageY-this.offsetTop;e=b.getImageData(c,d,1,1).data;f=e[0];g=e[1];k=e[2];h=f+","+g+","+k;l=top.ICEcoder.rgbToHex(f,g,k);top.get("rgbMouseXY").value=h;top.get("hexMouseXY").value="#"+l;top.get("hexMouseXY").style.backgroundColor=top.get("rgbMouseXY").style.backgroundColor="#"+l;p=128>f||128>g||128>k&&200>f&&200>g&&50<k?"#fff":"#000";top.get("hexMouseXY").style.color=top.get("rgbMouseXY").style.color=p;n=get("floatingContainer");
n.style.left=top.ICEcoder.mouseX+20+"px";n.style.top=top.ICEcoder.mouseY+"px";m=-(a.naturalWidth/a.width*c*5)+25;q=-(a.naturalHeight/a.height*d*5)+25;n.style.backgroundPosition=m+"px "+q+"px"};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=p}},rgbToHex:function(a,
b,c){return top.ICEcoder.toHex(a)+top.ICEcoder.toHex(b)+top.ICEcoder.toHex(c)},toHex:function(a){a=parseInt(a,10);if(isNaN(a))return"00";a=Math.max(0,Math.min(a,255));return"0123456789abcdef".charAt((a-a%16)/16)+"0123456789abcdef".charAt(a%16)},insertColorValue:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;c=b.getTokenAt(b.getCursor());b.replaceRange(a,{line:b.getCursor().line,ch:c.start},{line:b.getCursor().line,
ch:1E6})},fMIconVis:function(a,b){var c;if(c=top.get(a))c.style.opacity=b},isOpen:function(a){a=a.replace(/\|/g,"/").replace(top.docRoot+top.iceRoot,"");a=top.ICEcoder.openFiles.indexOf(a);return-1!=a?a:!1},startPluginIntervals:function(a,b,c,d){-1<b.indexOf("?")&&(b=b+"&csrf="+top.ICEcoder.csrf);top.ICEcoder["plugTimer"+a]=-1<["_parent","_top","_self",""].indexOf(c)?top.ICEcoder["plugTimer"+a]=setInterval("window.location='"+b+"'",6E4*d):0==c.indexOf("fileControl")?top.ICEcoder["plugTimer"+a]=setInterval(function(){top.ICEcoder.serverQueue("add",
b);top.ICEcoder.serverMessage(c.split(":")[1])},6E4*d):top.ICEcoder["plugTimer"+a]=setInterval("window.open('"+b+"','"+c+"')",6E4*d);top.ICEcoder.pluginIntervalRefs.push(a)},codeAssistToggle:function(){var a,b;top.ICEcoder.codeAssist=!top.ICEcoder.codeAssist;top.get("codeAssistDisplay").style.backgroundPosition=top.ICEcoder.codeAssist?"0 0":"-16px 0";top.ICEcoder.cssColorPreview();top.ICEcoder.focus(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?"diff":!1);for(i=0;i<top.ICEcoder.cMInstances.length;i++)if(a=
top.ICEcoder.openFiles[i],a=a.split("."),a=a[a.length-1],"js"==a||"json"==a)a=top.ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[i]],b=top.ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[i]+"diff"],top.ICEcoder.codeAssist?(a.setOption("lint",!0),b.setOption("lint",!0)):(a.clearGutter("CodeMirror-lint-markers"),a.setOption("lint",!1),b.clearGutter("CodeMirror-lint-markers"),b.setOption("lint",!1))},serverQueue:function(a,b,c,d){var e,f,g,k,h;if(-1!==ICEcoder.serverQueueItems.indexOf(b))top.ICEcoder.serverMessage(),
top.ICEcoder.serverQueue("del",0);else{e=ICEcoder.getcMInstance();for(g=f=0;g<ICEcoder.serverQueueItems.length;g++)0<ICEcoder.serverQueueItems[g].indexOf("action=save")&&f++;f++;if("add"==a)ICEcoder.serverQueueItems.push(b),0<b.indexOf("action=save")&&(g=document.createElement("textarea"),g.setAttribute("id","saveTemp"+f),document.body.appendChild(g),0<b.indexOf("saveType=saveAs")||0<b.indexOf("fileVersion=undefined")?top.get("saveTemp"+f).value=e.getValue():top.get("saveTemp"+f).value=d);else if("del"==
a){if(ICEcoder.serverQueueItems[0]&&0<ICEcoder.serverQueueItems[0].indexOf("action=save")){d=f-1;for(g=1;g<d;g++)top.get("saveTemp"+g).value=top.get("saveTemp"+(g+1)).value;d=top.get("saveTemp"+d);d.parentNode.removeChild(d)}ICEcoder.serverQueueItems.splice(0,1)}if("del"==a&&1<=ICEcoder.serverQueueItems.length||1==ICEcoder.serverQueueItems.length)b&&-1==b.indexOf("saveFiles=")&&-1==b.indexOf("action=load")?(k=top.ICEcoder.xhrObj(),k.onreadystatechange=function(){4==k.readyState&&(200==k.status?(h=
JSON.parse(k.responseText),h.action.timeEnd=(new Date).getTime(),h.action.timeTaken=h.action.timeEnd-h.action.timeStart,0<=["raw","both"].indexOf(top.ICEcoder.fileDirResOutput)&&console.log(k.responseText),0<=["object","both"].indexOf(top.ICEcoder.fileDirResOutput)&&console.log(h),h.status.error?(top.ICEcoder.message(h.status.errorMsg),console.log("ICEcoder error info for your request..."),console.log(h),top.ICEcoder.serverMessage(),top.ICEcoder.serverQueue("del",0)):eval(h.action.doNext)):(top.ICEcoder.message(top.t["Sorry there was..."]),
console.log("ICEcoder error info for your request..."),console.log(h),top.ICEcoder.serverMessage(),top.ICEcoder.serverQueue("del",0)))},k.open("POST",ICEcoder.serverQueueItems[0],!0),k.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a=(new Date).getTime(),0<b.indexOf("action=saveAs")?k.send("timeStart="+a+"&file="+c+"&contents="+encodeURIComponent(top.document.getElementById("saveTemp1").value)):0<b.indexOf("action=save")?k.send("timeStart="+a+"&file="+c+"&changes="+encodeURIComponent(top.document.getElementById("saveTemp1").value)):
k.send("timeStart="+a+"&file="+c)):setTimeout(function(){"undefined"!=typeof ICEcoder.serverQueueItems[0]&&(top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href=ICEcoder.serverQueueItems[0])},1)}},cancelAllActions:function(){window.stop();0<ICEcoder.serverQueueItems.length&&ICEcoder.serverQueueItems.splice(1,ICEcoder.serverQueueItems.length);top.ICEcoder.showHide("hide",top.get("loadingMask"));top.ICEcoder.serverMessage('<b style="color: #d00">'+top.t["Cancelled tasks"]+"</b>");
setTimeout(function(){top.ICEcoder.serverMessage()},2E3)},setPreviousFiles:function(){var a;a=top.ICEcoder.openFiles.join(",").replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,"");""==a&&(a="CLEAR");top.ICEcoder.serverQueue("add","lib/settings.php?saveFiles="+a+"&csrf="+top.ICEcoder.csrf);top.ICEcoder.updateLast10List(a)},updateLast10List:function(a){var b,c,d;a=a.split(",");for(var e=0;e<a.length;e++)"CLEAR"!=a[e]&&(b='<li class="pft-file ext-'+a[e].substring(a[e].lastIndexOf(".")+
1)+'" style="margin-left: -21px"><a style="cursor:pointer" onclick="top.ICEcoder.openFile(\''+a[e].replace(/\|/g,"/")+"')\">"+a[e].replace(/\|/g,"/")+"</a></li>\n",c=top.ICEcoder.content.contentWindow.document.getElementById("last10Files"),-1==c.innerHTML.indexOf(b)&&(d=c.innerHTML.split("\n"),(10<=d.length||'<div style="display: inline-block; margin-left: -39px; margin-top: -4px">[none]</div><br><br>'==d[0]||""==d[d.length-1])&&d.pop(),c.innerHTML=b+d.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.previousFiles.length;a++)top.ICEcoder.thisFileFolderLink=top.ICEcoder.previousFiles[a].replace("|","/"),top.ICEcoder.thisFileFolderType="file",top.ICEcoder.openFile()},settingsScreen:function(a){a||(top.get("mediaContainer").innerHTML=
'<iframe src="lib/settings-screen.php" class="whiteGlow" style="width: 970px; height: 610px"></iframe>');top.ICEcoder.showHide(a?"hide":"show",top.get("blackMask"))},helpScreen:function(){top.get("mediaContainer").innerHTML='<iframe src="lib/help.php" class="whiteGlow" style="width: 840px; height: 465px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},versionsScreen:function(a,b){top.get("mediaContainer").innerHTML='<iframe src="lib/backup-versions.php?file='+a+"&csrf="+top.ICEcoder.csrf+
'" class="whiteGlow" style="width: 970px; height: 640px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},showManual:function(a,b){var c;c=b?"#"+b:"";top.get("mediaContainer").innerHTML='<iframe src="https://icecoder.net/manual?version='+a+c+'" class="whiteGlow" style="width: 800px; height: 470px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},propertiesScreen:function(a){top.get("mediaContainer").innerHTML='<iframe src="lib/properties.php?fileName='+a.replace(/\//g,
"|")+"&csrf="+top.ICEcoder.csrf+'" class="whiteGlow" style="width: 660px; height: 330px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},autoLogoutWarningScreen:function(){top.get("mediaContainer").innerHTML='<iframe src="lib/auto-logout-warning.php" id="autoLogoutIFrame" class="whiteGlow" style="width: 400px; height: 160px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},pluginsManager:function(){top.get("mediaContainer").innerHTML='<iframe src="lib/plugins-manager.php" class="whiteGlow" style="width: 800px; height: 450px"></iframe>';
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='<iframe src="lib/github.php?action='+a+"&selectedFiles="+top.ICEcoder.selectedFiles.join(";")+"&csrf="+top.ICEcoder.csrf+'" class="whiteGlow" style="width: 340px; height: 340px"></iframe>';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='<iframe src="lib/github-manager.php" class="whiteGlow" style="width: 660px; height: 450px"></iframe>',
top.ICEcoder.showHide("show",top.get("blackMask"))):top.ICEcoder.githubTokenAsk("showManager")},githubDiffToggle:function(){var a;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,a=top.ICEcoder.githubDiff?"true":"false",top.ICEcoder.filesFrame.src="files.php?githubDiff="+a+"&csrf="+top.ICEcoder.csrf},ftpManager:function(){top.get("mediaContainer").innerHTML=
'<iframe src="lib/ftp-manager.php" class="whiteGlow" style="width: 660px; height: 550px"></iframe>';top.ICEcoder.showHide("show",top.get("blackMask"))},useNewSettings:function(a,b,c,d,e,f,g,k,h,l,p,n,m,q,r,w,v,x,y,z,A,B,C,D){var t,u=a.slice(0,a.lastIndexOf("?")),u=u.slice(u.lastIndexOf("/")+1,u.lastIndexOf("."));top.ICEcoder.theme!==u&&(top.ICEcoder.theme=u,"editor"==top.ICEcoder.theme&&(top.ICEcoder.theme="icecoder"),t=document.createElement("link"),t.setAttribute("rel","stylesheet"),t.setAttribute("type",
"text/css"),t.setAttribute("href",a),top.ICEcoder.content.contentWindow.document.getElementsByTagName("head")[0].appendChild(t),t=-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[4];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: "+t+" !important";top.ICEcoder.lineWrapping=k;top.ICEcoder.lineNumbers=h;top.ICEcoder.showTrailingSpace=l;top.ICEcoder.matchBrackets=p;top.ICEcoder.autoCloseTags=n;top.ICEcoder.autoCloseBrackets=m;top.ICEcoder.indentWithTabs=q;top.ICEcoder.indentSize=w;top.ICEcoder.indentAuto=r;for(f=0;f<ICEcoder.cMInstances.length;f++)ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("lineWrapping",
top.ICEcoder.lineWrapping),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("lineNumbers",top.ICEcoder.lineNumbers),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("showTrailingSpace",top.ICEcoder.showTrailingSpace),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("matchBrackets",top.ICEcoder.matchBrackets),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("autoCloseTags",top.ICEcoder.autoCloseTags),ICEcoder.content.contentWindow["cM"+
ICEcoder.cMInstances[f]].setOption("autoCloseBrackets",top.ICEcoder.autoCloseBrackets),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("indentWithTabs",top.ICEcoder.indentWithTabs),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("indentUnit",top.ICEcoder.indentSize),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].setOption("tabSize",top.ICEcoder.indentSize),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]].refresh(),ICEcoder.content.contentWindow["cM"+
ICEcoder.cMInstances[f]+"diff"].setOption("lineWrapping",top.ICEcoder.lineWrapping),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("lineNumbers",top.ICEcoder.lineNumbers),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("showTrailingSpace",top.ICEcoder.showTrailingSpace),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("matchBrackets",top.ICEcoder.matchBrackets),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+
"diff"].setOption("autoCloseTags",top.ICEcoder.autoCloseTags),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("autoCloseBrackets",top.ICEcoder.autoCloseBrackets),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("indentWithTabs",top.ICEcoder.indentWithTabs),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("indentUnit",top.ICEcoder.indentSize),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].setOption("tabSize",
top.ICEcoder.indentSize),ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[f]+"diff"].refresh();d!=top.ICEcoder.tagWrapperCommand&&(top.ICEcoder.tagWrapperCommand=d);e!=top.ICEcoder.autoComplete&&(top.ICEcoder.autoComplete=e);top.get("plugins").style.left="left"==v?"0":"auto";top.get("plugins").style.right="right"==v?"0":"auto";top.ICEcoder.bugFilePaths=x;top.ICEcoder.bugFileCheckTimer=y;top.ICEcoder.bugFileMaxLines=z;""!=top.ICEcoder.bugFilePaths[0]?top.ICEcoder.startBugChecking():"undefined"!=
typeof top.ICEcoder.bugFileCheckInt&&clearInterval(top.ICEcoder.bugFileCheckInt);top.ICEcoder.splitPane&&top.ICEcoder.updateDiffs();top.ICEcoder.githubAuthTokenSet=A;top.ICEcoder.updateDiffOnSave=B;top.ICEcoder.autoLogoutMins=C;D&&top.ICEcoder.refreshFileManager()},updateResultsDisplay:function(a){ICEcoder.findReplace(top.get("find").value,!0,!1);top.get("results").style.display="show"==a?"inline-block":"none"},fullScreenSwitcher:function(){"undefined"!=typeof document.cancelFullScreen?document.fullScreen?
document.cancelFullScreen():document.body.requestFullScreen():"undefined"!=typeof document.mozCancelFullScreen?document.mozFullScreen?document.mozCancelFullScreen():document.body.mozRequestFullScreen():"undefined"!=typeof document.webkitCancelFullScreen&&(document.webkitIsFullScreen?document.webkitCancelFullScreen():document.body.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT))},zipIt:function(a){a=a.replace(/\//g,"|");top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="plugins/zip-it/index.php?zip="+
a+"&csrf="+top.ICEcoder.csrf},downloadFile:function(a){a=a.replace(/\//g,"|");top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="lib/download.php?file="+a+"&csrf="+top.ICEcoder.csrf},chmod:function(a,b){a=a.replace(top.iceRoot,"");top.ICEcoder.showHide("hide",top.get("blackMask"));top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=perms&perms="+b+"&csrf="+top.ICEcoder.csrf,a.replace(/\+/g,"%2B"));top.ICEcoder.serverMessage("<b>chMod "+b+" on </b><br>"+a.replace(/\|/g,
"/"))},openPreviewWindow:function(){if(0<top.ICEcoder.openFiles.length){var a,b,c,d,e;d=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];a=d.substr(d.lastIndexOf("/")+1);e=a.substr(a.lastIndexOf(".")+1);a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();c=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.previewWindowLoading=!0;top.ICEcoder.previewWindow=window.open(d,"previewWindow",500,500);-1<["md"].indexOf(e)?top.ICEcoder.previewWindow.onload=function(){top.ICEcoder.previewWindowLoading=
!1;top.ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(c.getValue())}:top.ICEcoder.previewWindow.onload=function(){top.ICEcoder.previewWindowLoading=!1;try{top.ICEcoder.doPesticide()}catch(a){}try{top.ICEcoder.doStatsJS("open")}catch(a){}try{top.ICEcoder.doResponsive()}catch(a){}}}},resetAutoLogoutTimer:function(){1<top.ICEcoder.autoLogoutMins&&top.ICEcoder.autoLogoutTimer>60*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},message:function(a){alert(a)},ask:function(a){return confirm(a)},getInput:function(a,b){return prompt(a,b)},dataMessage:function(a){var b;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='<h1 style="color: #fff; cursor: default">Thanks for updating to v'+top.ICEcoder.versionNo+'!</h1><h2 style="color: #888; cursor: default">Click anywhere to continue using ICEcoder...</h2>'},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(){var a;"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..."]);"bugs"==top.ICEcoder.bugReportStatus&&(a=top.ICEcoder.openFiles.indexOf(top.ICEcoder.bugReportPath.replace(/\|/g,"/")),-1<a&&top.ICEcoder.closeTab(a+1,"dontSetPV","dontAsk"),top.ICEcoder.openFile(top.ICEcoder.bugReportPath),
top.ICEcoder.bugFilesSizesSeen=top.ICEcoder.bugFilesSizesActual)},startBugChecking:function(){var a;0!==top.ICEcoder.bugFileCheckTimer?("undefined"!=typeof top.ICEcoder.bugFileCheckInt&&clearInterval(top.ICEcoder.bugFileCheckInt),top.ICEcoder.bugFilesSizesSeen=[],top.ICEcoder.bugFileCheckInt=setInterval(function(){a="lib/bug-files-check.php?";a+="files="+(""!==top.ICEcoder.bugFilePaths[0]?top.ICEcoder.bugFilePaths.join():"null").replace(/\//g,"|");a+="&filesSizesSeen=";if(top.ICEcoder.bugFilesSizesSeen.length!=
top.ICEcoder.bugFilePaths.length)for(var b=0;b<top.ICEcoder.bugFilePaths.length;b++)top.ICEcoder.bugFilesSizesSeen[b]="null";a+=top.ICEcoder.bugFilesSizesSeen.join();a+="&maxLines="+top.ICEcoder.bugFileMaxLines;a+="&csrf="+top.ICEcoder.csrf;var c=top.ICEcoder.xhrObj();c.onreadystatechange=function(){if(4==c.readyState&&200==c.status){var a=JSON.parse(c.responseText);top.get("bugIcon").style.backgroundPosition="off"==a.result?"0 0":"ok"==a.result?"-32px 0":"bugs"==a.result?"-48px 0":"-16px 0";top.ICEcoder.bugReportStatus=
a.result;"null"==top.ICEcoder.bugFilesSizesSeen[0]&&(top.ICEcoder.bugFilesSizesSeen=a.filesSizesSeen);top.ICEcoder.bugFilesSizesActual=a.filesSizesSeen;top.ICEcoder.bugReportPath=a.bugReportPath}};c.open("GET",a,!0);c.send()},parseInt(1E3*top.ICEcoder.bugFileCheckTimer,10)),top.ICEcoder.bugReportStatus="ok"):"undefined"!=typeof top.ICEcoder.bugFileCheckInt&&clearInterval(top.ICEcoder.bugFileCheckInt)},xssClean:function(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,
"&quot;").replace(/'/g,"&#039;")},printCode:function(){var a,b;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=top.ICEcoder.filesFrame.contentWindow.frames.fileControl;b.window.document.body.innerHTML='<!DOCTYPE html><head><title>ICEcoder code output</title></head><body><pre style="white-space: pre-wrap">'+top.ICEcoder.xssClean(a.getValue())+"</pre></body></html>";b.focus();b.print();a.focus()},indicateChanges:function(){var a;
if(!top.ICEcoder.loadingFile){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){var c,d;ICEcoder.selectedTab=a;c=ICEcoder.getcMInstance();d=ICEcoder.getcMdiffInstance();if(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?d:c){ICEcoder.switchMode();for(var e=0;e<ICEcoder.cMInstances.length;e++)ICEcoder.content.contentWindow["cM"+
ICEcoder.cMInstances[e]].getWrapperElement().style.display="none",ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[e]+"diff"].getWrapperElement().style.display="none";c.setOption("theme",top.ICEcoder.theme);d.setOption("theme",top.ICEcoder.theme+" diff");c.getWrapperElement().style.display="block";d.getWrapperElement().style.display="block";top.ICEcoder.splitPane&&top.ICEcoder.updateDiffs();b||setTimeout(function(){top.ICEcoder.focus()},4);c.refresh();d.refresh();ICEcoder.redoTabHighlight(ICEcoder.selectedTab);
top.ICEcoder.findMode=!1;ICEcoder.findReplace(top.get("find").value,!0,!1);top.ICEcoder.updateVersionsDisplay();top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay()}},newTab:function(a){var b;ICEcoder.cMInstances.push(ICEcoder.nextcMInstance);ICEcoder.selectedTab=ICEcoder.cMInstances.length;ICEcoder.showHide("show",ICEcoder.content);ICEcoder.content.contentWindow.createNewCMInstance(ICEcoder.nextcMInstance);ICEcoder.setLayout();ICEcoder.thisFileFolderType=
"file";ICEcoder.thisFileFolderLink="/[NEW]";ICEcoder.openFile();b=ICEcoder.getcMInstance("new");ICEcoder.switchTab(ICEcoder.openFiles.length);b.removeLineClass(ICEcoder["cMActiveLinecM"+ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]],"background");ICEcoder["cMActiveLinecM"+ICEcoder.selectedTab]=b.addLineClass(0,"background","cm-s-activeLine");ICEcoder.nextcMInstance++;a&&top.ICEcoder.saveFile()},createNewTab:function(a){var b;top.ICEcoder.openFiles.push(top.ICEcoder.shortURL);top.get("tab"+top.ICEcoder.openFiles.length).style.display=
"inline-block";b=top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1];top.get("tab"+top.ICEcoder.openFiles.length).innerHTML='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a> '+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){var c;top.ICEcoder.openFiles[a-1]=b;c=top.ICEcoder.openFiles[a-1];top.get("tab"+a).innerHTML='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a> '+
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){var d;a||(a=top.ICEcoder.selectedTab);ICEcoder.getcMInstance();
ICEcoder.getcMdiffInstance();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;d<ICEcoder.openFiles.length;d++)top.get("tab"+d).innerHTML=top.get("tab"+(d+1)).innerHTML,top.get("tab"+d).title=top.get("tab"+(d+1)).title,ICEcoder.openFiles[d-1]=ICEcoder.openFiles[d],ICEcoder.openFileMDTs[d-1]=ICEcoder.openFileMDTs[d],ICEcoder.openFileVersions[d-1]=ICEcoder.openFileVersions[d];
ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[a-1]].getWrapperElement().style.display="none";ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[a-1]+"diff"].getWrapperElement().style.display="none";top.ICEcoder.cMInstances.splice(a-1,1);top.get("tab"+ICEcoder.openFiles.length).style.display="none";top.get("tab"+ICEcoder.openFiles.length).innerHTML="";top.get("tab"+ICEcoder.openFiles.length).title="";ICEcoder.openFiles.pop();ICEcoder.openFileMDTs.pop();ICEcoder.openFileVersions.pop();
ICEcoder.selectedTab==a&&(0<ICEcoder.openFiles.length?--ICEcoder.selectedTab:ICEcoder.selectedTab=0);0<ICEcoder.openFiles.length&&0==ICEcoder.selectedTab&&(ICEcoder.selectedTab=1);0==ICEcoder.openFiles.length?top.ICEcoder.fMIconVis("fMView",.3):(ICEcoder.switchMode(),ICEcoder.switchTab(ICEcoder.selectedTab));top.ICEcoder.savedPoints.splice(a-1,1);top.ICEcoder.savedContents.splice(a-1,1);top.ICEcoder.redoTabHighlight(ICEcoder.selectedTab);top.ICEcoder.selectDeselectFile("deselect",top.ICEcoder.filesFrame.contentWindow.document.getElementById(c.replace(/\//g,
"|")));b||top.ICEcoder.setPreviousFiles();top.ICEcoder.updateVersionsDisplay();top.ICEcoder.indicateChanges()}top.ICEcoder.canSwitchTabs=!1;top.ICEcoder.setTabWidths("posOnlyNewTab");setTimeout(function(){top.ICEcoder.canSwitchTabs=!0},100)},closeAllTabs:function(){if(0<top.ICEcoder.cMInstances.length&&ICEcoder.ask(top.t["Close all tabs"]))for(var a=top.ICEcoder.cMInstances.length;0<a;a--)top.ICEcoder.closeTab(a,1<a?!0:!1);top.ICEcoder.indicateChanges()},setTabWidths:function(a){var b,c,d,e,f;if(top.ICEcoder.ready){b=
parseInt(top.ICEcoder.content.style.width,10)-53-22-10;c=b/top.ICEcoder.openFiles.length-18;d=-18;e=53;f=0;top.ICEcoder.tabLeftPos=[];for(var g=0;g<top.ICEcoder.openFiles.length;g++)a&&(g=top.ICEcoder.openFiles.length),d=168*top.ICEcoder.openFiles.length>b?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,b;a=parseInt(top.get("tab"+top.ICEcoder.openFiles.length).style.width,10)+

View File

@@ -0,0 +1,27 @@
// Provide a fileName and get fileExt and mode set based on supported languages
fileExt = fileName.split(".");
fileExt = fileExt[fileExt.length-1];
var mode =
fileExt == "js" || fileExt == "json" ? "text/javascript"
: fileExt == "coffee" ? "text/x-coffeescript"
: fileExt == "rb" ? "text/x-ruby"
: fileExt == "py" ? "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";

View File

@@ -125,7 +125,7 @@ if (startTab!=top.ICEcoder.selectedTab) {
$fullPath = $path.$slash.$f;
if(is_dir($fullPath)) {
$ret .= phpGrep($q, $fullPath, $base);
} else if(stristr(toUTF8noBOM(file_get_contents($fullPath,false,$context),false), $q)) {
} else if(stristr(toUTF8noBOM(getData($fullPath),false), $q)) {
$bFile = false;
$foundInSelFile = false;
// Exclude banned files
@@ -147,7 +147,7 @@ if (startTab!=top.ICEcoder.selectedTab) {
}
if (!$bFile && (count($selectedFiles)==0 || count($selectedFiles)>0 && $foundInSelFile)) {
$ret .= "<a href=\\\"javascript:top.ICEcoder.openFile('".$fullPath."');top.ICEcoder.goFindAfterOpenInt = setInterval(function(){goFindAfterOpen('".$fullPath."')},20);top.ICEcoder.showHide('hide',top.get('blackMask'))\\\">";
$ret .= str_replace($base,"",$fullPath)."</a><div id=\\\"foundCount".$r."\\\">".$t['Found']." ".substr_count(strtolower(toUTF8noBOM(file_get_contents($fullPath,false,$context),false)),$q)." ".$t['times']."</div>";
$ret .= str_replace($base,"",$fullPath)."</a><div id=\\\"foundCount".$r."\\\">".$t['Found']." ".substr_count(strtolower(toUTF8noBOM(getData($fullPath),false)),$q)." ".$t['times']."</div>";
if (isset($_GET['replace'])) {
$ret .= "<div class=\\\"replace\\\" id=\\\"replace\\\" onClick=\\\"replaceInFileSingle('".$fullPath."');this.style.display=\'none\'\\\">".$t['replace']."</div>";
};

View File

@@ -7,17 +7,7 @@ $t = $text['plugins-manager'];
$pluginsDataSrc = "https://icecoder.net/plugin-data?format=JSON";
// Now get our plugin data and put into a PHP array
if (ini_get('allow_url_fopen')) {
$pluginsDataJS = @file_get_contents($pluginsDataSrc, false, $context);
if (!$pluginsDataJS) {
$pluginsDataJS = file_get_contents(str_replace("https:","http:",$pluginsDataSrc), false, $context);
}
} elseif (function_exists('curl_init')) {
$pDSrc = curl_init($pluginsDataSrc);
curl_setopt($pDSrc, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($pDSrc, CURLOPT_RETURNTRANSFER, true);
$pluginsDataJS = curl_exec($pDSrc);
}
$pluginsDataJS = getData($pluginsDataSrc,'curl');
$pluginsData = json_decode($pluginsDataJS, true);
// If we have an action to perform
@@ -25,7 +15,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Get our old plugin & user settings
$oldPlugins = $ICEcoder["plugins"];
$settingsContents = file_get_contents($settingsFile,false,$context);
$settingsContents = getData($settingsFile);
// ==========
// INSTALLING
@@ -37,13 +27,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
$target = '../plugins/';
$zipURL = $pluginsData[strClean($_GET['plugin'])]['zipURL'];
$zipFile = "../tmp/".basename($zipURL);
if (ini_get('allow_url_fopen')) {
$fileData = file_get_contents($zipURL, false, $context);
} elseif (function_exists('curl_init')) {
$client = curl_init($zipURL);
curl_setopt($client, CURLOPT_RETURNTRANSFER, 1); //fixed this line
$fileData = curl_exec($client);
}
$fileData = getData($zipURL,'curl');
file_put_contents($zipFile, $fileData);
// Now unpack the zip

View File

@@ -45,6 +45,40 @@ if (isset($_SESSION['text'])) {
$t = $text['settings-common'];
}
// Get data from a fopen or CURL connection
function getData($url,$type='fopen',$dieMessage=false) {
global $context;
// Request is to connect via CURL
if ($type == "curl" && function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_USERAGENT, 'ICEcoder');
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$data = curl_exec($ch);
curl_close($ch);
// Otherwise, use an fopen connection
} elseif (ini_get('allow_url_fopen')) {
$data = @file_get_contents($url,false,$context);
if (!$data) {
$data = @file_get_contents(str_replace("https:","http:",$url), false, $context);
}
}
// Return data or die with message
if ($data) {
return $data;
} elseif ($dieMessage) {
die($dieMessage);
exit;
}
}
// Logout if that's the action we're taking
if (isset($_GET['logout'])) {
include(dirname(__FILE__)."/../processes/on-user-logout.php");
@@ -128,6 +162,13 @@ function xssClean($data,$type) {
return $output;
}
// Clean PHP code injection attempts
function injClean($data) {
$output = str_replace("(", "", str_replace(")", "", str_replace(";", "", $data)));
return $output;
}
// returns a UTF8 based string with any UFT8 BOM removed
function toUTF8noBOM($string,$message) {
global $text;
@@ -226,11 +267,15 @@ function getVersionsCount($fileLoc,$fileName) {
$backupIndex = $backupDirBase.$backupDirHost."/".$backupDateDirs[$i]."/.versions-index";
// Have a .versions-index file? Get contents
if (file_exists($backupIndex) && is_readable($backupIndex)) {
$versionsInfo = file_get_contents($backupIndex,false,$context);
$versionsInfo = getData($backupIndex);
$versionsInfo = explode("\n",$versionsInfo);
// For each line, check if it's our file and if so, add the count to our $count value and $dateCount array
for ($j=0; $j<count($versionsInfo); $j++) {
$fileRef = $fileLoc."/".$fileName." = ";
// Replace any backslashes in $fileLoc
$fileLoc = str_replace("\\","/",$fileLoc);
// Join $fileLock and $fileName into a path and replace double slashes
$fileRef = str_replace("//","/",$fileLoc."/".$fileName." = ");
// Check if we have a match
if (strpos($versionsInfo[$j],$fileRef) === 0) {
// We have a match, so split on the " = " and we can grab number as 2nd part
$lineInfo = explode(" = ",$versionsInfo[$j]);

View File

@@ -5,7 +5,7 @@ $t = $text['settings-save-current-files'];
// Save the currently opened files for next time
if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) {
$settingsContents = file_get_contents($settingsFile,false,$context);
$settingsContents = getData($settingsFile);
// Replace our previousFiles var with the the current
$repPosStart = strpos($settingsContents,'previousFiles" => "')+20;

View File

@@ -2,7 +2,7 @@
$newConfigSettingsFile = '<?php
// ICEcoder system settings
$ICEcoderSettings = array(
"versionNo" => "5.6",
"versionNo" => "5.7",
"codeMirrorDir" => "CodeMirror",
"docRoot" => $_SERVER[\'DOCUMENT_ROOT\'], // Set absolute path of another location if needed
"demoMode" => false,

View File

@@ -5,7 +5,7 @@ $t = $text['settings-update'];
// Update this config file?
if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_POST["theme"]) && $_POST["theme"]) {
$settingsContents = file_get_contents($settingsFile,false,$context);
$settingsContents = getData($settingsFile);
// Replace our settings vars
$repPosStart = strpos($settingsContents,'"root"');
$repPosEnd = strpos($settingsContents,'"plugins"');
@@ -45,7 +45,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
$ICEcoder["indentSize"] = intval($_POST['indentSize']);
$ICEcoder["pluginPanelAligned"] = strClean($_POST['pluginPanelAligned']);
$ICEcoder["bugFilePaths"] = 'array("'.str_replace(',','","',str_replace(" ","",strClean($_POST['bugFilePaths']))).'")';
$ICEcoder["bugFileCheckTimer"] = intval($_POST['bugFileCheckTimer']);
$ICEcoder["bugFileCheckTimer"] = intval($_POST['bugFileCheckTimer']) >= 0 ? intval($_POST['bugFileCheckTimer']) : 0;
$ICEcoder["bugFileMaxLines"] = intval($_POST['bugFileMaxLines']);
$ICEcoder["githubAuthToken"] = strClean($_POST['githubAuthToken']);
@@ -84,7 +84,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
$refreshFM = $_POST['changedFileSettings']=="true" ? "true" : "false";
// Change multiUser and enableRegistration in config___settings.php
$generalSettingsContents = file_get_contents($configSettings,false,$context);
$generalSettingsContents = getData($configSettings);
$isMultiUser = isset($_POST['multiUser']) && $_POST['multiUser'] ? "true" : "false";
$generalSettingsContents = str_replace('"multiUser" => true,','"multiUser" => '.$isMultiUser.',',$generalSettingsContents);
$generalSettingsContents = str_replace('"multiUser" => false,','"multiUser" => '.$isMultiUser.',',$generalSettingsContents);

View File

@@ -55,7 +55,7 @@ $ICEcoderUserSettings['previousFiles'] = $prevFilesAvail;
// Replace our config created date with the filemtime?
if (basename($_SERVER['SCRIPT_NAME']) == "index.php" && $ICEcoderUserSettings['configCreateDate'] == 0) {
$settingsContents = file_get_contents(dirname(__FILE__)."/".$settingsFile,false,$context);
$settingsContents = getData(dirname(__FILE__)."/".$settingsFile);
clearstatcache();
$configfilemtime = filemtime(dirname(__FILE__)."/"."config___settings.php");
// Make it a number (avoids null, undefined etc)
@@ -164,16 +164,11 @@ for ($i=0;$i<count($settingsArray);$i++) {
if (!isset($_SESSION[$settingsArray[$i]])) {$_SESSION[$settingsArray[$i]] = $ICEcoder[$settingsArray[$i]];}
}
// Determin our allowed IP addresses
$allowedIP = false;
for($i=0;$i<count($_SESSION['allowedIPs']);$i++) {
if ($_SESSION['allowedIPs'][$i]==$_SERVER["REMOTE_ADDR"]||$_SESSION['allowedIPs'][$i]=="*") {
$allowedIP = true;
}
}
// If user not allowed to view, display message
if (!$allowedIP) {
die('Sorry, access not permitted');
// Check IP permissions
if (!in_array($_SERVER["REMOTE_ADDR"], $_SESSION['allowedIPs']) && !in_array("*", $_SESSION['allowedIPs'])) {
header('Location: /');
die("Sorry, not in allowed IPs list");
exit;
};
// Establish any FTP site to use
@@ -208,7 +203,7 @@ if ((!$_SESSION['loggedIn'] || $ICEcoder["password"] == "") && !strpos($_SERVER[
// If we're unlocking ICEcoder after donating
} elseif (isset($_POST['submit']) && (strpos($_POST['submit'],"Unlock ICEcoder")>-1)) {
if (generateHash(strClean($_POST['email']),$_POST['code'])==$_POST['code']) {
$settingsContents = file_get_contents($settingsFile,false,$context);
$settingsContents = getData($settingsFile);
// Replace our empty email & code with the one submitted by user
$settingsContents = str_replace('"licenseEmail" => "",','"licenseEmail" => "'.$_POST['email'].'",',$settingsContents);
$settingsContents = str_replace('"licenseCode" => "",','"licenseCode" => "'.$_POST['code'].'",',$settingsContents);
@@ -238,7 +233,7 @@ if ((!$_SESSION['loggedIn'] || $ICEcoder["password"] == "") && !strpos($_SERVER[
// If the password hasn't been set and we're setting it
if ($ICEcoder["password"] == "" && isset($_POST['submit']) && (strpos($_POST['submit'],"set password")>-1)) {
$password = generateHash(strClean($_POST['password']));
$settingsContents = file_get_contents($settingsFile,false,$context);
$settingsContents = getData($settingsFile);
// Replace our empty password with the one submitted by user
$settingsContents = str_replace('"password" => "",','"password" => "'.$password.'",',$settingsContents);
// Also set the update checker preference
@@ -263,7 +258,7 @@ if ((!$_SESSION['loggedIn'] || $ICEcoder["password"] == "") && !strpos($_SERVER[
}
// Disable the enableRegistration config setting if the user had that option chosen
if (isset($_POST['disableFurtherRegistration'])) {
$updatedConfigSettingsFile = file_get_contents(dirname(__FILE__)."/".$configSettings);
$updatedConfigSettingsFile = getData(dirname(__FILE__)."/".$configSettings);
if ($fUConfigSettings = fopen(dirname(__FILE__)."/".$configSettings, 'w')) {
$updatedConfigSettingsFile = str_replace('"enableRegistration" => true','"enableRegistration" => false',$updatedConfigSettingsFile);
fwrite($fUConfigSettings, $updatedConfigSettingsFile);

View File

@@ -78,19 +78,7 @@ function copyOldVersion() {
}
$icv_url = "https://icecoder.net/latest-version.txt";
echo 'Detecting current version of ICEcoder...<br>';
if (ini_get('allow_url_fopen')) {
$icvInfo = @file_get_contents($icv_url,false,$context);
if (!$icvInfo) {
$icvInfo = file_get_contents(str_replace("https:","http:",$icv_url), false, $context);
}
} elseif (function_exists('curl_init')) {
$ch = curl_init($icv_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$icvInfo = curl_exec($ch);
} else {
die('Sorry, couldn\'t figure out latest version.');
}
$icvInfo = getData($icv_url,'curl','Sorry, couldn\'t figure out latest version.');
echo 'Latest version of ICEcoder is '.$icvInfo.'<br>';
openZipNew($icvInfo);
}
@@ -104,18 +92,7 @@ function openZipNew($icvInfo) {
$remoteFile = 'https://icecoder.net/ICEcoder-v'.(str_replace(" beta", "-beta",$icvInfo)).'.zip';
$file = "../tmp/new-version.zip";
if (ini_get('allow_url_fopen')) {
$fileData = @file_get_contents($remoteFile,false,$context);
if (!$fileData) {
$fileData = file_get_contents(str_replace("https:","http:",$remoteFile), false, $context);
}
} elseif (function_exists('curl_init')) {
$client = curl_init($remoteFile);
curl_setopt($client, CURLOPT_RETURNTRANSFER, 1); //fixed this line
$fileData = curl_exec($client);
} else {
die('Sorry, couldn\'t get latest version zip file.');
}
$fileData = getData($remoteFile,'curl','Sorry, couldn\'t get latest version zip file.');
echo 'Storing zip file...<br>';
file_put_contents($file, $fileData);
@@ -156,9 +133,9 @@ function transposeSettings($oldFile,$newFile,$saveFile) {
echo '- Getting old and new settings...<br>';
// Get old and new settings and start a new $contents
$oldSettingsContent = file_get_contents($oldFile,false,$context);
$oldSettingsContent = getData($oldFile);
$oldSettingsArray = explode("\n",$oldSettingsContent);
$newSettingsContent = file_get_contents($newFile,false,$context);
$newSettingsContent = getData($newFile);
$newSettingsArray = explode("\n",$newSettingsContent);
$contents = "";

View File

@@ -30,31 +30,7 @@ top.ICEcoder.switchMode = function(mode) {
cMdiff.setOption("mode",mode);
}
} else if (cM && fileName) {
fileExt = fileName.split(".");
fileExt = fileExt[fileExt.length-1];
var mode =
fileExt == "js" || fileExt == "json" ? "text/javascript"
: fileExt == "coffee" ? "text/x-coffeescript"
: fileExt == "rb" ? "text/x-ruby"
: fileExt == "py" ? "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";
<?php include(dirname(__FILE__)."/../lib/language-modes-partial.js");?>
if (mode != cM.getOption("mode")) {
cM.setOption("mode",mode);
@@ -180,8 +156,8 @@ top.ICEcoder.caretLocationType = function() {
caretChunk = thisCM.getValue().substr(0,top.ICEcoder.caretPos+1);
if(caretChunk.lastIndexOf("<script")>caretChunk.lastIndexOf("/script>")&&caretLocType=="Unknown") {caretLocType = "JavaScript";}
else if (caretChunk.lastIndexOf("<?")>caretChunk.lastIndexOf("?>")&&caretLocType=="Unknown") {caretLocType = "PHP";}
else if (caretChunk.lastIndexOf("<%")>caretChunk.lastIndexOf("%>")&&caretLocType=="Unknown") {caretLocType = "Ruby";}
else if (caretChunk.lastIndexOf("<\?")>caretChunk.lastIndexOf("?\>")&&caretLocType=="Unknown") {caretLocType = "PHP";}
else if (caretChunk.lastIndexOf("<\%")>caretChunk.lastIndexOf("%\>")&&caretLocType=="Unknown") {caretLocType = "Ruby";}
else if (caretChunk.lastIndexOf("<style")>caretChunk.lastIndexOf("/style>")&&caretLocType=="Unknown") {caretLocType = "CSS";}
else if (caretChunk.lastIndexOf("<")>caretChunk.lastIndexOf(">")&&caretLocType=="Unknown") {caretLocType = "HTML";}
else if (caretLocType=="Unknown") {caretLocType = "Content";};

View File

@@ -243,7 +243,7 @@ test = {
setTimeout(function() {
ICEcoder.closeTab(1,false,true);
console.log('TEST COMPLETE!');
alert('Test Complete!\n\nRan '+s+' of '+total+' tests OK.\nSee console for more details.');
top.ICEcoder.message('Test Complete!\n\nRan '+s+' of '+total+' tests OK.\nSee console for more details.');
},200);
} else {
testResult("- FAIL",title);
@@ -276,7 +276,7 @@ function displayResults(successful) {
function testStopped() {
unitTestResults.innerHTML += " - Test stopped";
alert("Test stopped, see console for details.");
top.ICEcoder.message("Test stopped, see console for details.");
}
</script>