mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-24 16:56:15 -04:00
Move tab logic into a new TabWaiter
This commit is contained in:
parent
98af95a6ce
commit
c2087f6d5f
10 changed files with 523 additions and 462 deletions
|
@ -79,10 +79,10 @@ self.addEventListener("message", function(e) {
|
|||
self.removeInput(r.data);
|
||||
break;
|
||||
case "changeTabRight":
|
||||
self.changeTabRight(r.data.activeTab, r.data.nums);
|
||||
self.changeTabRight(r.data.activeTab);
|
||||
break;
|
||||
case "changeTabLeft":
|
||||
self.changeTabLeft(r.data.activeTab, r.data.nums);
|
||||
self.changeTabLeft(r.data.activeTab);
|
||||
break;
|
||||
case "autobake":
|
||||
self.autoBake(r.data.activeTab, 0, false);
|
||||
|
@ -887,38 +887,26 @@ self.removeInput = function(removeInputData) {
|
|||
* Change to the next tab.
|
||||
*
|
||||
* @param {number} inputNum - The inputNum of the tab to change to
|
||||
* @param {number[]} tabNums - List of the currently displayed tabs
|
||||
*/
|
||||
self.changeTabRight = function(inputNum, tabNums) {
|
||||
self.changeTabRight = function(inputNum) {
|
||||
const newInput = self.getNextInputNum(inputNum);
|
||||
if (tabNums.includes(newInput)) {
|
||||
self.postMessage({
|
||||
action: "changeTab",
|
||||
data: newInput
|
||||
});
|
||||
} else {
|
||||
// If the tab is not displayed, refresh the tabs to display it
|
||||
self.refreshTabs(newInput, "right");
|
||||
}
|
||||
self.postMessage({
|
||||
action: "changeTab",
|
||||
data: newInput
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Change to the previous tab.
|
||||
*
|
||||
* @param {number} inputNum - The inputNum of the tab to change to
|
||||
* @param {number[]} tabNums - List of the currently displayed tabs
|
||||
*/
|
||||
self.changeTabLeft = function(inputNum, tabNums) {
|
||||
self.changeTabLeft = function(inputNum) {
|
||||
const newInput = self.getPreviousInputNum(inputNum);
|
||||
if (tabNums.includes(newInput)) {
|
||||
self.postMessage({
|
||||
action: "changeTab",
|
||||
data: newInput
|
||||
});
|
||||
} else {
|
||||
// If the tab is not displayed, refresh the tabs to display it
|
||||
self.refreshTabs(newInput, "left");
|
||||
}
|
||||
self.postMessage({
|
||||
action: "changeTab",
|
||||
data: newInput
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue