mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-24 17:27:08 +01:00
Tabs now have closelink fist as it's RTL and clear first slash and end
with one for same reason Else if conditions to give better perf newBlock has a z-index of 1000 to show above code Show titles on tab hovers New setTabWidths function to reset tab widths on demand
This commit is contained in:
@@ -95,6 +95,7 @@ var ICEcoder = {
|
||||
this.account.style.height = this.accountH + "px";
|
||||
this.fmLock.style.marginLeft = (this.filesW-42) + "px";
|
||||
this.filesFrame.style.height = (winH-headerH-accountH-footerH) + "px";
|
||||
top.ICEcoder.setTabWidths();
|
||||
|
||||
// If we need to set the editor sizes
|
||||
if (!dontSetEditor) {
|
||||
@@ -566,7 +567,7 @@ var ICEcoder = {
|
||||
// rename array item and the tab
|
||||
top.ICEcoder.openFiles[i] = newName;
|
||||
closeTabLink = '<a nohref onClick="top.ICEcoder.files.contentWindow.closeTab('+(i+1)+')"><img src="images/nav-close.gif" id="closeTabButton'+(i+1)+'" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'" onMouseOut="this.style.backgroundColor=prevBG"></a>';
|
||||
top.document.getElementById('tab'+(i+1)).innerHTML = top.ICEcoder.openFiles[i] + " " + closeTabLink;
|
||||
top.document.getElementById('tab'+(i+1)).innerHTML = closeTabLink + " " + top.ICEcoder.openFiles[i].replace(/\//,"") + "/";
|
||||
}
|
||||
top.ICEcoder.serverQueue("add","lib/file-control.php?action=rename&file="+newName+"&oldFileName="+oldName.replace(/\|/g,"/"));
|
||||
top.ICEcoder.serverMessage('<b>Renaming to</b><br>'+newName);
|
||||
@@ -749,9 +750,9 @@ var ICEcoder = {
|
||||
top.ICEcoder.thisFileFolderType='file';
|
||||
top.ICEcoder.openFile();
|
||||
}
|
||||
if (action=="newFile") {top.ICEcoder.newFile();}
|
||||
if (action=="newFolder") {top.ICEcoder.newFolder();}
|
||||
if (action=="rename") {top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile);}
|
||||
else if (action=="newFile") {top.ICEcoder.newFile();}
|
||||
else if (action=="newFolder") {top.ICEcoder.newFolder();}
|
||||
else if (action=="rename") {top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile);}
|
||||
}
|
||||
|
||||
if (action=="delete" && ICEcoder.selectedFiles.length>0) {
|
||||
@@ -1017,18 +1018,18 @@ var ICEcoder = {
|
||||
cM = ICEcoder.getcMInstance();
|
||||
caretLocType = "Unknown";
|
||||
caretChunk = cM.getValue().substr(0,ICEcoder.caretPos+1);
|
||||
if (caretChunk.lastIndexOf("<script")>caretChunk.lastIndexOf("</script>")&&caretLocType=="Unknown") {caretLocType = "JavaScript"};
|
||||
if (caretChunk.lastIndexOf("<?")>caretChunk.lastIndexOf("?>")&&caretLocType=="Unknown") {caretLocType = "PHP"};
|
||||
if (caretChunk.lastIndexOf("<%")>caretChunk.lastIndexOf("%>")&&caretLocType=="Unknown") {caretLocType = "Ruby"};
|
||||
if (caretChunk.lastIndexOf("<")>caretChunk.lastIndexOf(">")&&caretLocType=="Unknown") {caretLocType = "HTML"};
|
||||
if (caretLocType=="Unknown") {caretLocType = "Content"};
|
||||
if (caretChunk.lastIndexOf("<script")>caretChunk.lastIndexOf("</script>")&&caretLocType=="Unknown") {caretLocType = "JavaScript"}
|
||||
else if (caretChunk.lastIndexOf("<?")>caretChunk.lastIndexOf("?>")&&caretLocType=="Unknown") {caretLocType = "PHP"}
|
||||
else if (caretChunk.lastIndexOf("<%")>caretChunk.lastIndexOf("%>")&&caretLocType=="Unknown") {caretLocType = "Ruby"}
|
||||
else if (caretChunk.lastIndexOf("<")>caretChunk.lastIndexOf(">")&&caretLocType=="Unknown") {caretLocType = "HTML"}
|
||||
else if (caretLocType=="Unknown") {caretLocType = "Content"};
|
||||
|
||||
fileName = ICEcoder.openFiles[ICEcoder.selectedTab-1];
|
||||
if (fileName.indexOf(".js")>0) {caretLocType="JavaScript"};
|
||||
if (fileName.indexOf(".coffee")>0) {caretLocType="CoffeeScript"};
|
||||
if (fileName.indexOf(".rb")>0) {caretLocType="Ruby"};
|
||||
if (fileName.indexOf(".css")>0) {caretLocType="CSS"};
|
||||
if (fileName.indexOf(".less")>0) {caretLocType="LESS"};
|
||||
if (fileName.indexOf(".js")>0) {caretLocType="JavaScript"}
|
||||
else if (fileName.indexOf(".coffee")>0) {caretLocType="CoffeeScript"}
|
||||
else if (fileName.indexOf(".rb")>0) {caretLocType="Ruby"}
|
||||
else if (fileName.indexOf(".css")>0) {caretLocType="CSS"}
|
||||
else if (fileName.indexOf(".less")>0) {caretLocType="LESS"};
|
||||
|
||||
ICEcoder.caretLocType = caretLocType;
|
||||
},
|
||||
@@ -1130,6 +1131,7 @@ var ICEcoder = {
|
||||
newBlock.style.position = "absolute";
|
||||
newBlock.style.display = "block";
|
||||
newBlock.style.width = newBlock.style.height = "20px";
|
||||
newBlock.style.zIndex = "1000";
|
||||
newBlock.style.background = match ? match[0] : '';
|
||||
if (newBlock.style.backgroundColor=="") {newBlock.style.display = "none"};
|
||||
top.document.getElementById('header').appendChild(newBlock);
|
||||
@@ -1259,8 +1261,7 @@ var ICEcoder = {
|
||||
document.body.appendChild(txtArea);
|
||||
document.getElementById('saveTemp'+nextSaveID).value = cM.getValue();
|
||||
}
|
||||
}
|
||||
if (action=="del") {
|
||||
} else if (action=="del") {
|
||||
if (ICEcoder.serverQueueItems[0] && ICEcoder.serverQueueItems[0].indexOf('action=save')>0) {
|
||||
topSaveID = nextSaveID-1;
|
||||
for (var i=1;i<topSaveID;i++) {
|
||||
@@ -1564,7 +1565,11 @@ var ICEcoder = {
|
||||
// Setup a new tab
|
||||
closeTabLink = '<a nohref onClick="top.ICEcoder.closeTab('+(top.ICEcoder.openFiles.length)+')"><img src="images/nav-close.gif" id="closeTabButton'+(top.ICEcoder.openFiles.length)+'" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'" onMouseOut="this.style.backgroundColor=prevBG"></a>';
|
||||
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).style.display = "inline-block";
|
||||
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).innerHTML = top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1] + " " + closeTabLink;
|
||||
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).innerHTML = closeTabLink + " " + top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1].replace(/\//,"") + "/";
|
||||
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).title = top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1];
|
||||
|
||||
// Set the widths
|
||||
top.ICEcoder.setTabWidths();
|
||||
|
||||
// Highlight it and state it's selected
|
||||
top.ICEcoder.redoTabHighlight(top.ICEcoder.openFiles.length);
|
||||
@@ -1601,7 +1606,8 @@ var ICEcoder = {
|
||||
|
||||
// Setup a new tab
|
||||
closeTabLink = '<a nohref onClick="parent.ICEcoder.closeTab('+tabNum+')"><img src="images/nav-close.gif" id="closeTabButton'+tabNum+'" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'" onMouseOut="this.style.backgroundColor=prevBG"></a>';
|
||||
top.document.getElementById('tab'+tabNum).innerHTML = top.ICEcoder.openFiles[tabNum-1] + " " + closeTabLink;
|
||||
top.document.getElementById('tab'+tabNum).innerHTML = closeTabLink + " " + top.ICEcoder.openFiles[tabNum-1].replace(/\//,"") + "/";
|
||||
top.document.getElementById('tab'+tabNum).title = top.ICEcoder.openFiles[tabNum-1];
|
||||
},
|
||||
|
||||
// Reset all tabs to be without a highlight and then highlight the selected
|
||||
@@ -1642,6 +1648,7 @@ var ICEcoder = {
|
||||
// recursively copy over all tabs & data from the tab to the right, if there is one
|
||||
for (var i=closeTabNum;i<ICEcoder.openFiles.length;i++) {
|
||||
top.document.getElementById('tab'+i).innerHTML = top.document.getElementById('tab'+(i+1)).innerHTML;
|
||||
top.document.getElementById('tab'+i).title = top.document.getElementById('tab'+(i+1)).title;
|
||||
ICEcoder.openFiles[i-1] = ICEcoder.openFiles[i];
|
||||
ICEcoder.openFileMDTs[i-1] = ICEcoder.openFileMDTs[i];
|
||||
|
||||
@@ -1654,6 +1661,7 @@ var ICEcoder = {
|
||||
// clear the rightmost tab (or only one left in a 1 tab scenario) & remove from the array
|
||||
top.document.getElementById('tab'+ICEcoder.openFiles.length).style.display = "none";
|
||||
top.document.getElementById('tab'+ICEcoder.openFiles.length).innerHTML = "";
|
||||
top.document.getElementById('tab'+ICEcoder.openFiles.length).title = "";
|
||||
ICEcoder.openFiles.pop();
|
||||
ICEcoder.openFileMDTs.pop();
|
||||
// If we're closing the selected tab, determin the new selectedTab number, reduced by 1 if we have some tabs, 0 for a reset state
|
||||
@@ -1681,6 +1689,22 @@ var ICEcoder = {
|
||||
}
|
||||
// Lastly, stop it from trying to also switch tab
|
||||
top.ICEcoder.canSwitchTabs=false;
|
||||
// and set the widths
|
||||
top.ICEcoder.setTabWidths();
|
||||
},
|
||||
|
||||
// Set the tabs width
|
||||
setTabWidths: function() {
|
||||
var availWidth, tabWidth;
|
||||
|
||||
availWidth = parseInt(top.ICEcoder.content.style.width,10)-41-24-10; // - left margin - new tab - right margin
|
||||
avgWidth = (availWidth/top.ICEcoder.openFiles.length)-18;
|
||||
|
||||
for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
|
||||
thisWidth = parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10);
|
||||
tabWidth = top.ICEcoder.openFiles.length*(150+18) > availWidth ? thisWidth : 150;
|
||||
top.document.getElementById('tab'+(i+1)).style.width = tabWidth + "px";
|
||||
}
|
||||
},
|
||||
|
||||
// ==============
|
||||
@@ -1805,7 +1829,7 @@ var ICEcoder = {
|
||||
key = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode;
|
||||
|
||||
if (key==17) {top.ICEcoder.ctrlKeyDown = false; top.ICEcoder.stickyTabMaybe = false}
|
||||
if (key==16) {top.ICEcoder.shiftKeyDown = false}
|
||||
if (key==46) {top.ICEcoder.delKeyDown = false}
|
||||
else if (key==16) {top.ICEcoder.shiftKeyDown = false}
|
||||
else if (key==46) {top.ICEcoder.delKeyDown = false}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user