User:Najzere/spoilerimage.js

$(document).ready(function { $('span.spoilerimage img').each( function { var spWidth=($(this).attr('width')/2)-25; 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.append($spoilerImage); $(this).parent.css({     position: 'relative',      top: 0,      left: 0    }); $spoilerImage.css({     position: 'absolute',      left: spWidth,      top: 0    }); $(this).attr({     onMouseOver: "$(this).attr('src','"+hiddensrc+"'); $(this).next.css('display','none');",      onMouseOut: "$(this).attr('src','"+spoilersrc+"'); $(this).next.css('display','');"    }); }); });