User:Dantman/vector.js

( function ( $, mw ) {	if ( !window.history || !window.history.replaceState ) {		return;	}

mw.loader.using( 'jquery.mwExtension', function {		var articlePathRE, pathQuery, path;

articlePathRE = new RegExp(			'^' +			$.escapeRE( mw.config.get( 'wgArticlePath' ) ).replace( '\\$1', mw.config.get( 'wgArticlePath' ).indexOf( '?' ) >= -1 ? '([^?]*)' : '([^&]*)' ) +			'$'		);		pathQuery = location.pathname + ( location.search ? '?' + location.search : '' ); // Only execute on paths matching the article path (don't squash query arguments) if ( articlePathRE.test( pathQuery ) ) { path = mw.util.wikiGetlink( mw.config.get( 'wgPageName' ) ); if ( window.location.hash ) { path += '#' + window.location.hash; }			window.history.replaceState( {}, document.title, path ); }	} );

}( jQuery, mediaWiki ) );