mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-09-23 10:22:14 +00:00
build: Updating dependencies
composer: * mediawiki/mediawiki-phan-config: 0.12.1 → 0.14.0 npm: * eslint-config-wikimedia: 0.25.1 → 0.26.0 The following rules are failing and were disabled: * resources: * es-x/no-resizable-and-growable-arraybuffers * tests/qunit: * es-x/no-resizable-and-growable-arraybuffers * grunt-banana-checker: 0.11.0 → 0.11.1 Change-Id: Ief610bdadaccd2325cd1b8a2cae70b7e465d8b76
This commit is contained in:
parent
9e613eda3a
commit
147b576b57
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"require-dev": {
|
||||
"mediawiki/mediawiki-codesniffer": "41.0.0",
|
||||
"mediawiki/mediawiki-phan-config": "0.12.1",
|
||||
"mediawiki/mediawiki-phan-config": "0.14.0",
|
||||
"mediawiki/minus-x": "1.1.1",
|
||||
"php-parallel-lint/php-console-highlighter": "1.0.0",
|
||||
"php-parallel-lint/php-parallel-lint": "1.3.2"
|
||||
|
|
1360
package-lock.json
generated
1360
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -9,9 +9,9 @@
|
|||
"doc": "jsdoc -c jsdoc.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint-config-wikimedia": "0.25.1",
|
||||
"eslint-config-wikimedia": "0.26.0",
|
||||
"grunt": "1.6.1",
|
||||
"grunt-banana-checker": "0.11.0",
|
||||
"grunt-banana-checker": "0.11.1",
|
||||
"grunt-eslint": "24.3.0",
|
||||
"grunt-stylelint": "0.19.0",
|
||||
"jsdoc": "3.6.10",
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
"no-var": "error",
|
||||
"max-len": "off",
|
||||
"no-jquery/no-class-state": "off",
|
||||
"no-jquery/no-support": "off"
|
||||
"no-jquery/no-support": "off",
|
||||
"es-x/no-resizable-and-growable-arraybuffers": "warn"
|
||||
},
|
||||
"settings": {
|
||||
"jsdoc": {
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
}
|
||||
|
||||
if ( value === null ) {
|
||||
mw.log( `Failed to fetch item ${key} from localStorage` );
|
||||
mw.log( `Failed to fetch item ${ key } from localStorage` );
|
||||
}
|
||||
|
||||
return fallback !== undefined ? fallback : null;
|
||||
|
|
|
@ -91,7 +91,9 @@
|
|||
// document, possibly a different site, that would probably have unexpected results.
|
||||
$jq
|
||||
.find( '[style]' )
|
||||
.filter( function () { return this.style.display === 'none'; } )
|
||||
.filter( function () {
|
||||
return this.style.display === 'none';
|
||||
} )
|
||||
.remove();
|
||||
|
||||
// TemplateStyles can generate inline style tags
|
||||
|
|
|
@ -138,7 +138,7 @@ const HtmlUtils = require( './mmv.HtmlUtils.js' );
|
|||
} catch ( e ) {
|
||||
message = e.message;
|
||||
if ( e.stack ) {
|
||||
message += `\n${e.stack}`;
|
||||
message += `\n${ e.stack }`;
|
||||
}
|
||||
deferred.reject( message );
|
||||
return;
|
||||
|
@ -164,7 +164,7 @@ const HtmlUtils = require( './mmv.HtmlUtils.js' );
|
|||
mw.log.warn( message2 );
|
||||
this.cleanupOverlay();
|
||||
this.viewerIsBroken = true;
|
||||
mw.notify( `Error loading MediaViewer: ${message2}` );
|
||||
mw.notify( `Error loading MediaViewer: ${ message2 }` );
|
||||
return $.Deferred().reject( message2 );
|
||||
}
|
||||
);
|
||||
|
@ -698,6 +698,7 @@ const HtmlUtils = require( './mmv.HtmlUtils.js' );
|
|||
} );
|
||||
}
|
||||
}
|
||||
|
||||
whenThumbsReady() {
|
||||
return this.thumbsReadyDeferred.promise();
|
||||
}
|
||||
|
|
|
@ -43,6 +43,6 @@
|
|||
* @return {string} the location hash
|
||||
* @member mw.mmv
|
||||
*/
|
||||
getMediaHash: ( imageFileTitle ) => `#/media/${encodeURI( imageFileTitle )}`
|
||||
getMediaHash: ( imageFileTitle ) => `#/media/${ encodeURI( imageFileTitle ) }`
|
||||
};
|
||||
}() );
|
||||
|
|
|
@ -133,6 +133,7 @@ const { EmbedFileFormatter, Utils } = require( 'mmv.ui.ondemandshareddependencie
|
|||
.text( mw.message( 'multimediaviewer-download-preview-link-title' ).text() )
|
||||
.appendTo( $container );
|
||||
}
|
||||
|
||||
createAttributionButton( $container ) {
|
||||
const attributionInput = new mw.widgets.CopyTextLayout( {
|
||||
align: 'top',
|
||||
|
@ -278,7 +279,7 @@ const { EmbedFileFormatter, Utils } = require( 'mmv.ui.ondemandshareddependencie
|
|||
* @param {string} url
|
||||
*/
|
||||
setDownloadUrl( url ) {
|
||||
this.$downloadButton.attr( 'href', `${url}?download` );
|
||||
this.$downloadButton.attr( 'href', `${ url }?download` );
|
||||
this.$previewLink.attr( 'href', url );
|
||||
|
||||
// Re-enable download
|
||||
|
@ -300,15 +301,15 @@ const { EmbedFileFormatter, Utils } = require( 'mmv.ui.ondemandshareddependencie
|
|||
// * multimediaviewer-download-medium-button-name
|
||||
// * multimediaviewer-download-large-button-name
|
||||
// * multimediaviewer-download-xl-button-name
|
||||
const sizeClassMessage = mw.message( `multimediaviewer-download-${sizeClass}-button-name` ).text();
|
||||
const sizeClassMessage = mw.message( `multimediaviewer-download-${ sizeClass }-button-name` ).text();
|
||||
const dimensionMessage = mw.message( 'multimediaviewer-embed-dimensions', width, height ).text();
|
||||
const sizeMessage = mw.message( 'multimediaviewer-embed-dimensions-with-file-format',
|
||||
dimensionMessage, extension ).text();
|
||||
|
||||
// Update button label and size strings to reflect new selected size
|
||||
this.$downloadButton.html(
|
||||
`<span class="mw-mmv-download-image-size-name">${sizeClassMessage}</span>` +
|
||||
`<span class="mw-mmv-download-image-size">${sizeMessage}</span>`
|
||||
`<span class="mw-mmv-download-image-size-name">${ sizeClassMessage }</span>` +
|
||||
`<span class="mw-mmv-download-image-size">${ sizeMessage }</span>`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,11 +55,11 @@ const { HtmlUtils } = require( 'mmv.bootstrap' );
|
|||
* @return {string}
|
||||
*/
|
||||
getThumbnailWikitext( title, width, caption, alt ) {
|
||||
const widthSection = width ? `|${width}px` : '';
|
||||
const captionSection = caption ? `|${caption}` : '';
|
||||
const altSection = alt ? `|alt=${alt}` : '';
|
||||
const widthSection = width ? `|${ width }px` : '';
|
||||
const captionSection = caption ? `|${ caption }` : '';
|
||||
const altSection = alt ? `|alt=${ alt }` : '';
|
||||
|
||||
return `[[File:${title.getMainText()}${widthSection}|thumb${captionSection}${altSection}]]`;
|
||||
return `[[File:${ title.getMainText() }${ widthSection }|thumb${ captionSection }${ altSection }]]`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -204,7 +204,7 @@ const { HtmlUtils } = require( 'mmv.bootstrap' );
|
|||
// * multimediaviewer-large-embed-dimensions
|
||||
// * multimediaviewer-medium-embed-dimensions
|
||||
// * multimediaviewer-small-embed-dimensions
|
||||
`multimediaviewer-${sizeLabel}-embed-dimensions`,
|
||||
`multimediaviewer-${ sizeLabel }-embed-dimensions`,
|
||||
dimensions
|
||||
).text();
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ const Tab = require( './mmv.ui.reuse.tab.js' );
|
|||
// * mw-editfont-monospace
|
||||
// * mw-editfont-sans-serif
|
||||
// * mw-editfont-serif
|
||||
classes: [ `mw-editfont-${mw.user.options.get( 'editfont' )}` ],
|
||||
classes: [ `mw-editfont-${ mw.user.options.get( 'editfont' ) }` ],
|
||||
placeholder: mw.message( 'multimediaviewer-reuse-loading-placeholder' ).text(),
|
||||
autosize: true,
|
||||
maxRows: 5
|
||||
|
|
|
@ -31,6 +31,7 @@ const Tab = require( './mmv.ui.reuse.tab.js' );
|
|||
super( $container );
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
this.$pane.addClass( 'mw-mmv-share-pane' )
|
||||
.appendTo( this.$container );
|
||||
|
|
|
@ -149,6 +149,7 @@
|
|||
.on( 'focus.mmv-view-logger', () => this.startViewDuration() )
|
||||
.on( 'blur.mmv-view-logger', () => this.stopViewDuration() );
|
||||
}
|
||||
|
||||
/*
|
||||
* Stops listening to events
|
||||
*/
|
||||
|
|
|
@ -316,7 +316,7 @@ const ThumbnailWidthCalculator = require( './mmv.ThumbnailWidthCalculator.js' );
|
|||
$initialImage.hide()
|
||||
.removeAttr( 'style' )
|
||||
.removeClass()
|
||||
.addClass( `mw-mmv-placeholder-image ${image.filePageTitle.getExtension().toLowerCase()}` );
|
||||
.addClass( `mw-mmv-placeholder-image ${ image.filePageTitle.getExtension().toLowerCase() }` );
|
||||
|
||||
this.ui.canvas.set( image, $initialImage );
|
||||
|
||||
|
@ -346,7 +346,7 @@ const ThumbnailWidthCalculator = require( './mmv.ThumbnailWidthCalculator.js' );
|
|||
}
|
||||
|
||||
// eslint-disable-next-line mediawiki/class-doc
|
||||
imageElement.className = `mw-mmv-final-image ${image.filePageTitle.getExtension().toLowerCase()}`;
|
||||
imageElement.className = `mw-mmv-final-image ${ image.filePageTitle.getExtension().toLowerCase() }`;
|
||||
imageElement.alt = image.alt;
|
||||
|
||||
$.when( metadataPromise, pluginsPromise ).then( ( metadata ) => {
|
||||
|
@ -524,7 +524,7 @@ const ThumbnailWidthCalculator = require( './mmv.ThumbnailWidthCalculator.js' );
|
|||
*/
|
||||
setupProgressBar( image, imagePromise, imageWidth ) {
|
||||
const progressBar = this.ui.panel.progressBar;
|
||||
const key = `${image.filePageTitle.getPrefixedDb()}|${imageWidth}`;
|
||||
const key = `${ image.filePageTitle.getPrefixedDb() }|${ imageWidth }`;
|
||||
|
||||
if ( !this.progressCache[ key ] ) {
|
||||
// Animate progress bar to 5 to give a sense that something is happening, and make sure
|
||||
|
@ -902,7 +902,7 @@ const ThumbnailWidthCalculator = require( './mmv.ThumbnailWidthCalculator.js' );
|
|||
*/
|
||||
createDocumentTitle( imageTitle ) {
|
||||
if ( imageTitle ) {
|
||||
return `${imageTitle.getNameText()} - ${this.documentTitle}`;
|
||||
return `${ imageTitle.getNameText() } - ${ this.documentTitle }`;
|
||||
} else {
|
||||
return this.documentTitle;
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ const UiElement = require( './ui/mmv.ui.js' );
|
|||
// Make sure that the metadata is going to be at the bottom when it appears
|
||||
// 83 is the height of the top metadata area. Which can't be measured by
|
||||
// reading the DOM at this point of the execution, unfortunately
|
||||
this.$postDiv.css( 'top', `${$( window ).height() - 83}px` );
|
||||
this.$postDiv.css( 'top', `${ $( window ).height() - 83 }px` );
|
||||
|
||||
// Re-appending the same content can have nasty side-effects
|
||||
// Such as the browser leaving fullscreen mode if the fullscreened element is part of it
|
||||
|
@ -468,7 +468,7 @@ const UiElement = require( './ui/mmv.ui.js' );
|
|||
* @param {boolean} showNextButton Whether the next button should be revealed or not
|
||||
*/
|
||||
updateControls( showPrevButton, showNextButton ) {
|
||||
const prevNextTop = `${( this.$imageWrapper.height() / 2 ) - 60}px`;
|
||||
const prevNextTop = `${ ( this.$imageWrapper.height() / 2 ) - 60 }px`;
|
||||
|
||||
if ( this.isFullscreen ) {
|
||||
this.$postDiv.css( 'top', '' );
|
||||
|
|
|
@ -162,6 +162,7 @@ const License = require( './mmv.model.License.js' );
|
|||
*/
|
||||
this.thumbUrls = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new Image object out of an object containing
|
||||
*
|
||||
|
@ -200,7 +201,7 @@ const License = require( './mmv.model.License.js' );
|
|||
|
||||
// Anonymise the timestamp to avoid making the file identifiable
|
||||
// We only need to know the day
|
||||
anonymizedUploadDateTime = `${anonymizedUploadDateTime.slice( 0, anonymizedUploadDateTime.length - 6 )}000000`;
|
||||
anonymizedUploadDateTime = `${ anonymizedUploadDateTime.slice( 0, anonymizedUploadDateTime.length - 6 ) }000000`;
|
||||
|
||||
name = this.parseExtmeta( extmeta.ObjectName, 'plaintext' );
|
||||
|
||||
|
@ -260,6 +261,7 @@ const License = require( './mmv.model.License.js' );
|
|||
|
||||
return imageData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new License object out of an object containing
|
||||
* imageinfo data from an API response.
|
||||
|
@ -284,6 +286,7 @@ const License = require( './mmv.model.License.js' );
|
|||
|
||||
return license;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads and parses a value from the imageinfo API extmetadata field.
|
||||
*
|
||||
|
@ -333,6 +336,7 @@ const License = require( './mmv.model.License.js' );
|
|||
throw new Error( 'Image.parseExtmeta: unknown type' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a thumb URL
|
||||
*
|
||||
|
@ -342,6 +346,7 @@ const License = require( './mmv.model.License.js' );
|
|||
addThumbUrl( width, url ) {
|
||||
this.thumbUrls[ width ] = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a thumb URL if we have it.
|
||||
*
|
||||
|
@ -351,6 +356,7 @@ const License = require( './mmv.model.License.js' );
|
|||
getThumbUrl( width ) {
|
||||
return this.thumbUrls[ width ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the image has geolocation data.
|
||||
*
|
||||
|
|
|
@ -41,15 +41,19 @@
|
|||
/** @property {string} url - */
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
getPrefixedDb() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
getPrefixedText() {
|
||||
return text( this.getPrefixedDb() );
|
||||
}
|
||||
|
||||
getDomain() {
|
||||
return this.domain;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ const { HtmlUtils } = require( 'mmv.bootstrap' );
|
|||
/** @property {HtmlUtils} htmlUtils - */
|
||||
this.htmlUtils = new HtmlUtils();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this is a Creative Commons license.
|
||||
*
|
||||
|
@ -73,6 +74,7 @@ const { HtmlUtils } = require( 'mmv.bootstrap' );
|
|||
isCc() {
|
||||
return this.internalName ? this.internalName.slice( 0, 2 ) === 'cc' : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this is a public domain "license".
|
||||
*
|
||||
|
@ -81,6 +83,7 @@ const { HtmlUtils } = require( 'mmv.bootstrap' );
|
|||
isPd() {
|
||||
return this.internalName === 'pd';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this is a free license.
|
||||
*
|
||||
|
@ -90,6 +93,7 @@ const { HtmlUtils } = require( 'mmv.bootstrap' );
|
|||
// licenses with missing nonfree information are assumed free
|
||||
return !this.nonFree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether reusers need to attribute the author
|
||||
*
|
||||
|
@ -99,6 +103,7 @@ const { HtmlUtils } = require( 'mmv.bootstrap' );
|
|||
// to be on the safe side, if the attribution required flag is not set, it is assumed to be true
|
||||
return !this.isPd() && this.attributionRequired !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the short name of the license:
|
||||
* - if we have interface messages for this license (basically just CC and PD), use those
|
||||
|
@ -109,7 +114,7 @@ const { HtmlUtils } = require( 'mmv.bootstrap' );
|
|||
* FIXME a model should not depend on an i18n class. We should probably use view models.
|
||||
*/
|
||||
getShortName() {
|
||||
const message = `multimediaviewer-license-${this.internalName || ''}`;
|
||||
const message = `multimediaviewer-license-${ this.internalName || '' }`;
|
||||
if ( mw.messages.exists( message ) ) {
|
||||
// The following messages are used here:
|
||||
// * multimediaviewer-license-cc-by-1.0
|
||||
|
@ -134,6 +139,7 @@ const { HtmlUtils } = require( 'mmv.bootstrap' );
|
|||
return this.shortName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short HTML representation of the license.
|
||||
*
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
this.cache[ key ] = getPromise();
|
||||
this.cache[ key ].fail( ( error ) => {
|
||||
// constructor.name is usually not reliable in inherited classes, but OOjs fixes that
|
||||
mw.log( `${this.constructor.name} provider failed to load: `, error );
|
||||
mw.log( `${ this.constructor.name } provider failed to load: `, error );
|
||||
} );
|
||||
}
|
||||
return this.cache[ key ];
|
||||
|
@ -113,7 +113,7 @@
|
|||
const errorCode = data.error && data.error.code;
|
||||
let errorMessage = data.error && data.error.info || 'unknown error';
|
||||
if ( errorCode ) {
|
||||
errorMessage = `${errorCode}: ${errorMessage}`;
|
||||
errorMessage = `${ errorCode }: ${ errorMessage }`;
|
||||
}
|
||||
return errorMessage;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ const Thumbnail = require( '../model/mmv.model.Thumbnail.js' );
|
|||
svg: 1
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* File extensions which can be displayed in the browser.
|
||||
* Other file types need to be thumbnailed even if the size of the original file would be right.
|
||||
|
@ -261,7 +262,7 @@ const Thumbnail = require( '../model/mmv.model.Thumbnail.js' );
|
|||
}
|
||||
|
||||
// we are assuming here that the other thumbnail parameters do not look like a size
|
||||
url = url.replace( sizeRegexp, `${width}px` );
|
||||
url = url.replace( sizeRegexp, `${ width }px` );
|
||||
|
||||
return this.restoreFilename( url, file );
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
if ( !this.cache[ cacheKey ] ) {
|
||||
this.cache[ cacheKey ] = this.rawGet( url, this.imagePreloadingSupported() );
|
||||
this.cache[ cacheKey ].fail( ( error ) => {
|
||||
mw.log( `${this.constructor.name} provider failed to load: `, error );
|
||||
mw.log( `${ this.constructor.name } provider failed to load: `, error );
|
||||
} );
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@
|
|||
}
|
||||
|
||||
img.onload = () => deferred.resolve( img );
|
||||
img.onerror = () => deferred.reject( `could not load image from ${url}` );
|
||||
img.onerror = () => deferred.reject( `could not load image from ${ url }` );
|
||||
|
||||
img.src = url;
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ const ImageModel = require( '../model/mmv.model.Image.js' );
|
|||
if ( page.imageinfo && page.imageinfo.length ) {
|
||||
return ImageModel.newFromImageInfo( file, page );
|
||||
} else if ( page.missing === true && page.imagerepository === '' ) {
|
||||
return $.Deferred().reject( `file does not exist: ${file.getPrefixedDb()}` );
|
||||
return $.Deferred().reject( `file does not exist: ${ file.getPrefixedDb() }` );
|
||||
} else {
|
||||
return $.Deferred().reject( 'unknown error' );
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ const Thumbnail = require( '../model/mmv.model.Thumbnail.js' );
|
|||
* @return {jQuery.Promise.<Thumbnail>}
|
||||
*/
|
||||
get( file, width, height ) {
|
||||
const cacheKey = `${file.getPrefixedDb()}|${width || ''}|${height || ''}`;
|
||||
const cacheKey = `${ file.getPrefixedDb() }|${ width || '' }|${ height || '' }`;
|
||||
|
||||
return this.getCachedPromise( cacheKey, () => {
|
||||
return this.apiGetWithMaxAge( {
|
||||
|
@ -78,7 +78,7 @@ const Thumbnail = require( '../model/mmv.model.Thumbnail.js' );
|
|||
return $.Deferred().reject( 'error in provider, thumb info not found' );
|
||||
}
|
||||
} else if ( page.missing === true && page.imagerepository === '' ) {
|
||||
return $.Deferred().reject( `file does not exist: ${file.getPrefixedDb()}` );
|
||||
return $.Deferred().reject( `file does not exist: ${ file.getPrefixedDb() }` );
|
||||
} else {
|
||||
return $.Deferred().reject( 'unknown error' );
|
||||
}
|
||||
|
|
|
@ -322,8 +322,8 @@ const UiElement = require( './mmv.ui.js' );
|
|||
duration: animationLength,
|
||||
step: ( step ) => {
|
||||
this.$image.css( {
|
||||
'-webkit-filter': `blur(${step}px)`,
|
||||
filter: `blur(${step}px)`
|
||||
'-webkit-filter': `blur(${ step }px)`,
|
||||
filter: `blur(${ step }px)`
|
||||
} );
|
||||
},
|
||||
complete: () => {
|
||||
|
@ -332,6 +332,7 @@ const UiElement = require( './mmv.ui.js' );
|
|||
}
|
||||
} );
|
||||
}
|
||||
|
||||
unblur() {
|
||||
// We apply empty CSS values to remove the inline styles applied by jQuery
|
||||
// so that they don't get in the way of styles defined in CSS
|
||||
|
@ -350,18 +351,18 @@ const UiElement = require( './mmv.ui.js' );
|
|||
const htmlUtils = new HtmlUtils();
|
||||
|
||||
// ** is bolding in Phabricator
|
||||
const description = `**${mw.message( 'multimediaviewer-errorreport-privacywarning' ).text()}**
|
||||
const description = `**${ mw.message( 'multimediaviewer-errorreport-privacywarning' ).text() }**
|
||||
|
||||
|
||||
Error details:
|
||||
|
||||
error: ${error}
|
||||
URL: ${location.href}
|
||||
user agent: ${navigator.userAgent}
|
||||
screen size: ${screen.width}x${screen.height}
|
||||
canvas size: ${canvasDimensions.width}x${canvasDimensions.height}
|
||||
image size: ${this.imageRawMetadata.originalWidth}x${this.imageRawMetadata.originalHeight}
|
||||
thumbnail size: CSS: ${thumbnailDimensions.cssWidth}x${thumbnailDimensions.cssHeight}, screen width: ${thumbnailDimensions.screen}, real width: ${thumbnailDimensions.real}`;
|
||||
error: ${ error }
|
||||
URL: ${ location.href }
|
||||
user agent: ${ navigator.userAgent }
|
||||
screen size: ${ screen.width }x${ screen.height }
|
||||
canvas size: ${ canvasDimensions.width }x${ canvasDimensions.height }
|
||||
image size: ${ this.imageRawMetadata.originalWidth }x${ this.imageRawMetadata.originalHeight }
|
||||
thumbnail size: CSS: ${ thumbnailDimensions.cssWidth }x${ thumbnailDimensions.cssHeight }, screen width: ${ thumbnailDimensions.screen }, real width: ${ thumbnailDimensions.real }`;
|
||||
const errorUri = mw.msg( 'multimediaviewer-report-issue-url', encodeURIComponent( description ) );
|
||||
|
||||
const $retryLink = $( '<a>' ).addClass( 'mw-mmv-retry-link' ).text(
|
||||
|
|
|
@ -255,6 +255,7 @@ const UiElement = require( './mmv.ui.js' );
|
|||
this.$reuse.prop( 'href', image.descriptionUrl );
|
||||
this.$download.prop( 'href', image.url );
|
||||
}
|
||||
|
||||
empty() {
|
||||
this.$reuse
|
||||
.removeClass( 'open' )
|
||||
|
|
|
@ -154,14 +154,14 @@ const UiElement = require( './mmv.ui.js' );
|
|||
this.closeDialog();
|
||||
return false;
|
||||
} );
|
||||
$( document ).on( `click.mmv.${this.eventPrefix}`, this.outsideClickHandler );
|
||||
$( document ).on( `click.mmv.${ this.eventPrefix }`, this.outsideClickHandler );
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the event handler set up by startListeningToOutsideClick().
|
||||
*/
|
||||
stopListeningToOutsideClick() {
|
||||
$( document ).off( `click.mmv.${this.eventPrefix}`, this.outsideClickHandler );
|
||||
$( document ).off( `click.mmv.${ this.eventPrefix }`, this.outsideClickHandler );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -373,6 +373,7 @@ const TruncatableTextField = require( './mmv.ui.truncatableTextField.js' );
|
|||
)
|
||||
.appendTo( this.$imageMetadata );
|
||||
}
|
||||
|
||||
/* Setters */
|
||||
/**
|
||||
* Sets the image title at the top of the metadata panel.
|
||||
|
@ -531,7 +532,7 @@ const TruncatableTextField = require( './mmv.ui.truncatableTextField.js' );
|
|||
let isCc;
|
||||
let isPd;
|
||||
|
||||
filePageUrl += `?uselang=${mw.config.get( 'wgUserLanguage' )}#${mw.message( 'license-header' ).text()}`;
|
||||
filePageUrl += `?uselang=${ mw.config.get( 'wgUserLanguage' ) }#${ mw.message( 'license-header' ).text() }`;
|
||||
|
||||
if ( license ) {
|
||||
shortName = license.getShortName();
|
||||
|
@ -592,7 +593,7 @@ const TruncatableTextField = require( './mmv.ui.truncatableTextField.js' );
|
|||
// * multimediaviewer-restriction-trademarked
|
||||
// * multimediaviewer-restriction-default
|
||||
// * multimediaviewer-restriction-default-and-others
|
||||
if ( !mw.message( `multimediaviewer-restriction-${value}` ).exists() || value === 'default' || index + 1 > MetadataPanel.MAX_RESTRICT ) {
|
||||
if ( !mw.message( `multimediaviewer-restriction-${ value }` ).exists() || value === 'default' || index + 1 > MetadataPanel.MAX_RESTRICT ) {
|
||||
showDefault = true; // If the restriction isn't defined or there are more than MAX_RESTRICT of them, show a generic symbol at the end
|
||||
return;
|
||||
}
|
||||
|
@ -640,7 +641,7 @@ const TruncatableTextField = require( './mmv.ui.truncatableTextField.js' );
|
|||
// * multimediaviewer-restriction-trademarked
|
||||
// * multimediaviewer-restriction-default
|
||||
// * multimediaviewer-restriction-default-and-others
|
||||
.prop( 'title', mw.message( `multimediaviewer-restriction-${type}` ).text() );
|
||||
.prop( 'title', mw.message( `multimediaviewer-restriction-${ type }` ).text() );
|
||||
|
||||
$( '<span>' )
|
||||
// The following classes are used here:
|
||||
|
@ -658,8 +659,8 @@ const TruncatableTextField = require( './mmv.ui.truncatableTextField.js' );
|
|||
// * mw-mmv-restriction-personality
|
||||
// * mw-mmv-restriction-trademarked:after
|
||||
// * mw-mmv-restriction-default
|
||||
.addClass( `mw-mmv-restriction-label-inner mw-mmv-restriction-${type === 'default-and-others' ? 'default' : type}` )
|
||||
.text( mw.message( `multimediaviewer-restriction-${type}` ).text() )
|
||||
.addClass( `mw-mmv-restriction-label-inner mw-mmv-restriction-${ type === 'default-and-others' ? 'default' : type }` )
|
||||
.text( mw.message( `multimediaviewer-restriction-${ type }` ).text() )
|
||||
.appendTo( $label );
|
||||
|
||||
return $label;
|
||||
|
@ -676,13 +677,13 @@ const TruncatableTextField = require( './mmv.ui.truncatableTextField.js' );
|
|||
}
|
||||
|
||||
const latitude = imageData.latitude >= 0 ? imageData.latitude : imageData.latitude * -1;
|
||||
const latmsg = `multimediaviewer-geoloc-${imageData.latitude >= 0 ? 'north' : 'south'}`;
|
||||
const latmsg = `multimediaviewer-geoloc-${ imageData.latitude >= 0 ? 'north' : 'south' }`;
|
||||
const latdeg = Math.floor( latitude );
|
||||
let latremain = latitude - latdeg;
|
||||
const latmin = Math.floor( ( latremain ) * 60 );
|
||||
|
||||
const longitude = imageData.longitude >= 0 ? imageData.longitude : imageData.longitude * -1;
|
||||
const longmsg = `multimediaviewer-geoloc-${imageData.longitude >= 0 ? 'east' : 'west'}`;
|
||||
const longmsg = `multimediaviewer-geoloc-${ imageData.longitude >= 0 ? 'east' : 'west' }`;
|
||||
const longdeg = Math.floor( longitude );
|
||||
let longremain = longitude - longdeg;
|
||||
const longmin = Math.floor( ( longremain ) * 60 );
|
||||
|
@ -724,11 +725,11 @@ const TruncatableTextField = require( './mmv.ui.truncatableTextField.js' );
|
|||
|
||||
this.$location.prop( 'href', (
|
||||
'https://geohack.toolforge.org/geohack.php?pagename=' +
|
||||
`File:${imageData.title.getMain()
|
||||
`File:${ imageData.title.getMain()
|
||||
}¶ms=${
|
||||
Math.abs( imageData.latitude )}${imageData.latitude >= 0 ? '_N_' : '_S_'
|
||||
}${Math.abs( imageData.longitude )}${imageData.longitude >= 0 ? '_E_' : '_W_'
|
||||
}&language=${encodeURIComponent( mw.config.get( 'wgUserLanguage' ) )}`
|
||||
Math.abs( imageData.latitude ) }${ imageData.latitude >= 0 ? '_N_' : '_S_'
|
||||
}${ Math.abs( imageData.longitude ) }${ imageData.longitude >= 0 ? '_E_' : '_W_'
|
||||
}&language=${ encodeURIComponent( mw.config.get( 'wgUserLanguage' ) ) }`
|
||||
) );
|
||||
|
||||
this.$locationLi.removeClass( 'empty' );
|
||||
|
|
|
@ -42,6 +42,7 @@ const UiElement = require( './mmv.ui.js' );
|
|||
.addClass( 'mw-mmv-progress-percent' )
|
||||
.appendTo( this.$progress );
|
||||
}
|
||||
|
||||
empty() {
|
||||
this.hide();
|
||||
}
|
||||
|
@ -68,13 +69,13 @@ const UiElement = require( './mmv.ui.js' );
|
|||
// fast to 100 and we hide the bar when the animation is done
|
||||
// FIXME: Use CSS transition
|
||||
// eslint-disable-next-line no-jquery/no-animate
|
||||
this.$percent.animate( { width: `${percent}%` }, 50, 'swing', this.hide.bind( this ) );
|
||||
this.$percent.animate( { width: `${ percent }%` }, 50, 'swing', this.hide.bind( this ) );
|
||||
} else {
|
||||
// When any other % update comes in, we make sure the bar is visible
|
||||
// and we animate to the right position
|
||||
// FIXME: Use CSS transition
|
||||
// eslint-disable-next-line no-jquery/no-animate
|
||||
this.$percent.animate( { width: `${percent}%` } );
|
||||
this.$percent.animate( { width: `${ percent }%` } );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +86,7 @@ const UiElement = require( './mmv.ui.js' );
|
|||
*/
|
||||
jumpTo( percent ) {
|
||||
this.$progress.removeClass( 'empty' );
|
||||
this.$percent.stop().css( { width: `${percent}%` } );
|
||||
this.$percent.stop().css( { width: `${ percent }%` } );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ const Dialog = require( './mmv.ui.dialog.js' );
|
|||
|
||||
this.eventPrefix = 'use-this-file';
|
||||
}
|
||||
|
||||
// FIXME this should happen outside the dialog and the tabs, but we need to improve
|
||||
initTabs() {
|
||||
const makeTab = ( type ) => new OO.ui.MenuOptionWidget( {
|
||||
|
@ -54,7 +55,7 @@ const Dialog = require( './mmv.ui.dialog.js' );
|
|||
// The following messages are used here:
|
||||
// * multimediaviewer-embed-tab
|
||||
// * multimediaviewer-share-tab
|
||||
label: mw.message( `multimediaviewer-${type}-tab` ).text()
|
||||
label: mw.message( `multimediaviewer-${ type }-tab` ).text()
|
||||
} );
|
||||
|
||||
this.reuseTabs = new OO.ui.MenuSelectWidget( {
|
||||
|
@ -104,6 +105,7 @@ const Dialog = require( './mmv.ui.dialog.js' );
|
|||
this.tabsSetValues = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
toggleDialog() {
|
||||
if ( this.tabs === null ) {
|
||||
this.initTabs();
|
||||
|
|
|
@ -94,9 +94,11 @@ const UiElement = require( './mmv.ui.js' );
|
|||
.addClass( 'mw-mmv-ttf-container empty' )
|
||||
.append( this.$element, this.$ellipsis );
|
||||
}
|
||||
|
||||
attach() {
|
||||
$( window ).on( 'resize.mmv-ttf', mw.util.debounce( this.repaint.bind( this ), 100 ) );
|
||||
}
|
||||
|
||||
unattach() {
|
||||
$( window ).off( 'resize.mmv-ttf' );
|
||||
}
|
||||
|
@ -113,6 +115,7 @@ const UiElement = require( './mmv.ui.js' );
|
|||
this.$ellipsis.hide();
|
||||
this.shrink();
|
||||
}
|
||||
|
||||
empty() {
|
||||
this.$element.empty();
|
||||
// eslint-disable-next-line mediawiki/class-doc
|
||||
|
|
|
@ -36,6 +36,7 @@ const Dialog = require( './mmv.ui.dialog.js' );
|
|||
|
||||
this.initPanel();
|
||||
}
|
||||
|
||||
attach() {
|
||||
this.handleEvent( 'mmv-options-open', this.handleOpenCloseClick.bind( this ) );
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
},
|
||||
"rules": {
|
||||
"no-jquery/no-global-selector": "off",
|
||||
"no-jquery/no-sizzle": "off"
|
||||
"no-jquery/no-sizzle": "off",
|
||||
"es-x/no-resizable-and-growable-arraybuffers": "warn"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,9 @@ const { EmbedFileFormatter } = require( 'mmv.ui.ondemandshareddependencies' );
|
|||
);
|
||||
const repoInfo = {
|
||||
displayName: options.siteName,
|
||||
getSiteLink: function () { return options.siteUrl; }
|
||||
getSiteLink: function () {
|
||||
return options.siteUrl;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
|
@ -229,7 +231,9 @@ const { EmbedFileFormatter } = require( 'mmv.ui.ondemandshareddependencies' );
|
|||
source: 'Source',
|
||||
descriptionShortUrl: 'link',
|
||||
title: {
|
||||
getNameText: function () { return 'Image Title'; }
|
||||
getNameText: function () {
|
||||
return 'Image Title';
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
@ -246,10 +250,14 @@ const { EmbedFileFormatter } = require( 'mmv.ui.ondemandshareddependencies' );
|
|||
source: 'Source',
|
||||
descriptionShortUrl: 'link',
|
||||
title: {
|
||||
getNameText: function () { return 'Image Title'; }
|
||||
getNameText: function () {
|
||||
return 'Image Title';
|
||||
}
|
||||
},
|
||||
license: {
|
||||
getShortName: function () { return 'WTFPL v2'; },
|
||||
getShortName: function () {
|
||||
return 'WTFPL v2';
|
||||
},
|
||||
longName: 'Do What the Fuck You Want Public License Version 2',
|
||||
isFree: this.sandbox.stub().returns( true )
|
||||
}
|
||||
|
@ -265,7 +273,9 @@ const { EmbedFileFormatter } = require( 'mmv.ui.ondemandshareddependencies' );
|
|||
let html = formatter.getCreditHtml( {
|
||||
repoInfo: {
|
||||
displayName: 'Localcommons',
|
||||
getSiteLink: function () { return 'quux'; }
|
||||
getSiteLink: function () {
|
||||
return 'quux';
|
||||
}
|
||||
},
|
||||
|
||||
imageInfo: {
|
||||
|
@ -273,7 +283,9 @@ const { EmbedFileFormatter } = require( 'mmv.ui.ondemandshareddependencies' );
|
|||
source: 'Source',
|
||||
descriptionShortUrl: 'some link',
|
||||
title: {
|
||||
getNameText: function () { return 'Image Title'; }
|
||||
getNameText: function () {
|
||||
return 'Image Title';
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
@ -287,7 +299,9 @@ const { EmbedFileFormatter } = require( 'mmv.ui.ondemandshareddependencies' );
|
|||
html = formatter.getCreditHtml( {
|
||||
repoInfo: {
|
||||
displayName: 'Localcommons',
|
||||
getSiteLink: function () { return 'quux'; }
|
||||
getSiteLink: function () {
|
||||
return 'quux';
|
||||
}
|
||||
},
|
||||
|
||||
imageInfo: {
|
||||
|
@ -295,10 +309,14 @@ const { EmbedFileFormatter } = require( 'mmv.ui.ondemandshareddependencies' );
|
|||
source: 'Source',
|
||||
descriptionShortUrl: 'some link',
|
||||
title: {
|
||||
getNameText: function () { return 'Image Title'; }
|
||||
getNameText: function () {
|
||||
return 'Image Title';
|
||||
}
|
||||
},
|
||||
license: {
|
||||
getShortLink: function () { return '<a href="http://www.wtfpl.net/">WTFPL v2</a>'; },
|
||||
getShortLink: function () {
|
||||
return '<a href="http://www.wtfpl.net/">WTFPL v2</a>';
|
||||
},
|
||||
longName: 'Do What the Fuck You Want Public License Version 2',
|
||||
isFree: this.sandbox.stub().returns( true )
|
||||
}
|
||||
|
|
|
@ -60,8 +60,12 @@ const { MultimediaViewerBootstrap } = require( 'mmv.bootstrap' );
|
|||
canvas: { set: function () {},
|
||||
unblurWithAnimation: function () {},
|
||||
unblur: function () {},
|
||||
getCurrentImageWidths: function () { return { real: 0 }; },
|
||||
getDimensions: function () { return {}; }
|
||||
getCurrentImageWidths: function () {
|
||||
return { real: 0 };
|
||||
},
|
||||
getDimensions: function () {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
panel: {
|
||||
setImageInfo: function () {},
|
||||
|
@ -138,8 +142,12 @@ const { MultimediaViewerBootstrap } = require( 'mmv.bootstrap' );
|
|||
canvas: { set: function () {},
|
||||
unblurWithAnimation: function () {},
|
||||
unblur: function () {},
|
||||
getCurrentImageWidths: function () { return { real: 0 }; },
|
||||
getDimensions: function () { return {}; }
|
||||
getCurrentImageWidths: function () {
|
||||
return { real: 0 };
|
||||
},
|
||||
getDimensions: function () {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
panel: {
|
||||
setImageInfo: function () {},
|
||||
|
@ -249,7 +257,9 @@ const { MultimediaViewerBootstrap } = require( 'mmv.bootstrap' );
|
|||
viewer.ui = { canvas: {
|
||||
unblurWithAnimation: function () {},
|
||||
unblur: function () {},
|
||||
maybeDisplayPlaceholder: function () { return true; }
|
||||
maybeDisplayPlaceholder: function () {
|
||||
return true;
|
||||
}
|
||||
} };
|
||||
viewer.imageInfoProvider.get = this.sandbox.stub();
|
||||
|
||||
|
@ -272,7 +282,9 @@ const { MultimediaViewerBootstrap } = require( 'mmv.bootstrap' );
|
|||
viewer.ui = { canvas: {
|
||||
unblurWithAnimation: function () {},
|
||||
unblur: function () {},
|
||||
maybeDisplayPlaceholder: function () { return true; }
|
||||
maybeDisplayPlaceholder: function () {
|
||||
return true;
|
||||
}
|
||||
} };
|
||||
viewer.imageInfoProvider.get = this.sandbox.stub().returns( $.Deferred().resolve( { width: 100, height: 100 } ) );
|
||||
|
||||
|
@ -354,8 +366,12 @@ const { MultimediaViewerBootstrap } = require( 'mmv.bootstrap' );
|
|||
setupForLoad: function () {},
|
||||
canvas: {
|
||||
set: function () {},
|
||||
getCurrentImageWidths: function () { return { real: 0 }; },
|
||||
getDimensions: function () { return {}; }
|
||||
getCurrentImageWidths: function () {
|
||||
return { real: 0 };
|
||||
},
|
||||
getDimensions: function () {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
panel: {
|
||||
setImageInfo: this.sandbox.stub(),
|
||||
|
|
|
@ -57,7 +57,9 @@ const { License } = require( 'mmv' );
|
|||
|
||||
mw.message = function ( name ) {
|
||||
return name === 'multimediaviewer-license-' + existingMessageKey ?
|
||||
{ text: function () { return 'Translated name'; } } :
|
||||
{ text: function () {
|
||||
return 'Translated name';
|
||||
} } :
|
||||
oldMwMessage.apply( mw, arguments );
|
||||
};
|
||||
mw.messages.exists = function ( name ) {
|
||||
|
|
|
@ -99,7 +99,9 @@ const { ImageProvider } = require( 'mmv' );
|
|||
|
||||
imageProvider.imagePreloadingSupported = () => true;
|
||||
imageProvider.performance = {
|
||||
record: function () { return $.Deferred().resolve(); }
|
||||
record: function () {
|
||||
return $.Deferred().resolve();
|
||||
}
|
||||
};
|
||||
|
||||
return imageProvider.get( url ).then( function ( image ) {
|
||||
|
@ -115,7 +117,9 @@ const { ImageProvider } = require( 'mmv' );
|
|||
|
||||
imageProvider.imagePreloadingSupported = () => true;
|
||||
imageProvider.performance = {
|
||||
record: function () { return $.Deferred().resolve(); }
|
||||
record: function () {
|
||||
return $.Deferred().resolve();
|
||||
}
|
||||
};
|
||||
|
||||
imageProvider.get( url ).fail( function () {
|
||||
|
|
|
@ -101,7 +101,9 @@ const { Canvas, LightboxImage } = require( 'mmv' );
|
|||
const canvas = new Canvas( $qf );
|
||||
|
||||
imageRawMetadata.filePageTitle = {
|
||||
getExtension: function () { return 'svg'; }
|
||||
getExtension: function () {
|
||||
return 'svg';
|
||||
}
|
||||
};
|
||||
canvas.imageRawMetadata = imageRawMetadata;
|
||||
|
||||
|
@ -129,7 +131,9 @@ const { Canvas, LightboxImage } = require( 'mmv' );
|
|||
const canvas = new Canvas( $qf );
|
||||
|
||||
imageRawMetadata.filePageTitle = {
|
||||
getExtension: function () { return 'png'; }
|
||||
getExtension: function () {
|
||||
return 'png';
|
||||
}
|
||||
};
|
||||
canvas.imageRawMetadata = imageRawMetadata;
|
||||
|
||||
|
@ -157,7 +161,9 @@ const { Canvas, LightboxImage } = require( 'mmv' );
|
|||
const canvas = new Canvas( $qf );
|
||||
|
||||
imageRawMetadata.filePageTitle = {
|
||||
getExtension: function () { return 'png'; }
|
||||
getExtension: function () {
|
||||
return 'png';
|
||||
}
|
||||
};
|
||||
canvas.imageRawMetadata = imageRawMetadata;
|
||||
|
||||
|
@ -185,7 +191,9 @@ const { Canvas, LightboxImage } = require( 'mmv' );
|
|||
const canvas = new Canvas( $qf );
|
||||
|
||||
imageRawMetadata.filePageTitle = {
|
||||
getExtension: function () { return 'png'; }
|
||||
getExtension: function () {
|
||||
return 'png';
|
||||
}
|
||||
};
|
||||
canvas.imageRawMetadata = imageRawMetadata;
|
||||
|
||||
|
@ -213,7 +221,9 @@ const { Canvas, LightboxImage } = require( 'mmv' );
|
|||
const canvas = new Canvas( $qf );
|
||||
|
||||
imageRawMetadata.filePageTitle = {
|
||||
getExtension: function () { return 'png'; }
|
||||
getExtension: function () {
|
||||
return 'png';
|
||||
}
|
||||
};
|
||||
canvas.imageRawMetadata = imageRawMetadata;
|
||||
|
||||
|
|
|
@ -46,7 +46,9 @@ QUnit.test( '.setLocationData()', function ( assert ) {
|
|||
const imageData = {
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
hasCoords: function () { return true; },
|
||||
hasCoords: function () {
|
||||
return true;
|
||||
},
|
||||
title: mw.Title.newFromText( 'File:Foobar.jpg' )
|
||||
};
|
||||
|
||||
|
@ -114,11 +116,17 @@ QUnit.test( '.setImageInfo()', function ( assert ) {
|
|||
title: image.filePageTitle,
|
||||
url: 'https://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg',
|
||||
descriptionUrl: 'https://commons.wikimedia.org/wiki/File:Foobar.jpg',
|
||||
hasCoords: function () { return false; }
|
||||
hasCoords: function () {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const repoData = {
|
||||
getArticlePath: function () { return 'Foo'; },
|
||||
isCommons: function () { return false; }
|
||||
getArticlePath: function () {
|
||||
return 'Foo';
|
||||
},
|
||||
isCommons: function () {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const clock = this.sandbox.useFakeTimers();
|
||||
|
||||
|
|
|
@ -39,9 +39,15 @@ const { MetadataPanelScroller } = require( 'mmv' );
|
|||
let displayCount = null; // pretend it doesn't exist at first
|
||||
const localStorage = createLocalStorage( {
|
||||
// We simulate localStorage to avoid test side-effects
|
||||
getItem: function () { return displayCount; },
|
||||
setItem: function ( _, val ) { displayCount = val; },
|
||||
removeItem: function () { displayCount = null; }
|
||||
getItem: function () {
|
||||
return displayCount;
|
||||
},
|
||||
setItem: function ( _, val ) {
|
||||
displayCount = val;
|
||||
},
|
||||
removeItem: function () {
|
||||
displayCount = null;
|
||||
}
|
||||
} );
|
||||
const scroller = new MetadataPanelScroller( $qf, $( '<div>' ).appendTo( $qf ), localStorage );
|
||||
|
||||
|
|
|
@ -272,8 +272,12 @@ const { Embed } = require( 'mmv.ui.reuse.shareembed' );
|
|||
const height = 20;
|
||||
|
||||
embed.formatter = {
|
||||
getThumbnailWikitextFromEmbedFileInfo: function () { return 'wikitext'; },
|
||||
getThumbnailHtml: function () { return 'html'; }
|
||||
getThumbnailWikitextFromEmbedFileInfo: function () {
|
||||
return 'wikitext';
|
||||
},
|
||||
getThumbnailHtml: function () {
|
||||
return 'html';
|
||||
}
|
||||
};
|
||||
|
||||
embed.set( {}, {} );
|
||||
|
|
|
@ -49,7 +49,9 @@ const { StripeButtons } = require( 'mmv' );
|
|||
const fakeImageInfo = { descriptionUrl: '//commons.wikimedia.org/wiki/File:Foo.jpg' };
|
||||
const fakeRepoInfo = {
|
||||
displayName: 'Wikimedia Commons',
|
||||
isCommons: function () { return true; }
|
||||
isCommons: function () {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
buttons.set( fakeImageInfo, fakeRepoInfo );
|
||||
|
@ -66,7 +68,9 @@ const { StripeButtons } = require( 'mmv' );
|
|||
const descriptionUrl2 = 'http://example.com/different-desc';
|
||||
const imageInfo = { descriptionUrl: descriptionUrl };
|
||||
const repoInfo = {
|
||||
isCommons: function () { return false; }
|
||||
isCommons: function () {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
buttons.setDescriptionPageButton( imageInfo, repoInfo );
|
||||
|
|
Loading…
Reference in a new issue