MediaWiki:Common.js: Dallime mes rishikimesh
Content deleted Content added
Heqje e kodit për lokalizimin e kohës. Kodi është i gabuar. |
علاء (diskuto | kontribute) T238706 |
||
Rreshti 505: | Rreshti 505: | ||
var iFrame = document.createElement ( 'iframe' ) ; |
var iFrame = document.createElement ( 'iframe' ) ; |
||
var url = 'https://tools.wmflabs.org/wiwosm/osm-on-ol/kml-on-ol.php?' |
|||
+ 'lang=' + mw.config.get('wgUserLanguage') |
|||
+ '¶ms=' + h |
|||
+ '&title=' + mw.util.wikiUrlencode( mw.config.get( 'wgTitle' ) ) |
|||
+ ( window.location.protocol == 'https:' ? '&secure=1' : '' ) ; |
|||
iFrame.style.width = '100%' ; |
iFrame.style.width = '100%' ; |
||
iFrame.style.height = ((AlterigiaSchermo*80/100)-100) + 'px' ; |
iFrame.style.height = ((AlterigiaSchermo*80/100)-100) + 'px' ; |
||
iFrame.style.clear = 'both' ; |
iFrame.style.clear = 'both' ; |
||
iFrame.src = url ; |
|||
var ResizeArea = document.createElement('div'); |
var ResizeArea = document.createElement('div'); |
||
ResizeArea.style.position = "relative"; |
ResizeArea.style.position = "relative"; |
Versioni i datës 20 nëntor 2019 09:23
/**
* Main Page layout fixes
*/
if ( mw.config.get('wgIsMainPage') ) {
mw.loader.using(['mediawiki.util']).then(function () {
mw.util.addPortletLink('p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
'Lista e plotë', 'interwiki-completelist', 'Lista e plotë e Wikipediave');
});
}
/** "Technical restrictions" title fix *****************************************
*
* Description: 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
* UK 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.
* Maintainers: [[User:Interiot]], [[User:Mets501]], [[User:Freakofnurture]]
*/
var disableRealTitle = 0; // users can set disableRealTitle = 1 locally to disable.
if (mw.config.get('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() {
try {
var realTitleBanner = document.getElementById("RealTitleBanner");
if (realTitleBanner && !document.getElementById("DisableRealTitle") && !disableRealTitle ) {
var realTitle = document.getElementById("RealTitle");
if (realTitle) {
var realTitleHTML = realTitle.innerHTML;
if (realTitle.textContent) { //everyone but IE
realTitleText = realTitle.textContent;
} else { //IE
realTitleText = realTitle.innerText;
}
var isPasteable = 0;
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[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 (mw.config.get('wgNamespaceNumber') != 0) {
if (mw.config.get('wgCanonicalNamespace') == verifyTitle.substr(0, mw.config.get('wgCanonicalNamespace').length).replace(/ /g, "_") && verifyTitle.charAt(mw.config.get('wgCanonicalNamespace').length) == ":") {
verifyTitle = verifyTitle.substr(mw.config.get('wgCanonicalNamespace').length + 1);
} else {
realTitleText = mw.config.get('wgCanonicalNamespace').replace(/_/g, " ") + ":" + realTitleText;
realTitleHTML = mw.config.get('wgCanonicalNamespace').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[0].toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
if ( (verifyTitle == mw.config.get('wgTitle')) || (verifyTitle == mw.config.get('wgTitle').replace(/^(.+)?(January|February|March|April|May|June|July|August|September|October|November|December)\s+([12]?[0-9]|3[0123])([^\d].*)?$/g, "$1$3 $2$4") )) 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 + " - Wikipedia, enciklopedia e lirë";
}
}
} catch (e) {
/* Something went wrong. */
}
});
}
// 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;
}
/* Test if an element has a certain class **************************************
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
*/
var hasClass = (function () {
var reCache = {};
return function (element, className) {
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
};
})();
/**
* 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 = 'fshih';
var expandCaption = 'shfaq';
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,
$toggle,
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();
}
}
$toggle = $element.find( '.mw-collapsible-toggle' );
if ( $toggle.length ) {
// Make the toggle inherit text color
if( $toggle.parent()[0].style.color ) {
$toggle.find( 'a' ).css( 'color', 'inherit' );
}
}
} );
}
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 );
/**
* WikiMiniAtlas is a popup click and drag world map.
* See [[meta:WikiMiniAtlas]] for more information.
* Maintainers: [[w:User:Dschwen]]
*/
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
/** Interwiki links to featured articles ***************************************
*
* Description: Highlights interwiki links to featured articles (or
* equivalents) by changing the bullet before the interwiki link
* into a star.
* Maintainers: [[User:R. Koot]]
*/
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 = "Ky artikull ka arritur një kualitet të lartë në këtë gjuhë.";
}
}
}
}
$( LinkFA );
// Import Onlyifuploading-functions from [[MediaWiki:Onlyifuploading.js]]
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) == 'Upload' ) {
importScript("MediaWiki:Onlyifuploading.js");
importScript("MediaWiki:Onlyifediting.js");
}
// Import Onlyifediting-functions from [[MediaWiki:Onlyifediting.js]]
if ( mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit' ) {
importScript("MediaWiki:Onlyifediting.js");
}
/* OPEN STREET MAP SCRIPT */
/**
* Move the coordinates which are at the top of the page
* From fr:mediawiki:common.js
*/
function moveCoord() {
var h1 = document.getElementById('firstHeading');
if(!h1) h1 = document.getElementsByTagName('h1')[0]; // Nostalgia, Standard
var coord = document.getElementById('coordinates');
if ( !coord || !h1 ) return;
coord.id = "coordinates-title";
h1.parentNode.insertBefore(coord, h1); /* déplacement de l'élément */
}
$(moveCoord);
// Verwendung von OpenStreetMap in Wikipedia.
// (c) 2008 by Magnus Manske
// Released under GPL
// Modified version in order to makes it work with moveCoord() above
// From fr:mediawiki:common.js
// modified to makes it work for IT : Otourly
if(typeof(MoveResizeAbsolute_AddMoveArea)!="function") mw.loader.load('//sq.wikipedia.org/w/index.php?title=MediaWiki:Gadget-MoveResizeAbsolute.js&action=raw&ctype=text/javascript');
function openStreetMap_Init () {
var c = document.getElementById ( 'coordinates-title' ) ;
if ( !c ) return ;
var a = c.getElementsByTagName ( 'a' ) ;
var geohack = false;
for ( var i = 0 ; i < a.length ; i++ ) {
var h = a[i].href ;
if ( !h.match(/geohack/) ) continue ;
geohack = true ;
break ;
}
if ( !geohack ) return ;
var na = document.createElement ( 'a' ) ;
na.href = 'javascript:openStreetMap_Toggle();' ;
na.title = 'Shfaq / fshih hartën' ;
na.appendChild ( document.createTextNode ( 'Harta' ) ) ;
c.appendChild ( document.createTextNode ( ' (' ) ) ;
c.appendChild ( na ) ;
c.appendChild ( document.createTextNode ( ') ' ) ) ;
}
function openStreetMap_Toggle () {
var c = document.getElementById ( 'coordinates-title' ) ;
if ( !c) return ;
var osm = document.getElementById ( 'OpenStreetMap' ) ;
if (osm) {
if ( osm.style.display == 'none' ) {
osm.style.display = 'block' ;
} else {
osm.style.display = 'none' ;
}
return;
}
var found_link = false ;
var a = c.getElementsByTagName ( 'a' ) ;
var h;
for ( var i = 0 ; i < a.length ; i++ ) {
h = a[i].href ;
if ( !h.match(/geohack/) ) continue ;
found_link = true ;
break ;
}
if ( !found_link ) return ; // No geohack link found
h = h.split('params=')[1] ;
var LarghezzaSchermo = MoveResizeAbsolute_GetScreenWidth();
var AlterigiaSchermo = MoveResizeAbsolute_GetScreenHeight();
var OSMDiv = document.createElement('div');
OSMDiv.id = 'OpenStreetMap' ;
OSMDiv.style.position = "absolute";
OSMDiv.style.zIndex = 5000;
OSMDiv.style.top = (AlterigiaSchermo*10/100) + "px";
OSMDiv.style.left = (LarghezzaSchermo*15/100) + "px";
OSMDiv.style.width = "74%";
OSMDiv.style.height = (AlterigiaSchermo*80/100) + "px";
OSMDiv.style.border = "3px solid grey";
OSMDiv.style.backgroundColor = "white";
OSMDiv.style.overflow = "hidden";
var MoveArea = document.createElement('div');
MoveArea.style.position = "relative";
MoveArea.style.top = "0";
MoveArea.style.width = "100%";
MoveArea.style.height = "50px";
MoveArea.title = "Kliko dhe tërhiqe për të ndryshuar madhësinë e dritares";
var CloseLink = document.createElement('a');
CloseLink.setAttribute("style", "float:right;margin:10px;");
CloseLink.innerHTML = "Fshih";
CloseLink.title = "Kliko për të mbyllur hartën";
CloseLink.href = "javascript:openStreetMap_Toggle();";
MoveArea.appendChild(CloseLink);
var iFrame = document.createElement ( 'iframe' ) ;
iFrame.style.width = '100%' ;
iFrame.style.height = ((AlterigiaSchermo*80/100)-100) + 'px' ;
iFrame.style.clear = 'both' ;
var ResizeArea = document.createElement('div');
ResizeArea.style.position = "relative";
ResizeArea.style.top = "0";
ResizeArea.style.width = "100%";
ResizeArea.style.height = "50px";
ResizeArea.title = "Kliko dhe tërhiqe për të ndryshuar madhësinë e dritares";
OSMDiv.appendChild(MoveArea);
OSMDiv.appendChild(iFrame);
OSMDiv.appendChild(ResizeArea);
document.body.appendChild ( OSMDiv ) ;
var ElementsToMove = new Array(OSMDiv);
var ElementsToResize = new Array(OSMDiv, iFrame);
var ElementsMinWidth = new Array(150, 150);
var ElementsMinHeights = new Array(200, 100);
MoveResizeAbsolute_AddMoveArea(MoveArea, ElementsToMove);
MoveResizeAbsolute_AddResizeArea(ResizeArea, ElementsToResize, ElementsMinWidth, ElementsMinHeights);
}
mw.loader.using(['mediawiki.util']).then(function () {
$(openStreetMap_Init);
});
// Crudely widen the sitenotice message to 100% page width and hide the dismiss link.
// NB: This one is better left commented out when not specifically needed.
/*
$(function(){
try {
var siteNoticeText = document.getElementById('mw-dismissable-notice').childNodes[0].childNodes[0].childNodes[0];
var siteNoticeDismiss = document.getElementById('mw-dismissable-notice').childNodes[0].childNodes[0].childNodes[2];
}catch(e){
return false;
}
siteNoticeDismiss.setAttribute('style', 'display:none;');
siteNoticeText.setAttribute('width', '100%');
});
*/
/** Interwiki links to featured articles ***************************************
*
* Description: Highlights interwiki links to featured articles (or
* equivalents) by changing the bullet before the interwiki link
* into a star.
*/
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 = "Ky është një artikull i përkryer në një gjuhë tjetër.";
} else if ( document.getElementById( InterwikiLinks[i].className + "-ga" ) && InterwikiLinks[i].className.indexOf( "badge-goodarticle" ) === -1 ) {
InterwikiLinks[i].className += " GA";
InterwikiLinks[i].title = "Ky është një artikull i mirë në një gjuhë tjetër.";
}
}
}
}
$( LinkFA );
/**
* sq:Skript për të alternuar mes shumë hartave të vendodhjes importuar nga wiki franceze fr:Script pour alterner entre plusieurs cartes de géolocalisation
*/
function GeoBox_Init(Element){
if(!Element) Element = document.body;
var cont = $( Element ).find( 'div.img_toogle' ).get();
for (var i = 0,m=cont.length; i < m; i++) {
cont[i].id = 'img_toogle_' + i;
var Boxes = $( cont[i] ).find( '.geobox' ).get();
var ToggleLinksDiv = document.createElement('ul');
ToggleLinksDiv.id = 'geoboxToggleLinks_' + i;
for(var a=0,l=Boxes.length;a<l;a++){
var ThisBox = Boxes[a];
ThisBox.id = 'geobox_' + i + "_" + a;
ThisBox.style.borderTop='0';
var ThisAlt = ThisBox.getElementsByTagName('img')[0].alt;
var toggle = document.createElement('a');
toggle.id = 'geoboxToggle_' + i + "_" + a;
toggle.appendChild(document.createTextNode(ThisAlt));
toggle.href='javascript:;';
toggle.onclick = function(){
GeoBox_Toggle(this);
return false;
};
var Li = document.createElement('li');
Li.appendChild(toggle);
ToggleLinksDiv.appendChild(Li);
if(a==(l-1)){
Li.style.display = "none";
}else{
ThisBox.style.display = "none";
}
}
cont[i].appendChild(ToggleLinksDiv);
}
}
function GeoBox_Toggle(link){
var ImgToggleIndex = link.id.split('geoboxToggle_').join('').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;
var AllGeoboxes = $( ImageToggle ).find( '.geobox' ).get();
for(var a=0,l=AllGeoboxes.length;a<l;a++){
var ThisgeoBox = AllGeoboxes[a];
if(ThisgeoBox.id === Geobox.id){
ThisgeoBox.style.display = "";
}else{
ThisgeoBox.style.display = "none";
}
}
var AllToggleLinks = Links.getElementsByTagName('a');
for(var a=0,l=AllToggleLinks.length;a<l;a++){
var thisToggleLink = AllToggleLinks[a];
if(thisToggleLink.id === Link.id){
thisToggleLink.parentNode.style.display = "none";
}else{
thisToggleLink.parentNode.style.display = "";
}
}
}
if ( ( mw.config.get( 'wgAction' ) === 'view' ||
mw.config.get( 'wgAction' ) === 'purge' ||
mw.config.get( 'wgAction' ) === 'submit' )
) {
$( function() {
GeoBox_Init();
} );
}