mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 15:24:00 +01:00
Fix to cursor height for wrapped lines
Avoids issue caused by for non diff height styled lines
This commit is contained in:
@@ -269,7 +269,29 @@ var ICEcoder = {
|
||||
}
|
||||
// Set the cursor to text height, not line height
|
||||
setTimeout(function() {
|
||||
thisCM.setOption("cursorHeight",thisCM.defaultTextHeight() / thisCM.lineInfo(thisCM.getCursor().line).handle.height);
|
||||
var paneMatch;
|
||||
|
||||
// Loop through styles to check if we have to adjust cursor height
|
||||
for (var i=0; i<top.ICEcoder.renderLineStyle.length; i++) {
|
||||
|
||||
// We have no matching pane to start with
|
||||
paneMatch = false;
|
||||
|
||||
// Is the pane we need to set the cursor on this pane?
|
||||
if (
|
||||
(top.ICEcoder.renderLineStyle[i][0] != "diff" && cMinstance.indexOf("diff") == -1) ||
|
||||
(top.ICEcoder.renderLineStyle[i][0] == "diff" && cMinstance.indexOf("diff") > -1)
|
||||
)
|
||||
{paneMatch = true;}
|
||||
|
||||
// If the pane matches & also the line we're on is the line we have a style set for, set that cursor height
|
||||
if (paneMatch && thisCM.getCursor().line+1 == top.ICEcoder.renderLineStyle[i][1]) {
|
||||
thisCM.setOption("cursorHeight",thisCM.defaultTextHeight() / thisCM.lineInfo(thisCM.getCursor().line).handle.height);
|
||||
} else {
|
||||
thisCM.setOption("cursorHeight",1);
|
||||
}
|
||||
|
||||
}
|
||||
},0);
|
||||
},
|
||||
|
||||
|
||||
148
lib/ice-coder.min.js
vendored
148
lib/ice-coder.min.js
vendored
@@ -10,80 +10,80 @@ clearInterval(ICEcoder.changeFilesInt);ICEcoder.setLayout()},canResizeFilesW:fun
|
||||
lockUnlockNav:function(){var a;a=top.filesFrame.contentWindow.document.getElementById("fmLock");ICEcoder.lockedNav=!ICEcoder.lockedNav;a.style.backgroundPosition=ICEcoder.lockedNav?"0 0":"-16px 0"},showHidePlugins:function(a){get("plugins").style.width="show"==a?"55px":"3px";get("plugins").style.background="show"==a?"#333":"transparent";"show"==a&&ICEcoder.changeFilesW("expand")},cMonFocus:function(a,b){top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay();
|
||||
top.ICEcoder.editorFocusInstance=b;top.ICEcoder.getCaretPosition()},cMonBlur:function(a,b){},cMonKeyUp:function(a,b){"undefined"!=typeof top.doFind&&clearInterval(top.doFind);top.doFind=setTimeout(function(){top.ICEcoder.findReplace(top.get("find").value,!0,!1)},500);top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay()},cMonCursorActivity:function(a,b){var c;top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay();
|
||||
a.removeLineClass(top.ICEcoder["cMActiveLine"+b],"background");a.getCursor("start").line==a.getCursor().line&&(top.ICEcoder["cMActiveLine"+b]=a.addLineClass(a.getCursor().line,"background","cm-s-activeLine"));"CSS"==top.ICEcoder.caretLocType&&top.ICEcoder.cssColorPreview();c=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.prevLineDiff:top.ICEcoder.prevLine;c!=a.getCursor().line&&a.getLine(c)&&0<a.getLine(c).length&&0==a.getLine(c).replace(/\s/g,"").length&&a.replaceRange("",{line:c,
|
||||
ch:0},{line:c,ch:1E6});setTimeout(function(){a.setOption("cursorHeight",a.defaultTextHeight()/a.lineInfo(a.getCursor().line).handle.height)},0)},cMonChange:function(a,b,c){var d,f;top.ICEcoder.loadingFile||top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);setTimeout(function(){top.ICEcoder.scrollBarVisible=a.getScrollInfo().height>a.getScrollInfo().clientHeight;top.ICEcoder.setLayout()},0);top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay();top.ICEcoder.updateNestingIndicator();
|
||||
top.ICEcoder.findMode&&(top.ICEcoder.results.splice(top.ICEcoder.findResult,1),top.get("results").innerHTML=top.ICEcoder.results.length+" "+top.t.results,top.ICEcoder.findMode=!1);if(b=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]){d=b.substr(b.lastIndexOf("/")+1);f=d.substr(d.lastIndexOf(".")+1);for(var e=c.from.line;e<c.from.line+c.text.length;e++)top.ICEcoder.content.contentWindow.CodeMirror.doFold(-1<a.getLine(e).indexOf("{")?"brace":"xml",null,"+","-",!0)(a,e);if("}"==c.text[0]||c.removed&&
|
||||
"}"==c.removed[0])for(cursor=a.getSearchCursor("{",a.getCursor(),!1),cursor.findPrevious(),e=cursor.from().line;e<a.getCursor().line;e++)top.ICEcoder.content.contentWindow.CodeMirror.doFold(-1<a.getLine(e).indexOf("{")?"brace":"xml",null,"+","-",!0)(a,e)}top.ICEcoder.splitPane&&top.ICEcoder.updateDiffs();b&&top.ICEcoder.previewWindow.location&&top.ICEcoder.updatePreviewWindow(a,b,d,f);top.ICEcoder.indicateChanges()},cMonScroll:function(a,b){var c,d;c=top.ICEcoder.getcMInstance();d=top.ICEcoder.getcMdiffInstance();
|
||||
c=-1<b.indexOf("diff")?c:d;top.ICEcoder.mouseDown=!1;c.scrollTo(a.getScrollInfo().left,a.getScrollInfo().top)},cMonInputRead:function(a,b){"keypress"==top.ICEcoder.autoComplete&&top.ICEcoder.codeAssist&&(clearTimeout(top.ICEcoder.debounce),a.state.completionActive||(top.ICEcoder.debounce=setTimeout(function(){CodeMirror.commands.autocomplete(a)},200)))},cMonRenderLine:function(a,b,c,d){for(var f,e=0;e<top.ICEcoder.renderLineStyle.length;e++){f=!1;if("diff"!=top.ICEcoder.renderLineStyle[e][0]&&-1==
|
||||
b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[e][0]&&-1<b.indexOf("diff"))f=!0;f&&a.lineInfo(c).line+1==top.ICEcoder.renderLineStyle[e][1]&&(d.style[top.ICEcoder.renderLineStyle[e][2]]=top.ICEcoder.renderLineStyle[e][3])}},updateDiffs:function(){var a,b,c,d,f;top.ICEcoder.renderLineStyle=[];top.ICEcoder.renderPaneShiftAmount=0;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();c=difflib.stringAsLines(a.getValue());d=difflib.stringAsLines(b.getValue());c=(new difflib.SequenceMatcher(c,
|
||||
d)).get_opcodes();f=a.getAllMarks();for(d=0;d<f.length;d++)f[d].clear();f=b.getAllMarks();for(d=0;d<f.length;d++)f[d].clear();for(d=0;d<c.length;d++)if("equal"!==c[d][0]){if("replace"==c[d][0]){f=(c[d][4]-c[d][2]+1+top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["main",c[d][2],"height",f+"px"]);for(var 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])for(f=(c[d][2]-c[d][4]+1-top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight(),f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",f+"px"]),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,f=b.length;a[c]&&a[c]==b[c];c++);for(;d>c&f>c&a[d-1]==b[f-1];d--)f--;return[c,d-c,f-c]},updatePreviewWindow:function(a,b,c,d){top.ICEcoder.previewWindow.location.pathname==b?-1<["htm","html","txt"].indexOf(d)?top.ICEcoder.previewWindow.document.documentElement.innerHTML=
|
||||
a.getValue():-1<["md"].indexOf(d)&&(top.ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(a.getValue())):-1<["css"].indexOf(d)&&-1<top.ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(c)&&(a=a.getValue(),c=document.createElement("style"),c.type="text/css",c.id="ICEcoder"+b.replace(/\//g,"_"),c.styleSheet?c.styleSheet.cssText=a:c.appendChild(document.createTextNode(a)),top.ICEcoder.previewWindow.document.getElementById(c.id)&&top.ICEcoder.previewWindow.document.documentElement.removeChild(top.ICEcoder.previewWindow.document.getElementById(c.id)),
|
||||
top.ICEcoder.previewWindow.document.documentElement.appendChild(c));try{top.ICEcoder.doPesticide()}catch(f){}try{top.ICEcoder.doStatsJS("update")}catch(e){}},contentCleanUp:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getValue();b=b.replace(/<ICEcoder:\/:textarea>/g,"</textarea>");a.setValue(b);a.clearHistory();top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1]=a.changeGeneration()},undo:function(){var a,
|
||||
b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a).undo()},redo:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a).redo()},indent:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;"more"==a?top.ICEcoder.content.contentWindow.CodeMirror.commands.indentMore(b):top.ICEcoder.content.contentWindow.CodeMirror.commands.indentLess(b)},
|
||||
moveLines:function(a){var b,c,d,f,e,g,k;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;f=d.getCursor("start");e=d.getCursor("end");"up"==a&&0<f.line&&(g=f.line-1);"down"==a&&e.line<d.lineCount()-1&&(g=e.line+1);isNaN(g)||(k=d.getLine(g),d.operation(function(){if("up"==a)for(var b=f.line;b<=e.line;b++)d.replaceRange(d.getLine(b),{line:b-1,ch:0},{line:b-1,ch:1E6});else for(b=e.line;b>=f.line;b--)d.replaceRange(d.getLine(b),
|
||||
{line:b+1,ch:0},{line:b+1,ch:1E6});d.replaceRange(k,{line:"up"==a?e.line:f.line,ch:0},{line:"up"==a?e.line:f.line,ch:1E6});d.setSelection({line:f.line+("up"==a?-1:1),ch:f.ch},{line:e.line+("up"==a?-1:1),ch:e.ch})}))},highlightLine:function(a){var b,c;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;b.setSelection({line:a,ch:0},{line:a,ch:b.lineInfo(a).text.length})},focus:function(a){var b,c;/iPhone|iPad|iPod/i.test(navigator.userAgent)||
|
||||
(b=top.ICEcoder.getcMInstance(),c=top.ICEcoder.getcMdiffInstance(),(a=a?c:b)&&a.focus())},goToLine:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b).setCursor(a?a-1:top.get("goToLineNo").value-1);top.ICEcoder.focus();return!1},lineCommentToggle:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getCursor().ch;c=a.getCursor().line;
|
||||
d=a.getLine(c);ICEcoder.lineCommentToggleSub(a,b,c,d,d.length,2)},tagWrapper:function(a){var b,c,d,f,e;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;b=a;"div"==a?(f=d.getCursor("start").line,e=d.getCursor().line,d.operation(function(){d.replaceSelection("<div>\n"+d.getSelection()+"\n</div>","around");for(var a=f+1;a<=e+1;a++)d.indentLine(a);d.indentLine(e+2,"prev");d.indentLine(e+2,"subtract")})):-1<"p a b i strong em h1 h2 h3 li".split(" ").indexOf(a)&&
|
||||
d.getSelection().substr(0,a.length+1)=="<"+b&&d.getSelection().substr(-(a.length+3))=="</"+a+">"?d.replaceSelection(d.getSelection().substr(d.getSelection().indexOf(">")+1,d.getSelection().length-d.getSelection().indexOf(">")-1-a.length-3),"around"):("a"==a&&(b='a href=""'),d.replaceSelection("<"+b+">"+d.getSelection()+"</"+a+">","around"),"a"==a&&d.setCursor({line:d.getCursor("start").line,ch:d.getCursor("start").ch+9}))},addLineBreakAtEnd:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();
|
||||
b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||(a=b.getCursor().line);b.replaceRange(b.getLine(a)+"<br>",{line:a,ch:0},{line:a,ch:1E6})},insertLineBefore:function(a){var b,c,d;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||(a=d.getCursor().line);d.operation(function(){d.replaceRange("\n"+d.getLine(a),{line:a,ch:0},{line:a,ch:1E6});d.setCursor({line:d.getCursor().line-1,ch:0});d.execCommand("indentAuto")})},insertLineAfter:function(a){var b,
|
||||
c,d;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||(a=d.getCursor().line);d.operation(function(){d.replaceRange(d.getLine(a)+"\n",{line:a,ch:0},{line:a,ch:1E6});d.execCommand("indentAuto")})},duplicateLines:function(a){var b,c,d;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;!a&&b.somethingSelected()?(c=b.getCursor("start"),d=b.getCursor("end"),a=c.line!=d.line&&
|
||||
d.ch==b.getLine(d.line).length?"\n":"",b.replaceSelection(b.getSelection()+a+b.getSelection(),"end"),b.setSelection(c,d)):(a||(a=b.getCursor().line),c=b.getCursor().ch,b.replaceRange(b.getLine(a)+"\n"+b.getLine(a),{line:a,ch:0},{line:a,ch:1E6}),b.setCursor(a+1,c))},removeLines:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;!a&&b.somethingSelected()?b.replaceSelection("","end"):(a||(a=b.getCursor().line),c=b.getCursor().ch,
|
||||
b.execCommand("deleteLine"),b.setCursor(a-1,c))},jumpToDefinition:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getTokenAt(a.getCursor()).string;if(a.somethingSelected()&&top.ICEcoder.origCurorPos)a.setCursor(top.ICEcoder.origCurorPos);else for(top.ICEcoder.origCurorPos=a.getCursor(),a=["var "+b,"function "+b,b+"=function",b+"= function",b+" =function",b+" = function",b+"=new function",b+"= new function",
|
||||
b+" =new function",b+" = new function","window['"+b+"']",'window["'+b+'"]',"this['"+b+"']",'this["'+b+'"]',b+":",b+" :","def "+b,"class "+b],b=0;b<a.length&&!top.ICEcoder.findReplace(a[b],!1,!1);b++);},autocomplete:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.content.contentWindow.CodeMirror.commands.autocomplete(a)},pasteURL:function(a){var b,c;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();
|
||||
b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;"CTRL"==top.ICEcoder.draggingWithKey&&(a=window.location.protocol+"//"+window.location.hostname+a);b.replaceSelection(a,"around")},searchForSelected:function(){var a,b;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.caretLocType&&(""!=a.getSelection()?(b=top.ICEcoder.caretLocType.toLowerCase()+" ","Content"==top.ICEcoder.caretLocType&&(b=""),window.open("http://www.google.com/#output=search&q="+
|
||||
b+a.getSelection())):top.ICEcoder.message(top.t["No text selected..."]))},fmAction:function(a,b){var c,d,f,e;c=top.get("filesFrame").contentWindow.document.getElementById(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1]+"_perms").parentNode;d=c.parentNode;f=-1<c.onmouseover.toString().indexOf("'folder'")?"folder":"file";e=!1;"up"==b&&(d.previousSibling&&d.previousSibling.previousSibling?(e=d.previousSibling.previousSibling,"UL"==e.tagName&&(e=e.childNodes[e.childNodes.length-1])):d.parentNode.previousSibling&&
|
||||
(e=d.parentNode.previousSibling),e&&(e=e.childNodes[0]));"down"==b&&(d.nextSibling&&d.nextSibling.childNodes[0]?e=d.nextSibling.childNodes[0]:d.nextSibling&&d.nextSibling.nextSibling?e=d.nextSibling.nextSibling:d.parentNode.nextSibling&&(e=d.parentNode.nextSibling.nextSibling),e&&(e=e.childNodes[0]));"left"==b&&"folder"==f&&d.parentNode.previousSibling&&top.ICEcoder.openCloseDir(c,!1);if("right"==b||"enter"==b)"folder"==f?top.ICEcoder.openCloseDir(c,!0):top.ICEcoder.openFile(c.childNodes[1].id.replace(/\|/g,
|
||||
"/"));e&&e.childNodes[1]&&(top.ICEcoder.overFileFolder(f,e.childNodes[1].id),top.ICEcoder.selectFileFolder(a))},openCloseDir:function(a,b){var c,d;a.onclick=function(a){a.ctrlKey||top.ICEcoder.cmdKey||top.ICEcoder.openCloseDir(this,!b)};c=a.parentNode;c.nextSibling&&(c=c.nextSibling);c&&"UL"==c.tagName&&((d="none"==c.style.display)?b=!0:c.style.display="none",a.parentNode.className=a.className=d?"pft-directory dirOpen":"pft-directory");b?top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href=
|
||||
"lib/get-branch.php?location="+a.childNodes[1].id+"&csrf="+top.ICEcoder.csrf:"UL"==c.tagName&&c.parentNode.removeChild(c);return!1},overFileFolder:function(a,b){ICEcoder.thisFileFolderType=a;ICEcoder.thisFileFolderLink=b},selectFileFolder:function(a,b){var c,d,f,e,g,k;if(""==top.ICEcoder.thisFileFolderLink)b||a.ctrlKey||top.ICEcoder.cmdKey||top.ICEcoder.deselectAllFiles();else if(top.ICEcoder.thisFileFolderLink)if(d=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),c=ICEcoder.filesFrame.contentWindow.document.getElementById(d),
|
||||
b||a.ctrlKey||top.ICEcoder.cmdKey)-1<top.ICEcoder.selectedFiles.indexOf(d)?(ICEcoder.selectDeselectFile("deselect",c),top.ICEcoder.selectedFiles.splice(top.ICEcoder.selectedFiles.indexOf(d),1)):(ICEcoder.selectDeselectFile("select",c),top.ICEcoder.selectedFiles.push(d));else if(a.shiftKey){var h=function(a,b,c,d){return("00000000000000000000"+a).substr(-20)};f=!1;e=c.parentNode.parentNode.parentNode;g=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1];k=d.replace(/\d+/g,h)<g.replace(/\d+/g,
|
||||
h)?d:g;g=d.replace(/\d+/g,h)>g.replace(/\d+/g,h)?d:g;if(0<top.ICEcoder.selectedFiles.length&&k.substr(0,k.lastIndexOf("|"))==g.substr(0,g.lastIndexOf("|")))for(d=0;1E6>d&&("LI"!=e.childNodes[d].nodeName&&d++,c=e.childNodes[d].childNodes[0].childNodes[1],c.id==k&&(f=!0),1==f&&-1==top.ICEcoder.selectedFiles.indexOf(c.id)&&(ICEcoder.selectDeselectFile("select",c),top.ICEcoder.selectedFiles.push(c.id)),c.id!=g);d+=2);else ICEcoder.selectDeselectFile("select",c),top.ICEcoder.selectedFiles.push(d)}else top.ICEcoder.deselectAllFiles(),
|
||||
ICEcoder.selectDeselectFile("select",c),top.ICEcoder.selectedFiles.push(d);top.ICEcoder.githubDiff&&(top.get("githubNavSelectedCount").innerHTML="Selected: "+top.ICEcoder.selectedFiles.length,top.get("githubNavCommit").style.color=0<top.ICEcoder.selectedFiles.length?"#fff":"#333",top.get("githubNavCommit").style.background=0<top.ICEcoder.selectedFiles.length?"#2187e7":"#555",top.get("githubNavSelectedCount").style.color=0<top.ICEcoder.selectedFiles.length?"#fff":"#333",top.get("githubNavPull").style.color=
|
||||
0<top.ICEcoder.selectedFiles.length?"#fff":"#333",top.get("githubNavPull").style.background=0<top.ICEcoder.selectedFiles.length?"#2187e7":"#555");document.findAndReplace.target[2].innerHTML=top.ICEcoder.selectedFiles[0]?top.t["selected files"]:top.t["all files"];document.findAndReplace.target[3].innerHTML=top.ICEcoder.selectedFiles[0]?top.t["selected filenames"]:top.t["all filenames"];top.ICEcoder.hideFileMenu()},deselectAllFiles:function(){for(var a,b=0;b<top.ICEcoder.selectedFiles.length;b++)a=
|
||||
top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.selectedFiles[b]),ICEcoder.selectDeselectFile("deselect",a);top.ICEcoder.selectedFiles.length=0},selectDeselectFile:function(a,b){var c;b&&(c=-1<top.ICEcoder.openFiles.indexOf(b.id.replace(/\|/g,"/"))?!0:!1,top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]==b.id.replace(/\|/g,"/")?b.style.backgroundColor="select"==a?top.ICEcoder.tabBGselected:top.ICEcoder.tabBGcurrent:b.style.backgroundColor="select"==a?top.ICEcoder.tabBGselected:
|
||||
b.style.backgroundColor=c?top.ICEcoder.tabBGopen:top.ICEcoder.tabBGnormal,b.style.color="select"==a?top.ICEcoder.tabFGselected:top.ICEcoder.tabFGnormalFile)},newFile:function(){top.ICEcoder.newTab();top.ICEcoder.saveFile()},newFolder:function(){var a,b;a=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/");if(b=top.ICEcoder.getInput("Enter new folder name at "+a,""))b=(a+"/"+b).replace(/\/\//,"/"),top.ICEcoder.serverQueue("add","lib/file-control.php?action=newFolder&file="+
|
||||
b.replace(/\//g,"|")+"&csrf="+top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+top.t["Creating Folder"]+"</b><br>"+b)},openFile:function(a){var b;a&&(top.ICEcoder.thisFileFolderLink=a,top.ICEcoder.thisFileFolderType="file");"/[NEW]"!=top.ICEcoder.thisFileFolderLink&&!1!==top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)?top.ICEcoder.switchTab(top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)+1):""!=top.ICEcoder.thisFileFolderLink&&"file"==top.ICEcoder.thisFileFolderType&&(a=top.ICEcoder.thisFileFolderLink.replace(/\|/g,
|
||||
"/"),b=!0,100<=top.ICEcoder.openFiles.length&&(top.ICEcoder.message(top.t["Sorry you can..."]),b=!1),b&&(top.ICEcoder.shortURL=a,"/[NEW]"!=a?(top.ICEcoder.thisFileFolderLink=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),top.ICEcoder.serverQueue("add","lib/file-control.php?action=load&file="+top.ICEcoder.thisFileFolderLink+"&csrf="+top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+top.t["Opening File"]+"</b><br>"+top.ICEcoder.shortURL)):top.ICEcoder.createNewTab(),top.ICEcoder.fMIconVis("fMView",
|
||||
1)))},openFilesFromList:function(a){for(var b=0;b<a.length;b++)top.ICEcoder.thisFileFolderLink=a[b].replace("|","/"),top.ICEcoder.thisFileFolderType="file",top.ICEcoder.openFile()},openPrompt:function(){var a;if(a=top.ICEcoder.getInput(top.t["Enter relative file..."],""))-1<a.indexOf("://")?top.ICEcoder.getRemoteFile(a):top.ICEcoder.openFile(a)},getRemoteFile:function(a){top.ICEcoder.serverQueue("add","lib/file-control.php?action=getRemoteFile&file="+a+"&csrf="+top.ICEcoder.csrf);top.ICEcoder.serverMessage("<b>"+
|
||||
top.t.Getting+"</b><br>"+a)},saveFile:function(a){var b,c;a=a?"saveAs":"save";b=ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|");"|[NEW]"==b&&0<top.ICEcoder.selectedFiles.length&&(c=top.ICEcoder.selectedFiles[0],b=-1==c.lastIndexOf(".")||c.lastIndexOf(".")<c.lastIndexOf("|")?c+b:"|[NEW]");b=b.replace("||","|");top.ICEcoder.serverQueue("add","lib/file-control.php?action=save&file="+b+"&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&saveType="+a+"&csrf="+
|
||||
top.ICEcoder.csrf);top.ICEcoder.serverMessage("<b>"+top.t.Saving+"</b><br>"+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,""))},renameFile:function(a,b){var c,d;a?c=a.replace(/\|/g,"/"):(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));b&&(d=top.ICEcoder.openFiles.indexOf(c.replace(/\|/g,"/")),-1<d&&
|
||||
(top.ICEcoder.openFiles[d]=b,closeTabLink='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a>',c=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.php?action=rename&file="+b+"&oldFileName="+a.replace(/\|/g,"/")+"&csrf="+top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+top.t["Renaming to"]+"</b><br>"+b),top.ICEcoder.setPreviousFiles())},moveFile:function(a,b){var c,d;b&&(d=top.ICEcoder.openFiles.indexOf(a.replace(/\|/g,"/")),-1<d&&(top.ICEcoder.openFiles[d]=b,closeTabLink='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a>',
|
||||
c=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.php?action=move&file="+b+"&oldFileName="+a.replace(/\|/g,"/")+"&csrf="+top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+top.t["Moving to"]+"</b><br>"+b),top.ICEcoder.setPreviousFiles())},deleteFiles:function(a){var b;a=a?a:top.ICEcoder.selectedFiles;b=a.toString().replace(/\|/g,"/").replace(/,/g,"\n");
|
||||
0<a.length&&top.ICEcoder.ask("Delete:\n\n"+b+"?")&&(top.ICEcoder.serverQueue("add","lib/file-control.php?action=delete&file="+a.join(";")+"&csrf="+top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+top.t["Deleting File"]+"</b><br>"+b))},copyFiles:function(a,b,c){top.ICEcoder.copiedFiles=[];for(var d=0;d<a.length;d++)top.ICEcoder.copiedFiles[d]=a[d];b||(top.get("fmMenuPasteOption").style.display="block");c||top.ICEcoder.hideFileMenu()},pasteFiles:function(a){if(top.ICEcoder.copiedFiles)for(var b=
|
||||
0;b<top.ICEcoder.copiedFiles.length;b++)"|"!=top.ICEcoder.copiedFiles[b]?(top.ICEcoder.serverQueue("add","lib/file-control.php?action=paste&file="+top.ICEcoder.copiedFiles[b]+"&location="+a+"&csrf="+top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+top.t["Pasting File"]+"</b><br>"+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){var b;
|
||||
top.ICEcoder.copiedFiles&&(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","optionsRemote","optionsHelp"];if("hide"==a)fileNavInt=setTimeout(function(){for(var a=0;a<c.length;a++)top.ICEcoder.showHide("hide",top.get(c[a])),top.get(c[a]+"Nav").style.color=""},150);else for(var d=0;d<c.length;d++)top.ICEcoder.showHide("hide",top.get(c[d])),top.get(c[d]+"Nav").style.color="";get("fileOptions").style.opacity=0;"show"==a&&("undefined"!=typeof fileNavInt&&clearTimeout(fileNavInt),top.ICEcoder.showHide(a,top.get(b)),top.get(b+"Nav").style.color=
|
||||
"#fff",get("fileOptions").style.opacity=1)},showMenu:function(a){var b,c;0!=top.ICEcoder.selectedFiles.length&&-1!=top.ICEcoder.selectedFiles.indexOf(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\//g,"|"))||top.ICEcoder.selectFileFolder(a);a=129;c=window.innerHeight;"undefined"!=typeof top.ICEcoder.thisFileFolderLink&&""!=top.ICEcoder.thisFileFolderLink&&(b=-1<top.ICEcoder.selectedFiles[0].indexOf(".")?"file":"folder",top.get("folderMenuItems").style.display="folder"==
|
||||
b&&1==top.ICEcoder.selectedFiles.length?"block":"none","folder"==b&&1==top.ICEcoder.selectedFiles.length&&(a+=67,"block"==top.get("fmMenuPasteOption").style.display&&(a+=19)),top.get("singleFileMenuItems").style.display=1<top.ICEcoder.selectedFiles.length?"none":"block",1==top.ICEcoder.selectedFiles.length&&(a+=43),top.get("fileMenu").style.display="inline-block",setTimeout(function(){top.get("fileMenu").style.opacity="1"},4),top.get("fileMenu").style.left=top.ICEcoder.mouseX+20+"px",b=top.ICEcoder.mouseY-
|
||||
top.ICEcoder.filesFrame.contentWindow.document.body.scrollTop-10,b+a>c&&(b-=b+a-c),top.get("fileMenu").style.top=b+"px");return!1},showFileMenu:function(){top.get("fileMenu").style.display="inline-block";setTimeout(function(){top.get("fileMenu").style.opacity="1"},4)},hideFileMenu:function(){top.get("fileMenu").style.display="none";top.get("fileMenu").style.opacity="0"},updateFileManagerList:function(a,b,c,d,f,e,g){var k,h,l,n,p,m,r;if("add"==a&&!top.get("filesFrame").contentWindow.document.getElementById(b.replace(top.iceRoot,
|
||||
"").replace(/\/$/,"").replace(/\//g,"|")+"|"+c)){k="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?664:705;b||(b="/");b=b.replace(top.iceRoot,"/");b=b.replace("//","/");h=top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));l=h.parentNode.parentNode.nextSibling;n=document.createTextNode("\n");p=777==d?"background: #800; color: #eee":"color: #888";p='<a nohref title="'+b.replace(/\/$/,"")+"/"+c+'" onMouseOver="top.ICEcoder.overFileFolder(\''+
|
||||
g+"',this.childNodes[1].id)\" onMouseOut=\"top.ICEcoder.overFileFolder('"+g+"','')\" onClick=\"if(!event.ctrlKey && !top.ICEcoder.cmdKey) {top.ICEcoder.openCloseDir(this,"+("folder"==g?"true":"false")+'); if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {top.ICEcoder.openFile()}}" style="position: relative; left:-22px"> <span id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'">'+c+'</span> <span style="'+p+'; font-size: 8px" id="'+
|
||||
b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'_perms">'+d+"</span></a>";if(3>l.childNodes.length)m=document.createElement("ul"),l=h.parentNode.parentNode,l.parentNode.insertBefore(m,l.nextSibling),m=document.createElement("li"),m.className=k,m.draggable=!0,m.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())},m.ondragend=function(){top.ICEcoder.dropFile(this)},
|
||||
m.innerHTML=p,l.nextSibling.appendChild(m),l.nextSibling.appendChild(n);else for(h=0;h<l.childNodes.length;h++)if(l.childNodes[h].className&&(m=0<l.childNodes[h].className.indexOf("directory")?"folder":"file",r=l.childNodes[h].getElementsByTagName("span")[0].innerHTML,m==g&&r>c||"folder"==g&&"file"==m||h==l.childNodes.length-1)){m=document.createElement("li");m.className=k;m.draggable=!0;m.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?
|
||||
top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())};m.ondragend=function(){top.ICEcoder.dropFile(this)};m.innerHTML=p;h==l.childNodes.length-1?(l.appendChild(m),l.appendChild(n)):(l.insertBefore(m,l.childNodes[h]),l.insertBefore(n,l.childNodes[h+1]));break}"file"!=g||e||(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]=b+c)}"rename"==a&&(e=f.replace(/\//g,"|"),h=top.get("filesFrame").contentWindow.document.getElementById(e),h.innerHTML=c,h.id=b.replace(/\//g,"|")+"|"+
|
||||
c,h.parentNode.title=h.id.replace(/\|/g,"/"),targetElemPerms=top.get("filesFrame").contentWindow.document.getElementById(e+"_perms"),targetElemPerms.id=b.replace(/\//g,"|")+"|"+c+"_perms");"move"==a&&(top.ICEcoder.updateFileManagerList("add",b,c,!1,!1,!1,g),top.ICEcoder.updateFileManagerList("delete",f.substr(0,f.lastIndexOf("/")),c));"chmod"==a&&(e=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"),h=top.get("filesFrame").contentWindow.document.getElementById(e.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))},refreshFileManager:function(){top.ICEcoder.showHide("show",top.get("loadingMask"));top.ICEcoder.filesFrame.contentWindow.location.reload(!0);
|
||||
top.ICEcoder.filesFrame.style.opacity="0";top.ICEcoder.filesFrame.onload=function(){top.ICEcoder.filesFrame.style.opacity="1";top.ICEcoder.showHide("hide",top.get("loadingMask"))}},draggingWithKeyTest:function(a){var b;b=a.keyCode?a.keyCode:a.which?a.which:a.charCode;if(224==b||91==b||93==b)top.ICEcoder.cmdKey=!0;top.ICEcoder.draggingWithKey=a.ctrlKey||top.ICEcoder.cmdKey?"CTRL":!1},dropFile:function(a){var b,c;b=a.childNodes[0].childNodes[1].id.replace(/\|/g,"/");fileName=b.substr(b.lastIndexOf("/")+
|
||||
1);"editor"==top.ICEcoder.area&&top.ICEcoder.pasteURL(b);"files"==top.ICEcoder.area&&setTimeout(function(){c="folder"==ICEcoder.thisFileFolderType?ICEcoder.thisFileFolderLink:ICEcoder.thisFileFolderLink.substr(0,ICEcoder.thisFileFolderLink.lastIndexOf("|"));"CTRL"==top.ICEcoder.draggingWithKey?(top.ICEcoder.copyFiles(top.ICEcoder.selectedFiles),top.ICEcoder.pasteFiles(c)):top.ICEcoder.moveFile(b,c.replace(/\|/g,"/")+"/"+fileName)},4);top.ICEcoder.mouseDown=!1},findReplaceOptions:function(){top.get("rText").style.display=
|
||||
top.get("replace").style.display=top.get("rTarget").style.display=document.findAndReplace.connector.value==top.t.and?"inline-block":"none"},findReplace:function(a,b,c){var d,f,e,g;a=a.toLowerCase();d=top.get("replace").value;f=top.get("results");e=ICEcoder.getcMInstance();g=ICEcoder.getcMdiffInstance();if((e=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?g:e)&&0<a.length&&document.findAndReplace.target.value==top.t["this document"]){e.getValue().toLowerCase();document.findAndReplace.connector.value==
|
||||
top.t.and&&c&&(document.findAndReplace.replaceAction.value==top.t.replace&&e.getSelection().toLowerCase()==a?e.replaceSelection(d,"around"):document.findAndReplace.replaceAction.value==top.t["replace all"]&&(c=new RegExp(a,"gi"),e.setValue(e.getValue().replace(c,d))));c=e.getValue().toLowerCase();if(!top.ICEcoder.findMode||a!=top.ICEcoder.lastsearch){ICEcoder.results=[];ICEcoder.resultsLines=[];for(d=0;d<c.length;d++)c.substr(d,a.length)==a&&-1==ICEcoder.results.indexOf(d)&&(ICEcoder.results.push(d),
|
||||
-1==ICEcoder.resultsLines.indexOf(e.posFromIndex(d).line+1)&&ICEcoder.resultsLines.push(e.posFromIndex(d).line+1));ICEcoder.lastsearch=a}if(0<ICEcoder.results.length){if(b)f.innerHTML=ICEcoder.results.length+" results";else{for(d=ICEcoder.findResult=0;d<ICEcoder.results.length;d++)ICEcoder.results[d]<e.indexFromPos(e.getCursor())&&ICEcoder.findResult++;ICEcoder.findResult>ICEcoder.results.length-1&&(ICEcoder.findResult=0);f.innerHTML="Highlighted result "+(ICEcoder.findResult+1)+" of "+ICEcoder.results.length+
|
||||
" results";b=e.getSearchCursor(a,e.getCursor(),!0);b.findNext();b.from()||(b=e.getSearchCursor(a,{line:0,ch:0},!0),b.findNext());e.setSelection(b.from(),b.to());top.ICEcoder.focus();top.ICEcoder.findMode=!0}a=top.ICEcoder.scrollBarVisible?parseInt(top.ICEcoder.content.style.height,10)/e.lineCount():e.defaultTextHeight();b=top.ICEcoder.scrollBarVisible?0:e.heightAtLine(0);f="";for(d=1;d<=e.lineCount();d++)c=-1<ICEcoder.resultsLines.indexOf(d)?e.getCursor().line+1==d?"#b00":"#888":"transparent",f+=
|
||||
'<div style="position: absolute; display: block; width: 5px; height:'+a+"px; background: "+c+"; top: "+parseInt(a*(d-1)+b,10)+'px"></div>';top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML=f;top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="inline-block";return!0}f.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?(f=b=e="",document.findAndReplace.connector.value==top.t.and&&(e="&replace="+d),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"]&&(f="&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='<iframe src="lib/multiple-results.php?find='+a+e+b+f+"&csrf="+top.ICEcoder.csrf+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>'):(f.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.php?action=replaceText&fileRef="+
|
||||
a.replace(/\//g,"|")+"&find="+b+"&replace="+c+"&csrf="+top.ICEcoder.csrf);top.ICEcoder.serverMessage("<b>"+top.t["Replacing text in"]+"</b><br>"+a)},getCaretPosition:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getCursor().line;c=a.getCursor().ch;for(var f=d=0;f<b;f++)d+=a.getLine(f).length+1;ICEcoder.caretPos=d+c-1},updateCharDisplay:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();
|
||||
a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;ICEcoder.caretLocationType();ICEcoder.charDisplay.innerHTML=ICEcoder.caretLocType+", Line: "+(a.getCursor().line+1)+", Char: "+a.getCursor().ch},updateByteDisplay:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;ICEcoder.byteDisplay.innerHTML=a.getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" bytes"},showDisplay:function(a){top.ICEcoder.byteDisplay.style.display=
|
||||
"byte"==a?"inline-block":"none";top.ICEcoder.charDisplay.style.display="char"==a?"inline-block":"none"},showHide:function(a,b){b.style.visibility="show"==a?"visible":"hidden"},getcMInstance:function(a){return top.ICEcoder.content.contentWindow[isNaN(a)?"new"==a||"new"!=a&&0<ICEcoder.openFiles.length?"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1":"cM"+ICEcoder.cMInstances[a-1]]},getcMdiffInstance:function(a){return top.ICEcoder.content.contentWindow[(isNaN(a)?"new"==a||"new"!=a&&0<ICEcoder.openFiles.length?
|
||||
"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1":"cM"+ICEcoder.cMInstances[a-1])+"diff"]},getMouseXY:function(a,b){top.ICEcoder.mouseX=a.pageX?a.pageX:a.clientX+document.body.scrollLeft;top.ICEcoder.mouseY=a.pageY?a.pageY:a.clientY+document.body.scrollTop;top.ICEcoder.area=b;"top"!=b&&(top.ICEcoder.mouseY+=70);"editor"==b&&(top.ICEcoder.mouseX+=top.ICEcoder.filesW);top.ICEcoder.dragCursorTest();62<top.ICEcoder.mouseY&&top.ICEcoder.setTabWidths()},dragCursorTest:function(){var a,b;a=top.ICEcoder.mouseX-
|
||||
top.ICEcoder.diffStartX;!1!==top.ICEcoder.draggingTab&&top.ICEcoder.diffStartX&&(-10>=a||10<=a)&&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),a=!ICEcoder.draggingTab&&(top.ICEcoder.mouseX>top.ICEcoder.filesW-7&&top.ICEcoder.mouseX<top.ICEcoder.filesW+
|
||||
7||top.ICEcoder.draggingFilesW)?"w-resize":"auto",top.ICEcoder.content.contentWindow.document&&top.ICEcoder.filesFrame.contentWindow)){top.document.body.style.cursor=a;if(b=top.ICEcoder.content.contentWindow.document.body)b.style.cursor=a;if(b=top.ICEcoder.filesFrame.contentWindow.document.body)b.style.cursor=a}},serverMessage:function(a){var b;b=top.get("serverMessage");a?(b.innerHTML=top.ICEcoder.xssClean(a).replace(/\<b\>/g,"<b>").replace(/\<\/b\>/g,"</b>").replace(/\<br\>/g,
|
||||
"<br>"),b.style.left="0"):setTimeout(function(){b.style.left="2000px"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();if(a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a){b=a.getLine(a.getCursor().line);for(c=/(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi;(d=c.exec(b))&&a.getCursor().ch>d.index+d[0].length;);(b=top.get("content").contentWindow.document.getElementById("cssColor"))&&
|
||||
b.parentNode.removeChild(b);top.ICEcoder.codeAssist&&"CSS"==top.ICEcoder.caretLocType&&(b=top.document.createElement("div"),b.id="cssColor",b.style.position="absolute",b.style.display="block",b.style.width=b.style.height="20px",b.style.zIndex="1000",b.style.background=d?d[0]:"",b.style.cursor="pointer",b.onclick=function(){top.ICEcoder.showColorPicker(d[0])},""==b.style.backgroundColor&&(b.style.display="none"),top.get("header").appendChild(b),a.addWidget(a.getCursor(),top.get("cssColor"),!0))}},
|
||||
showColorPicker:function(a){top.get("blackMask").style.visibility="visible";top.get("mediaContainer").innerHTML='<div id="picker" class="picker"></div><br><br><input type="text" id="color" name="color" value="#000" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'color\').value)" value="insert >" class="insertColorValue"><br><input type="text" id="colorRGB" name="colorRGB" value="rgb(0,0,0)" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'colorRGB\').value)" value="insert >" class="insertColorValue">';
|
||||
ch:0},{line:c,ch:1E6});setTimeout(function(){for(var c,f=0;f<top.ICEcoder.renderLineStyle.length;f++){c=!1;if("diff"!=top.ICEcoder.renderLineStyle[f][0]&&-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[f][0]&&-1<b.indexOf("diff"))c=!0;c&&a.getCursor().line+1==top.ICEcoder.renderLineStyle[f][1]?a.setOption("cursorHeight",a.defaultTextHeight()/a.lineInfo(a.getCursor().line).handle.height):a.setOption("cursorHeight",1)}},0)},cMonChange:function(a,b,c){var d,f;top.ICEcoder.loadingFile||top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);
|
||||
setTimeout(function(){top.ICEcoder.scrollBarVisible=a.getScrollInfo().height>a.getScrollInfo().clientHeight;top.ICEcoder.setLayout()},0);top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay();top.ICEcoder.updateNestingIndicator();top.ICEcoder.findMode&&(top.ICEcoder.results.splice(top.ICEcoder.findResult,1),top.get("results").innerHTML=top.ICEcoder.results.length+" "+top.t.results,top.ICEcoder.findMode=!1);if(b=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-
|
||||
1]){d=b.substr(b.lastIndexOf("/")+1);f=d.substr(d.lastIndexOf(".")+1);for(var e=c.from.line;e<c.from.line+c.text.length;e++)top.ICEcoder.content.contentWindow.CodeMirror.doFold(-1<a.getLine(e).indexOf("{")?"brace":"xml",null,"+","-",!0)(a,e);if("}"==c.text[0]||c.removed&&"}"==c.removed[0])for(cursor=a.getSearchCursor("{",a.getCursor(),!1),cursor.findPrevious(),e=cursor.from().line;e<a.getCursor().line;e++)top.ICEcoder.content.contentWindow.CodeMirror.doFold(-1<a.getLine(e).indexOf("{")?"brace":"xml",
|
||||
null,"+","-",!0)(a,e)}top.ICEcoder.splitPane&&top.ICEcoder.updateDiffs();b&&top.ICEcoder.previewWindow.location&&top.ICEcoder.updatePreviewWindow(a,b,d,f);top.ICEcoder.indicateChanges()},cMonScroll:function(a,b){var c,d;c=top.ICEcoder.getcMInstance();d=top.ICEcoder.getcMdiffInstance();c=-1<b.indexOf("diff")?c:d;top.ICEcoder.mouseDown=!1;c.scrollTo(a.getScrollInfo().left,a.getScrollInfo().top)},cMonInputRead:function(a,b){"keypress"==top.ICEcoder.autoComplete&&top.ICEcoder.codeAssist&&(clearTimeout(top.ICEcoder.debounce),
|
||||
a.state.completionActive||(top.ICEcoder.debounce=setTimeout(function(){CodeMirror.commands.autocomplete(a)},200)))},cMonRenderLine:function(a,b,c,d){for(var f,e=0;e<top.ICEcoder.renderLineStyle.length;e++){f=!1;if("diff"!=top.ICEcoder.renderLineStyle[e][0]&&-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[e][0]&&-1<b.indexOf("diff"))f=!0;f&&a.lineInfo(c).line+1==top.ICEcoder.renderLineStyle[e][1]&&(d.style[top.ICEcoder.renderLineStyle[e][2]]=top.ICEcoder.renderLineStyle[e][3])}},updateDiffs:function(){var a,
|
||||
b,c,d,f;top.ICEcoder.renderLineStyle=[];top.ICEcoder.renderPaneShiftAmount=0;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();c=difflib.stringAsLines(a.getValue());d=difflib.stringAsLines(b.getValue());c=(new difflib.SequenceMatcher(c,d)).get_opcodes();f=a.getAllMarks();for(d=0;d<f.length;d++)f[d].clear();f=b.getAllMarks();for(d=0;d<f.length;d++)f[d].clear();for(d=0;d<c.length;d++)if("equal"!==c[d][0]){if("replace"==c[d][0]){f=(c[d][4]-c[d][2]+1+top.ICEcoder.renderPaneShiftAmount)*
|
||||
a.defaultTextHeight();f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["main",c[d][2],"height",f+"px"]);for(var 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])for(f=(c[d][2]-c[d][4]+1-top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight(),
|
||||
f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",f+"px"]),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,f=b.length;a[c]&&a[c]==b[c];c++);for(;d>c&f>c&a[d-1]==b[f-1];d--)f--;return[c,d-c,f-c]},updatePreviewWindow:function(a,b,c,d){top.ICEcoder.previewWindow.location.pathname==b?-1<["htm","html","txt"].indexOf(d)?top.ICEcoder.previewWindow.document.documentElement.innerHTML=a.getValue():-1<["md"].indexOf(d)&&(top.ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(a.getValue())):-1<["css"].indexOf(d)&&-1<top.ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(c)&&
|
||||
(a=a.getValue(),c=document.createElement("style"),c.type="text/css",c.id="ICEcoder"+b.replace(/\//g,"_"),c.styleSheet?c.styleSheet.cssText=a:c.appendChild(document.createTextNode(a)),top.ICEcoder.previewWindow.document.getElementById(c.id)&&top.ICEcoder.previewWindow.document.documentElement.removeChild(top.ICEcoder.previewWindow.document.getElementById(c.id)),top.ICEcoder.previewWindow.document.documentElement.appendChild(c));try{top.ICEcoder.doPesticide()}catch(f){}try{top.ICEcoder.doStatsJS("update")}catch(e){}},
|
||||
contentCleanUp:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getValue();b=b.replace(/<ICEcoder:\/:textarea>/g,"</textarea>");a.setValue(b);a.clearHistory();top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1]=a.changeGeneration()},undo:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a).undo()},redo:function(){var a,b;a=ICEcoder.getcMInstance();
|
||||
b=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a).redo()},indent:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;"more"==a?top.ICEcoder.content.contentWindow.CodeMirror.commands.indentMore(b):top.ICEcoder.content.contentWindow.CodeMirror.commands.indentLess(b)},moveLines:function(a){var b,c,d,f,e,g,k;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?
|
||||
c:b;f=d.getCursor("start");e=d.getCursor("end");"up"==a&&0<f.line&&(g=f.line-1);"down"==a&&e.line<d.lineCount()-1&&(g=e.line+1);isNaN(g)||(k=d.getLine(g),d.operation(function(){if("up"==a)for(var b=f.line;b<=e.line;b++)d.replaceRange(d.getLine(b),{line:b-1,ch:0},{line:b-1,ch:1E6});else for(b=e.line;b>=f.line;b--)d.replaceRange(d.getLine(b),{line:b+1,ch:0},{line:b+1,ch:1E6});d.replaceRange(k,{line:"up"==a?e.line:f.line,ch:0},{line:"up"==a?e.line:f.line,ch:1E6});d.setSelection({line:f.line+("up"==a?
|
||||
-1:1),ch:f.ch},{line:e.line+("up"==a?-1:1),ch:e.ch})}))},highlightLine:function(a){var b,c;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;b.setSelection({line:a,ch:0},{line:a,ch:b.lineInfo(a).text.length})},focus:function(a){var b,c;/iPhone|iPad|iPod/i.test(navigator.userAgent)||(b=top.ICEcoder.getcMInstance(),c=top.ICEcoder.getcMdiffInstance(),(a=a?c:b)&&a.focus())},goToLine:function(a){var b,c;b=ICEcoder.getcMInstance();
|
||||
c=ICEcoder.getcMdiffInstance();(-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b).setCursor(a?a-1:top.get("goToLineNo").value-1);top.ICEcoder.focus();return!1},lineCommentToggle:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getCursor().ch;c=a.getCursor().line;d=a.getLine(c);ICEcoder.lineCommentToggleSub(a,b,c,d,d.length,2)},tagWrapper:function(a){var b,c,d,f,e;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();
|
||||
d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;b=a;"div"==a?(f=d.getCursor("start").line,e=d.getCursor().line,d.operation(function(){d.replaceSelection("<div>\n"+d.getSelection()+"\n</div>","around");for(var a=f+1;a<=e+1;a++)d.indentLine(a);d.indentLine(e+2,"prev");d.indentLine(e+2,"subtract")})):-1<"p a b i strong em h1 h2 h3 li".split(" ").indexOf(a)&&d.getSelection().substr(0,a.length+1)=="<"+b&&d.getSelection().substr(-(a.length+3))=="</"+a+">"?d.replaceSelection(d.getSelection().substr(d.getSelection().indexOf(">")+
|
||||
1,d.getSelection().length-d.getSelection().indexOf(">")-1-a.length-3),"around"):("a"==a&&(b='a href=""'),d.replaceSelection("<"+b+">"+d.getSelection()+"</"+a+">","around"),"a"==a&&d.setCursor({line:d.getCursor("start").line,ch:d.getCursor("start").ch+9}))},addLineBreakAtEnd:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||(a=b.getCursor().line);b.replaceRange(b.getLine(a)+"<br>",{line:a,ch:0},{line:a,ch:1E6})},
|
||||
insertLineBefore:function(a){var b,c,d;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||(a=d.getCursor().line);d.operation(function(){d.replaceRange("\n"+d.getLine(a),{line:a,ch:0},{line:a,ch:1E6});d.setCursor({line:d.getCursor().line-1,ch:0});d.execCommand("indentAuto")})},insertLineAfter:function(a){var b,c,d;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;a||
|
||||
(a=d.getCursor().line);d.operation(function(){d.replaceRange(d.getLine(a)+"\n",{line:a,ch:0},{line:a,ch:1E6});d.execCommand("indentAuto")})},duplicateLines:function(a){var b,c,d;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;!a&&b.somethingSelected()?(c=b.getCursor("start"),d=b.getCursor("end"),a=c.line!=d.line&&d.ch==b.getLine(d.line).length?"\n":"",b.replaceSelection(b.getSelection()+a+b.getSelection(),"end"),b.setSelection(c,
|
||||
d)):(a||(a=b.getCursor().line),c=b.getCursor().ch,b.replaceRange(b.getLine(a)+"\n"+b.getLine(a),{line:a,ch:0},{line:a,ch:1E6}),b.setCursor(a+1,c))},removeLines:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;!a&&b.somethingSelected()?b.replaceSelection("","end"):(a||(a=b.getCursor().line),c=b.getCursor().ch,b.execCommand("deleteLine"),b.setCursor(a-1,c))},jumpToDefinition:function(){var a,b;a=ICEcoder.getcMInstance();
|
||||
b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getTokenAt(a.getCursor()).string;if(a.somethingSelected()&&top.ICEcoder.origCurorPos)a.setCursor(top.ICEcoder.origCurorPos);else for(top.ICEcoder.origCurorPos=a.getCursor(),a=["var "+b,"function "+b,b+"=function",b+"= function",b+" =function",b+" = function",b+"=new function",b+"= new function",b+" =new function",b+" = new function","window['"+b+"']",'window["'+b+'"]',"this['"+b+"']",'this["'+b+'"]',b+":",
|
||||
b+" :","def "+b,"class "+b],b=0;b<a.length&&!top.ICEcoder.findReplace(a[b],!1,!1);b++);},autocomplete:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.content.contentWindow.CodeMirror.commands.autocomplete(a)},pasteURL:function(a){var b,c;b=top.ICEcoder.getcMInstance();c=top.ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;"CTRL"==top.ICEcoder.draggingWithKey&&(a=
|
||||
window.location.protocol+"//"+window.location.hostname+a);b.replaceSelection(a,"around")},searchForSelected:function(){var a,b;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;top.ICEcoder.caretLocType&&(""!=a.getSelection()?(b=top.ICEcoder.caretLocType.toLowerCase()+" ","Content"==top.ICEcoder.caretLocType&&(b=""),window.open("http://www.google.com/#output=search&q="+b+a.getSelection())):top.ICEcoder.message(top.t["No text selected..."]))},
|
||||
fmAction:function(a,b){var c,d,f,e;c=top.get("filesFrame").contentWindow.document.getElementById(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1]+"_perms").parentNode;d=c.parentNode;f=-1<c.onmouseover.toString().indexOf("'folder'")?"folder":"file";e=!1;"up"==b&&(d.previousSibling&&d.previousSibling.previousSibling?(e=d.previousSibling.previousSibling,"UL"==e.tagName&&(e=e.childNodes[e.childNodes.length-1])):d.parentNode.previousSibling&&(e=d.parentNode.previousSibling),e&&(e=e.childNodes[0]));
|
||||
"down"==b&&(d.nextSibling&&d.nextSibling.childNodes[0]?e=d.nextSibling.childNodes[0]:d.nextSibling&&d.nextSibling.nextSibling?e=d.nextSibling.nextSibling:d.parentNode.nextSibling&&(e=d.parentNode.nextSibling.nextSibling),e&&(e=e.childNodes[0]));"left"==b&&"folder"==f&&d.parentNode.previousSibling&&top.ICEcoder.openCloseDir(c,!1);if("right"==b||"enter"==b)"folder"==f?top.ICEcoder.openCloseDir(c,!0):top.ICEcoder.openFile(c.childNodes[1].id.replace(/\|/g,"/"));e&&e.childNodes[1]&&(top.ICEcoder.overFileFolder(f,
|
||||
e.childNodes[1].id),top.ICEcoder.selectFileFolder(a))},openCloseDir:function(a,b){var c,d;a.onclick=function(a){a.ctrlKey||top.ICEcoder.cmdKey||top.ICEcoder.openCloseDir(this,!b)};c=a.parentNode;c.nextSibling&&(c=c.nextSibling);c&&"UL"==c.tagName&&((d="none"==c.style.display)?b=!0:c.style.display="none",a.parentNode.className=a.className=d?"pft-directory dirOpen":"pft-directory");b?top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="lib/get-branch.php?location="+a.childNodes[1].id+
|
||||
"&csrf="+top.ICEcoder.csrf:"UL"==c.tagName&&c.parentNode.removeChild(c);return!1},overFileFolder:function(a,b){ICEcoder.thisFileFolderType=a;ICEcoder.thisFileFolderLink=b},selectFileFolder:function(a,b){var c,d,f,e,g,k;if(""==top.ICEcoder.thisFileFolderLink)b||a.ctrlKey||top.ICEcoder.cmdKey||top.ICEcoder.deselectAllFiles();else if(top.ICEcoder.thisFileFolderLink)if(d=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),c=ICEcoder.filesFrame.contentWindow.document.getElementById(d),b||a.ctrlKey||top.ICEcoder.cmdKey)-1<
|
||||
top.ICEcoder.selectedFiles.indexOf(d)?(ICEcoder.selectDeselectFile("deselect",c),top.ICEcoder.selectedFiles.splice(top.ICEcoder.selectedFiles.indexOf(d),1)):(ICEcoder.selectDeselectFile("select",c),top.ICEcoder.selectedFiles.push(d));else if(a.shiftKey){var h=function(a,b,c,d){return("00000000000000000000"+a).substr(-20)};f=!1;e=c.parentNode.parentNode.parentNode;g=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1];k=d.replace(/\d+/g,h)<g.replace(/\d+/g,h)?d:g;g=d.replace(/\d+/g,h)>g.replace(/\d+/g,
|
||||
h)?d:g;if(0<top.ICEcoder.selectedFiles.length&&k.substr(0,k.lastIndexOf("|"))==g.substr(0,g.lastIndexOf("|")))for(d=0;1E6>d&&("LI"!=e.childNodes[d].nodeName&&d++,c=e.childNodes[d].childNodes[0].childNodes[1],c.id==k&&(f=!0),1==f&&-1==top.ICEcoder.selectedFiles.indexOf(c.id)&&(ICEcoder.selectDeselectFile("select",c),top.ICEcoder.selectedFiles.push(c.id)),c.id!=g);d+=2);else ICEcoder.selectDeselectFile("select",c),top.ICEcoder.selectedFiles.push(d)}else top.ICEcoder.deselectAllFiles(),ICEcoder.selectDeselectFile("select",
|
||||
c),top.ICEcoder.selectedFiles.push(d);top.ICEcoder.githubDiff&&(top.get("githubNavSelectedCount").innerHTML="Selected: "+top.ICEcoder.selectedFiles.length,top.get("githubNavCommit").style.color=0<top.ICEcoder.selectedFiles.length?"#fff":"#333",top.get("githubNavCommit").style.background=0<top.ICEcoder.selectedFiles.length?"#2187e7":"#555",top.get("githubNavSelectedCount").style.color=0<top.ICEcoder.selectedFiles.length?"#fff":"#333",top.get("githubNavPull").style.color=0<top.ICEcoder.selectedFiles.length?
|
||||
"#fff":"#333",top.get("githubNavPull").style.background=0<top.ICEcoder.selectedFiles.length?"#2187e7":"#555");document.findAndReplace.target[2].innerHTML=top.ICEcoder.selectedFiles[0]?top.t["selected files"]:top.t["all files"];document.findAndReplace.target[3].innerHTML=top.ICEcoder.selectedFiles[0]?top.t["selected filenames"]:top.t["all filenames"];top.ICEcoder.hideFileMenu()},deselectAllFiles:function(){for(var a,b=0;b<top.ICEcoder.selectedFiles.length;b++)a=top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.selectedFiles[b]),
|
||||
ICEcoder.selectDeselectFile("deselect",a);top.ICEcoder.selectedFiles.length=0},selectDeselectFile:function(a,b){var c;b&&(c=-1<top.ICEcoder.openFiles.indexOf(b.id.replace(/\|/g,"/"))?!0:!1,top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]==b.id.replace(/\|/g,"/")?b.style.backgroundColor="select"==a?top.ICEcoder.tabBGselected:top.ICEcoder.tabBGcurrent:b.style.backgroundColor="select"==a?top.ICEcoder.tabBGselected:b.style.backgroundColor=c?top.ICEcoder.tabBGopen:top.ICEcoder.tabBGnormal,b.style.color=
|
||||
"select"==a?top.ICEcoder.tabFGselected:top.ICEcoder.tabFGnormalFile)},newFile:function(){top.ICEcoder.newTab();top.ICEcoder.saveFile()},newFolder:function(){var a,b;a=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/");if(b=top.ICEcoder.getInput("Enter new folder name at "+a,""))b=(a+"/"+b).replace(/\/\//,"/"),top.ICEcoder.serverQueue("add","lib/file-control.php?action=newFolder&file="+b.replace(/\//g,"|")+"&csrf="+top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+
|
||||
top.t["Creating Folder"]+"</b><br>"+b)},openFile:function(a){var b;a&&(top.ICEcoder.thisFileFolderLink=a,top.ICEcoder.thisFileFolderType="file");"/[NEW]"!=top.ICEcoder.thisFileFolderLink&&!1!==top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)?top.ICEcoder.switchTab(top.ICEcoder.isOpen(top.ICEcoder.thisFileFolderLink)+1):""!=top.ICEcoder.thisFileFolderLink&&"file"==top.ICEcoder.thisFileFolderType&&(a=top.ICEcoder.thisFileFolderLink.replace(/\|/g,"/"),b=!0,100<=top.ICEcoder.openFiles.length&&(top.ICEcoder.message(top.t["Sorry you can..."]),
|
||||
b=!1),b&&(top.ICEcoder.shortURL=a,"/[NEW]"!=a?(top.ICEcoder.thisFileFolderLink=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),top.ICEcoder.serverQueue("add","lib/file-control.php?action=load&file="+top.ICEcoder.thisFileFolderLink+"&csrf="+top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+top.t["Opening File"]+"</b><br>"+top.ICEcoder.shortURL)):top.ICEcoder.createNewTab(),top.ICEcoder.fMIconVis("fMView",1)))},openFilesFromList:function(a){for(var b=0;b<a.length;b++)top.ICEcoder.thisFileFolderLink=
|
||||
a[b].replace("|","/"),top.ICEcoder.thisFileFolderType="file",top.ICEcoder.openFile()},openPrompt:function(){var a;if(a=top.ICEcoder.getInput(top.t["Enter relative file..."],""))-1<a.indexOf("://")?top.ICEcoder.getRemoteFile(a):top.ICEcoder.openFile(a)},getRemoteFile:function(a){top.ICEcoder.serverQueue("add","lib/file-control.php?action=getRemoteFile&file="+a+"&csrf="+top.ICEcoder.csrf);top.ICEcoder.serverMessage("<b>"+top.t.Getting+"</b><br>"+a)},saveFile:function(a){var b,c;a=a?"saveAs":"save";
|
||||
b=ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|");"|[NEW]"==b&&0<top.ICEcoder.selectedFiles.length&&(c=top.ICEcoder.selectedFiles[0],b=-1==c.lastIndexOf(".")||c.lastIndexOf(".")<c.lastIndexOf("|")?c+b:"|[NEW]");b=b.replace("||","|");top.ICEcoder.serverQueue("add","lib/file-control.php?action=save&file="+b+"&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&saveType="+a+"&csrf="+top.ICEcoder.csrf);top.ICEcoder.serverMessage("<b>"+top.t.Saving+"</b><br>"+
|
||||
ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,""))},renameFile:function(a,b){var c,d;a?c=a.replace(/\|/g,"/"):(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));b&&(d=top.ICEcoder.openFiles.indexOf(c.replace(/\|/g,"/")),-1<d&&(top.ICEcoder.openFiles[d]=b,closeTabLink='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a>',
|
||||
c=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.php?action=rename&file="+b+"&oldFileName="+a.replace(/\|/g,"/")+"&csrf="+top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+top.t["Renaming to"]+"</b><br>"+b),top.ICEcoder.setPreviousFiles())},moveFile:function(a,b){var c,d;b&&(d=top.ICEcoder.openFiles.indexOf(a.replace(/\|/g,"/")),-1<d&&(top.ICEcoder.openFiles[d]=
|
||||
b,closeTabLink='<a nohref onClick="top.ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3),10))"><img src="images/nav-close.gif" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'; top.ICEcoder.overCloseLink=true" onMouseOut="this.style.backgroundColor=prevBG; top.ICEcoder.overCloseLink=false"></a>',c=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.php?action=move&file="+b+"&oldFileName="+a.replace(/\|/g,"/")+"&csrf="+top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+top.t["Moving to"]+"</b><br>"+b),top.ICEcoder.setPreviousFiles())},deleteFiles:function(a){var b;a=a?a:top.ICEcoder.selectedFiles;b=a.toString().replace(/\|/g,"/").replace(/,/g,"\n");0<a.length&&top.ICEcoder.ask("Delete:\n\n"+b+"?")&&(top.ICEcoder.serverQueue("add","lib/file-control.php?action=delete&file="+a.join(";")+"&csrf="+
|
||||
top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+top.t["Deleting File"]+"</b><br>"+b))},copyFiles:function(a,b,c){top.ICEcoder.copiedFiles=[];for(var d=0;d<a.length;d++)top.ICEcoder.copiedFiles[d]=a[d];b||(top.get("fmMenuPasteOption").style.display="block");c||top.ICEcoder.hideFileMenu()},pasteFiles:function(a){if(top.ICEcoder.copiedFiles)for(var b=0;b<top.ICEcoder.copiedFiles.length;b++)"|"!=top.ICEcoder.copiedFiles[b]?(top.ICEcoder.serverQueue("add","lib/file-control.php?action=paste&file="+
|
||||
top.ICEcoder.copiedFiles[b]+"&location="+a+"&csrf="+top.ICEcoder.csrf),top.ICEcoder.serverMessage("<b>"+top.t["Pasting File"]+"</b><br>"+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){var b;top.ICEcoder.copiedFiles&&(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","optionsRemote","optionsHelp"];if("hide"==a)fileNavInt=setTimeout(function(){for(var a=0;a<
|
||||
c.length;a++)top.ICEcoder.showHide("hide",top.get(c[a])),top.get(c[a]+"Nav").style.color=""},150);else for(var d=0;d<c.length;d++)top.ICEcoder.showHide("hide",top.get(c[d])),top.get(c[d]+"Nav").style.color="";get("fileOptions").style.opacity=0;"show"==a&&("undefined"!=typeof fileNavInt&&clearTimeout(fileNavInt),top.ICEcoder.showHide(a,top.get(b)),top.get(b+"Nav").style.color="#fff",get("fileOptions").style.opacity=1)},showMenu:function(a){var b,c;0!=top.ICEcoder.selectedFiles.length&&-1!=top.ICEcoder.selectedFiles.indexOf(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-
|
||||
1].replace(/\//g,"|"))||top.ICEcoder.selectFileFolder(a);a=129;c=window.innerHeight;"undefined"!=typeof top.ICEcoder.thisFileFolderLink&&""!=top.ICEcoder.thisFileFolderLink&&(b=-1<top.ICEcoder.selectedFiles[0].indexOf(".")?"file":"folder",top.get("folderMenuItems").style.display="folder"==b&&1==top.ICEcoder.selectedFiles.length?"block":"none","folder"==b&&1==top.ICEcoder.selectedFiles.length&&(a+=67,"block"==top.get("fmMenuPasteOption").style.display&&(a+=19)),top.get("singleFileMenuItems").style.display=
|
||||
1<top.ICEcoder.selectedFiles.length?"none":"block",1==top.ICEcoder.selectedFiles.length&&(a+=43),top.get("fileMenu").style.display="inline-block",setTimeout(function(){top.get("fileMenu").style.opacity="1"},4),top.get("fileMenu").style.left=top.ICEcoder.mouseX+20+"px",b=top.ICEcoder.mouseY-top.ICEcoder.filesFrame.contentWindow.document.body.scrollTop-10,b+a>c&&(b-=b+a-c),top.get("fileMenu").style.top=b+"px");return!1},showFileMenu:function(){top.get("fileMenu").style.display="inline-block";setTimeout(function(){top.get("fileMenu").style.opacity=
|
||||
"1"},4)},hideFileMenu:function(){top.get("fileMenu").style.display="none";top.get("fileMenu").style.opacity="0"},updateFileManagerList:function(a,b,c,d,f,e,g){var k,h,l,n,p,m,r;if("add"==a&&!top.get("filesFrame").contentWindow.document.getElementById(b.replace(top.iceRoot,"").replace(/\/$/,"").replace(/\//g,"|")+"|"+c)){k="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?664:705;b||(b="/");b=b.replace(top.iceRoot,"/");b=b.replace("//","/");h=top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,
|
||||
"|"));l=h.parentNode.parentNode.nextSibling;n=document.createTextNode("\n");p=777==d?"background: #800; color: #eee":"color: #888";p='<a nohref title="'+b.replace(/\/$/,"")+"/"+c+'" onMouseOver="top.ICEcoder.overFileFolder(\''+g+"',this.childNodes[1].id)\" onMouseOut=\"top.ICEcoder.overFileFolder('"+g+"','')\" onClick=\"if(!event.ctrlKey && !top.ICEcoder.cmdKey) {top.ICEcoder.openCloseDir(this,"+("folder"==g?"true":"false")+'); if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {top.ICEcoder.openFile()}}" style="position: relative; left:-22px"> <span id="'+
|
||||
b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'">'+c+'</span> <span style="'+p+'; font-size: 8px" id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'_perms">'+d+"</span></a>";if(3>l.childNodes.length)m=document.createElement("ul"),l=h.parentNode.parentNode,l.parentNode.insertBefore(m,l.nextSibling),m=document.createElement("li"),m.className=k,m.draggable=!0,m.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?
|
||||
top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())},m.ondragend=function(){top.ICEcoder.dropFile(this)},m.innerHTML=p,l.nextSibling.appendChild(m),l.nextSibling.appendChild(n);else for(h=0;h<l.childNodes.length;h++)if(l.childNodes[h].className&&(m=0<l.childNodes[h].className.indexOf("directory")?"folder":"file",r=l.childNodes[h].getElementsByTagName("span")[0].innerHTML,m==g&&r>c||"folder"==g&&"file"==m||h==l.childNodes.length-1)){m=document.createElement("li");m.className=
|
||||
k;m.draggable=!0;m.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())};m.ondragend=function(){top.ICEcoder.dropFile(this)};m.innerHTML=p;h==l.childNodes.length-1?(l.appendChild(m),l.appendChild(n)):(l.insertBefore(m,l.childNodes[h]),l.insertBefore(n,l.childNodes[h+1]));break}"file"!=g||e||(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-
|
||||
1]=b+c)}"rename"==a&&(e=f.replace(/\//g,"|"),h=top.get("filesFrame").contentWindow.document.getElementById(e),h.innerHTML=c,h.id=b.replace(/\//g,"|")+"|"+c,h.parentNode.title=h.id.replace(/\|/g,"/"),targetElemPerms=top.get("filesFrame").contentWindow.document.getElementById(e+"_perms"),targetElemPerms.id=b.replace(/\//g,"|")+"|"+c+"_perms");"move"==a&&(top.ICEcoder.updateFileManagerList("add",b,c,!1,!1,!1,g),top.ICEcoder.updateFileManagerList("delete",f.substr(0,f.lastIndexOf("/")),c));"chmod"==a&&
|
||||
(e=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"),h=top.get("filesFrame").contentWindow.document.getElementById(e.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))},refreshFileManager:function(){top.ICEcoder.showHide("show",top.get("loadingMask"));top.ICEcoder.filesFrame.contentWindow.location.reload(!0);top.ICEcoder.filesFrame.style.opacity="0";top.ICEcoder.filesFrame.onload=function(){top.ICEcoder.filesFrame.style.opacity="1";top.ICEcoder.showHide("hide",top.get("loadingMask"))}},draggingWithKeyTest:function(a){var b;b=a.keyCode?a.keyCode:a.which?a.which:a.charCode;if(224==b||91==b||
|
||||
93==b)top.ICEcoder.cmdKey=!0;top.ICEcoder.draggingWithKey=a.ctrlKey||top.ICEcoder.cmdKey?"CTRL":!1},dropFile:function(a){var b,c;b=a.childNodes[0].childNodes[1].id.replace(/\|/g,"/");fileName=b.substr(b.lastIndexOf("/")+1);"editor"==top.ICEcoder.area&&top.ICEcoder.pasteURL(b);"files"==top.ICEcoder.area&&setTimeout(function(){c="folder"==ICEcoder.thisFileFolderType?ICEcoder.thisFileFolderLink:ICEcoder.thisFileFolderLink.substr(0,ICEcoder.thisFileFolderLink.lastIndexOf("|"));"CTRL"==top.ICEcoder.draggingWithKey?
|
||||
(top.ICEcoder.copyFiles(top.ICEcoder.selectedFiles),top.ICEcoder.pasteFiles(c)):top.ICEcoder.moveFile(b,c.replace(/\|/g,"/")+"/"+fileName)},4);top.ICEcoder.mouseDown=!1},findReplaceOptions:function(){top.get("rText").style.display=top.get("replace").style.display=top.get("rTarget").style.display=document.findAndReplace.connector.value==top.t.and?"inline-block":"none"},findReplace:function(a,b,c){var d,f,e,g;a=a.toLowerCase();d=top.get("replace").value;f=top.get("results");e=ICEcoder.getcMInstance();
|
||||
g=ICEcoder.getcMdiffInstance();if((e=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?g:e)&&0<a.length&&document.findAndReplace.target.value==top.t["this document"]){e.getValue().toLowerCase();document.findAndReplace.connector.value==top.t.and&&c&&(document.findAndReplace.replaceAction.value==top.t.replace&&e.getSelection().toLowerCase()==a?e.replaceSelection(d,"around"):document.findAndReplace.replaceAction.value==top.t["replace all"]&&(c=new RegExp(a,"gi"),e.setValue(e.getValue().replace(c,d))));
|
||||
c=e.getValue().toLowerCase();if(!top.ICEcoder.findMode||a!=top.ICEcoder.lastsearch){ICEcoder.results=[];ICEcoder.resultsLines=[];for(d=0;d<c.length;d++)c.substr(d,a.length)==a&&-1==ICEcoder.results.indexOf(d)&&(ICEcoder.results.push(d),-1==ICEcoder.resultsLines.indexOf(e.posFromIndex(d).line+1)&&ICEcoder.resultsLines.push(e.posFromIndex(d).line+1));ICEcoder.lastsearch=a}if(0<ICEcoder.results.length){if(b)f.innerHTML=ICEcoder.results.length+" results";else{for(d=ICEcoder.findResult=0;d<ICEcoder.results.length;d++)ICEcoder.results[d]<
|
||||
e.indexFromPos(e.getCursor())&&ICEcoder.findResult++;ICEcoder.findResult>ICEcoder.results.length-1&&(ICEcoder.findResult=0);f.innerHTML="Highlighted result "+(ICEcoder.findResult+1)+" of "+ICEcoder.results.length+" results";b=e.getSearchCursor(a,e.getCursor(),!0);b.findNext();b.from()||(b=e.getSearchCursor(a,{line:0,ch:0},!0),b.findNext());e.setSelection(b.from(),b.to());top.ICEcoder.focus();top.ICEcoder.findMode=!0}a=top.ICEcoder.scrollBarVisible?parseInt(top.ICEcoder.content.style.height,10)/e.lineCount():
|
||||
e.defaultTextHeight();b=top.ICEcoder.scrollBarVisible?0:e.heightAtLine(0);f="";for(d=1;d<=e.lineCount();d++)c=-1<ICEcoder.resultsLines.indexOf(d)?e.getCursor().line+1==d?"#b00":"#888":"transparent",f+='<div style="position: absolute; display: block; width: 5px; height:'+a+"px; background: "+c+"; top: "+parseInt(a*(d-1)+b,10)+'px"></div>';top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML=f;top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display=
|
||||
"inline-block";return!0}f.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?(f=b=e="",document.findAndReplace.connector.value==top.t.and&&(e="&replace="+d),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"]&&
|
||||
(f="&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='<iframe src="lib/multiple-results.php?find='+a+e+b+f+"&csrf="+top.ICEcoder.csrf+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>'):(f.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.php?action=replaceText&fileRef="+a.replace(/\//g,"|")+"&find="+b+"&replace="+c+"&csrf="+top.ICEcoder.csrf);top.ICEcoder.serverMessage("<b>"+top.t["Replacing text in"]+"</b><br>"+a)},getCaretPosition:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getCursor().line;c=a.getCursor().ch;for(var f=d=0;f<b;f++)d+=a.getLine(f).length+
|
||||
1;ICEcoder.caretPos=d+c-1},updateCharDisplay:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;ICEcoder.caretLocationType();ICEcoder.charDisplay.innerHTML=ICEcoder.caretLocType+", Line: "+(a.getCursor().line+1)+", Char: "+a.getCursor().ch},updateByteDisplay:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;ICEcoder.byteDisplay.innerHTML=
|
||||
a.getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" bytes"},showDisplay:function(a){top.ICEcoder.byteDisplay.style.display="byte"==a?"inline-block":"none";top.ICEcoder.charDisplay.style.display="char"==a?"inline-block":"none"},showHide:function(a,b){b.style.visibility="show"==a?"visible":"hidden"},getcMInstance:function(a){return top.ICEcoder.content.contentWindow[isNaN(a)?"new"==a||"new"!=a&&0<ICEcoder.openFiles.length?"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1":"cM"+
|
||||
ICEcoder.cMInstances[a-1]]},getcMdiffInstance:function(a){return top.ICEcoder.content.contentWindow[(isNaN(a)?"new"==a||"new"!=a&&0<ICEcoder.openFiles.length?"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1":"cM"+ICEcoder.cMInstances[a-1])+"diff"]},getMouseXY:function(a,b){top.ICEcoder.mouseX=a.pageX?a.pageX:a.clientX+document.body.scrollLeft;top.ICEcoder.mouseY=a.pageY?a.pageY:a.clientY+document.body.scrollTop;top.ICEcoder.area=b;"top"!=b&&(top.ICEcoder.mouseY+=70);"editor"==b&&(top.ICEcoder.mouseX+=
|
||||
top.ICEcoder.filesW);top.ICEcoder.dragCursorTest();62<top.ICEcoder.mouseY&&top.ICEcoder.setTabWidths()},dragCursorTest:function(){var a,b;a=top.ICEcoder.mouseX-top.ICEcoder.diffStartX;!1!==top.ICEcoder.draggingTab&&top.ICEcoder.diffStartX&&(-10>=a||10<=a)&&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),a=!ICEcoder.draggingTab&&(top.ICEcoder.mouseX>top.ICEcoder.filesW-7&&top.ICEcoder.mouseX<top.ICEcoder.filesW+7||top.ICEcoder.draggingFilesW)?"w-resize":"auto",top.ICEcoder.content.contentWindow.document&&top.ICEcoder.filesFrame.contentWindow)){top.document.body.style.cursor=a;if(b=top.ICEcoder.content.contentWindow.document.body)b.style.cursor=a;if(b=top.ICEcoder.filesFrame.contentWindow.document.body)b.style.cursor=a}},serverMessage:function(a){var b;b=top.get("serverMessage");
|
||||
a?(b.innerHTML=top.ICEcoder.xssClean(a).replace(/\<b\>/g,"<b>").replace(/\<\/b\>/g,"</b>").replace(/\<br\>/g,"<br>"),b.style.left="0"):setTimeout(function(){b.style.left="2000px"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();if(a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a){b=a.getLine(a.getCursor().line);for(c=/(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi;(d=
|
||||
c.exec(b))&&a.getCursor().ch>d.index+d[0].length;);(b=top.get("content").contentWindow.document.getElementById("cssColor"))&&b.parentNode.removeChild(b);top.ICEcoder.codeAssist&&"CSS"==top.ICEcoder.caretLocType&&(b=top.document.createElement("div"),b.id="cssColor",b.style.position="absolute",b.style.display="block",b.style.width=b.style.height="20px",b.style.zIndex="1000",b.style.background=d?d[0]:"",b.style.cursor="pointer",b.onclick=function(){top.ICEcoder.showColorPicker(d[0])},""==b.style.backgroundColor&&
|
||||
(b.style.display="none"),top.get("header").appendChild(b),a.addWidget(a.getCursor(),top.get("cssColor"),!0))}},showColorPicker:function(a){top.get("blackMask").style.visibility="visible";top.get("mediaContainer").innerHTML='<div id="picker" class="picker"></div><br><br><input type="text" id="color" name="color" value="#000" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'color\').value)" value="insert >" class="insertColorValue"><br><input type="text" id="colorRGB" name="colorRGB" value="rgb(0,0,0)" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'colorRGB\').value)" value="insert >" class="insertColorValue">';
|
||||
farbtastic("picker","color");a&&top.get("picker").farbtastic.setColor(a)},drawCanvasImage:function(a){var b,c,d,f,e,g,k,h,l,n,p;b=top.get("canvasPicker").getContext("2d");c=new Image;c.src=a.src;c.onload=function(){top.get("canvasPicker").width=a.width;top.get("canvasPicker").height=a.height;b.drawImage(c,0,0,a.width,a.height)};top.get("canvasPicker").onmousemove=function(a){d=a.pageX-this.offsetLeft;f=a.pageY-this.offsetTop;e=b.getImageData(d,f,1,1).data;g=e[0];k=e[1];h=e[2];l=g+","+k+","+h;n=top.ICEcoder.rgbToHex(g,
|
||||
k,h);top.get("rgbMouseXY").value=l;top.get("hexMouseXY").value="#"+n;top.get("hexMouseXY").style.backgroundColor=top.get("rgbMouseXY").style.backgroundColor="#"+n;p=128>g||128>k||128>h&&200>g&&200>k&&50<h?"#fff":"#000";top.get("hexMouseXY").style.color=top.get("rgbMouseXY").style.color=p};top.get("canvasPicker").onclick=function(){top.get("rgb").value=top.get("rgbMouseXY").value;top.get("hex").value=top.get("hexMouseXY").value;top.get("hex").style.backgroundColor=top.get("rgb").style.backgroundColor=
|
||||
top.get("hex").value;top.get("hex").style.color=top.get("rgb").style.color=p}},rgbToHex:function(a,b,c){return top.ICEcoder.toHex(a)+top.ICEcoder.toHex(b)+top.ICEcoder.toHex(c)},toHex:function(a){a=parseInt(a,10);if(isNaN(a))return"00";a=Math.max(0,Math.min(a,255));return"0123456789abcdef".charAt((a-a%16)/16)+"0123456789abcdef".charAt(a%16)},insertColorValue:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.getcMdiffInstance();b=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?c:b;c=b.getTokenAt(b.getCursor());
|
||||
|
||||
Reference in New Issue
Block a user