mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
overCloseLink flag and position new tab on close
The 3 x instances where we define closeTabLink needs the setting/unsetting of a new var flag called overCloseLink. This is so we can choose not to start or end a drag function. After processing a closeTab function, set canSwitchTabs back to true in 0.1s Finally, the newTab left position should be set according to the length of open files, not 1 less than it and we also need to have a tab width of 0 but compensate for the padding, so needs to be -18
This commit is contained in:
@@ -617,7 +617,7 @@ var ICEcoder = {
|
||||
if(i>-1) {
|
||||
// rename array item and the tab
|
||||
top.ICEcoder.openFiles[i] = newName;
|
||||
closeTabLink = '<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\'" onMouseOut="this.style.backgroundColor=prevBG"></a>';
|
||||
closeTabLink = '<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>';
|
||||
fileName = top.ICEcoder.openFiles[i];
|
||||
top.document.getElementById('tab'+(i+1)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
|
||||
top.document.getElementById('tab'+(i+1)).title = newName;
|
||||
@@ -1607,7 +1607,7 @@ var ICEcoder = {
|
||||
top.ICEcoder.openFiles.push(top.ICEcoder.shortURL);
|
||||
|
||||
// Setup a new tab
|
||||
closeTabLink = '<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\'" onMouseOut="this.style.backgroundColor=prevBG"></a>';
|
||||
closeTabLink = '<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>';
|
||||
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).style.display = "inline-block";
|
||||
fileName = top.ICEcoder.openFiles[top.ICEcoder.openFiles.length-1];
|
||||
top.document.getElementById('tab'+(top.ICEcoder.openFiles.length)).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
|
||||
@@ -1650,7 +1650,7 @@ var ICEcoder = {
|
||||
top.ICEcoder.openFiles[tabNum-1] = newName;
|
||||
|
||||
// Setup a new tab
|
||||
closeTabLink = '<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\'" onMouseOut="this.style.backgroundColor=prevBG"></a>';
|
||||
closeTabLink = '<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>';
|
||||
fileName = top.ICEcoder.openFiles[tabNum-1];
|
||||
top.document.getElementById('tab'+tabNum).innerHTML = closeTabLink + " " + fileName.slice(fileName.lastIndexOf("/")).replace(/\//,"");
|
||||
top.document.getElementById('tab'+tabNum).title = "/" + top.ICEcoder.openFiles[tabNum-1].replace(/\//,"");
|
||||
@@ -1680,6 +1680,7 @@ var ICEcoder = {
|
||||
// Close the tab upon request
|
||||
closeTab: function(closeTabNum, dontSetPV) {
|
||||
var cM, okToRemove, closeFileName;
|
||||
|
||||
cM = ICEcoder.getcMInstance();
|
||||
okToRemove = true;
|
||||
if (ICEcoder.changedContent[closeTabNum-1]==1) {
|
||||
@@ -1738,6 +1739,7 @@ var ICEcoder = {
|
||||
top.ICEcoder.canSwitchTabs=false;
|
||||
// and set the widths
|
||||
top.ICEcoder.setTabWidths('posOnlyNewTab');
|
||||
setTimeout(function() {top.ICEcoder.canSwitchTabs=true;},100);
|
||||
},
|
||||
|
||||
// Close all tabs
|
||||
@@ -1760,13 +1762,15 @@ var ICEcoder = {
|
||||
lastWidth = 0;
|
||||
top.ICEcoder.tabLeftPos = [];
|
||||
for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
|
||||
if (posOnlyNewTab) {i=top.ICEcoder.openFiles.length-1};
|
||||
if (posOnlyNewTab) {i=top.ICEcoder.openFiles.length};
|
||||
tabWidth = top.ICEcoder.openFiles.length*(150+18) > availWidth ? parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10) : 150;
|
||||
lastLeft = i==0 ? 41 : parseInt(top.document.getElementById('tab'+(i)).style.left,10);
|
||||
lastWidth = i==0 ? 0 : parseInt(top.document.getElementById('tab'+(i)).style.width,10)+18;
|
||||
if (!posOnlyNewTab) {
|
||||
top.document.getElementById('tab'+(i+1)).style.left = (lastLeft+lastWidth) + "px";
|
||||
top.document.getElementById('tab'+(i+1)).style.width = tabWidth + "px";
|
||||
} else {
|
||||
tabWidth = -18;
|
||||
}
|
||||
top.ICEcoder.tabLeftPos.push(lastLeft+lastWidth);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user