« 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 Anthony Lieuallen :: Rate this Message:

Reply to Author | View in Thread

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

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