Don't switch tab if closing another tab

This commit is contained in:
mattpass
2020-09-26 09:59:37 +01:00
parent cfbd11d8de
commit d884c2ed11
2 changed files with 4 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ var ICEcoder = {
draggingTab: false, // If we're dragging a tab
draggingWithKey: false, // The key that's down while dragging, false if no key
tabLeftPos: [], // Array of left positions of tabs inside content area
overCloseLink: false, // If mouse is over close link on tab or not
colorCurrentBG: '#1d1d1b', // Current tab/file background color
colorCurrentText: '#fff', // Current tab/file text color
colorOpenBG: '#c3c3c3', // Open tab/file background color
@@ -4175,7 +4176,7 @@ var ICEcoder = {
this.openFiles.push(shortURL);
// Setup a new tab
closeTabLink = '<a nohref onClick="ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3), 10))"><img src="' + this.iceLoc + '/assets/images/nav-close.gif" class="closeTab" onMouseOver="prevBG = this.style.backgroundColor; this.style.backgroundColor = \'#333\'; this.overCloseLink = true" onMouseOut="this.style.backgroundColor = prevBG; this.overCloseLink = false"></a>';
closeTabLink = '<a nohref onClick="ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3), 10))"><img src="' + this.iceLoc + '/assets/images/nav-close.gif" class="closeTab" onMouseOver="prevBG = this.style.backgroundColor; this.style.backgroundColor = \'#333\'; parent.ICEcoder.overCloseLink = true" onMouseOut="this.style.backgroundColor = prevBG; parent.ICEcoder.overCloseLink = false"></a>';
get('tab' + (this.openFiles.length)).style.display = "inline-block";
fileName = this.openFiles[this.openFiles.length - 1];
fileExt = fileName.substr(fileName.lastIndexOf(".") + 1);
@@ -4223,7 +4224,7 @@ var ICEcoder = {
this.openFiles[tabNum - 1] = newName;
// Setup a new tab
closeTabLink = '<a nohref onClick="ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3), 10))"><img src="' + this.iceLoc + '/assets/images/nav-close.gif" class="closeTab" onMouseOver="prevBG = this.style.backgroundColor; this.style.backgroundColor = \'#333\'; this.overCloseLink = true" onMouseOut="this.style.backgroundColor = prevBG; this.overCloseLink = false"></a>';
closeTabLink = '<a nohref onClick="ICEcoder.closeTab(parseInt(this.parentNode.id.slice(3), 10))"><img src="' + this.iceLoc + '/assets/images/nav-close.gif" class="closeTab" onMouseOver="prevBG = this.style.backgroundColor; this.style.backgroundColor = \'#333\'; parent.ICEcoder.overCloseLink = true" onMouseOut="this.style.backgroundColor = prevBG; parent.ICEcoder.overCloseLink = false"></a>';
fileName = this.openFiles[tabNum - 1];
fileExt = fileName.substr(fileName.lastIndexOf(".") + 1);
get('tab' + tabNum).innerHTML = closeTabLink + "<span style=\"display: inline-block; width: 19px\"></span>" + fileName.slice(fileName.lastIndexOf("/")).replace(/\//, "");

View File

@@ -312,7 +312,7 @@ if (true === $havePrettier && true === file_exists(dirname(__FILE__) . "/plugins
<a nohref onClick="ICEcoder.alphaTabs()"><img src="<?php echo $iceURLPath;?>/assets/images/nav-alpha.png" class="alphaTabs" title="<?php echo $t['Alphabetize tabs'];?>"></a>
<?php
for ($i = 1; $i <= 100; $i++) {
echo '<div id="tab' . $i . '" class="tab" onmousedown="ICEcoder.canSwitchTabs ? ICEcoder.switchTab(parseInt(this.id.slice(3), 10)) : ICEcoder.canSwitchTabs = true; thisColor = ICEcoder.colorSelectedText; if (!ICEcoder.overCloseLink) {ICEcoder.tabDragStart(parseInt(this.id.slice(3), 10))}; if (event.button == 1) {ICEcoder.closeTab(parseInt(this.id.slice(3), 10)); return false};" onmouseover="thisColor = this.style.color; this.style.color = ICEcoder.colorSelectedText" onmouseout="this.style.color = thisColor"></div>';
echo '<div id="tab' . $i . '" class="tab" onmousedown="!ICEcoder.overCloseLink && ICEcoder.canSwitchTabs ? ICEcoder.switchTab(parseInt(this.id.slice(3), 10)) : ICEcoder.canSwitchTabs = true; thisColor = ICEcoder.colorSelectedText; if (!ICEcoder.overCloseLink) {ICEcoder.tabDragStart(parseInt(this.id.slice(3), 10))}; if (event.button == 1) {ICEcoder.closeTab(parseInt(this.id.slice(3), 10)); return false};" onmouseover="thisColor = this.style.color; this.style.color = ICEcoder.colorSelectedText" onmouseout="this.style.color = thisColor"></div>';
}
?><div class="newTab" onClick="ICEcoder.newTab(false)" id="newTab">+</div>
</div>