[Greasemonkey] how to reset style of elements inserted by
greasemonkey scripts?
chris feldmann
cfeldmann at gmail.com
Fri Sep 2 19:25:24 EDT 2005
On 9/2/05, paolo massa <massa at itc.it> wrote:
> I wrote a greasemonkey script that insert a box (a div) into social
> sites (flickr, delicious, ...) with some links to the page of the same
> user on the other sites, i.e. if you are on flickr.com/photos/zephoria
> you get handy links to http://del.icio.us/zephoria,
> http://technorati.com/profile/zephoria, etc.
> The script, Identity Burro, is available at
> http://moloko.itc.it/paoloblog/archives/2005/08/29/identity_burro_making_social_sites_more_social.html
>
> My question is the following:
> I would like the box to keep the same visual appearance across all
> sites (for example if the social site in which it fires has a black
> background for divs I don't want my div to have a black backgroud). Do
> you know if there is a way to "reset" the style of inserted HTML
> elements so that they don't inherit the styles of the page they
> modify? Or maybe there is a list of default CSS values that could be
> "forced" into the style? something like
> var resetStyle="text-decoration:
> none;font-weight:normal;background:none;border:0;padding:0;margin:0;text-align:left;";
> html_element.setAttribute("style",resetStyle);
function infectStyles(css) {
var h, s;
h=document.getElementsByTagName('head')[0];
if (!h) { return; }
s = document.createElement('style');
s.type = 'text/css';
s.innerHTML = css;
h.appendChild(s);
}
var css = 'insert css here with "! important" as necessary';
Derived directly from diveintogreasemonkey.org
>
> I apologize if this is more a CSS-experts question but I hope that
> some of you writing GM scripts has already met and solved this
> problem. If this is not the case, I'll ask the question to a
> CSS-experts mailing list.
> Thanks anyway!
> Of course, feedback about the script itself is appreciated as well!
>
> P.
>
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>
>
>
More information about the Greasemonkey
mailing list