Add toggle-colours and toggle-fonts master
authorNot Zed <notzed@gmail.com>
Wed, 11 Dec 2019 23:03:58 +0000 (09:33 +1030)
committerNot Zed <notzed@gmail.com>
Wed, 11 Dec 2019 23:03:58 +0000 (09:33 +1030)
README [new file with mode: 0644]
dist/toggle-colours.xpi [new file with mode: 0644]
dist/toggle-fonts.xpi [new file with mode: 0644]
toggle-colours/README.md [new file with mode: 0644]
toggle-colours/background.js [new file with mode: 0644]
toggle-colours/icons/icon.svg [new file with mode: 0644]
toggle-colours/manifest.json [new file with mode: 0644]
toggle-fonts/README.md [new file with mode: 0644]
toggle-fonts/background.js [new file with mode: 0644]
toggle-fonts/icons/icon.svg [new file with mode: 0644]
toggle-fonts/manifest.json [new file with mode: 0644]

diff --git a/README b/README
new file mode 100644 (file)
index 0000000..683bcd5
--- /dev/null
+++ b/README
@@ -0,0 +1,39 @@
+
+INTRODUCTION
+------------
+
+This is a couple of trivial but useful extensions for mozilla firefox.
+
+toggle-colours
+
+ Switches the "Override the colours specified by the page with your
+ selections above" in the "Language and Appearance - > Colours" pane
+ between "none" and "always".
+
+toggle-fonts
+
+  Switches the "Allow pages to choose their own fonts, instead of your
+  selections above" in the "Language and Appearance - > Fonts and
+  Colours -> Advanced" pane between "on" and "off".
+
+PACKAGING
+---------
+
+Unfortunately because mozilla are a bunch of cunts there's no way to
+create an installable 'xpi' without creating an account on their site
+and getting them to sign it.
+
+If you're so inclined, have at it:
+
+https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions
+
+Due to the above i've included the signed packages I use in "dist/".
+They can be installed by going to "about:addons" and selecting
+"Install Add-on from File..." menu item from the "anus menu" over
+on the right hand side.
+
+LICENSE
+-------
+
+There's basically nothing to them, so they are public domain or
+equivalent.
diff --git a/dist/toggle-colours.xpi b/dist/toggle-colours.xpi
new file mode 100644 (file)
index 0000000..902d896
Binary files /dev/null and b/dist/toggle-colours.xpi differ
diff --git a/dist/toggle-fonts.xpi b/dist/toggle-fonts.xpi
new file mode 100644 (file)
index 0000000..dd7e0a4
Binary files /dev/null and b/dist/toggle-fonts.xpi differ
diff --git a/toggle-colours/README.md b/toggle-colours/README.md
new file mode 100644 (file)
index 0000000..15b1e56
--- /dev/null
@@ -0,0 +1,4 @@
+#Toggle Document Colours\r
+Toggles between "never" and "always" for colour override setting.\r
+\r
+Affects all windows.
\ No newline at end of file
diff --git a/toggle-colours/background.js b/toggle-colours/background.js
new file mode 100644 (file)
index 0000000..3debb02
--- /dev/null
@@ -0,0 +1,17 @@
+\r
+function toggle() {\r
+    var docSetting = browser.browserSettings.overrideDocumentColors.get({});\r
+\r
+    docSetting.then(function callback(junk){\r
+       var value;\r
+       if (junk.value == 'never') {\r
+           value = 'always';\r
+       } else {\r
+           value = 'never';\r
+       }\r
+       browser.browserSettings.overrideDocumentColors\r
+           .set({value: value});\r
+    });\r
+}\r
+\r
+browser.browserAction.onClicked.addListener(toggle);\r
diff --git a/toggle-colours/icons/icon.svg b/toggle-colours/icons/icon.svg
new file mode 100644 (file)
index 0000000..ecfefe9
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 7 10">
+  <text style="font-style:italic; font-size:10px" x="0" y="8.5">C</text>
+</svg>
diff --git a/toggle-colours/manifest.json b/toggle-colours/manifest.json
new file mode 100644 (file)
index 0000000..c65d22b
--- /dev/null
@@ -0,0 +1,17 @@
+{
+    "name": "Toggle Document Colours",
+    "version": "0.0.0",
+    "description": "Toggles beween never and always for colour override globally.",
+    "background": {
+       "scripts": ["background.js"]
+    },
+    "browser_action": {
+       "default_icon": "icons/icon.svg",
+       "default_title": "Toggle Document Colours"
+    },
+    "author": "NotZed",
+    "permissions": [
+       "browserSettings"
+    ],
+    "manifest_version": 2
+}
diff --git a/toggle-fonts/README.md b/toggle-fonts/README.md
new file mode 100644 (file)
index 0000000..bca3144
--- /dev/null
@@ -0,0 +1,4 @@
+#Toggle Document Fonts\r
+Toggles between use document fonts.\r
+\r
+Affects all windows.
\ No newline at end of file
diff --git a/toggle-fonts/background.js b/toggle-fonts/background.js
new file mode 100644 (file)
index 0000000..2b8f04d
--- /dev/null
@@ -0,0 +1,11 @@
+\r
+function toggle() {\r
+    browser.browserSettings.useDocumentFonts\r
+       .get({})\r
+       .then(function callback(junk){\r
+           browser.browserSettings.useDocumentFonts\r
+               .set({value: !junk.value});\r
+       });\r
+}\r
+\r
+browser.browserAction.onClicked.addListener(toggle);\r
diff --git a/toggle-fonts/icons/icon.svg b/toggle-fonts/icons/icon.svg
new file mode 100644 (file)
index 0000000..2bb324f
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 7 10">
+  <text style="font-style:italic; font-size:10px" x="0" y="8.5">F</text>
+</svg>
diff --git a/toggle-fonts/manifest.json b/toggle-fonts/manifest.json
new file mode 100644 (file)
index 0000000..7cf253d
--- /dev/null
@@ -0,0 +1,17 @@
+{
+    "name": "Toggle Document Fonts",
+    "version": "0.0.0",
+    "description": "Toggles document font override.",
+    "background": {
+       "scripts": ["background.js"]
+    },
+    "browser_action": {
+       "default_icon": "icons/icon.svg",
+       "default_title": "Toggle Document Fonts"
+    },
+    "author": "NotZed",
+    "permissions": [
+       "browserSettings"
+    ],
+    "manifest_version": 2
+}