Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
m |
m |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
− | + | ||
− | jQuery(document).ready(function($) { | + | jQuery(document).ready(function ($) { |
− | $('.spoiler-body').hide(); | + | $('.spoiler-body').hide(); |
− | $('.spoiler-title').click(function(){ | + | $('.spoiler-title').click(function () { |
− | + | $(this).toggleClass('opened').toggleClass('closed').next().slideToggle(); | |
− | + | if ($(this).hasClass('opened')) { | |
− | + | $(this).html(' [hide] '); | |
− | + | } else { | |
− | + | $(this).html(' [show] '); | |
− | + | } | |
− | } | + | }); |
}); | }); | ||
− | |||
− |
Revision as of 18:46, 6 November 2013
/* Any JavaScript here will be loaded for all users on every page load. */ jQuery(document).ready(function ($) { $('.spoiler-body').hide(); $('.spoiler-title').click(function () { $(this).toggleClass('opened').toggleClass('closed').next().slideToggle(); if ($(this).hasClass('opened')) { $(this).html(' [hide] '); } else { $(this).html(' [show] '); } }); });