From 5a161b1365eab6401d86f82e20341d390989942d Mon Sep 17 00:00:00 2001 From: Markus Stefanko Date: Mon, 22 Jun 2020 07:57:24 +0700 Subject: [PATCH] Update to 5.2.0 --- .babelrc | 2 +- manifest-firefox.json | 2 +- manifest.json | 2 +- outlib/TabManager.js | 202 +++++++++++++++++-------- outlib/TabNew.js | 203 ------------------------- outlib/TabOptions.js | 19 +-- outlib/TabOptionsFirefox.js | 19 +-- outlib/Window.js | 9 +- outlib/background.js | 293 ++++++++++++++++++++++-------------- outlib/popup.js | 11 ++ package.json | 5 +- readme.md | 2 +- 12 files changed, 352 insertions(+), 417 deletions(-) delete mode 100644 outlib/TabNew.js diff --git a/.babelrc b/.babelrc index 1e7d9a09..ba9af462 100644 --- a/.babelrc +++ b/.babelrc @@ -9,7 +9,7 @@ "sourceType": "script", "plugins": [ ["inline-replace-variables", { - "__VERSION__": "5.1.6" + "__VERSION__": "5.2.0" }] ] } diff --git a/manifest-firefox.json b/manifest-firefox.json index 706fbf04..d6c18377 100644 --- a/manifest-firefox.json +++ b/manifest-firefox.json @@ -1,7 +1,7 @@ { "name": "Tab Manager Plus for Firefox", "short_name": "Tab Manager+", - "version": "5.1.6", + "version": "5.2.0", "manifest_version": 2, "description": "Quickly find open tabs, see all windows in one view, find duplicates and limit tabs per window. The best Tab Manager for Firefox.", "author": "stefanXO", diff --git a/manifest.json b/manifest.json index fb3e4981..2ef8b6a9 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Tab Manager Plus for Chrome", "short_name": "Tab Manager+", - "version": "5.1.6", + "version": "5.2.0", "manifest_version": 2, "offline_enabled": true, "description": "Quickly find open tabs, see all windows in one view, find duplicates and limit tabs per window. The best Tab Manager for Chrome.", diff --git a/outlib/TabManager.js b/outlib/TabManager.js index a6a383ab..96a1cd76 100644 --- a/outlib/TabManager.js +++ b/outlib/TabManager.js @@ -22,7 +22,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component } - var layout = "horizontal"; + var layout = "blocks"; var animations = true; var windowTitles = true; var compact = false; @@ -34,15 +34,15 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component var filterTabs = false; var tabLimit = 0; var openInOwnTab = false; - var tabWidth = 530; - var tabHeight = 450; + var tabWidth = 800; + var tabHeight = 600; if (_this7.localStorageAvailable()) { - if (!localStorage["layout"]) localStorage["layout"] = "horizontal"; + if (!localStorage["layout"]) localStorage["layout"] = "blocks"; if (typeof localStorage["tabLimit"] === "undefined") localStorage["tabLimit"] = "0"; if (typeof localStorage["openInOwnTab"] === "undefined") localStorage["openInOwnTab"] = "0"; - if (typeof localStorage["tabWidth"] === "undefined") localStorage["tabWidth"] = "530"; - if (typeof localStorage["tabHeight"] === "undefined") localStorage["tabHeight"] = "450"; + if (typeof localStorage["tabWidth"] === "undefined") localStorage["tabWidth"] = "800"; + if (typeof localStorage["tabHeight"] === "undefined") localStorage["tabHeight"] = "600"; if (typeof localStorage["animations"] === "undefined") localStorage["animations"] = "1"; if (typeof localStorage["windowTitles"] === "undefined") localStorage["windowTitles"] = "1"; if (typeof localStorage["compact"] === "undefined") localStorage["compact"] = "0"; @@ -52,7 +52,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component if (typeof localStorage["sessionsFeature"] === "undefined") localStorage["sessionsFeature"] = "0"; if (typeof localStorage["hideWindows"] === "undefined") localStorage["hideWindows"] = "0"; if (typeof localStorage["filter-tabs"] === "undefined") localStorage["filter-tabs"] = "0"; - if (typeof localStorage["version"] === "undefined") localStorage["version"] = "5.1.6"; + if (typeof localStorage["version"] === "undefined") localStorage["version"] = "5.2.0"; layout = localStorage["layout"]; tabLimit = JSON.parse(localStorage["tabLimit"]); @@ -106,7 +106,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component windowsbyid: {}, closeTimeout: closeTimeout, resetTimeout: resetTimeout, - height: 400, + height: 600, hasScrollBar: false, focusUpdates: 0, topText: "", @@ -114,7 +114,8 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component lastDirection: false, optionsActive: !!_this7.props.optionsActive, filterTabs: filterTabs, - dupTabs: false }; + dupTabs: false, + colorsActive: false }; _this7.addWindow = _this7.addWindow.bind(_this7); @@ -199,6 +200,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component this.setState({ topText: text }); this.setState({ bottomText: bottom }); //this.update(); + this.forceUpdate(); } }, { key: "render", value: function render() { var _this = this; @@ -241,6 +243,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component React.createElement("div", { className: "window-container " + this.state.layout + " " + (this.state.optionsActive ? "hidden" : ""), ref: "windowcontainer", tabIndex: 2 }, this.state.windows.map(function (window) { if (window.state == "minimized") return; + if (!!this.state.colorsActive && this.state.colorsActive !== window.id) return; return ( React.createElement(Window, { key: "window" + window.id, @@ -258,6 +261,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component scrollTo: _this.scrollTo.bind(_this), hoverIcon: _this.hoverIcon.bind(_this), parentUpdate: _this.update.bind(_this), + toggleColors: _this.toggleColors.bind(_this), tabMiddleClick: _this.deleteTab.bind(_this), select: _this.select.bind(_this), selectTo: _this.selectTo.bind(_this), @@ -269,7 +273,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component ref: "window" + window.id })); - }), + }.bind(this)), React.createElement("div", { className: "hrCont " + (!haveMin ? "hidden" : "") }, React.createElement("div", { className: "hrDiv" }, React.createElement("span", { className: "hrSpan" }, "Minimized windows"))), @@ -277,6 +281,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component this.state.windows.map(function (window) { if (window.state !== "minimized") return; + if (!!this.state.colorsActive && this.state.colorsActive !== window.id) return; return ( React.createElement(Window, { key: "window" + window.id, @@ -294,6 +299,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component scrollTo: _this.scrollTo.bind(_this), hoverIcon: _this.hoverIcon.bind(_this), parentUpdate: _this.update.bind(_this), + toggleColors: _this.toggleColors.bind(_this), tabMiddleClick: _this.deleteTab.bind(_this), select: _this.select.bind(_this), selectTo: _this.selectTo.bind(_this), @@ -305,7 +311,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component ref: "window" + window.id })); - }), + }.bind(this)), React.createElement("div", { className: "hrCont " + (!haveSess ? "hidden" : "") }, React.createElement("div", { className: "hrDiv" }, React.createElement("span", { className: "hrSpan" }, "Saved windows"))), @@ -313,6 +319,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component haveSess ? this.state.sessions.map(function (window) { + if (!!this.state.colorsActive && this.state.colorsActive !== window.id) return; return ( React.createElement(Session, { key: "session" + window.id, @@ -329,6 +336,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component scrollTo: _this.scrollTo.bind(_this), hoverIcon: _this.hoverIcon.bind(_this), parentUpdate: _this.update.bind(_this), + toggleColors: _this.toggleColors.bind(_this), tabMiddleClick: _this.deleteTab.bind(_this), select: _this.select.bind(_this), windowTitles: _this.state.windowTitles, @@ -336,7 +344,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component ref: "session" + window.id })); - }) : + }.bind(this)) : false), React.createElement("div", { className: "options-container " + (this.state.optionsActive ? "" : "hidden"), ref: "options-container" }, @@ -398,17 +406,17 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component disabled: true, className: "tabtitle", ref: "topbox", - placeholder: tabCount + " tabs in " + this.state.windows.length + " windows", + placeholder: maybePluralize(tabCount, 'tab') + " in " + this.state.windows.length + " windows", value: this.state.topText }), React.createElement("input", { type: "text", disabled: true, className: "taburl", ref: "topboxurl", placeholder: this.getTip(), value: this.state.bottomText })), - React.createElement("div", { className: "window searchbox " + (this.state.optionsActive ? "hidden" : "") }, + React.createElement("div", { className: "window searchbox " + (this.state.optionsActive || !!this.state.colorsActive ? "hidden" : "") }, React.createElement("table", null, React.createElement("tbody", null, React.createElement("tr", null, React.createElement("td", { className: "one" }, - React.createElement("input", { className: "searchBoxInput", type: "text", placeholder: "Search tabs...", tabIndex: "1", onChange: this.search, ref: "searchbox" })), + React.createElement("input", { className: "searchBoxInput", type: "text", placeholder: "Start typing to search tabs...", tabIndex: "1", onChange: this.search, ref: "searchbox" })), React.createElement("td", { className: "two" }, React.createElement("div", { @@ -421,7 +429,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component className: "icon windowaction trash", title: Object.keys(this.state.selection).length > 0 ? - "Close selected tabs\nWill close " + Object.keys(this.state.selection).length + " tabs" : + "Close selected tabs\nWill close " + maybePluralize(Object.keys(this.state.selection).length, 'tab') : "Close current Tab", onClick: this.deleteTabs, @@ -431,7 +439,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component className: "icon windowaction discard", title: Object.keys(this.state.selection).length > 0 ? - "Discard selected tabs\nWill discard " + Object.keys(this.state.selection).length + " tabs - freeing memory" : + "Discard selected tabs\nWill discard " + maybePluralize(Object.keys(this.state.selection).length, 'tab') + " - freeing memory" : "Select tabs to discard them and free memory", style: @@ -446,7 +454,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component className: "icon windowaction pin", title: Object.keys(this.state.selection).length > 0 ? - "Pin selected tabs\nWill pin " + Object.keys(this.state.selection).length + " tabs" : + "Pin selected tabs\nWill pin " + maybePluralize(Object.keys(this.state.selection).length, 'tab') : "Pin current Tab", onClick: this.pinTabs, @@ -459,9 +467,8 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component " tabs that do not match search" + ( this.state.searchLen > 0 ? "\n" + ( - this.state.filterTabs ? "Will reveal " : "Will hide ") + ( - Object.keys(this.state.tabsbyid).length - Object.keys(this.state.selection).length) + - " tabs" : + this.state.filterTabs ? "Will reveal " : "Will hide ") + + maybePluralize(Object.keys(this.state.tabsbyid).length - Object.keys(this.state.selection).length, 'tab') : ""), onClick: this.toggleFilterMismatchedTabs, @@ -471,7 +478,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component className: "icon windowaction new", title: Object.keys(this.state.selection).length > 0 ? - "Move tabs to new window\nWill move " + Object.keys(this.state.selection).length + " selected tabs to it" : + "Move tabs to new window\nWill move " + maybePluralize(Object.keys(this.state.selection).length, 'selected tab') + " to it" : "Open new empty window", onClick: this.addWindow, @@ -573,6 +580,15 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component { this.state.optionsActive = !this.state.optionsActive; this.forceUpdate(); + } }, { key: "toggleColors", value: function toggleColors( + active, windowId) { + if (!!active) { + this.state.colorsActive = windowId; + } else { + this.state.colorsActive = false; + } + console.log("colorsActive", active, windowId, this.state.colorsActive); + this.forceUpdate(); } }, { key: "update", value: function () {var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {var windows, tabCount, i, window, j, tab, id;return regeneratorRuntime.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:_context2.next = 2;return ( browser.windows.getAll({ populate: true }));case 2:windows = _context2.sent; @@ -756,7 +772,24 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component } }, { key: "search", value: function search( e) { var hiddenCount = this.state.hiddenCount || 0; - var searchLen = (e.target.value || "").length; + var searchQuery = e.target.value || ""; + var searchLen = searchQuery.length; + + var searchType = "normal"; + var searchTerms = []; + if (searchQuery.indexOf(" ") === -1) { + searchType = "normal"; + } else if (searchQuery.indexOf(" OR ") > -1) { + searchTerms = searchQuery.split(" OR "); + searchType = "OR"; + } else if (searchQuery.indexOf(" ") > -1) { + searchTerms = searchQuery.split(" "); + searchType = "AND"; + } + if (searchType != "normal") { + searchTerms = searchTerms.filter(function (entry) {return entry.trim() != '';}); + } + if (!searchLen) { this.state.selection = {}; this.state.hiddenTabs = {}; @@ -764,18 +797,44 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component } else { var idList; var lastSearchLen = this.state.searchLen; - if (!lastSearchLen) { - idList = this.state.tabsbyid; - } else if (lastSearchLen > searchLen) { - idList = this.state.hiddenTabs; - } else if (lastSearchLen < searchLen) { - idList = this.state.selection; - } else { - return; + idList = this.state.tabsbyid; + if (searchType == "normal") { + if (!lastSearchLen) { + idList = this.state.tabsbyid; + } else if (lastSearchLen > searchLen) { + idList = this.state.hiddenTabs; + } else if (lastSearchLen < searchLen) { + idList = this.state.selection; + } } for (var id in idList) { var tab = this.state.tabsbyid[id]; - if ((tab.title + tab.url).toLowerCase().indexOf(e.target.value.toLowerCase()) >= 0) { + var tabSearchTerm = (tab.title + tab.url).toLowerCase(); + var match = false; + if (searchType == "normal") { + match = tabSearchTerm.indexOf(e.target.value.toLowerCase()) >= 0; + } else if (searchType == "OR") {var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { + for (var _iterator = searchTerms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var searchOR = _step.value; + searchOR = searchOR.trim().toLowerCase(); + if (tabSearchTerm.indexOf(searchOR) >= 0) { + match = true; + break; + } + }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator.return) {_iterator.return();}} finally {if (_didIteratorError) {throw _iteratorError;}}} + } else if (searchType == "AND") { + var andMatch = true;var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try { + for (var _iterator2 = searchTerms[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var searchAND = _step2.value; + searchAND = searchAND.trim().toLowerCase(); + if (tabSearchTerm.indexOf(searchAND) >= 0) { + + } else { + andMatch = false; + break; + } + }} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2.return) {_iterator2.return();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}} + match = andMatch; + } + if (match) { hiddenCount -= this.state.hiddenTabs[id] || 0; this.state.selection[id] = true; delete this.state.hiddenTabs[id]; @@ -920,11 +979,11 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component if (!this.state.lastDirection) { if (goRight) this.state.lastDirection = "goRight"; if (goLeft) this.state.lastDirection = "goLeft"; - }var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try { - for (var _iterator = this.state.windows[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var _w = _step.value; + }var _iteratorNormalCompletion3 = true;var _didIteratorError3 = false;var _iteratorError3 = undefined;try { + for (var _iterator3 = this.state.windows[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {var _w = _step3.value; if (found) break; - if (_w.state != "minimized") {var _iteratorNormalCompletion3 = true;var _didIteratorError3 = false;var _iteratorError3 = undefined;try { - for (var _iterator3 = _w.tabs[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {var _t = _step3.value; + if (_w.state != "minimized") {var _iteratorNormalCompletion5 = true;var _didIteratorError5 = false;var _iteratorError5 = undefined;try { + for (var _iterator5 = _w.tabs[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {var _t = _step5.value; last = _t.id; if (!first) first = _t.id; if (!selectedTab) { @@ -950,13 +1009,13 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component } prev = _t.id; // console.log(_t, _t.id == selectedTab); - }} catch (err) {_didIteratorError3 = true;_iteratorError3 = err;} finally {try {if (!_iteratorNormalCompletion3 && _iterator3.return) {_iterator3.return();}} finally {if (_didIteratorError3) {throw _iteratorError3;}}} + }} catch (err) {_didIteratorError5 = true;_iteratorError5 = err;} finally {try {if (!_iteratorNormalCompletion5 && _iterator5.return) {_iterator5.return();}} finally {if (_didIteratorError5) {throw _iteratorError5;}}} } - }} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator.return) {_iterator.return();}} finally {if (_didIteratorError) {throw _iteratorError;}}}var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try { - for (var _iterator2 = this.state.windows[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var _w = _step2.value; + }} catch (err) {_didIteratorError3 = true;_iteratorError3 = err;} finally {try {if (!_iteratorNormalCompletion3 && _iterator3.return) {_iterator3.return();}} finally {if (_didIteratorError3) {throw _iteratorError3;}}}var _iteratorNormalCompletion4 = true;var _didIteratorError4 = false;var _iteratorError4 = undefined;try { + for (var _iterator4 = this.state.windows[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {var _w = _step4.value; if (found) break; - if (_w.state == "minimized") {var _iteratorNormalCompletion4 = true;var _didIteratorError4 = false;var _iteratorError4 = undefined;try { - for (var _iterator4 = _w.tabs[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {var _t = _step4.value; + if (_w.state == "minimized") {var _iteratorNormalCompletion6 = true;var _didIteratorError6 = false;var _iteratorError6 = undefined;try { + for (var _iterator6 = _w.tabs[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {var _t = _step6.value; last = _t.id; if (!first) first = _t.id; if (!selectedTab) { @@ -981,9 +1040,9 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component } prev = _t.id; // console.log(_t, _t.id == selectedTab); - }} catch (err) {_didIteratorError4 = true;_iteratorError4 = err;} finally {try {if (!_iteratorNormalCompletion4 && _iterator4.return) {_iterator4.return();}} finally {if (_didIteratorError4) {throw _iteratorError4;}}} + }} catch (err) {_didIteratorError6 = true;_iteratorError6 = err;} finally {try {if (!_iteratorNormalCompletion6 && _iterator6.return) {_iterator6.return();}} finally {if (_didIteratorError6) {throw _iteratorError6;}}} } - }} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2.return) {_iterator2.return();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}} + }} catch (err) {_didIteratorError4 = true;_iteratorError4 = err;} finally {try {if (!_iteratorNormalCompletion4 && _iterator4.return) {_iterator4.return();}} finally {if (_didIteratorError4) {throw _iteratorError4;}}} if (!found && goRight && first) { if (!altKey) this.state.selection = {}; this.select(first); @@ -1011,13 +1070,13 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component if (selectedTabs.length == 1) { selectedTab = selectedTabs[0]; // console.log(selectedTab); - }var _iteratorNormalCompletion5 = true;var _didIteratorError5 = false;var _iteratorError5 = undefined;try { - for (var _iterator5 = this.state.windows[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {var _w = _step5.value; + }var _iteratorNormalCompletion7 = true;var _didIteratorError7 = false;var _iteratorError7 = undefined;try { + for (var _iterator7 = this.state.windows[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {var _w = _step7.value; i = 0; if (found) break; if (_w.state != "minimized") { - if (!first) first = _w.id;var _iteratorNormalCompletion7 = true;var _didIteratorError7 = false;var _iteratorError7 = undefined;try { - for (var _iterator7 = _w.tabs[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {var _t = _step7.value; + if (!first) first = _w.id;var _iteratorNormalCompletion9 = true;var _didIteratorError9 = false;var _iteratorError9 = undefined;try { + for (var _iterator9 = _w.tabs[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {var _t = _step9.value; i++; last = _w.id; if (!selectedTab) { @@ -1045,16 +1104,16 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component } // console.log(_t, _t.id == selectedTab); - }} catch (err) {_didIteratorError7 = true;_iteratorError7 = err;} finally {try {if (!_iteratorNormalCompletion7 && _iterator7.return) {_iterator7.return();}} finally {if (_didIteratorError7) {throw _iteratorError7;}}} + }} catch (err) {_didIteratorError9 = true;_iteratorError9 = err;} finally {try {if (!_iteratorNormalCompletion9 && _iterator9.return) {_iterator9.return();}} finally {if (_didIteratorError9) {throw _iteratorError9;}}} prev = _w.id; } - }} catch (err) {_didIteratorError5 = true;_iteratorError5 = err;} finally {try {if (!_iteratorNormalCompletion5 && _iterator5.return) {_iterator5.return();}} finally {if (_didIteratorError5) {throw _iteratorError5;}}}var _iteratorNormalCompletion6 = true;var _didIteratorError6 = false;var _iteratorError6 = undefined;try { - for (var _iterator6 = this.state.windows[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {var _w = _step6.value; + }} catch (err) {_didIteratorError7 = true;_iteratorError7 = err;} finally {try {if (!_iteratorNormalCompletion7 && _iterator7.return) {_iterator7.return();}} finally {if (_didIteratorError7) {throw _iteratorError7;}}}var _iteratorNormalCompletion8 = true;var _didIteratorError8 = false;var _iteratorError8 = undefined;try { + for (var _iterator8 = this.state.windows[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {var _w = _step8.value; i = 0; if (found) break; if (_w.state == "minimized") { - if (!first) first = _w.id;var _iteratorNormalCompletion8 = true;var _didIteratorError8 = false;var _iteratorError8 = undefined;try { - for (var _iterator8 = _w.tabs[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {var _t = _step8.value; + if (!first) first = _w.id;var _iteratorNormalCompletion10 = true;var _didIteratorError10 = false;var _iteratorError10 = undefined;try { + for (var _iterator10 = _w.tabs[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {var _t = _step10.value; i++; last = _w.id; if (!selectedTab) { @@ -1081,12 +1140,12 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component break; } // console.log(_t, _t.id == selectedTab); - }} catch (err) {_didIteratorError8 = true;_iteratorError8 = err;} finally {try {if (!_iteratorNormalCompletion8 && _iterator8.return) {_iterator8.return();}} finally {if (_didIteratorError8) {throw _iteratorError8;}}} + }} catch (err) {_didIteratorError10 = true;_iteratorError10 = err;} finally {try {if (!_iteratorNormalCompletion10 && _iterator10.return) {_iterator10.return();}} finally {if (_didIteratorError10) {throw _iteratorError10;}}} prev = _w.id; } } // console.log(found, goDown, first); - } catch (err) {_didIteratorError6 = true;_iteratorError6 = err;} finally {try {if (!_iteratorNormalCompletion6 && _iterator6.return) {_iterator6.return();}} finally {if (_didIteratorError6) {throw _iteratorError6;}}}if (!found && goDown && first) { + } catch (err) {_didIteratorError8 = true;_iteratorError8 = err;} finally {try {if (!_iteratorNormalCompletion8 && _iterator8.return) {_iterator8.return();}} finally {if (_didIteratorError8) {throw _iteratorError8;}}}if (!found && goDown && first) { // console.log("go first", first); this.state.selection = {}; this.selectWindowTab(first, tabPosition); @@ -1111,18 +1170,18 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component } } }, { key: "selectWindowTab", value: function selectWindowTab( windowId, tabPosition) { - if (!tabPosition || tabPosition < 1) tabPosition = 1;var _iteratorNormalCompletion9 = true;var _didIteratorError9 = false;var _iteratorError9 = undefined;try { - for (var _iterator9 = this.state.windows[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {var _w = _step9.value; + if (!tabPosition || tabPosition < 1) tabPosition = 1;var _iteratorNormalCompletion11 = true;var _didIteratorError11 = false;var _iteratorError11 = undefined;try { + for (var _iterator11 = this.state.windows[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {var _w = _step11.value; if (_w.id != windowId) continue; - var i = 0;var _iteratorNormalCompletion10 = true;var _didIteratorError10 = false;var _iteratorError10 = undefined;try { - for (var _iterator10 = _w.tabs[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {var _t = _step10.value; + var i = 0;var _iteratorNormalCompletion12 = true;var _didIteratorError12 = false;var _iteratorError12 = undefined;try { + for (var _iterator12 = _w.tabs[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {var _t = _step12.value; i++; if (_w.tabs.length >= tabPosition && tabPosition == i || _w.tabs.length < tabPosition && _w.tabs.length == i) { this.state.selection = {}; this.select(_t.id); } - }} catch (err) {_didIteratorError10 = true;_iteratorError10 = err;} finally {try {if (!_iteratorNormalCompletion10 && _iterator10.return) {_iterator10.return();}} finally {if (_didIteratorError10) {throw _iteratorError10;}}} - }} catch (err) {_didIteratorError9 = true;_iteratorError9 = err;} finally {try {if (!_iteratorNormalCompletion9 && _iterator9.return) {_iterator9.return();}} finally {if (_didIteratorError9) {throw _iteratorError9;}}} + }} catch (err) {_didIteratorError12 = true;_iteratorError12 = err;} finally {try {if (!_iteratorNormalCompletion12 && _iterator12.return) {_iterator12.return();}} finally {if (_didIteratorError12) {throw _iteratorError12;}}} + }} catch (err) {_didIteratorError11 = true;_iteratorError11 = err;} finally {try {if (!_iteratorNormalCompletion11 && _iterator11.return) {_iterator11.return();}} finally {if (_didIteratorError11) {throw _iteratorError11;}}} } }, { key: "scrollTo", value: function scrollTo( what, id) { var els = document.getElementById(what + "-" + id); @@ -1396,7 +1455,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component } }, { key: "tabWidthText", value: function tabWidthText() { this.setState({ - bottomText: "Change the width of this window. 530 by default." }); + bottomText: "Change the width of this window. 800 by default." }); } }, { key: "changeTabHeight", value: function changeTabHeight( e) { @@ -1408,7 +1467,7 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component } }, { key: "tabHeightText", value: function tabHeightText() { this.setState({ - bottomText: "Change the height of this window. 400 by default." }); + bottomText: "Change the height of this window. 600 by default." }); } }, { key: "toggleAnimations", value: function toggleAnimations() { @@ -1508,6 +1567,10 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component } }, { key: "exportSessions", value: function exportSessions() { + if (this.state.sessions.length == 0) { + window.alert("You have currently no windows saved for later. There is nothing to export."); + return; + } var exportName = "tab-manager-plus-backup"; var today = new Date(); var y = today.getFullYear(); @@ -1534,6 +1597,12 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component } }, { key: "importSessions", value: function importSessions( evt) {var _this8 = this; + if (navigator.userAgent.search("Firefox") > -1) { + if (window.inPopup) { + window.alert("Due to a Firefox bug session import does not work in the popup. Please use the options screen or open Tab Manager Plus in its' own tab"); + return; + } + } try { var inputField = evt.target; // #session_import var files = evt.target.files; @@ -1619,7 +1688,9 @@ TabManager = function (_React$Component) {_inherits(TabManager, _React$Component "Middle click to close a tab", "Tab Manager Plus loves saving time", "To see incognito tabs, enable incognito access in the extension settings", - "You can drag and drop tabs to other windows"]; + "You can drag and drop tabs to other windows", + "You can type to search right away", + "You can search for different tabs : google OR yahoo"]; return "Tip: " + tips[Math.floor(Math.random() * tips.length)]; @@ -1697,4 +1768,7 @@ function debounce(func, wait, immediate) { timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; -} \ No newline at end of file +} + +var maybePluralize = function maybePluralize(count, noun) {var suffix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 's';return ( + count + " " + noun + (count !== 1 ? suffix : ''));}; \ No newline at end of file diff --git a/outlib/TabNew.js b/outlib/TabNew.js deleted file mode 100644 index 9253b3bc..00000000 --- a/outlib/TabNew.js +++ /dev/null @@ -1,203 +0,0 @@ -"use strict";var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();function _asyncToGenerator(fn) {return function () {var gen = fn.apply(this, arguments);return new Promise(function (resolve, reject) {function step(key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {return Promise.resolve(value).then(function (value) {step("next", value);}, function (err) {step("throw", err);});}}return step("next");});};}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self, call) {if (!self) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call && (typeof call === "object" || typeof call === "function") ? call : self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;}var - -Tab = function (_React$Component) {_inherits(Tab, _React$Component); - function Tab(props) {_classCallCheck(this, Tab);var _this = _possibleConstructorReturn(this, (Tab.__proto__ || Object.getPrototypeOf(Tab)).call(this, - props)); - _this.state = { - favIcon: "" }; - - - _this.onHover = _this.onHover.bind(_this); - _this.onMouseDown = _this.onMouseDown.bind(_this); - _this.click = _this.click.bind(_this); - _this.dragStart = _this.dragStart.bind(_this); - _this.dragOver = _this.dragOver.bind(_this); - _this.dragOut = _this.dragOut.bind(_this); - _this.drop = _this.drop.bind(_this); - _this.resolveFavIconUrl = _this.resolveFavIconUrl.bind(_this);return _this; - - }_createClass(Tab, [{ key: "componentWillMount", value: function componentWillMount() - { - this.resolveFavIconUrl(); - } }, { key: "render", value: function render() - { - var children = []; - if (this.props.layout == "vertical") { - children.push( - React.createElement("div", { key: "tab-pinned-" + this.props.tab.id, className: "tab-pinned " + (!this.props.tab.pinned ? "hidden" : "") }, "Pinned")); - - - - children.push( - React.createElement("div", { key: "tab-highlighted-" + this.props.tab.id, className: "tab-highlighted " + (!this.props.tab.highlighted ? "hidden" : "") }, "Active")); - - - - children.push( - React.createElement("div", { key: "tab-selected-" + this.props.tab.id, className: "tab-selected " + (!this.props.selected ? "hidden" : "") }, "Selected")); - - - - children.push( - React.createElement("div", { - key: "tab-icon-" + this.props.tab.id, - className: "iconoverlay ", - style: { - backgroundImage: this.state.favIcon } })); - - - - children.push( - React.createElement("div", { key: "tab-title-" + this.props.tab.id, className: "tabtitle" }, - this.props.tab.title)); - - - } - - var tabDom = { - key: "tab-" + this.props.tab.id, - id: "tab-" + this.props.tab.id, - ref: "tab2" + this.props.tab.id, - className: - "icon tab " + ( - this.props.selected ? "selected " : "") + ( - this.props.tab.pinned ? "pinned " : "") + ( - this.props.tab.highlighted ? "highlighted " : "") + ( - this.props.hidden ? "hidden " : "") + ( - this.props.tab.mutedInfo && this.props.tab.mutedInfo.muted ? "muted " : "") + ( - this.props.tab.audible ? "audible " : "") + ( - this.props.tab.discarded ? "discarded " : "") + ( - this.props.layout == "vertical" ? "full " : "") + ( - this.props.tab.incognito ? "incognito " : "") + ( - this.state.draggingOver || "") + ( - this.props.searchActive ? "search-active " : "") + - " tab-" + - this.props.tab.id + - " " + ( - this.props.layout == "vertical" ? "vertical " : "blocks "), - style: - this.props.layout == "vertical" ? - {} : - { backgroundImage: this.state.favIcon }, - - - - title: this.props.tab.title, - onClick: this.click, - onMouseDown: this.onMouseDown, - onMouseEnter: this.onHover }; - - - if (!!this.props.drag) { - tabDom["onDragStart"] = this.dragStart; - tabDom["onDragOver"] = this.dragOver; - tabDom["onDragLeave"] = this.dragOut; - tabDom["onDrop"] = this.drop; - tabDom["draggable"] = "true"; - } - - return ( - React.createElement("div", tabDom, - children, - React.createElement("div", { className: "limiter" }))); - - - } }, { key: "onHover", value: function onHover( - e) { - this.props.hoverHandler(this.props.tab); - this.resolveFavIconUrl(); - } }, { key: "onMouseDown", value: function onMouseDown( - e) { - if (e.button === 0) return; - if (!this.props.drag) return; - this.click(e); - } }, { key: "click", value: function click( - e) { - e.nativeEvent.preventDefault(); - e.nativeEvent.stopPropagation(); - if (!this.props.drag) return; - if (e.button === 1) { - this.props.middleClick(this.props.tab.id); - } else if (e.button === 2 || e.nativeEvent.metaKey || e.nativeEvent.altKey || e.nativeEvent.shiftKey || e.nativeEvent.ctrlKey) { - e.preventDefault(); - if (e.button === 2 && (e.nativeEvent.metaKey || e.nativeEvent.altKey || e.nativeEvent.shiftKey || e.nativeEvent.ctrlKey)) { - this.props.selectTo(this.props.tab.id); - } else { - this.props.select(this.props.tab.id); - } - } else { - browser.tabs.update(this.props.tab.id, { active: true }).then( - function () { - browser.windows.update(this.props.window.id, { focused: true }).then( - function () { - if (!!window.inPopup) window.close(); - }.bind(this)); - - }.bind(this)); - - } - return false; - } }, { key: "dragStart", value: function dragStart( - e) { - if (!!this.props.drag) { - e.dataTransfer.setData("Text", this.props.tab.id); - e.dataTransfer.setData("text/uri-list", this.props.tab.url); - this.props.drag(e, this.props.tab.id); - } else { - return false; - } - } }, { key: "dragOver", value: function dragOver( - e) { - e.nativeEvent.preventDefault(); - if (!this.props.drag) return; - var before = this.state.draggingOver; - if (this.props.layout == "vertical") { - this.state.draggingOver = e.nativeEvent.offsetY > ReactDOM.findDOMNode(this).clientHeight / 2 ? "bottom" : "top"; - } else { - this.state.draggingOver = e.nativeEvent.offsetX > ReactDOM.findDOMNode(this).clientWidth / 2 ? "right" : "left"; - } - if (before != this.state.draggingOver) this.forceUpdate(); - } }, { key: "dragOut", value: function dragOut() - { - if (!this.props.drag) return; - delete this.state.draggingOver; - this.forceUpdate(); - } }, { key: "drop", value: function drop( - e) { - if (!!this.props.drop) { - e.nativeEvent.preventDefault(); - e.stopPropagation(); - var before = this.state.draggingOver == "top" || this.state.draggingOver == "left"; - delete this.state.draggingOver; - this.props.drop(this.props.tab.id, before); - } else { - return false; - } - } }, { key: "resolveFavIconUrl", value: function () {var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {var image, favIcons, iconName;return regeneratorRuntime.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0: - - - // if(!!browser.tabs.captureTab) { - // console.log("tabs captureTab"); - // image = await browser.tabs.captureTab(this.props.tab.id); - // image = "url(" + image + ")"; - // }else - if (this.props.tab.url.indexOf("chrome://") !== 0 && this.props.tab.url.indexOf("about:") !== 0) { - // if(!!browser.tabs.captureVisibleTab && this.props.tab.highlighted) { - // console.log("tabsCapture"); - // try { - // image = await browser.tabs.captureVisibleTab( this.props.window.id, {} ); - // //console.log(image); - // } catch ( e ) { - // console.log(e.message); - // } - // image = "url(" + image + ")"; - // }else{ - image = this.props.tab.favIconUrl ? "url(" + this.props.tab.favIconUrl + ")" : ""; - //} - } else { - favIcons = ["bookmarks", "chrome", "crashes", "downloads", "extensions", "flags", "history", "settings"]; - iconName = this.props.tab.url.slice(9).match(/^\w+/g); - image = !iconName || favIcons.indexOf(iconName[0]) < 0 ? "" : "url(../images/chrome/" + iconName[0] + ".png)"; - } - this.setState({ - favIcon: image });case 2:case "end":return _context.stop();}}}, _callee, this);}));function resolveFavIconUrl() {return _ref.apply(this, arguments);}return resolveFavIconUrl;}() }]);return Tab;}(React.Component); \ No newline at end of file diff --git a/outlib/TabOptions.js b/outlib/TabOptions.js index c88b955b..f70b5a26 100644 --- a/outlib/TabOptions.js +++ b/outlib/TabOptions.js @@ -6,7 +6,7 @@ TabOptions = function (_React$Component) {_inherits(TabOptions, _React$Component _this.state = {};return _this; }_createClass(TabOptions, [{ key: "logo", value: function logo() { - var logo = [React.createElement("img", { src: "images/browsers.svg", style: { maxWidth: "3rem" } }), React.createElement("h2", null, "Tab Manager Plus ", "5.1.6")]; + var logo = [React.createElement("img", { src: "images/browsers.svg", style: { maxWidth: "3rem" } }), React.createElement("h2", null, "Tab Manager Plus ", "5.2.0")]; return ( React.createElement("div", { className: "logo-options" }, @@ -189,7 +189,7 @@ TabOptions = function (_React$Component) {_inherits(TabOptions, _React$Component React.createElement("i", null, "By default: disabled ( experimental feature )"))), - React.createElement("div", { className: "toggle-box" }, + this.props.sessionsFeature && React.createElement("div", { className: "toggle-box" }, React.createElement("div", { className: "toggle-box" }, React.createElement("label", { className: "textlabel", htmlFor: "session_export", style: { whiteSpace: "pre", lineHeight: "2rem" } }, React.createElement("h4", null, "Export/Backup Sessions")), @@ -201,7 +201,7 @@ TabOptions = function (_React$Component) {_inherits(TabOptions, _React$Component React.createElement("div", { className: "option-description" }, "Allows you to backup your saved windows to an external file.")), - React.createElement("div", { className: "toggle-box" }, + this.props.sessionsFeature && React.createElement("div", { className: "toggle-box" }, React.createElement("div", { className: "toggle-box" }, React.createElement("label", { className: "textlabel", htmlFor: "session_import", style: { whiteSpace: "pre", lineHeight: "2rem" } }, React.createElement("h4", null, "Import/Restore Sessions")), @@ -321,19 +321,6 @@ TabOptions = function (_React$Component) {_inherits(TabOptions, _React$Component - React.createElement("div", { className: "option-description" }, "If you also want to see your incognito tabs in the Tab Manager overview, then enable incognito access for this extension."))), - - - - - React.createElement("div", { className: "optionsBox" }, - React.createElement("h4", null, "Other shortcuts"), - React.createElement("div", { className: "toggle-box" }, - React.createElement("div", { className: "toggle-box" }, - React.createElement("a", { href: "#", onClick: this.openIncognitoOptions }, "Allow in Incognito")), - - - React.createElement("div", { className: "option-description" }, "If you also want to see your incognito tabs in the Tab Manager overview, then enable incognito access for this extension.")), diff --git a/outlib/TabOptionsFirefox.js b/outlib/TabOptionsFirefox.js index 63898b2a..04570fff 100644 --- a/outlib/TabOptionsFirefox.js +++ b/outlib/TabOptionsFirefox.js @@ -6,7 +6,7 @@ TabOptions = function (_React$Component) {_inherits(TabOptions, _React$Component _this.state = {};return _this; }_createClass(TabOptions, [{ key: "logo", value: function logo() { - var logo = [React.createElement("img", { src: "images/browsers.svg", style: { maxWidth: "3rem" } }), React.createElement("h2", null, "Tab Manager Plus ", "5.1.6")]; + var logo = [React.createElement("img", { src: "images/browsers.svg", style: { maxWidth: "3rem" } }), React.createElement("h2", null, "Tab Manager Plus ", "5.2.0")]; return ( React.createElement("div", { className: "logo-options" }, @@ -189,7 +189,7 @@ TabOptions = function (_React$Component) {_inherits(TabOptions, _React$Component React.createElement("i", null, "By default: disabled ( experimental feature )"))), - React.createElement("div", { className: "toggle-box" }, + this.props.sessionsFeature && React.createElement("div", { className: "toggle-box" }, React.createElement("div", { className: "toggle-box" }, React.createElement("label", { className: "textlabel", htmlFor: "session_export", style: { whiteSpace: "pre", lineHeight: "2rem" } }, React.createElement("h4", null, "Export/Backup Sessions")), @@ -201,7 +201,7 @@ TabOptions = function (_React$Component) {_inherits(TabOptions, _React$Component React.createElement("div", { className: "option-description" }, "Allows you to backup your saved windows to an external file.")), - React.createElement("div", { className: "toggle-box" }, + this.props.sessionsFeature && React.createElement("div", { className: "toggle-box" }, React.createElement("div", { className: "toggle-box" }, React.createElement("label", { className: "textlabel", htmlFor: "session_import", style: { whiteSpace: "pre", lineHeight: "2rem" } }, React.createElement("h4", null, "Import/Restore Sessions")), @@ -299,19 +299,6 @@ TabOptions = function (_React$Component) {_inherits(TabOptions, _React$Component - React.createElement("div", { className: "option-description" }, "If you also want to see your private tabs in the Tab Manager overview, then enable private windows access for this extension."))), - - - - - React.createElement("div", { className: "optionsBox" }, - React.createElement("h4", null, "Other shortcuts"), - React.createElement("div", { className: "toggle-box" }, - React.createElement("div", { className: "toggle-box" }, - React.createElement("a", { href: "#", onClick: this.openIncognitoOptions }, "Allow in Private Windows")), - - - React.createElement("div", { className: "option-description" }, "If you also want to see your private tabs in the Tab Manager overview, then enable private windows access for this extension.")), diff --git a/outlib/Window.js b/outlib/Window.js index 4bc18c43..b3441c58 100644 --- a/outlib/Window.js +++ b/outlib/Window.js @@ -41,7 +41,8 @@ Window = function (_React$Component) {_inherits(Window, _React$Component); _this2.minimize = _this2.minimize.bind(_this2); _this2.save = _this2.save.bind(_this2); _this2.stop = _this2.stop.bind(_this2); - _this2.windowClick = _this2.windowClick.bind(_this2);return _this2; + _this2.windowClick = _this2.windowClick.bind(_this2); + _this2.selectToFromTab = _this2.selectToFromTab.bind(_this2);return _this2; }_createClass(Window, [{ key: "render", value: function render() { @@ -79,7 +80,7 @@ Window = function (_React$Component) {_inherits(Window, _React$Component); hoverHandler: _this.props.hoverHandler, searchActive: _this.props.searchActive, select: _this.props.select, - selectTo: _this.selectTo, + selectTo: _this.selectToFromTab, drag: _this.props.drag, drop: _this.props.drop, dropWindow: _this.props.dropWindow, @@ -480,7 +481,7 @@ Window = function (_React$Component) {_inherits(Window, _React$Component); } this.props.parentUpdate(); if (!!window.inPopup) window.close();return _context.abrupt("return", - false);case 9:case "end":return _context.stop();}}}, _callee, this);}));function windowClick(_x) {return _ref.apply(this, arguments);}return windowClick;}() }, { key: "selectTo", value: function selectTo( + false);case 9:case "end":return _context.stop();}}}, _callee, this);}));function windowClick(_x) {return _ref.apply(this, arguments);}return windowClick;}() }, { key: "selectToFromTab", value: function selectToFromTab( tabId) { if (tabId) this.props.selectTo(tabId, this.props.tabs); @@ -567,6 +568,7 @@ Window = function (_React$Component) {_inherits(Window, _React$Component); e) { this.stopProp(e); + this.props.toggleColors(!this.state.colorActive, this.props.window.id); this.setState({ colorActive: !this.state.colorActive }); @@ -588,6 +590,7 @@ Window = function (_React$Component) {_inherits(Window, _React$Component); localStorage["windowColors"] = JSON.stringify(colors); } }, { key: "closePopup", value: function closePopup() { + this.props.toggleColors(!this.state.colorActive, this.props.window.id); this.setState({ colorActive: !this.state.colorActive }); diff --git a/outlib/background.js b/outlib/background.js index 48476b94..f1aa36b7 100644 --- a/outlib/background.js +++ b/outlib/background.js @@ -2,6 +2,8 @@ + + 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: pinnedIndex = 0; @@ -116,8 +118,6 @@ - - function _callee4(tab) {var tabLimit, tabCount;return regeneratorRuntime.wrap(function _callee4$(_context4) {while (1) {switch (_context4.prev = _context4.next) {case 0: if (typeof localStorage["tabLimit"] === "undefined") localStorage["tabLimit"] = "0"; try { @@ -133,7 +133,7 @@ - updateTabCountDebounce();case 11:case "end":return _context4.stop();}}}, _callee4, this);}));return function tabAdded(_x4) {return _ref4.apply(this, arguments);};}();var openPopup = function () {var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( + updateTabCountDebounce();case 11:case "end":return _context4.stop();}}}, _callee4, this);}));return function tabAdded(_x4) {return _ref4.apply(this, arguments);};}();var openSidebar = function () {var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( @@ -160,7 +160,11 @@ - function _callee5() {var openInOwnTab;return regeneratorRuntime.wrap(function _callee5$(_context5) {while (1) {switch (_context5.prev = _context5.next) {case 0: + function _callee5() {return regeneratorRuntime.wrap(function _callee5$(_context5) {while (1) {switch (_context5.prev = _context5.next) {case 0:_context5.next = 2;return ( + browser.sidebarAction.open());case 2:case "end":return _context5.stop();}}}, _callee5, this);}));return function openSidebar() {return _ref5.apply(this, arguments);};}();var openPopup = function () {var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( + + + function _callee6() {var openInOwnTab;return regeneratorRuntime.wrap(function _callee6$(_context6) {while (1) {switch (_context6.prev = _context6.next) {case 0: if (typeof localStorage["openInOwnTab"] === "undefined") localStorage["openInOwnTab"] = "0"; openInOwnTab = false; try { @@ -168,18 +172,18 @@ } catch (e) { openInOwnTab = false; }if (! - openInOwnTab) {_context5.next = 12;break;}_context5.next = 6;return ( - browser.browserAction.setPopup({ popup: "popup.html?popup=true" }));case 6:_context5.next = 8;return ( - browser.browserAction.openPopup());case 8:_context5.next = 10;return ( - browser.browserAction.setPopup({ popup: "" }));case 10:_context5.next = 14;break;case 12:_context5.next = 14;return ( + openInOwnTab) {_context6.next = 12;break;}_context6.next = 6;return ( + browser.browserAction.setPopup({ popup: "popup.html?popup=true" }));case 6:_context6.next = 8;return ( + browser.browserAction.openPopup());case 8:_context6.next = 10;return ( + browser.browserAction.setPopup({ popup: "" }));case 10:_context6.next = 14;break;case 12:_context6.next = 14;return ( - browser.browserAction.openPopup());case 14:case "end":return _context5.stop();}}}, _callee5, this);}));return function openPopup() {return _ref5.apply(this, arguments);};}();var openAsOwnTab = function () {var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( + browser.browserAction.openPopup());case 14:case "end":return _context6.stop();}}}, _callee6, this);}));return function openPopup() {return _ref6.apply(this, arguments);};}();var openAsOwnTab = function () {var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( - function _callee6() {var popup_page, tabs, currentTab, previousTab, i, tab;return regeneratorRuntime.wrap(function _callee6$(_context6) {while (1) {switch (_context6.prev = _context6.next) {case 0: - popup_page = browser.runtime.getURL("popup.html");_context6.next = 3;return ( - browser.tabs.query({}));case 3:tabs = _context6.sent; + function _callee7() {var popup_page, tabs, currentTab, previousTab, i, tab;return regeneratorRuntime.wrap(function _callee7$(_context7) {while (1) {switch (_context7.prev = _context7.next) {case 0: + popup_page = browser.runtime.getURL("popup.html");_context7.next = 3;return ( + browser.tabs.query({}));case 3:tabs = _context7.sent; @@ -188,24 +192,24 @@ previousTab = window.tabsActive[window.tabsActive.length - 2]; } - i = 0;case 6:if (!(i < tabs.length)) {_context6.next = 17;break;} + i = 0;case 6:if (!(i < tabs.length)) {_context7.next = 17;break;} tab = tabs[i];if (!( - tab.url.indexOf("popup.html") > -1 && tab.url.indexOf(popup_page) > -1)) {_context6.next = 14;break;}if (!( - currentTab && currentTab.tabId && tab.id == currentTab.tabId && previousTab && previousTab.tabId)) {_context6.next = 13;break;}return _context6.abrupt("return", - focusOnTabAndWindow(previousTab));case 13:return _context6.abrupt("return", + tab.url.indexOf("popup.html") > -1 && tab.url.indexOf(popup_page) > -1)) {_context7.next = 14;break;}if (!( + currentTab && currentTab.tabId && tab.id == currentTab.tabId && previousTab && previousTab.tabId)) {_context7.next = 13;break;}return _context7.abrupt("return", + focusOnTabAndWindow(previousTab));case 13:return _context7.abrupt("return", browser.windows.update(tab.windowId, { focused: true }).then( function () { browser.tabs.highlight({ windowId: tab.windowId, tabs: tab.index }); - }.bind(this)));case 14:i++;_context6.next = 6;break;case 17:return _context6.abrupt("return", + }.bind(this)));case 14:i++;_context7.next = 6;break;case 17:return _context7.abrupt("return", - browser.tabs.create({ url: "popup.html" }));case 18:case "end":return _context6.stop();}}}, _callee6, this);}));return function openAsOwnTab() {return _ref6.apply(this, arguments);};}();var setupPopup = function () {var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( + browser.tabs.create({ url: "popup.html" }));case 18:case "end":return _context7.stop();}}}, _callee7, this);}));return function openAsOwnTab() {return _ref7.apply(this, arguments);};}();var setupPopup = function () {var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( - function _callee7() {var openInOwnTab;return regeneratorRuntime.wrap(function _callee7$(_context7) {while (1) {switch (_context7.prev = _context7.next) {case 0: + function _callee8() {var openInOwnTab;return regeneratorRuntime.wrap(function _callee8$(_context8) {while (1) {switch (_context8.prev = _context8.next) {case 0: if (typeof localStorage["openInOwnTab"] === "undefined") localStorage["openInOwnTab"] = "0"; openInOwnTab = false; try { @@ -213,17 +217,20 @@ } catch (e) { openInOwnTab = false; } - console.log(openInOwnTab);_context7.next = 6;return ( + console.log(openInOwnTab);_context8.next = 6;return ( browser.browserAction.onClicked.removeListener(openAsOwnTab));case 6:if (! - openInOwnTab) {_context7.next = 13;break;}_context7.next = 9;return ( - browser.browserAction.setPopup({ popup: "" }));case 9:_context7.next = 11;return ( - browser.browserAction.onClicked.addListener(openAsOwnTab));case 11:_context7.next = 15;break;case 13:_context7.next = 15;return ( + openInOwnTab) {_context8.next = 13;break;}_context8.next = 9;return ( + browser.browserAction.setPopup({ popup: "" }));case 9:_context8.next = 11;return ( + browser.browserAction.onClicked.addListener(openAsOwnTab));case 11:_context8.next = 15;break;case 13:_context8.next = 15;return ( - 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( + browser.browserAction.setPopup({ popup: "popup.html?popup=true" }));case 15: + if (browser.sidebarAction) { + browser.sidebarAction.setPanel({ panel: "popup.html?panel=true" }); + }case 16:case "end":return _context8.stop();}}}, _callee8, this);}));return function setupPopup() {return _ref8.apply(this, arguments);};}();var setupListeners = function () {var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( - function _callee8() {return regeneratorRuntime.wrap(function _callee8$(_context8) {while (1) {switch (_context8.prev = _context8.next) {case 0:_context8.next = 2;return ( + function _callee9() {return regeneratorRuntime.wrap(function _callee9$(_context9) {while (1) {switch (_context9.prev = _context9.next) {case 0:_context9.next = 2;return ( browser.contextMenus.removeAll());case 2: browser.contextMenus.create({ @@ -238,6 +245,13 @@ onclick: openPopup }); } + if (!!browser.sidebarAction) { + browser.contextMenus.create({ + title: "🗂 Open sidebar", + contexts: ["browser_action"], + onclick: openSidebar }); + } + browser.contextMenus.create({ type: "separator", contexts: ["browser_action"] }); @@ -276,6 +290,14 @@ browser.tabs.create({ url: 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=67TZLSEGYQFFW' }); } }); + browser.contextMenus.create({ + title: "🐦 Follow on Twitter", + "contexts": ["browser_action"], + parentId: "support_menu", + onclick: function onclick(info, tab) { + browser.tabs.create({ url: 'https://www.twitter.com/mastef' }); + } }); + browser.contextMenus.create({ title: "🤔 Issues and Suggestions", id: "code_menu", @@ -348,15 +370,16 @@ browser.windows.onFocusChanged.addListener(windowFocus); browser.windows.onCreated.addListener(windowCreated); browser.windows.onRemoved.addListener(windowRemoved); - updateTabCountDebounce();case 39:case "end":return _context8.stop();}}}, _callee8, this);}));return function setupListeners() {return _ref8.apply(this, arguments);};}(); + updateTabCountDebounce(); + + setTimeout(cleanUp, 5000);case 42:case "end":return _context9.stop();}}}, _callee9, this);}));return function setupListeners() {return _ref9.apply(this, arguments);};}(); // Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of the trailing. -var hideWindows = function () {var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( - +var hideWindows = function () {var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( @@ -414,50 +437,49 @@ var hideWindows = function () {var _ref9 = _asyncToGenerator( /*#__PURE__*/regen + function _callee11(windowId) {var result;return regeneratorRuntime.wrap(function _callee11$(_context11) {while (1) {switch (_context11.prev = _context11.next) {case 0:if (!( + navigator.userAgent.search("Firefox") > -1)) {_context11.next = 2;break;}return _context11.abrupt("return");case 2:if (!( - function _callee10(windowId) {var result;return regeneratorRuntime.wrap(function _callee10$(_context10) {while (1) {switch (_context10.prev = _context10.next) {case 0:if (!( - navigator.userAgent.search("Firefox") > -1)) {_context10.next = 2;break;}return _context10.abrupt("return");case 2:if (!( + !windowId || windowId < 0)) {_context11.next = 6;break;}return _context11.abrupt("return");case 6:if (! - !windowId || windowId < 0)) {_context10.next = 6;break;}return _context10.abrupt("return");case 6:if (! - - localStorageAvailable()) {_context10.next = 12;break;} + localStorageAvailable()) {_context11.next = 12;break;} if (typeof localStorage["hideWindows"] === "undefined") localStorage["hideWindows"] = "0";if (!( - localStorage["hideWindows"] == "0")) {_context10.next = 10;break;}return _context10.abrupt("return");case 10:_context10.next = 14;break;case 12: + localStorage["hideWindows"] == "0")) {_context11.next = 10;break;}return _context11.abrupt("return");case 10:_context11.next = 14;break;case 12: - console.log("no local storage");return _context10.abrupt("return");case 14:_context10.next = 16;return ( + console.log("no local storage");return _context11.abrupt("return");case 14:_context11.next = 16;return ( - browser.permissions.contains({ permissions: ['system.display'] }));case 16:result = _context10.sent; + browser.permissions.contains({ permissions: ['system.display'] }));case 16:result = _context11.sent; if (result) { // The extension has the permissions. - chrome.system.display.getInfo(function () {var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(windowId, displaylayouts) {var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, displaylayout, windows, monitor, i, a, result;return regeneratorRuntime.wrap(function _callee9$(_context9) {while (1) {switch (_context9.prev = _context9.next) {case 0: + chrome.system.display.getInfo(function () {var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(windowId, displaylayouts) {var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, displaylayout, windows, monitor, i, a, result;return regeneratorRuntime.wrap(function _callee10$(_context10) {while (1) {switch (_context10.prev = _context10.next) {case 0: window.displayInfo = []; _iteratorNormalCompletion = true; _didIteratorError = false; - _iteratorError = undefined;_context9.prev = 4; + _iteratorError = undefined;_context10.prev = 4; for (_iterator = displaylayouts[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {displaylayout = _step.value; window.displayInfo.push(displaylayout.bounds); - }_context9.next = 12;break;case 8:_context9.prev = 8;_context9.t0 = _context9["catch"](4); + }_context10.next = 12;break;case 8:_context10.prev = 8;_context10.t0 = _context10["catch"](4); _didIteratorError = true; - _iteratorError = _context9.t0;case 12:_context9.prev = 12;_context9.prev = 13; + _iteratorError = _context10.t0;case 12:_context10.prev = 12;_context10.prev = 13; if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); - }case 15:_context9.prev = 15;if (! + }case 15:_context10.prev = 15;if (! - _didIteratorError) {_context9.next = 18;break;}throw ( - _iteratorError);case 18:return _context9.finish(15);case 19:return _context9.finish(12);case 20:_context9.next = 22;return ( + _didIteratorError) {_context10.next = 18;break;}throw ( + _iteratorError);case 18:return _context10.finish(15);case 19:return _context10.finish(12);case 20:_context10.next = 22;return ( - browser.windows.getAll({ populate: true }));case 22:windows = _context9.sent; + browser.windows.getAll({ populate: true }));case 22:windows = _context10.sent; monitor = -1; for (i = windows.length - 1; i >= 0; i--) { if (windows[i].id == windowId) { @@ -470,43 +492,128 @@ var hideWindows = function () {var _ref9 = _asyncToGenerator( /*#__PURE__*/regen } }; - i = windows.length - 1;case 27:if (!(i >= 0)) {_context9.next = 35;break;}if (!( - windows[i].id != windowId)) {_context9.next = 32;break;}if (! - is_in_bounds(windows[i], window.displayInfo[monitor])) {_context9.next = 32;break;}_context9.next = 32;return ( - browser.windows.update(windows[i].id, { "state": "minimized" }));case 32:i--;_context9.next = 27;break;case 35: + i = windows.length - 1;case 27:if (!(i >= 0)) {_context10.next = 35;break;}if (!( + windows[i].id != windowId)) {_context10.next = 32;break;}if (! + is_in_bounds(windows[i], window.displayInfo[monitor])) {_context10.next = 32;break;}_context10.next = 32;return ( + browser.windows.update(windows[i].id, { "state": "minimized" }));case 32:i--;_context10.next = 27;break;case 35: - ;case 36:case "end":return _context9.stop();}}}, _callee9, this, [[4, 8, 12, 20], [13,, 15, 19]]);}));return function (_x6, _x7) {return _ref10.apply(this, arguments);};}(). + ;case 36:case "end":return _context10.stop();}}}, _callee10, this, [[4, 8, 12, 20], [13,, 15, 19]]);}));return function (_x6, _x7) {return _ref11.apply(this, arguments);};}(). bind(null, windowId)); - }case 18:case "end":return _context10.stop();}}}, _callee10, this);}));return function hideWindows(_x5) {return _ref9.apply(this, arguments);};}();function _asyncToGenerator(fn) {return function () {var gen = fn.apply(this, arguments);return new Promise(function (resolve, reject) {function step(key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {return Promise.resolve(value).then(function (value) {step("next", value);}, function (err) {step("throw", err);});}}return step("next");});};}var browser = browser || chrome;function focusOnTabAndWindowDelayed(tab) {var tab = JSON.parse(JSON.stringify(tab));setTimeout(focusOnTabAndWindow.bind(this, tab), 125);}function focusOnWindowDelayed(windowId) {setTimeout(focusOnWindow.bind(this, windowId), 125);}function focusOnWindow(windowId) {browser.windows.update(windowId, { focused: true });}var updateTabCountDebounce = debounce(updateTabCount, 250);function tabRemoved() {updateTabCountDebounce();}window.tabsActive = [];function tabActiveChanged(tab) {if (!!tab && !!tab.tabId) {if (!window.tabsActive) window.tabsActive = [];if (!!window.tabsActive && window.tabsActive.length > 0) {var lastActive = window.tabsActive[window.tabsActive.length - 1];if (!!lastActive && lastActive.tabId == tab.tabId && lastActive.windowId == tab.windowId) {return;}}while (window.tabsActive.length > 20) {window.tabsActive.shift();}for (var i = window.tabsActive.length - 1; i >= 0; i--) {if (window.tabsActive[i].tabId == tab.tabId) {window.tabsActive.splice(i, 1);}};window.tabsActive.push(tab);}updateTabCountDebounce();}function debounce(func, wait, immediate) {var timeout;return function () {var context = this,args = arguments;var later = function later() {timeout = null;if (!immediate) func.apply(context, args);};var callNow = immediate && !timeout;clearTimeout(timeout);timeout = setTimeout(later, wait);if (callNow) func.apply(context, args);};};function localStorageAvailable() {var test = 'test';try {localStorage.setItem(test, test);localStorage.removeItem(test);return true;} catch (e) {return false;}}function windowFocus(windowId) {try {if (!!windowId) {windowActive(windowId); // console.log("onFocused", windowId); + }case 18:case "end":return _context11.stop();}}}, _callee11, this);}));return function hideWindows(_x5) {return _ref10.apply(this, arguments);};}();var cleanUp = function () {var _ref13 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + function _callee13() {var activewindows, windowids, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, w, windows, i, names, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, id;return regeneratorRuntime.wrap(function _callee13$(_context13) {while (1) {switch (_context13.prev = _context13.next) {case 0:_context13.next = 2;return ( + browser.windows.getAll({ populate: true }));case 2:activewindows = _context13.sent; + windowids = [];_iteratorNormalCompletion3 = true;_didIteratorError3 = false;_iteratorError3 = undefined;_context13.prev = 7; + for (_iterator3 = activewindows[Symbol.iterator](); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {w = _step3.value; + windowids.push(w.id); + } + // console.log("window ids...", windowids); + _context13.next = 15;break;case 11:_context13.prev = 11;_context13.t0 = _context13["catch"](7);_didIteratorError3 = true;_iteratorError3 = _context13.t0;case 15:_context13.prev = 15;_context13.prev = 16;if (!_iteratorNormalCompletion3 && _iterator3.return) {_iterator3.return();}case 18:_context13.prev = 18;if (!_didIteratorError3) {_context13.next = 21;break;}throw _iteratorError3;case 21:return _context13.finish(18);case 22:return _context13.finish(15);case 23:windows = JSON.parse(localStorage["windowAge"]); + if (windows instanceof Array) { + + } else { + windows = []; + } + // console.log("before", JSON.parse(JSON.stringify(windows))); + for (i = windows.length - 1; i >= 0; i--) { + if (windowids.indexOf(windows[i]) < 0) { + // console.log("did not find", windows[i], i); + windows.splice(i, 1); + } + }; + // console.log("after", JSON.parse(JSON.stringify(windows))); + localStorage["windowAge"] = JSON.stringify(windows); + + names = localStorage["windowNames"]; + if (!!names) { + names = JSON.parse(names); + } else { + names = {}; + } + + // console.log("before", JSON.parse(JSON.stringify(names))); + _iteratorNormalCompletion4 = true;_didIteratorError4 = false;_iteratorError4 = undefined;_context13.prev = 33;for (_iterator4 = Object.keys(names)[Symbol.iterator](); !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {id = _step4.value; + if (windowids.indexOf(parseInt(id)) < 0) { + // console.log("did not find", id); + delete names[id]; + } + } + // console.log("after", JSON.parse(JSON.stringify(names))); + _context13.next = 41;break;case 37:_context13.prev = 37;_context13.t1 = _context13["catch"](33);_didIteratorError4 = true;_iteratorError4 = _context13.t1;case 41:_context13.prev = 41;_context13.prev = 42;if (!_iteratorNormalCompletion4 && _iterator4.return) {_iterator4.return();}case 44:_context13.prev = 44;if (!_didIteratorError4) {_context13.next = 47;break;}throw _iteratorError4;case 47:return _context13.finish(44);case 48:return _context13.finish(41);case 49:localStorage["windowNames"] = JSON.stringify(names);case 50:case "end":return _context13.stop();}}}, _callee13, this, [[7, 11, 15, 23], [16,, 18, 22], [33, 37, 41, 49], [42,, 44, 48]]);}));return function cleanUp() {return _ref13.apply(this, arguments);};}();function _asyncToGenerator(fn) {return function () {var gen = fn.apply(this, arguments);return new Promise(function (resolve, reject) {function step(key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {return Promise.resolve(value).then(function (value) {step("next", value);}, function (err) {step("throw", err);});}}return step("next");});};}var browser = browser || chrome;window.tabsActive = [];window.displayInfo = [];function focusOnTabAndWindowDelayed(tab) {var tab = JSON.parse(JSON.stringify(tab));setTimeout(focusOnTabAndWindow.bind(this, tab), 125);}function focusOnWindowDelayed(windowId) {setTimeout(focusOnWindow.bind(this, windowId), 125);}function focusOnWindow(windowId) {browser.windows.update(windowId, { focused: true });}var updateTabCountDebounce = debounce(updateTabCount, 250);function tabRemoved() {updateTabCountDebounce();}function tabActiveChanged(tab) {if (!!tab && !!tab.tabId) {if (!window.tabsActive) window.tabsActive = [];if (!!window.tabsActive && window.tabsActive.length > 0) {var lastActive = window.tabsActive[window.tabsActive.length - 1];if (!!lastActive && lastActive.tabId == tab.tabId && lastActive.windowId == tab.windowId) {return;}}while (window.tabsActive.length > 20) {window.tabsActive.shift();}for (var i = window.tabsActive.length - 1; i >= 0; i--) {if (window.tabsActive[i].tabId == tab.tabId) {window.tabsActive.splice(i, 1);}};window.tabsActive.push(tab);}updateTabCountDebounce();}function debounce(func, wait, immediate) {var timeout;return function () {var context = this,args = arguments;var later = function later() {timeout = null;if (!immediate) func.apply(context, args);};var callNow = immediate && !timeout;clearTimeout(timeout);timeout = setTimeout(later, wait);if (callNow) func.apply(context, args);};};function localStorageAvailable() {var test = 'test';try {localStorage.setItem(test, test);localStorage.removeItem(test);return true;} catch (e) {return false;}}function windowFocus(windowId) {try {if (!!windowId) {windowActive(windowId); // console.log("onFocused", windowId); hideWindows(windowId);}} catch (e) {}}function windowCreated(window) {try {if (!!window && !!window.id) {windowActive(window.id);}} catch (e) {} // console.log("onCreated", window.id); }function windowRemoved(windowId) {try {if (!!windowId) {windowActive(windowId);}} catch (e) {} // console.log("onRemoved", windowId); -}window.displayInfo = []; - - -function is_in_bounds(object, bounds) { - var C = object,B = bounds; - if (C.left >= B.left && C.left <= B.left + B.width) { - if (C.top >= B.top && C.top <= B.top + B.height) { - return true; - } - } - return false; -}; - -function windowActive(windowId) { - if (windowId < 0) return; - var windows = JSON.parse(localStorage["windowAge"]); - if (windows instanceof Array) { - - } else { - windows = []; - } - if (windows.indexOf(windowId) > -1) windows.splice(windows.indexOf(windowId), 1); - windows.unshift(windowId); - localStorage["windowAge"] = JSON.stringify(windows); - - // browser.windows.getLastFocused({ populate: true }, function (w) { +}function is_in_bounds(object, bounds) {var C = object,B = bounds;if (C.left >= B.left && C.left <= B.left + B.width) {if (C.top >= B.top && C.top <= B.top + B.height) {return true;}}return false;};function windowActive(windowId) {if (windowId < 0) return;var windows = JSON.parse(localStorage["windowAge"]);if (windows instanceof Array) {} else {windows = [];}if (windows.indexOf(windowId) > -1) windows.splice(windows.indexOf(windowId), 1);windows.unshift(windowId);localStorage["windowAge"] = JSON.stringify(windows); // browser.windows.getLastFocused({ populate: true }, function (w) { // for (var i = 0; i < w.tabs.length; i++) { // var tab = w.tabs[i]; // if (tab.active == true) { @@ -519,36 +626,4 @@ function windowActive(windowId) { // }; // }); // console.log(windows); -} - -browser.commands.onCommand.addListener(function (command) { - if (command == "switch_to_previous_active_tab") { - if (!!window.tabsActive && window.tabsActive.length > 1) { - focusOnTabAndWindow(window.tabsActive[window.tabsActive.length - 2]); - } - } -}); - -browser.runtime.onMessage.addListener(function (request, sender, sendResponse) { - if (request.command == "reload_popup_controls") { - setupPopup(); - } -}); - -_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {var windows, i;return regeneratorRuntime.wrap(function _callee11$(_context11) {while (1) {switch (_context11.prev = _context11.next) {case 0:_context11.next = 2;return ( - browser.windows.getAll({ populate: true }));case 2:windows = _context11.sent; - localStorage["windowAge"] = JSON.stringify([]); - if (!!windows && windows.length > 0) { - windows.sort(function (a, b) { - if (a.id < b.id) return 1; - if (a.id > b.id) return -1; - return 0; - }); - for (i = 0; i < windows.length; i++) { - if (!!windows[i].id) windowActive(windows[i].id); - }; - }case 5:case "end":return _context11.stop();}}}, _callee11, this);}))(); - - -setInterval(setupListeners, 300000); -setupListeners(); \ No newline at end of file +}browser.commands.onCommand.addListener(function (command) {if (command == "switch_to_previous_active_tab") {if (!!window.tabsActive && window.tabsActive.length > 1) {focusOnTabAndWindow(window.tabsActive[window.tabsActive.length - 2]);}}});browser.runtime.onMessage.addListener(function (request, sender, sendResponse) {if (request.command == "reload_popup_controls") {setupPopup();}});_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {var windows, i;return regeneratorRuntime.wrap(function _callee12$(_context12) {while (1) {switch (_context12.prev = _context12.next) {case 0:_context12.next = 2;return browser.windows.getAll({ populate: true });case 2:windows = _context12.sent;localStorage["windowAge"] = JSON.stringify([]);if (!!windows && windows.length > 0) {windows.sort(function (a, b) {if (a.id < b.id) return 1;if (a.id > b.id) return -1;return 0;});for (i = 0; i < windows.length; i++) {if (!!windows[i].id) windowActive(windows[i].id);};}case 5:case "end":return _context12.stop();}}}, _callee12, this);}))();setInterval(setupListeners, 300000);setupListeners(); \ No newline at end of file diff --git a/outlib/popup.js b/outlib/popup.js index 0791e7d3..1515ae0b 100644 --- a/outlib/popup.js +++ b/outlib/popup.js @@ -5,6 +5,11 @@ if (window.location.search.indexOf("?popup") > -1) { } else { window.inPopup = false; } +if (window.location.search.indexOf("?panel") > -1) { + window.inPanel = true; +} else { + window.inPanel = false; +} window.onload = function () { window.requestAnimationFrame(loadApp); }; @@ -46,6 +51,12 @@ function loadApp() { } } } else { + if (window.inPanel) { + document.documentElement.style.maxHeight = "auto"; + document.documentElement.style.maxWidth = "auto"; + document.body.style.maxHeight = "auto"; + document.body.style.maxWidth = "auto"; + } document.documentElement.style.maxHeight = "100%"; document.documentElement.style.maxWidth = "100%"; document.documentElement.style.height = "100%"; diff --git a/package.json b/package.json index be3c5eb0..e17ab827 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tab-manager", - "version": "5.1.6", + "version": "5.2.0", "description": "This is an extended version of the old Tab Manager Google Chrome extension. Should work on both Chrome and Firefox. Malware free, with a new view type and many new features.", "main": "index.js", "directories": { @@ -31,7 +31,8 @@ "babel-preset-es2015": "^6.24.1", "babel-preset-es2017": "^6.24.1", "babel-preset-react": "^6.24.1", - "babel-preset-react-app": "^3.1.2" + "babel-preset-react-app": "^3.1.2", + "crx3": "^1.1.2" }, "dependencies": {} } diff --git a/readme.md b/readme.md index 4bdcda32..fd4a8a59 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Tab Manager Plus 5.1.6 +# Tab Manager Plus 5.2.0 ##### Search through your tabs instantly, save windows for later, limit open tabs per window - and many more.