"MediaWiki:Common.js" səhifəsinin versiyaları arasındakı fərqlər

(341 dəyişikliyi WikiSysop (Müzakirə) tərəfindən geri alındı.)
Teq: Undo
 
(38 intermediate revisions by 3 users not shown)
Sətir 1: Sətir 1:
 +
/* Burada redaktorların hamısı üçün bütün səhifələrdə istənilən JavaScript yüklənəcək */
 
// Switch language variants of messages (from zh)
 
// Switch language variants of messages (from zh)
 
function wgULS(latn,arab){
 
function wgULS(latn,arab){
Sətir 96: Sətir 97:
 
   }
 
   }
 
});
 
});
 +
 +
/* 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);
 +
    };
 +
})();
 +
  
 
  /** Interwiki links to featured articles ***************************************
 
  /** Interwiki links to featured articles ***************************************
Sətir 104: Sətir 119:
 
   *  Maintainers: [[User:R. Koot]]
 
   *  Maintainers: [[User:R. Koot]]
 
   */
 
   */
 
 
/**
 
* NAVFRAME
 
*/
 
 
   
 
   
 
//Messages
 
//Messages
Sətir 117: Sətir 128:
 
var zeroSectionTip = 'Girişi redaktə et';
 
var zeroSectionTip = 'Girişi redaktə et';
  
var NavigationBarHide = '[gizlət]';
+
var NavigationBarHide = '[bağla]';
var NavigationBarShow = '[göstər]';
+
var NavigationBarShow = '[bax]';
 
var NavigationBarShowDefault = 2;
 
var NavigationBarShowDefault = 2;
  
Sətir 152: Sətir 163:
  
  
var NavigationBarShowDefault;
+
/** Collapsible tables *********************************************************
if ( typeof NavigationBarShowDefault === 'undefined' ) {
+
  *
NavigationBarShowDefault = 1;
+
  *  Description: Allows tables to be collapsed, showing only the header. See
}
+
  *              [[Wikipedia:NavFrame]].
 +
  *  Maintainers: [[User:R. Koot]]
 +
  */
 +
 +
var autoCollapse = 2;
 +
var collapseCaption = "bağla";
 +
var expandCaption = "bax";
 +
 +
function collapseTable( tableIndex )
 +
{
 +
    var Button = document.getElementById( "collapseButton" + tableIndex );
 +
    var Table = document.getElementById( "collapsibleTable" + tableIndex );
 +
    var i;
 +
    if ( !Table || !Button ) {
 +
        return false;
 +
    }
 +
 +
    var Rows = Table.getElementsByTagName( "tr" );
 +
 +
    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 = Rows[0].style.display;
 +
        }
 +
        Button.firstChild.data = collapseCaption;
 +
    }
 +
}
 +
 +
function createCollapseButtons()
 +
{
 +
    var tableIndex = 0;
 +
    var NavigationBoxes = {};
 +
    var Tables = document.getElementsByTagName( "table" );
 +
    var i;
 +
    for ( 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 );
 +
            ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
 +
            ButtonLink.appendChild( ButtonText );
 +
 +
            Button.appendChild( document.createTextNode( "[" ) );
 +
            Button.appendChild( ButtonLink );
 +
            Button.appendChild( document.createTextNode( "]" ) );
 +
 +
            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++;
 +
            }
 +
        }
 +
    }
 +
 +
    for ( i = 0;  i < tableIndex; i++ ) {
 +
        if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
 +
            collapseTable( i );
 +
        }
 +
    }
 +
}
 +
 +
$( createCollapseButtons );
  
// table.collapsible
+
/** Dynamic Navigation Bars (experimental) *************************************
function makeCollapsibleMwCollapsible( $content ) {
+
  *
var $tables = $content
+
  *  Description: See [[Wikipedia:NavFrame]].
.find( 'table.collapsible:not(.mw-collapsible)' )
+
  * Maintainers: UNMAINTAINED
.addClass( 'mw-collapsible' );
+
  */
 
 
$.each( $tables, function( index, table ) {
 
// mw.log.warn( 'This page is using the deprecated class collapsible. Please replace it with mw-collapsible.');
 
if( $( table ).hasClass( 'collapsed') ) {
 
$( table ).addClass( 'mw-collapsed' );
 
// mw.log.warn( 'This page is using the deprecated class collapsed. Please replace it with mw-collapsed.');
 
}
 
} );
 
if( $tables.length > 0 ) {
 
mw.loader.using( 'jquery.makeCollapsible' ).then( function() {
 
$tables.makeCollapsible();
 
} );
 
}
 
}
 
mw.hook( 'wikipage.content' ).add( makeCollapsibleMwCollapsible );
 
 
 
/**
 
* 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 ( $element.hasClass( 'collapsible' ) ) {
 
$element.find('tr:first > th:first').prepend( $element.find('tr:first > * > .mw-collapsible-toggle'));
 
}
 
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();
 
}
 
}
 
// because of colored backgrounds, style the link in the text color
 
// to ensure accessible contrast
 
$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
 
*/
 
 
   
 
   
var collapseCaption = 'gizlə';
+
  // set up the words in your language
var expandCaption = 'göstər';
+
  var NavigationBarHide = '[' + collapseCaption + ']';
 
+
  var NavigationBarShow = '[' + expandCaption + ']';
// Set up the words in your language
+
 
var navigationBarHide = '[' + collapseCaption + ']';
+
  // set up max count of Navigation Bars on page,
var navigationBarShow = '[' + expandCaption + ']';
+
  // 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
* Shows and hides content and picture (if available) of navigation bars.
+
  var NavigationBarShowDefault = autoCollapse;
*
+
 
* @param {number} indexNavigationBar The index of navigation bar to be toggled
+
 
* @param {jQuery.Event} event Event object
+
  // shows and hides content and picture (if available) of navigation bars
*/
+
  // Parameters:
function toggleNavigationBar( indexNavigationBar, event ) {
+
  //    indexNavigationBar: the index of navigation bar to be toggled
var navToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
+
  function toggleNavigationBar(indexNavigationBar)
var navFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
+
  {
var navChild;
+
    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
 
+
    var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
if ( !navFrame || !navToggle ) {
+
 
return false;
+
    if (!NavFrame || !NavToggle) {
}
+
        return false;
 
+
    }
// If shown now
+
 
if ( navToggle.firstChild.data === navigationBarHide ) {
+
    // if shown now
for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
+
    if (NavToggle.firstChild.data == NavigationBarHide) {
if ( $( navChild ).hasClass( 'NavContent' ) ) {
+
        for (
navChild.style.display = 'none';
+
                var NavChild = NavFrame.firstChild;
}
+
                NavChild != null;
}
+
                NavChild = NavChild.nextSibling
navToggle.firstChild.data = navigationBarShow;
+
            ) {
+
            if ( hasClass( NavChild, 'NavPic' ) ) {
// If hidden now
+
                NavChild.style.display = 'none';
} else if ( navToggle.firstChild.data === navigationBarShow ) {
+
            }
for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
+
            if ( hasClass( NavChild, 'NavContent') ) {
if ( $( navChild ).hasClass( 'NavContent' ) ) {
+
                NavChild.style.display = 'none';
navChild.style.display = 'block';
+
            }
}
+
        }
}
+
    NavToggle.firstChild.data = NavigationBarShow;
navToggle.firstChild.data = navigationBarHide;
+
 
}
+
    // if hidden now
 
+
    } else if (NavToggle.firstChild.data == NavigationBarShow) {
event.preventDefault();
+
        for (
}
+
                var NavChild = NavFrame.firstChild;
 
+
                NavChild != null;
/**
+
                NavChild = NavChild.nextSibling
* Adds show/hide-button to navigation bars.
+
            ) {
*
+
            if (hasClass(NavChild, 'NavPic')) {
* @param {jQuery} $content
+
                NavChild.style.display = 'block';
*/
+
            }
