MediaWiki-diskussion:Common.js

Sidans innehåll stöds inte på andra språk.
Nytt ämne
Från Wikivoyage, den fria resehandboken.
Senaste kommentaren: för 7 år sedan av Riggwelter i ämnet Not existing script

Give search results even when page doesn't exist[Redigera]

Screenshot of the Earth test search, with this script adding links to Wikidata, Reasonator, Commons, and Wikipedia.

Hello, I propose to enable the tool created by Magnus Manske (creator of MediaWiki) to provide results from other languages and Commons (via Wikidata) when a page doesn't exist here: links are added to Special:Search and noarticletext. This helps to encourage translation and to make readers use your wiki more, because they can be sure to find something even if it's not local (rather than searching directly on the biggest wiki). The Italian and Polish Wikipedias, among others already enabled it by default.
Examples: [1] [2] [3]. More information: Magnus blog.
How to: just add the following line at the end of Common.js.

// Results from Wikidata
// [[File:Wdsearch_script_screenshot.png]]
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' ||  ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgCanonicalSpecialPageName' ) === false ) ) {
	importScriptURI("//en.wikipedia.org/w/index.php?title=MediaWiki:Wdsearch.js&action=raw&ctype=text/javascript");
}

--Nemo 21 mars 2015 kl. 18.29 (CET) (comments, translations and last instructions)Svara

Patch for Pagebanner[Redigera]

Please add the following lines:

$(".topbanner").closest(".mw-body").children(".firstHeading").hide();
$("#toc ul:first").css("padding-left", "2em");

--Andyrom75 (discussioni) 21 mars 2015 kl. 18.29 (CET)Svara

Done! Dan Koehl (diskussion) 21 mars 2015 kl. 18.54 (CET)Svara

Old code[Redigera]

Dan Koehl. I'm quite confident that this code could be removed.

//Test of Migration widgets
importScript('MediaWiki:Common.js/RenameWizard.js');

// Add old-wiki link
function addOldLink() {
	if ( $('#oldwikivoyagelink').length ) {
		var link = $( '<a></a>' );
		link.attr( 'href', 'http://sv.wikivoyage-old.org/wiki/' + wgPageName );
		link.text( ' - Se denna sida på vår gamla webbplats' );
		$('#oldwikivoyagelink').append( link );
	}
}
 
$( document ).ready( addOldLink() );

--Andyrom75 (discussioni) 22 mars 2015 kl. 02.35 (CET)Svara

Dan Koehl you can remove the above code, and also the following line
$("#toc ul:first").css("padding-left", "2em");
because I've integrated this line in it:MediaWiki:Pagebanner.css already loaded from MediaWiki:Common.css. --Andyrom75 (discussioni) 26 mars 2015 kl. 20.10 (CET)Svara
Utfört Utfört Dan Koehl (diskussion) 26 mars 2015 kl. 21.28 (CET)Svara

Not existing script[Redigera]

Dan, please remove the following lines:

// Moving of article states in the upper right corner
importScript( 'MediaWiki:MoveArticleStates.js' );

because the requested script has never existed in sv:voy, so that lines has not effect but code noise. PS I've deleted this script in it:voy on 2013. --Andyrom75 (discussioni) 4 september 2016 kl. 10.38 (CEST)Svara

Done. Riggwelter (diskussion) 8 september 2016 kl. 23.43 (CEST)Svara