User:Robyn Grayson/common.js

if ($('.hidden').length) { switch (wgCanonicalNamespace) { case 'User': case 'User_talk': $('.UserProfileActionButton .wikia-menu-button').before(               'Show Spoilers '            ); break; }   $('.wikinav2 .WikiaPageHeader').css('padding-right', '0'); $('#WikiaPageHeader .comments').after(       'Show Spoilers '    ); } $('#toggle-hidden').click(function {   if ($('.hidden.on, .hidden.off').length) {        $('.hidden').attr('class', 'hidden').removeAttr('title');        $('.wikia-button#toggle-hidden').attr('title', 'Hide all hiddens on the page').html('Hide Spoilers');    } else {        $('.hidden').attr('class', 'hidden on').attr('title', 'click to show the hiddens');        $('.wikia-button#toggle-hidden').attr('title', 'Show all hiddens on page').html('Show Spoilers');    } }); var hiddenConfig = function(i, el) { var $el = $(el); $el.attr('title', 'click to show the hiddens'); $el.click(function {       var $this = $(this);        if ($this.hasClass('on'))            $this.attr('class', 'hidden off').removeAttr('title');        else            $this.attr('class', 'hidden on').attr('title', 'click to show the hiddens');    }); }; $('.hidden.on').each(hiddenConfig);