MediaWiki diskusija:Common.js

Seiteninhalte werden in anderen Sprachen nicht unterstützt.
Z Wikipedije

Give search results even when page doesn't exist[žrědłowy tekst wobźěłaś]

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");
}
--[[m:User:Nemo_bis|Nemo]] ~~~~~ ([[w:en:MediaWiki talk:Wdsearch.js|comments, translations and last instructions]])
</div>
<!-- EdwardsBot 0661 -->

Announced JavaScript change for badges implementation[žrědłowy tekst wobźěłaś]

Hi! I want to let you know that in near future badges will be deployed on Wikidata and the Wikipedias. They help us with displaying the good and featured article icons next to the sitelinks and will replace the javascript hack which is used at the moment together with the Link GA and Link FA templates. To avoid an overlap where the current system and the new feature conflict, I will add a minor fix to your Common.js which adds the class names to the interwiki links. This is part of my task as a global edit interface editor for the Wikidata team. Thanks, Bene* (diskusija) 11. awgusta 2014, 21:16 (CEST)[wótegroniś]

ContentTranslation[žrědłowy tekst wobźěłaś]

Hi,

We, the Language Engineering team, are trying to test the ContentTranslation beta feature here, and it's failing because of an issue in this script. The '#content' element doesn't exist on Special:ContentTranslation, so it's irrelevant.

We'd be very thankful if you could please change the collapsibleDivs function (line 288) to the following code:

function collapsibleDivs(){
	var navIdx = 0, colNavs = [], i, NavFrame
	var content = document.getElementById('content')

	if ( !content ) {
		return
	}

	var divs = content.getElementsByTagName('div')

	for (i=0; NavFrame = divs[i]; i++) {
		if (!hasClass(NavFrame, 'NavFrame')) continue
		NavFrame.id = 'NavFrame' + navIdx
		var a = document.createElement('a')
		a.className = 'NavToggle'
		a.id = 'NavToggle' + navIdx
		a.href = 'javascript:collapseDiv(' + navIdx + ');'
		a.appendChild(document.createTextNode(NavigationBarHide))
		// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
		for (var j=0; j < NavFrame.childNodes.length; j++)
			if (hasClass(NavFrame.childNodes[j], 'NavHead'))
			NavFrame.childNodes[j].appendChild(a)
		colNavs[navIdx++] = NavFrame
	}

	for (i=0; i < navIdx; i++)
	if ((navIdx > NavigationBarShowDefault && !hasClass(colNavs[i], 'expanded')) || hasClass(colNavs[i], 'collapsed'))
		collapseDiv(i)
}

(Tagging relevant admins: Tlustulimu, Derbeth.)

Thank you very much! --Amir E. Aharoni (diskusija) 18. junija 2015, 18:36 (CEST)[wótegroniś]

@Amire80: jo se wótbył Mi ĵus korektis tiun fuŝon. / Rowno som tu zmólku pópšawił. :-) --Tlustulimu (diskusija) 18. junija 2015, 19:20 (CEST)[wótegroniś]

Prepare for T314318[žrědłowy tekst wobźěłaś]

Please make changes like the following,

https://ca.wikipedia.org/wiki/Especial:ComparePages?page1=MediaWiki%3ACommon.js&rev1=24309161&page2=Usuari%3AArlolra%2Fsandbox%2FMediaWiki%3ACommon.js&rev2=31054319&action=&unhide=

https://ca.wikipedia.org/wiki/Especial:ComparePages?page1=MediaWiki%3ACommon.js&rev1=31055727&page2=Usuari%3AArlolra%2Fsandbox%2FMediaWiki%3ACommon.js&rev2=31058458&action=&unhide=

For more information, see mw:Parsoid/Parser_Unification/Media_structure/FAQ

Thanks, Arlolra (diskusija) 31. januara 2023, 20:49 (CET)[wótegroniś]

Done in Special:Diff/144047 ABreault (WMF) (diskusija) 23. februara 2023, 23:37 (CET)[wótegroniś]