MediaWiki:Gadget-wstaw-link-interwiki.js: Różnice pomiędzy wersjami
Usunięta treść Dodana treść
m Jeśli użytkownik ma flagę flood, oznacz edycję jako edycję bota |
Usunięcie parametrów, kierujących poprzez {{link-interwiki}} do innych wersji językowych (nie wpływa na działanie, to był martwy kod) |
||
Linia 168:
mw.loader.using(['oojs-ui-core', 'oojs-ui-windows', 'oojs-ui-widgets', 'mediawiki.api', 'mediawiki.confirmCloseWindow']).then(function(){
var promptPromise = displayQidPopup(link, function(qid){
var
return createNewWikitext(localTitle, linkText, qid,
});
Linia 188:
* @param {string} localTitle The human-friendly local page name
* @param {string} linkText The visible link text
* @param {string}
* @param {
* @param {string} targetTitle The normalized link target page name
* @param {number} targetIndex The index of the link to the target page
* @returns {{actualWikitext: string, sanitizedWikitext: string, excerpt: string} | null} Data about the new wikitext or null if the link could not be found
*/
function createNewWikitext(localTitle, linkText,
var template = prepareTemplate(localTitle, linkText,
var replaced = replaceLinkWithText(actualWikitext, sanitizedWikitext, targetTitle, targetIndex, template);
Linia 350:
* Prepares the template for an interlanguage link.
* @param {string} localArticle The local article name
* @param {string}
* @param {string}
* @param {
* @returns {string}
*/
function prepareTemplate(localArticle, displayedText,
displayedText = displayedText || localArticle;▼
// If local article title and displayed text differ only in first letter case,
// use the display name as the local article title
Linia 367 ⟶ 363:
}
if(
if(
return '[[' +
}
linkTarget = linkTarget.toUpperCase();
}▼
if(localArticle.indexOf('=') !== -1) templateText += '1=';
if(displayedText !== localArticle){
templateText += ' |tekst=' + displayedText;
▲ }
▲ if(foreignLang !== 'Q'){
▲ templateText += '|lang=' + foreignLang;
▲ }
▲ templateText += '|Q=' + foreignArticle;
}
templateText += ' |Q=' + linkTarget + '}}';
return templateText;
}
|