From 6e23d4f3a565f384c8b0cea641070cc34e76c5ab Mon Sep 17 00:00:00 2001 From: ikipatang <5412352+ikipatang@users.noreply.github.com> Date: Thu, 30 Nov 2017 13:33:54 +0100 Subject: [PATCH] Popup dimensions: now in storage --- src/background.js | 14 ++++++++------ src/storage.js | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/background.js b/src/background.js index bc5dfe8..fd47713 100644 --- a/src/background.js +++ b/src/background.js @@ -1,15 +1,17 @@ /** * Open the given url in a popup - * @param {string} url - - * @return {void} - + * @param {string} url - + * @param {number} width - + * @param {number} height - + * @return {void} - */ -function openInPopup(url) { +function openInPopup(url, width, height) { browser.windows.create({ url, type: 'popup', allowScriptsToClose: true, - height: 600, - width: 900, + width, + height, }); } @@ -26,7 +28,7 @@ function shareCurrentTab(tab) { return; } const shareUrl = `${storage.url}?post=${encodeURIComponent(url)}&title=${encodeURIComponent(title)}&source=bookmarklet`; - openInPopup(shareUrl); + openInPopup(shareUrl, storage.popupWidth, storage.popupHeight); }); } diff --git a/src/storage.js b/src/storage.js index 238a76a..62a0a97 100644 --- a/src/storage.js +++ b/src/storage.js @@ -4,6 +4,8 @@ Default settings. Initialize storage to these values. var storage = { url: '', pageAction: false, + popupWidth: 900, + popupHeight: 600, } /*