function createNavigationBarToggleButton( $content ) {
+
            if (hasClass(NavChild, 'NavContent')) {
var i, j, navChild, navToggle, navToggleText, isCollapsed,
+
                NavChild.style.display = 'block';
indexNavigationBar = 0;
+
            }
// Iterate over all < div >-elements
+
        }
var $divs = $content.find( 'div.NavFrame:not(.mw-collapsible)' );
+
    NavToggle.firstChild.data = NavigationBarHide;
$divs.each( function ( i, navFrame ) {
+
    }
indexNavigationBar++;
+
  }
navToggle = document.createElement( 'a' );
+
 
navToggle.className = 'NavToggle';
+
  // adds show/hide-button to navigation bars
navToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
+
  function createNavigationBarToggleButton()
navToggle.setAttribute( 'href', '#' );
+
  {
$( navToggle ).on( 'click', $.proxy( toggleNavigationBar, null, indexNavigationBar ) );
+
    var indexNavigationBar = 0;
 
+
    // iterate over all < div >-elements  
isCollapsed = $( navFrame ).hasClass( 'collapsed' );
+
    var divs = document.getElementsByTagName("div");
/**
+
    for(
* Check if any children are already hidden.  This loop is here for backwards compatibility:
+
            var i=0;  
* the old way of making NavFrames start out collapsed was to manually add style="display:none"
+
            NavFrame = divs[i];
* to all the NavPic/NavContent elements.  Since this was bad for accessibility (no way to make
+
            i++
* 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.
+
        // if found a navigation bar
*/
+
        if (hasClass(NavFrame, "NavFrame")) {
for ( navChild = navFrame.firstChild; navChild !== null && !isCollapsed; navChild = navChild.nextSibling ) {
+
 
if ( $( navChild ).hasClass( 'NavPic' ) || $( navChild ).hasClass( 'NavContent' ) ) {
+
            indexNavigationBar++;
if ( navChild.style.display === 'none' ) {
+
            var NavToggle = document.createElement("a");
isCollapsed = true;
+
            NavToggle.className = 'NavToggle';
}
+
            NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
}
+
            NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
}
+
           
if ( isCollapsed ) {
+
            var NavToggleText = document.createTextNode(NavigationBarHide);
for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
+
            NavToggle.appendChild(NavToggleText);
if ( $( navChild ).hasClass( 'NavPic' ) || $( navChild ).hasClass( 'NavContent' ) ) {
+
            // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
navChild.style.display = 'none';
+
            for(
}
+
              var j=0;  
}
+
              j < NavFrame.childNodes.length;  
}
+
              j++
navToggleText = document.createTextNode( isCollapsed ? navigationBarShow : navigationBarHide );
+
            ) {
navToggle.appendChild( navToggleText );
+
              if (hasClass(NavFrame.childNodes[j], "NavHead")) {
 
+
                NavFrame.childNodes[j].appendChild(NavToggle);
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
+
              }
for ( j = 0; j < navFrame.childNodes.length; j++ ) {
+
            }
if ( $( navFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
+
            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
navToggle.style.color = navFrame.childNodes[j].style.color;
+
        }
navFrame.childNodes[j].appendChild( navToggle );
+
    }
}
+
    // if more Navigation Bars found than Default: hide all
}
+
    if (NavigationBarShowDefault < indexNavigationBar) {
navFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
+
        for(
} );
+
                var i=1;
}
+
                i<=indexNavigationBar;  
 
+
                i++
mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );
+
        ) {
 +
            toggleNavigationBar(i);
 +
        }
 +
    }
 +
 
 +
  }
 +
 
 +
  $( createNavigationBarToggleButton );
  
 
  /** "Technical restrictions" title fix *****************************************
 
  /** "Technical restrictions" title fix *****************************************
Sətir 376: Sətir 414:
 
                         realTitleBanner.style.display = "none";
 
                         realTitleBanner.style.display = "none";
 
                 }
 
                 }
                 document.title = realTitleText + " - Şəki Ensiklopediyası";
+
                 document.title = realTitleText + " - Wikipedia, the free encyclopedia";
 
             }
 
             }
 
         }
 
         }
Sətir 533: Sətir 571:
 
var searchEngines = {
 
var searchEngines = {
 
   mediawiki: {
 
   mediawiki: {
     ShortName: "MediaWiki axtarışı",
+
     ShortName: "Şəki Ensiklopediyasında axtarış",
     Template: "/w/index.php?search={searchTerms}"
+
     Template: "/wiki/index.php?search={searchTerms}"
 +
  },
 +
  globalwpsearch: {
 +
    ShortName: "Qlobal vikipediyalar",
 +
    Template: "http://vs.aka-online.de/cgi-bin/globalwpsearch.pl?timeout=120&search={searchTerms}"
 
   },
 
   },
 
   google: {
 
   google: {
 
     ShortName: "Google",
 
     ShortName: "Google",
     Template: "http://www.google.cat/search?as_sitesearch=wiki.sheki.site&hl={language}&q={searchTerms}"
+
     Template: "http://www.google.cat/search?as_sitesearch=shaki.info&hl={language}&q={searchTerms}"
 +
  },
 +
  wikiwix: {
 +
    ShortName: "Wikiwix",
 +
    Template: "http://www.wikiwix.com/index.php?action={searchTerms}&lang=az"
 
   },
 
   },
 
   yahoo: {
 
   yahoo: {
 
     ShortName: "Yahoo!",
 
     ShortName: "Yahoo!",
     Template: "http://search.yahoo.com/search?p={searchTerms}&vs=wiki.sheki.site"
+
     Template: "http://search.yahoo.com/search?p={searchTerms}&vs=shaki.info"
 
   },
 
   },
 
   wlive: {
 
   wlive: {
 
     ShortName: "Windows Live",
 
     ShortName: "Windows Live",
     Template: "http://search.live.com/results.aspx?q={searchTerms}&q1=site:http://wiki.sheki.site"
+
     Template: "http://search.live.com/results.aspx?q={searchTerms}&q1=site:http://shaki.info"
 
   }
 
   }
 
};
 
};
Sətir 730: Sətir 776:
 
}
 
}
  
 +
    /**
 +
* imgToggle
 +
*/
 +
// На странице есть как минимум один элемент div.img_toggle
 +
if ( $( 'div.img_toggle' ).length ) {
 +
mw.loader.load( 'ext.gadget.imgToggle' );
 +
}
 +
/**
 +
* Magic editintros ****************************************************
 +
*
 +
* Description: Adds editintros on disambiguation pages and BLP pages.
 +
* Maintainers: [[User:RockMFR]]
 +
*/
 +
function addEditIntro( name ) {
 +
$( '.mw-editsection, #ca-edit, #ca-ve-edit' ).find( 'a' ).each( function ( i, el ) {
 +
el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
 +
} );
 +
}
  
