Järjestelmäviesti:Common.js

Wikipediasta
Siirry navigaatioon Siirry hakuun

Huomautus: Selaimen välimuisti pitää tyhjentää asetusten tallentamisen jälkeen, jotta muutokset tulisivat voimaan.

  • Firefox ja Safari: Napsauta Shift-näppäin pohjassa Päivitä, tai paina Ctrl-F5 tai Ctrl-R (⌘-R Macilla)
  • Google Chrome: Paina Ctrl-Shift-R (⌘-Shift-R Macilla)
  • Internet Explorer ja Edge: Napsauta Ctrl-näppäin pohjassa Päivitä tai paina Ctrl-F5
  • Opera: Paina Ctrl-F5.
 /* '''Suomenkielisen Wikipedian JavaScript'''
  *
  * Tämä sivu on suojattu [[Wikipedia:Käyttöliittymän ylläpitäjät|vain käyttöliittymän ylläpitäjien]] muokattavaksi. Mikäli haluat
  * muutoksia JavaScript-koodiin, voit tehdä oman [[Toiminnot:Mypage/common.js|common.js]]-tiedoston tai
  * esittää pyynnön jollekin tämän koodin ylläpitäjistä.
  *
  * Ylläpitäjät:
  * [[Käyttäjä:Zache|Zache]] ([[Keskustelu käyttäjästä:Zache|keskustelu]])
   */

 if (mw.config.get('wgAction') == "edit" || mw.config.get('wgAction') == "submit") { // skriptit muokkaussivuille
    mw.loader.load("//fi.wikipedia.org/w/index.php?title=Järjestelmäviesti:Edittools.js&action=raw&ctype=text/javascript")
 }

 function initializebuttons() {
   if (window.addEventListener) window.addEventListener("load",buttons,false);
   else if (window.attachEvent) window.attachEvent("onload",buttons);
 }

/** Collapsible tables *********************************************************
 *
 *  Description: Allows tables to be collapsed, showing only the header. See
 *               [[Wikipedia:NavFrame]].
 *  Maintainers: [[User:R. Koot]]
*  Suomenkielisen version muokkauksesta vastaa [[Käyttäjä:Zache]] 
*/

var autoCollapse = 2;
var collapseCaption = "Piilota";
var expandCaption = "Näytä";

/* Test if an element has a certain class **************************************
 *
 * Description: Uses regular expressions and caching for better performance.
 * Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
 */
 var hasClass = (function () {
    var reCache = {};
    return function (element, className) {
        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
    };
})();

function collapseTable( tableIndex )
{
    var Button = document.getElementById( "collapseButton" + tableIndex );
    var Table = document.getElementById( "collapsibleTable" + tableIndex );

    if ( !Table || !Button ) {
        return false;
    }

    var Rows = Table.rows;

    if ( Button.firstChild.data == collapseCaption ) {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = "none";
        }
        Button.firstChild.data = expandCaption;
    } else {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = collapseCaption;
    }
}

function createCollapseButtons() {
    var tableIndex = 0;
    var NavigationBoxes = {};
    var Tables = document.getElementsByTagName( 'table' );
    var i;
 
    function handleButtonLink( index, e ) {
        window.collapseTable( index );
        e.preventDefault();
    }
 
    for ( i = 0; i < Tables.length; i++ ) {
        if ( $( Tables[i] ).hasClass( 'collapsible' ) ) {
 
            /* only add button and increment count if there is a header row to work with */
            var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0];
            if ( !HeaderRow ) continue;
            var Header = HeaderRow.getElementsByTagName( 'th' )[0];
            if ( !Header ) continue;
 
            NavigationBoxes[ tableIndex ] = Tables[i];
            Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex );
 
            var Button     = document.createElement( 'span' );
            var ButtonLink = document.createElement( 'a' );
            var ButtonText = document.createTextNode( collapseCaption );
 
            Button.className = 'collapseButton';  /* Styles are declared in Common.css */
 
            ButtonLink.style.color = Header.style.color;
            ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
            ButtonLink.setAttribute( 'href', '#' );
            $( ButtonLink ).on( 'click', $.proxy( handleButtonLink, ButtonLink, tableIndex ) );
            ButtonLink.appendChild( ButtonText );
 
            Button.appendChild( document.createTextNode( '[' ) );
            Button.appendChild( ButtonLink );
            Button.appendChild( document.createTextNode( ']' ) );
 
            Header.insertBefore( Button, Header.firstChild );
            tableIndex++;
        }
    }
 
    for ( i = 0;  i < tableIndex; i++ ) {
        if ( $( NavigationBoxes[i] ).hasClass( 'collapsed' ) || ( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) ) ) {
            window.collapseTable( i );
        } 
        else if ( $( NavigationBoxes[i] ).hasClass ( 'innercollapse' ) ) {
            var element = NavigationBoxes[i];
            while ((element = element.parentNode)) {
                if ( $( element ).hasClass( 'outercollapse' ) ) {
                    window.collapseTable ( i );
                    break;
                }
            }
        }
    }
}
 
