When are images loaded in new Journal view?

jfriendjfriend Registered Users Posts: 8,097 Major grins
In the new Journal view, it appears that if I run a script with onDOMReady that sometimes the images will not yet be in the page. I tried onPhotoShow (what the Smugmug view uses) and it doesn't fire in the new Journal view.

So, how do I reliably fire a script after the images are loaded into a new Journal page?

FYI, I see lots of new code (SM.Gallery.Manager) which perhaps explains why some timing is different than it used to be. I have scripts that are busted in the new journal view because I don't know how to trigger them after the photos are loaded. Does SM.Gallery.Manager have events that I can hook after the images have been loaded and put in the page?

Why don't you just fire the same event for every single view anytime it's loaded so script writers can just do it the same in every view? The Smugmug view has had onPhotoShow for a long time, but that doesn't fire in other views.
--John
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question

Comments

  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited October 19, 2010
    G'day John,

    I haven't really had anything to do with this new frontend development, but i've just been through the code and found the following events...I'm sure one of these will work for you...
    SM.Gallery.imageSelectEvent         = new YAHOO.util.CustomEvent("ImageChange", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.imageFocusEvent          = new YAHOO.util.CustomEvent("ImageFocus", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.pageChangeEvent          = new YAHOO.util.CustomEvent("PageChange", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.galleryDataLoadedEvent   = new YAHOO.util.CustomEvent("GalleryDataLoaded", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.hashUpdatedEvent         = new YAHOO.util.CustomEvent('HashUpdate', window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.imageAddToCartEvent      = new YAHOO.util.CustomEvent('AddToCart', window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.toolSelectionEvent       = new YAHOO.util.CustomEvent('ToolSelection', window, false, YAHOO.util.CustomEvent.FLAT);
    

    to subscribe to the event...
    SM.Gallery.<event>.subscribe(func);
    

    At this point, it only looks like this is rolled out for the new Journal style...but I'm sure the front end guys are working on that.

    Hope this helps.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited October 19, 2010
    devbobo wrote: »
    G'day John,

    I haven't really had anything to do with this new frontend development, but i've just been through the code and found the following events...I'm sure one of these will work for you...
    SM.Gallery.imageSelectEvent         = new YAHOO.util.CustomEvent("ImageChange", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.imageFocusEvent          = new YAHOO.util.CustomEvent("ImageFocus", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.pageChangeEvent          = new YAHOO.util.CustomEvent("PageChange", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.galleryDataLoadedEvent   = new YAHOO.util.CustomEvent("GalleryDataLoaded", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.hashUpdatedEvent         = new YAHOO.util.CustomEvent('HashUpdate', window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.imageAddToCartEvent      = new YAHOO.util.CustomEvent('AddToCart', window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.toolSelectionEvent       = new YAHOO.util.CustomEvent('ToolSelection', window, false, YAHOO.util.CustomEvent.FLAT);
    
    to subscribe to the event...
    SM.Gallery.<event>.subscribe(func);
    
    At this point, it only looks like this is rolled out for the new Journal style...but I'm sure the front end guys are working on that.

    Hope this helps.

    Cheers,

    David
    I'll give it a try. Thanks.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited October 21, 2010
    devbobo wrote: »
    G'day John,

    I haven't really had anything to do with this new frontend development, but i've just been through the code and found the following events...I'm sure one of these will work for you...
    SM.Gallery.imageSelectEvent         = new YAHOO.util.CustomEvent("ImageChange", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.imageFocusEvent          = new YAHOO.util.CustomEvent("ImageFocus", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.pageChangeEvent          = new YAHOO.util.CustomEvent("PageChange", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.galleryDataLoadedEvent   = new YAHOO.util.CustomEvent("GalleryDataLoaded", window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.hashUpdatedEvent         = new YAHOO.util.CustomEvent('HashUpdate', window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.imageAddToCartEvent      = new YAHOO.util.CustomEvent('AddToCart', window, false, YAHOO.util.CustomEvent.FLAT);
        SM.Gallery.toolSelectionEvent       = new YAHOO.util.CustomEvent('ToolSelection', window, false, YAHOO.util.CustomEvent.FLAT);
    
    to subscribe to the event...
    SM.Gallery.<event>.subscribe(func);
    
    At this point, it only looks like this is rolled out for the new Journal style...but I'm sure the front end guys are working on that.

    Hope this helps.

    Cheers,

    David
    No luck. "galleryDataLoadedEvent" fires, but the images aren't yet in the page, only in the data structures (presumably). Can you get some feedback to the UI guys that they need to fire an event after the images are added to the page (ideally after the page is done being built) so customizing can do whatever it wants to the images.

    Also, please pass on that all views should have the same set of events so customizing doesn't have to use different notification mechanisms for every view type.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited October 22, 2010
    jfriend wrote: »
    Also, please pass on that all views should have the same set of events so customizing doesn't have to use different notification mechanisms for every view type.

    John,

    I believe that Journal is the first to get this stuff...and will filter down to other styles as they get revised.

    I'll check with them about the other stuff.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited October 27, 2010
    devbobo wrote: »
    John,

    I believe that Journal is the first to get this stuff...and will filter down to other styles as they get revised.

    I'll check with them about the other stuff.

    Cheers,

    David
    Bump. Still looking for a way to know when the journal images are all in the page.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
Sign In or Register to comment.