diff --git a/lib/ice-coder.min.js b/lib/ice-coder.min.js index c378578..6b1b4b9 100644 --- a/lib/ice-coder.min.js +++ b/lib/ice-coder.min.js @@ -4,45 +4,45 @@ debounce:"",editorFocusInstance:"",openSeconds:0,indexing:!1,ready:!1,initAliase (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&&top.ICEcoder.autoOpenFiles(),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=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.git&&(top.ICEcoder.indexData.git=a.git,top.ICEcoder.updateGitDiffPane(),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,10)-25-4+this.filesW- -100+"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)&&-1top.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.length;b++)a+="
"+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