mw.hook( 'wikipage.content' ).add( createCollapseButtons );

 /** "Technical restrictions" title fix *****************************************
  *
  *  Description:
  *  Maintainers: [[:en:User:Interiot]], [[:en:User:Mets501]]
  *  Suomenkielisen version muokkauksesta vastaa [[Käyttäjä:Agony]]
  */
 
 // For pages that have something like Template:Lowercase, replace the title, but only if it is
 // cut-and-pasteable as a valid wikilink.
 // (for instance [[iPod]]'s title is updated.  <nowiki>But [[C#]] is not an equivalent wikilink, 
 // so [[C Sharp]] doesn't have its main title changed)</nowiki>
 //
 // The function looks for a banner like this: <nowiki>
 // <div id="RealTitleBanner">    <!-- div that gets hidden -->
 //   <span id="RealTitle">title</span>
 // </div>
 // </nowiki>An element with id=DisableRealTitle disables the function.
 var disableRealTitle = 0;		// users can disable this by making this true from their monobook.js
 if ((mw.config.get('wgIsArticle'))&&(mw.config.get('wgNamespaceNumber') == 0)) {			// don't display the RealTitle when editing, since it is apparently inconsistent (doesn't show when editing sections, doesn't show when not previewing)
     $(function() {
 	try {
 		var realTitleBanner = document.getElementById("RealTitleBanner");
 		if (realTitleBanner && !document.getElementById("DisableRealTitle") && !disableRealTitle) {
 			var realTitle = document.getElementById("RealTitle");
 			if (realTitle) {
 				var realTitleHTML = realTitle.innerHTML;
 				realTitleText = pickUpText(realTitle);
 
 				var isPasteable = 0;
 				//var containsHTML = /</.test(realTitleHTML);	// contains ANY HTML
 				var containsTooMuchHTML = /</.test( realTitleHTML.replace(/<\/?(sub|sup|small|big)>/gi, "") ); // contains HTML that will be ignored when cut-n-pasted as a wikilink
 				// calculate whether the title is pasteable
 				var verifyTitle = realTitleText.replace(/^ +/, "");		// trim left spaces
 				verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length);	// uppercase first character
 
 				// if the namespace prefix is there, remove it on our verification copy.  If it isn't there, add it to the original realValue copy.
 				if (mw.config.get('wgNamespaceNumber') != 0) {
 					if (mw.config.get('wgCanonicalNamespace') == verifyTitle.substr(0, mw.config.get('wgCanonicalNamespace').length).replace(/ /g, "_") && verifyTitle.charAt(mw.config.get('wgCanonicalNamespace').length) == ":") {
 						verifyTitle = verifyTitle.substr(mw.config.get('wgCanonicalNamespace').length + 1);
 					} else {
 						realTitleText = mw.config.get('wgCanonicalNamespace').replace(/_/g, " ") + ":" + realTitleText;
 						realTitleHTML = mw.config.get('wgCanonicalNamespace').replace(/_/g, " ") + ":" + realTitleHTML;
 					}
 				}
 
 				// verify whether mw.config.get('wgTitle') matches
 				verifyTitle = verifyTitle.replace(/^ +/, "").replace(/ +$/, "");		// trim left and right spaces
 				verifyTitle = verifyTitle.replace(/_/g, " ");		// underscores to spaces
 				verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length);	// uppercase first character
 				isPasteable = (verifyTitle == mw.config.get('wgTitle'));
 
 				var h1 = document.getElementsByTagName("h1")[0];
 				if (h1 && isPasteable) {
 					h1.innerHTML = containsTooMuchHTML ? realTitleText : realTitleHTML;
 					if (!containsTooMuchHTML)
 						realTitleBanner.style.display = "none";
 				}
 				document.title = realTitleText + " - Wikipedia";
 			}
 		}
 	} catch (e) {
 		/* Something went wrong. */
 	}
     });
 }
 
 
 // similar to innerHTML, but only returns the text portions of the insides, excludes HTML
 function pickUpText(aParentElement) {
   var str = "";
 
   function pickUpTextInternal(aElement) {
     var child = aElement.firstChild;
     while (child) {
       if (child.nodeType == 1)		// ELEMENT_NODE 
         pickUpTextInternal(child);
       else if (child.nodeType == 3)	// TEXT_NODE
         str += child.nodeValue;
 
       child = child.nextSibling;
     }
   }
 
   pickUpTextInternal(aParentElement);
 
   return str;
 }

 function toggleTemplateTable() {
 
   document.getElementById('fiwiki-templatetable').style.display=(document.getElementById('fiwiki-templatetable').style.display == 'none') ? 'block' : 'none';
 
   document.getElementById('fiwiki-templatetoggle').innerHTML=(document.getElementById('fiwiki-templatetable').style.display == 'none') ? '&#9660; Mallineet' : '&#9650; Piilota';
 
 }

 // ============================================================
 // BEGIN Dynamic Navigation Bars
 
 // set up the words in your language
 var NavigationBarHide = 'Piilota';
 var NavigationBarShow = 'Näytä';
 
 // set up max count of Navigation Bars on page,
 // if there are more, all will be hidden
 // NavigationBarShowDefault = 0; // all bars will be hidden
 // NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
 var NavigationBarShowDefault = 0;
 
 
 // shows and hides content and picture (if available) of navigation bars
 // Parameters:
 //     indexNavigationBar: the index of navigation bar to be toggled
 function toggleNavigationBar(indexNavigationBar)
 {
   var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
   var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
 
   if (!NavFrame || !NavToggle) {
     return false;
   }
 
   // if shown now
   if (NavToggle.firstChild.data == NavigationBarHide) {
     for (
       var NavChild = NavFrame.firstChild;
       NavChild != null;
       NavChild = NavChild.nextSibling
     ) {
       if (NavChild.className == 'NavPic') {
       NavChild.style.display = 'none';
     }
     if (NavChild.className == 'NavContent') {
       NavChild.style.display = 'none';
     }
     if (NavChild.className == 'NavToggle') {
       NavChild.firstChild.data = NavigationBarShow;
     }
   }
 
   // if hidden now
   } else if (NavToggle.firstChild.data == NavigationBarShow) {
     for (
       var NavChild = NavFrame.firstChild;
       NavChild != null;
       NavChild = NavChild.nextSibling
     ) {
       if (NavChild.className == 'NavPic') {
         NavChild.style.display = 'block';
       }
       if (NavChild.className == 'NavContent') {
         NavChild.style.display = 'block';
       }
       if (NavChild.className == 'NavToggle') {
         NavChild.firstChild.data = NavigationBarHide;
       }
     }
   }
 }
 
