MediaWiki:Monobook.js
Megjegyzés: közzététel után frissítened kell a böngésződ gyorsítótárát, hogy lásd a változásokat.
- Firefox / Safari: tartsd lenyomva a Shift gombot és kattints a Frissítés gombra a címsorban, vagy használd a Ctrl–F5 vagy Ctrl–R (Macen ⌘–R) billentyűkombinációt
- Google Chrome: használd a Ctrl–Shift–R (Macen ⌘–Shift–R) billentyűkombinációt
- Internet Explorer / Edge: tartsd nyomva a Ctrl-t, és kattints a Frissítés gombra, vagy nyomj Ctrl–F5-öt
- Opera: Nyomj Ctrl–F5-öt
/*
== Szerkesztőgombok a cím mögött; extra szerkesztőgomb a főcím mellett ==
*/
// moves section edit links to the right side of the section title
// (see also the rules for .editsectionmoved in Monobook.css)
// adds section edit link for the lead section next to the main (h1) title
// shows the contents of [[MediaWiki:Editintro-section-0]] above the edit box if used
// (unless the lead section is the same as the whole article)
// var oldEditsectionLinks=true disables the function.
if(document.getElementById && document.createElement) {
function moveSectionEditLinks() {
if(typeof oldEditsectionLinks != 'undefined' && oldEditsectionLinks == true) return;
var headings = false; // no need to show info about how to edit the whole page if there are no sections
var sectioneditlinks = false; // if there are section edit links, we can safely show the lead section edit link
/* move section edit links */
var body = document.getElementById("bodyContent");
// we iterate through headers until we find a section header
for(var i=1; i<=6; i++) {
var h = body.getElementsByTagName('h'+i);
for(var j=0; j<h.length; j++) {
var span = h[j].getElementsByTagName('span');
for(var k=0; k<span.length; k++) {
if(span[k].className == "mw-headline") headings = true;
else if(span[k].className == "editsection") {
headings = true;
sectioneditlinks = true;
if(is_opera) { // Opera doesn't seem to like the class being changed on the fly
span[k].style.fontSize = "x-small";
span[k].style.fontWeight = "normal";
span[k].style.cssFloat = span[k].style.styleFloat = "none";
span[k].style.marginLeft = "0.5em";
span[k].style.verticalAlign = "baseline";
span[k].style.lineHeight = "1em";
}
span[k].className = "editsectionmoved";
span[k].parentNode.appendChild(document.createTextNode(" "));
span[k].parentNode.appendChild(span[k]); // move behind the heading title
}
}
}
}
/* add lead section edit link */
var edit = document.getElementById("ca-edit");
if(headings && !sectioneditlinks) return; // if sections are not editable, don't add
else if(!headings) {
// try to guess whether sections would be editable; don't add if
// 1) article is protected or otherwise uneditable
// 2) user is viewing page history, edit/move/delete interface, etc.
// 3) user is viewing a special page
// 4) user is viewing a diff, unless it's a diff to the current revision
// 5) user is viewing a permalink to a revision, unless it's the current revision
if(!edit || wgAction != "view" || document.location.href.match("/wiki/Speci%C3%A1lis:"))
return;
var diffMatch = document.location.href.match(/diff=([^&]*)/);
var diff = diffMatch ? diffMatch[1] : null;
var oldidMatch = document.location.href.match(/oldid=([^&]*)/);
var oldid = oldidMatch ? oldidMatch[1] : null;
if(oldid && diff) {
if(diff != wgCurRevisionId && !(diff == "prev" && oldid == wgCurRevisionId)) return;
} else if(oldid) {
if(oldid != wgCurRevisionId) return;
}
// covers most cases, "diff=next&oldid=<last before current>" is impossible to catch
}
var href = edit.firstChild.href + "§ion=0";
if(headings) href += "&editintro=MediaWiki:Editintro-section-0";
var title = document.getElementsByTagName('h1')[0];
if(!title || title.className != "firstHeading") return; // make sure this is the main title
var edit0 = document.createElement('span');
edit0.className = "editsectionmoved";
if(is_opera) {
edit0.style.fontSize = "x-small";
edit0.style.fontWeight = "normal";
edit0.style.marginLeft = "0.5em";
edit0.style.verticalAlign = "baseline";
edit0.style.lineHeight = "1em";
}
edit0.innerHTML = '[<a title="Bevezető szerkesztése" href="' + href + '">szerkesztés</a>]';
title.appendChild(document.createTextNode(" "));
title.appendChild(edit0);
}
$(moveSectionEditLinks);
}
/*
* Címek elrejtése
*/
function hideArticleTitle() {
if (document.getElementById("HideTitle")) {
var h1 = document.getElementsByTagName("h1")[0];
if (h1) {
h1.style.display = "none";
}
var siteSub = document.getElementById("siteSub");
if (siteSub) {
siteSub.style.display = "none";
}
}
}
$(hideArticleTitle);
/*
==Kezdőlap javítás==
*/
/** Kezdőlap javítások *********************************************************
*
* Description: Various layout fixes for the main page, including an
* additional link to the complete list of languages available
* and the renaming of the 'Article' to to 'Main Page'.
* Forrás: en:Common.js
*/
function mainPageRenameNamespaceTab() {
try {
document.getElementById( 'ca-nstab-main' ).firstChild.textContent = 'Kezdőlap';
} catch(e) {
return;
}
}
if ( wgTitle == 'Kezdőlap' && ( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) ) {
$( mainPageRenameNamespaceTab );
}
/*
* Erőforrástakarékos üzenet az adminoknak a Betawikin való MediaWiki-felület-fordításra
*/
function betaWikiSign() {
if(document.getElementById && wgPageName.match("MediaWiki:")) {
var cica=0
for (i=0;i<wgUserGroups.length;i++) {
if (wgUserGroups[i] == "sysop") cica=1
}
if (cica==1) {
var box = document.getElementById("siteSub");
if(box ) {
box.innerHTML = '<div id="anoneditwarning" class="editwarning plainlinks" style="background: #ddddff; border: 1px solid #b3b7ff; color: #000000; margin: .2em 0 .5em; padding: .5em 1em; text-align: center; vertical-align: middle; clear: both;font-size:85%;"><b>Ha olyan üzenetet fordítasz, amely nem Wikihírek-specifikus, akkor azt a <a href="http://www.translatewiki.net" class="external text" style="color: #002bb8;" title="http://www.translatewiki.net" rel="nofollow">Betawikiben</a> tedd, hogy így minden magyar nyelvű Wikimedia-projekt számára elérhető legyen!</b> (<a href="http://www.translatewiki.net/wiki/' + wgPageName + '/hu" class="external text" style="color: #002bb8;" title="' + wgPageName + ' magyar változatának megtekintése a Betawikiben" rel="nofollow">→ezen üzenet megtekintése a Betawikiben</a>, <a href="http://www.translatewiki.net/wiki/' + wgPageName + '/hu?action=edit" class="external text" style="color: #002bb8;" title="' + wgPageName + ' magyar változatának szerkesztése a Betawikiben" rel="nofollow" style>szerkesztés</a>)</div>';
}
}
}
}
$(betaWikiSign);
/*
== Koordináták igazítása ==
*/
function alignCoord() {
if(!document.getElementById) return;
var bodyContent = document.getElementById('bodyContent');
var coordinates = document.getElementById('coordinates');
if(!coordinates || !bodyContent) return;
bodyContent.insertBefore(coordinates, bodyContent.firstChild);
coordinates.style.top = 'auto';
}
$(alignCoord);
// this script looks for the element with id "irclogon", and replaces its contents
// with a login form that redirects to the wikizine CGI:IRC gateway
if(document.getElementById && !document.location.href.match("action=edit") && !document.location.href.match("action=submit")) {
function loadLoginForm() {
var box = document.getElementById("irclogin");
if(box ) {
box.innerHTML = '<form method="post" action="http://chatwikizine.memebot.com/cgi-bin/cgiirc/irc.cgi" target="_blank" name="loginform" onsubmit="setjs()"><input type="hidden" name="interface" value="nonjs"/><input type="text" size="25" name="Nickname" value="' + nickify(wgUserName) + '" onfocus="clear_text(this)"/><input type="submit" value="Belépés"/><input type="hidden" name="Character_set" value="UTF-8"/><input type="hidden" name="Server" value="irc.freenode.net"/><input type="hidden" name="Channel" value="#wikipedia-hu"/></form>';
}
}
function nickify(s) {
if(s == null) {
return "anon" + Math.floor(Math.random()*100);
}
s = s.toLowerCase();
s = s.replace(" ", "_");
s = s.replace(/á/g, 'a');
s = s.replace(/é/g, 'e');
s = s.replace(/í/g, 'i');
s = s.replace(/[óő]/g, 'o');
s = s.replace(/[úű]/g, 'u');
s = s.replace(/[^a-z0-9_-]/g, '');
return s;
}
var irclogin_cleared = 0;
function clear_text(field) {
if(irclogin_cleared == 0) {
irclogin_cleared = 1;
field.value = "";
}
}
function setjs() {
if(navigator.product == 'Gecko') {
document.loginform["interface"].value = 'mozilla';
} else if(window.opera && document.childNodes) {
document.loginform["interface"].value = 'opera7';
} else if(navigator.appName == 'Microsoft Internet Explorer' &&
navigator.userAgent.indexOf("Mac_PowerPC") > 0) {
document.loginform["interface"].value = 'konqueror';
} else if(navigator.appName == 'Microsoft Internet Explorer') {
document.loginform["interface"].value = 'ie';
} else if(navigator.appName == 'Konqueror') {
document.loginform["interface"].value = 'konqueror';
} else if(window.opera) {
document.loginform["interface"].value = 'opera';
}
}
$(loadLoginForm);
}