From cafa9d521a3e235db1d53128c252284caec472c3 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Mon, 6 May 2013 15:57:28 +0100 Subject: [PATCH] Making JS Google Compiler compatible Needed to alter a few things to make it Compiler compatible. These include stop using 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. --- lib/ice-coder.js | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 1e81c6d..9e88d16 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -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 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(//g,''); + content = content.replace(//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.replaceSelection(cM.getSelection().slice(0,4)!="<\!--" + ? "<\!--" + cM.getSelection() + "//-->" : cM.getSelection().slice(4,cM.getSelection().length-5)); } else { - cM.setLine(linePos, lineContent.slice(0,4)!="" + cM.setLine(linePos, lineContent.slice(0,4)!="<\!--" + ? "<\!--" + lineContent + "//-->" : lineContent.slice(4,lCLen).slice(0,lCLen-9)); - adjustCursor = lineContent.slice(0,4)=="