summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2011-06-23 19:30:51 +0100
committerNick White <git@njw.me.uk>2011-06-23 19:30:51 +0100
commit575c45e066404a85adbf8112f676ba89c7258daa (patch)
treeb9c718f36451277379d4f54a36756ee820166a03
parenta2a6986c2719849d4e794261f29c8689701445e3 (diff)
Add viable to firefox, improve firefox usage, general cleanups
-rw-r--r--Makefile4
-rw-r--r--TODO1
-rw-r--r--chromium/updates.xml2
-rwxr-xr-xchromium/viablehook.js1
-rw-r--r--gecko/chrome/content/simplyread.xul9
-rw-r--r--gecko/install.ttl4
-rw-r--r--gecko/viablehook.js5
-rwxr-xr-xviable.js (renamed from chromium/viable.js)3
8 files changed, 18 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 46a0b83..b420f02 100644
--- a/Makefile
+++ b/Makefile
@@ -83,6 +83,7 @@ xpi: $(KEYFILE)
cp gecko/chrome.manifest gecko-build/
cp gecko/chrome/content/simplyread.xul gecko-build/chrome/content/
cp simplyread.js gecko-build/chrome/content/
+ cat viable.js gecko/viablehook.js > gecko-build/chrome/content/viable.js
rsvg -w 22 -h 22 icon.svg gecko-build/chrome/content/icon.png
rsvg -w 64 -h 64 icon.svg gecko-build/icon.png
sed -e "s/VERSION/$(VERSION)/g" -e "s|WEBSITE|$(WEBSITE)|g" -e "s|GECKOID|$(GECKOID)|g" -e "s/PUBKEY/`sh gecko/genpub.sh $(KEYFILE)`/g" \
@@ -95,7 +96,8 @@ crx: $(KEYFILE)
rm -rf chromium-build
mkdir chromium-build
sed 2q < COPYING > chromium-build/COPYING
- cp simplyread.js keybind.js chromium/viable.js chromium/background.html chromium-build/
+ cp simplyread.js keybind.js chromium/background.html chromium-build/
+ cat viable.js chromium/viablehook.js > chromium-build/viable.js
rsvg -w 19 -h 19 icon.svg chromium-build/icon.png
rsvg -w 48 -h 48 icon.svg chromium-build/icon48.png
rsvg -w 128 -h 128 icon.svg chromium-build/icon128.png
diff --git a/TODO b/TODO
index 9795f23..e9e915a 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,6 @@
chromium:
generate appid for use in update xml
see GenerateId in extension.cc of chrome for how it works
- currently should be dbggpgfcgemloeeldimghohejgnkahdi
gecko:
use rapper and bourne shell script to sign
diff --git a/chromium/updates.xml b/chromium/updates.xml
index f938094..acf8ed1 100644
--- a/chromium/updates.xml
+++ b/chromium/updates.xml
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
- <app appid='apapoaenlmlncnnhbpdobjifmpjdabpn'>
+ <app appid='dbggpgfcgemloeeldimghohejgnkahdi'>
<updatecheck codebase='WEBSITE/simplyread-VERSION.crx' version='VERSION' />
</app>
</gupdate>
diff --git a/chromium/viablehook.js b/chromium/viablehook.js
new file mode 100755
index 0000000..80bb673
--- /dev/null
+++ b/chromium/viablehook.js
@@ -0,0 +1 @@
+if(simplyread-viable()) chrome.extension.sendRequest({}, function(response) {});
diff --git a/gecko/chrome/content/simplyread.xul b/gecko/chrome/content/simplyread.xul
index 2ed3ac8..87af5ea 100644
--- a/gecko/chrome/content/simplyread.xul
+++ b/gecko/chrome/content/simplyread.xul
@@ -1,10 +1,11 @@
<?xml version="1.0"?>
<overlay id="simplyread" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://simplyread/content/viable.js" />
<script src="chrome://simplyread/content/simplyread.js" />
<keyset>
- <key id="simplyread" modifiers="accel alt" key="r" oncommand="simplyread()" />
+ <key id="simplyread" modifiers="control alt" key="r" oncommand="simplyread()" />
</keyset>
- <statusbar id="addon-bar">
- <image id="simplyread-icon" src="chrome://simplyread/content/icon.png" onclick="simplyread()" />
- </statusbar>
+ <toolbar id="addon-bar">
+ <toolbarbutton id="simplyread-btn" image="chrome://simplyread/content/icon.png" label="SimplyRead" oncommand="simplyread()" />
+ </toolbar>
</overlay>
diff --git a/gecko/install.ttl b/gecko/install.ttl
index 2ee9aaf..56d8d3b 100644
--- a/gecko/install.ttl
+++ b/gecko/install.ttl
@@ -8,10 +8,10 @@
em:targetApplication [
em:id "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
em:minVersion "3.0";
- em:maxVersion "4.0.*"
+ em:maxVersion "6.*"
] ;
em:name "SimplyRead";
- em:description "Stop browsing, start reading. Press Ctrl-Alt-r or click the 'sr' icon in the status bar to toggle SimplyRead.";
+ em:description "Stop browsing, start reading. Press Ctrl-Alt-r or press the 'sr' button in the addons bar to toggle SimplyRead.";
em:creator "Nick White";
em:homepageURL "WEBSITE/";
em:updateURL "WEBSITE/gecko-updates.rdf";
diff --git a/gecko/viablehook.js b/gecko/viablehook.js
new file mode 100644
index 0000000..8facf3e
--- /dev/null
+++ b/gecko/viablehook.js
@@ -0,0 +1,5 @@
+function srviable() {
+ document.getElementById("simplyread-btn").disabled = !simplyread-viable();
+}
+window.addEventListener("DOMContentLoaded", srviable, false);
+gBrowser.tabContainer.addEventListener("TabSelect", srviable, false);
diff --git a/chromium/viable.js b/viable.js
index c957608..8424451 100755
--- a/chromium/viable.js
+++ b/viable.js
@@ -1,9 +1,8 @@
/* See COPYING file for copyright, license and warranty details. */
-function viable() {
+function simplyread-viable() {
var doc;
doc = (document.body === undefined)
? window.content.document : document;
return doc.getElementsByTagName("p").length;
}
-if(viable()) chrome.extension.sendRequest({}, function(response) {});