User:Tgr/common.js
< User:Tgr
Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. The code will be executed when previewing this page under some skins, including Monobook. |
$.when( mw.loader.using( [ 'mediawiki.util', 'mediawiki.Uri' ] ), $.ready ).then( function () {
// CommonsMetadata convenience link
if ( mw.config.get( 'wgNamespaceNumber' ) === mw.config.get( 'wgNamespaceIds' ).file ) {
var CMDLink = new mw.Uri( mw.util.wikiScript( 'api' ) ).extend( {
action: 'query',
titles: mw.config.get( 'wgPageName' ),
prop: 'imageinfo',
iiprop: 'extmetadata',
iiextmetadatamultilang: 0,
format: 'jsonfm'
} ).toString();
mw.util.addPortletLink( 'p-tb', CMDLink, 'CMD metadata', 't-cmd', 'Extended metadata via CommonsMetadata', null, null );
}
// trigger bugs on demand
mw.util.addPortletLink( 'p-tb', '#makeError', 'make JS error', 't-makeError', 'Generate a JS error', null, null );
$( '#t-makeError' ).click( function ( e ) {
throw 'Error';
} );
} );