پرش به محتوا

مدیاویکی:Gadget-AncreTitres.js: تفاوت میان نسخه‌ها

از دانشنامه علوم انسانی
imported>Dalba
در المانی جدا از پیوند ویرایش اصلی باشد تا با edittop تداخل پیدا نکند
imported>Dalba
وگ به Special:Permalink/13500771 (بعد از واگردانی شدن تغییرات مدیاویکی:Gadget-close.js، این ابزار تداخل پیدا کرد)
خط ۱: خط ۱:
/*jslint browser:true */
/*jslint browser:true */
/*global $, wgServer, wgScript, wgPageName */
/*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 */
/*global alert, jQuery, mediaWiki, window */
/*jslint vars: true, plusplus: true */
// <nowiki>
// <nowiki>
(function(mw, $) {
(function(mw, $) {
خط ۷: خط ۲۷:
$(function() {
$(function() {
var _option = {
var _option = {
nom_permalink: 'پایاپیوند',
nom_permalink: '[پایاپیوند]',
nom_ancre: 'نشانی وب',
nom_ancre: '[URL]',
nom_lien_interne: 'ویکی‌پیوند',
nom_lien_interne: '[[ویکی‌پیوند]]',
description_pl: 'نمایش پیوند پایدار به این بخش',
description_pl: 'نمایش پیوند پایدار به این بخش',
description: 'نمایش یو‌آر‌ال این بخش',
description: 'نمایش یو‌آر‌ال این بخش',
descinterne: 'نمایش پیوند ویکی‌پدیایی این بخش',
descinterne: 'نمایش پیوند ویکی‌پدیایی این بخش',
linkcolor: '',
fontSize: 'xx-small',
fontWeight: 'normal',
afficheE: true,
afficheI: true,
afficheP: true
};
};
if (typeof window.AncreTitres !== 'undefined') {
if (typeof window.AncreTitres !== 'undefined') {
$.extend(_option, window.AncreTitres);
$.extend(_option, window.AncreTitres);
        }
}
 
if (!$('#content').length || (!_option.afficheI && !_option.afficheE)) {
        var sep = $('<span class="mw-editsection-bracket"> | </span>');
return;
        var permalink = $('#t-permalink a').length && $('#t-permalink a')[0].href;
}
        var urlPrefix = 'https:' + mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + mw.config.get('wgPageName');
$.each($('span.mw-headline'), function(_, headline) {
 
var anchor = headline.getAttribute('id');
$('#firstHeading,.mw-headline').each(function(_, headline) {
var $span = $('<span class="noprint ancretitres" style="' +
            var linksSection = $('<span class="mw-editsection"><span class="mw-editsection-bracket">[</span><span class="mw-editsection-bracket">]</span></span>');
'font-size: ' + _option.fontSize + '; ' +
            var lastBracket = linksSection.find('.mw-editsection-bracket').last();
'font-weight: ' + _option.fontWeight + '; ' + (_option.linkcolor !== '' ? 'color: ' + _option.linkcolor + ';' : '') +
 
'"></span>');
            if (headline.id && headline.id != 'firstHeading') {
if (_option.afficheP && $('#t-permalink a').length) {
                var anchor = '#' + headline.id;
$span.append(' ');
            } else {
$('<a href="#" title="' + _option.descinterne + '">' + _option.nom_permalink + '</a>').click(function() {
                var anchor = '';
window.prompt('پایاپیوند:', $('#t-permalink a')[0].href + '#' + anchor);
            }
return false;
 
}).appendTo($span);
            $('<a href="#" title="' + _option.description + '">' + _option.nom_ancre + '</a>').click(function() {
}
                window.prompt('نشانی وب معمولی:', urlPrefix + anchor);
if (_option.afficheE) {
                return false;
$span.append(' ');
            }).insertBefore(lastBracket);
$('<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);
if (permalink) {
return false;
                sep.clone().insertBefore(lastBracket);
}).appendTo($span);
                $('<a href="#" title="' + _option.description_pl + '">' + _option.nom_permalink + '</a>').click(function() {
}
                    window.prompt('پایاپیوند:', permalink + anchor);
if (_option.afficheI) {
                    return false;
$span.append(' ');
                }).insertBefore(lastBracket);
$('<a href="#" title="' + _option.descinterne + '">' + _option.nom_lien_interne + '</a>').click(function() {
            }
window.prompt('ویکی‌پیوند:', '[[' + mw.config.get('wgPageName') + '#' + anchor + ']]');
           
return false;
            sep.clone().insertBefore(lastBracket);
}).appendTo($span);
            $('<a href="#" title="' + _option.descinterne + '">' + _option.nom_lien_interne + '</a>').click(function() {
}
                window.prompt('ویکی‌پیوند:', '[[' + mw.config.get('wgPageName') + anchor + ']]');
$(headline).parent().append($span);
                return false;
});
            }).insertBefore(lastBracket);
 
            if (headline.nextElementSibling && headline.nextElementSibling.className === 'mw-editsection') {
                linksSection.appendTo(headline.nextElementSibling);
            } else {
                linksSection.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: 'نمایش پیوند ویکی‌پدیایی این بخش',
			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>