Skip to content

Commit

Permalink
Conversion to bookmark all tabs (instead of bookmark to right)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoasif committed Dec 19, 2018
1 parent 4eec912 commit e2da5f1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 25 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
bookmark tabs to right
Bookmark All Tabs

![context menu](https://mdejean.github.io/bookmarktoright/screenshot.png)

![popup](https://mdejean.github.io/bookmarktoright/screenshot2.png)
This add-on restores the Bookmark All Tabs feature in thr main context menu of the Firefox tab bar that was moved in version 64.

Except as otherwise noted, this software is distributed under the terms of the GNU General Public License, version 2 or later. See LICENSE for the full text. Alternate licensing is available.
8 changes: 4 additions & 4 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"extensionName": {
"message": "Bookmark Tabs to the Right",
"message": "Bookmark All Tabs",
"description": "Name of the extension."
},

"extensionDescription": {
"message": "Bookmark tabs to the right of a tab by right clicking or the current tab with a key command",
"message": "Bookmark all tabs. Fork of Bookmark Tabs to the Right.",
"description": "Description of the extension."
},

"menuItem": {
"message": "Bookmark Tabs to the Right",
"message": "Bookmark All Tabs…",
"description": "Tab context menu item"
},

"commandDescription": {
"message": "Bookmark tabs to the right",
"message": "Bookmark All Tabs…",
"description": "Keyboard shortcut description"
},

Expand Down
14 changes: 7 additions & 7 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ async function showBookmarkWindow(tabs) {
});
}

async function bookmarkRight(window, index) {
async function bookmarkAll(window, index) {
let tabs = await browser.tabs.query({windowId: window});

//to the right of index
tabs = tabs.filter((t) => t.index > index);
//tabs = tabs.filter((t) => t.index > index);

//remove duplicate tabs
tabs = tabs.filter((t1, i1) =>
Expand All @@ -39,21 +39,21 @@ async function bookmarkRight(window, index) {

browser.contextMenus.create({
contexts: ['tab'],
id: 'bookmark-right',
id: 'bookmark-all',
title: browser.i18n.getMessage('menuItem')
});
browser.contextMenus.onClicked.addListener((info, tab) => {
if (info.menuItemId == 'bookmark-right') {
bookmarkRight(tab.windowId, tab.index);
if (info.menuItemId == 'bookmark-all') {
bookmarkAll(tab.windowId, tab.index);
}
});

browser.commands.onCommand.addListener(async (command) => {
if (command == 'bookmark-right') {
if (command == 'bookmark-all') {
let tabs = await browser.tabs.query({
active: true,
windowId: browser.windows.WINDOW_ID_CURRENT
});
bookmarkRight(browser.windows.WINDOW_ID_CURRENT, tabs[0].index);
bookmarkAll(browser.windows.WINDOW_ID_CURRENT, tabs[0].index);
}
});
5 changes: 2 additions & 3 deletions bookmarkright.svg → bookmark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion bookmarks.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<select id='folder'></select>
<label class='check'><input type=checkbox id='close'>__MSG_closeAfterLabel__</label>
<div class='buttons'>
<button id='ok'>__MSG_addBookmarksButton__</button>
<button id='cancel' type='button'>__MSG_cancelButton__</button>
<button id='ok'>__MSG_addBookmarksButton__</button>
</div>
</form>
<script src='bookmarks.js'></script>
Expand Down
12 changes: 6 additions & 6 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"homepage_url": "https://github.com/mdejean/bookmarktoright",
"homepage_url": "https://github.com/yoasif/bookmark-all-tabs",
"manifest_version": 2,
"version": "1.3",
"version": "1.0",
"icons": {
"16": "bookmarkright.svg",
"48": "bookmarkright.svg",
"96": "bookmarkright.svg"
"16": "bookmark.svg",
"48": "bookmark.svg",
"96": "bookmark.svg"
},
"applications": {
"gecko": {
Expand All @@ -17,7 +17,7 @@

"commands": {
"bookmark-right": {
"suggested_key": { "default": "Ctrl+Shift+Period" },
"suggested_key": { "default": "Ctrl+Shift+D" },
"description": "__MSG_commandDescription__"
}
},
Expand Down

0 comments on commit e2da5f1

Please sign in to comment.