"मीडियाविकि:Common.js" के अवतरणों में अंतर

भारत डिस्कवरी प्रस्तुति
यहाँ जाएँ:भ्रमण, खोजें
(पृष्ठ को '/* यहां लिखी गई जावास्क्रीप्ट सभी सदस्योंके लिये इस...' से बदल रहा है।)
टैग: बदला गया
 
(6 सदस्यों द्वारा किये गये बीच के 50 अवतरण नहीं दर्शाए गए)
पंक्ति 1: पंक्ति 1:
/* Any JavaScript here will be loaded for all users on every page load. */
+
/* यहां लिखी गई जावास्क्रीप्ट सभी सदस्योंके लिये इस्तेमाल में लाई जायेगी। */
 
 
if (!window.$j) {
 
  $j = jQuery;
 
}
 
 
 
/*
 
== jQuery.hoverIntent ==
 
* Copyright (c) 2007 Brian Cherne
 
* http://cherne.net/brian/resources/jquery.hoverIntent.html
 
* Dual licensed under the MIT and GPL licenses
 
*/
 
(function($) {
 
$.fn.hoverIntent = function(f,g) {
 
// default configuration options
 
var cfg = {
 
sensitivity: 7,
 
interval: 100,
 
timeout: 0
 
};
 
// override configuration options with user supplied object
 
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
 
 
 
// instantiate variables
 
// cX, cY = current X and Y position of mouse, updated by mousemove event
 
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
 
var cX, cY, pX, pY;
 
 
 
// A private function for getting mouse position
 
var track = function(ev) {
 
cX = ev.pageX;
 
cY = ev.pageY;
 
};
 
 
 
// A private function for comparing current and previous mouse position
 
var compare = function(ev,ob) {
 
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
 
// compare mouse positions to see if they've crossed the threshold
 
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
 
$(ob).unbind("mousemove",track);
 
// set hoverIntent state to true (so mouseOut can be called)
 
ob.hoverIntent_s = 1;
 
return cfg.over.apply(ob,[ev]);
 
} else {
 
// set previous coordinates for next time
 
pX = cX; pY = cY;
 
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
 
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
 
}
 
};
 
 
 
// A private function for delaying the mouseOut function
 
var delay = function(ev,ob) {
 
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
 
ob.hoverIntent_s = 0;
 
return cfg.out.apply(ob,[ev]);
 
};
 
 
 
// A private function for handling mouse 'hovering'
 
var handleHover = function(e) {
 
// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
 
var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
 
while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
 
if ( p == this ) { return false; }
 
 
 
// copy objects to be passed into t (required for event object to be passed in IE)
 
var ev = jQuery.extend({},e);
 
var ob = this;
 
 
 
// cancel hoverIntent timer if it exists
 
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
 
 
 
// else e.type == "onmouseover"
 
if (e.type == "mouseover") {
 
// set "previous" X and Y position based on initial entry point
 
pX = ev.pageX; pY = ev.pageY;
 
// update "current" X and Y position based on mousemove
 
$(ob).bind("mousemove",track);
 
// start polling interval (self-calling timeout) to compare mouse coordinates over time
 
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
 
 
 
// else e.type == "onmouseout"
 
} else {
 
// unbind expensive mousemove event
 
$(ob).unbind("mousemove",track);
 
// if hoverIntent state is true, then call the mouseOut function after the specified delay
 
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
 
}
 
};
 
 
 
// bind the function to the two event listeners
 
return this.mouseover(handleHover).mouseout(handleHover);
 
};
 
})(jQuery);
 
 
 
/*
 
== Supersubs ==
 
* Supersubs v0.2b - jQuery plugin
 
* Copyright (c) 2008 Joel Birch
 
* Dual licensed under the MIT and GPL licenses:
 
*/
 
 
 
;(function($){ // $ will refer to jQuery within this closure
 
 
 
$.fn.supersubs = function(options){
 
var opts = $.extend({}, $.fn.supersubs.defaults, options);
 
// return original object to support chaining
 
return this.each(function() {
 
// cache selections
 
var $$ = $(this);
 
// support metadata
 
var o = $.meta ? $.extend({}, opts, $$.data()) : opts;
 
// get the font size of menu.
 
// .css('fontSize') returns various results cross-browser, so measure an em dash instead
 
var fontsize = $('<li id="menu-fontsize">&#8212;</li>').css({
 
'padding' : 0,
 
'position' : 'absolute',
 
'top' : '-999em',
 
'width' : 'auto'
 
}).appendTo($$).width(); //clientWidth is faster, but was incorrect here
 
// remove em dash
 
$('#menu-fontsize').remove();
 
// cache all ul elements
 
$ULs = $$.find('ul');
 
// loop through each ul in menu
 
$ULs.each(function(i) {
 
// cache this ul
 
var $ul = $ULs.eq(i);
 
// get all (li) children of this ul
 
var $LIs = $ul.children();
 
// get all anchor grand-children
 
var $As = $LIs.children('a');
 
// force content to one line and save current float property
 
var liFloat = $LIs.css('white-space','nowrap').css('float');
 
// remove width restrictions and floats so elements remain vertically stacked
 
var emWidth = $ul.add($LIs).add($As).css({
 
'float' : 'none',
 
'width' : 'auto'
 
})
 
// this ul will now be shrink-wrapped to longest li due to position:absolute
 
// so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
 
.end().end()[0].clientWidth / fontsize;
 
// add more width to ensure lines don't turn over at certain sizes in various browsers
 
emWidth += o.extraWidth;
 
// restrict to at least minWidth and at most maxWidth
 
if (emWidth > o.maxWidth) { emWidth = o.maxWidth; }
 
else if (emWidth < o.minWidth) { emWidth = o.minWidth; }
 
emWidth += 'em';
 
// set ul to width in ems
 
$ul.css('width',emWidth);
 
// restore li floats to avoid IE bugs
 
// set li width to full width of this ul
 
// revert white-space to normal
 
$LIs.css({
 
'float' : liFloat,
 
'width' : '100%',
 
'white-space' : 'normal'
 
})
 
// update offset position of descendant ul to reflect new width of parent
 
.each(function(){
 
var $childUl = $('>ul',this);
 
var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right';
 
$childUl.css(offsetDirection,emWidth);
 
});
 
});
 
 
});
 
};
 
// expose defaults
 
$.fn.supersubs.defaults = {
 
minWidth : 9, // requires em unit.
 
maxWidth : 25, // requires em unit.
 
extraWidth : 0 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
 
};
 
 
})(jQuery);
 
 
 
/*
 
== Superfish ==
 
* Superfish v1.4.8 - jQuery menu widget
 
* Copyright (c) 2008 Joel Birch
 
* Dual licensed under the MIT and GPL licenses
 
*/
 
 
 
;(function($){
 
$.fn.superfish = function(op){
 
 
 
var sf = $.fn.superfish,
 
c = sf.c,
 
$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
 
over = function(){
 
var $$ = $(this), menu = getMenu($$);
 
clearTimeout(menu.sfTimer);
 
$$.showSuperfishUl().siblings().hideSuperfishUl();
 
},
 
out = function(){
 
var $$ = $(this), menu = getMenu($$), o = sf.op;
 
clearTimeout(menu.sfTimer);
 
menu.sfTimer=setTimeout(function(){
 
o.retainPath=($.inArray($$[0],o.$path)>-1);
 
$$.hideSuperfishUl();
 
if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
 
},o.delay);
 
},
 
getMenu = function($menu){
 
var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
 
sf.op = sf.o[menu.serial];
 
return menu;
 
},
 
addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
 
 
return this.each(function() {
 
var s = this.serial = sf.o.length;
 
var o = $.extend({},sf.defaults,op);
 
o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
 
$(this).addClass([o.hoverClass,c.bcClass].join(' '))
 
.filter('li:has(ul)').removeClass(o.pathClass);
 
});
 
sf.o[s] = sf.op = o;
 
 
$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
 
if (o.autoArrows) addArrow( $('>a:first-child',this) );
 
})
 
.not('.'+c.bcClass)
 
.hideSuperfishUl();
 
 
var $a = $('a',this);
 
$a.each(function(i){
 
var $li = $a.eq(i).parents('li');
 
$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
 
});
 
o.onInit.call(this);
 
 
}).each(function() {
 
var menuClasses = [c.menuClass];
 
if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
 
$(this).addClass(menuClasses.join(' '));
 
});
 
};
 
 
 