/**
+
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
* Imagemap Highlight
+
$( function () {
$(document).ready(function() {
+
if ( document.getElementById( 'disambigbox' ) ) {
 +
addEditIntro( 'Template:Disambig_editintro' );
 +
}
 +
} );
  
    var
+
$( function () {
//add this class to all elements created by the script. the reason is that we call the script again on
+
var cats = mw.config.get('wgCategories');
//window resize, and use the class to remove all the "artefacts" we created in the previous run.
+
if ( !cats ) {
myClassName = 'imageMapHighlighterArtefacts'
+
return;
, liHighlightClass = 'liHighlighting'
+
}
, specialAreaMark = 'area_mark'
+
if ( $.inArray( 'Yaşayan insanlar', cats ) !== -1 || $.inArray( 'Yaşayan insanlar', cats ) !== -1 ) {
, specialLiClassesMark = 'list_classes'
+
addEditIntro( 'Template:BLP_editintro' );
// "2d context" attributes used for highlighting.
+
}
, areaHighLighting = {fillStyle: 'rgba(0,0,0,0.35)', strokeStyle: 'yellow', lineJoin: 'round', lineWidth: 2}
+
} );
//every imagemap that wants highlighting, should reside in a div of this 'class':
+
}
, hilightDivMarker = '.imageMapHighlighter'
+
 
// specifically for wikis - redlinks tooltip adds this message
+
$(function() {
, az = mw && mw.config && mw.config.get('wgUserLanguage') == 'az'
+
 
, expandLegend = az ? 'Adları göstər' : 'ּShow Legend'
+
var
, collapseLegend = az ? 'Adları gizlət' : 'Hide Legend'
+
//add this class to all elements created by the script. the reason is that we call the script again on
;
+
//window resize, and use the class to remove all the "artefacts" we created in the previous run.
 +
myClassName = 'imageMapHighlighterArtefacts',
 +
liHighlightClass = 'liHighlighting',
 +
specialAreaMark = 'area_mark',
 +
specialLiClassesMark = 'list_classes',
 +
specialAreaMarkFile = 'area_mark_file',
 +
// "2d context" attributes used for highlighting.
 +
areaHighLighting = {
 +
fillStyle: 'rgba(0,0,0,0.35)',
 +
strokeStyle: 'yellow',
 +
lineJoin: 'round',
 +
lineWidth: 2
 +
},
 +
//every imagemap that wants highlighting, should reside in a div of this 'class':
 +
hilightDivMarker = '.imageMapHighlighter',
 +
// specifically for wikis - redlinks tooltip adds this message
 +
ru = mw && mw.config && mw.config.get('wgUserLanguage') == 'ru',
 +
expandLegend = ru ? 'показать ссылки текстом' : 'sıyahını aç',
 +
collapseLegend = ru ? 'скрыть ссылки текстом' : 'siyahını bağla',
 +
files = [];
  
  
Sətir 765: Sətir 851:
 
context.beginPath();
 
context.beginPath();
 
switch (areas[i].shape) {
 
switch (areas[i].shape) {
case 'rect': drawPoly([coords[0], coords[1], coords[0], coords[3], coords[2], coords[3], coords[2], coords[1]]); break;
+
case 'rect':
case 'circle': context.arc(coords[0],coords[1],coords[2],0,Math.PI*2); break;//x,y,r,startAngle,endAngle
+
drawPoly([coords[0], coords[1], coords[0], coords[3], coords[2], coords[
case 'poly': drawPoly(coords); break;
+
3], coords[2], coords[1]]);
 +
break;
 +
case 'circle':
 +
context.arc(coords[0], coords[1], coords[2], 0, Math.PI * 2);
 +
break; //x,y,r,startAngle,endAngle
 +
case 'poly':
 +
drawPoly(coords);
 +
break;
 
}
 
}
 
context.closePath();
 
context.closePath();
Sətir 781: Sətir 874:
 
ol = $this.parent(),
 
ol = $this.parent(),
 
context = ol.data('context'),
 
context = ol.data('context'),
special = ol.data(specialAreaMark);
+
special = ol.data(specialAreaMark),
+
specialFile = ol.data(specialAreaMarkFile); //read JSON file addition
 +
 
 +
if (specialFile) {
 +
if (files[specialFile]) {
 +
$.extend(special, files[specialFile]);
 +
always(activate, caption, context, ol, special, $this);
 +
} else {
 +
$.get(mw.util.wikiScript(), {
 +
title: specialFile,
 +
action: 'raw'
 +
})
 +
.done(function(data) {
 +
files[specialFile] = JSON.parse(data);
 +
$.extend(special, files[specialFile]);
 +
})
 +
.always(function() {
 +
always(activate, caption, context, ol, special, $this);
 +
});
 +
}
 +
} else
 +
always(activate, caption, context, ol, special, $this);
 +
}
 +
 
 +
function always(activate, caption, context, ol, special, $this) {
 
$this.toggleClass(liHighlightClass, activate); // mark/unmark the list item.  
 
$this.toggleClass(liHighlightClass, activate); // mark/unmark the list item.  
+
 
 
context.clearRect(0, 0, context.canvas.width, context.canvas.height); // prepare for a new day.
 
context.clearRect(0, 0, context.canvas.width, context.canvas.height); // prepare for a new day.
+
 
ol.find('li').each(function() {
+
ol.find('li')
var $li = $(this);
+
.each(function() {
var licap = $li.text();
+
var $li = $(this);
var param;
+
var licap = $li.text();
if (activate && licap === caption) { // highlight!!!
+
var param;
param = special && special.hover || areaHighLighting;
+
if (activate && licap === caption) { // highlight!!!
} else {
+
param = special && (special.hover && special.hover[licap]
param = special && special.nover && (special.nover[licap] || special.nover.default);
+
|| getblocks(special, licap)) || areaHighLighting;
}
+
} else {
if (param) {
+
param = special && special.nover && (special.nover[licap] || special.nover
$.extend(context, param);
+
.default);
drawMarker(context, $li.data('areas'));
+
}
}
+
if (param) {
});
+
$.extend(context, param);
 +
drawMarker(context, $li.data('areas'));
 +
}
 +
});
 
}
 
}
  
 +
function getblocks(special, licap) {
 +
if (special.hoverblocks) {
 +
if (special.hoverblocks[licap])
 +
return special.hoverblocks[licap].value;
 +
for (var key in special.hoverblocks)
 +
if (special.hoverblocks[key] && special.hoverblocks[key].list.indexOf(licap) >=0 )
 +
return special.hoverblocks[key].value;
 +
}
 +
if (special.hover)
 +
return special.hover.default;
 +
}
 +
 
function handleOneMap() {
 
function handleOneMap() {
var img = $(this),  
+
var img = $(this),
w = img.width(),  
+
w = img.width(),
 
h = img.height(),
 
h = img.height(),
 +
infoIcon = img.next(),
 +
parent = img.parent(),
 
map = img.siblings('map:first'),
 
map = img.siblings('map:first'),
dims = {position: 'absolute', width: w + 'px', height: h + 'px', border: 0, top:0, left:0},
+
dims = {
specialHighlight = img.closest(hilightDivMarker).data(specialAreaMark),
+
position: 'absolute',
specialLiClasses = img.closest(hilightDivMarker).data(specialLiClassesMark);
+
width: w + 'px',
+
height: h + 'px',
+
border: 0,
if (!('area', map).length)
+
top: 0,
return; //not an imagemap. inside "each" anonymous function, 'return' means "continue".
+
left: 0
 +
},
 +
specialHighlight = img.closest(hilightDivMarker)
 +
.data(specialAreaMark),
 +
specialLiClasses = img.closest(hilightDivMarker)
 +
.data(specialLiClassesMark),
 +
specialHover = img.closest(hilightDivMarker)
 +
.data(specialAreaMarkFile);
 +
 
 +
if (!('area', map)
 +
.length)
 +
return; //not an imagemap. inside "each" anonymous function, 'return' means "continue".
  
var jcanvas = $('<canvas>', {'class': myClassName})
+
var jcanvas = $('<canvas>', {
 +
'class': myClassName
 +
})
 
.css(dims)
 
.css(dims)
.attr({width: w, height: h});
+
.attr({
var bgimg = $('<img>', {'class': myClassName, src: img.attr('src')})
+
width: w,
.css(dims);//completely inert image. this is what we see.
+
height: h
 +
});
 +
var bgimg = $('<img>', {
 +
'class': myClassName,
 +
src: img.attr('src')
 +
})
 +
.css(dims); //completely inert image. this is what we see.
 
var context = $.extend(jcanvas[0].getContext("2d"), areaHighLighting);
 
var context = $.extend(jcanvas[0].getContext("2d"), areaHighLighting);
+
 
// this is where the magic is done: prepare a sandwich of the inert bgimg at the bottom,
+
// this is where the magic is done: prepare a sandwich of the inert bgimg at the bottom,
// the canvas above it, and the original image on top,
+
// the canvas above it, and the original image on top,
// so canvas won't steal the mouse events.
+
// so canvas won't steal the mouse events.
// pack them all TIGHTLY in a newly minted "relative" div, so when page chnage
+
// pack them all TIGHTLY in a newly minted "relative" div, so when page chnage
// (other scripts adding elements, window resize etc.), canvas and imagese remain aligned.
+
// (other scripts adding elements, window resize etc.), canvas and imagese remain aligned.
var div = $('<div>').css({position: 'relative', width: w + 'px', height: h + 'px'});
+
var div = $('<div>')
img.before(div); // put the div just above the image, and ...
+
.css({
div.append(bgimg) // place the background image in the div
+
position: 'relative',
.append(jcanvas)// and the canvas. both are "absolute", so they don't occupy space in the div
+
width: w + 'px',
.append(img); // now yank the original image from the window and place it on the div.
+
height: h + 'px'
img.fadeTo(1, 0); // make the image transparent - we see canvas and bgimg through it.  
+
});
// the original, now transparent image is creating our mouse events
+
img.before(div); // put the div just above the image, and ...
+
div.append(bgimg) // place the background image in the div
var ol = $('<ol>', {'class': myClassName})
+
.append(jcanvas) // and the canvas. both are "absolute", so they don't occupy space in the div
.css({clear: 'both', margin: 0, listStyle: 'none', maxWidth: w + 'px', float: 'left', position: 'relative'})
+
.append(img); // now yank the original image from the window and place it on the div.
.attr({'data-expandtext' : expandLegend, 'data-collapsetext': collapseLegend})
+
img.fadeTo(1, 0); // make the image transparent - we see canvas and bgimg through it.  
 +
// the original, now transparent image is creating our mouse events
 +
 
 +
infoIcon.css({
 +
position: 'relative'
 +
}); // set position to info icon
 +
var ol = $('<ol>', {
 +
'class': myClassName
 +
})
 +
.css({
 +
clear: 'both',
 +
margin: 0,
 +
listStyle: 'none',
 +
maxWidth: w + 'px',
 +
position: 'relative'
 +
})
 
.data(specialAreaMark, specialHighlight)
 
.data(specialAreaMark, specialHighlight)
 +
.data(specialAreaMarkFile, specialHover)
 
.data('context', context);
 
.data('context', context);
 +
var oldiv = $('<div>')
 +
.html(ol)
 +
.css({
 +
clear: 'both',
 +
margin: 0,
 +
listStyle: 'none',
 +
maxWidth: w + 'px',
 +
position: 'relative'
 +
})
 +
.attr({
 +
'data-expandtext': expandLegend,
 +
'data-collapsetext': collapseLegend
 +
});
  
// ol below image, hr below ol. original caption pushed below hr.
+
// ol below image parent, hr below ol. original caption pushed below hr.
div.after($('<hr>', {'class': myClassName}).css('clear', 'both'))
+
parent.after($('<hr>', {
.after(ol);
+
'class': myClassName
var lis = {}; //collapse areas with same caption to one list item
+
})
 +
.css('clear', 'both'))
 +
.after(oldiv);
 +
$('<hr>', {
 +
'class': myClassName
 +
})
 +
.css('clear', 'both')
 +
.insertBefore($(oldiv));
 +
 +
var lis = {}; //collapse areas with same caption to one list item
 
var someli; // select arbitrary one
 
var someli; // select arbitrary one
$('area', map).each(function() {
+
$('area', map)
var text = this.title;
+
.each(function() {
var li = lis[text]; // title already met? use the same li
+
var text = this.title;
if (!li) { //no? create a new one.
+
var li = lis[text]; // title already met? use the same li
var href = this.href;
+
if (!li) { //no? create a new one.
lis[text] = li = $('<li>', {'class': myClassName})
+
var href = this.href;
.append($('<a>', {href: href, text: text}))  
+
lis[text] = li = $('<li>', {
.on('mouseover mouseout', mouseAction)
+
'class': myClassName
.data('areas', [])
+
})
.addClass(specialLiClasses && (specialLiClasses[text] || specialLiClasses['default']))
+
.append($('<a>', {
.appendTo(ol);
+
href: href,
}
+
text: text
li.data('areas').push(this); //add the area to the li
+
}))
someli = li; // whichever - we just want one...
+
.on('mouseover mouseout', mouseAction)
$(this).on('mouseover mouseout', function(e) {li.trigger(e);});
+
.data('areas', [])
});
+
.addClass(specialLiClasses && (specialLiClasses[text] ||
 +
specialLiClasses['default']))
 +
.appendTo(ol);
 +
if (specialLiClasses && specialLiClasses[text + ' super'])
 +
li.find('a')
 +
.addClass(specialLiClasses[text + ' super']);
 +
}
 +
li.data('areas')
 +
.push(this); //add the area to the li
 +
someli = li; // whichever - we just want one...
 +
$(this)
 +
.on('mouseover mouseout', function(e) {
 +
li.trigger(e);
 +
});
 +
});
 
if (someli) someli.trigger('mouseout');
 
if (someli) someli.trigger('mouseout');
ol.addClass('mw-collapsed')
+
oldiv.addClass('mw-collapsed')
.makeCollapsible();
+
.makeCollapsible();
 +
ol.attr('style', ol.attr('style')
 +
.replace('none', 'disc'));
 
}
 
}
  
 
function init() {
 
function init() {
mw.util.addCSS('li.' + myClassName + '{white-space:nowrap;border:solid 1px transparent;border-radius:6px;}\n' + //css for li element
+
mw.util.addCSS('li.' + myClassName +
'li.' +  myClassName + '.' + liHighlightClass + '{background-color:yellow;border-color:green;}\n' + //css for highlighted li element.
+
'{white-space:nowrap; font-size:88.36%;}\n' + //css for li element
'.rtl li.' + myClassName + '{float: right; margin-left: 3em;}\n' +
+
'li.' + liHighlightClass + '{background-color:yellow;}\n' + //css for highlighted li element.
'.ltr li.' + myClassName + '{float: left; margin-right: 3em;}');
+
'.rtl li.' + myClassName + '{float: right; margin-left: 1.5em;}\n' +
$(hilightDivMarker+ ' img').each(handleOneMap);
+
'.ltr li.' + myClassName + '{float: left; margin-right: 1.5em;}\n' +
 +
hilightDivMarker + ' .mw-collapsible-toggle {float: none}');
 +
$(hilightDivMarker + ' img')
 +
.each(handleOneMap);
 
}
 
}
  
 
//has at least one "imagehighlight" div, and canvas-capable browser:
 
//has at least one "imagehighlight" div, and canvas-capable browser:
if ( $(hilightDivMarker).length && $('<canvas>')[0].getContext )
+
if ($(hilightDivMarker)
mw.loader.using( ['jquery.makeCollapsible', 'mediawiki.util'] ).done( init );
+
.length && $('<canvas>')[0].getContext)
 +
mw.loader.using(['jquery.makeCollapsible', 'mediawiki.util'])
 +
.done(init);
 
});
 
});
 
    /**
 
* imgToggle
 
*/
 
