User:JGMalcolm/SimpleLightbox.js

// adapted from 'User:Rezonansowy/SimpleLightbox.js' // added ability to hit [Esc] to close box $(document).ready(function { $('body').append(' ');  $('a.image').click(function(e) { e.preventDefault; if ($(this).find('img').attr('src').match('/thumb/')) { var src = 'http:' + $(this).find('img').attr('src').replace('/thumb',).replace(/\/[\-_.%\w]*$/, ); } else { var src = $(this).find('img').attr('src'); }   $('#lightbox') .html('') .css('line-height', $(window).height+'px') .show .on('click', function { $(this).hide; }); }); $(document).keyup(function(e) { if (e.keyCode == 27) { // esc keycode $('#lightbox').hide; } }); });