var sf = $.fn.superfish;
 
sf.o = [];
 
sf.op = {};
 
sf.IE7fix = function(){
 
var o = sf.op;
 
if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
 
this.toggleClass(sf.c.shadowClass+'-off');
 
};
 
sf.c = {
 
bcClass    : 'sf-breadcrumb',
 
menuClass  : 'sf-js-enabled',
 
anchorClass : 'sf-with-ul',
 
arrowClass  : 'sf-sub-indicator',
 
shadowClass : 'sf-shadow'
 
};
 
sf.defaults = {
 
hoverClass : 'sfHover',
 
pathClass : 'overideThisToUse',
 
pathLevels : 1,
 
delay : 800,
 
animation : {opacity:'show'},
 
speed : 'normal',
 
autoArrows : true,
 
dropShadows : true,
 
disableHI : false, // true disables hoverIntent detection
 
onInit : function(){}, // callback functions
 
onBeforeShow: function(){},
 
onShow : function(){},
 
onHide : function(){}
 
};
 
$.fn.extend({
 
hideSuperfishUl : function(){
 
var o = sf.op,
 
not = (o.retainPath===true) ? o.$path : '';
 
o.retainPath = false;
 
var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
 
.find('>ul').hide().css('visibility','hidden');
 
o.onHide.call($ul);
 
return this;
 
},
 
showSuperfishUl : function(){
 
var o = sf.op,
 
sh = sf.c.shadowClass+'-off',
 
$ul = this.addClass(o.hoverClass)
 
.find('>ul:hidden').css('visibility','visible');
 
sf.IE7fix.call($ul);
 
o.onBeforeShow.call($ul);
 
$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
 
return this;
 
}
 
});
 
 
 
})(jQuery);
 
 
 
/*
 
== jQuery Tools ==
 
* jQuery Tools 1.2.2 - The missing UI library for the Web
 
* [tabs]
 
* http://flowplayer.org/tools/
 
*/
 
/* tabs */
 
(function(c){function p(d,a,b){var e=this,l=d.add(this),h=d.find(b.tabs),j=a.jquery?a:d.children(a),i;h.length||(h=d.children());j.length||(j=d.parent().find(a));j.length||(j=c(a));c.extend(this,{click:function(f,g){var k=h.eq(f);if(typeof f=="string"&&f.replace("#","")){k=h.filter("[href*="+f.replace("#","")+"]");f=Math.max(h.index(k),0)}if(b.rotate){var n=h.length-1;if(f<0)return e.click(n,g);if(f>n)return e.click(0,g)}if(!k.length){if(i>=0)return e;f=b.initialIndex;k=h.eq(f)}if(f===i)return e;
 
g=g||c.Event();g.type="onBeforeClick";l.trigger(g,[f]);if(!g.isDefaultPrevented()){o[b.effect].call(e,f,function(){g.type="onClick";l.trigger(g,[f])});i=f;h.removeClass(b.current);k.addClass(b.current);return e}},getConf:function(){return b},getTabs:function(){return h},getPanes:function(){return j},getCurrentPane:function(){return j.eq(i)},getCurrentTab:function(){return h.eq(i)},getIndex:function(){return i},next:function(){return e.click(i+1)},prev:function(){return e.click(i-1)}});c.each("onBeforeClick,onClick".split(","),
 
function(f,g){c.isFunction(b[g])&&c(e).bind(g,b[g]);e[g]=function(k){c(e).bind(g,k);return e}});if(b.history&&c.fn.history){c.tools.history.init(h);b.event="history"}h.each(function(f){c(this).bind(b.event,function(g){e.click(f,g);return g.preventDefault()})});j.find("a[href^=#]").click(function(f){e.click(c(this).attr("href"),f)});if(location.hash)e.click(location.hash);else if(b.initialIndex===0||b.initialIndex>0)e.click(b.initialIndex)}c.tools=c.tools||{version:"1.2.2"};c.tools.tabs={conf:{tabs:"a",
 
current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:false,history:false},addEffect:function(d,a){o[d]=a}};var o={"default":function(d,a){this.getPanes().hide().eq(d).show();a.call()},fade:function(d,a){var b=this.getConf(),e=b.fadeOutSpeed,l=this.getPanes();e?l.fadeOut(e):l.hide();l.eq(d).fadeIn(b.fadeInSpeed,a)},slide:function(d,a){this.getPanes().slideUp(200);this.getPanes().eq(d).slideDown(400,a)},ajax:function(d,a){this.getPanes().eq(0).load(this.getTabs().eq(d).attr("href"),
 
a)}},m;c.tools.tabs.addEffect("horizontal",function(d,a){m||(m=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){c(this).hide()});this.getPanes().eq(d).animate({width:m},function(){c(this).show();a.call()})});c.fn.tabs=function(d,a){var b=this.data("tabs");if(b)return b;if(c.isFunction(a))a={onBeforeClick:a};a=c.extend({},c.tools.tabs.conf,a);this.each(function(){b=new p(c(this),d,a);c(this).data("tabs",b)});return a.api?b:this}})(jQuery);
 
 
 
 
 
/*
 
Wikis függvények és segédletek ($.wiki)
 
*/
 
(function($){
 
  $.wiki =  {};
 
 
  /* $.wiki.contentSelector: visszaadja magát a szócikket tartalmazó
 
    elem szelektorát a skintől függően */
 
  if (skin == "modern") $.wiki.contentSelector = "#mw_contentholder";
 
  else if (skin == "standard" || skin == "nostalgia" || skin == "cologneblue") $.wiki.contentSelector = "#article";
 
  else $.wiki.contentSelector = "#bodyContent";
 
 
  /* Ajaxon keresztül lekéri a megadott oldalt opcionális paraméterekkel */
 
  $.wiki.getPage = function(settings) {
 
    if (typeof(settings.pageName) == "undefined" || settings.pageName == "")
 
      settings.error.call();
 
    var ajaxSettings = {
 
      url: $.wiki.wikiEntryLink(settings.pageName, (typeof(settings.params) == "undefined" ? {} : settings.params))
 
    }
 
    if (typeof(settings.async) != "undefined") ajaxSettings = $.extend(ajaxSettings, {async: settings.async});
 
    if (typeof(settings.success) != "undefined") ajaxSettings = $.extend(ajaxSettings, {success: settings.success});
 
    if (typeof(settings.error) != "undefined") ajaxSettings = $.extend(ajaxSettings, {error: settings.error});
 
    return $.ajax(ajaxSettings);
 
  };
 
 
  /* Ajaxon keresztül lekéri a megadott oldal nyers változatát opcionális további paraméterekkel */
 
  $.wiki.getPageRaw = function(settings) {
 
    if (typeof(settings.params) != "undefined")
 
      settings.params.action = "raw";
 
    else
 
      settings.params = {action: "raw"};
 
    return $.wiki.getPage(settings);
 
  };
 
 
  /* Egyszerű wikilink generálása lapnévből: http://hu.wikipedia.org/wiki/Pagename */
 
  $.wiki.wikiLink = function(page) {
 
    var prep = page.replace(/ /g, "_");
 
    return wgServer + wgArticlePath.replace(/\$1/g, prep);
 
  };
 
 
  /* Link a belépési ponthoz (index.php): http://hu.wikipedia.org/w/index.php?title=Pagename
 
    Opcionálisan további paraméterekkel
 
  */
 
  $.wiki.wikiEntryLink = function(page, args) {
 
    var prep = page.replace(/ /g, "_");
 
    prep = wgServer + wgScript + "?title=" + prep;
 
    $.each(args, function(key, value) {
 
      prep = prep + "&" + key + "=" + value;
 
    });
 
    return prep;
 
  }
 
})(jQuery);
 
 
 
