mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-04 07:44:01 +01:00
Move 5 x tab functions to tabs section of file
This commit is contained in:
275
lib/ice-coder.js
275
lib/ice-coder.js
@@ -1451,143 +1451,6 @@ var ICEcoder = {
|
||||
top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href="plugins/zip-it/index.php?zip="+tgt;
|
||||
},
|
||||
|
||||
tabDragStart: function(tab) {
|
||||
top.ICEcoder.draggingTab = tab;
|
||||
top.ICEcoder.diffStartX = top.ICEcoder.mouseX;
|
||||
top.ICEcoder.tagDragMouseXStart = (top.ICEcoder.mouseX - (parseInt(top.ICEcoder.files.style.width,10)+41+18)) % 150;
|
||||
top.document.getElementById('tab'+tab).style.zIndex = 2;
|
||||
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
|
||||
top.document.getElementById('tab'+i).className = i!==tab
|
||||
? "tab tabSlide"
|
||||
: "tab tabDrag";
|
||||
}
|
||||
},
|
||||
|
||||
// Tab dragging
|
||||
tabDragMove: function() {
|
||||
var tabWidth, lastTabWidth;
|
||||
|
||||
lastTabWidth = parseInt(top.document.getElementById('tab'+top.ICEcoder.openFiles.length).style.width,10)+18;
|
||||
|
||||
top.ICEcoder.thisLeft = thisLeft = top.ICEcoder.tabDragMouseX >= 41
|
||||
? top.ICEcoder.tabDragMouseX <= parseInt(top.document.getElementById('newTab').style.left,10) - lastTabWidth
|
||||
? top.ICEcoder.tabDragMouseX : (parseInt(top.document.getElementById('newTab').style.left,10) - lastTabWidth) : 41;
|
||||
|
||||
top.document.getElementById('tab'+top.ICEcoder.draggingTab).style.left = thisLeft + "px";
|
||||
|
||||
top.ICEcoder.dragTabNo = dragTabNo = top.ICEcoder.draggingTab;
|
||||
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
|
||||
top.document.getElementById('tab'+i).style.opacity = i == top.ICEcoder.draggingTab ? 1 : 0.5;
|
||||
tabWidth = top.ICEcoder.tabLeftPos[i] ? top.ICEcoder.tabLeftPos[i] - top.ICEcoder.tabLeftPos[i-1] : tabWidth;
|
||||
if (i!=top.ICEcoder.draggingTab) {
|
||||
if (i < top.ICEcoder.draggingTab) {
|
||||
top.document.getElementById('tab'+i).style.left = thisLeft <= top.ICEcoder.tabLeftPos[i-1]
|
||||
? top.ICEcoder.tabLeftPos[i-1]+tabWidth
|
||||
: top.ICEcoder.tabLeftPos[i-1];
|
||||
} else {
|
||||
top.document.getElementById('tab'+i).style.left = thisLeft >= top.ICEcoder.tabLeftPos[i-1]
|
||||
? top.ICEcoder.tabLeftPos[i-1]-tabWidth
|
||||
: top.ICEcoder.tabLeftPos[i-1];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Tab dragging end
|
||||
tabDragEnd: function() {
|
||||
var swapWith;
|
||||
|
||||
top.ICEcoder.setTabWidths();
|
||||
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
|
||||
if (top.ICEcoder.thisLeft >= top.ICEcoder.tabLeftPos[i-1]) {
|
||||
swapWith = top.ICEcoder.thisLeft == top.ICEcoder.tabLeftPos[0] ? 1 : top.ICEcoder.dragTabNo > i ? i+1 : i;
|
||||
}
|
||||
top.document.getElementById('tab'+i).className = "tab";
|
||||
top.document.getElementById('tab'+i).style.opacity = 1;
|
||||
if (i!=top.ICEcoder.dragTabNo) {
|
||||
top.document.getElementById('tab'+i).style.zIndex = 1;
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
top.document.getElementById('tab'+i).style.zIndex = 1;
|
||||
},150);
|
||||
}
|
||||
}
|
||||
if (top.ICEcoder.thisLeft && top.ICEcoder.thisLeft!==false) {
|
||||
var tempArray = [];
|
||||
for (var i=1;i<=top.ICEcoder.openFiles.length;i++) {
|
||||
tempArray.push(i);
|
||||
}
|
||||
tempArray.splice(top.ICEcoder.dragTabNo-1,1);
|
||||
tempArray.splice(swapWith-1,0,top.ICEcoder.dragTabNo);
|
||||
ICEcoder.sortTabs(tempArray);
|
||||
}
|
||||
top.ICEcoder.setTabWidths();
|
||||
top.ICEcoder.draggingTab = false;
|
||||
top.ICEcoder.thisLeft = false;
|
||||
},
|
||||
|
||||
// Sort tabs into new order
|
||||
sortTabs: function(newOrder) {
|
||||
var changedContent = [], openFiles = [], openFileMDTs = [], cMInstances = [];
|
||||
|
||||
a = [ICEcoder.changedContent, ICEcoder.openFiles, ICEcoder.openFileMDTs, ICEcoder.cMInstances];
|
||||
b = [changedContent, openFiles, openFileMDTs, cMInstances];
|
||||
for (var i=0;i<a.length;i++) {
|
||||
for (var j=0;j<a[i].length;j++) {
|
||||
b[i].push(a[i][newOrder[j]-1]);
|
||||
}
|
||||
a[i] = b[i];
|
||||
}
|
||||
for (var i=0;i<newOrder.length;i++) {
|
||||
document.getElementById('tab'+newOrder[i]).id = "tab" + (i+1) + ".temp";
|
||||
if (top.ICEcoder.selectedTab == newOrder[i]) {
|
||||
selectedTabWillBe = (i+1);
|
||||
}
|
||||
}
|
||||
for (var i=0;i<newOrder.length;i++) {
|
||||
document.getElementById('tab'+(i+1)+'.temp').id = "tab"+(i+1);
|
||||
}
|
||||
if (top.document.getElementById('tab'+selectedTabWillBe)) {
|
||||
top.document.getElementById('tab'+selectedTabWillBe).className = "tab tabSlide";
|
||||
}
|
||||
ICEcoder.changedContent = a[0];
|
||||
ICEcoder.openFiles = a[1];
|
||||
ICEcoder.openFileMDTs = a[2];
|
||||
ICEcoder.cMInstances = a[3];
|
||||
top.ICEcoder.setTabWidths();
|
||||
top.ICEcoder.switchTab(selectedTabWillBe);
|
||||
},
|
||||
|
||||
// Alphabetize tabs
|
||||
alphaTabs: function() {
|
||||
var currentArray, currentArrayFull, alphaArray, nextValue, nextPos;
|
||||
|
||||
currentArray = [];
|
||||
currentArrayFull = [];
|
||||
alphaArray = [];
|
||||
for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
|
||||
currentArray.push(top.ICEcoder.openFiles[i].slice(top.ICEcoder.openFiles[i].lastIndexOf('/')+1));
|
||||
currentArrayFull.push(top.ICEcoder.openFiles[i]);
|
||||
top.document.getElementById('tab'+(i+1)).className = "tab tabSlide";
|
||||
}
|
||||
while (currentArray.length>0) {
|
||||
nextValue = currentArray[0];
|
||||
nextValueFull = currentArrayFull[0];
|
||||
nextPos = 0;
|
||||
for (i=0;i<currentArray.length;i++) {
|
||||
if (currentArray[i] < nextValue) {
|
||||
nextValue = currentArray[i];
|
||||
nextValueFull = top.ICEcoder.openFiles[top.ICEcoder.openFiles.indexOf(currentArrayFull[i])];
|
||||
nextPos = i;
|
||||
}
|
||||
}
|
||||
alphaArray.push((top.ICEcoder.openFiles.indexOf(nextValueFull)+1));
|
||||
currentArray.splice(nextPos,1);
|
||||
currentArrayFull.splice(nextPos,1);
|
||||
}
|
||||
top.ICEcoder.sortTabs(alphaArray);
|
||||
},
|
||||
|
||||
// Change permissions on a file/folder
|
||||
chmod: function(file,perms) {
|
||||
top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'));
|
||||
@@ -1849,6 +1712,144 @@ var ICEcoder = {
|
||||
top.document.getElementById('newTab').style.left = (lastLeft+lastWidth+tabWidth+18) + "px";
|
||||
},
|
||||
|
||||
// Tab dragging start
|
||||
tabDragStart: function(tab) {
|
||||
top.ICEcoder.draggingTab = tab;
|
||||
top.ICEcoder.diffStartX = top.ICEcoder.mouseX;
|
||||
top.ICEcoder.tagDragMouseXStart = (top.ICEcoder.mouseX - (parseInt(top.ICEcoder.files.style.width,10)+41+18)) % 150;
|
||||
top.document.getElementById('tab'+tab).style.zIndex = 2;
|
||||
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
|
||||
top.document.getElementById('tab'+i).className = i!==tab
|
||||
? "tab tabSlide"
|
||||
: "tab tabDrag";
|
||||
}
|
||||
},
|
||||
|
||||
// Tab dragging
|
||||
tabDragMove: function() {
|
||||
var tabWidth, lastTabWidth;
|
||||
|
||||
lastTabWidth = parseInt(top.document.getElementById('tab'+top.ICEcoder.openFiles.length).style.width,10)+18;
|
||||
|
||||
top.ICEcoder.thisLeft = thisLeft = top.ICEcoder.tabDragMouseX >= 41
|
||||
? top.ICEcoder.tabDragMouseX <= parseInt(top.document.getElementById('newTab').style.left,10) - lastTabWidth
|
||||
? top.ICEcoder.tabDragMouseX : (parseInt(top.document.getElementById('newTab').style.left,10) - lastTabWidth) : 41;
|
||||
|
||||
top.document.getElementById('tab'+top.ICEcoder.draggingTab).style.left = thisLeft + "px";
|
||||
|
||||
top.ICEcoder.dragTabNo = dragTabNo = top.ICEcoder.draggingTab;
|
||||
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
|
||||
top.document.getElementById('tab'+i).style.opacity = i == top.ICEcoder.draggingTab ? 1 : 0.5;
|
||||
tabWidth = top.ICEcoder.tabLeftPos[i] ? top.ICEcoder.tabLeftPos[i] - top.ICEcoder.tabLeftPos[i-1] : tabWidth;
|
||||
if (i!=top.ICEcoder.draggingTab) {
|
||||
if (i < top.ICEcoder.draggingTab) {
|
||||
top.document.getElementById('tab'+i).style.left = thisLeft <= top.ICEcoder.tabLeftPos[i-1]
|
||||
? top.ICEcoder.tabLeftPos[i-1]+tabWidth
|
||||
: top.ICEcoder.tabLeftPos[i-1];
|
||||
} else {
|
||||
top.document.getElementById('tab'+i).style.left = thisLeft >= top.ICEcoder.tabLeftPos[i-1]
|
||||
? top.ICEcoder.tabLeftPos[i-1]-tabWidth
|
||||
: top.ICEcoder.tabLeftPos[i-1];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Tab dragging end
|
||||
tabDragEnd: function() {
|
||||
var swapWith;
|
||||
|
||||
top.ICEcoder.setTabWidths();
|
||||
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
|
||||
if (top.ICEcoder.thisLeft >= top.ICEcoder.tabLeftPos[i-1]) {
|
||||
swapWith = top.ICEcoder.thisLeft == top.ICEcoder.tabLeftPos[0] ? 1 : top.ICEcoder.dragTabNo > i ? i+1 : i;
|
||||
}
|
||||
top.document.getElementById('tab'+i).className = "tab";
|
||||
top.document.getElementById('tab'+i).style.opacity = 1;
|
||||
if (i!=top.ICEcoder.dragTabNo) {
|
||||
top.document.getElementById('tab'+i).style.zIndex = 1;
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
top.document.getElementById('tab'+i).style.zIndex = 1;
|
||||
},150);
|
||||
}
|
||||
}
|
||||
if (top.ICEcoder.thisLeft && top.ICEcoder.thisLeft!==false) {
|
||||
var tempArray = [];
|
||||
for (var i=1;i<=top.ICEcoder.openFiles.length;i++) {
|
||||
tempArray.push(i);
|
||||
}
|
||||
tempArray.splice(top.ICEcoder.dragTabNo-1,1);
|
||||
tempArray.splice(swapWith-1,0,top.ICEcoder.dragTabNo);
|
||||
ICEcoder.sortTabs(tempArray);
|
||||
}
|
||||
top.ICEcoder.setTabWidths();
|
||||
top.ICEcoder.draggingTab = false;
|
||||
top.ICEcoder.thisLeft = false;
|
||||
},
|
||||
|
||||
// Sort tabs into new order
|
||||
sortTabs: function(newOrder) {
|
||||
var changedContent = [], openFiles = [], openFileMDTs = [], cMInstances = [];
|
||||
|
||||
a = [ICEcoder.changedContent, ICEcoder.openFiles, ICEcoder.openFileMDTs, ICEcoder.cMInstances];
|
||||
b = [changedContent, openFiles, openFileMDTs, cMInstances];
|
||||
for (var i=0;i<a.length;i++) {
|
||||
for (var j=0;j<a[i].length;j++) {
|
||||
b[i].push(a[i][newOrder[j]-1]);
|
||||
}
|
||||
a[i] = b[i];
|
||||
}
|
||||
for (var i=0;i<newOrder.length;i++) {
|
||||
document.getElementById('tab'+newOrder[i]).id = "tab" + (i+1) + ".temp";
|
||||
if (top.ICEcoder.selectedTab == newOrder[i]) {
|
||||
selectedTabWillBe = (i+1);
|
||||
}
|
||||
}
|
||||
for (var i=0;i<newOrder.length;i++) {
|
||||
document.getElementById('tab'+(i+1)+'.temp').id = "tab"+(i+1);
|
||||
}
|
||||
if (top.document.getElementById('tab'+selectedTabWillBe)) {
|
||||
top.document.getElementById('tab'+selectedTabWillBe).className = "tab tabSlide";
|
||||
}
|
||||
ICEcoder.changedContent = a[0];
|
||||
ICEcoder.openFiles = a[1];
|
||||
ICEcoder.openFileMDTs = a[2];
|
||||
ICEcoder.cMInstances = a[3];
|
||||
top.ICEcoder.setTabWidths();
|
||||
top.ICEcoder.switchTab(selectedTabWillBe);
|
||||
},
|
||||
|
||||
// Alphabetize tabs
|
||||
alphaTabs: function() {
|
||||
var currentArray, currentArrayFull, alphaArray, nextValue, nextPos;
|
||||
|
||||
currentArray = [];
|
||||
currentArrayFull = [];
|
||||
alphaArray = [];
|
||||
for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
|
||||
currentArray.push(top.ICEcoder.openFiles[i].slice(top.ICEcoder.openFiles[i].lastIndexOf('/')+1));
|
||||
currentArrayFull.push(top.ICEcoder.openFiles[i]);
|
||||
top.document.getElementById('tab'+(i+1)).className = "tab tabSlide";
|
||||
}
|
||||
while (currentArray.length>0) {
|
||||
nextValue = currentArray[0];
|
||||
nextValueFull = currentArrayFull[0];
|
||||
nextPos = 0;
|
||||
for (i=0;i<currentArray.length;i++) {
|
||||
if (currentArray[i] < nextValue) {
|
||||
nextValue = currentArray[i];
|
||||
nextValueFull = top.ICEcoder.openFiles[top.ICEcoder.openFiles.indexOf(currentArrayFull[i])];
|
||||
nextPos = i;
|
||||
}
|
||||
}
|
||||
alphaArray.push((top.ICEcoder.openFiles.indexOf(nextValueFull)+1));
|
||||
currentArray.splice(nextPos,1);
|
||||
currentArrayFull.splice(nextPos,1);
|
||||
}
|
||||
top.ICEcoder.sortTabs(alphaArray);
|
||||
},
|
||||
|
||||
// ==============
|
||||
// UI
|
||||
// ==============
|
||||
|
||||
Reference in New Issue
Block a user