// adds show/hide-button to navigation bars
 function createNavigationBarToggleButton()
 {
   var indexNavigationBar = 0;
   // iterate over all < div >-elements
   var divs= document.getElementsByTagName("div");
   for(
     var i=0; 
     i<divs.length;
     i++
   ) {
     NavFrame = divs[i]; 
     // if found a navigation bar
     if (hasClass(NavFrame,"NavFrame")) {
 
       indexNavigationBar++;
       var NavToggle = document.createElement("a");
       NavToggle.className = 'NavToggle';
       NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
       NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
 
       var NavToggleText = document.createTextNode(NavigationBarHide);
       NavToggle.appendChild(NavToggleText);
 
       // add NavToggle-Button as first div-element 
       // in < div class="NavFrame" >
       NavFrame.insertBefore(
         NavToggle,
         NavFrame.firstChild
       );
       NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
       
       if (!hasClass(NavFrame,"Expand")) {
         toggleNavigationBar(indexNavigationBar);
       }
     }
   } 
 }

jQuery(document).ready(createNavigationBarToggleButton);

 
 // END Dynamic Navigation Bars
 // ============================================================


 function addLoadEvent(func) 
 {
   if (window.addEventListener) 
     window.addEventListener("load", func, false);
   else if (window.attachEvent) 
     window.attachEvent("onload", func);
 }