/*
 
== Segédfüggvények ==
 
*/
 
 
 
window.$ = jQuery; // bugfix - $ valamiért nem látszik
 
 
 
/* Chrome sniffing */
 
var is_chrome = /Chrome/.test(navigator.userAgent);
 
 
 
/* kell a sablonmesternek */
 
var is_khtml = false;
 
 
 
function addLoadEvent(func) {
 
  $j(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
 
  }
 
}
 
 
 
/* A wikibits.js importScriptjének emulálása az új betöltőrendszer használatával */
 
function mwImportScript(page) {
 
  mw.loader.load(mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' +
 
    encodeURIComponent(page.replace(/ /g,'_')).replace(/%2F/ig,'/').replace(/%3A/ig,':') +
 
    '&action=raw&ctype=text/javascript');
 
}
 
 
 
$j.fn.log = function(msg) {
 
  if (!window.console || !console.log) return;
 
  if (msg) {
 
      if (typeof msg == 'string') {
 
        console.log('%s: %o', msg, this);
 
      } else {
 
        console.log('%o -> %o', this, msg);
 
      }
 
  } else {
 
      console.log(this);
 
  }
 
};
 
 
 
/*
 
== Kezdőlap RSS ==
 
*/
 
if (wgPageName == 'Kezdőlap') {
 
  $j(function addFeaturedRSS() {
 
    var feeds = {
 
      'kiemelt': 'Kiemelt szócikkek',
 
      'kiemelt-kep': 'Kiemelt képek',
 
      'evfordulok': 'Évfordulók'
 
    }
 
    for (i in feeds) {
 
      var url = 'http://feeds.feedburner.com/huwiki-' + i;
 
      $('head').append('<link href="'+url+'" title="'+feeds[i]+'" type="application/rss+xml" rel="alternate">');
 
    }
 
  });
 
}
 
 
 
if (wgTitle == wgMainPageTitle)
 
    $j(function () {
 
        if (wgNamespaceNumber == 0)
 
            addPortletLink('p-lang', 'http://meta.wikimedia.org/wiki/List_of_Wikipedias',
 
                    'Teljes lista', 'interwiki-completelist', 'A Wikipédiák teljes listája');
 
        var nstab = document.getElementById('ca-nstab-main');
 
        if (nstab && wgUserLanguage == 'hu') {
 
            while (nstab.firstChild) nstab = nstab.firstChild;
 
            nstab.nodeValue = 'Kezdőlap';
 
        }
 
    }
 
);
 
 
 
/*
 
== Cím elrejtése ==
 
*/
 
function hideArticleTitle() {
 
  if (document.getElementById("HideTitle")) {
 
    if (skin=="modern") return;
 
    var h1 = document.getElementsByTagName("h1")[0];
 
    if (h1) {
 
      h1.style.display = "none";
 
    }
 
    var siteSub = document.getElementById("siteSub");
 
    if (siteSub) {
 
      siteSub.style.display = "none";
 
    }
 
  }
 
}
 
 
 
/*
 
== Menük és tabsetek inicializálása ==
 
*/
 
 
 
function generateMenuLayout(desti, level) {
 
  if (level > 2) return 0; // max. 2 szint
 
  var curr = $("<ul></ul>");
 
  $("div", desti).each(function() {
 
    var cdiv = $(this);
 
    if (cdiv.hasClass("menuItem")) {
 
      $("<li>").html(cdiv.html()).appendTo(curr);
 
    } else {
 
      var ret = generateMenuLayout($("#wikiMenu-" + cdiv.attr("title")), level+1);
 
      if (ret != 0) {
 
        $("<li>").html(cdiv.html()).append(ret).appendTo(curr);
 
      }
 
    }
 
  });
 
  if (level == 0) {
 
    desti.after(curr);
 
    var destid = "menu-" + desti.attr("id").substring(10);
 
    curr.attr("id", destid)
 
        .addClass("sf-menu");
 
    desti.remove();
 
 
 
    if (mw.config.get('wikimenu.useCustomMenu', false) == true
 
        && wgUserName != null && curr.parents("#header-menu").length > 0)
 
    {
 
      $.wiki.getPageRaw({
 
        pageName: "User:" + wgUserName + "/Saját menü",
 
        async: false,
 
        success: function(data) {
 
          var items = data.split("\n");
 
          if (items.length == 0 || items.length == 1 && items[0] == "") return;
 
          var cmenu = $('<ul></ul>');
 
          var ccount = 0;
 
          for (var zs = 0; zs < items.length; zs++) {
 
            if (items[zs] == "" || items[zs].substring(0,1) != '#') continue;
 
            var foo = items[zs].substring(1);
 
            if (foo.indexOf("|") > -1) {
 
              var splitem = foo.split("|");
 
              $('<li><a href="' + $.wiki.wikiLink(splitem[0], false) + '">' + splitem[1] + '</a></li>').appendTo(cmenu);
 
            } else {
 
              $('<li><a href="' + $.wiki.wikiLink(foo, false) + '">' + foo + '</a></li>').appendTo(cmenu);
 
            }
 
            ccount++;
 
          }
 
          if (ccount > 0) {
 
            $('<li><a href="#">Saját</a></li>').append(cmenu).appendTo(curr);
 
          }
 
        }
 
      });
 
    }
 
    return destid;
 
  } else {
 
    return curr;
 
  }
 
}
 
 
 
$(function() {
 
  if (wgNamespaceNumber != 0) {
 
    /* Sima cím eltüntetése, ha a menü alatt van helyettesítő */
 
    if (wgAction != "edit" && wgAction != "submit" && $("#header-title").length > 0) {
 
      if (skin != "modern") {
 
        $("#firstHeading").css("display", "none");
 
        $("#siteSub").css("display", "none");
 
      }
 
      if ($("#contentSub").length > 0 && $("#mw-revision-info").length == 0)
 
        $("#contentSub").css("display", "none");     
 
    }
 
   
 
    /* Gombok */
 
    var bigButtons = $(".bigButton", $($.wiki.contentSelector));
 
    if (bigButtons.length > 0) {
 
      bigButtons.each(function() {
 
        var link = $("a:first", $(this));
 
        if (link.length > 0) {
 
          var curLink = link.attr("href");
 
          link.parent().html(link.html());
 
          $(this).css("cursor", "pointer")
 
                .wrap('<a class="buttonWrapperAnchor" href="' + curLink + '"></a>');
 
        }
 
      });
 
}
 
   
 
    /* Eligazítólapok */
 
    var eliItems = $(".eligazitoLap > .eligazitoElem", $($.wiki.contentSelector));
 
    if (eliItems.length > 0) {
 
      /* IE6 miaza:hover??-bugfix */
 
      if ($.browser.msie && $.browser.version == 6) {
 
        eliItems.hover(
 
          function() {
 
            $(this).addClass("eeHover");
 
          },
 
          function() {
 
            $(this).removeClass("eeHover");
 
          }
 
        );
 
      }
 
      eliItems.each(function() {
 
        var link = $(".eligazitoTovabb > a", $(this));
 
        if (link.length > 0) {
 
          var curLink = link.attr("href");
 
          link.parent().html(link.html());
 
          $(this).css("cursor", "pointer")
 
                .wrap('<a href="' + curLink + '" class="eligazitoWrapLink"></a>');
 
        }
 
      });
 
    }
 
   
 
    /* Tabok felépítése */
 
    $(".tabset-tabs", $($.wiki.contentSelector)).each(function() {
 
      var tabul = $("<ul></ul>");
 
      var curid = $(this).attr("id").substring(10);
 
      var tabCount = 0;
 
      $("#" + curid + "-content > div").each(function() {
 
        var cdiv = $(this);
 
        if (cdiv.hasClass("tab-nojs")) cdiv.removeClass("tab-nojs");
 
        if (cdiv.attr("title") != "") {
 
          $("<li></li>").html("<a>" + cdiv.attr("title") + "</a>").appendTo(tabul);
 
          tabCount++;
 
        } else {
 
          cdiv.remove();
 
        }
 
      });
 
      if (tabCount > 0) {
 
        $(this).after(tabul);
 
        tabul.attr("id", curid);
 
        tabul.addClass("tabset-tabs");
 
        tabul.tabs("#" + curid + "-content > div");
 
        tabul.trigger('tabsetReady');
 
      } else {
 
        $("#" + curid + "-content").remove();
 
      }
 
      $(this).remove();
 
    });
 
 
 
 
 
    /* Menük felépítése */
 
    if (mw.config.get('wikimenu.disabled', false) == false) {
 
      var menuRoots = $(".wikiMenu-rootContainer", $($.wiki.contentSelector));
 
      if (menuRoots.length > 0) {
 
        menuRoots.each(function() {
 
          var destid = generateMenuLayout($(this), 0);
 
          if (jQuery.browser.msie && jQuery.browser.version == 6) {
 
            $("#" + destid).superfish();
 
          } else {
 
            $("#" + destid).supersubs({
 
                minWidth:    12,  // minimum width of sub-menus in em units
 
                maxWidth:    27,  // maximum width of sub-menus in em units
 
                extraWidth:  2    // extra width can ensure lines don't sometimes turn over
 
                                  // due to slight rounding differences and font-family
 
            }).superfish();
 
          }
 
        });
 
      }
 
      $(".wikiMenu-container", $($.wiki.contentSelector)).remove();
 
    }
 
  }
 
});
 
 
 
