Jump to content

User:Mattflaschen/common.js

From Wikipedia, the free encyclopedia
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.
( function ( mw, $ ) {
	var cfg = mw.config.get( ['wgAction', 'wgCanonicalNamespace'] );
	
	// https://bugzilla.wikimedia.org/show_bug.cgi?id=52493
	// Probably over-complicated, but this way the text is guaranteed to match
    // Marked as fixed in Firefox Aurora, which should make it into Firefox 33
    // TODO: Remove then.
	function cleanupVisualEditorBetaLinks() {
		var $appendices = $( '.ve-tabmessage-appendix' );
		$appendices.each( function (i, appendix) {
			var $parent, textDescendants;
			
			$parent = $( appendix ).parent();
			textDescendants = $.map( $parent.contents(), function ( node ) {
				return $( node ).text();
			} );
			$parent.text( textDescendants.join( ' ' ) );
		} );
	}
	
	mw.hook( 'wikipage.content' ).add( cleanupVisualEditorBetaLinks );
	// [[File:User:He7d3r/Tools/DebugModeToggle.js]] (workaround for [[bugzilla:33355]])
	mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:He7d3r/Tools/DebugModeToggle.js&action=raw&ctype=text/javascript' );
	
	mw.loader.load( '//www.wikidata.org/w/index.php?title=User:Yair rand/WikidataInfo.js&action=raw&ctype=text/javascript' );
	
	// Sister project card
	// mw.loader.load( '//www.wikidata.org/w/index.php?title=User:Tpt/interproject.js&action=raw&ctype=text/javascript' );
	
	if ( ( cfg.wgCanonicalNamespace === 'Template' || cfg.wgCanonicalNamespace === 'User' ) && $.inArray( cfg.wgAction, [ 'edit', 'submit' ] ) !== -1 ) {
		mw.loader.load( '//fr.wikipedia.org/w/index.php?title=Utilisateur:Ltrlg/scripts/TemplateDataEditor.js&action=raw&ctype=text/javascript' );
	}
	
	// [[MediaWiki:Wdsearch.js]]
	// http://magnusmanske.de/wordpress/?p=108
	importScript('MediaWiki:Wdsearch.js');
	
	// Navigation popups settings
	popupAdminLinks=true;
	popupActionsMenu=false;
	popupHistoryLimit=1000;
	popupFixRedirs=true; 
	popupOnEditSelection=false;
	popupDiffDatePrinter='toUTCString';

	importScript( 'User:Mvolz/veCiteFromURLLoader.js' );
}( mediaWiki, jQuery ) );