From: Not Zed Date: Wed, 11 Dec 2019 23:03:58 +0000 (+1030) Subject: Add toggle-colours and toggle-fonts X-Git-Url: https://code.zedzone.au/cvs?a=commitdiff_plain;ds=sidebyside;p=extensionz Add toggle-colours and toggle-fonts --- c8d4ab67838ebd464abc5f8ef3307842b4d1b97a diff --git a/README b/README new file mode 100644 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 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 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 index 0000000..15b1e56 --- /dev/null +++ b/toggle-colours/README.md @@ -0,0 +1,4 @@ +#Toggle Document Colours +Toggles between "never" and "always" for colour override setting. + +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 index 0000000..3debb02 --- /dev/null +++ b/toggle-colours/background.js @@ -0,0 +1,17 @@ + +function toggle() { + var docSetting = browser.browserSettings.overrideDocumentColors.get({}); + + docSetting.then(function callback(junk){ + var value; + if (junk.value == 'never') { + value = 'always'; + } else { + value = 'never'; + } + browser.browserSettings.overrideDocumentColors + .set({value: value}); + }); +} + +browser.browserAction.onClicked.addListener(toggle); diff --git a/toggle-colours/icons/icon.svg b/toggle-colours/icons/icon.svg new file mode 100644 index 0000000..ecfefe9 --- /dev/null +++ b/toggle-colours/icons/icon.svg @@ -0,0 +1,5 @@ + + + + C + diff --git a/toggle-colours/manifest.json b/toggle-colours/manifest.json new file mode 100644 index 0000000..c65d22b --- /dev/null +++ b/toggle-colours/manifest.json @@ -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 index 0000000..bca3144 --- /dev/null +++ b/toggle-fonts/README.md @@ -0,0 +1,4 @@ +#Toggle Document Fonts +Toggles between use document fonts. + +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 index 0000000..2b8f04d --- /dev/null +++ b/toggle-fonts/background.js @@ -0,0 +1,11 @@ + +function toggle() { + browser.browserSettings.useDocumentFonts + .get({}) + .then(function callback(junk){ + browser.browserSettings.useDocumentFonts + .set({value: !junk.value}); + }); +} + +browser.browserAction.onClicked.addListener(toggle); diff --git a/toggle-fonts/icons/icon.svg b/toggle-fonts/icons/icon.svg new file mode 100644 index 0000000..2bb324f --- /dev/null +++ b/toggle-fonts/icons/icon.svg @@ -0,0 +1,5 @@ + + + + F + diff --git a/toggle-fonts/manifest.json b/toggle-fonts/manifest.json new file mode 100644 index 0000000..7cf253d --- /dev/null +++ b/toggle-fonts/manifest.json @@ -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 +}