User:MarkTraceur/common.js

function messWithInternalClasses { // T337030 if ( typeof mw.mmv !== 'undefined' ) { return; }	var oldLinks = mw.mmv.ui.MetadataPanel.prototype.initializeImageLinks, oldSet = mw.mmv.ui.MetadataPanel.prototype.setImageInfo, oldEmpty = mw.mmv.ui.MetadataPanel.prototype.empty;

mw.mmv.ui.MetadataPanel.prototype.initializeImageLinks = function { oldLinks.call( this );

this.$metadataLi = $( '' ) .addClass( 'mw-mmv-extension-metadata-li empty' ) .appendTo( this.$imageLinks );

this.$metadata = $( '' ) .addClass( 'mw-mmv-extension-metadata' ) .text( 'Metadata API call' ) .appendTo( this.$metadataLi ); };

mw.mmv.ui.MetadataPanel.prototype.setImageInfo = function ( image, imageData, repoData, localUsage, globalUsage, user ) { var metadataHref;

oldSet.call( this, image, imageData, repoData, localUsage, globalUsage, user );

metadataHref = mw.util.wikiScript( 'api' ) + '?action=query&format=json&prop=imageinfo&iiprop=timestamp|user|url|size|mime|mediatype|extmetadata&iiextmetadatafilter=DateTime|DateTimeOriginal|ImageDescription|License|LicenseShortName|UsageTerms|LicenseUrl|Credit|Artist|GPSLatitude|GPSLongitude|Categories|Permission&iiextmetadatalanguage=en&titles=' + encodeURIComponent( image.filePageTitle.getPrefixedDb );

this.$metadata.prop( 'href', metadataHref );

this.$metadataLi.removeClass( 'empty' ); };

mw.mmv.ui.MetadataPanel.prototype.empty = function { oldEmpty.call( this );

this.$metadata.prop( 'href', null ); this.$metadata.addClass( 'empty' ); }; }

if ( mw.mmv ) { mw.loader.using( 'mmv.ui.metadataPanel', function {		messWithInternalClasses;	} ); }