MediaWiki:Common.js: Difference between revisions

The Two Worlds Wiki - Documenting Two Worlds since 2008.
Jump to navigation Jump to search
Mystery Dungeon Independent>Adkuate
No edit summary
m (16 versions importées)
(8 intermediate revisions by 2 users not shown)
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. */


//Countdown
/*Include in the wiki
MediaWiki:Countdown.js
Widget:Rescue Password Generator/script.js‎
*/
mw.loader.load( '/w/index.php?title=MediaWiki:Countdown.js&action=raw&ctype=text/javascript' );
mw.loader.load( '/w/index.php?title=Widget:Rescue_Password_Generator/script.js‎&action=raw&ctype=text/javascript' );


// Set the date we're counting down to Shiren 5's western release
/*Mass Move Pages Tool
var countDownDate = new Date("Dec 2, 2020 00:00:00").getTime();
mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Plastikspork/massmove.js&action=raw&ctype=text/javascript' ); //[[User:Plastikspork/massmove.js]]
 
mw.util.addPortletLink("p-tb", "//en.wikipedia.org/wiki/Special:Massmove", "Mass move", "p-massmove", "Mass move");
// Set the date we're counting down to Shiren 5's Japanese release
var countDownDateT = new Date("Dec 3, 2020 00:00:00").getTime();
 
// Update the count down every 1 second
var x = setInterval(function() {
 
  // Get today's date and time
  var now = new Date().getTime();
   
  // Find the distance between now and the count down date
  var distance = countDownDate - now;
 
  var distance = countDownDateT - now;
   
  // Time calculations for days, hours, minutes and seconds
  var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  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"
  document.getElementById("shiren5nspc_ja").innerHTML = days + "d " + hours + "h "
  + minutes + "m " + seconds + "s ";
   
  // If the count down is over, write "Available now!"  
  if (distance < 0) {
    clearInterval(x);
    document.getElementById("shiren5nspc_west").innerHTML = "Available now!";
  }
 
  if (distance < 0) {
    clearInterval(x);
    document.getElementById("shiren5nspc_ja").innerHTML = "Available now!";
  }
}, 1000);

Revision as of 04:12, February 18, 2021

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

/*Include in the wiki
MediaWiki:Countdown.js
Widget:Rescue Password Generator/script.js‎
*/
mw.loader.load( '/w/index.php?title=MediaWiki:Countdown.js&action=raw&ctype=text/javascript' );
mw.loader.load( '/w/index.php?title=Widget:Rescue_Password_Generator/script.js‎&action=raw&ctype=text/javascript' );

/*Mass Move Pages Tool
mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Plastikspork/massmove.js&action=raw&ctype=text/javascript' ); //[[User:Plastikspork/massmove.js]]
mw.util.addPortletLink("p-tb", "//en.wikipedia.org/wiki/Special:Massmove", "Mass move", "p-massmove", "Mass move");