From cf59ffee4674eaf77208ced88af8c498238f4510 Mon Sep 17 00:00:00 2001 From: Elad Katz Date: Fri, 15 Feb 2019 05:06:45 +0200 Subject: [PATCH] Added option to open Brief in a popup instead of a new tab Modified global shortcut key to ctrl+shift+f (since ctrl+shift+d does not work) --- _locales/en/messages.json | 3 +++ background.js | 3 +++ manifest.json | 2 +- scripts/prefs.js | 1 + scripts/utils.js | 2 +- skin/brief.css | 1 + ui/options/options.xhtml | 4 ++++ 7 files changed, 14 insertions(+), 2 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 8de4dd8ae..21da5810c 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -239,6 +239,9 @@ "seeCustomizationTips_url": { "message": "http://brief.mozdev.org/customize.html" }, + "openInPopup_label": { + "message": "Open Brief in a popup" + }, "feedName_label": { "message": "Name" }, diff --git a/background.js b/background.js index 431395936..39e67e379 100644 --- a/background.js +++ b/background.js @@ -63,6 +63,7 @@ const Brief = { await Prefs.init({master: true}); Prefs.addObserver('showUnreadCounter', () => this._updateUI()); + Prefs.addObserver('openInPopup', () => this._updateUI()); Comm.registerObservers({ 'feedlist-updated': () => this._updateUI(), 'entries-updated': debounced(100, () => this._updateUI()), @@ -191,6 +192,7 @@ const Brief = { _updateUI: async function() { let enabled = Prefs.get('showUnreadCounter'); + let isPopup = Prefs.get('openInPopup'); browser.contextMenus.update('brief-button-show-unread', {checked: enabled}); if(enabled) { let count = await Database.query({ @@ -209,6 +211,7 @@ const Brief = { } else { browser.browserAction.setBadgeText({text: ""}); } + browser.browserAction.setPopup({popup: isPopup ? '/ui/brief.xhtml' : ''}); //TODO: return tooltip /* _updateStatus: async function Brief__updateStatus() { diff --git a/manifest.json b/manifest.json index 1d66ffc1e..c71c62767 100644 --- a/manifest.json +++ b/manifest.json @@ -34,7 +34,7 @@ "commands": { "_execute_browser_action": { "suggested_key": { - "default": "Ctrl+Shift+D" + "default": "Ctrl+Shift+F" } } }, diff --git a/scripts/prefs.js b/scripts/prefs.js index 829dbc21a..4c49abb27 100644 --- a/scripts/prefs.js +++ b/scripts/prefs.js @@ -66,6 +66,7 @@ function pref(name, value) { // The actual prefs pref("homeFolder", -1); pref("showUnreadCounter", true); +pref("openInPopup", false); pref("firstRun", true); pref("lastVersion", "0"); pref("assumeStandardKeys", true); diff --git a/scripts/utils.js b/scripts/utils.js index 6151c21b8..8d2ed0c25 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -119,7 +119,7 @@ export function getPluralForm(number, forms) { export async function openBackgroundTab(url) { - let tab = await browser.tabs.getCurrent(); + let [tab] = await browser.tabs.query({active: true, currentWindow: true}); try { await browser.tabs.create({active: false, url: url, openerTabId: tab.id}); } diff --git a/skin/brief.css b/skin/brief.css index c5640af9a..fc8cd01db 100644 --- a/skin/brief.css +++ b/skin/brief.css @@ -112,6 +112,7 @@ body.sidebar #reveal-sidebar-button { #sidebar { background-color: #f2f2f2 !important; min-width: 250px !important; + min-height: 600px !important; } #sidebar-splitter, diff --git a/ui/options/options.xhtml b/ui/options/options.xhtml index 8023a3eb9..508591eed 100644 --- a/ui/options/options.xhtml +++ b/ui/options/options.xhtml @@ -86,6 +86,10 @@

+ +