Code condensing

pB var setup to avoid repeating long DOM elem refs again
Removed end point from substr, not necessary
Put 3 x themes into an array and test using indexOf instead
Syntax spacing in a couple of areas
This commit is contained in:
Matt Pass
2012-10-08 07:37:08 +01:00
parent 0d55f3bd81
commit ee0303dc06

View File

@@ -1318,7 +1318,7 @@ var ICEcoder = {
if (oldBlock) {oldBlock.parentNode.removeChild(oldBlock)};
if (top.ICEcoder.codeAssist && top.ICEcoder.caretLocType=="CSS") {
newBlock = top.document.createElement("div");
newBlock.id="cssColor";
newBlock.id = "cssColor";
newBlock.style.position = "absolute";
newBlock.style.display = "block";
newBlock.style.width = newBlock.style.height = "20px";
@@ -1472,9 +1472,13 @@ var ICEcoder = {
// Refresh file manager on demand
refreshFileManager: function() {
top.document.getElementById('progressBar').style.webkitAnimation = top.document.getElementById('progressBar').style.mozAnimation = '';
var pB;
pB = top.document.getElementById('progressBar').style;
pB.webkitAnimation = pB.mozAnimation = '';
setTimeout(function () {
top.document.getElementById('progressBar').style.webkitAnimation = top.document.getElementById('progressBar').style.mozAnimation = 'fullexpand 10s ease-out';
pB.webkitAnimation = pB.mozAnimation = 'fullexpand 10s ease-out';
}, 4);
top.ICEcoder.showHide('show',top.document.getElementById('loadingMask'));
top.ICEcoder.filesFrame.src="files.php";
@@ -1517,7 +1521,7 @@ var ICEcoder = {
styleNode.setAttribute('type', 'text/css');
styleNode.setAttribute('href', themeURL);
top.ICEcoder.content.contentWindow.document.getElementsByTagName('head')[0].appendChild(styleNode);
activeLineBG = top.theme=="eclipse"||top.theme=="elegant"||top.theme=="neat" ? "#ccc": "#000";
activeLineBG = ["eclipse","elegant","neat"].indexOf(top.theme)>-1 ? "#ccc": "#000";
top.ICEcoder.switchTab(top.ICEcoder.selectedTab);
// Tabs indent setting
@@ -1593,7 +1597,6 @@ var ICEcoder = {
}
screenIcon.src = screenIcon.src.indexOf("images/full-screen.gif") > -1 ? "images/restored-screen.gif" : "images/full-screen.gif";
},
// Pass target file/folder to Zip It!
@@ -1621,10 +1624,10 @@ var ICEcoder = {
handleDrop: function(e) {
if (e.stopPropagation) {e.stopPropagation()}
if (ICEcoder.dragSrcEl != this) {
ICEcoder.dragSrcEl.innerHTML = this.innerHTML.split(" ")[0] + ICEcoder.dragSrcEl.innerHTML.substr(ICEcoder.dragSrcEl.innerHTML.indexOf(" "),ICEcoder.dragSrcEl.innerHTML.length);
this.innerHTML = e.dataTransfer.getData('text/html').split(" ")[0] + this.innerHTML.substr(this.innerHTML.indexOf(" "),this.innerHTML.length);
var dragID = ICEcoder.dragSrcEl.id.substr(3,ICEcoder.dragSrcEl.id.length)*1;
var dropID = this.id.substr(3,this.id.length)*1;
ICEcoder.dragSrcEl.innerHTML = this.innerHTML.split(" ")[0] + ICEcoder.dragSrcEl.innerHTML.substr(ICEcoder.dragSrcEl.innerHTML.indexOf(" "));
this.innerHTML = e.dataTransfer.getData('text/html').split(" ")[0] + this.innerHTML.substr(this.innerHTML.indexOf(" "));
var dragID = ICEcoder.dragSrcEl.id.substr(3)*1;
var dropID = this.id.substr(3)*1;
if(dragID==top.ICEcoder.selectedTab) {
var a; // array value
var b = dragID-1;