Skip to content

Commit

Permalink
feat: add an option to allow disable open list tab when store all tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
cnwangjie committed Oct 8, 2018
1 parent 838431e commit ddc6f85
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
"opt_desc_openEnd": {
"message": "When restore list open at the ending of tabs"
},
"opt_desc_openTabListNoTab": {
"message": "Open the tab list when store all tabs"
},
"opt_label_popup": {
"message": "Popup simple list"
},
Expand Down
3 changes: 3 additions & 0 deletions src/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
"opt_desc_openEnd": {
"message": "恢复列表时标签页在末尾打开"
},
"opt_desc_openTabListNoTab": {
"message": "当储存所有标签时打开标签列表"
},
"opt_label_popup": {
"message": "弹出简单列表"
},
Expand Down
8 changes: 8 additions & 0 deletions src/common/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,14 @@ export const optionsList = [
default: true,
new: '1.3.9',
},
{
cate: cate.BEHAVIOUR,
name: 'openTabListNoTab',
desc: __('opt_desc_openTabListNoTab'),
type: Boolean,
default: true,
new: '1.4.0',
},
]

if (DEBUG) {
Expand Down
6 changes: 4 additions & 2 deletions src/common/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@ const storeSelectedTabs = async listIndex => {

const storeAllTabs = async listIndex => {
const tabs = await getAllTabsInCurrentWindow()
await openTabLists()
const opts = await storage.getOptions()
if (opts.openTabListNoTab) await openTabLists()
return storeTabs(tabs, listIndex)
}

const storeAllTabInAllWindows = async () => {
const windows = await browser.windows.getAll()
await openTabLists()
const opts = await storage.getOptions()
if (opts.openTabListNoTab) await openTabLists()
for (const window of windows) {
const tabs = await getAllInWindow(window.id)
await storeTabs(tabs)
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_ext_name__",
"version": "1.3.10",
"version": "1.4.0",
"default_locale": "en",
"description": "__MSG_ext_desc__",
"author": "WangJie <[email protected]>",
Expand Down

0 comments on commit ddc6f85

Please sign in to comment.