|
2 | 2 |
|
3 | 3 |
|
4 | 4 |
|
5 | | - function _callee(tabs, isIncognito) {var first, t, i, w, tab;return regeneratorRuntime.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0: |
6 | | - first = tabs.shift(); |
| 5 | + function _callee(tabs, isIncognito) {var pinnedIndex, firstTab, t, i, firstPinned, w, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, oldTabId, oldTab, tabPinned, movedTabs, newTab;return regeneratorRuntime.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0: |
| 6 | + |
| 7 | + pinnedIndex = 0; |
| 8 | + firstTab = tabs.shift(); |
7 | 9 | t = []; |
8 | 10 | for (i = 0; i < tabs.length; i++) { |
9 | 11 | t.push(tabs[i].id); |
10 | | - };_context.next = 6;return ( |
11 | | - browser.windows.create({ tabId: first.id, incognito: !!isIncognito }));case 6:w = _context.sent;_context.next = 9;return ( |
12 | | - browser.tabs.update(first.id, { pinned: first.pinned }));case 9:if (!( |
13 | | - t.length > 0)) {_context.next = 15;break;}_context.next = 12;return ( |
14 | | - browser.tabs.move(t, { windowId: w.id, index: -1 }));case 12:tab = _context.sent;_context.next = 15;return ( |
15 | | - browser.tabs.update(tab.id, { pinned: tab.pinned }));case 15:_context.next = 17;return ( |
| 12 | + }; |
| 13 | + |
| 14 | + firstPinned = firstTab.pinned;_context.next = 8;return ( |
| 15 | + browser.windows.create({ tabId: firstTab.id, incognito: !!isIncognito }));case 8:w = _context.sent;if (! |
| 16 | + firstPinned) {_context.next = 13;break;}_context.next = 12;return ( |
| 17 | + browser.tabs.update(w.tabs[0].id, { pinned: firstPinned }));case 12: |
| 18 | + pinnedIndex++;case 13:if (!( |
| 19 | + |
| 20 | + |
| 21 | + t.length > 0)) {_context.next = 60;break;} |
| 22 | + i = 0;_iteratorNormalCompletion2 = true;_didIteratorError2 = false;_iteratorError2 = undefined;_context.prev = 18;_iterator2 = |
| 23 | + t[Symbol.iterator]();case 20:if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) {_context.next = 45;break;}oldTabId = _step2.value; |
| 24 | + i++;_context.next = 25;return ( |
| 25 | + browser.tabs.get(oldTabId));case 25:oldTab = _context.sent; |
| 26 | + tabPinned = oldTab.pinned; |
| 27 | + movedTabs = [];if ( |
| 28 | + tabPinned) {_context.next = 34;break;}_context.next = 31;return ( |
| 29 | + browser.tabs.move(oldTabId, { windowId: w.id, index: -1 }));case 31:movedTabs = _context.sent;_context.next = 37;break;case 34:_context.next = 36;return ( |
| 30 | + |
| 31 | + browser.tabs.move(oldTabId, { windowId: w.id, index: pinnedIndex++ }));case 36:movedTabs = _context.sent;case 37:if (!( |
| 32 | + |
| 33 | + movedTabs.length > 0)) {_context.next = 42;break;} |
| 34 | + newTab = movedTabs[0];if (! |
| 35 | + tabPinned) {_context.next = 42;break;}_context.next = 42;return ( |
| 36 | + browser.tabs.update(newTab.id, { pinned: tabPinned }));case 42:_iteratorNormalCompletion2 = true;_context.next = 20;break;case 45:_context.next = 51;break;case 47:_context.prev = 47;_context.t0 = _context["catch"](18);_didIteratorError2 = true;_iteratorError2 = _context.t0;case 51:_context.prev = 51;_context.prev = 52;if (!_iteratorNormalCompletion2 && _iterator2.return) {_iterator2.return();}case 54:_context.prev = 54;if (!_didIteratorError2) {_context.next = 57;break;}throw _iteratorError2;case 57:return _context.finish(54);case 58:return _context.finish(51);case 59: |
| 37 | + |
| 38 | + |
| 39 | + ;case 60:_context.next = 62;return ( |
16 | 40 |
|
17 | | - browser.windows.update(w.id, { focused: true }));case 17:case "end":return _context.stop();}}}, _callee, this);}));return function createWindowWithTabs(_x, _x2) {return _ref.apply(this, arguments);};}();var focusOnTabAndWindow = function () {var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( |
| 41 | + browser.windows.update(w.id, { focused: true }));case 62:case "end":return _context.stop();}}}, _callee, this, [[18, 47, 51, 59], [52,, 54, 58]]);}));return function createWindowWithTabs(_x, _x2) {return _ref.apply(this, arguments);};}();var focusOnTabAndWindow = function () {var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( |
18 | 42 |
|
19 | 43 |
|
20 | 44 | function _callee2(tab) {return regeneratorRuntime.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:_context2.next = 2;return ( |
|
168 | 192 | } catch (e) { |
169 | 193 | openInOwnTab = false; |
170 | 194 | } |
171 | | - console.log(openInOwnTab);if (! |
172 | | - openInOwnTab) {_context7.next = 11;break;}_context7.next = 7;return ( |
173 | | - browser.browserAction.setPopup({ popup: "" }));case 7:_context7.next = 9;return ( |
174 | | - browser.browserAction.onClicked.addListener(openAsOwnTab));case 9:_context7.next = 15;break;case 11:_context7.next = 13;return ( |
| 195 | + console.log(openInOwnTab);_context7.next = 6;return ( |
| 196 | + browser.browserAction.onClicked.removeListener(openAsOwnTab));case 6:if (! |
| 197 | + openInOwnTab) {_context7.next = 13;break;}_context7.next = 9;return ( |
| 198 | + browser.browserAction.setPopup({ popup: "" }));case 9:_context7.next = 11;return ( |
| 199 | + browser.browserAction.onClicked.addListener(openAsOwnTab));case 11:_context7.next = 15;break;case 13:_context7.next = 15;return ( |
175 | 200 |
|
176 | | - browser.browserAction.setPopup({ popup: "popup.html?popup=true" }));case 13:_context7.next = 15;return ( |
177 | | - browser.browserAction.onClicked.removeListener(openAsOwnTab));case 15:case "end":return _context7.stop();}}}, _callee7, this);}));return function setupPopup() {return _ref7.apply(this, arguments);};}();var setupListeners = function () {var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( |
| 201 | + browser.browserAction.setPopup({ popup: "popup.html?popup=true" }));case 15:case "end":return _context7.stop();}}}, _callee7, this);}));return function setupPopup() {return _ref7.apply(this, arguments);};}();var setupListeners = function () {var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( |
178 | 202 |
|
179 | 203 |
|
180 | 204 |
|
|
0 commit comments