On Thu, Mar 8, 2012 at 9:58 AM, Matt Kruse <[email protected]> wrote:

> @run-at document-start is working great to apply "theme" CSS to a site
> before anything renders. Kudos on adding this feature!
>

Really?  I'd love to see your script.


> I want to allow the user to un-apply the theme, but I can't find any
> hook into the added CSS. It's not in a <style> block in the page when
> I view source.
>

When you use view source, you see the downloaded source, not the "applied"
source after JS modifications.  Use the web console / DOM inspector /
Firebug.


> Is there any way to hook into the styles added with GM_addStyle() when
> running at document-start, so I can disable it?
>

GM_addStyle() doesn't do anything different at different run-at times.  It
tries to return the <style> node that it created, but I'm pretty sure it
fails to do so (hitting built in security mechanisms).  It's a _really_
simple function though[1] so it should be straightforward to write one
yourself that gives you a definite handle to the style node.

OTOH, perhaps a better way is probably to just write all your rules to
include something like "body.my_script_name" in the selector.  Apply that
class to the body, and remove it to remove the styles.

[1]
https://github.com/arantius/greasemonkey/blob/master/content/miscapis.js#L98

-- 
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.

Reply via email to