diff --git a/UrlEditorPRO/UrlEditorPRO.csproj b/UrlEditorPRO/UrlEditorPRO.csproj index a85304a..e65fc21 100644 --- a/UrlEditorPRO/UrlEditorPRO.csproj +++ b/UrlEditorPRO/UrlEditorPRO.csproj @@ -58,6 +58,7 @@ + diff --git a/UrlEditorPRO/app/background.ts b/UrlEditorPRO/app/background.ts new file mode 100644 index 0000000..ecb01fc --- /dev/null +++ b/UrlEditorPRO/app/background.ts @@ -0,0 +1,13 @@ +/// + + +module UrlEditor { + chrome.commands.onCommand.addListener(command => { + if (command == "goToHomepage") { + chrome.tabs.getSelected(null, function (tab) { + var uri = new UrlEditor.Uri(tab.url); + chrome.tabs.update(tab.id, { url: uri.protocol() + "//" + uri.host() }); + }); + } + }); +} \ No newline at end of file diff --git a/UrlEditorPRO/app/manifest.json b/UrlEditorPRO/app/manifest.json index ee3c6f2..58e9999 100644 --- a/UrlEditorPRO/app/manifest.json +++ b/UrlEditorPRO/app/manifest.json @@ -3,7 +3,7 @@ "name": "Url Editor PRO", "description": "Url parser which makes editing complex URLs as easy as possible. Features: params decoding, auto-suggest, keyboard navigation..", - "version": "0.9.0.0", + "version": "0.9.1.1", "permissions": [ "http://*/*", @@ -21,11 +21,21 @@ "default_popup": "popup.html" }, "options_page": "options.html", + "background": { + "scripts": [ "modules/url_parser.js", "background.js" ] + }, "commands": { "_execute_browser_action": { "suggested_key": { "default": "Ctrl+Shift+U" } + }, + "goToHomepage": { + "suggested_key": { + "default": "Ctrl+Shift+H", + "mac": "Command+Shift+H" + }, + "description": "Go to homepage (root path)" } }, "content_security_policy": "script-src 'self' https://www.google-analytics.com; object-src 'self'" diff --git a/UrlEditorPRO/app/options.html b/UrlEditorPRO/app/options.html index 685da92..57d8e85 100644 --- a/UrlEditorPRO/app/options.html +++ b/UrlEditorPRO/app/options.html @@ -153,7 +153,11 @@

Icon

Keyboard shortcuts

+
Global
Lunch extension (action) pane
+
Go to homepage (root path)
+
 
+
Action pane
Ctrl+"+"Add new parameter
Ctrl+"-"Remove currently selected parameter
Ctrl+ArrowNavigate to nearest field
diff --git a/UrlEditorPRO/app/options.ts b/UrlEditorPRO/app/options.ts index a42c93e..914c6d7 100644 --- a/UrlEditorPRO/app/options.ts +++ b/UrlEditorPRO/app/options.ts @@ -160,11 +160,15 @@ module UrlEditor.Options { } } + let commandToElemIDMap: IStringMap = { + "_execute_browser_action": "action-shortcut", + "goToHomepage": "goToHome-shortcut" + }; - chrome.commands.getAll((commands: any[]) => { + chrome.commands.getAll(commands => { commands.forEach(command => { - if (command.name == "_execute_browser_action") { - document.getElementById("action-shortcut").innerText = command.shortcut; + if (commandToElemIDMap[command.name]) { + document.getElementById(commandToElemIDMap[command.name]).innerText = command.shortcut; } }); });