First of all, thanks for the detailed answer. I hope I'm not pushing
it if I ask how would I go about firing a custom
event from AP. I'm not that good with events :(

I uploaded the current working AP+Splash script and also the Splash
script, in case anyone's interested
http://10megatons.com/zzztemp/greasemonkey/




On Mar 25, 2:39 am, Fracture <[email protected]> wrote:
> On Mar 24, 2:20 pm, esquifit <[email protected]> wrote:
>
>
>
> > I don't know the inner workings of Autopagerize, but it could be that
> > it is sufficient for it to run before the other script.
> > In the Greasmonkey Manage Scripts dialog, just drag the Splash script
> > back and drop it before Autopagerize.  The execution order is that of
> > the list. It probably doesn't work, but it takes 5 seconds to test it,
> > you never know.
>
> > On Wed, Mar 24, 2010 at 1:44 PM, Fracture <[email protected]> wrote:
> > > You would need to modify Splash so that it will scan for thumbnails
> > > again after Autopagerize inserts another page.
>
> > > One way to do this would be for Autopagerize to fire a custom message
> > > event on the new page content once it loads, then have Splash listen
> > > for that event and scan the new page when it happens. [1]
>
> > > You could also listen for DOMSubtreeModified in Splash and try to
> > > figure out when the event has been fired for a new page insertion. [2]
>
> > > Unless Splash gives its functions to unsafeWindow for some reason, you
> > > can't access them from Autopagerize.
>
> > > [1]http://help.dottoro.com/ljknkjqd.php
> > > [2]https://developer.mozilla.org/En/DOM_Events#Example
>
> > > On Mar 24, 7:34 am, solidox <[email protected]> wrote:
> > >> Hello,
>
> > >> I'm trying to fix a script, in fact the interaction between 2 scripts:
> > >> Autopagerize and Splash Album Viewer.
>
> > >> I guess u know what Autopagerize is; Splash is just a full-size
> > >> tooltip of the thumbnails on flickr (and other sites), so you don't
> > >> have to load the whole page to see the larger image.
>
> > >> The problem is Splash only works on the first page, because
> > >> Autopagerize loads the next pages after Splash scans the DOM for
> > >> thumbnails.
>
> > >> I found what needs to call what, but since each script is sandboxed, I
> > >> don't know how to access Splash's functions from Autopagerize.
>
> > >> Hope you can help, thx
>
> Since Autopagerize probably needs to fetch the next page with an
> asynchronous request anyway, Splash will run only for the first page
> no matter the order of execution.
>
> > And since I'm going to modify both scripts, I could have Splash make
> > it's function(s) public. I'm just not sure how to do that.
>
> The custom message method would be the best way.  You fire a custom
> event from AP when a new page is loaded and you set the event's target
> to the element that's added to the page.  In Splash you add an event
> listener for that custom event and "Splashify" the event target.
>
> Another way to do it is, in Splash:
>
> unsafeWindow.splashify = function(el) {...}
>
> And then in AP:
>
> ...
> onload: function(details) {
> ....
> unsafeWindow.splashify(el);
> ...
>
> }
>
> But this is very unsafe, as the name implies.  You're adding a
> function to the page's context, so the page's scripts can access it.
> Also, when calling the function, it's possible that the page overwrote
> the old function and instead made you run something malicious.
>
> The event passing method is better not only because it's safer, but
> because you can better separate the implementation and the
> "interface" (the event name, target, other properties).  Scripts don't
> need to call functions in other scripts and worry about name or
> parameter changes.

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