mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-04 07:44:01 +01:00
Update to match main JS
This commit is contained in:
78
lib/ice-coder.min.js
vendored
78
lib/ice-coder.min.js
vendored
@@ -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<top.ICEcoder.autoLogoutMins&&top.ICEcoder.autoLogoutTimer==60*top.ICEcoder.autoLogoutMins-60&&top.ICEcoder.autoLogoutWarningScreen();get("autoLogoutIFrame")&&get("autoLogoutIFrame").contentWindow.document.getElementById("timeRemaning")&&(get("autoLogoutIFrame").contentWindow.document.getElementById("timeRemaning").innerHTML=
|
||||
0<top.ICEcoder.autoLogoutTimer?60*top.ICEcoder.autoLogoutMins-top.ICEcoder.autoLogoutTimer:0);!a&&0<ICEcoder.autoLogoutMins&&top.ICEcoder.autoLogoutTimer>=60*top.ICEcoder.autoLogoutMins&&top.ICEcoder.logout("autoLogout");top.ICEcoder.openSeconds++;0==top.ICEcoder.openSeconds%300&&(top.ICEcoder.filesFrame.contentWindow.frames.pingActive.location.href="lib/session-active-ping.php");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;a<top.ICEcoder.openFiles.length;a++)top.ICEcoder.splitPane||top.ICEcoder.content.contentWindow["cM"+
|
||||
ICEcoder.cMInstances[a]].setSize(top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.content.style.height),top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]+"diff"].setSize(100-top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.content.style.height),top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]+"diff"].getWrapperElement().style.left=top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.splitPane&&top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]].setSize(top.ICEcoder.splitPaneLeftPerc+
|
||||
"%",top.ICEcoder.content.style.height);this.docExplorer.style.height=top.ICEcoder.content.style.height;top.ICEcoder.splitPane?top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.right=top.ICEcoder.scrollBarVisible?parseInt(parseInt(ICEcoder.content.style.width,10)/2,10)+17+"px":parseInt(parseInt(ICEcoder.content.style.width,10)/2,10)+"px":top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.right=top.ICEcoder.scrollBarVisible?"17px":"0"},4))},setSplitPane:function(a){top.ICEcoder.splitPane=
|
||||
"on"==a?!0:!1;top.get("splitPaneControlsOff").style.opacity=top.ICEcoder.splitPane?.2:.5;top.get("splitPaneControlsOn").style.opacity=top.ICEcoder.splitPane?.5:.2;top.get("splitPaneNamesMain").style.opacity=top.get("splitPaneNamesDiff").style.opacity=top.ICEcoder.splitPane?1:0;top.ICEcoder.setLayout();if(top.ICEcoder.splitPane){top.ICEcoder.updateDiffs();var b=top.ICEcoder.getcMInstance();top.ICEcoder.cMonScroll(b,"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1])}else if(b=top.ICEcoder.getcMInstance(),
|
||||
a=top.ICEcoder.getcMdiffInstance(),b){cMmarks=b.getAllMarks();for(b=0;b<cMmarks.length;b++)cMmarks[b].clear();cMdiffMarks=a.getAllMarks();for(b=0;b<cMdiffMarks.length;b++)cMdiffMarks[b].clear()}"undefined"!=typeof top.ICEcoder.animSplitPaneInt&&clearInterval(top.ICEcoder.animSplitPaneInt);top.ICEcoder.animSplitPaneInt=setInterval(function(){top.ICEcoder.splitPane&&50.1<top.ICEcoder.splitPaneLeftPerc?top.ICEcoder.splitPaneLeftPerc=(top.ICEcoder.splitPaneLeftPerc-50)/1.8+50:!top.ICEcoder.splitPane&&
|
||||
99.9>top.ICEcoder.splitPaneLeftPerc?top.ICEcoder.splitPaneLeftPerc=50-(100-top.ICEcoder.splitPaneLeftPerc)/1.8+50:(top.ICEcoder.splitPaneLeftPerc=top.ICEcoder.splitPane?50:100,clearInterval(top.ICEcoder.animSplitPaneInt));top.ICEcoder.setLayout()},4)},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.filesW<ICEcoder.maxFilesW-1?ICEcoder.filesW+=Math.ceil((ICEcoder.maxFilesW-ICEcoder.filesW)/2):ICEcoder.filesW=
|
||||
ICEcoder.maxFilesW:ICEcoder.filesW>ICEcoder.minFilesW+1?ICEcoder.filesW-=Math.ceil((ICEcoder.filesW-ICEcoder.minFilesW)/2):ICEcoder.filesW=ICEcoder.minFilesW;("expand"==a&&ICEcoder.filesW==ICEcoder.maxFilesW||"contract"==a&&ICEcoder.filesW==ICEcoder.minFilesW)&&clearInterval(ICEcoder.changeFilesInt);ICEcoder.setLayout()},canResizeFilesW:function(){top.ICEcoder.ready&&"w-resize"==top.document.body.style.cursor?top.ICEcoder.mouseDown&&"gutter"==top.ICEcoder.mouseDownInCM&&(top.ICEcoder.filesW=top.ICEcoder.maxFilesW=
|
||||
250<=top.ICEcoder.mouseX&&400>=top.ICEcoder.mouseX?top.ICEcoder.mouseX:250>top.ICEcoder.mouseX?250:400,top.ICEcoder.files.style.width=top.ICEcoder.filesFrame.style.width=top.ICEcoder.filesW+"px",top.ICEcoder.setLayout(),top.ICEcoder.draggingFilesW=!0):top.ICEcoder.draggingFilesW=!1},lockUnlockNav:function(){var a=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<top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.prevLineDiff:top.ICEcoder.prevLine;c!=a.getCursor().line&&a.getLine(c)&&0<a.getLine(c).length&&0==a.getLine(c).replace(/\s/g,"").length&&a.replaceRange("",{line:c,ch:0},{line:c,ch:1E6});setTimeout(function(){for(var d,c=0;c<top.ICEcoder.renderLineStyle.length;c++){d=!1;if("diff"!=top.ICEcoder.renderLineStyle[c][0]&&-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[c][0]&&-1<b.indexOf("diff"))d=!0;d&&a.getCursor().line+
|
||||
1==top.ICEcoder.renderLineStyle[c][1]?a.setOption("cursorHeight",a.defaultTextHeight()/a.lineInfo(a.getCursor().line).handle.height):a.setOption("cursorHeight",1)}},0)},cMonBeforeChange:function(a,b,c,d){b=a.listSelections();for(var e=0;e<b.length;e++){var f=d.findMatchingTag(a,b[e].anchor);if(0!==c.text[0].indexOf(">")&&"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;f<top.ICEcoder.oppTagReplaceData.length;f++){var g=top.ICEcoder.oppTagReplaceData[f].split(";");var l=g[0];var h=1*g[1].split(":")[0];var m=1*g[1].split(":")[1];b[f]&&(e=d.findMatchingTag(a,b[f].anchor));if("undefined"!=typeof e&&(l="open"==e.at?e.open.tag:e.close.tag,"undefined"!=typeof c.from)){var n=
|
||||
h==c.from.line?c.text[0].length-c.removed[0].length:0;var p="close"==e.at&&h==c.from.line?c.removed[0].length-c.text[0].length+1:1;var k={line:h,ch:m+n+("open"==e.at?2:p)};n={line:h,ch:m+n+("open"==e.at?2:p)+g[0].length}}""!=l.trim()&&"undefined"!=typeof k&&"undefined"!=typeof n&&a.getRange(k,n)==g[0]&&(a.replaceRange(l,k,n),"close"==e.at&&(top.ICEcoder.autocompleteSkip=!0))}top.ICEcoder.oppTagReplaceData=[];top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay();
|
||||
top.ICEcoder.updateNestingIndicator();top.ICEcoder.findMode&&(top.ICEcoder.results.splice(top.ICEcoder.findResult,1),top.get("results").innerHTML=top.ICEcoder.results.length+" "+top.t.results,top.ICEcoder.findMode=!1);top.ICEcoder.updateFunctionClassList();"undefined"!=typeof top.doMiniNav&&clearTimeout(top.doMiniNav);top.ICEcoder.loadingFile?top.ICEcoder.setMinimap():top.doMiniNav=setTimeout(function(){top.ICEcoder.setMinimap()},1E3);if(c=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]){var r=
|
||||
c.substr(c.lastIndexOf("/")+1);var t=r.substr(r.lastIndexOf(".")+1)}top.ICEcoder.splitPane&&setTimeout(function(){top.ICEcoder.updateDiffs()},0);top.ICEcoder.indexData&&top.ICEcoder.highlightGitDiffs();c&&top.ICEcoder.previewWindow.location&&"/[NEW]"!=c&&top.ICEcoder.updatePreviewWindow(a,c,r,t);top.ICEcoder.indicateChanges()},cMonUpdate:function(a,b){setTimeout(function(){get("docExplorer").style.background=window.getComputedStyle(a.getWrapperElement(),null).getPropertyValue("background")},0);top.ICEcoder.setMinimapLayout(a,
|
||||
b)},cMonScroll:function(a,b){top.ICEcoder.mouseDown=!1;top.ICEcoder.mouseDownInCM=!1;if(top.ICEcoder.splitPane){var c=top.ICEcoder.getcMInstance();var d=top.ICEcoder.getcMdiffInstance();var e=-1<b.indexOf("diff")?c:d;c&&setTimeout(function(){e.scrollTo(a.getScrollInfo().left,a.getScrollInfo().top)},0)}top.ICEcoder.setMinimapLayout(a,b)},cMonInputRead:function(a,b){"keypress"==top.ICEcoder.autoComplete&&top.ICEcoder.codeAssist&&!a.state.completionActive&&(top.ICEcoder.autocompleteSkip?top.ICEcoder.autocompleteSkip=
|
||||
!1:top.ICEcoder.autocomplete())},cMonGutterClick:function(a,b,c,d,e){top.ICEcoder.mouseDownInCM="gutter"},cMonMouseDown:function(a,b,c){top.ICEcoder.mouseDownInCM="editor"},cMonContextMenu:function(a,b,c){b=a.coordsChar({left:c.pageX,top:c.pageY});a.setCursor(b);c.ctrlKey&&setTimeout(function(){var b=a,c=b.getRange(b.findWordAt(b.getCursor()).anchor,b.findWordAt(b.getCursor()).head),f=null,g=0,l=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];l=l.substr(l.lastIndexOf(".")+1);for(i in top.ICEcoder.indexData.functions[l])i===
|
||||
c&&(f=top.ICEcoder.indexData.functions[l][i],g++);for(i in top.ICEcoder.indexData.classes[l])i===c&&(f=top.ICEcoder.indexData.classes[l][i],g++);1===g&&-1===[null,"def"].indexOf(b.getTokenTypeAt(b.getCursor()))&&(top.ICEcoder.openFile(f.filePath.replace(top.docRoot,"")),top.ICEcoder.goFindAfterOpenInt=setInterval(function(a){top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]!=a.filePath.replace(top.docRoot,"")||top.ICEcoder.loadingFile||(b=top.ICEcoder.getcMInstance(),setTimeout(function(a){top.ICEcoder.goToLine(a.range.from.line+
|
||||
1);b.setSelection({line:a.range.from.line,ch:a.range.from.ch},{line:a.range.to.line,ch:a.range.to.ch})},20,a),clearInterval(top.ICEcoder.goFindAfterOpenInt))},20,f));top.ICEcoder.mouseDownInCM="editor"},0)},cMonDragOver:function(a,b,c){top.ICEcoder.setDragCursor(b,"editor")},cMonRenderLine:function(a,b,c,d){for(var e,f=0;f<top.ICEcoder.renderLineStyle.length;f++){e=!1;if("diff"!=top.ICEcoder.renderLineStyle[f][0]&&-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[f][0]&&-1<b.indexOf("diff"))e=
|
||||
!0;e&&a.lineInfo(c).line+1==top.ICEcoder.renderLineStyle[f][1]&&(d.style[top.ICEcoder.renderLineStyle[f][2]]=top.ICEcoder.renderLineStyle[f][3])}},functionArgsTooltip:function(a,b){if(top.ICEcoder.indexData){if(0===top.ICEcoder.openFiles.length)return get("tooltip").style.display="none",!0;var c,d=top.ICEcoder.getcMInstance(),e=d.coordsChar({left:top.ICEcoder.mouseX-top.ICEcoder.maxFilesW,top:top.ICEcoder.mouseY-72}),f=d.getRange(d.findWordAt(e).anchor,d.findWordAt(e).head);if(""===f)return get("tooltip").style.display=
|
||||
"none",!0;var g=null,l=0,h=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];h=h.substr(h.lastIndexOf(".")+1);for(c in top.ICEcoder.indexData.functions[h])c===f&&(g=top.ICEcoder.indexData.functions[h][c],l++);1===l&&-1===[null,"def"].indexOf(d.getTokenTypeAt(e))?(get("tooltip").style.display="block",get("tooltip").style.left=top.ICEcoder.mouseX-top.ICEcoder.maxFilesW+10+"px",get("tooltip").style.top=top.ICEcoder.mouseY-30+"px",get("tooltip").style.zIndex="1",get("tooltip").innerHTML=g.params):get("tooltip").style.display=
|
||||
"none"}},updateDiffs:function(){top.ICEcoder.renderLineStyle=[];top.ICEcoder.renderPaneShiftAmount=0;var a=top.ICEcoder.getcMInstance();var b=top.ICEcoder.getcMdiffInstance();var c=a?difflib.stringAsLines(a.getValue()):"";var d=b?difflib.stringAsLines(b.getValue()):"";c=(new difflib.SequenceMatcher(c,d)).get_opcodes();if(a){var e=a.getAllMarks();for(d=0;d<e.length;d++)e[d].clear();e=b.getAllMarks();for(d=0;d<e.length;d++)e[d].clear()}if(a&&""!=b.getValue())for(d=0;d<c.length;d++)if("equal"!==c[d][0]){if("replace"==
|
||||
c[d][0]){var f=(c[d][4]-c[d][2]+1+top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)b.getLineHandle(e).height>a.defaultTextHeight()&&(f+=b.getLineHandle(e).height-a.defaultTextHeight());f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["main",c[d][2],"height",f+"px"]);for(e=0;e<c[d][2]-c[d][1];e++)f=top.ICEcoder.findStringDiffs(a.getLine(c[d][1]+e),b.getLine(c[d][3]+e)),a.markText({line:c[d][1]+e,ch:0},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,
|
||||
ch:f[0]},{className:"diffGreyLighter"}),a.markText({line:c[d][1]+e,ch:f[0]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:f[0]+f[1]},{className:"diffGrey"}),a.markText({line:c[d][1]+e,ch:f[0]+f[1]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:1E6},{className:"diffGreyLighter"})}else a.markText({line:c[d][1],ch:0},{line:c[d][2]-1,ch:1E6},{className:"diffGreen"});"replace"!=c[d][0]&&c[d][1]==c[d][2]&&(top.ICEcoder.renderLineStyle.push(["main",c[d][2],"height",(c[d][4]-c[d][3]+1)*a.defaultTextHeight()+
|
||||
"px"]),a.markText({line:c[d][2]-1,ch:0},{line:c[d][2]-1,ch:1E6},{className:"diffNone"}));if("replace"==c[d][0]){f=(c[d][2]-c[d][4]+1-top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)a.getLineHandle(e).height>a.defaultTextHeight()&&(f+=a.getLineHandle(e).height-a.defaultTextHeight());f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",f+"px"]);for(e=0;e<c[d][4]-c[d][3];e++)f=top.ICEcoder.findStringDiffs(a.getLine(c[d][1]+e),
|
||||
b.getLine(c[d][3]+e)),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:0},{line:c[d][3]+e,ch:f[0]},{className:"diffGreyLighter"}),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:f[0]},{line:c[d][3]+e,ch:f[0]+f[2]},{className:"diffGrey"}),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:f[0]+f[2]},{line:c[d][3]+e,ch:1E6},{className:"diffGreyLighter"})}else b.markText({line:c[d][3],ch:0},{line:c[d][4]-1,ch:1E6},{className:"diffRed"});"replace"!=c[d][0]&&
|
||||
c[d][3]==c[d][4]&&(top.ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",(c[d][2]-c[d][1]+1)*a.defaultTextHeight()+"px"]),b.markText({line:c[d][4]-1,ch:0},{line:c[d][4]-1,ch:1E6},{className:"diffNone"}));top.ICEcoder.renderPaneShiftAmount=c[d][2]-c[d][4]}},findStringDiffs:function(a,b){"undefined"==typeof a&&(a="");"undefined"==typeof b&&(b="");for(var c=0,d=a.length,e=b.length;a[c]&&a[c]==b[c];c++);for(;d>c&e>c&a[d-1]==b[e-1];d--)e--;return[c,d-c,e-c]},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;d<c.length;d++)if("equal"!==c[d][0])if("replace"==c[d][0])for(var e=c[d][3];e<c[d][4];e++){var f=document.createElement("DIV");f.className="CodeMirror-linenumber";b[e-(c[d][4]-c[d][2])]&&a[e].trim()===b[e-(c[d][4]-c[d][2])].trim()?f.style.background="#888":f.style.background="#f80";f.style.color="#111";f.innerHTML=e+1;cM.setGutterMarker(e,"CodeMirror-linenumbers",f)}else if("insert"==c[d][0])for(e=c[d][3];e<c[d][4];e++)f=
|
||||
document.createElement("DIV"),f.className="CodeMirror-linenumber",f.style.background="#080",f.style.color="#fff",f.innerHTML=e+1,cM.setGutterMarker(e,"CodeMirror-linenumbers",f);else f=document.createElement("DIV"),f.className="CodeMirror-linenumber",cM.lineCount()>c[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+="<div class=\"link\" onclick=\"top.ICEcoder.toolShowHideToggle('git'); top.ICEcoder.openFile('/"+top.ICEcoder.indexData.gitDiff.paths[b]+"')\">"+top.ICEcoder.indexData.gitDiff.paths[b]+"</div>\n",top.get("git").innerHTML=a+"<br><br>"},updatePreviewWindow:function(a,b,c,d){top.ICEcoder.previewWindow.location.pathname==b?-1<["htm","html","txt"].indexOf(d)?top.ICEcoder.previewWindow.document.documentElement.innerHTML=
|
||||
a.getValue():-1<["md"].indexOf(d)&&(top.ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(a.getValue())):-1<["css"].indexOf(d)&&-1<top.ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(c)&&(a=a.getValue(),c=document.createElement("style"),c.type="text/css",c.id="ICEcoder"+b.replace(/\//g,"_"),c.styleSheet?c.styleSheet.cssText=a:c.appendChild(document.createTextNode(a)),top.ICEcoder.previewWindow.document.getElementById(c.id)&&top.ICEcoder.previewWindow.document.documentElement.removeChild(top.ICEcoder.previewWindow.document.getElementById(c.id)),
|
||||
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,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;a<top.ICEcoder.openFiles.length;a++)top.ICEcoder.splitPane||top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]].setSize(top.ICEcoder.splitPaneLeftPerc+
|
||||
"%",top.ICEcoder.content.style.height),top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]+"diff"].setSize(100-top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.content.style.height),top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]+"diff"].getWrapperElement().style.left=top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.splitPane&&top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]].setSize(top.ICEcoder.splitPaneLeftPerc+"%",top.ICEcoder.content.style.height);this.docExplorer.style.height=
|
||||
top.ICEcoder.content.style.height;top.ICEcoder.splitPane?top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.right=top.ICEcoder.scrollBarVisible?parseInt(parseInt(ICEcoder.content.style.width,10)/2,10)+17+"px":parseInt(parseInt(ICEcoder.content.style.width,10)/2,10)+"px":top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.right=top.ICEcoder.scrollBarVisible?"17px":"0"},4))},setSplitPane:function(a){top.ICEcoder.splitPane="on"==a?!0:!1;top.get("splitPaneControlsOff").style.opacity=
|
||||
top.ICEcoder.splitPane?.2:.5;top.get("splitPaneControlsOn").style.opacity=top.ICEcoder.splitPane?.5:.2;top.get("splitPaneNamesMain").style.opacity=top.get("splitPaneNamesDiff").style.opacity=top.ICEcoder.splitPane?1:0;top.ICEcoder.setLayout();if(top.ICEcoder.splitPane){top.ICEcoder.updateDiffs();var b=top.ICEcoder.getcMInstance();top.ICEcoder.cMonScroll(b,"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1])}else if(b=top.ICEcoder.getcMInstance(),a=top.ICEcoder.getcMdiffInstance(),b){cMmarks=b.getAllMarks();
|
||||
for(b=0;b<cMmarks.length;b++)cMmarks[b].clear();cMdiffMarks=a.getAllMarks();for(b=0;b<cMdiffMarks.length;b++)cMdiffMarks[b].clear()}"undefined"!=typeof top.ICEcoder.animSplitPaneInt&&clearInterval(top.ICEcoder.animSplitPaneInt);top.ICEcoder.animSplitPaneInt=setInterval(function(){top.ICEcoder.splitPane&&50.1<top.ICEcoder.splitPaneLeftPerc?top.ICEcoder.splitPaneLeftPerc=(top.ICEcoder.splitPaneLeftPerc-50)/1.8+50:!top.ICEcoder.splitPane&&99.9>top.ICEcoder.splitPaneLeftPerc?top.ICEcoder.splitPaneLeftPerc=
|
||||
50-(100-top.ICEcoder.splitPaneLeftPerc)/1.8+50:(top.ICEcoder.splitPaneLeftPerc=top.ICEcoder.splitPane?50:100,clearInterval(top.ICEcoder.animSplitPaneInt));top.ICEcoder.setLayout()},4)},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.filesW<ICEcoder.maxFilesW-1?ICEcoder.filesW+=Math.ceil((ICEcoder.maxFilesW-ICEcoder.filesW)/2):ICEcoder.filesW=ICEcoder.maxFilesW:ICEcoder.filesW>ICEcoder.minFilesW+1?ICEcoder.filesW-=Math.ceil((ICEcoder.filesW-ICEcoder.minFilesW)/2):ICEcoder.filesW=ICEcoder.minFilesW;
|
||||
("expand"==a&&ICEcoder.filesW==ICEcoder.maxFilesW||"contract"==a&&ICEcoder.filesW==ICEcoder.minFilesW)&&clearInterval(ICEcoder.changeFilesInt);ICEcoder.setLayout()},canResizeFilesW:function(){top.ICEcoder.ready&&"w-resize"==top.document.body.style.cursor?top.ICEcoder.mouseDown&&"gutter"==top.ICEcoder.mouseDownInCM&&(top.ICEcoder.filesW=top.ICEcoder.maxFilesW=250<=top.ICEcoder.mouseX&&400>=top.ICEcoder.mouseX?top.ICEcoder.mouseX:250>top.ICEcoder.mouseX?250:400,top.ICEcoder.files.style.width=top.ICEcoder.filesFrame.style.width=
|
||||
top.ICEcoder.filesW+"px",top.ICEcoder.setLayout(),top.ICEcoder.draggingFilesW=!0):top.ICEcoder.draggingFilesW=!1},lockUnlockNav:function(){var a=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<top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.prevLineDiff:top.ICEcoder.prevLine;c!=a.getCursor().line&&
|
||||
a.getLine(c)&&0<a.getLine(c).length&&0==a.getLine(c).replace(/\s/g,"").length&&a.replaceRange("",{line:c,ch:0},{line:c,ch:1E6});setTimeout(function(){for(var d,c=0;c<top.ICEcoder.renderLineStyle.length;c++){d=!1;if("diff"!=top.ICEcoder.renderLineStyle[c][0]&&-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[c][0]&&-1<b.indexOf("diff"))d=!0;d&&a.getCursor().line+1==top.ICEcoder.renderLineStyle[c][1]?a.setOption("cursorHeight",a.defaultTextHeight()/a.lineInfo(a.getCursor().line).handle.height):
|
||||
a.setOption("cursorHeight",1)}},0)},cMonBeforeChange:function(a,b,c,d){b=a.listSelections();for(var e=0;e<b.length;e++){var f=d.findMatchingTag(a,b[e].anchor);if(0!==c.text[0].indexOf(">")&&"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;f<top.ICEcoder.oppTagReplaceData.length;f++){var g=top.ICEcoder.oppTagReplaceData[f].split(";");var l=g[0];var h=1*g[1].split(":")[0];var m=1*g[1].split(":")[1];b[f]&&(e=d.findMatchingTag(a,b[f].anchor));if("undefined"!=typeof e&&(l="open"==e.at?e.open.tag:e.close.tag,"undefined"!=typeof c.from)){var n=h==c.from.line?c.text[0].length-c.removed[0].length:0;var p="close"==e.at&&h==c.from.line?c.removed[0].length-c.text[0].length+1:1;var k={line:h,
|
||||
ch:m+n+("open"==e.at?2:p)};n={line:h,ch:m+n+("open"==e.at?2:p)+g[0].length}}""!=l.trim()&&"undefined"!=typeof k&&"undefined"!=typeof n&&a.getRange(k,n)==g[0]&&(a.replaceRange(l,k,n),"close"==e.at&&(top.ICEcoder.autocompleteSkip=!0))}top.ICEcoder.oppTagReplaceData=[];top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay();top.ICEcoder.updateNestingIndicator();top.ICEcoder.findMode&&(top.ICEcoder.results.splice(top.ICEcoder.findResult,1),top.get("results").innerHTML=
|
||||
top.ICEcoder.results.length+" "+top.t.results,top.ICEcoder.findMode=!1);top.ICEcoder.updateFunctionClassList();"undefined"!=typeof top.doMiniNav&&clearTimeout(top.doMiniNav);top.ICEcoder.loadingFile?top.ICEcoder.setMinimap():top.doMiniNav=setTimeout(function(){top.ICEcoder.setMinimap()},1E3);if(c=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]){var r=c.substr(c.lastIndexOf("/")+1);var t=r.substr(r.lastIndexOf(".")+1)}top.ICEcoder.splitPane&&setTimeout(function(){top.ICEcoder.updateDiffs()},0);
|
||||
top.ICEcoder.indexData&&top.ICEcoder.highlightGitDiffs();c&&top.ICEcoder.previewWindow.location&&"/[NEW]"!=c&&top.ICEcoder.updatePreviewWindow(a,c,r,t);top.ICEcoder.indicateChanges()},cMonUpdate:function(a,b){setTimeout(function(){get("docExplorer").style.background=window.getComputedStyle(a.getWrapperElement(),null).getPropertyValue("background")},0);top.ICEcoder.setMinimapLayout(a,b)},cMonScroll:function(a,b){top.ICEcoder.mouseDown=!1;top.ICEcoder.mouseDownInCM=!1;if(top.ICEcoder.splitPane){var c=
|
||||
top.ICEcoder.getcMInstance();var d=top.ICEcoder.getcMdiffInstance();var e=-1<b.indexOf("diff")?c:d;c&&setTimeout(function(){e.scrollTo(a.getScrollInfo().left,a.getScrollInfo().top)},0)}top.ICEcoder.setMinimapLayout(a,b)},cMonInputRead:function(a,b){"keypress"==top.ICEcoder.autoComplete&&top.ICEcoder.codeAssist&&!a.state.completionActive&&(top.ICEcoder.autocompleteSkip?top.ICEcoder.autocompleteSkip=!1:top.ICEcoder.autocomplete())},cMonGutterClick:function(a,b,c,d,e){top.ICEcoder.mouseDownInCM="gutter"},
|
||||
cMonMouseDown:function(a,b,c){top.ICEcoder.mouseDownInCM="editor"},cMonContextMenu:function(a,b,c){b=a.coordsChar({left:c.pageX,top:c.pageY});a.setCursor(b);c.ctrlKey&&setTimeout(function(){var b=a,c=b.getRange(b.findWordAt(b.getCursor()).anchor,b.findWordAt(b.getCursor()).head),f=null,g=0,l=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];l=l.substr(l.lastIndexOf(".")+1);for(i in top.ICEcoder.indexData.functions[l])i===c&&(f=top.ICEcoder.indexData.functions[l][i],g++);for(i in top.ICEcoder.indexData.classes[l])i===
|
||||
c&&(f=top.ICEcoder.indexData.classes[l][i],g++);1===g&&-1===[null,"def"].indexOf(b.getTokenTypeAt(b.getCursor()))&&(top.ICEcoder.openFile(f.filePath.replace(top.docRoot,"")),top.ICEcoder.goFindAfterOpenInt=setInterval(function(a){top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]!=a.filePath.replace(top.docRoot,"")||top.ICEcoder.loadingFile||(b=top.ICEcoder.getcMInstance(),setTimeout(function(a){top.ICEcoder.goToLine(a.range.from.line+1);b.setSelection({line:a.range.from.line,ch:a.range.from.ch},
|
||||
{line:a.range.to.line,ch:a.range.to.ch})},20,a),clearInterval(top.ICEcoder.goFindAfterOpenInt))},20,f));top.ICEcoder.mouseDownInCM="editor"},0)},cMonDragOver:function(a,b,c){top.ICEcoder.setDragCursor(b,"editor")},cMonRenderLine:function(a,b,c,d){for(var e,f=0;f<top.ICEcoder.renderLineStyle.length;f++){e=!1;if("diff"!=top.ICEcoder.renderLineStyle[f][0]&&-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[f][0]&&-1<b.indexOf("diff"))e=!0;e&&a.lineInfo(c).line+1==top.ICEcoder.renderLineStyle[f][1]&&
|
||||
(d.style[top.ICEcoder.renderLineStyle[f][2]]=top.ICEcoder.renderLineStyle[f][3])}},functionArgsTooltip:function(a,b){if(top.ICEcoder.indexData){if(0===top.ICEcoder.openFiles.length)return get("tooltip").style.display="none",!0;var c,d=top.ICEcoder.getcMInstance(),e=d.coordsChar({left:top.ICEcoder.mouseX-top.ICEcoder.maxFilesW,top:top.ICEcoder.mouseY-72}),f=d.getRange(d.findWordAt(e).anchor,d.findWordAt(e).head);if(""===f)return get("tooltip").style.display="none",!0;var g=null,l=0,h=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-
|
||||
1];h=h.substr(h.lastIndexOf(".")+1);for(c in top.ICEcoder.indexData.functions[h])c===f&&(g=top.ICEcoder.indexData.functions[h][c],l++);1===l&&-1===[null,"def"].indexOf(d.getTokenTypeAt(e))?(get("tooltip").style.display="block",get("tooltip").style.left=top.ICEcoder.mouseX-top.ICEcoder.maxFilesW+10+"px",get("tooltip").style.top=top.ICEcoder.mouseY-30+"px",get("tooltip").style.zIndex="1",get("tooltip").innerHTML=g.params):get("tooltip").style.display="none"}},updateDiffs:function(){top.ICEcoder.renderLineStyle=
|
||||
[];top.ICEcoder.renderPaneShiftAmount=0;var a=top.ICEcoder.getcMInstance();var b=top.ICEcoder.getcMdiffInstance();var c=a?difflib.stringAsLines(a.getValue()):"";var d=b?difflib.stringAsLines(b.getValue()):"";c=(new difflib.SequenceMatcher(c,d)).get_opcodes();if(a){var e=a.getAllMarks();for(d=0;d<e.length;d++)e[d].clear();e=b.getAllMarks();for(d=0;d<e.length;d++)e[d].clear()}if(a&&""!=b.getValue())for(d=0;d<c.length;d++)if("equal"!==c[d][0]){if("replace"==c[d][0]){var f=(c[d][4]-c[d][2]+1+top.ICEcoder.renderPaneShiftAmount)*
|
||||
a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)b.getLineHandle(e).height>a.defaultTextHeight()&&(f+=b.getLineHandle(e).height-a.defaultTextHeight());f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["main",c[d][2],"height",f+"px"]);for(e=0;e<c[d][2]-c[d][1];e++)f=top.ICEcoder.findStringDiffs(a.getLine(c[d][1]+e),b.getLine(c[d][3]+e)),a.markText({line:c[d][1]+e,ch:0},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:f[0]},{className:"diffGreyLighter"}),a.markText({line:c[d][1]+
|
||||
e,ch:f[0]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:f[0]+f[1]},{className:"diffGrey"}),a.markText({line:c[d][1]+e,ch:f[0]+f[1]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:1E6},{className:"diffGreyLighter"})}else a.markText({line:c[d][1],ch:0},{line:c[d][2]-1,ch:1E6},{className:"diffGreen"});"replace"!=c[d][0]&&c[d][1]==c[d][2]&&(top.ICEcoder.renderLineStyle.push(["main",c[d][2],"height",(c[d][4]-c[d][3]+1)*a.defaultTextHeight()+"px"]),a.markText({line:c[d][2]-1,ch:0},{line:c[d][2]-
|
||||
1,ch:1E6},{className:"diffNone"}));if("replace"==c[d][0]){f=(c[d][2]-c[d][4]+1-top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)a.getLineHandle(e).height>a.defaultTextHeight()&&(f+=a.getLineHandle(e).height-a.defaultTextHeight());f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",f+"px"]);for(e=0;e<c[d][4]-c[d][3];e++)f=top.ICEcoder.findStringDiffs(a.getLine(c[d][1]+e),b.getLine(c[d][3]+e)),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,
|
||||
ch:0},{line:c[d][3]+e,ch:f[0]},{className:"diffGreyLighter"}),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:f[0]},{line:c[d][3]+e,ch:f[0]+f[2]},{className:"diffGrey"}),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:f[0]+f[2]},{line:c[d][3]+e,ch:1E6},{className:"diffGreyLighter"})}else b.markText({line:c[d][3],ch:0},{line:c[d][4]-1,ch:1E6},{className:"diffRed"});"replace"!=c[d][0]&&c[d][3]==c[d][4]&&(top.ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",(c[d][2]-
|
||||
c[d][1]+1)*a.defaultTextHeight()+"px"]),b.markText({line:c[d][4]-1,ch:0},{line:c[d][4]-1,ch:1E6},{className:"diffNone"}));top.ICEcoder.renderPaneShiftAmount=c[d][2]-c[d][4]}},findStringDiffs:function(a,b){"undefined"==typeof a&&(a="");"undefined"==typeof b&&(b="");for(var c=0,d=a.length,e=b.length;a[c]&&a[c]==b[c];c++);for(;d>c&e>c&a[d-1]==b[e-1];d--)e--;return[c,d-c,e-c]},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;d<c.length;d++)if("equal"!==c[d][0])if("replace"==c[d][0])for(var e=c[d][3];e<c[d][4];e++){var f=document.createElement("DIV");f.className="CodeMirror-linenumber";b[e-(c[d][4]-c[d][2])]&&a[e].trim()===b[e-(c[d][4]-c[d][2])].trim()?f.style.background="#888":f.style.background="#f80";f.style.color="#111";f.innerHTML=e+1;cM.setGutterMarker(e,"CodeMirror-linenumbers",f)}else if("insert"==c[d][0])for(e=c[d][3];e<c[d][4];e++)f=document.createElement("DIV"),f.className="CodeMirror-linenumber",f.style.background=
|
||||
"#080",f.style.color="#fff",f.innerHTML=e+1,cM.setGutterMarker(e,"CodeMirror-linenumbers",f);else f=document.createElement("DIV"),f.className="CodeMirror-linenumber",cM.lineCount()>c[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+="<div class=\"link\" onclick=\"top.ICEcoder.toolShowHideToggle('git'); top.ICEcoder.openFile('/"+top.ICEcoder.indexData.gitDiff.paths[b]+"')\">"+top.ICEcoder.indexData.gitDiff.paths[b]+"</div>\n",top.get("git").innerHTML=a+"<br><br>"},updatePreviewWindow:function(a,b,c,d){top.ICEcoder.previewWindow.location.pathname==b?-1<["htm","html","txt"].indexOf(d)?top.ICEcoder.previewWindow.document.documentElement.innerHTML=a.getValue():-1<["md"].indexOf(d)&&
|
||||
(top.ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(a.getValue())):-1<["css"].indexOf(d)&&-1<top.ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(c)&&(a=a.getValue(),c=document.createElement("style"),c.type="text/css",c.id="ICEcoder"+b.replace(/\//g,"_"),c.styleSheet?c.styleSheet.cssText=a:c.appendChild(document.createTextNode(a)),top.ICEcoder.previewWindow.document.getElementById(c.id)&&top.ICEcoder.previewWindow.document.documentElement.removeChild(top.ICEcoder.previewWindow.document.getElementById(c.id)),
|
||||
top.ICEcoder.previewWindow.document.documentElement.appendChild(c));try{top.ICEcoder.doPesticide()}catch(e){}try{top.ICEcoder.doStatsJS("update")}catch(e){}try{top.ICEcoder.doResponsive()}catch(e){}},contentCleanUp:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getValue();b=b.replace(/<ICEcoder:\/:textarea>/g,"</textarea>");a.setValue(b);a.clearHistory();top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1]=
|
||||
a.changeGeneration();top.ICEcoder.savedContents[top.ICEcoder.selectedTab-1]=a.getValue()},undo:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a).undo()},redo:function(){var a=ICEcoder.getcMInstance();var b=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a).redo()},indent:function(a){var b=ICEcoder.getcMInstance();var c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?
|
||||
c:b;"more"==a?top.ICEcoder.content.contentWindow.CodeMirror.commands.indentMore(b):top.ICEcoder.content.contentWindow.CodeMirror.commands.indentLess(b)},moveLines:function(a){var b;var c=top.ICEcoder.getcMInstance();var d=top.ICEcoder.getcMdiffInstance();var e=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?d:c;var f=e.getCursor("start");var g=e.getCursor("end");"up"==a&&0<f.line&&(b=f.line-1);"down"==a&&g.line<e.lineCount()-1&&(b=g.line+1);if(!isNaN(b)){var l=e.getLine(b);e.operation(function(){if("up"==
|
||||
|
||||
Reference in New Issue
Block a user