MediaWiki:Common.js

From BASAbaliWiki
Revision as of 00:05, 31 January 2020 by Alexey123 (talk | contribs)

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */

$(function(){
	var puzzleAnswersToggle = $('.puzzle-page-answers-switch');
	if(puzzleAnswersToggle.length) {
		puzzleAnswersToggle.click(function(){
			$('.puzzle-page-answers').toggleClass('answers-hidden');
			$(this).hide();
		});
	}
	
	var puzzleAnswersList = $('.puzzle-page-answers');
	if(puzzleAnswersList.find('.answers-list img').length) {
		puzzleAnswersList.find('.answers-list a').click(function(e){
			if(puzzleAnswersList.hasClass('answers-hidden')) {
				e.preventDefault();
				return false;
			}
		});
	}
	
	var wikithonList = $('.wikithon-random-list');
	if( wikithonList.length ) {
		wikithonList.find('li > a').click(function() {
			$(this).attr('target', '_blank');
			$(this).parent().fadeOut(function() { $(this).remove(); });	
		});
	}
	
	var audios = $('.html5-audio-mini-player');
	if( audios.length ) {
		audios.click(function(e){
			$(this).find('audio').play();
		});
	}
	
});