Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Released into the public domain <http://en.wikipedia.org/wiki/Template:PD-self>
/*global jQuery, mediaWiki*/

( function ( mw, $ ) {
	var ns, nsPrefixMap, shortcut;
	
	ns = mw.config.get( 'wgNamespaceNumber' );
	if ( ns >= 0 && mw.config.get( 'wgAction' ) === 'view' ) {
		nsPrefixMap = {
			0: '',
			4: 'WP:',
			5: 'WT:'
		};

		shortcut = (
			ns in nsPrefixMap
				? nsPrefixMap[ns]
				: mw.config.get( 'wgFormattedNamespaces' )[ns] + ':'
		) + mw.config.get( 'wgTitle' );

		mw.loader.using( 'mediawiki.api' ).then( function () {
			return ( new mw.Api() ).get( {
				action: 'query',
				revids: mw.config.get( 'wgCurRevisionId' ),
				prop: 'revisions',
				maxage: 86400
			} );
		} ).then( function ( data ) {
			var isoDate;
			
			try {
				isoDate = data.query.pages[mw.config.get( 'wgArticleId' )].revisions[0].timestamp;
			} catch ( e ) {
				return;
			}

			document.title = shortcut + ' - ' + isoDate.replace( /T.*$/, '' ) + ' Wikipedia,' + mw.config.get( 'wgContentLanguage' ).toUpperCase();
		} );

	} else {
		document.title = document.title.replace( / \- [^\-]*$/, ' - Wikipedia,' + mw.config.get( 'wgContentLanguage' ).toUpperCase() );
	}
}( mediaWiki, jQuery ) );