/* Kapcsolódó lapok */
 
$j(function() {
 
  $j('.buborekGomb').each(function() {
 
    if (wgNamespaceNumber===0) return;
 
    var $this = $j(this);
 
    var contentDivSelector = '#' + $this.attr('id').replace(/^button-/, '') + '-content';
 
    var contentDiv = $j(contentDivSelector);
 
    var bodySelector = 'body';
 
    if (skin==='monobook') bodySelector = '#globalWrapper';
 
    $j(contentDivSelector).appendTo(bodySelector);
 
   
 
    var contentDivWidth = 0;
 
    $j.swap(contentDiv.get(0), {display: 'block'}, function() {
 
      contentDivWidth = $j(this).outerWidth();
 
    });
 
   
 
    function reposBuborek() {
 
      var contentDivLeft = $this.offset().left + contentDivWidth > $j(window).width()
 
          ? $this.offset().left + $this.outerWidth() - contentDivWidth
 
          : $this.offset().left;
 
      $j(contentDivSelector).css({
 
        position: 'absolute',
 
        top: $this.offset().top + $this.outerHeight(),
 
        left: contentDivLeft
 
      });
 
    }
 
   
 
    reposBuborek();
 
    $j(contentDivSelector).find('.buborekTitlebar').prepend(
 
      $j('<div>').addClass('buborekCloseButton')
 
                .html('x')
 
                .click(function() {
 
                  $this.removeClass('button-active');
 
                  contentDiv.stop().fadeTo(200, 0).removeClass('buborekVisible').hide();
 
                })
 
    );
 
    $this.click(function() {
 
      if(contentDiv.hasClass('buborekVisible')) {
 
        $this.removeClass('button-active');
 
        contentDiv.stop().fadeTo(200, 0).removeClass('buborekVisible').hide();
 
      } else {
 
        reposBuborek();
 
        $this.addClass('button-active');
 
        contentDiv.stop().show().fadeTo(200, 1).addClass('buborekVisible');
 
      }
 
    });
 
  });
 
});
 
 
 
/*
 
== Képannotációk ==
 
*/
 
 
 
if (wgNamespaceNumber != -1
 
    && wgAction && (wgAction == 'view' || wgAction == 'purge')
 
    && document.URL.search (/[?&]oldid=/) < 0
 
    && document.URL.search (/[?&]diff=/) < 0
 
    && mw.config.get('imageAnnotator.disabled', false) != true) {
 
  mwImportScript ('MediaWiki:Gadget-ImageAnnotator.js');
 
}
 
 
 
/*
 
== 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) {
 
  if (!element) return;
 
  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 ==
 
*/
 
 
 
mw.loader.load( 'http://meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js'
 
            + '&action=raw&ctype=text/javascript&dontcountme=s&smaxage=3600');
 
 
 
/*
 
== Képfeltöltés ==
 
*/
 
 
 
// Nincslicenc sablon beszúrása, ha a semmilyen sablon opciót választotta
 
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;
 
};
 
$j(ForceLicenseInstall);
 
 
 
// bugfix: lehessen az utolsó opciót is választani
 
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;
 
  }
 
}
 
$j(licenseSelectorEnableLastInstall);
 
 
 
// ne írja át a célfájlnevet forrásfájl kiválasztásakor, ha van wgDestFile paraméter
 
if (window.toggleFilenameFiller) {
 
  $j(toggleFilenameFiller);
 
}
 
 
 
/*
 
== Legördülő menü és extra gombok az edittools-ba ==
 
*/
 
 
 
if (document.URL.indexOf("action=edit") > 0 || document.URL.indexOf("action=submit") > 0 || (wgCanonicalNamespace == "Special" && wgCanonicalSpecialPageName == "Upload")) {
 
 
 
  function addCharSubsetMenu() {
 
    var forceAll = false;
 
    var specialchars = document.getElementById('specialchars');
 
    if (!specialchars) return;
 
    var menu = document.getElementById('charSubsetMenu');
 
    if (!menu) {
 
      menu = document.createElement('select');
 
      menu.id = 'charSubsetMenu';
 
      menu.style.display = 'inline';
 
      menu.onchange = function() {
 
        chooseCharSubset(menu.options[menu.selectedIndex].value);
 
      }
 
    } else { // személyreszabott menü teljesre váltásakor
 
      forceAll = true;
 
      var menuChildNodes = [];
 
      for (var i = 0; i < menu.childNodes.length; i++) {
 
        menuChildNodes.push(menu.childNodes[i]);
 
      }
 
      for(var i = 0; i < menuChildNodes.length; i++) {
 
        menu.removeChild(menuChildNodes[i]);
 
      }
 
    }
 
   
 
    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' || forceAll) {
 
      for (var i = 0; i < l.length; i++) {
 
        menu.appendChild(specialCharacterTypes[l[i].title]);
 
      }
 
    } else { // személyreszabott menü
 
      for(var i = 0; i < allowedSpecialCharacterTypes.length; i++) {
 
        if(typeof(specialCharacterTypes[allowedSpecialCharacterTypes[i]]) != 'undefined') {
 
          menu.appendChild(specialCharacterTypes[allowedSpecialCharacterTypes[i]]);
 
        }
 
      }
 
      var showAll = document.createElement('option');
 
      showAll.appendChild(document.createTextNode("több..."));
 
      showAll.style.fontStyle = 'italic';
 
      showAll.value = 999;
 
      menu.appendChild(showAll);
 
    }
 
   
 
    if (forceAll) { // select visszaállítása az aktív karakterkészletre
 
      var value = -1;
 
      var l = specialchars.getElementsByTagName('p');
 
      for (var i = 0; i < l.length ; i++) {
 
        if (l[i].style.display == 'inline') {
 
          value = i;
 
          break;
 
        }
 
      }
 
      for (var i = 0; i < menu.options.length; i++) {
 
        if (menu.options[i].value == value) {
 
          menu.selectedIndex = i;
 
          break;
 
        }
 
      }
 
    } else { // első karakterkészlet aktiválása
 
      chooseCharSubset(menu.options[0].value);
 
    }
 
    specialchars.insertBefore(menu, specialchars.firstChild);
 
  }
 
  function chooseCharSubset(s) {
 
    if (s == 999) { // "több..." opció
 
      addCharSubsetMenu();
 
      return;
 
    }
 
    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": "<s>",
 
      "tagClose": "</s>",
 
      "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": "<small>",
 
      "tagClose": "</small>",
 
      "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": "<tt>",
 
      "tagClose": "</tt>",
 
      "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": "<ref>",
 
      "tagClose": "</ref>",
 
      "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": "{" + "{források}}",
 
      "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 = "– ~~" + "~~";
 
  }
 
 
 
  $j(addCharSubsetMenu);
 
  $j(InsertButtonsToToolBar);
 
}
 
 
 
