I don't know what determines the order in which Greasemonkey applies 
scripts, but I would guess its based on alphabetical order or order of 
installation.

What I would do, is have the first script create some invisible element 
in the page with a unique ID as its last act (so when it creates this 
element, the script has done everything you need it to have done).

Something like <div id="unique_id_001" style="display: none;"></div> 
appended to the end of the body tag.


Then the second script has a clause before it does whatever processing 
it does, where it checks if the element exists - if it does it 
continues, else it uses setTimeout() and waits for a while before 
rechecking.

Something like this:



check();

function check()
{
    if(document.getElementById("unique_id_001")!=null)
    {
       process();
    }
    else
    {
        setTimeout("check()",1000);
    }
}





The script calls function check() immediately. Check() tests if element 
with id "unique_id_001" exists - if it does (does not return null) then 
it calls function process() which is where the second script does 
whatever it does.
Else if it does not exist, it uses setTimeout to call check() again 
after (in this example) 1000 milliseconds - 1 second.


jumper4000 wrote:
> Hi, I have two scripts and I need them to work together. For example,
> I want the second script to apply to the result of the first script.
> Right now, the second script is only applied to the original content
> of the page, and not what the first script produces. Does this make
> sense? If not, please let me know and I'll try to clarify.
>
> Thanks
>
> >
>
>   

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