View Full Version : JS to force Lightbox in Traditional only
DavidTO
Nov-10-2007, 01:24 PM
Possible? Any kind-hearted soul feel like hooking me up? :D
darryl
Nov-10-2007, 10:15 PM
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.
devbobo
Nov-11-2007, 05:16 PM
:thumb
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);
DavidTO
Nov-11-2007, 05:20 PM
dev:
:bow
:bow
:bow
Thank you, so much!
darryl
Nov-12-2007, 12:48 PM
:-O !!!!
Thanks for the hack!!
darryl
Nov-12-2007, 01:23 PM
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);
DavidTO
Nov-12-2007, 01:26 PM
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. :dunno
darryl
Nov-12-2007, 01:42 PM
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 > "Magical Light" by eric_the_web. Winner, Dgrin Challenge 81, "What's Going On?"You can see the rest of the challenge entries here." title="Digital Grin > "Magical Light" by eric_the_web. Winner, Dgrin Challenge 81, "What's Going On?"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. :-}
devbobo
Nov-12-2007, 02:24 PM
yeah, it looks like a SmugBug... i'm looking into it.
darryl
Nov-15-2007, 08:33 PM
*bumparoo* -- hiya Dev. :-}
Oh, yeah, it took me over a year to notice it, but thanks for this Photo Tools hack 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.
:-}
devbobo
Nov-15-2007, 08:44 PM
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
darryl
Dec-05-2007, 01:17 PM
*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!
com3
Jan-13-2008, 01:45 AM
*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
+1! :clap
+ 1 for Feburary
and +1 for March :wink
+ 1 for Feburary
and +1 for March :wink
bump for April...May... :cool
I'd really like to launch the LightBox from Journal style.... :cry
darryl
Sep-16-2008, 10:39 PM
*Bumparooni* - wow, has it really been that long?
darryl
Sep-29-2008, 02:55 PM
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.]
vBulletin v3.5.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.