diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 31a342ed..325e615a 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -464,6 +464,9 @@ "optionsBadgeDisabled": { "message": "Badge background color (when disabled)" }, + "optionsPopupWidth": { + "message": "Popup width (in pixels)" + }, "optionsUpdateInterval": { "message": "Automatically check for and install all available userstyle updates (in hrs)" }, diff --git a/options/index.html b/options/index.html index b825079d..a234d6fd 100644 --- a/options/index.html +++ b/options/index.html @@ -18,6 +18,10 @@ + + + + 1 diff --git a/options/index.js b/options/index.js index 206e6906..5d262acd 100644 --- a/options/index.js +++ b/options/index.js @@ -4,6 +4,7 @@ function restore () { chrome.runtime.getBackgroundPage(bg => { document.getElementById('badgeDisabled').value = bg.prefs.get('badgeDisabled'); document.getElementById('badgeNormal').value = bg.prefs.get('badgeNormal'); + document.getElementById('popupWidth').value = bg.prefs.get('popupWidth'); document.getElementById('updateInterval').value = bg.prefs.get('updateInterval'); }); } @@ -12,6 +13,7 @@ function save () { chrome.runtime.getBackgroundPage(bg => { bg.prefs.set('badgeDisabled', document.getElementById('badgeDisabled').value); bg.prefs.set('badgeNormal', document.getElementById('badgeNormal').value); + bg.prefs.set('popupWidth', +document.getElementById('popupWidth').value); bg.prefs.set( 'updateInterval', Math.max(0, +document.getElementById('updateInterval').value) diff --git a/popup.css b/popup.css index 6cf1823f..dd5c9f19 100644 --- a/popup.css +++ b/popup.css @@ -81,7 +81,9 @@ body > .actions { #unavailable { border: none; - display: none; + display: none; /* flex */ + align-items: center; + justify-content: center; font-size: 14px; text-indent: 6px; } diff --git a/popup.js b/popup.js index 47cc4861..510e49c3 100644 --- a/popup.js +++ b/popup.js @@ -13,7 +13,7 @@ function updatePopUp(url) { var urlWillWork = /^(file|http|https|ftps?|chrome\-extension):/.exec(url); if (!urlWillWork) { document.body.classList.add("blocked"); - document.getElementById("unavailable").style.display = "block"; + document.getElementById("unavailable").style.display = "flex"; return; } @@ -227,3 +227,6 @@ document.querySelector('#popup-shortcuts-button').addEventListener("click", func 'url': 'chrome://extensions/configureCommands' }); }); + +// popup width +document.body.style.width = prefs.get('popupWidth') + 'px'; diff --git a/storage.js b/storage.js index 9a6c0174..601ff3df 100644 --- a/storage.js +++ b/storage.js @@ -352,6 +352,8 @@ var prefs = chrome.extension.getBackgroundPage().prefs || new function Prefs() { "badgeDisabled": "#8B0000", // badge background color when disabled "badgeNormal": "#006666", // badge background color + "popupWidth": 240, // popup width in pixels + "updateInterval": 0 // user-style automatic update interval, hour }; var values = deepCopy(defaults);