/*
 
== Extra gombok Vector alatt ==
 
*/
 
 
 
//mwImportScript("Szerkesztő:Tgr/common.js");
 
 
// UsabilityInitiative toolbar customization
 
if ( typeof $j != 'undefined' && typeof $.wikiEditor != "undefined" ) {
 
  $j( function() {
 
    $j( '#wpTextbox1' ).bind( 'wikiEditor-toolbar-buildSection-main', function( event, section ) {
 
      if (wgUserLanguage=='hu') {
 
        // change bold/italic icon
 
        var tools = section.groups.format.tools;
 
        if ( !( 'hu' in tools.bold.icon ) ) {
 
          tools.bold.icon['hu'] = 'format-bold-F.png'; // no need for full URL because this one exists in default Vector icon set
 
        }
 
        if ( !( 'hu' in tools.italic.icon ) ) {
 
          tools.italic.icon['hu'] = 'http://upload.wikimedia.org/wikipedia/commons/6/6a/Toolbaricon_italic_D.png';
 
        }
 
      }
 
      // change signature to en dash
 
      section.groups.insert.tools.signature.action.options.post = '– ~~' + '~~';
 
    });
 
    $j( '#wpTextbox1' ).bind( 'wikiEditor-toolbar-buildSection-advanced', function( event, section ) {
 
      // localized redirect text
 
      section.groups.insert.tools.redirect.action.options.pre= '#ÁTIRÁNYÍTÁS [[';
 
    });
 
 
    // special characters
 
    $j( '#wpTextbox1' ).bind( 'wikiEditor-toolbar-buildSection-characters', function( event, section ) {
 
      var paren = function(left, right) {
 
        return { label: left + right, action: { type: 'encapsulate', options: { pre: left, post: right } } };
 
      };
 
      var pages = {
 
        basic: {
 
          layout: 'characters',
 
          label: 'Alap',
 
          characters: [ 'á', 'é', 'í', 'ó', 'ö', 'ő', 'ú', 'ü', 'ű', 'Á', 'É', 'Í', 'Ó', 'Ö', 'Ő', 'Ú', 'Ü', 'Ű',
 
            '~', '|', '#', paren('„', '”'), paren('»', '«'), paren('’', '’'), '’', '–', '…', paren('<', '>'), '°', '‰',
 
            '×', '→', '∅', 'µ', '²', '³', '½', '⅓', '⅔', '¼', '¾', '€', '§', '†', '‡', '©', '®', '•', '·', '&nbsp;', '‑' ]
 
        }
 
      };
 
      for (i in section.pages) {
 
        pages[i] = section.pages[i];
 
      }
 
      section.pages = pages;
 
    });
 
  });
 
}
 
 
 
 
 
/*
 
== É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 += '<a href="javascript:insertText(loginbox, \'' + hunchars[i] + '\')">' + hunchars[i] + '</a> ';
 
      }
 
   
 
      loginchars.innerHTML += str;
 
      loginchars.style.display = "block";
 
    }
 
  }
 
  $j(installLoginChars);
 
}
 
 
 
/*
 
== Becsukható <div> ==
 
*/
 
 
 
// ============================================================
 
// 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)
 
            var NavLength = NavFrame.childNodes.length;    //Menet közben valamiért bekerül a végére egy undefined gyerek
 
            for(
 
              var j=0;
 
              j < NavLength;
 
              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($j.client.profile().layout == "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($j.client.profile().layout == "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) $j( 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:
 
// <div id="RealTitleBanner">  ... <span id="RealTitle">title</span> ... </div>
 
// 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 = /</.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 (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;
 
  }
 
 
 
  $j(fixArticleTitle);
 
}
 
 
 
/*
 
== IRC login ==
 
*/
 
 
 
// this script looks for the element with id "irclogon", and replaces its contents
 
// with a login form that redirects to the Mibbit 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="get" action="http://webchat.freenode.net/" target="_blank" name="loginform"><input type="hidden" name="channels" value="#wikipedia-hu"/><input type="hidden" name="prompt" value="0"/><input type="hidden" name="nick" value="' + nickify(wgUserName) + '"/><input type="submit" value="Belépés"/></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, '');
 
    if(s == '') {
 
      return "badname" + Math.floor(Math.random()*100);
 
    }
 
    return s;
 
  }
 
 
  $j(loadLoginForm);
 
}
 
 
 
/*
 
== Információs sablon beillesztése a szövegdobozba feltöltéskor, amennyiben az üres ==
 
*/
 
 
 
function insertInfoTemplate() {
 
  var editbox = document.getElementById('wpUploadDescription');
 
  if (!editbox)            return;
 
  if (editbox.value != '') return;
 
  if (location.href.match(/wpForReUpload=1/)) return; // új változat feltöltésekor a szövegmező szerkesztési összefoglalóként funkcionál
 
  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"
 
                + "}}";
 
}
 
 
 
$j(insertInfoTemplate);
 
 
 
/*
 
== 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;
 
// (minus sign)([pound dollar euro yen currency]|cents)
 
} else if ( /(^([-\u2212] *)?[\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] );
 
if( keyText === undefined ) {
 
keyText = '';
 
}
 
var oldIndex = ( reverse ? -j : j );
 
var preprocessed = preprocessor( keyText.replace(/^[\s\xa0]+/, '').replace(/[\s\xa0]+$/, '') );
 
 
 
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 = '<img src="' + ts_image_path + ts_image_down + '" alt="&darr;"/>';
 
newRows.reverse();
 
span.setAttribute( 'sortdir', 'up' );
 
} else {
 
arrowHTML = '<img src="' + ts_image_path + ts_image_up + '" alt="&uarr;"/>';
 
span.setAttribute( 'sortdir', 'down' );
 
}
 
 
 
for ( var i = 0; i < staticRows.length; i++ ) {
 
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 = '<img src="' + ts_image_path + ts_image_none + '" alt="&darr;"/>';
 
}
 
span.innerHTML = arrowHTML;
 
 
 
if ( ts_alternate_row_colors ) {
 
ts_alternate( table );
 
}
 
}
 
 
 
 
 
/*
 
== A Képdia sablon 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="&nbsp;";
 
      }
 
      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="&nbsp;";
 
      }
 
      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";
 
    }
 
  }
 
}
 
 
$j(kepDia);
 
 
 
/*
 
== Knávom, azaz a kínai nevek átírását váltogató mechanika ==
 
*
 
* [[Sablon:Kínai]] stb.
 
*/
 
mwImportScript('User:Chery/kínai.js');
 
 
 
/*
 
== Kéthasábos forráslista kikapcsolása, ha <4 forrás van ==
 
*/
 
 
 
if ($j.client.profile().layout == "gecko" || $j.client.profile().layout == "webkit" || $j.client.profile().layout == "presto") {
 
  $j(function dynamicMultiColumn() {
 
    $('ol.references').each(function() {
 
      if ($(this).find('li').length < 4) {
 
        $(this).add($(this).parent().parent()).each(function() {
 
          this.style.columnCount = 1;
 
          this.style.MozColumnCount = 1;
 
          this.style.WebkitColumnCount = 1;
 
        });
 
      }
 
    });
 
  });
 
}
 
 
 
 
 
/*
 
== Keresési kifejezések naplózása névtelenül a Squidek által ==
 
*/
 
 
 
// This script is needed for (anonymously) logging search terms by our Squids!
 
// The search URL will contain the search term,
 
// please modify retroactively at [[wikt:de:MediaWiki:If-search.js]];
 
// rather IMPORT this script; example: [[wikt:de:MediaWiki:If-search.js/import]].
 
 
// You may have to adapt this?
 
function $inp(ID) {
 
  return $("input", $("#" + ID)).get(0);
 
}
 
 
function tfSearch(f,i) {
 
  if ($("#" + f).length > 0) {
 
    $("#" + f).submit(function() {
 
      SubSearch(f, i, '/');
 
    });
 
  }
 
}
 
