mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
Python now supported as a language
Also minor fixes to Ruby's usage
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ You can run ICEcoder either online or locally, on Linux, Windows or Mac based pl
|
||||
|
||||
###Features you'd expect
|
||||
* Context aware code highlighting
|
||||
* Supports HTML, CSS, LESS, JavaScript, CoffeeScript, PHP & Ruby, Markdown & more
|
||||
* Supports HTML, CSS, LESS, JavaScript, CoffeeScript, PHP, Python, Ruby, Markdown & more
|
||||
* Smart tab key system (selected text indents line)
|
||||
* File manager
|
||||
* Find & replace/replace all
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<!--
|
||||
codemirror-compressed.js
|
||||
incls: codemirror
|
||||
modes: clike, coffeescript, css, htmlmixed, javascript, less, markdown, php, ruby & xml
|
||||
modes: clike, coffeescript, css, htmlmixed, javascript, less, markdown, php, python, ruby & xml
|
||||
utils: closetag, foldcode, xml-fold, brace-fold, show-hint, javascript-hint, html-hint, searchcursor, match-highlighter
|
||||
//-->
|
||||
<script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script>
|
||||
@@ -219,7 +219,7 @@ function createNewCMInstance(num) {
|
||||
);
|
||||
|
||||
window['cM'+num].on("gutterClick", function(thisCM, line, gutter, clickEvent) {
|
||||
["JavaScript","CoffeeScript","PHP","Ruby"].indexOf(top.ICEcoder.caretLocType) > -1
|
||||
["JavaScript","CoffeeScript","PHP","Python","Ruby"].indexOf(top.ICEcoder.caretLocType) > -1
|
||||
? codeFoldBrace(window['cM'+num], line) : codeFoldTag(window['cM'+num], line);
|
||||
window['cM'+num].setGutterMarker(line, "CodeMirror-linenumbers", document.createTextNode("+ "+(line+1)));
|
||||
setTimeout(function() {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 8.0 KiB |
@@ -28,7 +28,7 @@ if ($_GET['action']=="load") {
|
||||
finfo_close($finfoMIME);
|
||||
} else {
|
||||
$fileExt = pathinfo($file, PATHINFO_EXTENSION);
|
||||
if (array_search($fileExt,array("coffee","css","htm","html","js","less","md","php","rb","ruby","txt","xml"))!==false) {$finfo = "text";};
|
||||
if (array_search($fileExt,array("coffee","css","htm","html","js","less","md","php","py","rb","ruby","txt","xml"))!==false) {$finfo = "text";};
|
||||
if (array_search($fileExt,array("gif","jpg","jpeg","png"))!==false) {$finfo = "image";};
|
||||
}
|
||||
if (strpos($finfo,"text")===0 || strpos($finfo,"empty")!==false) {
|
||||
|
||||
@@ -58,6 +58,7 @@ body {margin: 0; overflow: auto}
|
||||
.fileManager LI.ext-md:before {background-position: -160px 0}
|
||||
.fileManager LI.ext-php:before {background-position: -176px 0}
|
||||
.fileManager LI.ext-png:before {background-position: -192px 0}
|
||||
.fileManager LI.ext-rb:before, .fileManager LI.ext-ruby:before {background-position: -208px 0}
|
||||
.fileManager LI.ext-txt:before {background-position: -224px 0}
|
||||
.fileManager LI.ext-zip:before {background-position: -240px 0}
|
||||
.fileManager LI.ext-py:before {background-position: -208px 0}
|
||||
.fileManager LI.ext-rb:before, .fileManager LI.ext-ruby:before {background-position: -224px 0}
|
||||
.fileManager LI.ext-txt:before {background-position: -240px 0}
|
||||
.fileManager LI.ext-zip:before {background-position: -256px 0}
|
||||
@@ -157,9 +157,9 @@ var ICEcoder = {
|
||||
contentCleanUp: function() {
|
||||
var fileName, cM, content;
|
||||
|
||||
// If it's not a JS, CoffeeScript Ruby, CSS or LESS file, replace our temp /textarea value
|
||||
// If it's not a JS, CoffeeScript, CSS or LESS file, replace our temp /textarea value
|
||||
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
|
||||
if (["js","coffee","rb","css","less"].indexOf(fileName.split(".")[1])<0) {
|
||||
if (["js","coffee","css","less"].indexOf(fileName.split(".")[1])<0) {
|
||||
cM = ICEcoder.getcMInstance();
|
||||
content = cM.getValue();
|
||||
content = content.replace(/<ICEcoder:\/:textarea>/g,'<\/textarea>');
|
||||
@@ -216,6 +216,7 @@ var ICEcoder = {
|
||||
fileName.indexOf('.js')>0 ? cM.setOption("mode","javascript")
|
||||
: fileName.indexOf('.coffee')>0 ? cM.setOption("mode","coffeescript")
|
||||
: fileName.indexOf('.rb')>0 ? cM.setOption("mode","ruby")
|
||||
: fileName.indexOf('.py')>0 ? cM.setOption("mode","python")
|
||||
: fileName.indexOf('.css')>0 ? cM.setOption("mode","css")
|
||||
: fileName.indexOf('.less')>0 ? cM.setOption("mode","less")
|
||||
: fileName.indexOf('.md')>0 ? cM.setOption("mode","markdown")
|
||||
@@ -234,9 +235,9 @@ var ICEcoder = {
|
||||
lCLen = lineContent.length;
|
||||
adjustCursor = 2;
|
||||
|
||||
if (["JavaScript","CoffeeScript","PHP","Ruby","CSS"].indexOf(ICEcoder.caretLocType)>-1) {
|
||||
if (["JavaScript","CoffeeScript","PHP","Python","Ruby","CSS"].indexOf(ICEcoder.caretLocType)>-1) {
|
||||
if (cM.somethingSelected()) {
|
||||
if (ICEcoder.caretLocType=="Ruby") {
|
||||
if (ICEcoder.caretLocType=="Ruby"||ICEcoder.caretLocType=="Python") {
|
||||
startLine = cM.getCursor(true).line;
|
||||
endLine = cM.getCursor().line;
|
||||
for (var i=startLine; i<=endLine; i++) {
|
||||
@@ -1049,7 +1050,7 @@ var ICEcoder = {
|
||||
ICEcoder.nestDisplay.innerHTML = "";
|
||||
if ("undefined" != typeof ICEcoder.openFiles[ICEcoder.selectedTab-1]) {
|
||||
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
|
||||
if (["js","coffee","rb","css","less"].indexOf(fileName.split(".")[1])<0 &&
|
||||
if (["js","coffee","css","less"].indexOf(fileName.split(".")[1])<0 &&
|
||||
(nestCheck.indexOf("include(")==-1)&&(nestCheck.indexOf("include_once(")==-1)&&
|
||||
(nestCheck.indexOf("<html")>-1||nestCheck.indexOf("<body")>-1)) {
|
||||
|
||||
@@ -1078,7 +1079,7 @@ var ICEcoder = {
|
||||
cM = ICEcoder.getcMInstance();
|
||||
nestOK = true;
|
||||
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
|
||||
if (cM && fileName && ["js","coffee","rb","css","less"].indexOf(fileName.split(".")[1])==-1) {
|
||||
if (cM && fileName && ["js","coffee","css","less"].indexOf(fileName.split(".")[1])==-1) {
|
||||
nestOK = cM.getTokenAt({line:cM.lineCount(),ch:cM.lineInfo(cM.lineCount()-1).text.length}).className != "error" ? true : false;
|
||||
}
|
||||
ICEcoder.nestValid.style.background = nestOK ? "#0b0" : "#f00";
|
||||
@@ -1127,6 +1128,7 @@ var ICEcoder = {
|
||||
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
|
||||
if (fileName.indexOf(".js")>0) {caretLocType="JavaScript"}
|
||||
else if (fileName.indexOf(".coffee")>0) {caretLocType="CoffeeScript"}
|
||||
else if (fileName.indexOf(".py")>0) {caretLocType="Python"}
|
||||
else if (fileName.indexOf(".rb")>0) {caretLocType="Ruby"}
|
||||
else if (fileName.indexOf(".css")>0) {caretLocType="CSS"}
|
||||
else if (fileName.indexOf(".less")>0) {caretLocType="LESS"}
|
||||
|
||||
54
lib/ice-coder.min.js
vendored
54
lib/ice-coder.min.js
vendored
@@ -4,27 +4,27 @@ function(){a.src=document.mozFullScreen?b[0]:b[1]},!1);document.addEventListener
|
||||
this.accountH+"px";this.fmLock.style.marginLeft=this.filesW-42+"px";this.filesFrame.style.height=c-40-50-30+"px";this.nestValid.style.left=this.filesW+10+"px";this.nestDisplay.style.left=this.filesW+17+"px";top.ICEcoder.setTabWidths();a||(this.editor.style.width=ICEcoder.content.style.width=b-this.filesW+"px",ICEcoder.content.style.height=c-40-30-21-28+"px",setTimeout(function(){for(var a=0;a<top.ICEcoder.openFiles.length;a++)top.ICEcoder.content.contentWindow["cM"+ICEcoder.cMInstances[a]].setSize("100%",
|
||||
top.ICEcoder.content.style.height)},4))},changeFilesW:function(a){if(!ICEcoder.lockedNav||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(){"w-resize"==top.document.body.style.cursor?top.ICEcoder.mouseDown&&(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.account.style.width=top.ICEcoder.filesFrame.style.width=top.ICEcoder.filesW+"px",top.ICEcoder.setLayout(),top.ICEcoder.draggingFilesW=!0):top.ICEcoder.draggingFilesW=!1},lockUnlockNav:function(){var a;a=top.document.getElementById("fmLock");ICEcoder.lockedNav=ICEcoder.lockedNav?!1:!0;a.style.backgroundPosition=ICEcoder.lockedNav?"-64px -16px":"-80px -16px"},contentCleanUp:function(){var a,b;0>["js","coffee","rb","css","less"].indexOf(ICEcoder.openFiles[ICEcoder.selectedTab-
|
||||
top.ICEcoder.mouseX?250:400,top.ICEcoder.files.style.width=top.ICEcoder.account.style.width=top.ICEcoder.filesFrame.style.width=top.ICEcoder.filesW+"px",top.ICEcoder.setLayout(),top.ICEcoder.draggingFilesW=!0):top.ICEcoder.draggingFilesW=!1},lockUnlockNav:function(){var a;a=top.document.getElementById("fmLock");ICEcoder.lockedNav=ICEcoder.lockedNav?!1:!0;a.style.backgroundPosition=ICEcoder.lockedNav?"-64px -16px":"-80px -16px"},contentCleanUp:function(){var a,b;0>["js","coffee","css","less"].indexOf(ICEcoder.openFiles[ICEcoder.selectedTab-
|
||||
1].split(".")[1])&&(a=ICEcoder.getcMInstance(),b=a.getValue(),b=b.replace(/<ICEcoder:\/:textarea>/g,"</textarea>"),a.setValue(b),a.clearHistory())},moveLine:function(a){var b,c,d;b=top.ICEcoder.getcMInstance();c=b.getCursor().line;"up"==a&&0<c&&(d=c-1);"down"==a&&c<b.lineCount()-1&&(d=c+1);isNaN(d)||(a=b.getLine(d),b.setLine(d,b.getLine(c)),b.setLine(c,a),ICEcoder.highlightLine(d))},highlightLine:function(a){var b;b=top.ICEcoder.getcMInstance();b.setSelection({line:a,ch:0},{line:a,ch:b.lineInfo(a).text.length})},
|
||||
goToLine:function(a){var b;b=ICEcoder.getcMInstance();b.setCursor(a?a-1:document.getElementById("goToLineNo").value-1);b.focus();return!1},switchMode:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.openFiles[ICEcoder.selectedTab-1];a?b.setOption("mode",a):c&&(0<c.indexOf(".js")?b.setOption("mode","javascript"):0<c.indexOf(".coffee")?b.setOption("mode","coffeescript"):0<c.indexOf(".rb")?b.setOption("mode","ruby"):0<c.indexOf(".css")?b.setOption("mode","css"):0<c.indexOf(".less")?b.setOption("mode",
|
||||
"less"):0<c.indexOf(".md")?b.setOption("mode","markdown"):b.setOption("mode","application/x-httpd-php"))},lineCommentToggle:function(){var a,b,c,d,e,f;a=ICEcoder.getcMInstance();b=a.getCursor().ch;c=a.getCursor().line;d=a.getLine(c);e=d.length;f=2;if(-1<["JavaScript","CoffeeScript","PHP","Ruby","CSS"].indexOf(ICEcoder.caretLocType))if(a.somethingSelected())if("Ruby"==ICEcoder.caretLocType){e=a.getCursor(!0).line;for(d=a.getCursor().line;e<=d;e++)a.setLine(e,"#"!=a.getLine(e).slice(0,1)?"#"+a.getLine(e):
|
||||
a.getLine(e).slice(1,a.getLine(e).length))}else a.replaceSelection("/*"!=a.getSelection().slice(0,2)?"/*"+a.getSelection()+"*/":a.getSelection().slice(2,a.getSelection().length-2));else-1<["CoffeeScript","CSS"].indexOf(ICEcoder.caretLocType)?(a.setLine(c,"/*"!=d.slice(0,2)?"/*"+d+"*/":d.slice(2,e).slice(0,e-4)),"/*"==d.slice(0,2)&&(f=-f)):"Ruby"==ICEcoder.caretLocType?(a.setLine(c,"#"!=d.slice(0,1)?"#"+d:d.slice(1,e)),"#"==d.slice(0,1)&&(f=-f)):(a.setLine(c,"//"!=d.slice(0,2)?"//"+d:d.slice(2,e)),
|
||||
"//"==d.slice(0,2)&&(f=-f));else a.somethingSelected()?a.replaceSelection("\x3c!--"!=a.getSelection().slice(0,4)?"\x3c!--"+a.getSelection()+"//--\x3e":a.getSelection().slice(4,a.getSelection().length-5)):(a.setLine(c,"\x3c!--"!=d.slice(0,4)?"\x3c!--"+d+"//--\x3e":d.slice(4,e).slice(0,e-9)),f="\x3c!--"==d.slice(0,4)?-4:4);a.somethingSelected()||a.setCursor(c,b+f)},highlightBlock:function(a,b){var c,d,e,f;c=top.ICEcoder.getcMInstance();if(b)top.ICEcoder.dontUpdateNest?c.setCursor(top.ICEcoder.cursorOrigLine,
|
||||
top.ICEcoder.cursorOrigCh):top.ICEcoder.getNestLocation("updateNestDisplay"),top.ICEcoder.dontUpdateNest=!1;else{top.ICEcoder.cursorOrigCh=c.getCursor().ch;top.ICEcoder.cursorOrigLine=c.getCursor().line;top.ICEcoder.dontUpdateNest=!0;d={};d.ch=c.getCursor().ch;d.line=c.getCursor().line;for(var g=top.ICEcoder.htmlTagArray.length-1;g>=a;g--)e=c.getSearchCursor("<"+top.ICEcoder.htmlTagArray[g],d),e.findPrevious(),d.ch=e.from().ch,d.line=e.from().line,g==a&&(f=c.getSearchCursor(">",d),f.findNext(),c.setCursor(f.from().line,
|
||||
f.from().ch+1),top.ICEcoder.getNestLocation(),ICEcoder.htmlTagArray.length-1!=a&&g++);e.from()&&(d={},top.ICEcoder.startPosLine=d.line=e.from().line,top.ICEcoder.startPosCh=d.ch=e.from().ch,e={},e.line=top.ICEcoder.content.contentWindow.CodeMirror.tagRangeFinder(c,d)||d.line,e.line=e.line.to?e.line.to.line:e.line,e.ch=c.getLine(e.line).indexOf("</"+top.ICEcoder.htmlTagArray[a]+">")+top.ICEcoder.htmlTagArray[a].length+3,!top.ICEcoder.dontSelect?c.setSelection(d,e):top.ICEcoder.dontSelect=!1,c.scrollIntoView(d))}},
|
||||
setPosition:function(a,b,c){var d;d=ICEcoder.getcMInstance();c=d.getLine(b).indexOf(">",d.getLine(b).indexOf("<"+c))+1;d.setCursor(b,c);d.focus();for(d=b=0;d<=a;d++)b=ICEcoder.nestDisplay.innerHTML.indexOf(">",b+1);ICEcoder.nestDisplay.innerHTML=ICEcoder.nestDisplay.innerHTML.substr(0,b).replace(/<(?:.|\n)*?>/gm,"");top.ICEcoder.dontUpdateNest=!1;top.ICEcoder.dontSelect=!0},tagWrapper:function(a){var b,c,d,e;b=ICEcoder.getcMInstance();c=a;"div"==a?(d=b.getCursor("start").line,e=b.getCursor().line,
|
||||
b.operation(function(){b.replaceSelection("<div>\n"+b.getSelection()+"\n</div>");for(var a=d+1;a<=e+1;a++)b.indentLine(a);b.indentLine(e+2,"prev");b.indentLine(e+2,"subtract")})):("a"==a&&(c='a href=""'),b.replaceSelection("<"+c+">"+b.getSelection()+"</"+a+">"));"a"==a&&b.setCursor({line:b.getCursor("start").line,ch:b.getCursor("start").ch+9})},addLineBreakAtEnd:function(a){var b;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);b.setLine(a,b.getLine(a)+"<br>")},duplicateLine:function(a){var b,
|
||||
c;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);c=b.getCursor().ch;b.setLine(a,b.getLine(a)+"\n"+b.getLine(a));b.setCursor(a+1,c)},removeLine:function(a){var b,c;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);c=b.getCursor().ch;b.removeLine(a);b.setCursor(a-1,c)},jumpToDefinition:function(){var a,b;a=ICEcoder.getcMInstance();b=a.getTokenAt(a.getCursor()).string;if(a.somethingSelected()&&top.ICEcoder.origCurorPos)a.setCursor(top.ICEcoder.origCurorPos);else{top.ICEcoder.origCurorPos=a.getCursor();
|
||||
a=["var "+b,"function "+b,b+"=function",b+"=new function",b+":","def "+b,"class "+b];for(b=0;b<a.length;b++)top.ICEcoder.findReplace(a[b],!1,!1)&&(b=a.length)}},openCloseDir:function(a,b){var c,d;a.onclick=function(){top.ICEcoder.openCloseDir(this,!1)};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);return!1},overFileFolder:function(a,b){ICEcoder.thisFileFolderType=a;ICEcoder.thisFileFolderLink=b},selectFileFolder:function(a){var b,c;""==top.ICEcoder.thisFileFolderLink?a.ctrlKey||top.ICEcoder.deselectAllFiles():top.ICEcoder.thisFileFolderLink&&(c=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),b=ICEcoder.filesFrame.contentWindow.document.getElementById(c),a.ctrlKey?-1<top.ICEcoder.selectedFiles.indexOf(c)?(ICEcoder.selectDeselectFile("deselect",
|
||||
b),top.ICEcoder.selectedFiles.splice(top.ICEcoder.selectedFiles.indexOf(c),1)):(ICEcoder.selectDeselectFile("select",b),top.ICEcoder.selectedFiles.push(c)):(top.ICEcoder.deselectAllFiles(),ICEcoder.selectDeselectFile("select",b),top.ICEcoder.selectedFiles.push(c)));document.findAndReplace.target[2].innerHTML=!top.ICEcoder.selectedFiles[0]?"all files":"selected files";document.findAndReplace.target[3].innerHTML=!top.ICEcoder.selectedFiles[0]?"all filenames":"selected filenames";top.ICEcoder.fMIconVis("fMOpen",
|
||||
1==top.ICEcoder.selectedFiles.length?1:0.3);top.ICEcoder.fMIconVis("fMNewFile",1==top.ICEcoder.selectedFiles.length&&"folder"==top.ICEcoder.thisFileFolderType?1:0.3);top.ICEcoder.fMIconVis("fMNewFolder",1==top.ICEcoder.selectedFiles.length&&"folder"==top.ICEcoder.thisFileFolderType?1:0.3);top.ICEcoder.fMIconVis("fMDelete",0<top.ICEcoder.selectedFiles.length?1:0.3);top.ICEcoder.fMIconVis("fMRename",1==top.ICEcoder.selectedFiles.length?1:0.3);top.document.getElementById("fileMenu").style.display="none"},
|
||||
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,b.style.backgroundColor=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]==b.id.replace(/\|/g,"/")?"#49d":"select"==a?"#888":b.style.backgroundColor=
|
||||
c?"rgba(255,255,255,0.15)":"transparent",b.style.color="select"==a?"#fff":"#eee")},newFile:function(){top.ICEcoder.newTab();top.ICEcoder.saveFile()},newFolder:function(){var a,b;a=top.ICEcoder.rightClickedFile.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,"|")),top.ICEcoder.serverMessage("<b>Creating Folder</b><br>"+b)},openFile:function(a){var b;
|
||||
a&&(top.ICEcoder.thisFileFolderLink=a,top.ICEcoder.thisFileFolderType="file");!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?-1<top.ICEcoder.openFiles.indexOf(a)&&"/[NEW]"!=a&&(b=!1,top.ICEcoder.switchTab(i+1)):(top.ICEcoder.message("Sorry, you can only have 100 files open at a time!"),
|
||||
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),top.ICEcoder.serverMessage("<b>Opening File</b><br>"+top.ICEcoder.shortURL)):top.ICEcoder.createNewTab(),top.ICEcoder.fMIconVis("fMView",1)))},openPrompt:function(){var a;(a=top.ICEcoder.getInput("Enter relative file path prefixed with /",""))&&top.ICEcoder.openFile(a)},
|
||||
saveFile:function(a){top.ICEcoder.serverQueue("add","lib/file-control.php?action=save&file="+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|")+"&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&saveType="+(a?"saveAs":"save"));top.ICEcoder.serverMessage("<b>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.rightClickedFile.replace(/\|/g,"/"),a=top.ICEcoder.rightClickedFile.replace(/\|/g,
|
||||
"/"));b||(b=top.ICEcoder.getInput("Please enter the new name for",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>',
|
||||
goToLine:function(a){var b;b=ICEcoder.getcMInstance();b.setCursor(a?a-1:document.getElementById("goToLineNo").value-1);b.focus();return!1},switchMode:function(a){var b,c;b=ICEcoder.getcMInstance();c=ICEcoder.openFiles[ICEcoder.selectedTab-1];a?b.setOption("mode",a):c&&(0<c.indexOf(".js")?b.setOption("mode","javascript"):0<c.indexOf(".coffee")?b.setOption("mode","coffeescript"):0<c.indexOf(".rb")?b.setOption("mode","ruby"):0<c.indexOf(".py")?b.setOption("mode","python"):0<c.indexOf(".css")?b.setOption("mode",
|
||||
"css"):0<c.indexOf(".less")?b.setOption("mode","less"):0<c.indexOf(".md")?b.setOption("mode","markdown"):b.setOption("mode","application/x-httpd-php"))},lineCommentToggle:function(){var a,b,c,d,e,f;a=ICEcoder.getcMInstance();b=a.getCursor().ch;c=a.getCursor().line;d=a.getLine(c);e=d.length;f=2;if(-1<"JavaScript CoffeeScript PHP Python Ruby CSS".split(" ").indexOf(ICEcoder.caretLocType))if(a.somethingSelected())if("Ruby"==ICEcoder.caretLocType||"Python"==ICEcoder.caretLocType){e=a.getCursor(!0).line;
|
||||
for(d=a.getCursor().line;e<=d;e++)a.setLine(e,"#"!=a.getLine(e).slice(0,1)?"#"+a.getLine(e):a.getLine(e).slice(1,a.getLine(e).length))}else a.replaceSelection("/*"!=a.getSelection().slice(0,2)?"/*"+a.getSelection()+"*/":a.getSelection().slice(2,a.getSelection().length-2));else-1<["CoffeeScript","CSS"].indexOf(ICEcoder.caretLocType)?(a.setLine(c,"/*"!=d.slice(0,2)?"/*"+d+"*/":d.slice(2,e).slice(0,e-4)),"/*"==d.slice(0,2)&&(f=-f)):"Ruby"==ICEcoder.caretLocType?(a.setLine(c,"#"!=d.slice(0,1)?"#"+d:d.slice(1,
|
||||
e)),"#"==d.slice(0,1)&&(f=-f)):(a.setLine(c,"//"!=d.slice(0,2)?"//"+d:d.slice(2,e)),"//"==d.slice(0,2)&&(f=-f));else a.somethingSelected()?a.replaceSelection("\x3c!--"!=a.getSelection().slice(0,4)?"\x3c!--"+a.getSelection()+"//--\x3e":a.getSelection().slice(4,a.getSelection().length-5)):(a.setLine(c,"\x3c!--"!=d.slice(0,4)?"\x3c!--"+d+"//--\x3e":d.slice(4,e).slice(0,e-9)),f="\x3c!--"==d.slice(0,4)?-4:4);a.somethingSelected()||a.setCursor(c,b+f)},highlightBlock:function(a,b){var c,d,e,f;c=top.ICEcoder.getcMInstance();
|
||||
if(b)top.ICEcoder.dontUpdateNest?c.setCursor(top.ICEcoder.cursorOrigLine,top.ICEcoder.cursorOrigCh):top.ICEcoder.getNestLocation("updateNestDisplay"),top.ICEcoder.dontUpdateNest=!1;else{top.ICEcoder.cursorOrigCh=c.getCursor().ch;top.ICEcoder.cursorOrigLine=c.getCursor().line;top.ICEcoder.dontUpdateNest=!0;d={};d.ch=c.getCursor().ch;d.line=c.getCursor().line;for(var g=top.ICEcoder.htmlTagArray.length-1;g>=a;g--)e=c.getSearchCursor("<"+top.ICEcoder.htmlTagArray[g],d),e.findPrevious(),d.ch=e.from().ch,
|
||||
d.line=e.from().line,g==a&&(f=c.getSearchCursor(">",d),f.findNext(),c.setCursor(f.from().line,f.from().ch+1),top.ICEcoder.getNestLocation(),ICEcoder.htmlTagArray.length-1!=a&&g++);e.from()&&(d={},top.ICEcoder.startPosLine=d.line=e.from().line,top.ICEcoder.startPosCh=d.ch=e.from().ch,e={},e.line=top.ICEcoder.content.contentWindow.CodeMirror.tagRangeFinder(c,d)||d.line,e.line=e.line.to?e.line.to.line:e.line,e.ch=c.getLine(e.line).indexOf("</"+top.ICEcoder.htmlTagArray[a]+">")+top.ICEcoder.htmlTagArray[a].length+
|
||||
3,!top.ICEcoder.dontSelect?c.setSelection(d,e):top.ICEcoder.dontSelect=!1,c.scrollIntoView(d))}},setPosition:function(a,b,c){var d;d=ICEcoder.getcMInstance();c=d.getLine(b).indexOf(">",d.getLine(b).indexOf("<"+c))+1;d.setCursor(b,c);d.focus();for(d=b=0;d<=a;d++)b=ICEcoder.nestDisplay.innerHTML.indexOf(">",b+1);ICEcoder.nestDisplay.innerHTML=ICEcoder.nestDisplay.innerHTML.substr(0,b).replace(/<(?:.|\n)*?>/gm,"");top.ICEcoder.dontUpdateNest=!1;top.ICEcoder.dontSelect=!0},tagWrapper:function(a){var b,
|
||||
c,d,e;b=ICEcoder.getcMInstance();c=a;"div"==a?(d=b.getCursor("start").line,e=b.getCursor().line,b.operation(function(){b.replaceSelection("<div>\n"+b.getSelection()+"\n</div>");for(var a=d+1;a<=e+1;a++)b.indentLine(a);b.indentLine(e+2,"prev");b.indentLine(e+2,"subtract")})):("a"==a&&(c='a href=""'),b.replaceSelection("<"+c+">"+b.getSelection()+"</"+a+">"));"a"==a&&b.setCursor({line:b.getCursor("start").line,ch:b.getCursor("start").ch+9})},addLineBreakAtEnd:function(a){var b;b=ICEcoder.getcMInstance();
|
||||
a||(a=b.getCursor().line);b.setLine(a,b.getLine(a)+"<br>")},duplicateLine:function(a){var b,c;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);c=b.getCursor().ch;b.setLine(a,b.getLine(a)+"\n"+b.getLine(a));b.setCursor(a+1,c)},removeLine:function(a){var b,c;b=ICEcoder.getcMInstance();a||(a=b.getCursor().line);c=b.getCursor().ch;b.removeLine(a);b.setCursor(a-1,c)},jumpToDefinition:function(){var a,b;a=ICEcoder.getcMInstance();b=a.getTokenAt(a.getCursor()).string;if(a.somethingSelected()&&top.ICEcoder.origCurorPos)a.setCursor(top.ICEcoder.origCurorPos);
|
||||
else{top.ICEcoder.origCurorPos=a.getCursor();a=["var "+b,"function "+b,b+"=function",b+"=new function",b+":","def "+b,"class "+b];for(b=0;b<a.length;b++)top.ICEcoder.findReplace(a[b],!1,!1)&&(b=a.length)}},openCloseDir:function(a,b){var c,d;a.onclick=function(){top.ICEcoder.openCloseDir(this,!1)};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);return!1},overFileFolder:function(a,b){ICEcoder.thisFileFolderType=a;ICEcoder.thisFileFolderLink=b},selectFileFolder:function(a){var b,c;""==top.ICEcoder.thisFileFolderLink?a.ctrlKey||top.ICEcoder.deselectAllFiles():top.ICEcoder.thisFileFolderLink&&(c=top.ICEcoder.thisFileFolderLink.replace(/\//g,"|"),b=ICEcoder.filesFrame.contentWindow.document.getElementById(c),a.ctrlKey?
|
||||
-1<top.ICEcoder.selectedFiles.indexOf(c)?(ICEcoder.selectDeselectFile("deselect",b),top.ICEcoder.selectedFiles.splice(top.ICEcoder.selectedFiles.indexOf(c),1)):(ICEcoder.selectDeselectFile("select",b),top.ICEcoder.selectedFiles.push(c)):(top.ICEcoder.deselectAllFiles(),ICEcoder.selectDeselectFile("select",b),top.ICEcoder.selectedFiles.push(c)));document.findAndReplace.target[2].innerHTML=!top.ICEcoder.selectedFiles[0]?"all files":"selected files";document.findAndReplace.target[3].innerHTML=!top.ICEcoder.selectedFiles[0]?
|
||||
"all filenames":"selected filenames";top.ICEcoder.fMIconVis("fMOpen",1==top.ICEcoder.selectedFiles.length?1:0.3);top.ICEcoder.fMIconVis("fMNewFile",1==top.ICEcoder.selectedFiles.length&&"folder"==top.ICEcoder.thisFileFolderType?1:0.3);top.ICEcoder.fMIconVis("fMNewFolder",1==top.ICEcoder.selectedFiles.length&&"folder"==top.ICEcoder.thisFileFolderType?1:0.3);top.ICEcoder.fMIconVis("fMDelete",0<top.ICEcoder.selectedFiles.length?1:0.3);top.ICEcoder.fMIconVis("fMRename",1==top.ICEcoder.selectedFiles.length?
|
||||
1:0.3);top.document.getElementById("fileMenu").style.display="none"},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,b.style.backgroundColor=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-
|
||||
1]==b.id.replace(/\|/g,"/")?"#49d":"select"==a?"#888":b.style.backgroundColor=c?"rgba(255,255,255,0.15)":"transparent",b.style.color="select"==a?"#fff":"#eee")},newFile:function(){top.ICEcoder.newTab();top.ICEcoder.saveFile()},newFolder:function(){var a,b;a=top.ICEcoder.rightClickedFile.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,"|")),top.ICEcoder.serverMessage("<b>Creating Folder</b><br>"+
|
||||
b)},openFile:function(a){var b;a&&(top.ICEcoder.thisFileFolderLink=a,top.ICEcoder.thisFileFolderType="file");!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?-1<top.ICEcoder.openFiles.indexOf(a)&&"/[NEW]"!=a&&(b=!1,top.ICEcoder.switchTab(i+1)):
|
||||
(top.ICEcoder.message("Sorry, you can only have 100 files open at a time!"),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),top.ICEcoder.serverMessage("<b>Opening File</b><br>"+top.ICEcoder.shortURL)):top.ICEcoder.createNewTab(),top.ICEcoder.fMIconVis("fMView",1)))},openPrompt:function(){var a;(a=top.ICEcoder.getInput("Enter relative file path prefixed with /",
|
||||
""))&&top.ICEcoder.openFile(a)},saveFile:function(a){top.ICEcoder.serverQueue("add","lib/file-control.php?action=save&file="+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"").replace(/\//g,"|")+"&fileMDT="+ICEcoder.openFileMDTs[ICEcoder.selectedTab-1]+"&saveType="+(a?"saveAs":"save"));top.ICEcoder.serverMessage("<b>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.rightClickedFile.replace(/\|/g,
|
||||
"/"),a=top.ICEcoder.rightClickedFile.replace(/\|/g,"/"));b||(b=top.ICEcoder.getInput("Please enter the new name for",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.document.getElementById("tab"+(d+1)).innerHTML=closeTabLink+" "+c.slice(c.lastIndexOf("/")).replace(/\//,""),top.document.getElementById("tab"+(d+1)).title=b),top.ICEcoder.serverQueue("add","lib/file-control.php?action=rename&file="+b+"&oldFileName="+a.replace(/\|/g,"/")),top.ICEcoder.serverMessage("<b>Renaming to</b><br>"+b),top.ICEcoder.setPreviousFiles())},deleteFile:function(){var a;0<top.ICEcoder.selectedFiles.length&&(a=top.ICEcoder.ask("Delete:\n\n"+top.ICEcoder.selectedFiles.toString().replace(/\|/g,
|
||||
"/").replace(/,/g,"\n")+"?"));if(a){a="";for(var b=0;b<top.ICEcoder.selectedFiles.length;b++)a+=top.ICEcoder.selectedFiles[b],b<top.ICEcoder.selectedFiles.length-1&&(a+=";");top.ICEcoder.serverQueue("add","lib/file-control.php?action=delete&file="+a);top.ICEcoder.serverMessage("<b>Deleting File</b><br>"+top.ICEcoder.selectedFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n"))}},copyFile:function(a){top.ICEcoder.copiedFile=a;top.document.getElementById("fmMenuPasteOption").style.display="block";
|
||||
top.ICEcoder.hideFileMenu()},pasteFile:function(a){top.ICEcoder.copiedFile?(top.ICEcoder.serverQueue("add","lib/file-control.php?action=paste&file="+top.ICEcoder.copiedFile+"&location="+a),top.ICEcoder.serverMessage("<b>Pasting File</b><br>"+top.ICEcoder.copiedFile.toString().replace(/\|/g,"/").replace(/,/g,"\n"))):top.ICEcoder.message("Nothing to paste, copy a file/folder first!")},uploadFilesSelect:function(a){top.document.getElementById("uploadDir").value=a;top.document.getElementById("fileInput").click()},
|
||||
@@ -44,17 +44,17 @@ document.findAndReplace.replaceAction.value&&f.getSelection().toLowerCase()==a?f
|
||||
f.getCursor(),!0);e.findNext();e.from()||(e=f.getSearchCursor(a,{line:0,ch:0},!0),e.findNext());f.setSelection(e.from(),e.to());f.focus();top.ICEcoder.findMode=!0}return!0}e.innerHTML="No results";return!1}if(""!=a&&c){filesQS=e=f="";"and"==document.findAndReplace.connector.value&&(f="&replace="+d);0<=document.findAndReplace.target.value.indexOf("file")&&(e="&target="+document.findAndReplace.target.value.replace(/ /g,"-"));if("selected files"==document.findAndReplace.target.value){filesQS="&selectedFiles=";
|
||||
for(d=0;d<top.ICEcoder.selectedFiles.length;d++)filesQS+=top.ICEcoder.selectedFiles[d]+":";filesQS=filesQS.replace(/\:$/,"")}a=a.replace(/\'/g,"'");a!=encodeURIComponent(a)?a="ICEcoder:"+encodeURIComponent(a):a;top.ICEcoder.showHide("show",top.document.getElementById("loadingMask"));top.document.getElementById("mediaContainer").innerHTML='<iframe src="lib/multiple-results.php?find='+a+f+e+filesQS+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>'}},replaceInFile:function(a,b,
|
||||
c){top.ICEcoder.serverQueue("add","lib/file-control.php?action=replaceText&fileRef="+a.replace(/\//g,"|")+"&find="+b+"&replace="+c);top.ICEcoder.serverMessage("<b>Replacing text in</b><br>"+a)},getNestLocation:function(a){var b,c,d;if(b=ICEcoder.getcMInstance()){c=b.getValue();b=b.getTokenAt(b.getCursor()).state;if("undefined"!=typeof b.curState){ICEcoder.htmlTagArray=[];for(d=b.curState.htmlState.context;d;d=d.prev)"undefined"!=typeof d.tagName&&ICEcoder.htmlTagArray.unshift(d.tagName)}ICEcoder.tagString=
|
||||
ICEcoder.htmlTagArray[ICEcoder.htmlTagArray.length-1];"JavaScript"==ICEcoder.caretLocType&&(ICEcoder.tagString="script");if(a&&!top.ICEcoder.dontUpdateNest&&(ICEcoder.nestDisplay.innerHTML="","undefined"!=typeof ICEcoder.openFiles[ICEcoder.selectedTab-1]&&(a=ICEcoder.openFiles[ICEcoder.selectedTab-1],0>["js","coffee","rb","css","less"].indexOf(a.split(".")[1])&&-1==c.indexOf("include(")&&-1==c.indexOf("include_once(")&&(-1<c.indexOf("<html")||-1<c.indexOf("<body"))))){for(a=0;a<ICEcoder.htmlTagArray.length;a++)c=
|
||||
ICEcoder.htmlTagArray[ICEcoder.htmlTagArray.length-1];"JavaScript"==ICEcoder.caretLocType&&(ICEcoder.tagString="script");if(a&&!top.ICEcoder.dontUpdateNest&&(ICEcoder.nestDisplay.innerHTML="","undefined"!=typeof ICEcoder.openFiles[ICEcoder.selectedTab-1]&&(a=ICEcoder.openFiles[ICEcoder.selectedTab-1],0>["js","coffee","css","less"].indexOf(a.split(".")[1])&&-1==c.indexOf("include(")&&-1==c.indexOf("include_once(")&&(-1<c.indexOf("<html")||-1<c.indexOf("<body"))))){for(a=0;a<ICEcoder.htmlTagArray.length;a++)c=
|
||||
'onMouseover="top.ICEcoder.highlightBlock('+a+')" onMouseout="top.ICEcoder.highlightBlock('+a+",'hide')\" onClick=\"top.ICEcoder.setPosition("+a+",top.ICEcoder.startPosLine,'"+ICEcoder.htmlTagArray[a]+"')\"",0==a&&(ICEcoder.nestDisplay.innerHTML+="<div "+c+' style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif)"></div>'),ICEcoder.nestDisplay.innerHTML+="<a "+c+' style="display: inline-block; cursor: pointer; background: #333; padding: 7px 2px 7px 7px; margin-top: -5px; height: 30px">'+
|
||||
ICEcoder.htmlTagArray[a]+"</a>",ICEcoder.nestDisplay.innerHTML+=a<ICEcoder.htmlTagArray.length-1?"<div "+c+' style="display: inline-block; width: 8px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); background-position: -7px 0; cursor: pointer"></div>':"<div "+c+' style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); background-position: -15px 0; cursor: pointer"></div>';"undefined"!=typeof b.curState&&
|
||||
0<ICEcoder.htmlTagArray.length&&(ICEcoder.nestDisplay.innerHTML+='<a style="display: inline-block; cursor: default; padding: 7px 2px 7px 7px; margin-top: -5px; height: 30px; color: #666">'+(b.curState.tagName?b.curState.tagName:"content")+"</a>")}}},updateNestingIndicator:function(){var a,b,c;a=ICEcoder.getcMInstance();b=!0;c=ICEcoder.openFiles[ICEcoder.selectedTab-1];a&&(c&&-1==["js","coffee","rb","css","less"].indexOf(c.split(".")[1]))&&(b="error"!=a.getTokenAt({line:a.lineCount(),ch:a.lineInfo(a.lineCount()-
|
||||
0<ICEcoder.htmlTagArray.length&&(ICEcoder.nestDisplay.innerHTML+='<a style="display: inline-block; cursor: default; padding: 7px 2px 7px 7px; margin-top: -5px; height: 30px; color: #666">'+(b.curState.tagName?b.curState.tagName:"content")+"</a>")}}},updateNestingIndicator:function(){var a,b,c;a=ICEcoder.getcMInstance();b=!0;c=ICEcoder.openFiles[ICEcoder.selectedTab-1];a&&(c&&-1==["js","coffee","css","less"].indexOf(c.split(".")[1]))&&(b="error"!=a.getTokenAt({line:a.lineCount(),ch:a.lineInfo(a.lineCount()-
|
||||
1).text.length}).className?!0:!1);ICEcoder.nestValid.style.background=b?"#0b0":"#f00";ICEcoder.nestValid.title=b?"Nesting OK":"Nesting Broken"},getCaretPosition:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=a.getValue();c=a.getCursor().line;a=a.getCursor().ch;for(var e=d=0;e<c;e++)d=b.indexOf("\n",d),d+=1;ICEcoder.caretPos=d+a-1;ICEcoder.getNestLocation("yes")},updateCharDisplay:function(){var a;a=ICEcoder.getcMInstance();ICEcoder.caretLocationType();ICEcoder.charDisplay.innerHTML=ICEcoder.caretLocType+
|
||||
", Line: "+(a.getCursor().line+1)+", Char: "+a.getCursor().ch},caretLocationType:function(){var a,b;a=ICEcoder.getcMInstance();b="Unknown";a=a.getValue().substr(0,ICEcoder.caretPos+1);a.lastIndexOf("<script")>a.lastIndexOf("\x3c/script>")&&"Unknown"==b?b="JavaScript":a.lastIndexOf("<?")>a.lastIndexOf("?>")&&"Unknown"==b?b="PHP":a.lastIndexOf("<%")>a.lastIndexOf("%>")&&"Unknown"==b?b="Ruby":a.lastIndexOf("<")>a.lastIndexOf(">")&&"Unknown"==b?b="HTML":"Unknown"==b&&(b="Content");a=ICEcoder.openFiles[ICEcoder.selectedTab-
|
||||
1];0<a.indexOf(".js")?b="JavaScript":0<a.indexOf(".coffee")?b="CoffeeScript":0<a.indexOf(".rb")?b="Ruby":0<a.indexOf(".css")?b="CSS":0<a.indexOf(".less")?b="LESS":0<a.indexOf(".md")&&(b="Markdown");ICEcoder.caretLocType=b},redoChangedContent:function(a){var b,c;b=ICEcoder.getcMInstance();c=a.keyCode?a.keyCode:a.which?a.which:a.charCode;if(!a.ctrlKey&&27!=c&&20!=c&&(16>c||19<c)&&(37>c||40<c)&&(144!=c||145!=c)&&(45!=c||46!=c)&&(33>c||36<c)&&(91!=c||92!=c)&&(112>c||123<c))ICEcoder.changedContent[ICEcoder.selectedTab-
|
||||
1]=0<b.historySize().undo?1:0,ICEcoder.redoTabHighlight(ICEcoder.selectedTab)},showHide:function(a,b){b.style.visibility="show"==a?"visible":"hidden"},getcMInstance:function(a){return top.ICEcoder.content.contentWindow["new"==a||"new"!=a&&0<ICEcoder.openFiles.length?"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1"]},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"!=b&&
|
||||
(top.ICEcoder.mouseY+=90);"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;if(!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&&(a=window.innerWidth?window.innerHeight:document.body.clientHeight,top.ICEcoder.mouseDown||(top.ICEcoder.draggingFilesW=!1),a=!ICEcoder.draggingTab&&(top.ICEcoder.mouseX>top.ICEcoder.filesW-7&&top.ICEcoder.mouseX<top.ICEcoder.filesW+7&&40<top.ICEcoder.mouseY&&top.ICEcoder.mouseY<a-30||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=document.getElementById("serverMessage");a?(b.innerHTML=a,b.style.display="inline-block"):setTimeout(function(){b.style.display="none"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b,c,d;a=ICEcoder.getcMInstance();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=
|
||||
1];0<a.indexOf(".js")?b="JavaScript":0<a.indexOf(".coffee")?b="CoffeeScript":0<a.indexOf(".py")?b="Python":0<a.indexOf(".rb")?b="Ruby":0<a.indexOf(".css")?b="CSS":0<a.indexOf(".less")?b="LESS":0<a.indexOf(".md")&&(b="Markdown");ICEcoder.caretLocType=b},redoChangedContent:function(a){var b,c;b=ICEcoder.getcMInstance();c=a.keyCode?a.keyCode:a.which?a.which:a.charCode;if(!a.ctrlKey&&27!=c&&20!=c&&(16>c||19<c)&&(37>c||40<c)&&(144!=c||145!=c)&&(45!=c||46!=c)&&(33>c||36<c)&&(91!=c||92!=c)&&(112>c||123<
|
||||
c))ICEcoder.changedContent[ICEcoder.selectedTab-1]=0<b.historySize().undo?1:0,ICEcoder.redoTabHighlight(ICEcoder.selectedTab)},showHide:function(a,b){b.style.visibility="show"==a?"visible":"hidden"},getcMInstance:function(a){return top.ICEcoder.content.contentWindow["new"==a||"new"!=a&&0<ICEcoder.openFiles.length?"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1"]},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"!=b&&(top.ICEcoder.mouseY+=90);"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;if(!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&&(a=window.innerWidth?window.innerHeight:document.body.clientHeight,top.ICEcoder.mouseDown||(top.ICEcoder.draggingFilesW=!1),a=!ICEcoder.draggingTab&&(top.ICEcoder.mouseX>top.ICEcoder.filesW-7&&top.ICEcoder.mouseX<top.ICEcoder.filesW+7&&40<top.ICEcoder.mouseY&&top.ICEcoder.mouseY<a-30||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=document.getElementById("serverMessage");a?(b.innerHTML=a,b.style.display="inline-block"):setTimeout(function(){b.style.display="none"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b,c,d;a=ICEcoder.getcMInstance();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.document.getElementById("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.document.getElementById("header").appendChild(b),a.addWidget(a.getCursor(),top.document.getElementById("cssColor"),!0))},showColorPicker:function(a){top.document.getElementById("blackMask").style.visibility="visible";top.document.getElementById("mediaContainer").innerHTML='<div id="picker" class="picker"></div><br><br><input type="text" id="color" name="color" value="#123456" style="border: 0; width: 70px; padding-left: 5px"><input type="button" onClick="top.ICEcoder.insertColorValue()" value="insert >" style="background: #888; color: #fff; height: 18px; width: 70px; border: 0; margin-left: 5px; cursor: pointer">';
|
||||
farbtastic("picker","color");a&&top.document.getElementById("picker").farbtastic.setColor(a)},drawCanvasImage:function(a){var b=document.getElementById("canvasPicker").getContext("2d"),c=new Image;c.src=a.src;c.onload=function(){document.getElementById("canvasPicker").width=a.width;document.getElementById("canvasPicker").height=a.height;b.drawImage(c,0,0,a.width,a.height)};document.getElementById("canvasPicker").onmousemove=function(a){var c=b.getImageData(a.pageX-this.offsetLeft,a.pageY-this.offsetTop,
|
||||
|
||||
Reference in New Issue
Block a user