MediaWiki-diskusjon:Common.js

Siste kommentar: for 1 år sidan av ABreault (WMF) i emnet Prepare for T314318

Etter Bep sitt råd fjernar eg innhaldet på denne sida, eg flyttar det rett og slett over hit. Vi har same tekst på Monobook.js. Trondtr 22:23, 26 august 2007 (CEST).

 /* Denne sida inneheld javaskript som verker for alle brukarar på alle sider. */

// ============================================================
// BEGIN LinkFA
// ============================================================
function LinkFA() 
{
    var a;
    // iterate over all <span>-elements
    for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
        // if found a FA span
        if(a.className == "FA") {
            // iterate over all <li>-elements
            var b;
            for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
                // if found a FA link
                if(b.className == "interwiki-" + a.id) {
                    b.style.padding = "0 0 0 16px";
                    b.style.backgroundImage = "url('http://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Cscr-featured.png/14px-Cscr-featured.png')";
                    b.style.backgroundRepeat = "no-repeat";
                    b.title = "Tilsvarende artikkel er utmerket på dette språket";
                    b.className += " FA";
                }
            }
        }
    }
}
 
aOnloadFunctions[aOnloadFunctions.length] = LinkFA;
// END LinkFA
// ============================================================


Det var følgjande som stod på sida då Bep gav beskjed om at det var feil:
 function LinkFA() 
 {
     if ( document.getElementById( "p-lang" ) ) {
         var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
 
         for ( var i = 0; i < InterwikiLinks.length; i++ ) {
             if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
                 InterwikiLinks[i].className += " FA"
                 InterwikiLinks[i].title = "This is a featured article in another language.";
             }
         }
     }
 }
 
 addOnloadHook( LinkFA );
--Frokor 22:57, 26 august 2007 (CEST)

Engelsk endre

/* by Marc Mongenet, 2006, fr.wikipedia */

function forcePreview() {

 if (wgUserName != null || wgAction != "edit") return;
 saveButton = document.getElementById("wpSave");
 if (!saveButton) return;
 saveButton.disabled = true;
 saveButton.value = "Save page (use preview first)";
 saveButton.style.fontWeight = "normal";
 document.getElementById("wpPreview").style.fontWeight = "bold";

} addOnloadHook(forcePreview);

/* Ende von forcePreview</syntaxhighlight>

er ikkje omset, Save page (use preview first) bør endras. Røed (nb) 00:22, 4 april 2008 (CEST)

Det var eg som la inn dette skriptet, men ettersom det berre gjeld anonyme brukarar treng det strengt tatt ikkje liggje her på common, ettersom det berre gjeld anonyme brukarar (som nyttar monobook). Det kan nok flyttast dit. Anders 09:01, 4 april 2008 (CEST)

update search external bar endre

I have a temporary access to solve the search bar external after an mediawiki update http://meta.wikimedia.org/wiki/Steward_requests/Permissions/Approved_temporary#temporary_global_.22editinterface.22 Pmartin 1. april 2009 kl. 21:19 (CEST)Svar

Give search results even when page doesn't exist endre

 
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 endre

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* (diskusjon) 18. august 2014 kl. 22:29 (CEST)Svar

Tabellsortering endre

Som foreslått på Wikipedia:Samfunnshuset [4]. Sortering på «aa» er tatt ut for å unngå problemer med sortering av navn ala «Aachen». En test-side er tilgjengelig på Brukar:Jeblad/sortering. — Jeblad 26. nov. 2017 kl. 07:57 (CET)

Forslag til collation sequence 
/**
 * Collation sequence for Norwegian.
 * Note that æ, ø, and å are reordered.
 * For jquery.tablesorter.js
 */
 mw.config.set( 'tableSorterCollation', {
 	'Æ'  : 'Å',
 	'Ø'  : 'Æ',
 	'Å'  : 'Ø',
 	'Ä'  : 'Å',
 	'Ö'  : 'Æ',
 	'Ü'  : 'Y',
 	'Þ'  : 'Th',
 	'æ'  : 'å',
 	'ø'  : 'æ',
 	'å'  : 'ø',
 	'ä'  : 'å',
 	'ö'  : 'æ',
 	'ü'  : 'y',
 	'þ'  : 'th'
} );

Prepare for T314318 endre

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 (diskusjon) 31. januar 2023 kl. 21:35 (CET)Svar

I have made the changes, thanks for the notification. The second edit gave a warning about very complex nesting, however, which does make the script hard to understand. Hopefully the output itself will work better. Ranveig (diskusjon) 1. februar 2023 kl. 11:42 (CET)Svar
Thanks! Just missed the variable declaration added in Special:Diff/3463270 ABreault (WMF) (diskusjon) 23. februar 2023 kl. 23:05 (CET)Svar
Tilbake til siden «Common.js».