Järjestelmäviesti:Gadget-MuokkaaJohdantoa.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.
/*Lisää Muokkaa-painikkeen Johdanto-osioon-alku
  Koodi on poimittu sivulta: https://fi.wikipedia.org/w/index.php?title=user:Usp/common.js&oldid=13181926
*/
$( function () {
	// if this is preview page or generated page, stop
	if (
		document.getElementById( 'wikiPreview' ) ||
		window.location.href.indexOf( '/wiki/Special:' ) != -1
	)
	{
		return;
	}

	// section edit links doesn't work correctly in MediaWiki namespace, stop
	if ( mw.config.get( 'wgNamespaceNumber' ) == 8 ) {
		return;
	}

	// create div and set innerHTML to link
	var divContainer = document.createElement( 'span' );
	var html = '<span class="mw-editsection">';
	html += '<span class="mw-editsection-bracket">[</span>';
	// show visual editor link only in namespace 0
	if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
		html += ' <a href="/w/index.php?title=' + mw.config.get( 'wgPageName' ) + '&amp;veaction=edit&amp;section=0" title="Muokkaa johdantoa">muokkaa</a>';
		html += ' | ';
	}
	html += '<a href="/w/index.php?title=' + mw.config.get( 'wgPageName' ) + '&amp;action=edit&amp;section=0" title="Muokkaa johdantoa">muokkaa wikitekstiä</a> ';
	html += '<span class="mw-editsection-bracket">]</span></span>';
	divContainer.innerHTML = html;

	// insert divContainer into the DOM before the h1
	if ( window.location.href.indexOf( '&action=edit' ) == -1 ) {
		document.getElementsByTagName( 'h1' )[0].appendChild( divContainer );
	}

	if ( window.location.href.indexOf( '&action=edit&section=0' ) != -1 ) {
		var summary = document.getElementById( 'wpSummary' );
		if (summary) summary.value = '/* Intro */ ';
	}
} );
/*
Lisää Muokkaa-painikkeen Johdanto-osioon-loppu
*/