Am 16.04.2012 23:53, schrieb Nate:
I have experimented with several solutions for the colorblind -
unfortunately none of them have had exactly what I am looking for.
What I ultimately ended up doing was writing a greasemonkey script
that loops through the stylesheets looking for certain shades of blue
and replacing them with red styles - this worked pretty well.
I did that about a year ago and then had to reinstall Windows and
never got around to reinstalling gm. Now I'm trying to get the script
working again but it's been an uphill battle so far. It appears that
either I hadn't tested the script on cross-domain css files or else
FF's security restrictions have increased recently. So, I added a try/
catch to prevent that particular security feature from stopping the
script entirely, but no colors are being changed. I can see in the
console that the script is running and looping through style sheets,
but no changes are visible. I've been testing on reddit and google's
search results - the light blue links against the white background are
the ideal candidates for the kind of thing I like to change. Anyway
here's the script; thanks for any help!
The problem is that document.styleSheet also includes the stylesheet
that have been loaded from other domains. You cannot access their rules
by item(index).cssRules, this violates certain security rules. Use this
script to debug and see yourself:
function log(str) {
GM_log(str);
}
(function () {
ss = document.styleSheets;
for (sheet = 0; sheet < ss.length; sheet++) {
var itm = ss.item(sheet);
var hrf = itm.href;
log(sheet+" SOURCE\n"+((hrf)?hrf:"PAGE"));
try {
var rls = itm.cssRules;
log(sheet+" RETRIEVE\n"+((rls)?"SUCCESS":"NULL"));
} catch (e) {
log(sheet+" ERROR\n"+e);
}
}
}) ();
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/greasemonkey-users?hl=en.