FW: [Greasemonkey] Including other JS files and using "class"
and custom styles
Stefano POGLIANI
stefano at poglianis.net
Fri Aug 25 19:30:34 EDT 2006
Sam
were you able to succeed on this?
Thanks
/Stefano
sam foster wrote:
> Ah, I figured if I lurked for long enough someone would ask my
> question for me :)
> It seems like fetching the library asynchonously might cause problems?
> Would GM allow the page's onload event to happen while my library was
> being loaded?
>
> This seems like a common use case - its a drag pasting in and managing
> these "includes".
> I'd like to be able to pull in aol's dojo from
> http://o.aolcdn.com/iamalpha/.resource/jssdk/dojo-0.2.2/dojo.js
> and keep it cached. Anyone tried this?
>
> Sam
>
>
>> |
>> |Philip Friedman - Auto Europe wrote:
>> |> Maybe not "straightforward" by Anthony's standards, but it
>> |does "include"
>> |> library.js in libraryTest.user.js as desired.
>> |>
>> |> Here's the example, that works for the two files in the same
>> |directory
>> |> on the server. Note that libraryTest.user.js @includes
>> |itself, so the
>> |> URL construction won't make sense in the real world.
>> |>
>> |> File libraryTest.user.js:
>> |>
>> |> // ==UserScript==
>> |> // @name LibraryTest
>> |> // @namespace /phil
>> |> // @description Library Test
>> |> // @include http://*libraryTest.user.js
>> |> // @exclude
>> |> // ==/UserScript==
>> |>
>> |> GM_xmlhttpRequest( { method:'GET'
>> |> , url:document.location.href.replace(/\/[^\/]*$/,'/library.js')
>> |> , onload: onLoadLibrary
>> |> } );
>> |>
>> |> function onLoadLibrary(rsp) {
>> |> eval(rsp.responseText);
>> |> libraryAlert();
>> |> }
>> |>
>> |> File library.js:
>> |>
>> |> function libraryAlert() {
>> |> alert('libraryAlert');
>> |> GM_log('libraryAlert');
>> |> }
>> |>
>> |> --
>> |> Regards, Phil Friedman - Auto Europe - 207-842-2069
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
More information about the Greasemonkey
mailing list