// На странице есть как минимум один элемент div.img_toggle
 
if ( $( 'div.img_toggle' ).length ) {
 
mw.loader.load( 'ext.gadget.imgToggle' );
 
}
 
/**
 
* Magic editintros ****************************************************
 
*
 
* Description: Adds editintros on disambiguation pages and BLP pages.
 
* Maintainers: [[User:RockMFR]]
 
*/
 
function addEditIntro( name ) {
 
$( '.mw-editsection, #ca-edit, #ca-ve-edit' ).find( 'a' ).each( function ( i, el ) {
 
el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
 
} );
 
}
 
 
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
 
$( function () {
 
if ( document.getElementById( 'disambigbox' ) ) {
 
addEditIntro( 'Template:Disambig_editintro' );
 
}
 
} );
 
 
$( function () {
 
var cats = mw.config.get('wgCategories');
 
if ( !cats ) {
 
return;
 
}
 
if ( $.inArray( 'Yaşayan insanlar', cats ) !== -1 || $.inArray( 'Yaşayan insanlar', cats ) !== -1 ) {
 
addEditIntro( 'Template:BLP_editintro' );
 
}
 
} );
 
}
 

Səhifəsinin 04:41, 2 dekabr 2023 tarixinə olan son halı

/* Burada redaktorların hamısı üçün bütün səhifələrdə istənilən JavaScript yüklənəcək */
// Switch language variants of messages (from zh)
function wgULS(latn,arab){
        //
        az=latn||arab;
        az=az;
        latn=latn;
        arab=arab;
        switch(mw.config.get('wgUserLanguage')){
                case "az": return ku;
                case "az-arab": return arab;
                case "az-latn": return latn;
                default: return "";
        }
}

