URL/Page rules
+URL/Page rules
Associate the above commands with URLs, based on regex rules. When a URL is tied to a command, a button will appear in context-menus and the address bar to run said command.
diff --git a/_locales/en/messages.json b/_locales/en/messages.json index e92c8b6..e3a790c 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -151,6 +151,11 @@ "description": "Name of button in options-page to save changes." }, + "optionsPageTitle": { + "message": "Shellfox settings", + "description": "Title of the settings-page." + }, + "errorPageTitle": { "message": "Shellfox error", "description": "Title of the error-page." diff --git a/_locales/eo/messages.json b/_locales/eo/messages.json index 25ff21f..300942d 100644 --- a/_locales/eo/messages.json +++ b/_locales/eo/messages.json @@ -151,6 +151,11 @@ "description": "Nomo de butono ĉe agordopaĝo por konservi ŝanĝojn." }, + "optionsPageTitle": { + "message": "Ŝelvulpaj agordoj", + "description": "Titolo de agordo-paĝo." + }, + "errorPageTitle": { "message": "Ŝelvulpo eraris" }, diff --git a/background.js b/background.js index 60729b4..6943b37 100644 --- a/background.js +++ b/background.js @@ -17,6 +17,11 @@ function shellfoxFailed() { port = undefined; // Tell the user about the error… + openNewTab("/html/error.html?error=" + escape(error)); +} + + +function openNewTab(url) { browser.tabs.query({"active": true}).then((tabs) => { let openerTab = undefined; if (tabs && tabs.length > 0) @@ -24,7 +29,7 @@ function shellfoxFailed() { browser.tabs.create({ "active": true, - "url": "/html/error.html?error=" + escape(error), + "url": url, "openerTabId": openerTab }) }); @@ -266,6 +271,10 @@ browser.menus.onClicked.addListener((info, tab) => { } }); +browser.browserAction.onClicked.addListener(() => { + openNewTab("/html/options.html"); +}); + // When a download starts, run any applicable download commands. browser.downloads.onCreated.addListener((downloadItem) => { diff --git a/html/error.css b/html/error.css index 2349f0b..989cd0c 100644 --- a/html/error.css +++ b/html/error.css @@ -1,3 +1,11 @@ /* SPCSS theme by Susam Pal, under the MIT license * https://github.com/susam/spcss */ body{color:#333;font-family:helvetica,arial,sans-serif;line-height:1.5;margin:0 auto;max-width:40em;padding:0 1em}h1,h2,h3,h4,h5,h6{margin:1.25em 0 .5em;line-height:1.2}a:link{color:#00e}a:visited{color:#518}a:focus,a:hover{color:#03f}a:active{color:#e00}h1 a:empty:before,h2 a:empty:before,h3 a:empty:before,h4 a:empty:before,h5 a:empty:before,h6 a:empty:before{content:"#"}h1 a:empty,h2 a:empty,h3 a:empty,h4 a:empty,h5 a:empty,h6 a:empty{visibility:hidden;padding-left:.25em}h1:hover a:empty,h2:hover a:empty,h3:hover a:empty,h4:hover a:empty,h5:hover a:empty,h6:hover a:empty{visibility:visible}img{max-width:100%}figure{margin:1em 0;text-align:center}figcaption{font-size:small}code,kbd,pre,samp{color:#009;font-family:monospace,monospace}pre kbd{color:#060}blockquote,pre{background:#eee;padding:.5em}pre{overflow:auto}blockquote{border-left:medium solid #ccc;margin:1em 0}blockquote :first-child{margin-top:0}blockquote :last-child{margin-bottom:0}table{border-collapse:collapse}td,th{border:thin solid #999;padding:.3em .4em;text-align:left}@media (prefers-color-scheme:dark){body{background:#111;color:#bbb}a:link{color:#9bf}a:visited{color:#caf}a:focus,a:hover{color:#9cf}a:active{color:#faa}code,kbd,pre,samp{color:#6cf}pre kbd{color:#9c6}blockquote,pre{background:#000}blockquote{border-color:#333}td,th{border-color:#666}} + +table { + width: 100%; +} + +input { + width: 100%; +} diff --git a/html/options.html b/html/options.html index 2532fd3..c9d6778 100644 --- a/html/options.html +++ b/html/options.html @@ -2,6 +2,8 @@
+ +Associate the above commands with URLs, based on regex rules. When a URL is tied to a command, a button will appear in context-menus and the address bar to run said command.