MediaWiki:Common.js
Oharra: Gorde ondoren zure nabigatzailearen katxea ekidin beharko duzu aldaketak ikusteko. Mozilla / Firefox / Safari: Shift tekla sakatu birkargatzeko momentuan, edo Ctrl-Shift-R sakatu (Cmd-Shift-R Apple Mac baten); IE: Ctrl tekla sakatu birkargatzeko momentuan, edo Ctrl-F5 sakatu; Konqueror:: Birkargatzeko klik egin, edo F5 sakatu, besterik ez; Opera erabiltzaileek Tresnak-Hobespenak atalera jo eta katxea garbitzeko aukera hautatu.
/**
* Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
* loaded for all users on every wiki page. If possible create a gadget that is
* enabled by default instead of adding it here (since gadgets are fully
* optimized ResourceLoader modules with possibility to add dependencies etc.)
*
* Since Common.js isn't a gadget, there is no place to declare its
* dependencies, so we have to lazy load them with mw.loader.using on demand and
* then execute the rest in the callback. In most cases these dependencies will
* be loaded (or loading) already and the callback will not be delayed. In case a
* dependency hasn't arrived yet it'll make sure those are loaded before this.
*/
/* global mw, $ */
/* jshint strict:false, browser:true */
mw.loader.using( ['mediawiki.user', 'mediawiki.util'] ).then( function () {
/* Begin of mw.loader.using callback */
;(function(a){a.fn.rwdImageMaps=function(){var d=this,c=parseFloat(a.fn.jquery);var b=function(){d.each(function(){if(typeof(a(this).attr("usemap"))=="undefined"){return}var f=this,e=a(f);a("<img />").on( 'load', function(){var o,k,i="width",n="height";if(c<1.6){o=f.getAttribute(i),k=f.getAttribute(n)}else{o=e.attr(i),k=e.attr(n)}if(!o||!k){var p=new Image();p.src=e.attr("src");if(!o){o=p.width}if(!k){k=p.height}}var g=e.width()/100,l=e.height()/100,j=e.attr("usemap").replace("#",""),m="coords";a('map[name="'+j+'"]').find("area").each(function(){var s=a(this);if(!s.data(m)){s.data(m,s.attr(m))}var r=s.data(m).split(","),q=new Array(r.length);for(var h=0;h<q.length;++h){if(h%2===0){q[h]=parseInt(((r[h]/o)*100)*g)}else{q[h]=parseInt(((r[h]/k)*100)*l)}}s.attr(m,q.toString())})}).attr("src",e.attr("src"))})};a(window).resize(b).trigger("resize");return this}})(jQuery);
$(document).ready(function(e) {
$('img[usemap]').rwdImageMaps();
$('.banner-box').css('font-size',($('.banner-box').width()*0.03)+'px');
$('.banner-box').css('line-height',($('.banner-box').width()*0.08)+'px');
});
$(window).resize(function(e) {
$('.banner-box').css('font-size',($('.banner-box').width()*0.03)+'px');
$('.banner-box').css('line-height',($('.banner-box').width()*0.08)+'px');
});
function forcePreview() {
if (mw.config.get('wgUserName') != null || mw.config.get('wgAction') != "edit") return;
saveButton = document.getElementById("wpSave");
if (!saveButton) return;
saveButton.disabled = true;
saveButton.value = "Gorde (aurreikuspena lehenik)";
saveButton.style.fontWeight = "normal";
document.getElementById("wpPreview").style.fontWeight = "bold";
}
$(document).ready(forcePreview);
/** &withJS= URL parameter *******
* Allow to try custom scripts from MediaWiki space
* without editing [[Special:Mypage/monobook.js]]
*/
var extraJS = mw.util.getParamValue("withJS");
if ( extraJS && extraJS.match("^MediaWiki:[^&<>=%]*\.js$") ) {
importScript(extraJS);
}
/**
* WikiMiniAtlas
*
* Description: WikiMiniAtlas is a popup click and drag world map.
* This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
* The script itself is located on meta because it is used by many projects.
* See [[Meta:WikiMiniAtlas]] for more information.
* Maintainers: [[User:Dschwen]]
*/
( function () {
var require_wikiminiatlas = false;
var coord_filter = /geohack/;
$( document ).ready( function() {
$( 'a.external.text' ).each( function( key, link ) {
if ( link.href && coord_filter.exec( link.href ) ) {
require_wikiminiatlas = true;
// break from loop
return false;
}
} );
if ( $( 'div.kmldata' ).length ) {
require_wikiminiatlas = true;
}
if ( require_wikiminiatlas ) {
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
}
} );
} )();
// == Nabarmendutako Artikuluentzako kodea ==
function LinkFA()
{
if ( document.getElementById( "p-lang" ) ) {
var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
for ( var i = 0; i < InterwikiLinks.length; i++ ) {
if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) && InterwikiLinks[i].className.indexOf( "badge-featuredarticle" ) === -1 ) {
InterwikiLinks[i].className += " FA"
InterwikiLinks[i].title = "Artikulu hau beste Wikipedia batean nabarmendu da.";
}
}
}
}
/**
* «Gehitu atala» lotura, «Editatu» aukeraren ondoan, eztabaida orrien azken atalean.
* Iturria: //de.wikipedia.org/w/index.php?title=MediaWiki:Common.js&oldid=107948391
*/
$( function() {
var newSectionLink = $( '#ca-addsection a' );
if( newSectionLink.length ) {
var link = newSectionLink.clone(); //create a copy
//avoid duplicate accesskey
link.removeAttr( 'accesskey' ).attr( 'title', function ( index, oldTitle ) {
return oldTitle.replace( /\s*\[.*\]\s*$/, '' );
} );
// Vector itxura hautatuz gero, «Gehitu atala» lotura azaltzen da
link.css( {
"text-transform" : "lowercase"
} );
//add it wihin the brackets
var lastEditsectionLink = $( 'span.editsection:last a' );
lastEditsectionLink.before( link );
lastEditsectionLink.before( ' | ' ); //see [[MediaWiki:Pipe-separator]]
}
} );
//###### comença codi per a plantilla de diapositives (grups d'imatges) #####
/**
* Utilisation du modèle Modèle:Images
* Importat de [[fr:MediaWiki:Common.js]] per Pasqual
* a 4 de febrer de 2008, 01:02
*
*/
function toggleImage(group, remindex, shwindex) {
document.getElementById("ImageGroupsGr"+group+"Im"+remindex).style.display="none";
document.getElementById("ImageGroupsGr"+group+"Im"+shwindex).style.display="inline";
}
function imageGroup(){
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("div");
var i = 0, j = 0;
var units, search;
var currentimage;
var UnitNode;
for (i = 0; i < divs.length ; i++) {
if (divs[i].className != "ImageGroup") continue;
UnitNode=undefined;
search=divs[i].getElementsByTagName("div");
for (j = 0; j < search.length ; j++) {
if (search[j].className != "ImageGroupUnits") 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 (['center', 'mw-halign-center'].some(function(className) { return temp.classList.contains(className); })) { units.push(temp); }
}
var wrap;
for (j = 0 ; j < units.length ; j++) {
currentimage=units[j];
wrap = document.createElement('div');
wrap.id = "ImageGroupsGr" + i + "Im" + j;
currentimage.parentNode.insertBefore(wrap, currentimage);
wrap.appendChild(currentimage);
var imghead = document.createElement("div");
var leftlink;
var rightlink;
if (j != 0) {
leftlink = document.createElement("a");
leftlink.href = "javascript:toggleImage("+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:toggleImage("+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);
}
wrap.insertBefore(imghead,wrap.childNodes[0]);
if (j != 0) wrap.style.display="none";
}
}
}
$(document).ready(imageGroup);
//###### finalitza codi per a plantilla de diapositives #####
//**************************************************************
// MediaWiki.Edittools
//**************************************************************
function addCharSubsetMenu()
{
addCharSubsetMenuVar(0);
}
/* Menuak sortzen ditu karaktere sailkatzeko */
/***** MediaWiki:Edittools-ekin funtzionatzen du *****/
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';
l[i].style.visibility = i == s ? 'visible' : 'hidden';
}
}
function addCharSubsetMenuVar(s) {
var copywarn = document.getElementById('specialchars');
if (copywarn) {
var aIdx = [];
aIdx[s] = "selected=\"selected\"";
var menu = "<span style=\"margin-top:1px 1px 1px 1px;border-width:1px;border-style:solid;border-color:#aaaaaa;padding:2px 2px 2px 2px;font-size:x-small;position:relative;\"><select id=\"charsetBox\" style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
menu += "<option "+aIdx[0]+">matematika</option>";
menu += "<option "+aIdx[4]+">alemana</option>";
menu += "<option "+aIdx[5]+">antzinako goi alemana</option>";
menu += "<option "+aIdx[6]+">berberea</option>";
menu += "<option "+aIdx[7]+">bosniera/serbokroaziera</option>";
menu += "<option "+aIdx[8]+">errumaniera</option>";
menu += "<option "+aIdx[9]+">eskandinaviera</option>";
menu += "<option "+aIdx[10]+">eslovakiera</option>";
menu += "<option "+aIdx[11]+">esperantoa</option>";
menu += "<option "+aIdx[12]+">estoniera</option>";
menu += "<option "+aIdx[13]+">frantsesa</option>";
menu += "<option "+aIdx[14]+">galesa</option>";
menu += "<option "+aIdx[15]+">gaztelania</option>";
menu += "<option "+aIdx[16]+">antzinako greziera</option>";
menu += "<option "+aIdx[17]+">hawaiiera</option>";
menu += "<option "+aIdx[18]+">hungariera</option>";
menu += "<option "+aIdx[19]+">indoeuropera</option>";
menu += "<option "+aIdx[20]+">antzinako ingelesa</option>";
menu += "<option "+aIdx[21]+">irlandera</option>";
menu += "<option "+aIdx[22]+">islandiera</option>";
menu += "<option "+aIdx[23]+">italiera</option>";
menu += "<option "+aIdx[24]+">japoniera</option>";
menu += "<option "+aIdx[25]+">katalana</option>";
menu += "<option "+aIdx[26]+">letoniera</option>";
menu += "<option "+aIdx[27]+">lituaniera</option>";
menu += "<option "+aIdx[28]+">maltera</option>";
menu += "<option "+aIdx[29]+">navajoa eta apatxea</option>";
menu += "<option "+aIdx[30]+">nederlandera</option>";
menu += "<option "+aIdx[31]+">pinyina</option>";
menu += "<option "+aIdx[32]+">poloniera</option>";
menu += "<option "+aIdx[33]+">portugesa</option>";
menu += "<option "+aIdx[34]+">serbiera</option>";
menu += "<option "+aIdx[35]+">turkiera</option>";
menu += "<option "+aIdx[36]+">txekiera</option>";
menu += "<option "+aIdx[37]+">vietnamera</option>";
menu += "<option "+aIdx[39]+">yiddisha</option>";
menu += "</select></span>";
copywarn.innerHTML = menu + copywarn.innerHTML;
chooseCharSubset(s);
}
}
$(document).ready(addCharSubsetMenu);
function LinkFA()
{
// iterate over all <span>-elements
for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
// if found a FA span
if(a.className == "FA") {
// iterate over all <li>-elements
for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
// if found a FA link
if(b.className == "interwiki-" + a.id && b.className.indexOf("badge-featuredarticle") === -1 && b.className.indexOf("badge-goodarticle") === -1) {
b.style.padding = "0 0 0 16px";
b.style.backgroundImage = "url('//upload.wikimedia.org/wikipedia/en/6/60/LinkFA-star.png')";
b.style.backgroundRepeat = "no-repeat";
b.title = "Artikulu hau nabarmenduen artean dago";
}
}
}
}
}
$(document).ready(LinkFA);
// ============================================================
// BEGIN Dynamic Navigation Bars (experimantal)
// set up the words in your language
var NavigationBarHide = '[ Ezkutatu ]';
var NavigationBarShow = '[ Erakutsi ]';
// 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 = 1;
/**
* Collapsible tables
*
* Allows tables to be collapsed, showing only the header. See [[Help:Collapsing]].
*
* @version 2.0.3 (2014-03-14)
* @source https://www.mediawiki.org/wiki/MediaWiki:Gadget-collapsibleTables.js
* @author [[User:R. Koot]]
* @author [[User:Krinkle]]
* @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which
* is supported in MediaWiki core.
*/
var autoCollapse = 2;
var collapseCaption = 'ezkutatu';
var expandCaption = 'erakutsi';
var tableIndex = 0;
function collapseTable( tableIndex ) {
var Button = document.getElementById( 'collapseButton' + tableIndex );
var Table = document.getElementById( 'collapsibleTable' + tableIndex );
if ( !Table || !Button ) {
return false;
}
var Rows = Table.rows;
var i;
var $row0 = $(Rows[0]);
if ( Button.firstChild.data === collapseCaption ) {
for ( i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = 'none';
}
Button.firstChild.data = expandCaption;
} else {
for ( i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = $row0.css( 'display' );
}
Button.firstChild.data = collapseCaption;
}
}
function createClickHandler( tableIndex ) {
return function ( e ) {
e.preventDefault();
collapseTable( tableIndex );
};
}
function createCollapseButtons( $content ) {
var NavigationBoxes = {};
var $Tables = $content.find( 'table' );
var i;
$Tables.each( function( i, table ) {
if ( $(table).hasClass( 'collapsible' ) ) {
/* only add button and increment count if there is a header row to work with */
var HeaderRow = table.getElementsByTagName( 'tr' )[0];
if ( !HeaderRow ) {
return;
}
var Header = table.getElementsByTagName( 'th' )[0];
if ( !Header ) {
return;
}
NavigationBoxes[ tableIndex ] = table;
table.setAttribute( 'id', 'collapsibleTable' + tableIndex );
var Button = document.createElement( 'span' );
var ButtonLink = document.createElement( 'a' );
var ButtonText = document.createTextNode( collapseCaption );
// Styles are declared in [[MediaWiki:Common.css]]
Button.className = 'collapseButton';
ButtonLink.style.color = Header.style.color;
ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
ButtonLink.setAttribute( 'href', '#' );
$( ButtonLink ).on( 'click', createClickHandler( tableIndex ) );
ButtonLink.appendChild( ButtonText );
Button.appendChild( document.createTextNode( '[' ) );
Button.appendChild( ButtonLink );
Button.appendChild( document.createTextNode( ']' ) );
Header.insertBefore( Button, Header.firstChild );
tableIndex++;
}
} );
for ( i = 0; i < tableIndex; i++ ) {
if ( $( NavigationBoxes[i] ).hasClass( 'collapsed' ) ||
( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) )
) {
collapseTable( i );
}
else if ( $( NavigationBoxes[i] ).hasClass ( 'innercollapse' ) ) {
var element = NavigationBoxes[i];
while ((element = element.parentNode)) {
if ( $( element ).hasClass( 'outercollapse' ) ) {
collapseTable ( i );
break;
}
}
}
}
}
mw.hook( 'wikipage.content' ).add( createCollapseButtons );
/**
* Add support to mw-collapsible for autocollapse, innercollapse and outercollapse
*
* Maintainers: TheDJ
*/
function mwCollapsibleSetup( $collapsibleContent ) {
var $element,
autoCollapseThreshold = 2;
$.each( $collapsibleContent, function (index, element) {
$element = $( element );
if ( $collapsibleContent.length > autoCollapseThreshold && $element.hasClass( 'autocollapse' ) ) {
$element.data( 'mw-collapsible' ).collapse();
} else if ( $element.hasClass( 'innercollapse' ) ) {
if ( $element.parents( '.outercollapse' ).length > 0 ) {
$element.data( 'mw-collapsible' ).collapse();
}
}
} );
}
mw.hook( 'wikipage.collapsibleContent' ).add( mwCollapsibleSetup );
/**
* Dynamic Navigation Bars (experimental)
*
* Description: See [[Wikipedia:NavFrame]].
* Maintainers: UNMAINTAINED
*/
/* set up the words in your language */
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';
var indexNavigationBar = 0;
/**
* Shows and hides content and picture (if available) of navigation bars
* Parameters:
* indexNavigationBar: the index of navigation bar to be toggled
**/
window.toggleNavigationBar = function ( indexNavigationBar, event ) {
var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
var NavChild;
if ( !NavFrame || !NavToggle ) {
return false;
}
/* if shown now */
if ( NavToggle.firstChild.data === NavigationBarHide ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'none';
}
}
NavToggle.firstChild.data = NavigationBarShow;
/* if hidden now */
} else if ( NavToggle.firstChild.data === NavigationBarShow ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
event.preventDefault();
};
/* adds show/hide-button to navigation bars */
function createNavigationBarToggleButton( $content ) {
var NavChild;
/* iterate over all < div >-elements */
var $divs = $content.find( 'div' );
$divs.each( function ( i, NavFrame ) {
/* if found a navigation bar */
if ( $( NavFrame ).hasClass( 'NavFrame' ) ) {
indexNavigationBar++;
var NavToggle = document.createElement( 'a' );
NavToggle.className = 'NavToggle';
NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
NavToggle.setAttribute( 'href', '#' );
$( NavToggle ).on( 'click', $.proxy( window.toggleNavigationBar, window, indexNavigationBar ) );
var isCollapsed = $( NavFrame ).hasClass( 'collapsed' );
/**
* Check if any children are already hidden. This loop is here for backwards compatibility:
* the old way of making NavFrames start out collapsed was to manually add style="display:none"
* to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make
* the content visible without JavaScript support), the new recommended way is to add the class
* "collapsed" to the NavFrame itself, just like with collapsible tables.
*/
for ( NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
if ( NavChild.style.display === 'none' ) {
isCollapsed = true;
}
}
}
if ( isCollapsed ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
NavChild.style.display = 'none';
}
}
}
var NavToggleText = document.createTextNode( isCollapsed ? NavigationBarShow : 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] ).hasClass( 'NavHead' ) ) {
NavToggle.style.color = NavFrame.childNodes[j].style.color;
NavFrame.childNodes[j].appendChild( NavToggle );
}
}
NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
}
} );
}
mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );
/**
* Description: Adapt multiple columns to the actual size of the bodyContent div.
* Maintainers:
*/
(function(mw, $) {
// counter for number of columns
var count = 0;
// width of the #bodyContent and its token
var widths = [
{ size : 450, name : 'multicol-xx-small' },
{ size : 700, name : 'multicol-x-small' },
{ size : 950, name : 'multicol-small' },
{ size : 1200, name : 'multicol-normal' },
{ size : 1500, name : 'multicol-large' },
{ size : 1800, name : 'multicol-x-large' },
{ size : 2100, name : 'multicol-xx-large' }
];
// selectors for default override of large lists
var selectors = [
'#bodyContent h2:has(#Erreferentziak) + ol.large.references',
'#bodyContent h2:has(#Bibliografia) + ul.large',
'#bodyContent h2:has(#Ikus,_gainera) + ul.large',
'#bodyContent h2:has(#Kanpo_estekak) + ul.large',
];
// calculate number of columns and set its token
function calc() {
var found = 0;
var body = $('#bodyContent');
var width = body.width();
// remove any previous definitions
// this is necessary for resize to work
for (var i = 0; i<widths.length; i++)
body.removeClass(widths[i].name);
// if the width is to small we set a special token and exits
if (width < widths[0].size) {
body.addClass('multicol-xx-small');
body.addClass('multicol-verysmall');
return;
}
// test for increasing sizes and set the token
for (var i = 1; i<widths.length; i++) {
count++;
if (width < widths[i].size) {
body.addClass( widths[i].name);
found++;
break;
}
}
// if we didn't find a matching size we set a special token
if (!found) {
body.addClass('multicol-xx-large');
body.addClass('multicol-verylarge');
}
// unless we had a too smalll width we set a common token
body.addClass('multicol-all');
}
// set it all up
$(function() {
calc(); // only on ready
$(window).resize(calc); // only on resize
// identify large lists
count *= 2; // twice the number of columns
$('#bodyContent ol, #bodyContent ul').each(function(i, el) {
if (count < el.children.length) $(el).addClass('large');
});
// override for long lists in specific sections, add later
//$(selectors.join(',')).before('<div class="multicol" style="display:none"></div>');
});
})(mediaWiki, jQuery);
// Results from Wikidata
// [[File:Wdsearch_script_screenshot.png]]
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' || ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgCanonicalSpecialPageName' ) === false ) ) {
mw.loader.load("//en.wikipedia.org/w/index.php?title=MediaWiki:Wdsearch.js&action=raw&ctype=text/javascript");
}
// Add Wikidata to "in Other Projects" section
if ( !$( '#p-wikibase-otherprojects' ).length ) {
$( '#p-tb' ).before( $( '<nav id="p-wikibase-otherprojects" class="vector-menu vector-menu-portal portal" aria-labelledby="p-wikibase-otherprojects-label" dir="ltr"><div id="p-wikibase-otherprojects-label" class="vector-menu-heading"><span>Beste proiektuetan</span></div><div class="body"><ul></ul></div></div>' ) );
}
$( '#p-wikibase-otherprojects ul' ).append( $( '#t-wikibase' ) );
// Only load if there's a wikiwidget in the page
var widgets = $( '.WikiWidget' );
if ( widgets.length > 0 ) {
// Only load when viewing or previewing the page
var action = mw.config.get( 'wgAction' );
if ( action === 'view' || action === 'submit' ) {
// Load the initialization script from Commons
mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:WikiWidgets.js&action=raw&ctype=text/javascript' );
}
}
/* Xake partidak ikusteko kodea */
$( function() {
if ( $( '.pgn-sourcegame' ).length ) {
mw.loader.load('//he.wikipedia.org/w/index.php?title=Mediawiki:Gadget-pgnviewer.js&action=raw&ctype=text/javascript');
mw.loader.load('//he.wikipedia.org/w/index.php?title=Mediawiki:Gadget-pgnviewer.css&action=raw&ctype=text/css', 'text/css');
}
} );
/* Vikidia loturak txertatzea */
(function ($) {
"use strict";
if ( $(".vikidia-link").length ) {
$("#mw-panel").append("\
<nav id='p-vikidia' class='vector-menu-heading-label'>\
<h3><span style='font-family:GochiHand; color:#BA55D3; font-size:1em;'>Vikidian</span></h3>\
<div class='vector-menu-content'>\
<ul class='vector-menu-content-list'>\
</ul>\
</div>\
</nav>\
");
$(".vikidia-link").appendTo("#p-vikidia ul").removeAttr("style");
}
})(jQuery);
/**
* Script per alternar entre diverses imatges utilitzada a {{switcher2}}
* procedència: [[:fr:special:permalink/165756873]] el 26-07-2020
*/
function GeoBox_Init($content) {
$content.find( 'div.img_toogle' ).each( function ( i, Container ) {
Container.id = 'img_toogle_' + i;
var Boxes = $( Container ).find( '.geobox' );
if (Boxes.length < 2) {
return;
}
var ToggleLinksDiv = document.createElement('ul');
ToggleLinksDiv.id = 'geoboxToggleLinks_' + i;
Boxes.each( function ( a, ThisBox ) {
ThisBox.id = 'geobox_' + i + '_' + a;
var ThisImg = ThisBox.getElementsByTagName('img')[0];
if(!ThisImg) return;
var ThisAlt = ThisImg.alt;
var toggle = document.createElement('a');
toggle.id = 'geoboxToggle_' + i + '_' + a;
toggle.textContent = ThisAlt;
toggle.href = 'javascript:';
toggle.onclick = function (e) {
e.preventDefault();
GeoBox_Toggle(this);
};
var Li = document.createElement('li');
Li.appendChild(toggle);
ToggleLinksDiv.appendChild(Li);
if (a === (Boxes.length - 1)) {
toggle.style.color = '#888';
toggle.style.pointerEvents = 'none';
} else {
ThisBox.style.display = 'none';
}
} );
Container.appendChild(ToggleLinksDiv);
} );
}
function GeoBox_Toggle(link) {
var ImgToggleIndex = link.id.replace('geoboxToggle_', '').replace(/_.*/g, '');
var GeoBoxIndex = link.id.replace(/.*_/g, '');
var ImageToggle = document.getElementById('img_toogle_' + ImgToggleIndex);
var Links = document.getElementById('geoboxToggleLinks_' + ImgToggleIndex);
var Geobox = document.getElementById('geobox_' + ImgToggleIndex + '_' + GeoBoxIndex);
var Link = document.getElementById('geoboxToggle_' + ImgToggleIndex + '_' + GeoBoxIndex);
if ( !ImageToggle || !Links || !Geobox || !Link ) {
return;
}
$( ImageToggle ).find( '.geobox' ).each( function ( _, ThisgeoBox ) {
if (ThisgeoBox.id === Geobox.id) {
ThisgeoBox.style.display = '';
} else {
ThisgeoBox.style.display = 'none';
}
} );
$( Links ).find( 'a' ).each( function ( _, thisToggleLink ) {
if (thisToggleLink.id === Link.id) {
thisToggleLink.style.color = '#888';
thisToggleLink.style.pointerEvents = 'none';
} else {
thisToggleLink.style.color = '';
thisToggleLink.style.pointerEvents = '';
}
} );
}
mw.hook( 'wikipage.content' ).add( GeoBox_Init );
/* Kategoria faltsuak gehitzeko kodea */
mw.hook( 'wikipage.categories' ).add( function () {
$( '.fake-category a' ).each( function() {
$( this ).appendTo( '#mw-normal-catlinks ul' ).wrap( '<li>' );
} );
} );
/* End of mw.loader.using callback */
} );
/* DO NOT ADD CODE BELOW THIS LINE */