We need onSmugmugDoneCreatingPage event

jfriendjfriend Registered Users Posts: 8,097 Major grins
It is getting more a more difficult to write scripts that modify Smugmug's pages. This is because we have a harder and harder time knowing when Smugmug is actually done building the page. It used to be we could use YE.onDOMReady. Then, Smugmug started using YE.onDOMReady to add things to the page (buttons, etc...) so it because hard for us to know when all of Smugmug's code was done adding things to the page.

How, I find that certain flash objects not only don't work on just onDOMReady, but they finish initializing themselves on a setTimeout call which makes their initialization very indeterminate.

So, if we want to run our own scripts to modify the page when Smugmug is done putting things in the page, it's a nightmare to do it reliably without causing problems.

ALL we need is one simple page level event when all of Smugmug's code (including the building of flash objects and buttons and anything else built with JS or built on timers) is done. This would make modifying the page a lot more reliable, would make the technique for doing it not vary depending upon what page you're on, etc....

I've asked for this before when the YUI buttons first appeared and were added via onDOMReady. But, I never heard one way or the other whether anyone at Smugmug thought this was a good idea or was even interested in the topic at all.

The consequences of not doing this right is that we have scripts (like the one that moves the slideshow button to the same line as the cart buttons) that work fine for a year, then Smugmug changes something and people's pages stop working because of some timing conflict with customization scripts they have and we can't even find a way to make the customization work any more, much less make them work in a way that will be safe for the future.

We could have a lot fewer page creation timing issues if there was a simple event when Smugmug was done building the page that signified that is was now safe for us to modify things to our liking.

Here's one thread where we're tracking down one of these timing issues now and I'm trying to hack a super defensive script that won't cause problems and am not having any luck. Worse yet, the timing issue is brower-specific and doesn't happen on my system (the worst kind).
--John
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question

Comments

  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited July 31, 2009
    Bump. Just wondering if any Smugmug devs read this and care to offer some thoughts?

    The more Smugmug adds things to the page dynamically, the harder it is to write problem-free javascript that also modifies 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
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited August 1, 2009
    John,

    For a long time, I've wanted to us to have a js framework for different Smug events. And we have discussed it several times internally. But it's not really my area, probably Lee or Jimmy...maybe another sorcerer.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited August 1, 2009
    devbobo wrote:
    John,

    For a long time, I've wanted to us to have a js framework for different Smug events. And we have discussed it several times internally. But it's not really my area, probably Lee or Jimmy...maybe another sorcerer.

    Cheers,

    David
    It would be very useful to have a few simple events. With all the other JS stuff going on in pages now, it's getting quite difficult to write trouble-free JS code that does your own stuff to the page and works right in all the different views. There's one event already with onPhotoShow.subscribe(). We probably only need a small number of other events and it would be great to have them work the same in all the different views.

    Hopefully Lee or Jimmy will drop in with a comment some time.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • bwgbwg Registered Users, Retired Mod Posts: 2,119 SmugMug Employee
    edited August 1, 2009
    its something that will be addressed in a future update. thats all i can say at this time.
    Pedal faster
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited August 1, 2009
    bigwebguy wrote:
    its something that will be addressed in a future update. thats all i can say at this time.
    If you want to run anything by someone who does a lot of JS customizing, just let me know.
    --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.