/** Interwiki links to featured articles ***************************************
 *
 *  Description: Highlights interwiki links to featured articles (or
 *               equivalents) by changing the bullet before the interwiki link
 *               into a star.
 *  Maintainers: User:R. Koot
 */

function LinkFA() {
    if ( document.getElementById( 'p-lang' ) ) {
        var InterwikiLinks = document.getElementById( 'p-lang' ).getElementsByTagName( 'li' );

        for ( var i = 0; i < InterwikiLinks.length; i++ ) {
            var className = InterwikiLinks[i].className.match(/interwiki-[-\w]+/);
            if ( document.getElementById( className + '-fa' ) && InterwikiLinks[i].className.indexOf( 'badge-featuredarticle' ) === -1 ) {
                InterwikiLinks[i].className += ' FA';
                InterwikiLinks[i].title = 'Tästä aiheesta on suositeltu artikkeli toisessa Wikipedian kieliversiossa.';
            } else if ( document.getElementById( className + '-ga' ) && InterwikiLinks[i].className.indexOf( 'badge-goodarticle' ) === -1 ) {
                InterwikiLinks[i].className += ' GA';
                InterwikiLinks[i].title = 'Tästä aiheesta on hyvä artikkeli toisessa Wikipedian kieliversiossa.';
            } else if ( document.getElementById( className + '-la' ) && InterwikiLinks[i].className.indexOf( 'badge-recommendedarticle' ) === -1 ) {
                InterwikiLinks[i].className += ' LA';
                InterwikiLinks[i].title = 'Tästä aiheesta on lupaava artikkeli toisessa Wikipedian kieliversiossa.';
            }
        }
    }
}

