Wikipedysta:Cyfrowabiblioteka/common.js
/*global mw, JSconfig, importScript, jsMsg, importStylesheet */
/*jshint forin:false, strict:false, onecase:true, laxbreak:true, browser:true, jquery:true */
/**
* JSconfig
*
* If you are a gadget author, you may use
* [[MediaWiki:Gadget-SettingsManager.js]] or jquery.jStorage or mediawiki.cookie
* and [[MediaWiki:Gadget-SettingsUI.js]] to provide an easy interface.
*
*
* Global configuration options to enable/disable and configure
* specific script features from [[MediaWiki:Common.js]] and [[MediaWiki:Monobook.js]]
* <s>This framework adds config options (saved as cookies) to [[Special:Preferences]]</s>
* (Site script does not run at [[Special:Preferences]] any more so this functionality has been removed)
*
* For a more permanent change you can override the default settings in your
* [[Special:Mypage/monobook.js]]
* for Example: JSconfig.keys[loadAutoInformationTemplate] = false;
*
* Maintainer: [[User:Dschwen]]
*/
window.JSconfig = {
prefix: 'jsconfig_',
keys: {},
meta: {},
// Register a new configuration item
// * name : String, internal name
// * default_value : String or Boolean (type determines configuration widget)
// * description : String, text appearing next to the widget in the preferences, or an hash-object
// containing translations of the description indexed by the language code
//
// Access keys through JSconfig.keys[name]
registerKey: function (name, default_value, description, prefpage) {
if (JSconfig.keys[name] === undefined) {
JSconfig.keys[name] = default_value;
} else {
// all cookies are read as strings,
// convert to the type of the default value
switch (typeof default_value) {
case 'boolean':
JSconfig.keys[name] = (JSconfig.keys[name] === 'true');
break;
case 'number':
JSconfig.keys[name] = JSconfig.keys[name] / 1;
break;
}
}
JSconfig.meta[name] = {
description: description[mw.config.get( 'wgUserLanguage' )] || description.en || (typeof description === 'string' && description) || '<i>en</i> translation missing',
page: prefpage || 0,
default_value: default_value
};
},
readCookies: function () {
var cookies = document.cookie.split('; ');
var p = JSconfig.prefix.length;
var i;
for (var key = 0; cookies && key < cookies.length; key++) {
if (cookies[key].substring(0, p) === JSconfig.prefix) {
i = cookies[key].indexOf('=');
//alert( cookies[key] + ',' + key + ',' + cookies[key].substring(p,i) );
JSconfig.keys[cookies[key].substring(p, i)] = cookies[key].substring(i + 1);
}
}
},
writeCookies: function () {
var expdate = new Date();
expdate.setTime(expdate.getTime() + 1000 * 60 * 60 * 24 * 3650); // expires in 3560 days
for (var key in JSconfig.keys) {
document.cookie = JSconfig.prefix + key + '=' + JSconfig.keys[key] + '; path=/; expires=' + expdate.toUTCString();
}
}
};
JSconfig.readCookies();
mw.loader.using(['mediawiki.util']).then(function () {
/* Begin of mw.loader.using callback */
// Overwriting deprecated functions that have a follower that (also) accepts the same syntax:
window.getParamValue = mw.util.getParamValue;
/**
* Prepend server (if not already).
* @example '/something' to 'http://commons.wikimedia.org/something'
* @example don't touch 'https://commons.wikimedia.org/foo'
* @example don't touch '//commons.wikimedia.org/bar'
* @param url {String}
* @return {String}
*/
mw.util.expandUrl = function ( url ) {
if ( url.substr( 0, 1 ) === '/' && url.substr( 0, 2 ) !== '//' ) {
return mw.config.get( 'wgServer' ) + url;
} else {
return url;
}
};
/**
* Expand protocol-relative urls.
* @param method {String} CURRENT, RELATIVE, HTTP, HTTPS
* @return {String}
*/
mw.util.expandProtocol = function ( url, method ) {
// Not relative right now, return right away
if ( url.substr( 0, 2 ) !== '//' ) {
return url;
}
method = method || 'CURRENT';
switch ( method ) {
case 'CURRENT':
url = location.protocol + url;
break;
case 'RELATIVE':
break;
case 'HTTP':
url = 'http:' + url;
break;
case 'HTTPS':
url = 'https:' + url;
break;
}
return url;
};
// Creates action=raw links for JS or CSS gadgets
// Useful for mw.loader.load, which doesn't accept page titles
function rawPageLink( pageName ) {
return mw.config.get( 'wgServer' ) + mw.config.get( 'wgScript' ) + '?title=' + mw.util.wikiUrlencode(pageName) + '&action=raw&ctype=text/javascript';
}
// Overwriting deprecated functions that don't have an exact followup but can be easily mapped:
window.importScript = function ( page ) {
if ( typeof page === 'string' && page.length ) {
mw.loader.load( rawPageLink( page ) );
}
};
// Wrapper for mw.notify still used by legacy scripts.
function jsMsgAppend( msg ) {
mw.notify( msg );
}
/**
* @source https://www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
* @revision 2017-05-16
*/
mw.loader.using( ['mediawiki.util'], function () {
var extraCSS = mw.util.getParamValue( 'withCSS' ),
extraJS = mw.util.getParamValue( 'withJS' ),
extraModule = mw.util.getParamValue( 'withModule' );
if ( extraCSS ) {
// WARNING: DO NOT REMOVE THIS "IF" - REQUIRED FOR SECURITY (against XSS/CSRF attacks)
if ( /^MediaWiki:[^&<>=%#]*\.css$/.test( extraCSS ) ) {
mw.loader.load( '/w/index.php?title=' + encodeURIComponent( extraCSS ) + '&action=raw&ctype=text/css', 'text/css' );
} else {
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
}
}
if ( extraJS ) {
// WARNING: DO NOT REMOVE THIS "IF" - REQUIRED FOR SECURITY (against XSS/CSRF attacks)
if ( /^MediaWiki:[^&<>=%#]*\.js$/.test( extraJS ) ) {
mw.loader.load( '/w/index.php?title=' + encodeURIComponent( extraJS ) + '&action=raw&ctype=text/javascript' );
} else {
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
}
}
if ( extraModule ) {
if ( /^ext\.gadget\.[^,\|]+$/.test( extraModule ) ) {
mw.loader.load( extraModule );
} else {
mw.notify( 'Only gadget modules are allowed.', { title: 'Invalid withModule value' } );
}
}
});
/**
* Edittools
*
* Formatting buttons for special characters below the edit field
* Also enables these buttons on any textarea or input field on the page.
*
* Maintainer: [[User:Lupo]], [[User:DieBuche]]
*/
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit' , 'submit' ]) > -1
|| mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload'
) {
importScript('MediaWiki:Edittools.js');
}
/**
* ImageAnnotator
* Globally enabled per
* http://commons.wikimedia.org/?title=Commons:Village_pump&oldid=26818359#New_interface_feature
* Maintainer: [[User:Lupo]]
*/
// Not on Special pages, and only if viewing the page
if (mw.config.get( 'wgNamespaceNumber' ) !== -1 && $.inArray(mw.config.get('wgAction'), ['view', 'submit']) !== -1 ) {
if (typeof ImageAnnotator_disable === 'undefined' || !ImageAnnotator_disable) {
// Don't even import it if it's disabled.
importScript('MediaWiki:Gadget-ImageAnnotator.js');
}
}
/**
* QICSigs
*
* Fix for the broken signatures in gallery tags
* Helper script to make voting on QIC easier
* needed for [[COM:QIC]]
*
* Maintainers: [[User:Dschwen]]
*/
if (mw.config.get( 'wgPageName' ) === 'Commons:Quality_images_candidates/candidate_list' && mw.config.get( 'wgAction' ) === 'edit') {
importScript('MediaWiki:QICSigs.js');
importScript('MediaWiki:QIvoter.js');
}
/**
* VICValidate
*
* Some basic form validation for creating new Valued image nominations
* needed for [[COM:VIC]]
*
* Maintainers: [[User:Dschwen]]
*/
if (mw.config.get( 'wgPageName' ) === 'Commons:Valued_image_candidates' && mw.config.get( 'wgAction' ) === 'view') {
importScript('MediaWiki:VICValidate.js');
}
/**
* subPagesLink
*
* Adds a link to subpages of current page
*
* Maintainers: [[:he:משתמש:ערן]], [[User:Dschwen]]
*
* JSconfig items: bool JSconfig.subPagesLink(true=enabled (default), false=disabled)
*/
var subPagesLink = {
// Translations of the menu item
i18n: {
'be-tarask': 'Падстаронкі',
'be-x-old': 'Падстаронкі',
bg: 'Подстраници',
bn: 'উপপাতাসমূহ',
ca: 'Subpàgines',
cs: 'Podstránky',
cy: 'Isdudalennau',
de: 'Unterseiten',
en: 'Subpages', // default
et: 'Alamlehed',
eo: 'Subpaĝoj',
eu: 'Azpiorrialdeak',
es: 'Subpáginas',
fa: 'زیرصفحه\u200cها',
fi: 'Alasivut',
fr: 'Sous-pages',
gl: 'Subpáxinas',
he: 'דפי משנה',
hr: 'Podstranice',
hy: 'Ենթաէջեր',
id: 'Sub halaman',
it: 'Sottopagine',
is: 'Undirsíður',
ja: '下位ページ',
ko: '하위 문서 목록',
min: 'Sublaman',
mk: 'Потстраници',
ml: 'ഉപതാളുകൾ',
nl: "Subpagina's",
no: 'Undersider',
pl: 'Podstrony',
pt: 'Subpáginas',
'pt-br': 'Subpáginas',
ru: 'Подстраницы',
sl: 'Podstrani',
sr: 'Подстранице',
sv: 'Undersidor',
tr: 'Altsayfalar',
tyv: 'Адакы арыннар',
uk: 'Підсторінки',
vi: 'Trang con',
'zh-hans': '子页面',
'zh-hant': '子頁面'
},
install: function () {
// honor user configuration
if (!JSconfig.keys.subPagesLink) {
return;
}
if (document.getElementById('t-whatlinkshere')
&& ['Special', 'File', 'Category'].indexOf(mw.config.get('wgCanonicalNamespace')) === -1
) {
var subpagesText = subPagesLink.i18n[mw.config.get( 'wgUserLanguage' )] || subPagesLink.i18n.en;
var subpagesLink = mw.util.getUrl('Special:Prefixindex/' + mw.config.get( 'wgPageName' ) + '/');
mw.util.addPortletLink('p-tb', subpagesLink, subpagesText, 't-subpages');
}
}
};
JSconfig.registerKey('subPagesLink', true, {
'be-tarask': 'Паказваць спасылку на падстаронкі ў панэлі інструмэнтаў',
'be-x-old': 'Паказваць спасылку на падстаронкі ў панэлі інструмэнтаў',
bg: 'Показване на връзката Подстраници в менюто с инструменти',
bn: 'সরঞ্জাম-এ উপপাতাসমূহের লিঙ্ক দেখাও',
cs: 'Zobrazovat v panelu nástrojů odkaz Podstránky',
cy: 'Dangos cyswllt i Isdudalennau yn y blwch offer',
en: 'Show a Subpages link in the toolbox', // default
eo: 'Montri subpaĝan ligilon en la ilaro',
fa: 'نمایش زیرصفجه\u200cها در جعبه ابزار',
fr: 'affiche un lien Sous-pages dans la boîte à outils',
hr: 'Prikaži poveznicu na podstranice u pomagalima',
hy: 'Ցույց տալ «Ենթաէջեր» հղումը գործիքների տուփում',
id: 'Tampilkan Sub halaman di kotak perkakas',
ja: 'ツールボックスに「下位ページ」リンクを表示',
min: 'Tunjuakan Sublaman pado kotak pakakeh',
mk: 'Покажи врска до потстраниците во алатникот',
ml: 'പണിസഞ്ചിയിൽ ഉപതാളുകൾക്കുള്ള കണ്ണി പ്രദർശിപ്പിക്കുക',
nl: "Een link Subpagina's weergeven bij de hulpmiddelen",
pl: 'Pokaż w panelu bocznym link do podstron',
pt: 'Exibir um link para as subpáginas no menu de ferramentas',
'pt-br': 'Exibir um link para as subpáginas no menu de ferramentas',
ru: 'Показывать ссылку на подстраницы в меню инструментов',
sl: 'Med pripomočki prikaži povezavo na podstrani',
sv: 'Visa en länk för undersidor i verktygslådan',
tr: 'Araç kutusunda alt sayfalara bir bağlantı gösterir',
vi: 'Hiển thị liên kết Trang con ở hộp Công cụ',
'zh-hans': '在工具箱显示一个子页面的链接',
'zh-hant': '在工具箱顯示壹個子頁面的鏈接'
}, 7);
$(subPagesLink.install);
/**
* gallery shuffle
*
* Maintainers: [[User:Dschwen]], [[User:Krinkle]]
*/
function gallery_dshuf($c) {
$c.find('div.dshuf').children('ul.gallery').each( function (i, ul) {
var $ul = $(ul),
$lis = $ul.children('li.gallerybox');
// assign random keys
$lis
.each( function (i, li) {
$.data(li, 'dshufkey', Math.random());
} )
// sort according to key
.sort( function (a, b) {
var A = $.data(a, 'dshufkey'),
B = $.data(b, 'dshufkey');
if (A < B) {
return -1;
} else if (A > B) {
return 1;
} else {
return 0;
}
})
// append in random order
.each( function (i, li) {
$ul.append(li);
} );
});
}
mw.hook( 'wikipage.content' ).add( gallery_dshuf );
/**
* dshuf
*
* shuffles div elements with the class dshuf and
* common class dshufsetX (X being an integer)
* taken from http://commons.wikimedia.org/?title=MediaWiki:Common.js&oldid=7380543
*
* Maintainers: [[User:Gmaxwell]], [[User:Dschwen]]
*/
function dshuf($c) {
var shufsets = {};
var rx = new RegExp('dshuf' + '\\s+(dshufset\\d+)', 'i');
var divs = document.getElementsByTagName('div');
var i = divs.length;
function sortFunction(a, b) {
return a.key - b.key;
}
while (i--) {
if (rx.test(divs[i].className)) {
if (typeof shufsets[RegExp.$1] === 'undefined') {
shufsets[RegExp.$1] = {};
shufsets[RegExp.$1].inner = [];
shufsets[RegExp.$1].member = [];
}
shufsets[RegExp.$1].inner.push({
key: Math.random(),
html: divs[i].innerHTML
});
shufsets[RegExp.$1].member.push(divs[i]);
}
}
for (var shufset in shufsets) {
shufsets[shufset].inner.sort(sortFunction);
i = shufsets[shufset].member.length;
while (i--) {
shufsets[shufset].member[i].innerHTML = shufsets[shufset].inner[i].html;
shufsets[shufset].member[i].style.display = 'block';
}
}
}
mw.hook( 'wikipage.content' ).add( dshuf );
/**
* localizeSignature: localizes the signature on Commons with the string in the user's preferred language
*
* Maintainer: [[User:Slomox]]
*/
function localizeSignature($c) {
var talkTextLocalization = {
'be-tarask': 'Абмеркаваньне',
'be-x-old': 'Абмеркаваньне',
bn: 'আলোচনা',
ca: 'Discussió',
cs: 'diskuse',
cy: 'Sgwrs',
de: 'Diskussion',
fa: 'بحث',
fr: 'd',
hy: 'Քննարկում',
id: 'bicara',
ko: '토론',
min: 'maota',
mk: 'Разговор',
ml: 'സംവാദം',
nl: 'Overleg',
pt: 'Discussão',
'pt-br': 'Discussão',
nds: 'Diskuschoon',
sl: 'Pogovor',
sv: 'Diskussion',
tr: 'Tartışma',
'zh-hans': '留言',
'zh-hant': '留言'
};
var talkText = talkTextLocalization[mw.config.get( 'wgUserLanguage' )];
if (!talkText) {
return;
}
$c.find('.signature-talk').text(talkText);
}
mw.hook( 'wikipage.content' ).add( localizeSignature );
/**
* Ajax Translation of /lang links, see [[MediaWiki:AjaxTranslation.js]]
* Maintainer: [[User:ערן]], [[User:DieBuche]]
*/
if (!window.disableAjaxTranslation) {
importScript('MediaWiki:AjaxTranslation.js');
}
/**
* SVG images: adds links to rendered PNG images in different resolutions
*
* @author Krinkle, 2012-2013
* @deprecated in 1.18
*/
function SVGThumbs() {
function svgAltSize(w, title) {
var path, a;
// Example:
// - https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png
// - https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Example.png/116px-Example.png
// - https://upload.wikimedia.org/wikipedia/commons/thumb/4/45/Gerrit_patchset_25838_test.svg/200px-Gerrit_patchset_25838_test.svg.png
// - https://upload.wikimedia.org/wikipedia/commons/thumb/4/45/Gerrit_patchset_25838_test.svg/langde-200px-Gerrit_patchset_25838_test.svg.png
path = thumbu.replace(/\/(lang[a-z-]+-)?\d+(px-[^\/]+$)/, '/$1' + w + '$2');
a = document.createElement('A');
a.setAttribute('href', path);
a.appendChild(document.createTextNode(title));
return a;
}
var file = document.getElementById('file'); // might fail if MediaWiki can't render the SVG
if (file && mw.config.get( 'wgIsArticle' ) && mw.config.get( 'wgTitle' ).match(/\.svg$/i)) {
var thumbu = jQuery(file).find('img:first').attr('src');
if (!thumbu) {
return;
}
var p = document.createElement('p');
p.className = 'SVGThumbs';
var i18n = {
'be-tarask': 'Гэтая выява ў фармаце PNG у іншых памерах: ',
'be-x-old': 'Гэтая выява ў фармаце PNG у іншых памерах: ',
bn: 'এই চিত্রটি অন্যান্য প্রস্থের মধ্যে PNG হিসেবে রূপান্তরিত: ',
en: 'This image rendered as PNG in other widths: ',
eo: 'Ĉi tiu bildo en la aranĝo PNG kun aliaj larĝoj: ',
es: 'Esta imagen renderizada como PNG en otros tamaños: ',
de: 'Dieses Bild im PNG-Format in folgenden Breiten: ',
cs: 'Tento obrázek jako PNG v jiné velikosti: ',
cy: 'Caiff y ddelwedd hon ei chynhyrchu mewn PNG yn y lled canlynol: ',
fa: 'رندر پی\u200cان\u200cجی این تصویر در اندازه\u200cهای دیگر: ',
fi: 'tämä kuva PNG:nä muissa ko’oissa:',
fr: 'Cette image restituée en PNG dans d’autres tailles : ',
hr: 'Prikaži sliku u PNG formatu u ostalim veličinama: ',
hy: 'Այս պատկերը մատուցված որպես ՓիԷնՋի այլ լայնքերով՝ ',
id: 'Gambar ini dijadikan PNG dengan lebar berbeda: ',
ja: 'この画像の PNG 版は他のサイズでも利用可能です:',
min: 'Gambar ko dijadian PNG jo leba babedo: ',
ml: 'ഈ ചിത്രം PNG ആയി ലഭ്യമാകുന്ന മറ്റ് വലിപ്പങ്ങൾ: ',
mk: 'Сликава како PNG во други големини: ',
nl: 'Deze afbeelding als PNG in andere groottes: ',
pt: 'Esta imagem renderizada como PNG em outros tamanhos: ',
'pt-br': 'Esta imagem renderizada como PNG em outros tamanhos: ',
sl: 'Prikaži to sliko v PNG-zapisu v drugih velikostih: ',
sv: 'Denna bild i PNG-format i olika storlekar: ',
vi: 'Hình này được kết xuất ở dạng PNG có chiều ngang khác: ',
'zh-hans': '该图像转换为PNG格式的其他尺寸:',
'zh-hant': '該圖像轉換為PNG格式的其他尺寸:'
};
var ptext = i18n[mw.config.get( 'wgUserLanguage' )] || i18n.en;
p.appendChild(document.createTextNode(ptext));
var l = [200, 500, 1000, 2000];
for (var i = 0; i < l.length; i++) {
p.appendChild(svgAltSize(l[i], l[i] + 'px'));
if (i < l.length - 1) {
p.appendChild(document.createTextNode(', '));
}
}
p.appendChild(document.createTextNode('.'));
var info = $(file.parentNode).find('div.fullMedia').get(0);
if (info) {
info.appendChild(p);
}
}
}
$(SVGThumbs);
// RTL site-side scripts
if ([
'ar',
'arc',
'arz',
'bcc',
'bqi',
'dv',
'fa',
'fa-af',
'glk',
'ha',
'he',
'kk-arab',
'kk-cn',
'ks',
'ku-arab',
'mzn',
'prd',
'ps',
'sd',
'ur',
'ydd',
'yi'
].indexOf(mw.config.get('wgUserLanguage')) !== -1) {
mw.loader.load('ext.gadget.BiDiEditing');
}
// Language-specific site-wide scripts
if ($.inArray(mw.config.get('wgUserLanguage'), [
'ku',
'nds'
]) !== -1) {
importScript('MediaWiki:Common.js/' + mw.config.get( 'wgUserLanguage' ) + '.js');
}
/**
* Helper function to normalize date used by script (e.g. Flickrreview script)
*
* TODO: Outsource to a gadget for proper minifying and dependencies?
* Maintainer: ???
*/
function getISODate() {
var date = new Date();
// UTC
var dd = date.getUTCDate();
if (dd < 10) {
dd = '0' + dd.toString();
}
var mm = date.getUTCMonth() + 1;
if (mm < 10) {
mm = '0' + mm.toString();
}
var YYYY = date.getUTCFullYear();
var ISOdate = YYYY + '-' + mm + '-' + dd;
return ISOdate;
}
/**
* Sitenotice translation for all skins
* Maintainer: Krinkle
*/
$(function () {
if (mw.config.get( 'wgUserLanguage' ) !== 'en') {
$('#siteNotice').find('#localNotice p').load(
mw.util.getUrl( 'MediaWiki:Sitenotice-translation' ) + '?action=render&uselang=' + mw.config.get( 'wgUserLanguage' ) + ' p'
);
}
});
/**
* Main page tab all main pages and instead of the 'Gallery' tab
*/
if ($.inArray( mw.config.get( 'wgNamespaceNumber' ), [ 0 , 1 ]) > -1) {
importScript('MediaWiki:MainPages.js');
}
/**
* Add links to GlobalUsage and the CommonsDelinker log to file deletion log entries.
*
* Maintainer: [[User:Ilmari Karonen]]
*/
mw.hook( 'wikipage.content' ).add(function($content) {
var $deletions = $content.find('li.mw-logline-delete');
if (!$deletions.length) {
return;
}
// create the links in advance so we can cloneNode() them quickly in the loop
var guLink = $('<a>', {
'class' : 'delinker-log-globalusage'
}).append('global usage');
var cdLink = $('<a>', {
'class' : 'delinker-log-link extiw'
}).append('delinker log');
var span = $('<span>', {
'class' : 'delinker-log-links'
}).append(' (').append(guLink).append('; ')
.append(cdLink).append(')');
$deletions.each (function() {
var $match = $( this ).find('a[title^="File:"]').first();
if ( $match.length ) {
var filename = $match.text().substring(5).replace(/ /g,'_');
guLink.attr('href', mw.util.getUrl( 'Special:GlobalUsage' ) + '?target=' + encodeURIComponent(filename) );
guLink.attr('title', 'Current usage of ' + filename + ' on all Wikimedia projects');
cdLink.attr('href', 'https://commons-delinquent.toolforge.org/index.php?image=' + encodeURIComponent(filename));
cdLink.attr('title', 'CommonsDelinker log for ' + filename);
$( this ).append( span.clone() );
}
});
});
// Workaround for [[bugzilla:708]] via [[Template:InterProject]]
importScript('MediaWiki:InterProject.js');
/**
* {{tl|LargeImage}} linkswap
*
* Swaps the 'full resolution' link with the 'interactive zoomviewer' links for large images.
* Avoids people crashing their browser by accidentally attempting to view a 200MP image
*
* Maintainer: [[User:Dschwen]]
*/
if (mw.config.get( 'wgAction' ) === 'view' && mw.config.get( 'wgNamespaceNumber' ) === 6) {
$(function () {
var $viewerLinks = $('#LargeImage_viewer_links'),
$fullResLink = $('.fullMedia>a[href^="//upload.wikimedia.org/wikipedia/commons/"].internal'),
$copy_to = $fullResLink.clone(true),
$copy_from = $viewerLinks.clone(true);
if ($viewerLinks.length === 1 && $fullResLink.length === 1) {
$fullResLink.replaceWith($copy_from);
$viewerLinks.replaceWith($copy_to);
}
});
}
// Update from https://intuition.toolforge.org/wpAvailableLanguages.js.php - Last update: Wed, 08 Jul 2020 19:32:59 +0000
window.wpAvailableLanguages={"aa":"Qafár af","ab":"Аҧсшәа","abs":"bahasa ambon","ace":"Acèh","ady":"адыгабзэ","ady-cyrl":"адыгабзэ","aeb":"تونسي\/Tûnsî","aeb-arab":"تونسي","aeb-latn":"Tûnsî","af":"Afrikaans","ak":"Akan","aln":"Gegë","als":"Alemannisch","alt":"тÿштÿк алтай тил","am":"አማርኛ","ami":"Pangcah","an":"aragonés","ang":"Ænglisc","anp":"अङ्गिका","ar":"العربية","arc":"ܐܪܡܝܐ","arn":"mapudungun","arq":"جازايرية","ary":"الدارجة","arz":"مصرى","as":"অসমীয়া","ase":"American sign language","ast":"asturianu","atj":"Atikamekw","av":"авар","avk":"Kotava","awa":"अवधी","ay":"Aymar aru","az":"azərbaycanca","azb":"تۆرکجه","ba":"башҡортса","ban":"Bali","bar":"Boarisch","bat-smg":"žemaitėška","bbc":"Batak Toba","bbc-latn":"Batak Toba","bcc":"جهلسری بلوچی","bcl":"Bikol Central","be":"беларуская","be-tarask":"беларуская (тарашкевіца)","be-x-old":"беларуская (тарашкевіца)","bg":"български","bgn":"روچ کپتین بلوچی","bh":"भोजपुरी","bho":"भोजपुरी","bi":"Bislama","bjn":"Banjar","bm":"bamanankan","bn":"বাংলা","bo":"བོད་ཡིག","bpy":"বিষ্ণুপ্রিয়া মণিপুরী","bqi":"بختیاری","br":"brezhoneg","brh":"Bráhuí","bs":"bosanski","btm":"Batak Mandailing","bto":"Iriga Bicolano","bug":"ᨅᨔ ᨕᨘᨁᨗ","bxr":"буряад","ca":"català","cbk-zam":"Chavacano de Zamboanga","cdo":"Mìng-dĕ̤ng-ngṳ̄","ce":"нохчийн","ceb":"Cebuano","ch":"Chamoru","cho":"Choctaw","chr":"ᏣᎳᎩ","chy":"Tsetsêhestâhese","ckb":"کوردی","co":"corsu","cps":"Capiceño","cr":"Nēhiyawēwin \/ ᓀᐦᐃᔭᐍᐏᐣ","crh":"qırımtatarca","crh-cyrl":"къырымтатарджа (Кирилл)","crh-latn":"qırımtatarca (Latin)","cs":"čeština","csb":"kaszëbsczi","cu":"словѣньскъ \/ ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ","cv":"Чӑвашла","cy":"Cymraeg","da":"dansk","de":"Deutsch","de-at":"Österreichisches Deutsch","de-ch":"Schweizer Hochdeutsch","de-formal":"Deutsch (Sie-Form)","din":"Thuɔŋjäŋ","diq":"Zazaki","dsb":"dolnoserbski","dtp":"Dusun Bundu-liwan","dty":"डोटेली","dv":"ދިވެހިބަސް","dz":"ཇོང་ཁ","ee":"eʋegbe","egl":"Emiliàn","el":"Ελληνικά","eml":"emiliàn e rumagnòl","en":"English","en-ca":"Canadian English","en-gb":"British English","eo":"Esperanto","es":"español","es-419":"español de América Latina","es-formal":"español (formal)","et":"eesti","eu":"euskara","ext":"estremeñu","fa":"فارسی","ff":"Fulfulde","fi":"suomi","fit":"meänkieli","fiu-vro":"Võro","fj":"Na Vosa Vakaviti","fkv":"kvääni","fo":"føroyskt","fr":"français","frc":"français cadien","frp":"arpetan","frr":"Nordfriisk","fur":"furlan","fy":"Frysk","ga":"Gaeilge","gag":"Gagauz","gan":"贛語","gan-hans":"赣语(简体)","gan-hant":"贛語(繁體)","gcr":"kriyòl gwiyannen","gd":"Gàidhlig","gl":"galego","glk":"گیلکی","gn":"Avañe'ẽ","gom":"गोंयची कोंकणी \/ Gõychi Konknni","gom-deva":"गोंयची कोंकणी","gom-latn":"Gõychi Konknni","gor":"Bahasa Hulontalo","got":"\ud800\udf32\ud800\udf3f\ud800\udf44\ud800\udf39\ud800\udf43\ud800\udf3a","grc":"Ἀρχαία ἑλληνικὴ","gsw":"Alemannisch","gu":"ગુજરાતી","gv":"Gaelg","ha":"Hausa","hak":"客家語\/Hak-kâ-ngî","haw":"Hawaiʻi","he":"עברית","hi":"हिन्दी","hif":"Fiji Hindi","hif-latn":"Fiji Hindi","hil":"Ilonggo","ho":"Hiri Motu","hr":"hrvatski","hrx":"Hunsrik","hsb":"hornjoserbsce","ht":"Kreyòl ayisyen","hu":"magyar","hu-formal":"magyar (formal)","hy":"հայերեն","hyw":"Արեւմտահայերէն","hz":"Otsiherero","ia":"interlingua","id":"Bahasa Indonesia","ie":"Interlingue","ig":"Igbo","ii":"ꆇꉙ","ik":"Iñupiak","ike-cans":"ᐃᓄᒃᑎᑐᑦ","ike-latn":"inuktitut","ilo":"Ilokano","inh":"ГӀалгӀай","io":"Ido","is":"íslenska","it":"italiano","iu":"ᐃᓄᒃᑎᑐᑦ\/inuktitut","ja":"日本語","jam":"Patois","jbo":"la .lojban.","jut":"jysk","jv":"Jawa","ka":"ქართული","kaa":"Qaraqalpaqsha","kab":"Taqbaylit","kbd":"Адыгэбзэ","kbd-cyrl":"Адыгэбзэ","kbp":"Kabɩyɛ","kea":"Kabuverdianu","kg":"Kongo","khw":"کھوار","ki":"Gĩkũyũ","kiu":"Kırmancki","kj":"Kwanyama","kjp":"ဖၠုံလိက်","kk":"қазақша","kk-arab":"قازاقشا (تٴوتە)","kk-cn":"قازاقشا (جۇنگو)","kk-cyrl":"қазақша (кирил)","kk-kz":"қазақша (Қазақстан)","kk-latn":"qazaqşa (latın)","kk-tr":"qazaqşa (Türkïya)","kl":"kalaallisut","km":"ភាសាខ្មែរ","kn":"ಕನ್ನಡ","ko":"한국어","ko-kp":"조선말","koi":"Перем Коми","kr":"Kanuri","krc":"къарачай-малкъар","kri":"Krio","krj":"Kinaray-a","krl":"karjal","ks":"कॉशुर \/ کٲشُر","ks-arab":"کٲشُر","ks-deva":"कॉशुर","ksh":"Ripoarisch","ku":"kurdî","ku-arab":"كوردي (عەرەبی)","ku-latn":"kurdî (latînî)","kum":"къумукъ","kv":"коми","kw":"kernowek","ky":"Кыргызча","la":"Latina","lad":"Ladino","lb":"Lëtzebuergesch","lbe":"лакку","lez":"лезги","lfn":"Lingua Franca Nova","lg":"Luganda","li":"Limburgs","lij":"Ligure","liv":"Līvõ kēļ","lki":"لەکی","lld":"Ladin","lmo":"lumbaart","ln":"lingála","lo":"ລາວ","loz":"Silozi","lrc":"لۊری شومالی","lt":"lietuvių","ltg":"latgaļu","lus":"Mizo ţawng","luz":"لئری دوٙمینی","lv":"latviešu","lzh":"文言","lzz":"Lazuri","mai":"मैथिली","map-bms":"Basa Banyumasan","mdf":"мокшень","mg":"Malagasy","mh":"Ebon","mhr":"олык марий","mi":"Māori","min":"Minangkabau","mk":"македонски","ml":"മലയാളം","mn":"монгол","mni":"ꯃꯤꯇꯩ ꯂꯣꯟ","mnw":"ဘာသာ မန်","mo":"молдовеняскэ","mr":"मराठी","mrj":"кырык мары","ms":"Bahasa Melayu","mt":"Malti","mus":"Mvskoke","mwl":"Mirandés","my":"မြန်မာဘာသာ","myv":"эрзянь","mzn":"مازِرونی","na":"Dorerin Naoero","nah":"Nāhuatl","nan":"Bân-lâm-gú","nap":"Napulitano","nb":"norsk bokmål","nds":"Plattdüütsch","nds-nl":"Nedersaksies","ne":"नेपाली","new":"नेपाल भाषा","ng":"Oshiwambo","niu":"Niuē","nl":"Nederlands","nl-informal":"Nederlands (informeel)","nn":"norsk nynorsk","no":"norsk","nod":"ᨣᩴᩤᨾᩮᩥᩬᨦ","nov":"Novial","nqo":"ߒߞߏ","nrm":"Nouormand","nso":"Sesotho sa Leboa","nv":"Diné bizaad","ny":"Chi-Chewa","nys":"Nyunga","oc":"occitan","olo":"Livvinkarjala","om":"Oromoo","or":"ଓଡ଼ିଆ","os":"Ирон","ota":"لسان توركى","pa":"ਪੰਜਾਬੀ","pag":"Pangasinan","pam":"Kapampangan","pap":"Papiamentu","pcd":"Picard","pdc":"Deitsch","pdt":"Plautdietsch","pfl":"Pälzisch","pi":"पालि","pih":"Norfuk \/ Pitkern","pl":"polski","pms":"Piemontèis","pnb":"پنجابی","pnt":"Ποντιακά","prg":"Prūsiskan","ps":"پښتو","pt":"português","pt-br":"português do Brasil","qu":"Runa Simi","qug":"Runa shimi","rgn":"Rumagnôl","rif":"Tarifit","rm":"rumantsch","rmf":"kaalengo tšimb","rmy":"romani čhib","rn":"Kirundi","ro":"română","roa-rup":"armãneashti","roa-tara":"tarandíne","ru":"русский","rue":"русиньскый","rup":"armãneashti","ruq":"Vlăheşte","ruq-cyrl":"Влахесте","ruq-latn":"Vlăheşte","rw":"Kinyarwanda","rwr":"मारवाड़ी","sa":"संस्कृतम्","sah":"саха тыла","sat":"ᱥᱟᱱᱛᱟᱲᱤ","sc":"sardu","scn":"sicilianu","sco":"Scots","sd":"سنڌي","sdc":"Sassaresu","sdh":"کوردی خوارگ","se":"davvisámegiella","sei":"Cmique Itom","ses":"Koyraboro Senni","sg":"Sängö","sgs":"žemaitėška","sh":"srpskohrvatski \/ српскохрватски","shi":"Tašlḥiyt\/ⵜⴰⵛⵍⵃⵉⵜ","shi-latn":"Tašlḥiyt","shi-tfng":"ⵜⴰⵛⵍⵃⵉⵜ","shn":"ၽႃႇသႃႇတႆး ","shy-latn":"tacawit","si":"සිංහල","simple":"Simple English","sjd":"Кӣллт са̄мь кӣлл","sje":"bidumsámegiella","sju":"ubmejesámiengiälla","sk":"slovenčina","skr":"سرائیکی","skr-arab":"سرائیکی","sl":"slovenščina","sli":"Schläsch","sm":"Gagana Samoa","sma":"åarjelsaemien","smj":"julevsámegiella","smn":"anarâškielâ","sms":"sääʹmǩiõll","sn":"chiShona","so":"Soomaaliga","sq":"shqip","sr":"српски \/ srpski","sr-ec":"српски (ћирилица)","sr-el":"srpski (latinica)","srn":"Sranantongo","srq":"mbia cheë","ss":"SiSwati","st":"Sesotho","stq":"Seeltersk","sty":"себертатар","su":"Sunda","sv":"svenska","sw":"Kiswahili","szl":"ślůnski","szy":"Sakizaya","ta":"தமிழ்","tay":"Tayal","tcy":"ತುಳು","te":"తెలుగు","tet":"tetun","tg":"тоҷикӣ","tg-cyrl":"тоҷикӣ","tg-latn":"tojikī","th":"ไทย","ti":"ትግርኛ","tk":"Türkmençe","tl":"Tagalog","tly":"толышә зывон","tn":"Setswana","to":"lea faka-Tonga","tpi":"Tok Pisin","tr":"Türkçe","tru":"Ṫuroyo","trv":"Seediq","ts":"Xitsonga","tt":"татарча\/tatarça","tt-cyrl":"татарча","tt-latn":"tatarça","tum":"chiTumbuka","tw":"Twi","ty":"reo tahiti","tyv":"тыва дыл","tzm":"ⵜⴰⵎⴰⵣⵉⵖⵜ","udm":"удмурт","ug":"ئۇيغۇرچە \/ Uyghurche","ug-arab":"ئۇيغۇرچە","ug-latn":"Uyghurche","uk":"українська","ur":"اردو","uz":"oʻzbekcha\/ўзбекча","uz-cyrl":"ўзбекча","uz-latn":"oʻzbekcha","ve":"Tshivenda","vec":"vèneto","vep":"vepsän kel’","vi":"Tiếng Việt","vls":"West-Vlams","vmf":"Mainfränkisch","vo":"Volapük","vot":"Vaďďa","vro":"Võro","wa":"walon","war":"Winaray","wo":"Wolof","wuu":"吴语","xal":"хальмг","xh":"isiXhosa","xmf":"მარგალური","xsy":"saisiyat","yi":"ייִדיש","yo":"Yorùbá","yue":"粵語","za":"Vahcuengh","zea":"Zeêuws","zgh":"ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ","zh":"中文","zh-classical":"文言","zh-cn":"中文(中国大陆)","zh-hans":"中文(简体)","zh-hant":"中文(繁體)","zh-hk":"中文(香港)","zh-min-nan":"Bân-lâm-gú","zh-mo":"中文(澳門)","zh-my":"中文(马来西亚)","zh-sg":"中文(新加坡)","zh-tw":"中文(台灣)","zh-yue":"粵語","zu":"isiZulu"};
/**
* AnonymousI18N
*
* Internationalisation for anonymous users.
*
* @author [[User:Krinkle]]
* @stats [[File:Krinkle_AnonymousI18N.js]]
*/
if (mw.config.get('wgUserName') === null) {
mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:AnonymousI18N.js&action=raw&ctype=text/javascript' );
// ULS disabled until functional - T58464
$('#pt-uls').hide();
}
/**
* Special:Upload enhancements
*
* Moved to [[MediaWiki:Upload.js]], [[MediaWiki:Gadget-ImprovedUploadForm.js]]
*
* Maintainer: [[User:Lupo]]
*
*/
if (mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload') {
importScript('MediaWiki:Upload.js');
}
/**
* Pending fix for bug 29277
*
* If we're on file pages and the filepage module isn't being loaded
* or already loaded, load it.
* Calls to mw.log are file, mw.log is no-op function in production mode,
* and with debug=true it's linked to console.
*/
if ( mw.config.get( 'wgCanonicalNamespace' ) === 'File' && $.inArray( mw.loader.getState( 'filepage' ), ['loading', 'loaded', 'ready'] ) === -1 ) {
mw.log( 'site js> filepage module should be loaded but is not. loading now..' );
mw.loader.using( 'filepage', function () {
mw.log( 'site js> filepage module ' + mw.loader.getState( 'filepage' ) );
} );
}
/**
* ImageStacks
* Maintainer: [[User:Hellerhoff]], [[User:DieBuche]]
*/
// Only load if page contains template
mw.hook( 'wikipage.content' ).add( function ( $content ) {
if ( $content.find( 'div.ImageStack' ).length ) mw.loader.load( 'ext.gadget.ImageStack' );
} );
/**
* Infobox image switcher
* Maintainer: [[User:Mike Peel]]
*/
// Only load if page contains template
mw.hook( 'wikipage.content' ).add( function ( $content ) {
if ( $content.find( 'table#wdinfobox' ).length ) mw.loader.load( 'ext.gadget.Infobox' );
} );
// Catfood - tweaked version of [[MediaWiki:Catfood.js]]
// Add a link to a RSS feed for each category page, in the toolbox.
// If i18n is required, create a gadget, please and use MW-messages
if (mw.config.get('wgNamespaceNumber') === 14) $(document).ready(function () {
var p = mw.util.addPortletLink('p-tb', 'https://catfood.toolforge.org/catfood.php?category=' + encodeURIComponent(mw.config.get('wgTitle').split(' ').join('_')), 'RSS feed', 't-catfood', 'Category feed: The images are ordered based on the time of the addition of the image to the category, latest additions first');
if (!p) return;
var $p = $(p);
var $a = $p.find('a');
if ($a.length) {
$a.addClass('feedlink');
} else {
$p.addClass('feedlink');
}
});
/**
* Commons Dashboard
* a collection of widgets containing real time status displays
* and ways to achieve common tasks with less work
* that seamless integrate into the Wikimedia Commons user interface
* @maintainer [[User:Rillke]]
*/
mw.hook( 'wikipage.content' ).add( function($content) {
if ($content.find('.commonsdashboard').length) mw.loader.load('ext.gadget.CommonsDashboard');
} );
/**
* jQuery UI loader
* Loads jQuery UI modules on demand and allows users making use of
* (some) of the awesome jQuery UI widgets.
*
* @maintainer [[User:Rillke]]
*/
mw.hook( 'wikipage.content' ).add( function ( $content ) {
var $accordion = $content.find( '.accordion' ),
$button = $content.find( '.ui-button' );
if ($accordion.length) {
mw.loader.using( 'jquery.ui', function () {
$accordion.accordion( { autoHeight: false } );
} );
}
if ($button.length) {
mw.loader.load( 'jquery.ui' );
}
} );
// Fix for https://bugzilla.wikimedia.org/show_bug.cgi?id=51038
mw.hook( 'wikipage.content' ).add( function($content) {
if ($content.find('.mw-babel-wrapper').length) mw.loader.load('ext.babel');
});
/* End of mw.loader.using callback */
});
/**
* Various user scripts are making use of this function despite deprecation a long time ago:
* https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#Legacy_removals
* These users should be notified that they are running broken scripts so they can update.
* This function can be removed after 30th September 2020
*/
function addPortletLink() {
var userScript = '/wiki/Special:MyPage/' + mw.config.get('skin') +'.js';
var commonScript = '/wiki/Special:MyPage/common.js';
mw.notify(
$('<div>').html(
'A script you are loading is using the deprecated function <strong>addPortletLink</strong>. Please review your scripts in <a href="https://profillengkap.com/pl/' + userScript + '">your user</a> <a href="https://profillengkap.com/pl/' + commonScript + '">scripts</a> to make this notification go away.'
),
{ type: 'error' }
);
}
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.