From c3561b060852d94f1cc99f182eb94f1db51d058c Mon Sep 17 00:00:00 2001 From: Anton Gorbunov Date: Wed, 7 Dec 2016 16:18:24 +0500 Subject: [PATCH] Make browser button clickable Just another optional way to do topscrolling. --- _locales/en/messages.json | 3 +++ _locales/ru/messages.json | 3 +++ background.js | 5 +++++ manifest.json | 9 ++++++++- 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 background.js diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 09542fb..96915e1 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1,5 +1,8 @@ { "appDesc": { "message": "Click on the left border of any page for scroll to the top." + }, + "browserAction": { + "message": "Scroll to the top or return" } } \ No newline at end of file diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json index a0e4f84..b2074c2 100644 --- a/_locales/ru/messages.json +++ b/_locales/ru/messages.json @@ -1,5 +1,8 @@ { "appDesc": { "message": "Кликните на левой границе экрана для прокрутки любой страницы в начало." + }, + "browserAction": { + "message": "Прокрутить вверх или вернуться" } } \ No newline at end of file diff --git a/background.js b/background.js new file mode 100644 index 0000000..7509f53 --- /dev/null +++ b/background.js @@ -0,0 +1,5 @@ +chrome.browserAction.onClicked.addListener(function(tab) { + chrome.tabs.executeScript({ + code: 'document.getElementById("topscroll-chrome-extension-bar").click()' + }); +}); \ No newline at end of file diff --git a/manifest.json b/manifest.json index 4b1bd0c..a312bb7 100644 --- a/manifest.json +++ b/manifest.json @@ -16,5 +16,12 @@ "css": ["basic.css"], "js": ["contentscript.js"] } - ] + ], + "background": { + "scripts": ["background.js"], + "persistent": false + }, + "browser_action": { + "default_title": "__MSG_browserAction__" + } }