Thread Closed

#1
Firefox 6.0, Windows XP, Toolbar Buttons version 0.6.0.8

For accessibility reasons, I need one button that simultaneously toggles both:
(1) browser.display.use_document_colors and
(2) browser.display.use_system_colors

The 'Page Colours' custom button toggles (1) above but not (2).

Is it possible to locally modify the button so a single button toggles both fields?

I am not a CSS programmer and I do not know where in the Firefox profile to look for the code. With a little guidance I could hopefully change this if it is even possible to do so.

Thank you in advance!
ReportQuote
#2
I'm not a programmer either, but for some reason I decided to give it a try. I found ways to modify both version 1.0 and the old custom version so that the existing button also toggles system colors. (Unknown why anyone would want to do it though.) I'll explain more if you want. Basically, for the old version, some code is added to script.js, which is in the .jar file in the .xpi file. The added part is between the ------ mod ------ lines:
function toggleDocumentColors(item) {
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
    if (prefs.getBoolPref("browser.display.use_document_colors")) {
        prefs.setBoolPref("browser.display.use_document_colors", false);
        item.checked = true;
    } else {
        prefs.setBoolPref("browser.display.use_document_colors", true);
        item.checked = false;
    }

/* --------- system colors mod ----------- */
    if (prefs.getBoolPref("browser.display.use_system_colors")) {
        prefs.setBoolPref("browser.display.use_system_colors", false);
    } else {
        prefs.setBoolPref("browser.display.use_system_colors", true);
    }
/* --------- end system colors mod ---------- */

}

If you list your buttons, I can create an installer for you to try.

Edited by Ln on Aug. 31, 2011, 6:40 a.m.

ReportQuote
#3
Thank you Ln!

The only custom button I'm using is 'Page Colours'.

I see the code in the script.js file and I understand your modification.

Is modifying the script.js file and then re-installing the xpi, the only way to change this? Or is it possible to add your mod directly somewhere?

Thanks again!
ReportQuote
#4
you can edit the file's in firefox's application data
about:support
http://i.imgur.com/jKmIM.png
then open the extensions folder everything you want is in there
toolbar buttons is in {03B08592-E5B4-45ff-A0BE-C1D975458688}
ReportQuote
#5
Thank you AZ!

I do not have any extension folder = {03B08592-E5B4-45ff-A0BE-C1D975458688} .

Only 9782a54e67bed4a1271aae66be4662d7@button.codefisher.org.xpi .

Here is the contents of my Install.rdf file:

<?xml version="1.0" ?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>9782a54e67bed4a1271aae66be4662d7@button.codefisher.org</em:id>
<em:name>Custom Toolbar Buttons</em:name>
<em:version>0.6.0.8</em:version>
<em:description>A customized version of Toolbar Buttons including the buttons : Page Colours</em:description>
<em:creator>Michael Buckley</em:creator>

<em:homepageURL>http://codefisher.org/toolbar_button/toolbar_button_maker</em:homepageURL>
<em:updateURL>https://codefisher.org/toolbar_button/custom_update?buttons=use-document-colors</em:updateURL>
<!-- Flock -->
  <em:targetApplication>
   <Description>
    <em:id>{a463f10c-3994-11da-9945-000d60ca027b}</em:id>
    <em:minVersion>1.0</em:minVersion>
    <em:maxVersion>2.5.2</em:maxVersion>
   </Description>
  </em:targetApplication>
<!-- Firefox -->
  <em:targetApplication>
   <Description>
    <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
    <em:minVersion>3.0</em:minVersion>
    <em:maxVersion>3.7a1pre</em:maxVersion>
   </Description>
  </em:targetApplication>
</Description>
</RDF>

Any Suggestions?
Thanks again!

Edited by Orionstar on Sept. 3, 2011, 4:54 a.m.

ReportQuote
#6
Due to the maxVersion problem, it's sort of necessary to modify the xpi anyway. I plan to post files within a day.
ReportQuote
#7
to make it install edit this line
<em:maxVersion>3.7a1pre</em:maxVersion>
to
<em:maxVersion>8.0.1</em:maxVersion>
should not need another edit till after firefox 8
you can just disable the addon compatibility check with a addon compatibility reporter i thought you were going to edit more than the max version limit
i put code tags on your install.rdf for you
ReportQuote
#8
ReportQuote
#9
az: Thanks for adding code tags to my code as I could not see any way to do this. I have just installed addon compatibility reporter. I was previously adding "extensions.checkCompatibility.6.0" items manually. I understand about versioning. :)
Ln: Thank you for the modded xpi. It works! :)
Happy Labor Day everyone ! ! !

Edited by Orionstar on Sept. 4, 2011, 2:31 a.m.

ReportQuote
#10
Is it possible to press the button via a keyboard shortcut?

Thanks!
ReportQuote
#11
possibly with a code edit what would be the key code?
modifiers are easer for it (eg hold ctrl when clicking to do something else)
ReportQuote
#12
Color toggle seems to do the job using a keyboard shortcut, but its button can't be moved from the add-on bar. And it doesn't work right while the Toolbar Button is installed. Reviewers like the add-on, but they want a better button.
ReportQuote
#13
@Ln
What is the conflict between the buttons?
also here is a button that you can move around and click to replace the default button in color toggle
http://www.mediafire.com/download.php?vxmv55xlslukd16
just made (slapped it together) it for you
ReportQuote
#14
Color toggle along with the az color toggle button looks like a good combo. I didn't know about the Custom Link Buttons page you used. Very nice.

Color toggle doesn't work with the Toolbar Button because the toolbar button toggles preferences which are then applied to color toggle's Scheme 1. The result isn't what's wanted.
ReportQuote
#15
AZ
You asked "possibly with a code edit what would be the key code?
modifiers are easier for it (eg hold ctrl when clicking to do something else)"

All I need is F2 function key.

Thanks!

Also, are you able to tell me how to mod this myself, as the previous mod that Ln gave me works superbly otherwise?

Thanks again!
ReportQuote

Thread Closed