$(document).ready(function() {
 
  tfSearch("searchform","searchInput");
 
  tfSearch("search","searchText");
 
  tfSearch("powersearch","powerSearchText");
 
  tfSearch("bodySearch","bodySearchIput");
 
  if ($("#searchform").attr("action").indexOf(wgScript) > -1) {
 
    oSEAp = $($inp("searchform")).val();
 
  } else {
 
    oSEAp = $("#searchform").attr("action").replace(/^.*\/([^\/]+)$/, "$1");
 
}
 
});
 
 
 
function SubSearch(f,i,x) {
 
  if ($("#" + i).val() == "") {x="";}
 
  $("#" + f).attr("action", wgScriptPath+"iki/"+oSEAp+x+$("#" + i).val());
 
  if ($("input[name='title']", $("#" + f)).length > 0) {
 
    $("input[name='title']", $("#" + f)).eq(0).remove();
 
  }
 
}
 
 
 
/*
 
== Qcz's Userpage Utilities v0.9.1 ==
 
* jQuery kell hozzá.
 
* Licenc: GPLv3
 
*/
 
 
 
/*
 
* Visszaadja, hogy a jelenlegi lap névtere a tiltott névterek közé tartozik-e
 
*/
 
 
function isDeniedNamespace() {
 
  // nem akarjuk, hogy ahol nem kell, ott címet lehessen cserélni vagy ikont lehessen pakolni
 
  if (wgNamespaceNumber == 0 || wgNamespaceNumber == 1 || // fő névtér és vitája
 
      wgNamespaceNumber == 6 || wgNamespaceNumber == 7 || // kép és vitája
 
      wgNamespaceNumber == 10 || wgNamespaceNumber == 11 || // sablon és vitája
 
      wgNamespaceNumber == 14 || wgNamespaceNumber == 15 || // kategória és vitája
 
      wgNamespaceNumber == 101 // portálvita
 
    )
 
  {
 
    return true;
 
  } else {
 
    return false;
 
  }
 
}
 
 
/*
 
* Ikonok elrendezése a cím mellé, ablakátméretezés esetén újrapozícionálás
 
* az engedélyezett névterekbe tartozó lapokon (lásd az isDeniedNamespace függvényt)
 
*/
 
$(document).ready(function() {
 
  if (isDeniedNamespace())
 
    return;
 
  var sarokIcons = [];
 
 
  /* ikonok repozícionálása */
 
  function reposIcons() {
 
    if (sarokIcons.length == 0) return;
 
    var offset = $('#firstHeading').offset();
 
    var top = offset.top;
 
    var maxheight = $('#firstHeading').height();
 
    var right = offset.left + $('#firstHeading').width();
 
    for (var i = sarokIcons.length -1; i > -1; i--) {
 
      var thisTop = (sarokIcons[i].height > maxheight ?
 
                  top - (sarokIcons[i].height - maxheight) / 2 :
 
                  top + maxheight/2 - sarokIcons[i].height / 2);
 
      $('#sarokikon' + i)
 
        .css('top', (thisTop < 0 ? 0 : thisTop))         
 
        .css('left', right - sarokIcons[i].width);
 
      right = right - sarokIcons[i].width - 5;
 
    }
 
  };
 
 
  var sarokIconSpans = $('.sarokikon');
 
  if (sarokIconSpans.length == 0) return;
 
  sarokIconSpans.each(function() {
 
    // ugye a div fogja magát és kitolja 100%-ra a width-ét, így nem tudjuk mérni
 
    // a spannál meg a szöveg height-ű lesz egy képet tartalmazó span-is, még ha nagyobb is
 
    // ezért először inline lemérjük a div width-ét
 
    // majd elvesszük az inline css-osztályt, és lemérjük a height-et
 
    var xwidth = $(this).width();
 
    $(this).removeClass('sarokikon');
 
    var xheight = $(this).height();
 
    sarokIcons.push({
 
      html: $(this).html(),
 
      height: xheight,
 
      width: xwidth
 
    });
 
    $(this).remove();
 
  });
 
  if (sarokIcons.length > 0) {
 
    var offset = $('#firstHeading').offset();
 
    var right = offset.left + $('#firstHeading').width();
 
    for (var i = sarokIcons.length -1; i > -1; i--) {
 
      var iconDiv = $('<div></div>')
 
        .addClass('sarokikon_fenn')
 
        .attr('id', 'sarokikon' + i)
 
        .html(sarokIcons[i].html)
 
        .css({
 
          position: 'absolute',
 
          width: sarokIcons[i].width,
 
          height: sarokIcons[i].height,
 
          zIndex: 99
 
      });
 
      switch (skin) {
 
          case "monobook":
 
              iconDiv.appendTo('#globalWrapper');
 
              break;
 
          case "vector":
 
              iconDiv.css('font-size', '0.8em');
 
              iconDiv.appendTo('body');
 
              break;
 
          default:
 
              iconDiv.appendTo('body');
 
              break;
 
      }
 
      right = right - sarokIcons[i].width - 5;
 
    }
 
    reposIcons();
 
 
    var resizeTimer = null;
 
    $(window).bind('resize', function() {
 
        if (resizeTimer) clearTimeout(resizeTimer);
 
        resizeTimer = setTimeout(reposIcons, 100);
 
    });   
 
  }
 
});
 
 
/*
 
* Cím és alcím cseréje az engedélyezett névterekbe
 
* tartozó lapokon (lásd az isDeniedNamespace függvényt)
 
*/
 
$(document).ready(function() {
 
  if (wgAction != "view" || isDeniedNamespace())
 
    return;
 
  if ($('#sajatcim').length > 0) {
 
    if ($('#sajatcim').hasClass('nincsszerk') == false &&
 
          $('#firstHeading > .editsectionmoved').length > 0) {
 
      var movededit =
 
          $('<div>').append(
 
            $("#firstHeading > .editsectionmoved")
 
            .eq(0).clone()
 
          ).html();
 
      $('#firstHeading').html($('#sajatcim').html() + ' ' + movededit);
 
    } else {
 
      $('#firstHeading').html($('#sajatcim').html());
 
    }
 
    /* a $('title') nem megy IE8 (meg gondolom a korábbiak) alatt */
 
    document.title = $('#sajatcim').html().replace(/<\/?[^>]+>/gi, '') + ' - Wikipédia';
 
    $('#sajatcim').remove();
 
  }
 
  // alcímet csak a júzernévtérben cserélgessünk
 
  if (!(wgNamespaceNumber == 2 || wgNamespaceNumber == 3)) return;
 
  if ($('#sajatalcim').length > 0 && $('#siteSub').length > 0) {
 
    $('#siteSub').html($('#sajatalcim').html());
 
    $('#sajatalcim').remove();
 
  }
 
});
 
 
 
/*
 
* Virtuális kategóriák összegyűjtése és megjelenítése az igazi kategóriák mögött a szerkesztői lapokon
 
* TODO: kategória hozzáadása, ha nincs kat.
 
*/
 
$(document).ready(function() {
 
  if (wgAction == "view" && wgNamespaceNumber == 2 && $('#mw-normal-catlinks').length > 0 && $('.kategoria').length > 0) {
 
    var catlinksA = $('<div>').append(
 
                      $('#mw-normal-catlinks > a')
 
                      .eq(0).clone()
 
                    ).html();
 
    var oldCats = [];
 
    $('#mw-normal-catlinks > span').each(function() {
 
      oldCats.push(   
 
        $('<div>').append(
 
          $(this)
 
          .eq(0).clone()
 
        ).html()
 
 
      );
 
    });
 
    var catOutput = catlinksA + ': ';
 
    for (var i = 0;i<oldCats.length;i++) {
 
      catOutput = catOutput + oldCats[i];
 
      if (i < oldCats.length -1)
 
          catOutput = catOutput + ' | ';
 
    }
 
    $('.kategoria').each(function() {
 
        catOutput = catOutput + ' | ' +
 
            $('<div>').append(
 
              $('<a>').attr('href', '#globalWrapper').html($(this).html())
 
            ).html();
 
        $(this).remove();
 
    });
 
    $('#mw-normal-catlinks').html(catOutput);
 
  }
 
});
 
 
var disableUserFonts = false;
 
