MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| 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. */ | ||
$( | $.when( mw.loader.using( 'mediawiki.util' ), $.ready ).then( function () { | ||
var | var targetDate = new Date(2026, 2, 22); | ||
var $ | var today = new Date(); | ||
.attr('id', 'mw-custom-sidebar- | var timeDifference = today.getTime() - targetDate.getTime(); | ||
.text(' | var daysSince = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); | ||
$('#p-Tools ul').append($ | var $counterItem = $( '<li>' ) | ||
}); | .attr( 'id', 'mw-custom-sidebar-counter' ) | ||
.text( 'Days since milestone: ' + daysSince ); | |||
// Replace '#p-navigation ul' with your corrected sidebar ID if different | |||
$( '#p-Tools ul' ).append( $counterItem ); | |||
} ); | |||
Revision as of 19:15, 19 June 2026
/* Any JavaScript here will be loaded for all users on every page load. */
$.when( mw.loader.using( 'mediawiki.util' ), $.ready ).then( function () {
var targetDate = new Date(2026, 2, 22);
var today = new Date();
var timeDifference = today.getTime() - targetDate.getTime();
var daysSince = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
var $counterItem = $( '<li>' )
.attr( 'id', 'mw-custom-sidebar-counter' )
.text( 'Days since milestone: ' + daysSince );
// Replace '#p-navigation ul' with your corrected sidebar ID if different
$( '#p-Tools ul' ).append( $counterItem );
} );