« Return to Thread: Including other JS files and using "class" and custom styles

Re: Including other JS files and using "class" and custom styles

by Stefano POGLIANI :: Rate this Message:

Reply to Author | View in Thread

Thanks Anthony!

Do you have an example of use of "className" in Javascript?

also, as I read the "Dive into GM" page, it seems that if the newly
defined "class" gets added an  "! important;" at the end, the definition
overrides the previous one.
Could this approach be used to "sort of" RESET any stylesheet attribute
that would apply to the elements I am defining in my page?
The issue here is to avoid that page-specific stylesheets affect the
display of my widgets in the page (so that on one page my DIV will paint
in one way and, on a different page, it will paint in  a different way).


As to the XUL question. I was wondering if, for instance, with GM I
could create a little XUL container which could, then, be embedded in
soething like the "All-in-One Sidebar" extension.

Thanks
/Stefano

Anthony Lieuallen wrote:

> On 8/4/2006 4:18 AM, Stefano POGLIANI wrote:
>>   1. Does it work including an external Javascript script inside a GM
>>      script?
>
> The only straightforward way is to copy and paste the source in.
> There's no "include" statement like in some other languages.
>
>>   2. Is there a way where I could use some "static HTML" to shortcut
>>      the development time? If yes, does someone have an example?
>
> There's a number of ways.  For example:
> http://www.arantius.com/article/dollar-e
>
>>   3. one of the issues related to my poor knowledge of JS is that, when
>>      programmatically creating my widgets, I do not know how to set a
>>      custom CSS class (the equivalent of saying <div class="myclass">
>>      ..... how can I specify in Javascript this?)
>
> Since "class" is a reserved word in JavaScript, you have to use
> something else.  In this case, className.
>
>>   4. associated to the latter. If I create my own CSS classes, can I
>>      store their definition in a CSS style sheet file and "import" it
>>      in the GM script? If yes, how?
>
> Yes.
> http://diveintogreasemonkey.org/patterns/add-css.html
>
>>   5. Final one. Can I use XUL inside a GM script?
>
> That question is a bit too open ended for me to understand fully; I
> can't be sure, because I don't know what you're really trying to do,
> but I suspect the answer is no.
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey@...
> http://mozdev.org/mailman/listinfo/greasemonkey


_______________________________________________
Greasemonkey mailing list
Greasemonkey@...
http://mozdev.org/mailman/listinfo/greasemonkey

 « Return to Thread: Including other JS files and using "class" and custom styles