mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-06 16:46:48 +01:00
Making JS Google Compiler compatible
Needed to alter a few things to make it Compiler compatible. These include stop using </textarea> even if it's in a comment, escape it when using it as a string, comment tag openings need to be escaped too, plus we cannot use char as a var, so renamed many references to ch instead. Finally, needed to escape the ' apos ref to avoid issues there.
This commit is contained in:
@@ -155,12 +155,12 @@ 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 Ruby, 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) {
|
||||
cM = ICEcoder.getcMInstance();
|
||||
content = cM.getValue();
|
||||
content = content.replace(/<ICEcoder:\/:textarea>/g,'</textarea>');
|
||||
content = content.replace(/<ICEcoder:\/:textarea>/g,'<\/textarea>');
|
||||
|
||||
// Then set the content in the editor & clear the history
|
||||
cM.setValue(content);
|
||||
@@ -267,14 +267,14 @@ var ICEcoder = {
|
||||
}
|
||||
} else {
|
||||
if (cM.somethingSelected()) {
|
||||
cM.replaceSelection(cM.getSelection().slice(0,4)!="<!--"
|
||||
? "<!--" + cM.getSelection() + "//-->"
|
||||
cM.replaceSelection(cM.getSelection().slice(0,4)!="<\!--"
|
||||
? "<\!--" + cM.getSelection() + "//-->"
|
||||
: cM.getSelection().slice(4,cM.getSelection().length-5));
|
||||
} else {
|
||||
cM.setLine(linePos, lineContent.slice(0,4)!="<!--"
|
||||
? "<!--" + lineContent + "//-->"
|
||||
cM.setLine(linePos, lineContent.slice(0,4)!="<\!--"
|
||||
? "<\!--" + lineContent + "//-->"
|
||||
: lineContent.slice(4,lCLen).slice(0,lCLen-9));
|
||||
adjustCursor = lineContent.slice(0,4)=="<!--" ? -4 : 4;
|
||||
adjustCursor = lineContent.slice(0,4)=="<\!--" ? -4 : 4;
|
||||
}
|
||||
}
|
||||
if (!cM.somethingSelected()) {cM.setCursor(linePos, cursorPos+adjustCursor)};
|
||||
@@ -334,22 +334,21 @@ var ICEcoder = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Set our cursor position upon mouse click of the nest position
|
||||
setPosition: function(nestPos,line,tag) {
|
||||
var cM, char, charPos;
|
||||
var cM, ch, chPos;
|
||||
|
||||
cM = ICEcoder.getcMInstance();
|
||||
// Set our char position just after the tag, and refocus on the editor
|
||||
char = cM.getLine(line).indexOf(">",cM.getLine(line).indexOf("<"+tag))+1;
|
||||
cM.setCursor(line,char);
|
||||
// Set our ch position just after the tag, and refocus on the editor
|
||||
ch = cM.getLine(line).indexOf(">",cM.getLine(line).indexOf("<"+tag))+1;
|
||||
cM.setCursor(line,ch);
|
||||
cM.focus();
|
||||
// Now update nest display to this nest depth & without any HTML tags to kill further interactivity
|
||||
charPos = 0;
|
||||
chPos = 0;
|
||||
for (var i=0;i<=nestPos;i++) {
|
||||
charPos = ICEcoder.nestDisplay.innerHTML.indexOf(">",charPos+1);
|
||||
chPos = ICEcoder.nestDisplay.innerHTML.indexOf(">",chPos+1);
|
||||
}
|
||||
ICEcoder.nestDisplay.innerHTML = ICEcoder.nestDisplay.innerHTML.substr(0,charPos).replace(/<(?:.|\n)*?>/gm, '');
|
||||
ICEcoder.nestDisplay.innerHTML = ICEcoder.nestDisplay.innerHTML.substr(0,chPos).replace(/<(?:.|\n)*?>/gm, '');
|
||||
top.ICEcoder.dontUpdateNest = false;
|
||||
top.ICEcoder.dontSelect = true;
|
||||
},
|
||||
@@ -1001,7 +1000,7 @@ var ICEcoder = {
|
||||
}
|
||||
filesQS = filesQS.replace(/\:$/,"");
|
||||
}
|
||||
find = find.replace(/\'/g, ''');
|
||||
find = find.replace(/\'/g, '\'');
|
||||
find != encodeURIComponent(find) ? find = 'ICEcoder:'+encodeURIComponent(find) : find;
|
||||
top.ICEcoder.showHide('show',top.document.getElementById('loadingMask'));
|
||||
top.document.getElementById('mediaContainer').innerHTML = '<iframe src="lib/multiple-results.php?find='+find+replaceQS+targetQS+filesQS+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>';
|
||||
@@ -1088,18 +1087,18 @@ var ICEcoder = {
|
||||
|
||||
// Get the caret position
|
||||
getCaretPosition: function() {
|
||||
var cM, content, line, char, charPos, charCount;
|
||||
var cM, content, line, ch, chPos, chCount;
|
||||
|
||||
cM = ICEcoder.getcMInstance();
|
||||
content = cM.getValue();
|
||||
line = cM.getCursor().line;
|
||||
char = cM.getCursor().ch;
|
||||
charPos = 0;
|
||||
ch = cM.getCursor().ch;
|
||||
chPos = 0;
|
||||
for (var i=0;i<line;i++) {
|
||||
charCount = content.indexOf("\n",charPos);
|
||||
charPos=charCount+1;
|
||||
chCount = content.indexOf("\n",chPos);
|
||||
chPos=chCount+1;
|
||||
}
|
||||
ICEcoder.caretPos=(charPos+char-1);
|
||||
ICEcoder.caretPos=(chPos+ch-1);
|
||||
ICEcoder.getNestLocation('yes');
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user