/** Skript für Vorlage:Galerie */
$(function() {
  if (document.URL.match(/printable/g)) return;
 
  function toggleImageFunction(group,  remindex, shwindex) {
    return function() {
      document.getElementById("ImageGroupsGr" + group + "Im" + remindex).style.display = "none";
      document.getElementById("ImageGroupsGr" + group + "Im" + shwindex).style.display = "block";
      return false;
    };
  }
 
  var divs = document.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 = [];
    for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
      var temp = UnitNode.childNodes[j];
      if (temp.className === "center") { units.push(temp); }
    }
    var rightlink;
    var commentText;
    for (j = 0; j < units.length; j++) {
      currentimage = units[j];
      currentimage.id = "ImageGroupsGr" + i + "Im" + j;
      var leftlink = document.createElement("a");
      if (commentText !== undefined) {
        leftlink.setAttribute("title", commentText);
      }
      var comment;
      if (typeof(currentimage.getAttribute("title")) !== "string") {
        commentText = (j+1) + "/" + units.length;
        comment = document.createElement("tt").appendChild(document.createTextNode("("+ commentText + ")"));
      }
      else {
        commentText = currentimage.getAttribute("title");
        comment = document.createElement("span").appendChild(document.createTextNode(commentText));
        currentimage.removeAttribute("title");
      }
      if(rightlink !== undefined) {
        rightlink.setAttribute("title", commentText);
      }
      var imghead = document.createElement("div");
      rightlink = document.createElement("a");
      if (j !== 0) {
        leftlink.href = "#";
        leftlink.onclick = toggleImageFunction(i, j, j-1);
        leftlink.appendChild(document.createTextNode("◀"));
      }
      if (j != units.length - 1) {
        rightlink.href = "#";
        rightlink.onclick = toggleImageFunction(i, j, j+1);
        rightlink.appendChild(document.createTextNode("▶"));
      }
      imghead.style.fontSize = "110%";
      imghead.style.fontweight = "bold";
      imghead.appendChild(leftlink);
      imghead.appendChild(document.createTextNode("\xA0"));
      imghead.appendChild(comment);
      imghead.appendChild(document.createTextNode("\xA0"));
      imghead.appendChild(rightlink);
      if (units.length > 1) {
        currentimage.insertBefore(imghead,currentimage.childNodes[0]);
      }
      if (j !== 0) {
        currentimage.style.display = "none";
      }
    }
  }
});

 /* 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);
     };
 })();


 /** 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]]
  */
 
//Messages
var listFA = {
 fa:'Bu başqa dildəki seçilmiş məqalədir',
 fl:'Bu başqa dildəki seçilmiş siyahıdır',
 ga:'Bu başqa dildəki yaxşı məqalədir'};

var zeroSectionTip = 'Girişi redaktə et';

var NavigationBarHide = '[bağla]';
var NavigationBarShow = '[bax]';
var NavigationBarShowDefault = 2;

function LinkFA(){
 var ll, s;
 $('#p-lang li').each( function(i, iw){
   ll = iw.className.replace(/^.*?(interwiki-)/, '$1').replace(/\s.*$/, '') + '-';
   for( var s in listFA )
     if( document.getElementById(ll + s) && !$( iw ).hasClass( 'badge-featuredarticle' ) && !$( iw ).hasClass( 'badge-goodarticle' ) && !$( iw ).hasClass( 'badge-featuredlist' ) )
       $( iw )
        .addClass( s.toUpperCase() )
        .attr( 'title',  listFA[s] + textFA );
 });
}


