User:Jrajav/myskin.js

/*jslint regexp: true, browser: true */ /*global $: false */

var iWantThumbnailPreviews = true, andAnimateThem = true, // CSS transition; Doesn't perform well in most browsers andPreloadThem = true, andSkipFiletypes = ['.svg', '.svg.png'];

$(function {    'use strict';

$('#searchInput') .attr('tabindex', 1) .attr('placeholder', 'Search');

$('pre[class*="source-"]').addClass('jrajav-code');

if (iWantThumbnailPreviews) { var setupPreviews = function (anchor, position) { var originalImage = anchor.find('img.thumbimage'), originalImageUrl = originalImage.attr('src').replace('/thumb/', '/').replace(/\/\d*px.*$/, ''), overlayImage = $(' '), loadOverlay = function { overlayImage.attr('src', originalImageUrl); originalImage.css('visibility', 'hidden'); },               skip = false;

andSkipFiletypes.forEach(function (filetype) {               if (filetype === originalImageUrl.slice(originalImageUrl.length - filetype.length)) {                    skip = true;                    return false; // Break loop                }            });

if (skip) { return; }

overlayImage .css('position', 'absolute') .css('max-width', originalImage.width + 'px') .css(position, '0') .hide .load(function {                    overlayImage                        .show                        .addClass('jrajav-image-overlay-' + position);                });

if (andAnimateThem) { overlayImage.addClass('jrajav-image-overlay-animate'); }

anchor.prepend(overlayImage);

if (andPreloadThem) { loadOverlay; } else { originalImage.one('mouseenter', loadOverlay); }       };

$('div.tleft a.image').each(function { setupPreviews($(this), 'left'); }); $('div.tright a.image').each(function { setupPreviews($(this), 'right'); }); } });