مدیاویکی:Gadget-AncreTitres.js: تفاوت میان نسخهها
ظاهر
imported>Dalba کامنت اضافی |
imported>Dalba جز jslint |
||
| خط ۱: | خط ۱: | ||
/*jslint browser:true */ | |||
/*global $, wgServer, wgScript, wgPageName */ | |||
/** | /** | ||
* AncreTitres | * AncreTitres | ||
| خط ۱۵: | خط ۱۷: | ||
* sur le lien [URL] ou [[lien]] à droite du titre de section. | * sur le lien [URL] ou [[lien]] à droite du titre de section. | ||
* | * | ||
* Auteurs : Pabix, Phe, Bayo, Chphe | * Auteurs : Pabix, Phe, Bayo, Chphe et Arkanosis | ||
* {{Projet:JavaScript/Script|AncreTitres}} | * {{Projet:JavaScript/Script|AncreTitres}} | ||
*/ | */ | ||
نسخهٔ ۲۶ اکتبر ۲۰۱۴، ساعت ۰۴:۲۳
/*jslint browser:true */
/*global $, wgServer, wgScript, wgPageName */
/**
* AncreTitres
*
* Cette fonction fournit un lien vers une section de page en cliquant
* sur le lien [ancre] à droite du titre de section.
*
* Auteurs : Pabix, Phe, Bayo, Dalba -- Correctif apporté par Chphe
* Date de dernière révision : 16 October 2014
* {{Projet:JavaScript/Script|AncreTitres}}
*/
/**
* AncreTitres
*
* Cette fonction fournit un lien vers une section de page en cliquant
* sur le lien [URL] ou [[lien]] à droite du titre de section.
*
* Auteurs : Pabix, Phe, Bayo, Chphe et Arkanosis
* {{Projet:JavaScript/Script|AncreTitres}}
*/
/*global alert, jQuery, mediaWiki, window */
/*jslint vars: true, plusplus: true */
// <nowiki>
(function (mw, $) {
'use strict';
$(function () {
var _option = {
nom_permalink: '[پایاپیوند]',
nom_ancre: '[URL]',
nom_lien_interne: '[[ویکیپیوند]]',
description_pl: 'نمایش پیوند پایدار به این بخش',
description: 'نمایش یوآرال این بخش',
descinterne: 'نمایش پیوند ویکیپدیایی این بخش',
linkcolor: '',
fontSize: 'xx-small',
fontWeight: 'normal',
afficheE: true,
afficheI: true,
afficheP: true
};
if (typeof window.AncreTitres !== 'undefined') {
$.extend(_option, window.AncreTitres);
}
if (!$('#content').length || (!_option.afficheI && !_option.afficheE)) {
return;
}
$.each($('span.mw-headline'), function (_, headline) {
var anchor = headline.getAttribute('id');
var $span = $('<span class="noprint ancretitres" style="' +
'font-size: ' + _option.fontSize + '; ' +
'font-weight: ' + _option.fontWeight + '; ' + (_option.linkcolor !== '' ? 'color: ' + _option.linkcolor + ';' : '') +
'"></span>');
if (_option.afficheP && $('#t-permalink a').length) {
$span.append(' ');
$('<a href="#" title="' + _option.descinterne + '">' + _option.nom_permalink + '</a>').click(function () {
window.prompt('پایاپیوند:', $('#t-permalink a') [0].href + '#' + anchor
);
return false;
}).appendTo($span);
}
if (_option.afficheE) {
$span.append(' ');
$('<a href="#" title="' + _option.description + '">' + _option.nom_ancre + '</a>').click(function () {
window.prompt('نشانی وب معمولی:', 'https:' + mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + mw.config.get('wgPageName') + '#' + anchor
);
return false;
}).appendTo($span);
}
if (_option.afficheI) {
$span.append(' ');
$('<a href="#" title="' + _option.descinterne + '">' + _option.nom_lien_interne + '</a>').click(function () {
window.prompt('ویکیپیوند:', '[[' + mw.config.get('wgPageName') + '#' + anchor + ']]'
);
return false;
}).appendTo($span);
}
$(headline).parent().append($span);
});
});
}(mediaWiki, jQuery));
// </nowiki>