mw.hook( 'wikipage.content' ).add( LinkFA );

 /* Special functionality for fi-wiki AFD */
 function appendVote(content, vote) {
   document.editform.wpSummary.value=vote;
   if (content.match(/===( )*Äänet( )*===[\s\S]*(===)/im)) {                       /* Do we have subsections? */
     /* Insert vote at the end of voting section */
     newContent=content.replace(/===( )*Äänet( )*===([\s\S]*?)[\s]*(?====)/im, '===Äänet===$3\r\n' + vote + '\r\n\r\n');
     return(newContent);
   } else {
     return(content + '\r\n' + vote + '\r\n');                                   /* Append vote to the end of page */
   }
 }

 addLoadEvent(LinkFA);

 /**
  * Funktio välilehtien lisäämiseksi, alkuperäinen koodi
  * [[commons:MediaWiki:Extra-tabs.js]] lisättynä api-kutsulla
  * joka tarkastaa oletuksena sivun olemassaolon api.php kautta
  *
  * Käyttöesimerkki:
  * function myTabs() {
  *   // Omat muokkaukset, ei varsinainen sivu joten ohitetaan apikutsu
  *   global_append_tab('Toiminnot:Muokkaukset/' + mw.config.get('wgUserName'), 'Omat muokkaukset', 'ca-contribs', false);
  *   // Välilehti omaan monobook.js-tiedostoon
  *   global_append_tab('Käyttäjä:' + mw.config.get('wgUserName') + '/monobook.js', 'monobook.js', 'ca-monobookjs');
  * }
  *
  * $( myTabs );
  */
 function global_append_tab(url, name, id, apicheck, preload) {
 
   if (apicheck != false) { apicheck = true; }
 
   var path = '/wiki/';
   if (url.substring(0, 9) == 'index.php') {
     path = '/w/';
   }
 
   var na = document.createElement('a');
 
   var xmlhttp = sajax_init_object();
 
   var li = document.createElement('li');
   if(id) li.id = id;
 
   if (apicheck == true) {
     xmlhttp.open( 'GET' , mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=json&action=query&prop=info&titles=' + encodeURIComponent(url), false);
     xmlhttp.send(null);

     if (xmlhttp.status == 200) {
       var data = xmlhttp.responseText;
       if (data.indexOf('missing') != -1) {
         li.setAttribute('class', 'new');
         if (preload) {
           na.setAttribute('href', '/w/index.php?action=edit&title=' + encodeURIComponent(url) +
                                   '&preload=' + encodeURIComponent(preload));
         }
       }
     }
   }
  
   if (!na.getAttribute('href')) {
     na.setAttribute('href', path + url);
   }
 
   var txt = document.createTextNode(name);
   var span = document.createElement('span');
   span.appendChild(txt);
   na.appendChild(span);
 
   li.appendChild(na);
 
   // Grab the element we want to append the tab and append the tab to it.
   if ( skin == 'vector' ) {
     var c1 = document.getElementById('p-views');
     var tabs = c1.getElementsByTagName('ul')[0];
   } else {
     var c1 = document.getElementById('column-one');
     var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
   }
   tabs.appendChild(li);
 }

 /** Election Javascript ****************************************************
   *  Kuvaus: Ehdokkaiden sekoitus äänestyksissä.
   */
 if (mw.config.get('wgCanonicalNamespace') == "Project" && mw.config.get('wgAction') == "view") {
     importScript("Järjestelmäviesti:Dshuf.js");
 }


/* Näytetään vakautetuilla ja vakailla sivuilla FlaggedRevs-tiedotelaatikot */
/* Voidaan poistaa sen jälkeen kun FlaggedRevs-piilotus on poistettu    */
/* -- Zache 14.2.2012                                                   */

if (mw.config.get('wgStableRevisionId')>0) 
{
    var e=document.getElementById("mw-fr-revisiontag");
    if (e && (mw.config.get('wgStableRevisionId')!=mw.config.get('wgCurRevisionId')))
    {
        if (e.innerHTML.search("doc-magnify.png")!=-1) { e.style.display="block"; }
        else if (e.innerHTML.search("img/2.png")!=-1) { e.style.display="block"; }
    }
}

/* vaihtaa sivun vanhimpaan odottavaan muutokseen */
 
function check_unreviewed() {
   $.getJSON("//fi.wikipedia.org/w/api.php?action=query&list=oldreviewedpages&ornamespace=0&format=json&orlimit=50"
             ,    function(data)
     {    
        if (data.query.oldreviewedpages.length)
        {
           var pos=Math.floor(Math.random()*data.query.oldreviewedpages.length);   
           var url="//fi.wikipedia.org/w/index.php?"
                + "title=" + data.query.oldreviewedpages[pos].title.replace(" ", "_")
                + "&diff=cur"
                + "&oldid=" + data.query.oldreviewedpages[pos].stable_revid
                + "&wikeddiff=1";
            document.location=url;
        }
     });
}

/* Mikäli kuva on common-kuva niin siirrytään suoraan sinne fiwikin kuvasivun sijaan */ 

function alwayscommonslinks() {
  var re1 = /^https:\/\/(?:(upload)\.)?(wikimedia)\.org(\/wikipedia\/commons\/[^?#]*)([#?].*|)$/i;
 
	var images = document.getElementsByTagName('img');
	for (var i = images.length; i--;) {
 
		var image = images[i], src = image.src;
		var m, main, sub, page, query;
 
		if ((m = src.match(re1)) && image.parentNode.href) {
                    image.parentNode.href=image.parentNode.href.replace("//fi.wikipedia.org/wiki/Tiedosto:", "//commons.wikimedia.org/wiki/File:");
                }
	}
}
jQuery( document ).ready( alwayscommonslinks );

/**
 * Description: Adapt multiple columns to the actual size of the bodyContent div.
 * Maintainers: [[:no:User:Jeblad]]
 */
(function(mw, $) {
    var widths = [
        { size : 300,  name : 'multicol-xx-small' },
        { size : 600,  name : 'multicol-x-small' },
        { size : 900,  name : 'multicol-small' },
        { size : 1200, name : 'multicol-normal' },
        { size : 1500, name : 'multicol-large' },
        { size : 1800, name : 'multicol-large' },
        { size : 2100, name : 'multicol-x-large' }
    ];
    $( function() {
        var found = 0;
        var width = $('#bodyContent').width();
        if (width < widths[0]) {
            $('#bodyContent').addClass('multicol-verysmall');
            return;
        }
        for (var i = 1; i<widths.length; i++) {
            if (widths[i-1].size <= width && width < widths[i].size) {
                $('#bodyContent').addClass( widths[i].name);
                found++;
                break;
            }
        }
        if (!found) {
            $('#bodyContent').addClass('multicol-verylarge');
        }
    });
})(mediaWiki, jQuery);

/* Luodaan Wikipedia:Verkkoviite-bookmarklet -sivulla javascript-linkki jonka käyttäjä voi 
raahata kirjanmerkkipalkkiin. 

Ylläpitäjä: Zache
Lisätty: 24.3.2014
*/

if (mw.config.get('wgPageName')=="Wikipedia:Verkkoviite-bookmarklet" )
{
	$(function() {
  		var url=$("#verkkoviite-bookmarklet-code").text().trim();
  		var target =$("#verkkoviite-bookmarklet-target");
  		if ((url!="") && (typeof(target)!="undefined"))
  		{
  			var link=$("<a>&nbsp;Verkkoviite&nbsp;</a>");
  			link.attr('href', url);
  			link.css('border-bottom', '0.1em solid black');
  			link.css('border-right', '0.1em solid black');
  			link.css('background-color', 'lightblue');
  			target.append(link);
  		}
	});
}

/**
 * Tekee vasempaan reunaan Kielet-listan yläpuolelle Sisarprojektit-listan. Koodi on otettu sv.wikipedia.org:stä
 */
$( function() { 
	var iwlinks = jQuery( 'div.interProject' );
	if ( iwlinks.length > 0 ) {
		var pproject = jQuery( '#p-tb' ).clone().attr( 'id', 'p-project' ).insertAfter( '#p-tb' );
		pproject.find( 'h3' ).attr( 'id', 'p-project-label' ).text( 'Sisarprojektit' );
		pproject.find( 'ul' ).addClass( 'interProject' ).empty().append( iwlinks );
		iwlinks.replaceWith( function() {
			return $( '<li></li>' ).addClass( $(this).attr( 'class' ) ).append( $(this).contents() );
		});
	}
});

/*
Lisää keskustelusivujen loppuun "lisää aihe" -linkin.
Koodi on mukaelma frwikin vastaavasta (common.js)
-- Zache 26.10.2016
*/
$( function () {
	var $link, $container,
		$newSectionLink = $( '#ca-addsection a' );
	if ( $newSectionLink.length ) {
		if ( mw.config.get( 'wgAction' ) === 'view' ) {
			$link = $( '<a>' )
				.addClass( 'mw-ui-button mw-ui-progressive' )
				.text( $newSectionLink.text() )
				.attr( {
					href: $newSectionLink.attr( 'href' ),
					title: $newSectionLink.attr( 'title' ),
					id: 'footer-addsectionbutton'
				} );

			$container = $( '<div>' )
				.attr( 'id', 'footer-addsectionbuttoncontainer' )
				.css( {
					'margin-top': '1em',
					'padding-top': '1em',
					'border-top': '1px solid #a2a9b1'
				} );
			$container.append( $link );
			$( '#mw-content-text' ).append( $container );
		}
	}
} );

// Näytetään luo uusi sivu -nappi kun sivua ei ole olemassa ja ollaan omilla käyttäjäsivuilla
// nappi tulee sivulta Järjestelmäviesti:Noarticletext:
if (mw.config.get('wgNamespaceNumber')==2)
{
	if (mw.config.get("wgPageName").search(":" + mw.config.get('wgUserName')) != -1)
	{
		$(".fiwiki-create-userpage-button").show();
	}
}

// Several scripts still using the deprecated global
window.addPortletLink = function () {};
mw.loader.using('mediawiki.util').then(function() {
	mw.log.deprecate( window, 'addPortletLink', mw.util.addPortletLink, 'Use mw.util.addPortletLink instead' );
})