User:Najzere/spoilerimage.js

$(document).ready(function { $('span.spoilerimage img').each( function { alert($(this).attr('width')); var spWidth=(parseFloat($(this).attr('width').substring(0,$(this).attr('width').length-2))/2)-25; var spHeight=(parseFloat($(this).attr('height').substring(0,$(this).attr('height').length-2))/2)-6; var hiddensrc=$(this).attr('src'); var spoilersrc='http://cdn.wikimg.net/strategywiki/images/b/be/Yellow-background-24x24.png'; $(this).attr('src',spoilersrc); var $spoilerImage=$(' '); $(this).parent.prepend($spoilerImage); $(this).parent.css({     position: 'relative',      top: 0,      left: 0    }); $spoilerImage.css({     position: 'absolute',      left: 75,      top: 0    }); $(this).attr({     onMouseOver: "$(this).attr('src','"+hiddensrc+"');",      onMouseOut: "$(this).attr('src','"+spoilersrc+"');"    }); }); });