From bf340e9f5ed22058877af1878c85c16de1dd8904 Mon Sep 17 00:00:00 2001 From: Nick White Date: Sat, 21 May 2011 12:54:14 +0100 Subject: Make chromium extension a page action --- chromium/background.html | 12 ++++++++++-- chromium/makecrx.sh | 2 ++ chromium/manifest.json | 6 +++--- chromium/viable.js | 13 +++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100755 chromium/viable.js (limited to 'chromium') diff --git a/chromium/background.html b/chromium/background.html index 5343f46..7850bd2 100644 --- a/chromium/background.html +++ b/chromium/background.html @@ -1,5 +1,13 @@ diff --git a/chromium/makecrx.sh b/chromium/makecrx.sh index ca97835..b0b8f2e 100755 --- a/chromium/makecrx.sh +++ b/chromium/makecrx.sh @@ -5,6 +5,8 @@ # Based on bash script at: # http://code.google.com/chrome/extensions/crx.html # Licensed under the BSD license +# +# NOTE: does not yet work perfectly with 9base tools test $# -ne 2 && echo "Usage: $0 dir pem" && exit 1 diff --git a/chromium/manifest.json b/chromium/manifest.json index 6b28f29..ceb7179 100644 --- a/chromium/manifest.json +++ b/chromium/manifest.json @@ -2,8 +2,8 @@ "name": "SimplyRead", "version": "VERSION", "background_page": "background.html", - "permissions": [ "tabs", "*://*/*" ], - "content_scripts": [{"matches": ["*://*/*"], "js": ["simplyread.js", "keybind.js"]}], - "browser_action": { "default_icon": "icon.png" }, + "permissions": [ "tabs", "" ], + "content_scripts": [{"matches": [""], "js": ["simplyread.js", "keybind.js", "viable.js"]}], + "page_action": { "default_icon": "icon.png" }, "update_url": "http://njw.me.uk/software/simplyread/chromium-updates.xml" } diff --git a/chromium/viable.js b/chromium/viable.js new file mode 100755 index 0000000..09acb36 --- /dev/null +++ b/chromium/viable.js @@ -0,0 +1,13 @@ +/* + * SimplyRead - makes webpages more readable + * + * See COPYING file for copyright, license and warranty details. + */ + +function viable() { + var doc; + doc = (document.body === undefined) + ? window.content.document : document; + return doc.getElementsByTagName("p").length; +} +if(viable()) chrome.extension.sendRequest({}, function(response) {}); -- cgit v1.2.3