var disableUserBackgrounds = false;
 
 
 
/*
 
* Betűtípus lecserélése szerkesztői lapokon
 
*/
 
 
 
$(document).ready(function() {
 
  if (wgAction == "view" && !disableUserFonts && (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) && $('#betutipus').length > 0) {
 
    var userFont = $('#betutipus').html();
 
    $('#firstHeading').css('font-family', userFont);
 
    $('#bodyContent').css('font-family', userFont);
 
    $('#betutipus').remove();
 
  }
 
});
 
 
 
/*
 
* Háttérszín lecserélése szerkesztői lapokon
 
*/
 
 
 
$(document).ready(function() {
 
  if (wgAction == "view" && !disableUserBackgrounds && (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) && $('#hatterszin').length > 0) {
 
    $('#content').css('background-color', $('#hatterszin').html());
 
    $('#hatterszin').remove();
 
  }
 
});
 
 
 
/*
 
== Erőforrástakarékos üzenet a TranslateWikin való MediaWiki-felület-fordításra ==
 
*/
 
$(document).ready(function() {
 
  if (wgNamespaceNumber == 8) {
 
    $('<div></div>')
 
      .addClass('editwarning')
 
      .addClass('plainlinks')
 
      .addClass('translateWikiMessage')
 
      .html('<b>Ha olyan üzenetet fordítasz, amely nem Wikipédia-specifikus, akkor azt a <a href="http://www.translatewiki.net" class="external text" style="color: #002bb8;" title="http://www.translatewiki.net" rel="nofollow">Translatewikiben</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 Translatewikiben" rel="nofollow">→ezen üzenet megtekintése a Translatewikiben</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 Translatewikiben" rel="nofollow" style>szerkesztés</a>)')
 
      .appendTo($('#siteSub'));
 
  }
 
});
 
 
 
/*
 
== Kinyitható fejezetek az új infoboxokra specializálva ==
 
*/
 
 
 
$(document).ready(function() {
 
  var ibSectionLinkClick = function(e) {
 
    $this = $(e.target);
 
    var $$id = $this.attr("id").substring(12);
 
    var $parentInfobox = $this.closest('table.ujinfobox');
 
    var $infobar = $("tr.nyitasinfo-" + $$id, $parentInfobox);
 
   
 
    if ($this.hasClass("becsukva")) {
 
      $("tr.csoport-" + $$id, $parentInfobox).each(function() {
 
        $(this).css("display", "");
 
      });
 
      $this.html(NavigationBarHide)
 
          .removeClass("becsukva");
 
      if ($infobar.length > 0) {
 
        $infobar.css("display", "none");
 
      }
 
    } else {
 
      $("tr.csoport-" + $$id, $parentInfobox).each(function() {
 
        $(this).css("display", "none");
 
      });
 
      $this.html(NavigationBarShow)
 
          .addClass("becsukva");
 
      if ($infobar.length > 0) {
 
        $infobar.css("display", "");
 
      }
 
    }
 
    return false;
 
  }
 
 
  $('.nyitolink', $('#bodyContent')).each(function() {
 
    var $this = $(this);
 
    var $$id = $this.attr("id").substring(10);
 
    var $link =
 
      $('<a>').attr("href", "#")
 
              .attr("id", "nyitolink-a-" + $$id)
 
              .css("color", $this.closest("td").css("color"))
 
              .click(ibSectionLinkClick);
 
    if ($this.hasClass("becsukva")) {
 
      $link.html(NavigationBarShow)
 
          .addClass("becsukva");
 
      var $parentInfobox = $this.closest('table.ujinfobox');
 
      $("tr.csoport-" + $$id, $parentInfobox).each(function() {
 
        $(this).css("display", "none");
 
      });
 
      var $infobar = $("tr.nyitasinfo-" + $$id, $parentInfobox);
 
      if ($infobar.length > 0) {
 
        $infobar.css("display", "");
 
      }
 
    } else {
 
      $link.html(NavigationBarHide);
 
    }
 
    $link.appendTo($this);
 
  });
 
});
 
 
 
/*
 
== Pozíciós térkép nagyító ==
 
*/
 
 
 
function poziciosTerkepInit() {
 
  var boxes = getElementsByClassName(document, "poziciosTerkepDoboz");
 
  for (var i=0; i<boxes.length; ++i){
 
      try{
 
        var inner = getElementsByClassName(boxes[i], "poziciosTerkepBelso")[0];
 
        if (inner.getElementsByTagName("img")[0].src.indexOf("/thumb/") == -1) return false;
 
        if ( inner.getElementsByTagName("img")[1] && inner.getElementsByTagName("img")[1].alt == "Háttér"
 
          && inner.getElementsByTagName("img")[1].src.indexOf("/thumb/") == -1)
 
            return false;
 
        var innerA = inner.getElementsByTagName("a")[0];
 
        innerA.onclick = function() {poziciosTerkepOpen(this); return false;}
 
        innerA.style.cursor = "move";
 
      }catch(e){}/*ha nincs meg, akkor nincs értelme továbbmenni*/
 
  }
 
 
 
  function getElementsByClassName(node, cl){
 
      if (node.getElementsByClassName)
 
        return node.getElementsByClassName(cl);
 
 
 
      var nodes = [];
 
      var elem = node.getElementsByTagName('DIV');
 
      for (var i = 0; i < elem.length; i++) {
 
        if (new RegExp('\\b'+cl+'\\b').test(elem[i].className))
 
            nodes.push(elem[i]);
 
      }
 
      return nodes;
 
  }
 
}
 
 
 
 
 
