/* generated javascript */
var skin = 'monobook';
var stylepath = '/skins-1.5';
/* MediaWiki:Common.js */
/* Any JavaScript here will be loaded for all users on every page load. */
/* Chrome sniffing */
var is_chrome = /Chrome/.test(navigator.userAgent);
/**
== Segédfüggvények ==
*/
function addLoadEvent(func) {
addOnloadHook(func);
}
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 escapeRegexp(s) {
return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
}
function getCookie(name) {
var cookieText;
var cookiePos = document.cookie.indexOf(name + '=');
if(cookiePos!=-1) {
var results = document.cookie.match(name+'=(.*?)(;|$)');
if(results) cookieText = unescape(results[1]);
return cookieText;
} else return null;
}
function setCookie(name, text, expires) {
if(text) {
if(expires) {
document.cookie = name + '=' + escape(text) + '; expires=' + expires.toUTCString() + '; path=/';
} else {
document.cookie = name + '=' + escape(text) + '; path=/';
}
} else {
document.cookie = name + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/'; // delete cookie
}
}
/**
== Elrejthető üzenetek ==
*/
function hideElement(e) {
var name = this.id.slice(5); // 'hide-' elhagyása
var element = document.getElementById(name);
var expires = new Date();
expires.setTime( expires.getTime() + (7*24*60*60*1000) ); // 1 hét
setCookie('hide-' + name, '1', expires);
element.style.display = "none";
this.style.display = "none";
return false;
}
function addHideButton(element) {
var isHidden = getCookie('hide-' + element.id);
if(isHidden) {
element.style.display = "none";
} else {
var button = document.createElement( "a" );
button.setAttribute( "id", "hide-" + element.id);
button.setAttribute( "class", "hideButton" );
button.setAttribute( "href", "#" );
button.setAttribute( "title", "Üzenet elrejtése egy hétre" );
button.onclick = hideElement;
button.appendChild( document.createTextNode("[elrejt]") );
element.appendChild( button );
}
}
/**
== WikiMiniAtlas ==
*/
importScriptURI( 'http://meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s&smaxage=3600');
/**
== Nincslicenc sablon beszúrása feltöltéskor ==
*/
// code to add a temporary license template if user leaves the license drop-down at
// its default setting and no template is present in the upload description
// based on ForceSummary()
function ForceLicenseInstall(){
// Check browser capabilities
if(!document.forms || !document.getElementById) return;
// User explicitly turned it off
if (typeof noForceLicense != 'undefined') return;
if(!document.forms.upload) return;
document.forms.upload.wpUpload.onclick = ForceLicense;
};
function ForceLicense(){
if ((document.forms.upload.wpLicense.selectedIndex == 0) && (!/\{\{[^{}]+\}\}/.test(document.forms.upload.wpUploadDescription.value))) {
document.forms.upload.wpUploadDescription.value += ("\n==Licenc==\n{"+"{nincslicenc}"+"}");
}
return true;
};
addOnloadHook(ForceLicenseInstall);
/*
== Enable selecting last item in license drop-down ==
*/
function licenseSelectorEnableLast() {
var selector = document.getElementById("wpLicense");
if ((selector) && (selector.selectedIndex != selector.options.length - 1 )) {
// call original handler
licenseSelectorCheck();
}
}
function licenseSelectorEnableLastInstall() {
var selector = document.getElementById("wpLicense");
if (selector) {
selector.options[selector.options.length-1].style.disabled = 'false';
selector.onchange = licenseSelectorEnableLast;
}
}
addOnloadHook(licenseSelectorEnableLastInstall);
/**
== Legördülő menü és extra gombok az edittools-ba ==
*/
if (document.URL.indexOf("action=edit") > 0 || document.URL.indexOf("action=submit") > 0 || decodeURIComponent(document.URL).indexOf("Speciális:Feltöltés") > 0) {
// Listbox to select edit tools
function addCharSubsetMenu() {
var specialchars = document.getElementById('specialchars');
if (specialchars) {
var menu = document.createElement('select');
menu.style.display = 'inline';
menu.onchange = function() {
chooseCharSubset(menu.options[menu.selectedIndex].value);
}
var specialCharacterTypes = new Object();
var l = document.getElementById('specialchars').getElementsByTagName('p');
for (var i = 0; i < l.length; i++) {
var title = l[i].title;
var opt = document.createElement('option');
opt.appendChild(document.createTextNode(title));
opt.value = i;
specialCharacterTypes[title] = opt;
}
if(typeof(allowedSpecialCharacterTypes) == 'undefined') {
for (var i = 0; i < l.length; i++) {
menu.appendChild(specialCharacterTypes[l[i].title]);
}
chooseCharSubset(0);
} else {
for(var i = 0; i < allowedSpecialCharacterTypes.length; i++) {
if(typeof(specialCharacterTypes[allowedSpecialCharacterTypes[i]]) != 'undefined') {
menu.appendChild(specialCharacterTypes[allowedSpecialCharacterTypes[i]]);
}
}
chooseCharSubset(specialCharacterTypes[allowedSpecialCharacterTypes[0]].value);
}
specialchars.insertBefore(menu, specialchars.firstChild);
}
}
function chooseCharSubset(s) {
var l = document.getElementById('specialchars').getElementsByTagName('p');
for (var i = 0; i < l.length ; i++) {
l[i].style.display = (i == s) ? 'inline' : 'none';
}
}
// Extra buttons for the edit toolbar, based on en:User:MarkS/extraeditbuttons.js
function InsertButtonsToToolBar() {
//Redirect
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
"speedTip": "Átirányítás",
"tagOpen": "#ÁTIRÁNYÍTÁS [[",
"tagClose": "]]",
"sampleText": "Cél" }
//Strike-Out Button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",
"speedTip": "Áthúzott szöveg",
"tagOpen": "",
"tagClose": "",
"sampleText": "Áthúzott szöveg" }
//Small Text
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/17/Button_small_2.png",
"speedTip": "Apróbetűs szöveg",
"tagOpen": "",
"tagClose": "",
"sampleText": "Apróbetűs szöveg" }
//Code
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/30/Tt_icon.png",
"speedTip": "Írógép-szöveg",
"tagOpen": "",
"tagClose": "",
"sampleText": "Fix szélességű szöveg" }
//Reference link button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/c/c4/Button_ref.png",
"speedTip": "Forráshivatkozás",
"tagOpen": "[",
"tagClose": "]",
"sampleText": "Hivatkozás szövegének helye" }
//Reference button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/f/fe/Button_refs.png",
"speedTip": "Forráshivatkozás lábrész",
"tagOpen": "",
"tagClose": "",
"sampleText": "" }
// Template button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/eb/Button_plantilla.png",
"speedTip": "Sablon",
"tagOpen": "{{",
"tagClose": "}}",
"sampleText": "példa sablon" }
if(mwEditButtons[9] && mwEditButtons[9].imageId == 'mw-editbutton-signature') mwEditButtons[9].tagOpen = "– ~~" + "~~";
}
addOnloadHook(addCharSubsetMenu);
addOnloadHook(InsertButtonsToToolBar);
}
/**
== Ékezetes karakterek bejelentkezéshez ==
*/
function insertText(box, string) {
box.focus();
if (document.selection && document.selection.createRange) { // IE/Opera
var range = document.selection.createRange();
range.text = string;
} else if (box.selectionStart || box.selectionStart == '0') { // Mozilla
var startPos = box.selectionStart;
var endPos = box.selectionEnd;
box.value = box.value.substring(0, startPos) + string + box.value.substring(endPos, box.value.length);
}
}
if (window['wgCanonicalSpecialPageName'] && wgCanonicalSpecialPageName == "Userlogin") {
function installLoginChars() {
window['loginbox'] = document.getElementById('wpName1');
var loginchars = document.getElementById('loginchars');
if (loginchars) {
var hunchars = "áéíóöőúüűÁÉÍÓÖŐÚÜŰ".split('');
for (var i = 0, str = ''; i < hunchars.length; i++) {
str += '' + hunchars[i] + ' ';
}
loginchars.innerHTML += str;
loginchars.style.display = "block";
}
}
addOnloadHook(installLoginChars);
}
/**
== Becsukható
==
*/
// ============================================================
// BEGIN Dynamic Navigation Bars (experimantal)
// set up the words in your language
var NavigationBarHide = '▲ becsuk';
var NavigationBarShow = '▼ kinyit';
// 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';
}
}
NavToggle.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';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
}
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton()
{
var indexNavigationBar = 0;
// iterate over all < div >-elements
for(
var i=0;
NavFrame = document.getElementsByTagName("div")[i];
i++
) {
// if found a navigation bar
if (NavFrame.className == "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);
// 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 (NavFrame.childNodes[j].className == "NavHead") {
NavFrame.childNodes[j].appendChild(NavToggle);
}
}
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
}
}
// if more Navigation Bars found than Default: hide all
if (NavigationBarShowDefault < indexNavigationBar) {
for(
var i=1;
i<=indexNavigationBar;
i++
) {
toggleNavigationBar(i);
}
}
}
if (!fCreateNavigationBarToggleButton) addLoadEvent(createNavigationBarToggleButton);
var fCreateNavigationBarToggleButton = 1;
// END Dynamic Navigation Bars
// ============================================================
/*
== Becsukható táblázat ==
Az angol változattól annyiban tér el, hogy 'sticky' class esetén megjegyzi a tábla állapotát (lap-szinten, nem tábla-szinten).
A lapneveket egy sütibe gyűjti -> csak kevés oldalon használd!
TODO: collapseTable/createCollapseButtons átírása, hogy változót használjanak az id-s gányolás helyett, és a megjegyzés lehessen id-alapú
*/
/** Collapsible tables *********************************************************
*
* Description: Allows tables to be collapsed, showing only the header. See
* Wikipedia:NavFrame.
* Maintainers: User:R. Koot
*/
var autoCollapse = 2;
var collapseCaption = "▲ becsuk";
var expandCaption = "▼ kinyit";
// browser detection magic; Gecko < 1.8 does not know visibility:collapse
var gecko_rvi = navigator.userAgent.toLowerCase().indexOf('rv:');
var gecko_rv = (gecko_rvi == -1) ? 0 : parseFloat(navigator.userAgent.toLowerCase().substring(gecko_rvi+3, gecko_rvi+6));
function collapseTable( tableIndex, sticky )
{
var Button = document.getElementById( "collapseButton" + tableIndex );
var Table = document.getElementById( "collapsibleTable" + tableIndex );
if ( !Table || !Button ) {
return false;
}
if (sticky) {
var closedTables = getCookie('closedTables');
if (closedTables == null) closedTables = '';
var pageRE = new RegExp('\\b' + escapeRegexp(wgPageName) + '\\b');
var expires = new Date();
expires.setTime( expires.getTime() + (4*7*24*60*60*1000) ); // 4 hét
}
var Rows = Table.getElementsByTagName( "tr" );
if ( Button.firstChild.data == collapseCaption ) {
if(is_gecko && gecko_rv >= 1.8) {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.visibility = 'collapse';
Rows[i].className += ' row-collapsed';
}
} else {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = 'none';
}
}
Button.firstChild.data = expandCaption;
if (sticky && !closedTables.match(pageRE)) {
setCookie('closedTables', closedTables + ' ' + wgPageName, expires);
}
} else {
if(is_gecko && gecko_rv >= 1.8) {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.visibility = 'visible';
Rows[i].className.replace(/\s*\brow-collapsed\b/g, '');
}
} else {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = Rows[0].style.display;
}
}
Button.firstChild.data = collapseCaption;
if (sticky && closedTables.match(pageRE)) {
closedTables = closedTables.replace(pageRE, '').replace(/ /, ' ').replace(/(^ | $)/, '');
setCookie('closedTables', closedTables, expires);
}
}
}
function createCollapseButtons()
{
var tableIndex = 0;
var NavigationBoxes = new Object();
var Tables = document.getElementsByTagName( "table" );
for ( var i = 0; i < Tables.length; i++ ) {
if ( hasClass( Tables[i], "collapsible" ) ) {
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.style.styleFloat = "right";
Button.style.cssFloat = "right";
Button.style.fontWeight = "normal";
Button.style.textAlign = "right";
Button.style.width = "6em";
ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
if ( hasClass( Tables[i], "sticky" ) ) {
ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ", true);" );
} else {
ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ", false);" );
}
ButtonLink.appendChild( ButtonText );
Button.appendChild( ButtonLink );
var Header = Tables[i].getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0];
/* only add button and increment count if there is a header row to work with */
if (Header) {
Header.insertBefore( Button, Header.childNodes[0] );
tableIndex++;
}
}
}
var closedTables = getCookie('closedTables');
var pageRE = new RegExp('\\b' + escapeRegexp(wgPageName) + '\\b');
var isClosed = (closedTables && closedTables.match(pageRE));
for ( var i = 0; i < tableIndex; i++ ) {
if ( hasClass( NavigationBoxes[i], "sticky" ) ) {
if (isClosed) collapseTable( i );
}
else if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
collapseTable( i );
}
}
}
if (!fCreateCollapseButtons) addOnloadHook( createCollapseButtons );
var fCreateCollapseButtons = 1;
/**
== Címek javítása ==
*/
// 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. But C# is not an equivalent
// wikilink, so C Sharp doesn't have its main title changed)
// Likewise for users who have selected the U.K. date format ("1 March") the
// titles of day-of-the-year articles will appear in that style. Users with any
// other date setting are not affected.
//
// The function looks for a banner like this:
//
... title ...
// An element with id=DisableRealTitle disables the function.
//
var disableRealTitle = 0; // users can set disableRealTitle = 1 locally to disable.
if (wgIsArticle) { // 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 fixArticleTitle() {
var realTitleBanner = document.getElementById("RealTitleBanner");
var realTitle = document.getElementById("RealTitle");
if (realTitleBanner && realTitle && !document.getElementById("DisableRealTitle") && !disableRealTitle) {
var realTitleHTML = realTitle.innerHTML;
realTitleText = pickUpText(realTitle);
var isPasteable = 0;
//var containsHTML = //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 (wgNamespaceNumber != 0) {
var localNamespace = wgPageName.split(':')[0];
if (wgCanonicalNamespace == verifyTitle.substr(0, wgCanonicalNamespace.length).replace(/ /g, "_") && verifyTitle.charAt(wgCanonicalNamespace.length) == ":") {
verifyTitle = verifyTitle.substr(wgCanonicalNamespace.length + 1);
} else if (localNamespace == verifyTitle.substr(0, localNamespace.length).replace(/ /g, "_") && verifyTitle.charAt(localNamespace.length) == ":") {
verifyTitle = verifyTitle.substr(localNamespace.length + 1);
} else {
realTitleText = localNamespace.replace(/_/g, " ") + ":" + realTitleText;
realTitleHTML = localNamespace.replace(/_/g, " ") + ":" + realTitleHTML;
}
}
// verify whether wgTitle matches
verifyTitle = verifyTitle.replace(/[\s_]+/g, " "); // underscores and multiple spaces to single spaces
verifyTitle = verifyTitle.replace(/^\s+/, "").replace(/\s+$/, ""); // trim left and right spaces
verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
if (verifyTitle == wgTitle) isPasteable = 1;
var h1 = document.getElementsByTagName("h1")[0];
if (h1 && isPasteable) {
h1.innerHTML = containsTooMuchHTML ? realTitleText : realTitleHTML;
if (!containsTooMuchHTML)
realTitleBanner.style.display = "none";
}
document.title = realTitleText + " - Wikipédia, a szabad enciklopédia";
}
}
// 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;
}
addOnloadHook(fixArticleTitle);
}
/**
== IRC login ==
*/
// 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 = '
';
}
}
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;
}
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';
}
}
addOnloadHook(loadLoginForm);
}
/**
== Információs sablon beillesztése a szövegdobozba feltöltéskor ==
*/
function insertInfoTemplate() {
var editbox = document.getElementById('wpUploadDescription');
if (!editbox) return;
if (editbox.value != '') return;
editbox.rows = 9; // make it large enough to fit the template
editbox.value = "{{Információ\n"
+ "| leírás = \n"
+ "| forrás = \n"
+ "| dátum = \n"
+ "| helyszín = \n"
+ "| szerző = \n"
+ "| engedély = \n"
+ "| más változatok = \n"
+ "}}";
}
addOnloadHook(insertInfoTemplate);
/**
== Összefoglalóra figyelmeztető prompt anonimoknak ==
*/
function IsLoggedIn() {
// If there is no login button, assume we're logged in
return document.getElementById('pt-login') == null;
}
// some code to check whether I've added an Edit Summary
// somewhat copied from [[User:ABCD/monobook.js]]
function ForceSummaryInstall(){
// Check browser capabilities
if(!document.forms || !document.getElementById) return;
// User explicitly turned it off
if (typeof noForceSummary != 'undefined') return;
// User is logged in
if(IsLoggedIn()) return;
if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return;
if(/§ion=new/.test(window.location.href)) return;
if(!document.forms.editform) return;
document.forms.editform.wpSave.onclick = ForceSummary;
};
function ForceSummary(){
var summary = document.forms.editform.wpSummary;
if(!summary.value.replace(/^(\/\*.*\*\/)? *(.*) *$/,'$2')){
var r = prompt('Kérünk, írj egy rövid szerkesztési\n összefoglalót a változtatásaidról:', summary.value);
if(r == null) return false;
summary.value = r;
}
return true;
};
addOnloadHook(ForceSummaryInstall);
/**
== Változtatható rendezésű táblázatok: ékezetes betűk, magyar írásmódú számok rendezése ==
*/
ts_number_regex = new RegExp(
"^(" +
"[+-]?[0-9][0-9,]*(\\.[0-9,]*)?(E[+-]?[0-9][0-9,]*)?" + // angol / Fortran-style scientific
"|" +
"[+-]?[0-9, \xa0]+%?" + // magyar
")$", "i"
);
function ts_toLowerCaseStripped(s) {
s = s.toLowerCase();
s = s.replace(/[áäâãåàāăą]/g, 'a');
s = s.replace(/[çćĉċč]/g, 'c');
s = s.replace(/[ďđ]/g, 'd');
s = s.replace(/[èéêëēĕėęě]/g, 'e');
s = s.replace(/[ĝğġģ]/g, 'g');
s = s.replace(/[ĥħ]/g, 'h');
s = s.replace(/[ìíîïĩīĭįı]/g, 'i');
s = s.replace(/[ĵ]/g, 'j');
s = s.replace(/[ķĸ]/g, 'k');
s = s.replace(/[ĺļľŀł]/g, 'l');
s = s.replace(/[ñńņňʼnŋ]/g, 'n');
s = s.replace(/[òóôõöøōŏő]/g, 'o');
s = s.replace(/[ŕŗř]/g, 'r');
s = s.replace(/[śŝşš]/g, 's');
s = s.replace(/[ţťŧ]/g, 't');
s = s.replace(/[ùúûüũūŭůűų]/g, 'u');
s = s.replace(/[ŵ]/g, 'w');
s = s.replace(/[ýÿŷ]/g, 'y');
s = s.replace(/[źżž]/g, 'z');
s = s.replace(/[æ]/g, 'ae');
s = s.replace(/[ij]/g, 'ij');
s = s.replace(/[œ]/g, 'oe');
return s;
}
function ts_parseFloat(num) {
if (!num) return 0;
num = num.replace(/[\s\xa0.]/g, ''); /* ezreseket elválasztó whitespace, pont ki */
num = num.replace(/,/, '.'); /* Tizedesvessző -> tizedespont */
num = parseFloat(num);
return (isNaN(num) ? 0 : num);
}
/* Eredeti változat: http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/skins/common/wikibits.js
* Ha az eredeti változat frissebb az itteninél, frissíteni kell a helyi változtatások megtartásával:
* # ts_initTransformTable hívás kiszedve
* # alapértelmezett preprocesszor más
*/
function ts_resortTable(lnk) {
// get the span
var span = lnk.getElementsByTagName('span')[0];
var td = lnk.parentNode;
var tr = td.parentNode;
var column = td.cellIndex;
var table = tr.parentNode;
while (table && !(table.tagName && table.tagName.toLowerCase() == 'table'))
table = table.parentNode;
if (!table) return;
if (table.rows.length <= 1) return;
// Work out a type for the column
// Skip the first row if that's where the headings are
var rowStart = (table.tHead && table.tHead.rows.length > 0 ? 0 : 1);
var itm = "";
for (var i = rowStart; i < table.rows.length; i++) {
if (table.rows[i].cells.length > column) {
itm = ts_getInnerText(table.rows[i].cells[column]);
itm = itm.replace(/^[\s\xa0]+/, "").replace(/[\s\xa0]+$/, "");
if (itm != "") break;
}
}
// TODO: bug 8226, localised date formats
var sortfn = ts_sort_generic;
var preprocessor = ts_toLowerCaseStripped;
if (/^\d\d[\/. -][a-zA-Z]{3}[\/. -]\d\d\d\d$/.test(itm)) {
preprocessor = ts_dateToSortKey;
} else if (/^\d\d[\/.-]\d\d[\/.-]\d\d\d\d$/.test(itm)) {
preprocessor = ts_dateToSortKey;
} else if (/^\d\d[\/.-]\d\d[\/.-]\d\d$/.test(itm)) {
preprocessor = ts_dateToSortKey;
// pound dollar euro yen currency cents
} else if (/(^[\u00a3$\u20ac\u00a4\u00a5]|\u00a2$)/.test(itm)) {
preprocessor = ts_currencyToSortKey;
} else if (ts_number_regex.test(itm)) {
preprocessor = ts_parseFloat;
}
var reverse = (span.getAttribute("sortdir") == 'down');
var newRows = new Array();
var staticRows = new Array();
for (var j = rowStart; j < table.rows.length; j++) {
var row = table.rows[j];
if((" "+row.className+" ").indexOf(" unsortable ") < 0) {
var keyText = ts_getInnerText(row.cells[column]);
var oldIndex = (reverse ? -j : j);
var preprocessed = preprocessor( keyText );
newRows[newRows.length] = new Array(row, preprocessed, oldIndex);
} else staticRows[staticRows.length] = new Array(row, false, j-rowStart);
}
newRows.sort(sortfn);
var arrowHTML;
if (reverse) {
arrowHTML = '

';
newRows.reverse();
span.setAttribute('sortdir','up');
} else {
arrowHTML = '

';
span.setAttribute('sortdir','down');
}
for(var i in staticRows) {
var row = staticRows[i];
newRows.splice(row[2], 0, row);
}
// We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones
// don't do sortbottom rows
for (var i = 0; i < newRows.length; i++) {
if ((" "+newRows[i][0].className+" ").indexOf(" sortbottom ") == -1)
table.tBodies[0].appendChild(newRows[i][0]);
}
// do sortbottom rows only
for (var i = 0; i < newRows.length; i++) {
if ((" "+newRows[i][0].className+" ").indexOf(" sortbottom ") != -1)
table.tBodies[0].appendChild(newRows[i][0]);
}
// Delete any other arrows there may be showing
var spans = getElementsByClassName(tr, "span", "sortarrow");
for (var i = 0; i < spans.length; i++) {
spans[i].innerHTML = '

';
}
span.innerHTML = arrowHTML;
if (ts_alternate_row_colors) {
ts_alternate(table);
}
}
/**
== A Sablon:Képdia működéséhez szükséges kód ==
*/
function kepValtas(group, remindex, shwindex) {
document.getElementById("kepDiaCs"+group+"Kep"+remindex).style.display="none";
document.getElementById("kepDiaCs"+group+"Kep"+shwindex).style.display="inline";
}
function kepDia(){
if (document.URL.match(/printable/g)) return;
var bc=document.getElementById("bodyContent");
if( !bc ) bc = document.getElementById("mw_contentholder");
if( !bc ) return;
var divs=bc.getElementsByTagName("td");
var i = 0, j = 0;
var units, search;
var currentimage;
var UnitNode;
for (i = 0; i < divs.length ; i++) {
if (divs[i].className != "kepDia") continue;
UnitNode=undefined;
search=divs[i].getElementsByTagName("div");
for (j = 0; j < search.length ; j++) {
if (search[j].className != "kepDiaKepek") continue;
UnitNode=search[j];
break;
}
if (UnitNode==undefined) continue;
units=Array();
for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
var temp = UnitNode.childNodes[j];
if (temp.className=="center") units.push(temp);
}
for (j = 0 ; j < units.length ; j++) {
currentimage=units[j];
currentimage.id="kepDiaCs"+i+"Kep"+j;
var imghead = document.createElement("div");
var leftlink;
var rightlink;
if (j != 0) {
leftlink = document.createElement("a");
leftlink.href = "javascript:kepValtas("+i+","+j+","+(j-1)+");";
leftlink.innerHTML="◀";
} else {
leftlink = document.createElement("span");
leftlink.innerHTML=" ";
}
if (j != units.length - 1) {
rightlink = document.createElement("a");
rightlink.href = "javascript:kepValtas("+i+","+j+","+(j+1)+");";
rightlink.innerHTML="▶";
} else {
rightlink = document.createElement("span");
rightlink.innerHTML=" ";
}
var comment = document.createElement("tt");
comment.innerHTML = "("+ (j+1) + "/" + units.length + ")";
with(imghead) {
style.fontSize="110%";
style.fontweight="bold";
appendChild(leftlink);
appendChild(comment);
appendChild(rightlink);
}
currentimage.insertBefore(imghead,currentimage.childNodes[0]);
if (j != 0) currentimage.style.display="none";
}
}
}
addOnloadHook(kepDia);
/*
== Knávom, azaz a kínai nevek átírását váltogató mechanika ==
*
* [[Sablon:Kínai]] stb.
*/
importScript('User:Chery/kínai.js');
/*
== Kéthasábos forráslista kikapcsolása, ha <4 forrás van ==
*/
if (is_gecko || webkit_match) {
addOnloadHook(function dynamicMultiColumn() {
var reflists = getElementsByClassName(document, "ol", "references");
for (var i = 0; i < reflists.length; i++) {
var l = 0
for (var j = 0; j < reflists[i].childNodes.length; j++) {
if (reflists[i].childNodes[j].nodeType == 1) l++;
}
if (l < 4) {
reflists[i].style.columnCount = 1;
reflists[i].style.MozColumnCount = 1;
reflists[i].style.WebkitColumnCount = 1;
}
}
});
}
/*
== Keresési statisztika ==
*/
// This script is needed for anonymously logging search terms by the Squids; see [[wikt:de:MediaWiki:If-search.js]]
// The search URL will contain the search term
// Please modify retroactively
// You may have to adapt this?
function $ID(ID) {return document.getElementById(ID);}
function tfSearch(s,t) {
if ($ID(s)) {
$ID(s).setAttribute("onsubmit", "SubSearch("+t+")");
$ID(s).parentNode.innerHTML = $ID(s).parentNode.innerHTML; // f***ing IE
}
}
function LogSearch() {
if (window.location.host == 'secure.wikimedia.org') return;
tfSearch('searchform',1);
tfSearch('search',3);
tfSearch('powersearch',2);
tfSearch('bodySearch',4);
oSEAp = $ID("searchform").action.replace(/^.*\/wiki\//, "");
}
addOnloadHook(LogSearch);
function SubSearch(s) {
var x="/";
if (s<2) {
if ($ID("searchInput").value == "") {x="";}
$ID("searchform").action = "/wiki/"+oSEAp+x+$ID("searchInput").value;
} else if (s<3) {
if ($ID("powerSearchText").value == "") {x="";}
$ID("powersearch").getElementsByTagName("input")[0].value = oSEAp+x+$ID("powerSearchText").value;
} else if (s<4) {
if ($ID("searchText").value == "") {x="";}
$ID("search").firstChild.value = oSEAp+x+$ID("searchText").value;
} else if (s<5) {
if ($ID("bodySearchIput").value == "") {x="";}
$ID("bodySearch").action = "/wiki/"+oSEAp+x+$ID("bodySearchIput").value;
}
}
/* MediaWiki:Monobook.js */
/*********************************************************************************************
* Ezek a szkriptek csak Monobook skin alatt futnak le. *
* A nem kifejezetten Monobook-specifikus szkripteket a [[MediaWiki:Common.js]]-be írd! *
**********************************************************************************************/
/*
== Kiemeltcsillag/lakat igazítása ==
*/
function titleIcons() {
var title = document.getElementById('firstHeading');
var protected_icon = document.getElementById('protected-icon');
var featured_icon = document.getElementById('featured-star');
var icon_list = [protected_icon, featured_icon];
for (i=0; i
" 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 = '[szerkesztés]';
title.appendChild(document.createTextNode(" "));
title.appendChild(edit0);
}
addOnloadHook(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";
}
}
}
addOnloadHook(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;
}
}
function mainPageAppendCompleteListLink() {
try {
var node = document.getElementById( "p-lang" )
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var aNode = document.createElement( 'a' );
var liNode = document.createElement( 'li' );
aNode.appendChild( document.createTextNode( 'Teljes lista' ) );
aNode.setAttribute( 'href' , 'http://meta.wikimedia.org/wiki/List_of_Wikipedias' );
liNode.appendChild( aNode );
liNode.className = 'interwiki-completelist';
node.appendChild( liNode );
} catch(e) {
// lets just ignore what's happened
return;
}
}
if ( wgTitle == 'Kezdőlap' && ( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) ) {
addOnloadHook( mainPageRenameNamespaceTab );
}
if ( wgTitle == 'Kezdőlap' && wgNamespaceNumber == 0 ) {
addOnloadHook( mainPageAppendCompleteListLink );
}
/*
== 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';
}
addOnloadHook(alignCoord);
/*
== 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 box = document.getElementById("siteSub");
if(box ) {
box.innerHTML = '';
}
}
}
addOnloadHook(betaWikiSign);
/*
== Kibővített keresőlap ==
*/
function SpecialSearchEnhanced() {
var createOption = function(site, action, mainQ, addQ, addV) {
var opt = document.createElement('option');
opt.appendChild(document.createTextNode(site));
searchEngines[searchEngines.length] = [action, mainQ, addQ, addV];
return opt;
}
var searchForm = null;
if (document.forms['powersearch']) {
searchForm = document.forms['powersearch'];
} else if (document.forms['search']) {
searchForm = document.forms['search'];
}
if(searchForm) {
if (searchForm.lsearchbox) {
var searchBox = searchForm.lsearchbox;
} else {
var searchBox = searchForm.search;
}
var selectBox = document.createElement('select');
selectBox.id = 'searchEngine';
searchForm.onsubmit = function() {
var optSelected = searchEngines[document.getElementById('searchEngine').selectedIndex];
searchForm.action = optSelected[0];
searchBox.name = optSelected[1];
searchForm.title.value = optSelected[3];
searchForm.title.name = optSelected[2];
}
selectBox.appendChild(createOption('Wikipédia', wgScriptPath + '/index.php', 'search', 'title', 'Special:Search'));
selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'sitesearch', 'hu.wikipedia.org'));
selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', 'hu.wikipedia.org'));
selectBox.appendChild(createOption('Windows Live', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://hu.wikipedia.org'));
selectBox.appendChild(createOption('Wikiwix', 'http://www.wikiwix.com/', 'action', 'lang', 'hu'));
searchBox.style.marginLeft = '0px';
if (document.getElementById('loadStatus')) {
var lStat = document.getElementById('loadStatus');
} else {
var lStat = searchForm.fulltext;
}
lStat.parentNode.insertBefore(selectBox, lStat);
}
}
var searchEngines = [];
addOnloadHook(SpecialSearchEnhanced);
/*
== FlaggedRevs doboz abszolút pozicionálása ==
*/
function positionHeaderNotice() {
var content = document.getElementById('content');
var h1 = document.getElementsByTagName('h1');
var i, firstHeading = null;
for (i = 0; i < h1.length; i++) {
if (hasClass(h1[i], 'firstHeading')) {
firstHeading = h1[i];
}
}
if (firstHeading == null) 'return';
var box = document.getElementById('mw-revisiontag');
if (box == null) return;
if (!hasClass(box, 'flaggedrevs_short')) 'return';
firstHeading.appendChild(box);
box.className += ' firstHeading-notice';
firstHeading.style.paddingRight = box.offsetWidth + 'px';
// átmeneti, amíg a CSS nem mindenkinek friss
box.style.position = 'absolute';
box.style.right = 0;
box.style.bottom = 0;
box.style.fontSize = '40%';
box.style.margin = '0';
}
addOnloadHook(positionHeaderNotice);