مدیاویکی:Gadget-AncreTitres.js: تفاوت میان نسخهها
ظاهر
imported>Dalba به یک روش دیگر |
imported>Dalba به این شکل جمعجورتر و یکدستتر خواهد بود |
||
| خط ۳۳: | خط ۳۳: | ||
description: 'نمایش یوآرال این بخش', | description: 'نمایش یوآرال این بخش', | ||
descinterne: 'نمایش پیوند ویکیپدیایی این بخش', | descinterne: 'نمایش پیوند ویکیپدیایی این بخش', | ||
afficheE: true, | afficheE: true, | ||
afficheI: true, | afficheI: true, | ||
| خط ۴۶: | خط ۴۳: | ||
return; | return; | ||
} | } | ||
$.each($(' | $.each($('.mw-editsection'), function(_, headline) { | ||
var anchor = headline.getAttribute('id'); | var anchor = headline.getAttribute('id'); | ||
if (_option.afficheP && $('#t-permalink a').length) { | if (_option.afficheP && $('#t-permalink a').length) { | ||
headline.append(' '); | |||
$('<a href="#" title="' + _option.descinterne + '">' + _option.nom_permalink + '</a>').click(function() { | $('<a href="#" title="' + _option.descinterne + '">' + _option.nom_permalink + '</a>').click(function() { | ||
window.prompt('پایاپیوند:', $('#t-permalink a')[0].href + '#' + anchor); | window.prompt('پایاپیوند:', $('#t-permalink a')[0].href + '#' + anchor); | ||
return false; | return false; | ||
}).appendTo( | }).appendTo(headline); | ||
} | } | ||
if (_option.afficheE) { | if (_option.afficheE) { | ||
headline.append(' '); | |||
$('<a href="#" title="' + _option.description + '">' + _option.nom_ancre + '</a>').click(function() { | $('<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); | window.prompt('نشانی وب معمولی:', 'https:' + mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + mw.config.get('wgPageName') + '#' + anchor); | ||
return false; | return false; | ||
}).appendTo( | }).appendTo(headline); | ||
} | } | ||
if (_option.afficheI) { | if (_option.afficheI) { | ||
headline.append(' '); | |||
$('<a href="#" title="' + _option.descinterne + '">' + _option.nom_lien_interne + '</a>').click(function() { | $('<a href="#" title="' + _option.descinterne + '">' + _option.nom_lien_interne + '</a>').click(function() { | ||
window.prompt('ویکیپیوند:', '[[' + mw.config.get('wgPageName') + '#' + anchor + ']]'); | window.prompt('ویکیپیوند:', '[[' + mw.config.get('wgPageName') + '#' + anchor + ']]'); | ||
return false; | return false; | ||
}).appendTo( | }).appendTo(headline); | ||
} | } | ||
}); | }); | ||
}); | }); | ||
}(mediaWiki, jQuery)); | }(mediaWiki, jQuery)); | ||
// </nowiki> | // </nowiki> | ||
نسخهٔ ۳ نوامبر ۲۰۱۸، ساعت ۰۹:۳۱
/*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, Arkanosis et Dalba
* {{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: 'نمایش پیوند ویکیپدیایی این بخش',
afficheE: true,
afficheI: true,
afficheP: true
};
if (typeof window.AncreTitres !== 'undefined') {
$.extend(_option, window.AncreTitres);
}
if (!$('#content').length || (!_option.afficheI && !_option.afficheE)) {
return;
}
$.each($('.mw-editsection'), function(_, headline) {
var anchor = headline.getAttribute('id');
if (_option.afficheP && $('#t-permalink a').length) {
headline.append(' ');
$('<a href="#" title="' + _option.descinterne + '">' + _option.nom_permalink + '</a>').click(function() {
window.prompt('پایاپیوند:', $('#t-permalink a')[0].href + '#' + anchor);
return false;
}).appendTo(headline);
}
if (_option.afficheE) {
headline.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(headline);
}
if (_option.afficheI) {
headline.append(' ');
$('<a href="#" title="' + _option.descinterne + '">' + _option.nom_lien_interne + '</a>').click(function() {
window.prompt('ویکیپیوند:', '[[' + mw.config.get('wgPageName') + '#' + anchor + ']]');
return false;
}).appendTo(headline);
}
});
});
}(mediaWiki, jQuery));
// </nowiki>