User:Dominus Arbitrationis/monobook.js
The UESPWiki – Your source for The Elder Scrolls since 1995
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
// -----------------------------------------------------------------------
// install [[Wikipedia:User:Cacycle/wikEd]] in-browser text editor
importScriptURI('//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript');
// --------------------------------------------------------------------
$(document).ready(function() {
$('body').append('<div id="lightbox" style="display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.6);text-align:center;z-index:9999"></div>');
$('a.image').click(function(e) {
e.preventDefault();
if ($(this).find('img').attr('src').match('/thumb/')) {
var src = $(this).find('img').attr('src').replace('/thumb','').replace(/\/[\-_.%\w]*$/, '');
} else {
var src = $(this).find('img').attr('src');
}
$('#lightbox')
.html('<img src="'+src+'" style="background:#fff;box-shadow: 0 0 25px #111;max-height:100%;max-width:100%;vertical-align:middle;cursor:pointer;" />')
.css('line-height', $(window).height()+'px')
.fadeIn('fast')
.live('click', function() {
$(this).fadeOut('fast');
});
});
});
// --------------------------------------------------------------------------