summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2010-11-15 21:38:13 +0000
committerNick White <git@njw.me.uk>2010-11-15 21:38:13 +0000
commit5e58b83688d1953bbae0dd492f51eb4ea7c222d3 (patch)
tree8bfd3afe24c8816cd3be28664dbc6b839634421d
parent9e11b949979529561e1a4d50ec43995983d1042e (diff)
Allow keybinding in chromium
-rw-r--r--INSTALL15
-rw-r--r--Makefile10
-rw-r--r--TODO2
-rw-r--r--chromium/manifest.json2
-rw-r--r--keybind.js11
5 files changed, 19 insertions, 21 deletions
diff --git a/INSTALL b/INSTALL
index 834d009..439a7ed 100644
--- a/INSTALL
+++ b/INSTALL
@@ -9,7 +9,6 @@ page, or build it by running:
make xpi
-
# Chromium
SimplyRead also exists as an extension for chromium (and derived
@@ -22,18 +21,9 @@ you can get it from the SimplyRead web page, or by running:
# Surf
To use SimplyRead from surf, and trigger it from ctrl-alt-r, add the
-following to script.js
-
-(function() {
- document.addEventListener('keydown', keybind, false);
-})();
-
-function keybind(e) {
- if (e.keyIdentifier == "U+0052" && e.ctrlKey && e.altKey) // ctrl-alt-r
- simplyread();
-}
-/* copy simplyread.js here */
+contents of keybind.js and simplyread.js to script.js:
+ cat keybind.js simplyread.js >> $HOME/.surf/script.js
# Uzbl
@@ -44,7 +34,6 @@ To use this from uzbl, add the following line to the config file:
You'll also have to add the statement 'simplyread();' to the bottom of
simplyread.js.
-
# Other browsers; 'bookmarklet'
To use this as a 'bookmarklet', create a new bookmark with an address of:
diff --git a/Makefile b/Makefile
index b5fc205..faa6715 100644
--- a/Makefile
+++ b/Makefile
@@ -17,18 +17,18 @@ index.html: doap.ttl README webheader.html
dist:
mkdir -p $(NAME)-$(VERSION)
- cp simplyread.js COPYING INSTALL README $(NAME)-$(VERSION)
+ cp simplyread.js keybind.js COPYING INSTALL README $(NAME)-$(VERSION)
tar -c $(NAME)-$(VERSION) | bzip2 -c > $(NAME)-$(VERSION).tar.bz2
gpg -b < $(NAME)-$(VERSION).tar.bz2 > $(NAME)-$(VERSION).tar.bz2.sig
rm -rf $(NAME)-$(VERSION)
echo $(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION).tar.bz2.sig
-xpi: simplyread.js gecko/install.rdf gecko/chrome.manifest gecko/chrome/content/simplyread.xul gecko/chrome/content/icon.svg
+xpi:
rm -rf $(NAME)-$(VERSION).xpi gecko-build
mkdir -p gecko-build/chrome/content
cp COPYING gecko/chrome.manifest gecko-build/
cp gecko/chrome/content/simplyread.xul gecko-build/chrome/content/
- cp simplyread.js gecko-build/chrome/content/simplyread.js
+ cp simplyread.js gecko-build/chrome/content/
rsvg gecko/chrome/content/icon.svg gecko-build/chrome/content/icon.png
sed "s/VERSION/$(VERSION)/g" < gecko/install.rdf > gecko-build/install.rdf
cd gecko-build; zip -r ../$(NAME)-$(VERSION).xpi . 1>/dev/null
@@ -36,10 +36,10 @@ xpi: simplyread.js gecko/install.rdf gecko/chrome.manifest gecko/chrome/content/
rm -rf gecko-build
echo $(NAME)-$(VERSION).xpi $(NAME)-$(VERSION).xpi.sig
-crx: simplyread.js chromium/icon.svg chromium/manifest.json chromium/background.html
+crx:
rm -rf chromium-build
mkdir chromium-build
- cp COPYING simplyread.js chromium/background.html chromium-build/
+ cp COPYING simplyread.js keybind.js chromium/background.html chromium-build/
rsvg chromium/icon.svg chromium-build/icon.png
sed "s/VERSION/$(VERSION)/g" < chromium/manifest.json > chromium-build/manifest.json
sh chromium/makecrx.sh chromium-build chromium/private.pem > $(NAME)-$(VERSION).crx
diff --git a/TODO b/TODO
index 06eda90..430cf8d 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,2 @@
-add ctrl-alt-r to chromium extension
- http://code.google.com/chrome/extensions/events.html
make tests for chromium and firefox engines
https://developer.mozilla.org/en/Automated_testing_tips_and_tricks
diff --git a/chromium/manifest.json b/chromium/manifest.json
index 56c51fa..321aff9 100644
--- a/chromium/manifest.json
+++ b/chromium/manifest.json
@@ -3,6 +3,6 @@
"version": "VERSION",
"background_page": "background.html",
"permissions": [ "tabs", "*://*/*" ],
- "content_scripts": [{"matches": ["*://*/*"], "js": ["simplyread.js"]}],
+ "content_scripts": [{"matches": ["*://*/*"], "js": ["simplyread.js", "keybind.js"]}],
"browser_action": { "default_icon": "icon.png" }
}
diff --git a/keybind.js b/keybind.js
new file mode 100644
index 0000000..ed5ae3a
--- /dev/null
+++ b/keybind.js
@@ -0,0 +1,11 @@
+/*
+ * See COPYING file for copyright, license and warranty details.
+ */
+(function() {
+ document.addEventListener('keydown', keybind, false);
+})();
+
+function keybind(e) {
+ if (e.keyIdentifier == "U+0052" && e.ctrlKey && e.altKey) // ctrl-alt-r
+ simplyread();
+}