|
5 | 5 | if (navigator.userAgent.search("Firefox") > -1) { |
6 | 6 |
|
7 | 7 | } else { |
8 | | - chrome.permissions.contains({ |
| 8 | + browser.permissions.contains({ |
9 | 9 | permissions: ['system.display'] }, |
10 | 10 | function (result) { |
11 | 11 | if (result) { |
|
41 | 41 | if (typeof localStorage["badge"] === "undefined") localStorage["badge"] = "1"; |
42 | 42 | if (typeof localStorage["hideWindows"] === "undefined") localStorage["hideWindows"] = "0"; |
43 | 43 | if (typeof localStorage["filter-tabs"] === "undefined") localStorage["filter-tabs"] = "0"; |
44 | | - if (typeof localStorage["version"] === "undefined") localStorage["version"] = "4.9.9"; |
| 44 | + if (typeof localStorage["version"] === "undefined") localStorage["version"] = "5.0.0"; |
45 | 45 |
|
46 | 46 | layout = localStorage["layout"]; |
47 | 47 | tabLimit = JSON.parse(localStorage["tabLimit"]); |
|
240 | 240 |
|
241 | 241 | }, |
242 | 242 | componentDidMount: function componentDidMount() { |
243 | | - chrome.windows.onCreated.addListener(this.update.bind(this)); |
244 | | - chrome.windows.onRemoved.addListener(this.update.bind(this)); |
245 | | - chrome.tabs.onCreated.addListener(this.update.bind(this)); |
246 | | - chrome.tabs.onUpdated.addListener(this.update.bind(this)); |
247 | | - chrome.tabs.onMoved.addListener(this.update.bind(this)); |
248 | | - chrome.tabs.onDetached.addListener(this.update.bind(this)); |
249 | | - chrome.tabs.onRemoved.addListener(this.update.bind(this)); |
250 | | - chrome.tabs.onReplaced.addListener(this.update.bind(this)); |
| 243 | + browser.windows.onCreated.addListener(this.update.bind(this)); |
| 244 | + browser.windows.onRemoved.addListener(this.update.bind(this)); |
| 245 | + browser.tabs.onCreated.addListener(this.update.bind(this)); |
| 246 | + browser.tabs.onUpdated.addListener(this.update.bind(this)); |
| 247 | + browser.tabs.onMoved.addListener(this.update.bind(this)); |
| 248 | + browser.tabs.onDetached.addListener(this.update.bind(this)); |
| 249 | + browser.tabs.onRemoved.addListener(this.update.bind(this)); |
| 250 | + browser.tabs.onReplaced.addListener(this.update.bind(this)); |
251 | 251 | this.refs.root.focus(); |
252 | 252 | this.focusRoot(); |
253 | 253 | setTimeout(function () { |
|
344 | 344 | this.forceUpdate(); |
345 | 345 | }, |
346 | 346 | rateExtension: function rateExtension() { |
347 | | - chrome.tabs.create({ url: 'https://chrome.google.com/webstore/detail/tab-manager-plus-for-chro/cnkdjjdmfiffagllbiiilooaoofcoeff' }); |
| 347 | + browser.tabs.create({ url: 'https://chrome.google.com/webstore/detail/tab-manager-plus-for-chro/cnkdjjdmfiffagllbiiilooaoofcoeff' }); |
348 | 348 | this.forceUpdate(); |
349 | 349 | }, |
350 | 350 | toggleOptions: function toggleOptions() { |
351 | 351 | this.state.optionsActive = !this.state.optionsActive; |
352 | 352 | this.forceUpdate(); |
353 | 353 | }, |
354 | 354 | update: function update() { |
355 | | - chrome.windows.getAll({ populate: true }, function (windows) { |
| 355 | + browser.windows.getAll({ populate: true }, function (windows) { |
356 | 356 | windows.sort(function (a, b) { |
357 | 357 | var windows = []; |
358 | 358 | if (!!localStorage["windowAge"]) { |
|
393 | 393 | var tabs = Object.keys(this.state.selection).map(function (id) {return _this2.state.tabsbyid[id];}); |
394 | 394 | if (tabs.length) { |
395 | 395 | for (var i = 0; i < tabs.length; i++) { |
396 | | - chrome.tabs.remove(tabs[i].id); |
| 396 | + browser.tabs.remove(tabs[i].id); |
397 | 397 | } |
398 | 398 | } else { |
399 | | - chrome.tabs.query({ currentWindow: true, active: true }, function (t) { |
| 399 | + browser.tabs.query({ currentWindow: true, active: true }, function (t) { |
400 | 400 | if (t && t.length > 0) { |
401 | | - chrome.tabs.remove(t[0].id); |
| 401 | + browser.tabs.remove(t[0].id); |
402 | 402 | } |
403 | 403 | }); |
404 | 404 | } |
405 | 405 | this.forceUpdate(); |
406 | 406 | }, |
407 | 407 | deleteTab: function deleteTab(tabId) { |
408 | | - chrome.tabs.remove(tabId); |
| 408 | + browser.tabs.remove(tabId); |
409 | 409 | }, |
410 | 410 | addWindow: function addWindow() {var _this3 = this; |
411 | 411 | var count = Object.keys(this.state.selection).length; |
412 | 412 | var tabs = Object.keys(this.state.selection).map(function (id) {return _this3.state.tabsbyid[id];}); |
413 | 413 |
|
414 | 414 | if (count == 0) { |
415 | | - chrome.windows.create({}); |
| 415 | + browser.windows.create({}); |
416 | 416 | } else if (count == 1) { |
417 | | - chrome.runtime.getBackgroundPage(function callback(tabs, backgroundPage) { |
| 417 | + browser.runtime.getBackgroundPage(function callback(tabs, backgroundPage) { |
418 | 418 | backgroundPage.focusOnTabAndWindow(tabs[0]); |
419 | 419 | }.bind(null, tabs)); |
420 | 420 | } else { |
421 | | - chrome.runtime.getBackgroundPage(function callback(tabs, backgroundPage) { |
| 421 | + browser.runtime.getBackgroundPage(function callback(tabs, backgroundPage) { |
422 | 422 | backgroundPage.createWindowWithTabs(tabs); |
423 | 423 | }.bind(null, tabs)); |
424 | 424 | } |
|
428 | 428 | if (tabs.length) { |
429 | 429 | if (tabs[0].pinned) tabs.reverse(); |
430 | 430 | for (var i = 0; i < tabs.length; i++) { |
431 | | - chrome.tabs.update(tabs[i].id, { pinned: !tabs[0].pinned }); |
| 431 | + browser.tabs.update(tabs[i].id, { pinned: !tabs[0].pinned }); |
432 | 432 | } |
433 | 433 |
|
434 | 434 | } else { |
435 | | - chrome.tabs.query({ currentWindow: true, active: true }, function (t) { |
| 435 | + browser.tabs.query({ currentWindow: true, active: true }, function (t) { |
436 | 436 | if (t && t.length > 0) { |
437 | | - chrome.tabs.update(t[0].id, { pinned: !t[0].pinned }); |
| 437 | + browser.tabs.update(t[0].id, { pinned: !t[0].pinned }); |
438 | 438 | } |
439 | 439 | }); |
440 | 440 | } |
|
652 | 652 |
|
653 | 653 | for (var i = 0; i < tabs.length; i++) { |
654 | 654 | (function (t) { |
655 | | - chrome.tabs.move(t.id, { windowId: tab.windowId, index: index }, function () { |
656 | | - chrome.tabs.update(t.id, { pinned: t.pinned }); |
| 655 | + browser.tabs.move(t.id, { windowId: tab.windowId, index: index }, function () { |
| 656 | + browser.tabs.update(t.id, { pinned: t.pinned }); |
657 | 657 | }); |
658 | 658 | })(tabs[i]); |
659 | 659 | } |
|
663 | 663 | var tabs = Object.keys(this.state.selection).map(function (id) {return _this6.state.tabsbyid[id];}); |
664 | 664 | for (var i = 0; i < tabs.length; i++) { |
665 | 665 | (function (t, windowId) { |
666 | | - chrome.tabs.move(t.id, { windowId: windowId, index: -1 }, function () { |
667 | | - chrome.tabs.update(t.id, { pinned: t.pinned }); |
| 666 | + browser.tabs.move(t.id, { windowId: windowId, index: -1 }, function () { |
| 667 | + browser.tabs.update(t.id, { pinned: t.pinned }); |
668 | 668 | }); |
669 | 669 | })(tabs[i], windowId); |
670 | 670 | } |
|
753 | 753 | this.state.badge = !this.state.badge; |
754 | 754 | localStorage["badge"] = this.state.badge ? "1" : "0"; |
755 | 755 | this.badgeText(); |
756 | | - chrome.runtime.getBackgroundPage(function callback(backgroundPage) { |
| 756 | + browser.runtime.getBackgroundPage(function callback(backgroundPage) { |
757 | 757 | backgroundPage.updateTabCount(); |
758 | 758 | }); |
759 | 759 | this.forceUpdate(); |
|
764 | 764 |
|
765 | 765 | }, |
766 | 766 | toggleHide: function toggleHide() { |
767 | | - chrome.permissions.request({ permissions: ["system.display"] }, function (granted) { |
| 767 | + browser.permissions.request({ permissions: ["system.display"] }, function (granted) { |
768 | 768 | if (granted) { |
769 | 769 | this.state.hideWindows = !this.state.hideWindows; |
770 | 770 | } else { |
|
0 commit comments