User:Jnanaranjan sahu/common.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
The accompanying .css page for this skin is at User:Jnanaranjan sahu/common.css. |
mw.loader.load( 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.0.47/jquery.fancybox.min.js' );
$('.image').each(function(i, obj) {
var thumbNailLink = $(this).find('img').attr('src');
if (thumbNailLink) {
if (thumbNailLink.toLowerCase().indexOf(".jpg") >= 0) {
extPosition = thumbNailLink.toLowerCase().indexOf(".jpg");
} else if (thumbNailLink.toLowerCase().indexOf(".jpeg") >= 0) {
extPosition = thumbNailLink.toLowerCase().indexOf(".jpeg")+1;
} else if (thumbNailLink.toLowerCase().indexOf(".svg") >= 0) {
extPosition = thumbNailLink.toLowerCase().indexOf(".svg");
} else if (thumbNailLink.toLowerCase().indexOf(".gif") >= 0) {
extPosition = thumbNailLink.toLowerCase().indexOf(".gif");
} else {
extPosition = thumbNailLink.toLowerCase().indexOf(".png");
}
$(this).attr('href', thumbNailLink.substring(0, extPosition+4).replace('thumb/',''));
$(this).attr('data-fancybox', 'gallery');
}
});