Deep-link to the license section of a file page

The necessary anchor link depends on the language used on Wikimedia Commons:

* https://commons.wikimedia.org/wiki/File:GATEWAY_(Moon_Space_Station).png?uselang=en#Licensing
* https://commons.wikimedia.org/wiki/File:GATEWAY_(Moon_Space_Station).png?uselang=de#Lizenz
* Ref: https://commons.wikimedia.org/wiki/Template:License-header

Remove jsduck due to lacking support for ES6 string templates.

Bug: T336708
Change-Id: Ib71e647682835baa71bd375ae3098966ae01f26c
This commit is contained in:
Simon Legner 2023-05-19 16:06:18 +03:00 committed by Jdlrobson
parent e91cddba2b
commit d0066039ac
5 changed files with 6 additions and 14 deletions

View file

@ -107,6 +107,7 @@
"mmv.head"
],
"messages": [
"license-header",
"multimediaviewer-file-page",
"multimediaviewer-options-learn-more",
"multimediaviewer-options-dialog-header",

View file

@ -1,12 +0,0 @@
{
"--title": "MultimediaViewer - Documentation",
"--categories": "jsduck.categories.json",
"--builtin-classes": true,
"--processes": "0",
"--warnings-exit-nonzero": true,
"--output": "docs",
"--": [
"jsduck.external.js",
"resources/"
]
}

View file

@ -5,7 +5,7 @@
"build": "npm -s run minify-svg",
"test": "grunt test",
"minify-svg": "svgo --config=.svgo.config.js --quiet --recursive --folder resources/",
"doc": "jsduck"
"doc": ""
},
"devDependencies": {
"eslint-config-wikimedia": "0.25.0",

View file

@ -540,6 +540,8 @@
MPP.setLicense = function ( license, filePageUrl ) {
var shortName, url, isCc, isPd;
filePageUrl += `?uselang=${mw.config.get( 'wgUserLanguage' )}#${mw.message( 'license-header' ).text()}`;
if ( license ) {
shortName = license.getShortName();
url = license.deedUrl || filePageUrl;

View file

@ -123,7 +123,8 @@ QUnit.test( '.setImageInfo()', function ( assert ) {
assert.strictEqual( panel.$title.text(), title, 'Title is correctly set' );
assert.notStrictEqual( panel.$credit.text(), '', 'Default credit is shown' );
assert.strictEqual( panel.$license.prop( 'href' ), imageData.descriptionUrl,
assert.strictEqual( panel.$license.prop( 'href' ),
imageData.descriptionUrl + '?uselang=qqx#(license-header)',
'User is directed to file page for license information' );
assert.strictEqual( panel.$license.prop( 'target' ), '', 'License information opens in same window' );
assert.true( panel.$datetimeLi.hasClass( 'empty' ), 'Date/Time is empty' );