MediaWiki:Common.js: Redaktələr arasındakı fərq

3.584 bayt çıxarıldı ,  12 mart
Шариф Ахмет (müzakirə) tərəfindən edilmiş 62379 nömrəli redaktə geri qaytarıldı
Redaktənin izahı yoxdur
(Шариф Ахмет (müzakirə) tərəfindən edilmiş 62379 nömrəli redaktə geri qaytarıldı)
Teq: Geri qaytarma
 
(4 redaktor tərəfindən edilmiş 52 dəyişiklik göstərilmir)
Sətir 1: Sətir 1:
/**
* Skriptləri yükləmək üçün lokal skript
*/
var importScript_ = importScript;
importScript = function ( page, proj ) {
if ( !proj ) {
importScript_( page );
} else {
if ( proj.indexOf( '.' ) === -1 ) {
proj += '.sheki.org';
}
mw.loader.using( 'mediawiki.util' ).done( function () {
mw.loader.load( '//' + proj + '/w/index.php?title=' + mw.util.wikiUrlencode( page ) +
'&action=raw&ctype=text/javascript' );
} );
}
};
//runAsEarlyAsPossible from ruwiki
function runAsEarlyAsPossible( callback, $testElement, func ) {
func = func || $;
$testElement = $testElement || $( '#footer' );
if ( $testElement.length ) {
callback();
} else {
func( callback );
}
}
// Switch language variants of messages (from zh)
// Switch language variants of messages (from zh)
function wgULS(latn,arab){
function wgULS(latn,arab){
Sətir 44: Sətir 74:
     for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
     for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
       var temp = UnitNode.childNodes[j];
       var temp = UnitNode.childNodes[j];
       if (temp.className === "center") { units.push(temp); }
       if (['center', 'mw-halign-center'].some(function(className) { return temp.classList.contains(className); })) { units.push(temp); }
     }
     }
     var rightlink;
     var rightlink;
     var commentText;
     var commentText;
    var wrap;
     for (j = 0; j < units.length; j++) {
     for (j = 0; j < units.length; j++) {
       currentimage = units[j];
       currentimage = units[j];
       currentimage.id = "ImageGroupsGr" + i + "Im" + j;
       wrap = document.createElement('div');
      wrap.id = "ImageGroupsGr" + i + "Im" + j;
      currentimage.parentNode.insertBefore(wrap, currentimage);
      wrap.appendChild(currentimage);
       var leftlink = document.createElement("a");
       var leftlink = document.createElement("a");
       if (commentText !== undefined) {
       if (commentText !== undefined) {
Sətir 88: Sətir 122:
       imghead.appendChild(rightlink);
       imghead.appendChild(rightlink);
       if (units.length > 1) {
       if (units.length > 1) {
         currentimage.insertBefore(imghead,currentimage.childNodes[0]);
         wrap.insertBefore(imghead,wrap.childNodes[0]);
       }
       }
       if (j !== 0) {
       if (j !== 0) {
         currentimage.style.display = "none";
         wrap.style.display = "none";
       }
       }
     }
     }
Sətir 216: Sətir 250:
  * Dynamic Navigation Bars (experimental)
  * Dynamic Navigation Bars (experimental)
  *
  *
  * Description: See [[Wikipedia:NavFrame]].
  * Description: See [[Şəki Ensiklopediyası:NavFrame]].
  * Maintainers: UNMAINTAINED
  * Maintainers: UNMAINTAINED
  */
  */
Sətir 224: Sətir 258:


// Set up the words in your language
// Set up the words in your language
var navigationBarHide = '[' + collapseCaption + ']';
var navigationBarHide = '[' + collapseCaption.toLowerCase() + ']';
var navigationBarShow = '[' + expandCaption + ']';
var navigationBarShow = '[' + expandCaption.toLowerCase() + ']';


/**
/**
Sətir 263: Sətir 297:
event.preventDefault();
event.preventDefault();
}
}
/* [[Şablon:Yarımbaşlıq]] üçün */
function sousTitreH1( $content ) {
$( '#firstHeading > #second_header_h1' ).remove();
var $span = $content.find( '#second_header_h1' );
if ( $span.length ) {
$span.prepend( ' ' );
$( '#firstHeading' ).append( $span );
}
}
mw.hook( 'wikipage.content' ).add( sousTitreH1 );


/**
/**
Sətir 533: Sətir 579:
var searchEngines = {
var searchEngines = {
   mediawiki: {
   mediawiki: {
     ShortName: "MediaWiki axtarışı",
     ShortName: "Şəki Ensiklopediyası",
     Template: "/w/index.php?search={searchTerms}"
     Template: "/wiki/index.php?search={searchTerms}"
  },
  globalwpsearch: {
    ShortName: "Vikipediya",
    Template: "https://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: "https://www.google.cat/search?as_sitesearch=az.wikipedia.org&hl={language}&q={searchTerms}"
  },
  wikiwix: {
    ShortName: "Wikiwix",
    Template: "https://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: "https://search.yahoo.com/search?p={searchTerms}&vs=sheki.org"
   },
   },
   wlive: {
   wlive: {
     ShortName: "Windows Live",
     ShortName: "Windows Live",
     Template: "http://search.live.com/results.aspx?q={searchTerms}&q1=site:http://wiki.sheki.site"
     Template: "https://search.live.com/results.aspx?q={searchTerms}&q1=site:https://sheki.org"
   }
   }
};
};
Sətir 660: Sətir 714:
   }
   }
}
}


if (mw.config.get('wgCanonicalSpecialPageName') == "Search") {
if (mw.config.get('wgCanonicalSpecialPageName') == "Search") {
Sətir 667: Sətir 720:
if (mw.config.get('wgAction') == "edit" || mw.config.get('wgAction') == "submit") {
if (mw.config.get('wgAction') == "edit" || mw.config.get('wgAction') == "submit") {
   importScript('MediaWiki:Editpage.js');
   importScript('MediaWiki:Editpage.js');
  mw.loader.load('ext.gadget.wikificator');
}
}


Sətir 723: Sətir 777:
     }
     }
}
}
//</source>
//</source>
// Results from Wikidata
// Results from Wikidata
Sətir 730: Sətir 785:
}
}


/**
* Imagemap Highlight
*/
if ( $( '.imageMapHighlighter' ).length && $( '<canvas>' )[ 0 ].getContext ) {
importScript( 'MediaWiki:Imagemap-Highlight.js' );
}
/**
* imgToggle
*/
if ( $( 'div.img_toggle' ).length ) {
mw.loader.load( 'ext.gadget.imgToggle' );
}
/**
* withJS
* İzah: URL keçidləri ilə MediaViki skriptlərinin işə salınması
* @mənbə: www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
*/
(function() {
    var extraJS = mw.util.getParamValue('withJS');
    if (extraJS) {
        if (extraJS.match(/^Media[VW]iki:[^&<>=%#]*\.js$/)) {
            importScript(extraJS);
        } else {
            mw.notify( 'Yalnız MediaViki ad fəzasındakı səhifələrə icazə verilir.', { title: 'Yanlış "withJS" dəyəri' } );
        }
    }
}());


/**
* Imagemap Highlight
$(document).ready(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'
// "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
, az = mw && mw.config && mw.config.get('wgUserLanguage') == 'az'
, expandLegend = az ? 'Adları göstər' : 'ּShow Legend'
, collapseLegend = az ? 'Adları gizlət' : 'Hide Legend'
;
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);
$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  || areaHighLighting;
} else {
param = special && special.nover && (special.nover[licap] || special.nover.default);
}
if (param) {
$.extend(context, param);
drawMarker(context, $li.data('areas'));
}
});
}
function handleOneMap() {
var img = $(this),
w = img.width(),
h = img.height(),
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);
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
var ol = $('<ol>', {'class': myClassName})
.css({clear: 'both', margin: 0, listStyle: 'none', maxWidth: w + 'px', float: 'left', position: 'relative'})
.attr({'data-expandtext' : expandLegend, 'data-collapsetext': collapseLegend})
.data(specialAreaMark, specialHighlight)
.data('context', context);
// ol below image, hr below ol. original caption pushed below hr.
div.after($('<hr>', {'class': myClassName}).css('clear', 'both'))
.after(ol);
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);
}
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');
ol.addClass('mw-collapsed')
.makeCollapsible();
}
function init() {
mw.util.addCSS('li.' + myClassName + '{white-space:nowrap;border:solid 1px transparent;border-radius:6px;}\n' + //css for li element
'li.' +  myClassName + '.' + liHighlightClass + '{background-color:yellow;border-color:green;}\n' + //css for highlighted li element.
'.rtl li.' + myClassName + '{float: right; margin-left: 3em;}\n' +
'.ltr li.' + myClassName + '{float: left; margin-right: 3em;}');
$(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 );
});
    /**
* imgToggle
*/
// На странице есть как минимум один элемент div.img_toggle
if ( $( 'div.img_toggle' ).length ) {
mw.loader.load( 'ext.gadget.imgToggle' );
}
/**
/**
  * Magic editintros ****************************************************
  * Magic editintros
*
  * İzah: Yaşayan insanların məqalələrini redaktə edərkən göstərilən xəbərdarlıq qutusu
  * Description: Adds editintros on disambiguation pages and BLP pages.
  * Müəllif: [[User:RockMFR]]
  * Maintainers: [[User:RockMFR]]
  */
  */
function addEditIntro( name ) {
function addEditIntro( name ) {
$( '.mw-editsection, #ca-edit, #ca-ve-edit' ).find( 'a' ).each( function ( i, el ) {
$( '.mw-editsection, #ca-edit, #ca-ve-edit' ).find( 'a' ).each( function ( i, el ) {
el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
} );
}
if ( mw.config.get( 'wgNamespaceNumber' ) === 2 || mw.config.get( 'wgNamespaceNumber' ) === 3) {
$( function () {
if ( document.getElementById( 'userpageedn' ) ) {
addEditIntro( 'Şablon:Editnotice_userpage' );
}
} );
} );
}
}
Sətir 912: Sətir 846:
return;
return;
}
}
if ( $.inArray( 'Yaşayan insanlar', cats ) !== -1 || $.inArray( 'Yaşayan insanlar', cats ) !== -1 ) {
if ( $.inArray( 'Yaşayan insanlar', cats ) !== -1 || $.inArray( 'Yaşayan uzunömürlülər', cats ) !== -1 ) {
addEditIntro( 'Template:BLP_editintro' );
addEditIntro( 'Template:BLP_editintro' );
}
}
} );
} );
}
}
// Web2Cit
mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Diegodlh/Web2Cit/script.js&action=raw&ctype=text/javascript' ); // Backlink: [[:en:User:Diegodlh/Web2Cit/script.js]]
// Naviqasiya panelində "İnzibatçıların iş bölgüsü" başlığının yerləşdirilməsi
importScript("MediaWiki:SysopDuties.js");