function editZeroSection(){
 if( !mw.config.get('wgArticleId') ) return;
 mw.util.$content.find('h2')
 .children('.mw-editsection:first')
 .clone().prependTo('#bodyContent')
 .css('float','right')
 .find('a')
 .each(function(index) {
 	$( this ).attr('title', zeroSectionTip);
 	if ($( this ).attr('class') === "mw-editsection-visualeditor" ) { 
 		$( this ).attr('href', mw.config.get('wgScript') + '?title='+mw.util.wikiUrlencode(mw.config.get('wgPageName')) + '&veaction=edit&vesection=0');
 	} else { 
 		$( this ).attr('href', mw.config.get('wgScript') + '?title='+mw.util.wikiUrlencode(mw.config.get('wgPageName')) + '&action=edit&section=0');
 	} 
 });
}


 /** Collapsible tables *********************************************************
  *
  *  Description: Allows tables to be collapsed, showing only the header. See
  *               [[Wikipedia:NavFrame]].
  *  Maintainers: [[User:R. Koot]]
  */
 
 var autoCollapse = 2;
 var collapseCaption = "bağla";
 var expandCaption = "bax";
 
 function collapseTable( tableIndex )
 {
     var Button = document.getElementById( "collapseButton" + tableIndex );
     var Table = document.getElementById( "collapsibleTable" + tableIndex );
     var i;
     if ( !Table || !Button ) {
         return false;
     }
 
     var Rows = Table.getElementsByTagName( "tr" ); 
 
     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 = Rows[0].style.display;
         }
         Button.firstChild.data = collapseCaption;
     }
 }
 
 function createCollapseButtons()
 {
     var tableIndex = 0;
     var NavigationBoxes = {};
     var Tables = document.getElementsByTagName( "table" );
     var i;
     for ( 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 );
             ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
             ButtonLink.appendChild( ButtonText );
 
             Button.appendChild( document.createTextNode( "[" ) );
             Button.appendChild( ButtonLink );
             Button.appendChild( document.createTextNode( "]" ) );
 
             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++;
             }
         }
     }
 
     for ( i = 0;  i < tableIndex; i++ ) {
         if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
             collapseTable( i );
         }
     }
 }
 
 $( createCollapseButtons );

 /** Dynamic Navigation Bars (experimental) *************************************
  *
  *  Description: See [[Wikipedia:NavFrame]].
  *  Maintainers: UNMAINTAINED
  */
 
  // set up the words in your language
  var NavigationBarHide = '[' + collapseCaption + ']';
  var NavigationBarShow = '[' + expandCaption + ']';
  
  // 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 = autoCollapse;
  
  
  // 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 ( hasClass( NavChild, 'NavPic' ) ) {
                 NavChild.style.display = 'none';
             }
             if ( hasClass( NavChild, '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 (hasClass(NavChild, 'NavPic')) {
                 NavChild.style.display = 'block';
             }
             if (hasClass(NavChild, '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 
     var divs = document.getElementsByTagName("div");
     for(
             var i=0; 
             NavFrame = divs[i]; 
             i++
         ) {
         // if found a navigation bar
         if (hasClass(NavFrame, "NavFrame")) {
  
             indexNavigationBar++;
             var NavToggle = document.createElement("a");
             NavToggle.className = 'NavToggle';
             NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
             NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
             
             var NavToggleText = document.createTextNode(NavigationBarHide);
             NavToggle.appendChild(NavToggleText);
             // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
             for(
               var j=0; 
               j < NavFrame.childNodes.length; 
               j++
             ) {
               if (hasClass(NavFrame.childNodes[j], "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);
         }
     }
   
  }
  
  $( createNavigationBarToggleButton );

 /** "Technical restrictions" title fix *****************************************
 *
 * Description:
 * Maintainers: User:Interiot, User:Mets501, User:Freakofnurture
 */
 //
 // 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: 
 // &lt;div id="RealTitleBanner"&gt;  ... &lt;span id="RealTitle"&gt;title&lt;/span&gt; ... &lt;/div&gt;
 // An element with id=DisableRealTitle disables the function.
 //
 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;
                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 (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.charAt(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, the free encyclopedia";
            }
        }
    } 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;
 }

 //fix edit summary prompt for undo
 //this code fixes the fact that the undo function combined with the "no edit summary prompter" causes problems if leaving the
 //edit summary unchanged
 //this was added by [[User:Deskana]], code by [[User:Tra]]
 $(function () {
   if (document.location.search.indexOf("undo=") != -1
   && document.getElementsByName('wpAutoSummary')[0]) {
     document.getElementsByName('wpAutoSummary')[0].value='';
   }
 })

/**
 * Qeydiyyatdan keçmiş istifadəçilər üçün gizli kateqoriyaların göstərilməsi üçün (+) düyməsini əlavə edən funksiya
 */
function hiddencat( $ ) {
	if (mw.util.getParamValue('printable') === 'yes') {
		return;
	}
	var cl = document.getElementById('catlinks');
	if (!cl) {
		return;
	}
	var $hc = $('#mw-hidden-catlinks');
	if ( !$hc.length ) {
		return;
	}
	if ( $hc.hasClass('mw-hidden-cats-user-shown') ) {
		return;
	}
	if ( $hc.hasClass('mw-hidden-cats-ns-shown') ) {
		$hc.addClass('mw-hidden-cats-hidden');
	}
	var nc = document.getElementById('mw-normal-catlinks');
	if ( !nc ) {
		var catline = document.createElement('div');
		catline.id = 'mw-normal-catlinks';
		var a = document.createElement('a');
		a.href = '';
		a.title = '';
		a.appendChild(document.createTextNode('Kateqoriyalar'));
		catline.appendChild(a);
		catline.appendChild(document.createTextNode(' : '));
		nc = cl.insertBefore(catline, cl.firstChild);
	}
	var lnk = document.createElement('a');
	lnk.id = 'mw-hidden-cats-link';
	lnk.title = 'Bu məqalədə gizli kateqoriyalar var';
	lnk.style.cursor = 'pointer';
	lnk.style.color = 'black';
	lnk.style.marginLeft = '0.3em';
	$(lnk).click(toggleHiddenCats);
	lnk.appendChild(document.createTextNode('[+]'));
	nc.appendChild(lnk);
}

function toggleHiddenCats(e) {
	var $hc = $('#mw-hidden-catlinks');
	if ( $hc.hasClass('mw-hidden-cats-hidden') ) {
		$hc.removeClass('mw-hidden-cats-hidden');
		$hc.addClass('mw-hidden-cat-user-shown');
		$(e.target).text('[–]');
	} else {
		$hc.removeClass('mw-hidden-cat-user-shown');
		$hc.addClass('mw-hidden-cats-hidden');
		$(e.target).text('[+]');
	}
}

mw.loader.using('mediawiki.util', function () {
	$( hiddencat );
});

 /** Add dismiss button to watchlist-message *************************************
  *
  *  Description: Hide the watchlist message for one week.
  *  Maintainers: [[User:Ruud Koot|Ruud Koot]]
  */
 
 function addDismissButton() {
    var watchlistMessage = document.getElementById("watchlist-message");
    if ( watchlistMessage == null ) return;
 
    if ( document.cookie.indexOf( "hidewatchlistmessage=yes" ) != -1 ) {
        watchlistMessage.style.display = "none";
    }
 
    var Button     = document.createElement( "span" );
    var ButtonLink = document.createElement( "a" );
    var ButtonText = document.createTextNode( "dismiss" );
 
    ButtonLink.setAttribute( "id", "dismissButton" );
    ButtonLink.setAttribute( "href", "javascript:dismissWatchlistMessage();" );
    ButtonLink.setAttribute( "title", "Hide this message for one week" );
    ButtonLink.appendChild( ButtonText );
 
    Button.appendChild( document.createTextNode( "[" ) );
    Button.appendChild( ButtonLink );
    Button.appendChild( document.createTextNode( "]" ) );
 
    watchlistMessage.appendChild( Button );
 }
 
 function dismissWatchlistMessage() {
     var e = new Date();
     e.setTime( e.getTime() + (7*24*60*60*1000) );
     document.cookie = "hidewatchlistmessage=yes; expires=" + e.toGMTString() + "; path=/";
     var watchlistMessage = document.getElementById("watchlist-message");
     watchlistMessage.style.display = "none";
 }
 
 $( addDismissButton );

 /** MediaWiki media player *******************************************************
   *
   *  Description: A Java player for in-browser playback of media files.
   *  Created by: [[User:Gmaxwell]]
   */
 
mw.loader.load('//en.wikipedia.org/w/index.php?title=Mediawiki:Wikimediaplayer.js&action=raw&ctype=text/javascript');

// Choice of multiple search engines
// Autor: Jakob Voss, Guillaume (tret de de:MediaWiki:SpezialSuche.js)
// Version: 0.3.8
// Published as Public Domain

// Map of search engines and some OpenSearch-based fields
var searchEngines = {
  mediawiki: {
    ShortName: "Şəki Ensiklopediyasında axtarış",
    Template: "/wiki/index.php?search={searchTerms}"
  },
  globalwpsearch: {
    ShortName: "Qlobal vikipediyalar",
    Template: "http://vs.aka-online.de/cgi-bin/globalwpsearch.pl?timeout=120&search={searchTerms}"
  },
  google: {
    ShortName: "Google",
    Template: "http://www.google.cat/search?as_sitesearch=shaki.info&hl={language}&q={searchTerms}"
  },
  wikiwix: {
    ShortName: "Wikiwix",
    Template: "http://www.wikiwix.com/index.php?action={searchTerms}&lang=az"
  },
  yahoo: {
    ShortName: "Yahoo!",
    Template: "http://search.yahoo.com/search?p={searchTerms}&vs=shaki.info"
  },
  wlive: {
    ShortName: "Windows Live",
    Template: "http://search.live.com/results.aspx?q={searchTerms}&q1=site:http://shaki.info"
  }
};
 

function externalSearchEngines() {
  if (typeof SpecialSearchEnhanced2Disabled != 'undefined') return;


  var mainNode = document.getElementById("powersearch");
  if (!mainNode) mainNode = document.getElementById("search");
  if (!mainNode) return;

  var beforeNode = document.getElementById("mw-search-top-table");
  if (!beforeNode) return;
  beforeNode = beforeNode.nextSibling;
  if (!beforeNode) return;
 
  var firstEngine = "mediawiki";
 
  var choices = document.createElement("div");
  choices.setAttribute("id","searchengineChoices");
  choices.style.textAlign = "center";
 
  var lsearchbox = document.getElementById("searchText");
  var initValue = lsearchbox.value;
 
  var space = "";

  for (var id in searchEngines) {
    var engine = searchEngines[id];
if(engine.ShortName)
   {
    if (space) choices.appendChild(space);
    space = document.createTextNode(" ");
 
    var attr = { 
      type: "radio", 
      name: "searchengineselect",
      value: id,
      onFocus: "changeSearchEngine(this.value)",
      id: "searchengineRadio-"+id
    };
 
    var html = "<input";
    for (var a in attr) html += " " + a + "='" + attr[a] + "'";
    html += " />";
    var span = document.createElement("span");
    span.innerHTML = html;
 
    choices.appendChild( span );
    var label
    if (engine.Template.indexOf('http') == 0) {
      label = document.createElement("a");
      label.href = engine.Template.replace("{searchTerms}", initValue).replace("{language}", "fr");
    } else {
      label = document.createElement("label");
    }
  
    label.appendChild( document.createTextNode( engine.ShortName ) );
    choices.appendChild( label );
  }
 }
  mainNode.insertBefore(choices, beforeNode);
 
  var input = document.createElement("input");
  input.id = "searchengineextraparam";
  input.type = "hidden";
 
  mainNode.insertBefore(input, beforeNode);

  changeSearchEngine(firstEngine, initValue);
}

function changeSearchEngine(selectedId, searchTerms) {

  var currentId = document.getElementById("searchengineChoices").currentChoice;
  if (selectedId == currentId) return;
 
  document.getElementById("searchengineChoices").currentChoice = selectedId;
  var radio = document.getElementById('searchengineRadio-'  + selectedId);
  radio.checked = "checked";
 
  var engine = searchEngines[selectedId];
  var p = engine.Template.indexOf('?');
  var params = engine.Template.substr(p+1);
 
  var form;
  if (document.forms["search"]) {
    form = document.forms["search"];
  } else {
    form = document.getElementById("powersearch");
  }
  form.setAttribute("action", engine.Template.substr(0,p));
 
  var l = ("" + params).split("&");
  for (var idx = 0;idx < l.length;idx++) {
    var p = l[idx].split("=");
    var pValue = p[1];
 
    if (pValue == "{language}") {
    } else if (pValue == "{searchTerms}") {
      var input;
      input = document.getElementById("searchText");
 
      input.name = p[0];
    } else {
      var input = document.getElementById("searchengineextraparam");
 
      input.name = p[0];
      input.value = pValue;
    }
  }
}


if (mw.config.get('wgCanonicalSpecialPageName') == "Search") {
   $(externalSearchEngines);
}
if (mw.config.get('wgAction') == "edit" || mw.config.get('wgAction') == "submit") {
  importScript('MediaWiki:Editpage.js');
}

// Sidebar Dəyişiklikləri
function ModifySidebar(action, section, name, link) {
    try {
        switch (section) {
          case "Başqa dillərdə":
            var target = "p-lang";
            break;
          case "Alətlər sandığı":
            var target = "p-tb";
            break;
          case "rəhbər":
            var target = "p-navigation";
            break;
          default:
            var target = "p-" + section;
            break;
        }
 
        if (action == "add") {
            var node = document.getElementById(target)
                               .getElementsByTagName('div')[0]
                               .getElementsByTagName('ul')[0];
 
            var aNode = document.createElement('a');
            var liNode = document.createElement('li');
 
            aNode.appendChild(document.createTextNode(name));
            aNode.setAttribute('href', link);
            liNode.appendChild(aNode);
            liNode.className='plainlinks';
            node.appendChild(liNode);
        }
 
        if (action == "remove") {
            var list = document.getElementById(target)
                               .getElementsByTagName('div')[0]
                               .getElementsByTagName('ul')[0];
 
            var listelements = list.getElementsByTagName('li');
 
            for (var i = 0; i < listelements.length; i++) {
                if (listelements[i].getElementsByTagName('a')[0].innerHTML == name ||
                    listelements[i].getElementsByTagName('a')[0].href == link) {
 
                    list.removeChild(listelements[i]);
                }
            }
        }
 
    } catch(e) {
      // lets just ignore what's happened
      return;
    }
}
//</source>
// 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");
}

    /**
	 * imgToggle
	 */
	// На странице есть как минимум один элемент div.img_toggle
	if ( $( 'div.img_toggle' ).length ) {
		mw.loader.load( 'ext.gadget.imgToggle' );
	}
/**
 * Magic editintros ****************************************************
 *
 * Description: Adds editintros on disambiguation pages and BLP pages.
 * Maintainers: [[User:RockMFR]]
 */
function addEditIntro( name ) {
	$( '.mw-editsection, #ca-edit, #ca-ve-edit' ).find( 'a' ).each( function ( i, el ) {
		el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
	} );
}

if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
	$( function () {
		if ( document.getElementById( 'disambigbox' ) ) {
			addEditIntro( 'Template:Disambig_editintro' );
		}
	} );

	$( function () {
		var cats = mw.config.get('wgCategories');
		if ( !cats ) {
			return;
		}
		if ( $.inArray( 'Yaşayan insanlar', cats ) !== -1 || $.inArray( 'Yaşayan insanlar', cats ) !== -1 ) {
			addEditIntro( 'Template:BLP_editintro' );
		}
	} );
}

$(function() {

	var
		//add this class to all elements created by the script. the reason is that we call the script again on
		//window resize, and use the class to remove all the "artefacts" we created in the previous run.
		myClassName = 'imageMapHighlighterArtefacts',
		liHighlightClass = 'liHighlighting',
		specialAreaMark = 'area_mark',
		specialLiClassesMark = 'list_classes',
		specialAreaMarkFile = 'area_mark_file',
		// "2d context" attributes used for highlighting.
		areaHighLighting = {
			fillStyle: 'rgba(0,0,0,0.35)',
			strokeStyle: 'yellow',
			lineJoin: 'round',
			lineWidth: 2
		},
		//every imagemap that wants highlighting, should reside in a div of this 'class':
		hilightDivMarker = '.imageMapHighlighter',
		// specifically for wikis - redlinks tooltip adds this message
		ru = mw && mw.config && mw.config.get('wgUserLanguage') == 'ru',
		expandLegend = ru ? 'показать ссылки текстом' : 'sıyahını aç',
		collapseLegend = ru ? 'скрыть ссылки текстом' : 'siyahını bağla',
		files = [];


	function drawMarker(context, areas) { // this is where the magic is done.

		function drawPoly(coords) {
			context.moveTo(coords.shift(), coords.shift());
			while (coords.length)
				context.lineTo(coords.shift(), coords.shift());
		}

		for (var i in areas) {
			var coords = areas[i].coords.split(',');
			context.beginPath();
			switch (areas[i].shape) {
				case 'rect':
					drawPoly([coords[0], coords[1], coords[0], coords[3], coords[2], coords[
						3], coords[2], coords[1]]);
					break;
				case 'circle':
					context.arc(coords[0], coords[1], coords[2], 0, Math.PI * 2);
					break; //x,y,r,startAngle,endAngle
				case 'poly':
					drawPoly(coords);
					break;
			}
			context.closePath();
			context.stroke();
			context.fill();
		}
	}

	function mouseAction(e) {
		var $this = $(this),
			activate = e.type == 'mouseover',
			caption = $this.text(),
			ol = $this.parent(),
			context = ol.data('context'),
			special = ol.data(specialAreaMark),
			specialFile = ol.data(specialAreaMarkFile); //read JSON file addition

		if (specialFile) {
			if (files[specialFile]) {
				$.extend(special, files[specialFile]);
				always(activate, caption, context, ol, special, $this);
			} else {
				$.get(mw.util.wikiScript(), {
						title: specialFile,
						action: 'raw'
					})
					.done(function(data) {
						files[specialFile] = JSON.parse(data);
						$.extend(special, files[specialFile]);
					})
					.always(function() {
						always(activate, caption, context, ol, special, $this);
					});
			}
		} else
			always(activate, caption, context, ol, special, $this);
	}

	function always(activate, caption, context, ol, special, $this) {
		$this.toggleClass(liHighlightClass, activate); // mark/unmark the list item. 

		context.clearRect(0, 0, context.canvas.width, context.canvas.height); // prepare for a new day.

		ol.find('li')
			.each(function() {
				var $li = $(this);
				var licap = $li.text();
				var param;
				if (activate && licap === caption) { // highlight!!!
					param = special && (special.hover && special.hover[licap]
						|| getblocks(special, licap)) || areaHighLighting;
				} else {
					param = special && special.nover && (special.nover[licap] || special.nover
						.default);
				}
				if (param) {
					$.extend(context, param);
					drawMarker(context, $li.data('areas'));
				}
			});
	}

	function getblocks(special, licap) {
		if (special.hoverblocks) {
			if (special.hoverblocks[licap])
				return special.hoverblocks[licap].value;
			for (var key in special.hoverblocks)
				if (special.hoverblocks[key] && special.hoverblocks[key].list.indexOf(licap) >=0 )
					return special.hoverblocks[key].value;
		}
		if (special.hover)
			return special.hover.default;
	}
	
	function handleOneMap() {
		var img = $(this),
			w = img.width(),
			h = img.height(),
			infoIcon = img.next(),
			parent = img.parent(),
			map = img.siblings('map:first'),
			dims = {
				position: 'absolute',
				width: w + 'px',
				height: h + 'px',
				border: 0,
				top: 0,
				left: 0
			},
			specialHighlight = img.closest(hilightDivMarker)
			.data(specialAreaMark),
			specialLiClasses = img.closest(hilightDivMarker)
			.data(specialLiClassesMark),
			specialHover = img.closest(hilightDivMarker)
			.data(specialAreaMarkFile);

		if (!('area', map)
			.length)
			return; //not an imagemap. inside "each" anonymous function, 'return' means "continue".

		var jcanvas = $('<canvas>', {
				'class': myClassName
			})
			.css(dims)
			.attr({
				width: w,
				height: h
			});
		var bgimg = $('<img>', {
				'class': myClassName,
				src: img.attr('src')
			})
			.css(dims); //completely inert image. this is what we see.
		var context = $.extend(jcanvas[0].getContext("2d"), areaHighLighting);

		// this is where the magic is done: prepare a sandwich of the inert bgimg at the bottom,
		// the canvas above it, and the original image on top,
		// so canvas won't steal the mouse events.
		// pack them all TIGHTLY in a newly minted "relative" div, so when page chnage
		// (other scripts adding elements, window resize etc.), canvas and imagese remain aligned.
		var div = $('<div>')
			.css({
				position: 'relative',
				width: w + 'px',
				height: h + 'px'
			});
		img.before(div); // put the div just above the image, and ...
		div.append(bgimg) // place the background image in the div
			.append(jcanvas) // and the canvas. both are "absolute", so they don't occupy space in the div
			.append(img); // now yank the original image from the window and place it on the div.
		img.fadeTo(1, 0); // make the image transparent - we see canvas and bgimg through it. 
		// the original, now transparent image is creating our mouse events

		infoIcon.css({
			position: 'relative'
		}); // set position to info icon
		var ol = $('<ol>', {
				'class': myClassName
			})
			.css({
				clear: 'both',
				margin: 0,
				listStyle: 'none',
				maxWidth: w + 'px',
				position: 'relative'
			})
			.data(specialAreaMark, specialHighlight)
			.data(specialAreaMarkFile, specialHover)
			.data('context', context);
		var oldiv = $('<div>')
			.html(ol)
			.css({
				clear: 'both',
				margin: 0,
				listStyle: 'none',
				maxWidth: w + 'px',
				position: 'relative'
			})
			.attr({
				'data-expandtext': expandLegend,
				'data-collapsetext': collapseLegend
			});

		// ol below image parent, hr below ol. original caption pushed below hr.
		parent.after($('<hr>', {
					'class': myClassName
				})
				.css('clear', 'both'))
			.after(oldiv);
		$('<hr>', {
					'class': myClassName
				})
				.css('clear', 'both')
			.insertBefore($(oldiv));
		
		var lis = {}; //collapse areas with same caption to one list item
		var someli; // select arbitrary one
		$('area', map)
			.each(function() {
				var text = this.title;
				var li = lis[text]; // title already met? use the same li
				if (!li) { //no? create a new one.
					var href = this.href;
					lis[text] = li = $('<li>', {
							'class': myClassName
						})
						.append($('<a>', {
							href: href,
							text: text
						}))
						.on('mouseover mouseout', mouseAction)
						.data('areas', [])
						.addClass(specialLiClasses && (specialLiClasses[text] ||
							specialLiClasses['default']))
						.appendTo(ol);
					if (specialLiClasses && specialLiClasses[text + ' super'])
						li.find('a')
							.addClass(specialLiClasses[text + ' super']);
				}
				li.data('areas')
					.push(this); //add the area to the li
				someli = li; // whichever - we just want one...
				$(this)
					.on('mouseover mouseout', function(e) {
						li.trigger(e);
					});
			});
		if (someli) someli.trigger('mouseout');
		oldiv.addClass('mw-collapsed')
			.makeCollapsible();
		ol.attr('style', ol.attr('style')
			.replace('none', 'disc'));
	}

	function init() {
		mw.util.addCSS('li.' + myClassName +
			'{white-space:nowrap; font-size:88.36%;}\n' + //css for li element
			'li.' + liHighlightClass + '{background-color:yellow;}\n' + //css for highlighted li element.
			'.rtl li.' + myClassName + '{float: right; margin-left: 1.5em;}\n' +
			'.ltr li.' + myClassName + '{float: left; margin-right: 1.5em;}\n' +
			hilightDivMarker + ' .mw-collapsible-toggle {float: none}');
		$(hilightDivMarker + ' img')
			.each(handleOneMap);
	}

	//has at least one "imagehighlight" div, and canvas-capable browser:
	if ($(hilightDivMarker)
		.length && $('<canvas>')[0].getContext)
		mw.loader.using(['jquery.makeCollapsible', 'mediawiki.util'])
		.done(init);
});