Update to lightbox and lightbox dialog
Of all my scripts, probably the one I've had the most use of is my lightbox and lightbox dialog library. More than a standard lightbox, it also provides dialog functionality so you can replicate native alerts and confirms but in a nice, styled lightboxy sort of way.
And it's just had an update, which now allows it to load absent files - that is, files not currently present in the DOM - as well as entire pages.
This is much better; it means you no longer have to load - but hide - full-size photos of thumbnails into your DOM. Now you can just point the lightbox script at it even though they're absent from the current DOM.
Pages open in an iframe loaded inside the lightbox (the size can be tweaked in the config).
For both techniques, run the lightbox plugin on a string pointing to the file to load, e.g.
1'folder/somePic.jpg'.lightbox(); //load absent picture
2'folder/somePage.php?someVar=3'.lightbox(); //load page
...and the script does the rest. Head over here to download, get usage info or view a demo.. Updated documentation to follow.
post a commentUpdate to date calculator script
I've just updated my date calculation tool, which you might recall allows you to get the number of seconds, minutes, hours, days or weeks between two dates.
It now allows you to specify the string now for one of the data arguments, meaning calculation will be done from/until the present moment
Also new is the ability to return years and months as well as the above units, and you can now specify time - not just date - in the date arguments.
Not the most exciting script in the world, but quite a useful one.
Head over here to download, get usage info or view a demo.
post a commentBizarre webkit bug with 'typeof'
That'll teach me to post scripts and assume, without checking, that the normally-reliable Chrome and Safari will play ball. The other day I posted my JS simulation of REGEXP lookbehinds, but Marcus Tucker found it didn't work in these browsers.
After some digging, it seems there's a bizarre bug in Webkit browsers (i.e. Chrome and Safari) whereby regular expression objects are considered functions, not objects. So:
alert(typeof /\w+/);
Opera, IE and FF all say 'object', as you'd expect, but Chrome and Safari say 'function'. Very odd. I fixed the issue by using instanceof rather than typeof:
1alert(/\w+/ instanceof RegExp)
2//all browsers say true - happy days!
post a comment