JS to force Lightbox in Traditional only

DavidTODavidTO Registered Users, Retired Mod Posts: 19,160 Major grins
Possible? Any kind-hearted soul feel like hooking me up? :D
Moderator Emeritus
Dgrin FAQ | Me | Workshops

Comments

  • darryldarryl Registered Users Posts: 997 Major grins
    edited November 11, 2007
    Although no longer supported, 1337box worked for me:

    http://www.dgrin.com/showthread.php?t=32708&highlight=1337Box

    That is, until I tried to combine it with the disabling of hover text and clicks for Journal views:

    http://www.dgrin.com/showpost.php?p=209813&postcount=12

    I never got motivated to debug what in 1337box was stomping on the hover/click disable for Journals, as the latter was more important to me.

    But some day maybe I'll hack 1337box to ignore journals and maybe it'll work.

    BTW, I think there's way too much *hacking* going on here.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited November 11, 2007
    <img src="https://us.v-cdn.net/6029383/emoji/thumb.gif&quot; border="0" alt="" >
    function hackTraditional() {
      if (YD.hasClass(document.body,"traditional")) {
        var oLst = YD.getElementsByClassName("photoLink", "a", this);
        var re = /\/gallery\/\d+\/\d+\/(\d+)\//;
    
        for (i=0; i < oLst.length; i++) {
          if (re.test(oLst[i])) {
            re.exec(oLst[i]);
            var url = oLst[i].href;
            oLst[i].href = "javascript:openLB(" + RegExp.$1 + ",'Auto');";
    
            if (YD.hasClass(document.body,"loggedIn"))
              oLst[i].parentNode.innerHTML += "<a href ='"+ url +"'>edit</a>";
          }
        }
      }
    }
    YE.onContentReady("photos", hackTraditional);
    
    David Parry
    SmugMug API Developer
    My Photos
  • DavidTODavidTO Registered Users, Retired Mod Posts: 19,160 Major grins
    edited November 11, 2007
    dev:


    bowdown.gif



    bowdown.gif



    bowdown.gif



    Thank you, so much!
    Moderator Emeritus
    Dgrin FAQ | Me | Workshops
  • darryldarryl Registered Users Posts: 997 Major grins
    edited November 12, 2007
    :-O !!!!

    Thanks for the hack!!
  • darryldarryl Registered Users Posts: 997 Major grins
    edited November 12, 2007
    Wait -- weird. This works for me when I'm logged in, but not when I'm logged out.

    And I've even removed all the code for the Journal click/hover hiding hack too.

    Example of it not working here:

    http://gladlee.smugmug.com/gallery/3711094/1/212727446

    DavidTO: Is it working for you when you log out?

    Thanks!

    Oh, minor changes to support allthumbs too:
    // Lightbox for Traditional and AllThumbs!
    function hackLightbox() {
      if (YD.hasClass(document.body,"traditional") || YD.hasClass(document.body,"allthumbs")) {
        var oLst = YD.getElementsByClassName("photoLink", "a", this);
        var re = /\/gallery\/\d+\/\d+\/(\d+)\//;
    
        for (i=0; i < oLst.length; i++) {
          if (re.test(oLst[i])) {
            re.exec(oLst[i]);
            var url = oLst[i].href;
            oLst[i].href = "javascript:openLB(" + RegExp.$1 + ",'Auto');";
    
            if (YD.hasClass(document.body,"loggedIn"))
              oLst[i].parentNode.innerHTML += "<a href ='"+ url +"'>edit</a>";
          }
        }
      }
    }
    YE.onContentReady("photos", hackLightbox);
    
  • DavidTODavidTO Registered Users, Retired Mod Posts: 19,160 Major grins
    edited November 12, 2007
    darryl wrote:
    Wait -- weird. This works for me when I'm logged in, but not when I'm logged out.

    And I've even removed the <body onload=doOnLoad()> call for the Journal click/hover hiding hack too.

    DavidTO: Is it working for you when you log out?


    It was. Or, I thought it was. But now it isn't. <img src="https://us.v-cdn.net/6029383/emoji/ne_nau.gif&quot; border="0" alt="" >
    Moderator Emeritus
    Dgrin FAQ | Me | Workshops
  • darryldarryl Registered Users Posts: 997 Major grins
    edited November 12, 2007
    Ah, the problem is that, strangely enough, the photoLink class only exists when you're logged in. I double checked this on the dgrin.smugmug.com to make sure it wasn't something with my site, and found that the link for an image in a gallery looks like this:
    <div class="photo"><a href="/gallery/167709/1/122965637/Medium"><img class="imgBorder" name="mainPhoto" id="mainPhoto"  alt="Digital Grin &gt; &quot;Magical Light&quot; by eric_the_web. Winner, Dgrin Challenge 81, &quot;What's Going On?&quot;You can see the rest of the challenge entries here." title="Digital Grin &gt; &quot;Magical Light&quot; by eric_the_web. Winner, Dgrin Challenge 81, &quot;What's Going On?&quot;You can see the rest of the challenge entries here." border="0" src="http://dgrin.smugmug.com/photos/122965637-Th-1.jpg"  width="150"  height="150" hspace="0" vspace="0"  /></a>                 <div class="caption">"Magical Light" by eric_the_web. Winner, Dgrin Challenge 81, "What's G ...</div></div>
    

    Note the lack of a photoLink class in the <a href> tag. That's the problem. I don't have the fix though. :-}
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited November 12, 2007
    yeah, it looks like a SmugBug... i'm looking into it.
    David Parry
    SmugMug API Developer
    My Photos
  • darryldarryl Registered Users Posts: 997 Major grins
    edited November 15, 2007
    *bumparoo* -- hiya Dev. :-}

    Oh, yeah, it took me over a year to notice it, but thanks for [post=682543]this Photo Tools hack[/post] for Traditional, All Thumbs and Journal views. It pretty much eliminates the need for the "edit" link you added in this hack. If I get motivated enough, maybe I'll update the select menu to contain all the right IDs for the Pro/NotMovie stuff.

    :-}
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited November 15, 2007
    As it turns out, it's not really a bug per se. The class is there when you are logged it for the purposes of the "arrange mode" tool.

    We are currently doing some other ui changes that will address this issue.

    Until then, when I get a chance...i will revisit the hack to remove the reliance on the class.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • darryldarryl Registered Users Posts: 997 Major grins
    edited December 5, 2007
    *Bump* -- would still like to force Lightbox in Traditional, Journal and other style. Any word on the UI fixes that would enable your hack to work when *not* logged in, Dev?

    Thanks!
  • com3com3 Registered Users Posts: 423 Major grins
    edited January 13, 2008
    darryl wrote:
    *Bump* -- would still like to force Lightbox in Traditional, Journal and other style. Any word on the UI fixes that would enable your hack to work when *not* logged in, Dev?

    Thanks!


    +1! clap.gif
  • dmcdmc Registered Users Posts: 427 Major grins
    edited March 17, 2008
    com3 wrote:
    +1! clap.gif

    + 1 for Feburary
    and +1 for March mwink.gif
  • dmcdmc Registered Users Posts: 427 Major grins
    edited May 6, 2008
    dmc wrote:
    + 1 for Feburary
    and +1 for March mwink.gif

    bump for April...May... :cool

    I'd really like to launch the LightBox from Journal style.... :cry
  • darryldarryl Registered Users Posts: 997 Major grins
    edited September 17, 2008
    *Bumparooni* - wow, has it really been that long?
  • dmcdmc Registered Users Posts: 427 Major grins
    edited September 17, 2008
    :cry
  • darryldarryl Registered Users Posts: 997 Major grins
    edited September 29, 2008
    You know what's weird?

    If you're in Traditional Style, and you click on a photo, you get maybe a Small or Medium image. Click again it bumps up. Again and it eventually bumps up to Original.

    But click one more time, and you get... Lightbox for Original. Huh!?

    What's the point of that? And clearly, it illustrates that SmugMug *could* implement Lightbox for other styles without a whole lot of recoding (just change the links for the thumbs in Traditional, etc.)

    Forget hacks. SmugMug should just use Lightbox for every Style unless they sense that you don't support JavaScript at all, in which case I'm sure there's a lot more things broken than just Lightbox.

    [Ok, played with this a bit more. After Lightbox is brought up, you don't get properly returned to the index page, or the photo where you exit Lightbox. Clearly there's work to be done here, but again, this is a super-old bug.]
Sign In or Register to comment.