New color settings added, BG image removed

tabBGopen now a lighter color, plus tabFGcurrent and tabFGopenFile
colors added
Removed bgVPos and no longer setting BG position as we're not using an
image anymore
(Instead we set either the current or open tabBG color
We also set the FG color of the filename to current or openFile
This commit is contained in:
Matt Pass
2013-06-05 18:11:54 +01:00
parent ce481b0f25
commit 8db478d8f0
2 changed files with 31 additions and 27 deletions

View File

@@ -32,9 +32,11 @@ var ICEcoder = {
tabLeftPos: [], // Left position of tabs inside content area
tabBGcurrent: '#141414', // BG of current tab
tabBGselected: '#49d', // BG of selected tab
tabBGopen: '#888', // BG of open tab
tabBGopen: '#aaa', // BG of open tab
tabBGnormal: 'transparent', // BG of normal tab
tabFGcurrent: '#fff', // FG of selected tab
tabFGselected: '#fff', // FG of selected tab
tabFGopenFile: '#000', // FG of open file
tabFGnormalFile: '#eee', // FG of normal file
tabFGnormalTab: '#000', // FG of normal tab
serverQueueItems: [], // Array of URLs to call in order
@@ -586,7 +588,7 @@ var ICEcoder = {
? top.ICEcoder.tabBGselected : file.style.backgroundColor = isOpen
? top.ICEcoder.tabBGopen : top.ICEcoder.tabBGnormal;
}
file.style.color= action=="select" ? top.ICEcoder.tabFGselected : top.ICEcoder.tabFGnormalFile;
file.style.color = action=="select" ? top.ICEcoder.tabFGselected : top.ICEcoder.tabFGnormalFile;
}
},
@@ -1856,7 +1858,7 @@ var ICEcoder = {
// Reset all tabs to be without a highlight and then highlight the selected
redoTabHighlight: function(selectedTab) {
var bgVPos, tColor, fileLink;
var tColor, fileLink;
for(var i=1;i<=ICEcoder.changedContent.length;i++) {
if (document.getElementById('tab'+i).childNodes[0]) {
@@ -1866,11 +1868,13 @@ var ICEcoder = {
tColor = i==selectedTab ? top.ICEcoder.tabFGselected : top.ICEcoder.tabFGnormalTab;
if ("undefined" != typeof top.ICEcoder.openFiles[i-1] && top.ICEcoder.openFiles[i-1] != "/[NEW]") {
fileLink = top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.openFiles[i-1].replace(/\//g,"|"));
if (fileLink) {fileLink.style.backgroundColor = i==selectedTab ? top.ICEcoder.tabBGcurrent : top.ICEcoder.tabBGopen;};
if (fileLink) {
fileLink.style.backgroundColor = i==selectedTab ? top.ICEcoder.tabBGcurrent : top.ICEcoder.tabBGopen;
fileLink.style.color = i==selectedTab ? top.ICEcoder.tabFGcurrent : top.ICEcoder.tabFGopenFile;
};
}
document.getElementById('tab'+i).style.color = tColor;
bgVPos = i==selectedTab ? -22 : 0;
document.getElementById('tab'+i).style.backgroundPosition = "0 "+bgVPos+"px";
document.getElementById('tab'+i).style.background = i==selectedTab ? top.ICEcoder.tabBGcurrent : top.ICEcoder.tabBGopen;
}
top.ICEcoder.fMIconVis('fMSave',ICEcoder.changedContent[selectedTab-1]==1 ? 1 : 0.3);
},

42
lib/ice-coder.min.js vendored
View File

@@ -1,5 +1,5 @@
var get=function(a){return top.document.getElementById(a)},ICEcoder={filesW:250,minFilesW:14,maxFilesW:250,selectedTab:0,changedContent:[],canSwitchTabs:!0,openFiles:[],openFileMDTs:[],cMInstances:[],nextcMInstance:1,selectedFiles:[],findMode:!1,lockedNav:!0,htmlTagArray:[],codeAssist:!0,mouseDown:!1,draggingFilesW:!1,draggingTab:!1,tabLeftPos:[],tabBGcurrent:"#141414",tabBGselected:"#49d",tabBGopen:"#888",tabBGnormal:"transparent",tabFGselected:"#fff",tabFGnormalFile:"#eee",tabFGnormalTab:"#000",
serverQueueItems:[],previewWindow:!1,pluginIntervalRefs:[],overPopup:!1,ready:!1,initAliases:function(){for(var a="header files account fmLock filesFrame editor tabsBar findBar content footer system nestValid nestDisplay charDisplay byteDisplay".split(" "),b=0;b<a.length;b++)ICEcoder[a[b]]=top.get(a[b])},init:function(){var a,b;ICEcoder.setLayout();top.ICEcoder.showHide("hide",top.get("loadingMask"));top.ICEcoder.openLastFiles&&top.ICEcoder.autoOpenFiles();setInterval(ICEcoder.updateNestingIndicator,
var get=function(a){return top.document.getElementById(a)},ICEcoder={filesW:250,minFilesW:14,maxFilesW:250,selectedTab:0,changedContent:[],canSwitchTabs:!0,openFiles:[],openFileMDTs:[],cMInstances:[],nextcMInstance:1,selectedFiles:[],findMode:!1,lockedNav:!0,htmlTagArray:[],codeAssist:!0,mouseDown:!1,draggingFilesW:!1,draggingTab:!1,tabLeftPos:[],tabBGcurrent:"#141414",tabBGselected:"#49d",tabBGopen:"#aaa",tabBGnormal:"transparent",tabFGcurrent:"#fff",tabFGselected:"#fff",tabFGopenFile:"#000",tabFGnormalFile:"#eee",
tabFGnormalTab:"#000",serverQueueItems:[],previewWindow:!1,pluginIntervalRefs:[],overPopup:!1,ready:!1,initAliases:function(){for(var a="header files account fmLock filesFrame editor tabsBar findBar content footer system nestValid nestDisplay charDisplay byteDisplay".split(" "),b=0;b<a.length;b++)ICEcoder[a[b]]=top.get(a[b])},init:function(){var a,b;ICEcoder.setLayout();top.ICEcoder.showHide("hide",top.get("loadingMask"));top.ICEcoder.openLastFiles&&top.ICEcoder.autoOpenFiles();setInterval(ICEcoder.updateNestingIndicator,
30);a=top.get("screenMode");b=["images/restored-screen.gif","images/full-screen.gif"];document.addEventListener("fullscreenchange",function(){a.src=document.fullscreen?b[0]:b[1]},!1);document.addEventListener("mozfullscreenchange",function(){a.src=document.mozFullScreen?b[0]:b[1]},!1);document.addEventListener("webkitfullscreenchange",function(){a.src=document.webkitIsFullScreen?b[0]:b[1]},!1);top.ICEcoder.ready=!0},setLayout:function(a){var b,c;b=window.innerWidth?window.innerWidth:document.body.clientWidth;
c=window.innerHeight?window.innerHeight:document.body.clientHeight;this.header.style.width=this.tabsBar.style.width=this.findBar.style.width=b+"px";this.files.style.width=this.editor.style.left=this.filesW+"px";this.account.style.height=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)},
@@ -86,22 +86,22 @@ ICEcoder.setLayout();ICEcoder.thisFileFolderType="file";ICEcoder.thisFileFolderL
"");top.get("tab"+top.ICEcoder.openFiles.length).title="/"+top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1].replace(/\//,"");top.ICEcoder.setTabWidths();top.ICEcoder.redoTabHighlight(top.ICEcoder.openFiles.length);top.ICEcoder.selectedTab=top.ICEcoder.openFiles.length;top.ICEcoder.changedContent.push(0);top.ICEcoder.setPreviousFiles()},nextTab:function(){top.ICEcoder.switchTab(top.ICEcoder.selectedTab+1<=top.ICEcoder.openFiles.length?top.ICEcoder.selectedTab+1:1,"noFocus")},previousTab:function(){top.ICEcoder.switchTab(1<=
top.ICEcoder.selectedTab-1?top.ICEcoder.selectedTab-1:top.ICEcoder.openFiles.length,"noFocus")},renameTab:function(a,b){var c;top.ICEcoder.openFiles[a-1]=b;c=top.ICEcoder.openFiles[a-1];top.get("tab"+a).innerHTML='<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.slice(c.lastIndexOf("/")).replace(/\//,"");top.get("tab"+a).title="/"+top.ICEcoder.openFiles[a-1].replace(/\//,"")},redoTabHighlight:function(a){for(var b,c,d=1;d<=ICEcoder.changedContent.length;d++){document.getElementById("tab"+d).childNodes[0]&&(document.getElementById("tab"+d).childNodes[0].childNodes[0].style.backgroundColor=1==ICEcoder.changedContent[d-1]?"#b00":"transparent");b=d==a?top.ICEcoder.tabFGselected:top.ICEcoder.tabFGnormalTab;if("undefined"!=typeof top.ICEcoder.openFiles[d-1]&&
"/[NEW]"!=top.ICEcoder.openFiles[d-1]&&(c=top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.openFiles[d-1].replace(/\//g,"|"))))c.style.backgroundColor=d==a?top.ICEcoder.tabBGcurrent:top.ICEcoder.tabBGopen;document.getElementById("tab"+d).style.color=b;b=d==a?-22:0;document.getElementById("tab"+d).style.backgroundPosition="0 "+b+"px"}top.ICEcoder.fMIconVis("fMSave",1==ICEcoder.changedContent[a-1]?1:0.3)},closeTab:function(a,b){var c;ICEcoder.getcMInstance();c=!0;1==ICEcoder.changedContent[a-
1]&&(c=top.ICEcoder.ask("You have made changes.\n\nAre you sure you want to close without saving?"));if(c){c=top.ICEcoder.openFiles[a-1];for(var d=a;d<ICEcoder.openFiles.length;d++)top.get("tab"+d).innerHTML=top.get("tab"+(d+1)).innerHTML,top.get("tab"+d).title=top.get("tab"+(d+1)).title,ICEcoder.openFiles[d-1]=ICEcoder.openFiles[d],ICEcoder.openFileMDTs[d-1]=ICEcoder.openFileMDTs[d];ICEcoder.content.contentWindow["cM"+top.ICEcoder.cMInstances[a-1]].getWrapperElement().style.display="none";top.ICEcoder.cMInstances.splice(a-
1,1);top.get("tab"+ICEcoder.openFiles.length).style.display="none";top.get("tab"+ICEcoder.openFiles.length).innerHTML="";top.get("tab"+ICEcoder.openFiles.length).title="";ICEcoder.openFiles.pop();ICEcoder.openFileMDTs.pop();ICEcoder.selectedTab==a&&(0<ICEcoder.openFiles.length?ICEcoder.selectedTab-=1:ICEcoder.selectedTab=0);0<ICEcoder.openFiles.length&&0==ICEcoder.selectedTab&&(ICEcoder.selectedTab=1);0==ICEcoder.openFiles.length?top.ICEcoder.fMIconVis("fMView",0.3):(ICEcoder.switchMode(),ICEcoder.switchTab(ICEcoder.selectedTab));
top.ICEcoder.changedContent.splice(a-1,1);top.ICEcoder.redoTabHighlight(ICEcoder.selectedTab);top.ICEcoder.getNestLocation("update");top.ICEcoder.selectDeselectFile("deselect",top.ICEcoder.filesFrame.contentWindow.document.getElementById(c.replace(/\//g,"|")));b||top.ICEcoder.setPreviousFiles()}top.ICEcoder.canSwitchTabs=!1;top.ICEcoder.setTabWidths("posOnlyNewTab");setTimeout(function(){top.ICEcoder.canSwitchTabs=!0},100)},closeAllTabs:function(){if(0<top.ICEcoder.cMInstances.length&&ICEcoder.ask("Close all tabs?"))for(var a=
top.ICEcoder.cMInstances.length;0<a;a--)top.ICEcoder.closeTab(a,1<a?!0:!1)},setTabWidths:function(a){var b,c,d,e,f;if(top.ICEcoder.ready){b=parseInt(top.ICEcoder.content.style.width,10)-41-24-10;c=b/top.ICEcoder.openFiles.length-18;d=-18;e=41;f=0;top.ICEcoder.tabLeftPos=[];for(var g=0;g<top.ICEcoder.openFiles.length;g++)a&&(g=top.ICEcoder.openFiles.length),d=168*top.ICEcoder.openFiles.length>b?parseInt(c*g,10)-parseInt(c*(g-1),10):150,e=0==g?41:parseInt(top.get("tab"+g).style.left,10),f=0==g?0:parseInt(top.get("tab"+
g).style.width,10)+18,a?d=-18:(top.get("tab"+(g+1)).style.left=e+f+"px",top.get("tab"+(g+1)).style.width=d+"px"),top.ICEcoder.tabLeftPos.push(e+f);top.get("newTab").style.left=e+f+d+18+"px"}},tabDragStart:function(a){top.ICEcoder.draggingTab=a;top.ICEcoder.diffStartX=top.ICEcoder.mouseX;top.ICEcoder.tabDragMouseXStart=(top.ICEcoder.mouseX-(parseInt(top.ICEcoder.files.style.width,10)+41+18))%150;top.get("tab"+a).style.zIndex=2;for(var b=1;b<=top.ICEcoder.openFiles.length;b++)top.get("tab"+b).className=
b!==a?"tab tabSlide":"tab tabDrag"},tabDragMove:function(){var a,b;a=parseInt(top.get("tab"+top.ICEcoder.openFiles.length).style.width,10)+18;top.ICEcoder.thisLeft=a=41<=top.ICEcoder.tabDragMouseX?top.ICEcoder.tabDragMouseX<=parseInt(top.get("newTab").style.left,10)-a?top.ICEcoder.tabDragMouseX:parseInt(top.get("newTab").style.left,10)-a:41;top.get("tab"+top.ICEcoder.draggingTab).style.left=a+"px";top.ICEcoder.dragTabNo=top.ICEcoder.draggingTab;for(var c=1;c<=top.ICEcoder.openFiles.length;c++)top.get("tab"+
c).style.opacity=c==top.ICEcoder.draggingTab?1:0.5,b=top.ICEcoder.tabLeftPos[c]?top.ICEcoder.tabLeftPos[c]-top.ICEcoder.tabLeftPos[c-1]:b,c!=top.ICEcoder.draggingTab&&(c<top.ICEcoder.draggingTab?top.get("tab"+c).style.left=a<=top.ICEcoder.tabLeftPos[c-1]?top.ICEcoder.tabLeftPos[c-1]+b:top.ICEcoder.tabLeftPos[c-1]:top.get("tab"+c).style.left=a>=top.ICEcoder.tabLeftPos[c-1]?top.ICEcoder.tabLeftPos[c-1]-b:top.ICEcoder.tabLeftPos[c-1])},tabDragEnd:function(){var a,b;top.ICEcoder.setTabWidths();for(var c=
1;c<=top.ICEcoder.openFiles.length;c++)top.ICEcoder.thisLeft>=top.ICEcoder.tabLeftPos[c-1]&&(a=top.ICEcoder.thisLeft==top.ICEcoder.tabLeftPos[0]?1:top.ICEcoder.dragTabNo>c?c+1:c),top.get("tab"+c).className="tab",top.get("tab"+c).style.opacity=1,c!=top.ICEcoder.dragTabNo?top.get("tab"+c).style.zIndex=1:setTimeout(function(){top.get("tab"+c).style.zIndex=1},150);if(top.ICEcoder.thisLeft&&!1!==top.ICEcoder.thisLeft){b=[];for(c=1;c<=top.ICEcoder.openFiles.length;c++)b.push(c);b.splice(top.ICEcoder.dragTabNo-
1,1);b.splice(a-1,0,top.ICEcoder.dragTabNo);ICEcoder.sortTabs(b)}top.ICEcoder.setTabWidths();top.ICEcoder.draggingTab=!1;top.ICEcoder.thisLeft=!1},sortTabs:function(a){var b,c,d;b=[ICEcoder.changedContent,ICEcoder.openFiles,ICEcoder.openFileMDTs,ICEcoder.cMInstances];c=[[],[],[],[]];for(var e=0;e<b.length;e++){for(var f=0;f<b[e].length;f++)c[e].push(b[e][a[f]-1]);b[e]=c[e]}for(e=0;e<a.length;e++)document.getElementById("tab"+a[e]).id="tab"+(e+1)+".temp",top.ICEcoder.selectedTab==a[e]&&(d=e+1);for(e=
0;e<a.length;e++)document.getElementById("tab"+(e+1)+".temp").id="tab"+(e+1);top.get("tab"+d)&&(top.get("tab"+d).className="tab tabSlide");ICEcoder.changedContent=b[0];ICEcoder.openFiles=b[1];ICEcoder.openFileMDTs=b[2];ICEcoder.cMInstances=b[3];top.ICEcoder.setTabWidths();top.ICEcoder.switchTab(d)},alphaTabs:function(){if(0<top.ICEcoder.openFiles.length){var a,b,c,d,e;a=[];b=[];c=[];for(var f=0;f<top.ICEcoder.openFiles.length;f++)a.push(top.ICEcoder.openFiles[f].slice(top.ICEcoder.openFiles[f].lastIndexOf("/")+
1)),b.push(top.ICEcoder.openFiles[f]),top.get("tab"+(f+1)).className="tab tabSlide";for(;0<a.length;){d=a[0];nextValueFull=b[0];for(f=e=0;f<a.length;f++)a[f]<d&&(d=a[f],nextValueFull=top.ICEcoder.openFiles[top.ICEcoder.openFiles.indexOf(b[f])],e=f);c.push(top.ICEcoder.openFiles.indexOf(nextValueFull)+1);a.splice(e,1);b.splice(e,1)}top.ICEcoder.sortTabs(c)}},interceptKeys:function(a,b){var c;c=b.keyCode?b.keyCode:b.which?b.which:b.charCode;if(46==c&&"files"==a)return top.ICEcoder.deleteFile(),!1;if(b.altKey){if(b.ctrlKey&&
"content"==a){if(68==c)return top.ICEcoder.tagWrapper("div"),!1;if(83==c)return top.ICEcoder.tagWrapper("span"),!1;if(80==c)return top.ICEcoder.tagWrapper("p"),!1;if(65==c)return top.ICEcoder.tagWrapper("a"),!1;if(66==c)return top.ICEcoder.tagWrapper("b"),!1;if(73==c)return top.ICEcoder.tagWrapper("i"),!1;if(71==c)return top.ICEcoder.tagWrapper("strong"),!1;if(69==c)return top.ICEcoder.tagWrapper("em"),!1;if(49==c)return top.ICEcoder.tagWrapper("h1"),!1;if(50==c)return top.ICEcoder.tagWrapper("h2"),
!1;if(51==c)return top.ICEcoder.tagWrapper("h3"),!1;if(52==c)return top.ICEcoder.tagWrapper("h4"),!1;if(53==c)return top.ICEcoder.tagWrapper("h5"),!1;if(54==c)return top.ICEcoder.tagWrapper("h6"),!1;if(55==c)return top.ICEcoder.tagWrapper("h7"),!1;if(13==c)return top.ICEcoder.addLineBreakAtEnd(),!1}return c}return 70==c&&b.ctrlKey?(top.get("find").focus(),!1):71==c&&b.ctrlKey?(top.get("goToLineNo").focus(),!1):73==c&&b.ctrlKey&&"content"==a?(c=top.ICEcoder.caretLocType.toLowerCase()+" ","CSS"==top.ICEcoder.caretLocType||
"PHP"==top.ICEcoder.caretLocType?window.open("http://voke.fm/"+c+top.ICEcoder.getcMInstance().getSelection()):("Content"==top.ICEcoder.caretLocType&&(c=""),window.open("http://www.google.com/#output=search&q="+c+top.ICEcoder.getcMInstance().getSelection())),!1):39==c&&b.ctrlKey&&"content"!=a?(top.ICEcoder.nextTab(),!1):37==c&&b.ctrlKey&&"content"!=a?(top.ICEcoder.previousTab(),!1):38==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.moveLine("up"),!1):40==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.moveLine("down"),
!1):107==c&&b.ctrlKey?("content"==a?top.ICEcoder.duplicateLine():top.ICEcoder.newTab(),!1):109==c&&b.ctrlKey?("content"==a?top.ICEcoder.removeLine():top.ICEcoder.closeTab(top.ICEcoder.selectedTab),!1):83==c&&b.ctrlKey?(b.shiftKey?top.ICEcoder.saveFile("saveAs"):top.ICEcoder.saveFile(),!1):13==c&&b.ctrlKey&&"/[NEW]"!=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]?(window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]),!1):79==c&&b.ctrlKey?(top.ICEcoder.openPrompt(),!1):32==c&&b.ctrlKey&&
"content"==a?(top.ICEcoder.addSnippet(),!1):32==c&&"content"!=a?(top.ICEcoder.getcMInstance().focus(),!1):74==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.jumpToDefinition(),!1):27==c&&"content"==a?(top.ICEcoder.lineCommentToggle(),!1):27==c&&"content"!=a?(top.ICEcoder.cancelAllActions(),!1):c},resetKeys:function(){},addSnippet:function(){var a,b,c;a=ICEcoder.getcMInstance();b=a.getCursor().line;c=a.getLine(b).length-a.getLine(b).replace(/^\s\s*/,"").length;a=a.getLine(b).slice(c);"function"==a.slice(0,
8)?top.ICEcoder.doSnippet("function","function VAR() {\nINDENT\tCURSOR\nINDENT}"):"if"==a.slice(0,2)?top.ICEcoder.doSnippet("if","if (CURSOR) {\nINDENT\t\nINDENT}"):"for"==a.slice(0,3)&&top.ICEcoder.doSnippet("for","for (var i=0; i<CURSOR; i++) {\nINDENT\t\nINDENT}")},doSnippet:function(a,b){var c,d,e,f,g,l;c=top.ICEcoder.getcMInstance();d=c.getCursor().line;if(-1<c.getLine(d).indexOf(a)){e=c.getLine(d);f=e.indexOf(a);e=e.slice(e.indexOf(a)+a.length);b=b.replace(/VAR/g,e);e=c.getLine(d).slice(0,f);
f=c.getLine(d).length-c.getLine(d).replace(/^\s\s*/,"").length;f=c.getLine(d).slice(0,f);b=b.replace(/INDENT/g,f);e+=b;f=e.indexOf("CURSOR");g=0;l=d;for(i=0;i<e.length;i++)e.indexOf("\n",g)<e.indexOf("CURSOR")&&(g=e.indexOf("\n",g)+1,l+=1);c.setLine(d,e.replace("CURSOR",""));c.setCursor(l,f);c.focus()}}};
"/[NEW]"!=top.ICEcoder.openFiles[d-1]&&(c=top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.openFiles[d-1].replace(/\//g,"|"))))c.style.backgroundColor=d==a?top.ICEcoder.tabBGcurrent:top.ICEcoder.tabBGopen,c.style.color=d==a?top.ICEcoder.tabFGcurrent:top.ICEcoder.tabFGopenFile;document.getElementById("tab"+d).style.color=b;document.getElementById("tab"+d).style.background=d==a?top.ICEcoder.tabBGcurrent:top.ICEcoder.tabBGopen}top.ICEcoder.fMIconVis("fMSave",1==ICEcoder.changedContent[a-
1]?1:0.3)},closeTab:function(a,b){var c;ICEcoder.getcMInstance();c=!0;1==ICEcoder.changedContent[a-1]&&(c=top.ICEcoder.ask("You have made changes.\n\nAre you sure you want to close without saving?"));if(c){c=top.ICEcoder.openFiles[a-1];for(var d=a;d<ICEcoder.openFiles.length;d++)top.get("tab"+d).innerHTML=top.get("tab"+(d+1)).innerHTML,top.get("tab"+d).title=top.get("tab"+(d+1)).title,ICEcoder.openFiles[d-1]=ICEcoder.openFiles[d],ICEcoder.openFileMDTs[d-1]=ICEcoder.openFileMDTs[d];ICEcoder.content.contentWindow["cM"+
top.ICEcoder.cMInstances[a-1]].getWrapperElement().style.display="none";top.ICEcoder.cMInstances.splice(a-1,1);top.get("tab"+ICEcoder.openFiles.length).style.display="none";top.get("tab"+ICEcoder.openFiles.length).innerHTML="";top.get("tab"+ICEcoder.openFiles.length).title="";ICEcoder.openFiles.pop();ICEcoder.openFileMDTs.pop();ICEcoder.selectedTab==a&&(0<ICEcoder.openFiles.length?ICEcoder.selectedTab-=1:ICEcoder.selectedTab=0);0<ICEcoder.openFiles.length&&0==ICEcoder.selectedTab&&(ICEcoder.selectedTab=
1);0==ICEcoder.openFiles.length?top.ICEcoder.fMIconVis("fMView",0.3):(ICEcoder.switchMode(),ICEcoder.switchTab(ICEcoder.selectedTab));top.ICEcoder.changedContent.splice(a-1,1);top.ICEcoder.redoTabHighlight(ICEcoder.selectedTab);top.ICEcoder.getNestLocation("update");top.ICEcoder.selectDeselectFile("deselect",top.ICEcoder.filesFrame.contentWindow.document.getElementById(c.replace(/\//g,"|")));b||top.ICEcoder.setPreviousFiles()}top.ICEcoder.canSwitchTabs=!1;top.ICEcoder.setTabWidths("posOnlyNewTab");
setTimeout(function(){top.ICEcoder.canSwitchTabs=!0},100)},closeAllTabs:function(){if(0<top.ICEcoder.cMInstances.length&&ICEcoder.ask("Close all tabs?"))for(var a=top.ICEcoder.cMInstances.length;0<a;a--)top.ICEcoder.closeTab(a,1<a?!0:!1)},setTabWidths:function(a){var b,c,d,e,f;if(top.ICEcoder.ready){b=parseInt(top.ICEcoder.content.style.width,10)-41-24-10;c=b/top.ICEcoder.openFiles.length-18;d=-18;e=41;f=0;top.ICEcoder.tabLeftPos=[];for(var g=0;g<top.ICEcoder.openFiles.length;g++)a&&(g=top.ICEcoder.openFiles.length),
d=168*top.ICEcoder.openFiles.length>b?parseInt(c*g,10)-parseInt(c*(g-1),10):150,e=0==g?41:parseInt(top.get("tab"+g).style.left,10),f=0==g?0:parseInt(top.get("tab"+g).style.width,10)+18,a?d=-18:(top.get("tab"+(g+1)).style.left=e+f+"px",top.get("tab"+(g+1)).style.width=d+"px"),top.ICEcoder.tabLeftPos.push(e+f);top.get("newTab").style.left=e+f+d+18+"px"}},tabDragStart:function(a){top.ICEcoder.draggingTab=a;top.ICEcoder.diffStartX=top.ICEcoder.mouseX;top.ICEcoder.tabDragMouseXStart=(top.ICEcoder.mouseX-
(parseInt(top.ICEcoder.files.style.width,10)+41+18))%150;top.get("tab"+a).style.zIndex=2;for(var b=1;b<=top.ICEcoder.openFiles.length;b++)top.get("tab"+b).className=b!==a?"tab tabSlide":"tab tabDrag"},tabDragMove:function(){var a,b;a=parseInt(top.get("tab"+top.ICEcoder.openFiles.length).style.width,10)+18;top.ICEcoder.thisLeft=a=41<=top.ICEcoder.tabDragMouseX?top.ICEcoder.tabDragMouseX<=parseInt(top.get("newTab").style.left,10)-a?top.ICEcoder.tabDragMouseX:parseInt(top.get("newTab").style.left,10)-
a:41;top.get("tab"+top.ICEcoder.draggingTab).style.left=a+"px";top.ICEcoder.dragTabNo=top.ICEcoder.draggingTab;for(var c=1;c<=top.ICEcoder.openFiles.length;c++)top.get("tab"+c).style.opacity=c==top.ICEcoder.draggingTab?1:0.5,b=top.ICEcoder.tabLeftPos[c]?top.ICEcoder.tabLeftPos[c]-top.ICEcoder.tabLeftPos[c-1]:b,c!=top.ICEcoder.draggingTab&&(c<top.ICEcoder.draggingTab?top.get("tab"+c).style.left=a<=top.ICEcoder.tabLeftPos[c-1]?top.ICEcoder.tabLeftPos[c-1]+b:top.ICEcoder.tabLeftPos[c-1]:top.get("tab"+
c).style.left=a>=top.ICEcoder.tabLeftPos[c-1]?top.ICEcoder.tabLeftPos[c-1]-b:top.ICEcoder.tabLeftPos[c-1])},tabDragEnd:function(){var a,b;top.ICEcoder.setTabWidths();for(var c=1;c<=top.ICEcoder.openFiles.length;c++)top.ICEcoder.thisLeft>=top.ICEcoder.tabLeftPos[c-1]&&(a=top.ICEcoder.thisLeft==top.ICEcoder.tabLeftPos[0]?1:top.ICEcoder.dragTabNo>c?c+1:c),top.get("tab"+c).className="tab",top.get("tab"+c).style.opacity=1,c!=top.ICEcoder.dragTabNo?top.get("tab"+c).style.zIndex=1:setTimeout(function(){top.get("tab"+
c).style.zIndex=1},150);if(top.ICEcoder.thisLeft&&!1!==top.ICEcoder.thisLeft){b=[];for(c=1;c<=top.ICEcoder.openFiles.length;c++)b.push(c);b.splice(top.ICEcoder.dragTabNo-1,1);b.splice(a-1,0,top.ICEcoder.dragTabNo);ICEcoder.sortTabs(b)}top.ICEcoder.setTabWidths();top.ICEcoder.draggingTab=!1;top.ICEcoder.thisLeft=!1},sortTabs:function(a){var b,c,d;b=[ICEcoder.changedContent,ICEcoder.openFiles,ICEcoder.openFileMDTs,ICEcoder.cMInstances];c=[[],[],[],[]];for(var e=0;e<b.length;e++){for(var f=0;f<b[e].length;f++)c[e].push(b[e][a[f]-
1]);b[e]=c[e]}for(e=0;e<a.length;e++)document.getElementById("tab"+a[e]).id="tab"+(e+1)+".temp",top.ICEcoder.selectedTab==a[e]&&(d=e+1);for(e=0;e<a.length;e++)document.getElementById("tab"+(e+1)+".temp").id="tab"+(e+1);top.get("tab"+d)&&(top.get("tab"+d).className="tab tabSlide");ICEcoder.changedContent=b[0];ICEcoder.openFiles=b[1];ICEcoder.openFileMDTs=b[2];ICEcoder.cMInstances=b[3];top.ICEcoder.setTabWidths();top.ICEcoder.switchTab(d)},alphaTabs:function(){if(0<top.ICEcoder.openFiles.length){var a,
b,c,d,e;a=[];b=[];c=[];for(var f=0;f<top.ICEcoder.openFiles.length;f++)a.push(top.ICEcoder.openFiles[f].slice(top.ICEcoder.openFiles[f].lastIndexOf("/")+1)),b.push(top.ICEcoder.openFiles[f]),top.get("tab"+(f+1)).className="tab tabSlide";for(;0<a.length;){d=a[0];nextValueFull=b[0];for(f=e=0;f<a.length;f++)a[f]<d&&(d=a[f],nextValueFull=top.ICEcoder.openFiles[top.ICEcoder.openFiles.indexOf(b[f])],e=f);c.push(top.ICEcoder.openFiles.indexOf(nextValueFull)+1);a.splice(e,1);b.splice(e,1)}top.ICEcoder.sortTabs(c)}},
interceptKeys:function(a,b){var c;c=b.keyCode?b.keyCode:b.which?b.which:b.charCode;if(46==c&&"files"==a)return top.ICEcoder.deleteFile(),!1;if(b.altKey){if(b.ctrlKey&&"content"==a){if(68==c)return top.ICEcoder.tagWrapper("div"),!1;if(83==c)return top.ICEcoder.tagWrapper("span"),!1;if(80==c)return top.ICEcoder.tagWrapper("p"),!1;if(65==c)return top.ICEcoder.tagWrapper("a"),!1;if(66==c)return top.ICEcoder.tagWrapper("b"),!1;if(73==c)return top.ICEcoder.tagWrapper("i"),!1;if(71==c)return top.ICEcoder.tagWrapper("strong"),
!1;if(69==c)return top.ICEcoder.tagWrapper("em"),!1;if(49==c)return top.ICEcoder.tagWrapper("h1"),!1;if(50==c)return top.ICEcoder.tagWrapper("h2"),!1;if(51==c)return top.ICEcoder.tagWrapper("h3"),!1;if(52==c)return top.ICEcoder.tagWrapper("h4"),!1;if(53==c)return top.ICEcoder.tagWrapper("h5"),!1;if(54==c)return top.ICEcoder.tagWrapper("h6"),!1;if(55==c)return top.ICEcoder.tagWrapper("h7"),!1;if(13==c)return top.ICEcoder.addLineBreakAtEnd(),!1}return c}return 70==c&&b.ctrlKey?(top.get("find").focus(),
!1):71==c&&b.ctrlKey?(top.get("goToLineNo").focus(),!1):73==c&&b.ctrlKey&&"content"==a?(c=top.ICEcoder.caretLocType.toLowerCase()+" ","CSS"==top.ICEcoder.caretLocType||"PHP"==top.ICEcoder.caretLocType?window.open("http://voke.fm/"+c+top.ICEcoder.getcMInstance().getSelection()):("Content"==top.ICEcoder.caretLocType&&(c=""),window.open("http://www.google.com/#output=search&q="+c+top.ICEcoder.getcMInstance().getSelection())),!1):39==c&&b.ctrlKey&&"content"!=a?(top.ICEcoder.nextTab(),!1):37==c&&b.ctrlKey&&
"content"!=a?(top.ICEcoder.previousTab(),!1):38==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.moveLine("up"),!1):40==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.moveLine("down"),!1):107==c&&b.ctrlKey?("content"==a?top.ICEcoder.duplicateLine():top.ICEcoder.newTab(),!1):109==c&&b.ctrlKey?("content"==a?top.ICEcoder.removeLine():top.ICEcoder.closeTab(top.ICEcoder.selectedTab),!1):83==c&&b.ctrlKey?(b.shiftKey?top.ICEcoder.saveFile("saveAs"):top.ICEcoder.saveFile(),!1):13==c&&b.ctrlKey&&"/[NEW]"!=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-
1]?(window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]),!1):79==c&&b.ctrlKey?(top.ICEcoder.openPrompt(),!1):32==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.addSnippet(),!1):32==c&&"content"!=a?(top.ICEcoder.getcMInstance().focus(),!1):74==c&&b.ctrlKey&&"content"==a?(top.ICEcoder.jumpToDefinition(),!1):27==c&&"content"==a?(top.ICEcoder.lineCommentToggle(),!1):27==c&&"content"!=a?(top.ICEcoder.cancelAllActions(),!1):c},resetKeys:function(){},addSnippet:function(){var a,b,c;a=ICEcoder.getcMInstance();
b=a.getCursor().line;c=a.getLine(b).length-a.getLine(b).replace(/^\s\s*/,"").length;a=a.getLine(b).slice(c);"function"==a.slice(0,8)?top.ICEcoder.doSnippet("function","function VAR() {\nINDENT\tCURSOR\nINDENT}"):"if"==a.slice(0,2)?top.ICEcoder.doSnippet("if","if (CURSOR) {\nINDENT\t\nINDENT}"):"for"==a.slice(0,3)&&top.ICEcoder.doSnippet("for","for (var i=0; i<CURSOR; i++) {\nINDENT\t\nINDENT}")},doSnippet:function(a,b){var c,d,e,f,g,l;c=top.ICEcoder.getcMInstance();d=c.getCursor().line;if(-1<c.getLine(d).indexOf(a)){e=
c.getLine(d);f=e.indexOf(a);e=e.slice(e.indexOf(a)+a.length);b=b.replace(/VAR/g,e);e=c.getLine(d).slice(0,f);f=c.getLine(d).length-c.getLine(d).replace(/^\s\s*/,"").length;f=c.getLine(d).slice(0,f);b=b.replace(/INDENT/g,f);e+=b;f=e.indexOf("CURSOR");g=0;l=d;for(i=0;i<e.length;i++)e.indexOf("\n",g)<e.indexOf("CURSOR")&&(g=e.indexOf("\n",g)+1,l+=1);c.setLine(d,e.replace("CURSOR",""));c.setCursor(l,f);c.focus()}}};