function poziciosTerkepOpen(sender) {
 
 
 
  //Kicsi pozíciós térkép megkeresése
 
  var outer = sender.parentNode;
 
  while (outer.className != "poziciosTerkepBelso") {
 
      outer = outer.parentNode;
 
  }
 
 
 
  //Pozíciós térkép átmásolása
 
  var newDiv = outer.cloneNode(true);
 
 
 
  var newImg = new Array();
 
  newImg[0] = newDiv.getElementsByTagName("img")[0];
 
  newImg[0].title = newImg[0].src.match(/\/.\/..\/(.*\.[a-zA-z]{3,4})\/[^\/]*$/)[1];
 
  if (newDiv.getElementsByTagName("img")[1] && newDiv.getElementsByTagName("img")[1].alt == "Háttér"){
 
      newImg[1] = newDiv.getElementsByTagName("img")[1];
 
      newImg[1].title = newImg[1].src.match(/\/.\/..\/(.*\.[a-zA-z]{3,4})\/[^\/]*$/)[1];
 
  }
 
 
 
  //A kép eredeti méreteinek lekérdezése
 
  for(var i=0; i<newImg.length; ++i){
 
      if (newImg[i].title.match(/\.[a-zA-z]{3,4}$/) != ".svg") {
 
        var poziciosTerkepAjax = sajax_init_object();
 
        if ( ! poziciosTerkepAjax ) return false;
 
        var url = wgServer + wgScriptPath + '/api.php' + "?action=query&format=xml&titles=Image:"+newImg[i].title+"&prop=imageinfo&iiprop=size";
 
        poziciosTerkepAjax.onreadystatechange = function () {
 
            if (poziciosTerkepAjax.readyState != 4)
 
              return false;
 
            var res = poziciosTerkepAjax.responseText;
 
            var imgWidth  = res.match(/width=\"([0-9]*)\"/)[1];
 
            var imgHeight = res.match(/height=\"([0-9]*)\"/)[1];
 
            if (poziciosTerkepKesz && imgWidth < newWidth) {
 
              for(var j=0; j<newImg.length; ++j){
 
                  newImg[j].width = imgWidth;
 
                  newImg[j].height= imgHeight;
 
                  if (newImg[j].title.match(/\.[a-zA-z]{3,4}$/) != ".svg")
 
                    newImg[j].src = newImg[j].src.replace(/thumb/, "").replace(/\/[0-9]*px-.*\.[a-zA-z]{3,4}$/, "");
 
                  newDiv.style.width = imgWidth+"px";
 
              }
 
            }
 
        };
 
        poziciosTerkepAjax.open('GET', url, true);
 
        poziciosTerkepAjax.send(null);
 
      }
 
  }
 
 
 
  //Méretek meghatározása
 
  var oldWidth = outer.clientWidth;
 
  var oldHeight = outer.clientHeight;
 
  var newWidth  = Math.round(document.getElementsByTagName("html")[0].clientWidth  * 0.90 );
 
  var newHeight = Math.round(document.getElementsByTagName("html")[0].clientHeight * 0.95 );
 
  if (oldHeight/oldWidth*newWidth > newHeight){
 
      newWidth = Math.round(oldWidth/oldHeight*newHeight);
 
  }else{
 
      newHeight = Math.round(oldHeight/oldWidth*newWidth);
 
  }
 
 
 
  for(var i=0; i<newImg.length; ++i){
 
      newImg[i].width=newWidth;
 
      newImg[i].height=newHeight;
 
      newImg[i].src = newImg[i].src.replace(new RegExp(oldWidth+"px\-", "g"), newWidth+"px-");
 
      newImg[i].parentNode.style.cssText = "cursor:hand";
 
  }
 
 
 
  newDiv.getElementsByTagName("span")[0].style.cssText =
 
      "padding: 1px; font-size:12pt;"+
 
      "text-shadow: -1px -1px 1px white, -1px 0px 1px white, -1px 1px 1px white, 0px -1px 1px white, "+
 
                    "0px 1px 1px white, 1px -1px 1px white, 1px 0px 1px white, 1px 1px 1px white;";
 
 
 
  newDiv.id="poziciosTerkepNagyitott";
 
  newDiv.style.cssText =
 
      "width: "+newWidth+"px; position: absolute; background-color:white; z-index:102;"
 
      +"top: "+ Math.round(((window.innerHeight || document.getElementsByTagName("html")[0].clientHeight)
 
                -newHeight)/2
 
                + ((document.body.scrollTop > 0) ? document.body.scrollTop : document.documentElement.scrollTop))+"px;"
 
      +"left: "+ Math.round(((window.innerWidth || document.getElementsByTagName("html")[0].clientWidth)
 
                -newWidth) /2) +"px;"
 
      +"border:solid 1px black;box-shadow:0px 0px 20px #C0C0C0; border-radius: 3px;"
 
      +"-moz-box-shadow:0px 0px 20px #C0C0C0; -moz-border-radius: 3px;";
 
 
 
  var closeButton = document.createElement("div");
 
  closeButton.style.cssText = "position:absolute;text-align:right;width:100%;z-index:103;";
 
  closeButton.innerHTML = "<img style='padding:4px;' onclick='poziciosTerkepClose()' "
 
      +"src='http://upload.wikimedia.org/wikipedia/commons/d/d4/Button_hide.png' />";
 
  newDiv.insertBefore(closeButton, newDiv.firstChild);
 
 
 
  //Kirakjuk
 
  var bodyContent = document.body;//getElementById("bodyContent");
 
  bodyContent.insertBefore(newDiv, bodyContent.firstChild);
 
 
 
  var poziciosTerkepKesz = true;
 
 
 
 
 
  //Háttér elsötétítése
 
  document.body.style.height = "auto";
 
  var scrollHeight = document.body.scrollHeight || document.body.offsetHeight;
 
  document.body.style.height = "100%";
 
  var opacityDiv = document.createElement("div");
 
  opacityDiv.id="poziciosTerkepOpacity";
 
  opacityDiv.onclick = function() {poziciosTerkepClose();};
 
  opacityDiv.style.cssText =
 
      "position:absolute; top:0; background:black; opacity:0.3; filter:alpha(opacity=70);"+
 
      "width:100%; height:"+(scrollHeight+20)+"px;z-index:101";
 
  document.body.appendChild(opacityDiv);
 
 
 
}
 
 
 
function poziciosTerkepClose() {
 
  document.body.removeChild(document.getElementById("poziciosTerkepNagyitott"));
 
  document.body.removeChild(document.getElementById("poziciosTerkepOpacity"));
 
}
 
 
 
$j(function() {
 
  poziciosTerkepInit();
 
});
 
 
 
/*
 
== Kategóriák részletes adatai ==
 
*/
 
 
 
if (wgUserName != null){
 
  $j(function() {
 
      $j('#mw-subcategories .CategoryTreeItem>span:last-child').each(function(){
 
        var res = $j(this).attr('title').match(/(egy|\d+) .* (egy|\d+) .* (egy|\d+) .*/);
 
        if (res){
 
            var strToInt = function(s) {return (isNaN(s) ? 1 : s);}
 
            $j(this).html(
 
              '(<abbr>'
 
              + strToInt(res[1]) + ' k'
 
              + ', ' + strToInt(res[2]) + ' l'
 
              + ((res[3] > 0) ? ', ' + strToInt(res[3]) + ' f' : '')
 
              + '</abbr>)'
 
            );
 
        }
 
      })
 
  });
 
}
 
 
 
/*
 
== Flagrev bugfix ==
 
*/
 
 
 
$j(function() {
 
//  $('#mw-fr-revisiontag').css("display", "block");
 
  $('#mw-fr-revisiontoggle').attr('title', null);
 
});
 
 
 
/*
 
== Figyelmeztető ikon a kezdőlap vitáján, ha hiányzó allapok vannak ==
 
*/
 
 
 
if (wgPageName == 'Vita:Kezdőlap') {
 
  $j('#header-container').bind('tabsetReady', function(e) {
 
      $(this).log(e);return;
 
      if ($j.trim($j('#urgent-tasks').text())) {
 
        $j('#ts-headerTabs li a:contains("Tennivalók")').append(
 
            $j('<img src="http://upload.wikimedia.org/wikipedia/commons/c/c0/Exclamation.png"/>').css('margin-left', '5px')
 
        );
 
      }
 
  });
 
}
 
 
 
/*
 
== WikEd ki/be kapcsoló függvények ==
 
*/
 
 
 
// switch off wikEd frame
 
function switchOffWikEd() {
 
    if (typeof(wikEd) != 'undefined' && wikEd.useWikEd == true) {
 
        var marker_start = "####wiked_cursor_marker_start####";
 
        var marker_end = "####wiked_cursor_marker_end####";
 
        try{
 
            insertTags(marker_start, marker_end, "");
 
        }catch(err){
 
        }
 
        wikEd.UpdateTextarea();
 
        wikEd.SetEditArea(false);
 
        wikEd.useWikEd = false;
 
        wikEd.SetPersistent('wikEdUseClassic', '1', 0, '/');
 
        wikEd.switchOff = true;
 
 
        var tb = document.getElementById("wpTextbox1");
 
        var tbSelectionStart = tb.value.indexOf(marker_start);
 
        tb.value = tb.value.replace(marker_start,"");
 
        var tbSelectionEnd  = tb.value.indexOf(marker_end);
 
        tb.value = tb.value.replace(marker_end,"");
 
        tb.selectionStart = tbSelectionStart;
 
        tb.selectionEnd  = tbSelectionEnd;
 
    }
 
}
 
 
/* switch on wikEd frame */
 
function switchOnWikEd() {
 
    if (typeof(wikEd) != 'undefined' && typeof(wikEd.switchOff) != 'undefined' && wikEd.switchOff === true) {
 
        wikEd.UpdateFrame();
 
        wikEd.SetEditArea(true);
 
        wikEd.useWikEd = true;
 
        wikEd.SetPersistent('wikEdUseClassic', '0', 0, '/');
 
        wikEd.ExecuteHook(wikEd.config.frameHook);
 
        wikEd.switchOff = false;
 
    }
 
}
 

19:06, 26 जून 2022 के समय का अवतरण

/* यहां लिखी गई जावास्क्रीप्ट सभी सदस्योंके लिये इस्तेमाल में लाई जायेगी। */