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

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

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



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


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

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

Click anywhere to continue using ICEcoder...

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


Use arrow keys to eat your code

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



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


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

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

Click anywhere to continue using ICEcoder...

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


Use arrow keys to eat your code

(it returns afterwards of course) :-)
'; + setTimeout(function(){ICEcoder.showHide("hide",get("blackMask"));get("mediaContainer").innerHTML="";ICEcoder.playSnake()},2E3)},playSnake:function(){var a=ICEcoder.getcMInstance();a.setOption("readOnly","nocursor");a.focus();ICEcoder.snakePreHistory=a.getHistory();ICEcoder.snakePreContent=a.getValue();ICEcoder.snakePreCursor=a.getCursor();a=Math.floor(50*Math.random());ICEcoder.snakePos=[[a,0],[a,-1],[a,-2],[a,-3],[a,-4]];ICEcoder.content.contentWindow.document.getElementById("game").style.display= + "block";ICEcoder.snakeDir="down";ICEcoder.doSnake();ICEcoder.snakeInt=setInterval(function(){var a=[];a[0]=ICEcoder.snakePos[0][0]+("right"==ICEcoder.snakeDir?1:"left"==ICEcoder.snakeDir?-1:0);a[1]=ICEcoder.snakePos[0][1]+("down"==ICEcoder.snakeDir?1:"up"==ICEcoder.snakeDir?-1:0);ICEcoder.snakePos.unshift(a);ICEcoder.snakePos.pop();ICEcoder.doSnake()},100)},doSnake:function(){var a;var b=ICEcoder.getcMInstance();var c=b.defaultCharWidth();var d=b.defaultTextHeight();var e=ICEcoder.content.contentWindow.document.getElementById("game").innerHTML= + "";for(a=0;a';ICEcoder.content.contentWindow.document.getElementById("game").innerHTML=e;e=b.coordsChar({top:ICEcoder.snakePos[0][1]*d+4,left:ICEcoder.snakePos[0][0]*c+60});var f=b.getLine(e.line);if(ICEcoder.snakePos[0][0]-1<=f.length-2){var g="";if("\t"===f.substr(e.ch, + 1))for(a=0;aICEcoder.snakePos[0][0]||0>ICEcoder.snakePos[0][1]||ICEcoder.snakePos[0][0]*c+60>a.clientWidth||ICEcoder.snakePos[0][1]*d+4>a.clientHeight||e)clearInterval(ICEcoder.snakeInt),ICEcoder.content.contentWindow.document.getElementById("game").style.display="none",b.setValue(ICEcoder.snakePreContent),ICEcoder.savedPoints[ICEcoder.selectedTab-1]=b.changeGeneration(),ICEcoder.savedContents[ICEcoder.selectedTab- + 1]=ICEcoder.snakePreContent,b.setHistory(ICEcoder.snakePreHistory),ICEcoder.indicateChanges(),ICEcoder.redoTabHighlight(ICEcoder.selectedTab),b.setOption("readOnly",!1),b.setCursor(ICEcoder.snakePreCursor),b.focus(),ICEcoder.snakePlaying=!1}}; \ No newline at end of file