MediaWiki:Common.js: Difference between revisions

MDFW - The Mystery Dungeon Tree of Information.
Jump to navigation Jump to search
No edit summary
mNo edit summary
Tag: Manual revert
 
(116 intermediate revisions by 3 users not shown)
Line 1: Line 1:
/* globals mw, $ */
/* jshint esversion: 10 */
/* 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. */


//Countdown
/* Include in the wiki the following JavaScript pages */
 
//importScript('MediaWiki:Sandbox.js');
// Set the date we're counting down to Shiren 5's western release
//importScript('MediaWiki:Countdown.js');
var countDownDate = new Date("Dec 2, 2020 00:00:00").getTime();


// Set the date we're counting down to Shiren 5's Japanese release
/* Accessibility (a11y) */
var countDownDateT = new Date("Dec 3, 2020 00:00:00").getTime();
$('a.mw-wiki-logo').attr('title', 'Mystery Dungeon Franchise Wiki');


// Update the count down every 1 second
$('#main-mobile > a').removeAttr('title');
var x = setInterval(function() {
$('#talk-mobile > a').removeAttr('title');
$('#ca-tools > a').removeAttr('title');
$('#pt-logout > a').removeAttr('title');


  // Get today's date and time
$('#n- > a')
  var now = new Date().getTime();
.attr('href', 'https://mysterydungeonwiki.com/wiki/Mystery_Dungeon_Franchise_Wiki')
   
.attr('aria-label', 'bar');
  // Find the distance between now and the count down date
  var distance = countDownDate - now;


  var distance = countDownDateT - now;
if ($(location).attr("href") === 'https://mysterydungeonwiki.com/wiki/Mystery_Dungeon_Franchise_Wiki') {
   
$('#n-mainpage-description').remove();
  // Time calculations for days, hours, minutes and seconds
}
  var days = Math.floor(distance / (1000 * 60 * 60 * 24));
/* end a11y */
  var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  var seconds = Math.floor((distance % (1000 * 60)) / 1000);
   
  // Output the result in an element with id="shiren5nspc_west"
  document.getElementById("shiren5nspc_west").innerHTML = days + "d " + hours + "h "
  + minutes + "m " + seconds + "s ";


  // Output the result in an element with id="shiren5nspc_ja"
// https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization
  document.getElementById("shiren5nspc_ja").innerHTML = days + "d " + hours + "h "
/* Check if we're editing a page. */
  + minutes + "m " + seconds + "s ";
if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1) {
   
// Add a hook handler.
  // If the count down is over, write "Available now!"
mw.hook('wikiEditor.toolbarReady').add(function ($textarea) {
  if (distance < 0) {
// Configure a new toolbar entry on the given $textarea jQuery object.
    clearInterval(x);
$textarea.wikiEditor('addToToolbar', {
    document.getElementById("shiren5nspc_west").innerHTML = "Available now!";
section: 'characters',
  }
pages: {
consolelogos: {
layout: 'characters',
label: 'Common Formatting',
characters: [
'[[File:Wiki.png|alt=Alt text.|thumb|Description.]]',
'{| class="wikitable"\n|- \n! colspan="2" |Name\n! rowspan="2" |Description\n|- \n! English\n! Japanese\n|-\n|\n|\n|\n|}'
]
}
}
});
});
}


  if (distance < 0) {
/*
    clearInterval(x);
var notice = document.getElementById("writereply");
    document.getElementById("shiren5nspc_ja").innerHTML = "Available now!";
notice.append("Forum posts can be made anonymously, however the associated IP address may be shown in some parts of the website.");
  }
*/
}, 1000);

Latest revision as of 22:17, 4 June 2025

/* globals mw, $ */
/* jshint esversion: 10 */

/* Any JavaScript here will be loaded for all users on every page load. */

/* Include in the wiki the following JavaScript pages */
//importScript('MediaWiki:Sandbox.js');
//importScript('MediaWiki:Countdown.js');

/* Accessibility (a11y) */
$('a.mw-wiki-logo').attr('title', 'Mystery Dungeon Franchise Wiki');

$('#main-mobile > a').removeAttr('title');
$('#talk-mobile > a').removeAttr('title');
$('#ca-tools > a').removeAttr('title');
$('#pt-logout > a').removeAttr('title');

$('#n- > a')
	.attr('href', 'https://mysterydungeonwiki.com/wiki/Mystery_Dungeon_Franchise_Wiki')
	.attr('aria-label', 'bar');

if ($(location).attr("href") === 'https://mysterydungeonwiki.com/wiki/Mystery_Dungeon_Franchise_Wiki') {
	$('#n-mainpage-description').remove();
}
/* end a11y */

// https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization
/* Check if we're editing a page. */
if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1) {
	// Add a hook handler.
	mw.hook('wikiEditor.toolbarReady').add(function ($textarea) {
		// Configure a new toolbar entry on the given $textarea jQuery object.
		$textarea.wikiEditor('addToToolbar', {
			section: 'characters',
			pages: {
				consolelogos: {
					layout: 'characters',
					label: 'Common Formatting',
					characters: [
						'[[File:Wiki.png|alt=Alt text.|thumb|Description.]]',
						'{| class="wikitable"\n|- \n! colspan="2" |Name\n! rowspan="2" |Description\n|- \n! English\n! Japanese\n|-\n|\n|\n|\n|}'
					]
				}
			}
		});
	});
}

/*
var notice = document.getElementById("writereply");
notice.append("Forum posts can be made anonymously, however the associated IP address may be shown in some parts of the website.");
*/