Ternary shortening htmlTagArray & getcMInstance

Reduced & simplified code to get the same result
This commit is contained in:
Matt Pass
2012-07-20 17:30:27 +01:00
parent 948978b5e1
commit caca296562

View File

@@ -173,13 +173,8 @@ var ICEcoder = {
if (!ICEcoder.codeBlock) {
// OK, we can do something further as we're not in a code block
// If it's the same as the previously logged tag preceeded by /, it's the equivalent end tag
if (tagEnd=="/"+ICEcoder.htmlTagArray[ICEcoder.htmlTagArray.length-1]) {
// So remove the last logged tag, thereby going up one in the nest
ICEcoder.htmlTagArray.pop();
} else {
// Otherwise it's a different tag, add it to the end
ICEcoder.htmlTagArray.push(tagString);
}
// so remove the last logged tag, thereby going up one in the nest, otherwise it's a different tag, add it to the end
tagEnd=="/"+ICEcoder.htmlTagArray[ICEcoder.htmlTagArray.length-1] ? ICEcoder.htmlTagArray.pop() : ICEcoder.htmlTagArray.push(tagString);
} else if (
((ICEcoder.tagStart=="script"||ICEcoder.tagStart=="/script")&&tagEndJS=="</script")||
((ICEcoder.tagStart=="?php"||ICEcoder.tagStart=="?")&&tagEnd=="?")||
@@ -1051,11 +1046,11 @@ var ICEcoder = {
getcMInstance: function(newTab) {
var cM;
if (newTab=="new"||(newTab!="new" && ICEcoder.openFiles.length>0)) {
cM = top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[ICEcoder.selectedTab-1]];
} else {
cM = top.ICEcoder.content.contentWindow['cM1'];
}
cM = top.ICEcoder.content.contentWindow[
newTab=="new"||(newTab!="new" && ICEcoder.openFiles.length>0)
? 'cM'+ICEcoder.cMInstances[ICEcoder.selectedTab-1]
: 'cM1'
];
return cM;
},