Shorten clickable link text in HTML credit lines

Previously, the clickable text in the generated HTML credit lines
was the entire link to the article. This is shortened to a localized
version of "Link".

Bug: T119686
Change-Id: I708f65a85bfa26c264cdd06a265096027266240c
This commit is contained in:
Andrew H 2016-09-04 04:49:58 +00:00 committed by jdlrobson
parent 4372c5380b
commit 0c3b0a5056
5 changed files with 9 additions and 6 deletions

View file

@ -232,7 +232,8 @@
"multimediaviewer-text-embed-credit-text-l",
"multimediaviewer-html-embed-credit-text-bl",
"multimediaviewer-html-embed-credit-text-b",
"multimediaviewer-html-embed-credit-text-l"
"multimediaviewer-html-embed-credit-text-l",
"multimediaviewer-html-embed-credit-link-text"
]
},
"mmv.ui.download.pane": {

View file

@ -96,6 +96,7 @@
"multimediaviewer-html-embed-credit-text-bl": "By $1, $2, $3",
"multimediaviewer-html-embed-credit-text-b": "By $1, $2",
"multimediaviewer-html-embed-credit-text-l": "$1, $2",
"multimediaviewer-html-embed-credit-link-text": "Link",
"multimediaviewer-embed-byline": "By $1",
"multimediaviewer-embed-license": "Licensed under $1.",
"multimediaviewer-embed-license-nonfree": "$1.",

View file

@ -105,6 +105,7 @@
"multimediaviewer-html-embed-credit-text-bl": "Credit text, used when generating HTML to reuse an image - used as a caption, not in the middle of a sentence.\n\nWhich one of the multimediaviewer-html-embed-credit-text-* messages is used will depend on what information about the image is available.\n\nParameters:\n* $1 - name of the author\n* $2 - copyright tag (usually a license)\n* $3 - URL to the image source\nEach of the parameters could be either plain text or a link.\n{{Related|Multimediaviewer-embed-credit-text}}",
"multimediaviewer-html-embed-credit-text-b": "Credit text, used when generating HTML to reuse an image - used as a caption, not in the middle of a sentence.\n\nWhich one of the multimediaviewer-html-embed-credit-text-* messages is used will depend on what information about the image is available.\n\nParameters:\n* $1 - name of the author\n* $2 - URL to the image source\nEach of the parameters could be either plain text or a link.\n{{Related|Multimediaviewer-embed-credit-text}}",
"multimediaviewer-html-embed-credit-text-l": "{{optional}}\nCredit text, used when generating HTML to reuse an image - used as a caption, not in the middle of a sentence.\n\nWhich one of the multimediaviewer-html-embed-credit-text-* messages is used will depend on what information about the image is available.\n\nParameters:\n* $1 - copyright tag (usually a license)\n* $2 - URL to the image source\nEach of the parameters could be either plain text or a link.\n{{Related|Multimediaviewer-embed-credit-text}}",
"multimediaviewer-html-embed-credit-link-text": "The clickable text of a link in a credit line, used when generating HTML to reuse an image.\n{{Related|Multimediaviewer-embed-credit-text}}",
"multimediaviewer-embed-byline": "Byline (author credit) text, used when generating wikitext/HTML to reuse the image. $1 is author name.\n{{Identical|By}}",
"multimediaviewer-embed-license": "License information, used when generating wikitext/HTML to reuse the image. $1 is the license name.",
"multimediaviewer-embed-license-nonfree": "Like {{msg-mw|multimediaviewer-embed-license}}, but for non-free images (where $1 is typically not a license name but something like \"Fair use\").",

View file

@ -163,7 +163,7 @@
EFFP.getCreditHtml = function ( info ) {
var creditText, creditParams,
shortURL = info.imageInfo.descriptionShortUrl,
shortLink = this.htmlUtils.makeLinkText( shortURL, { href: shortURL } ),
shortLink = this.htmlUtils.makeLinkText( mw.message( 'multimediaviewer-html-embed-credit-link-text' ), { href: shortURL } ),
license = info.imageInfo.license,
byline = this.getByline( info.imageInfo.author, info.imageInfo.source, info.imageInfo.attribution );

View file

@ -258,14 +258,14 @@
imageInfo: {
author: 'Author',
source: 'Source',
descriptionShortUrl: 'link',
descriptionShortUrl: 'some link',
title: {
getNameText: function () { return 'Image Title'; }
}
}
} );
assert.strictEqual( html, 'By Author - Source, <a href="link">link</a>', 'Sanity check' );
assert.strictEqual( html, 'By Author - Source, <a href="some link">Link</a>', 'Sanity check' );
html = formatter.getCreditHtml( {
repoInfo: {
@ -276,7 +276,7 @@
imageInfo: {
author: 'Author',
source: 'Source',
descriptionShortUrl: 'link',
descriptionShortUrl: 'some link',
title: {
getNameText: function () { return 'Image Title'; }
},
@ -288,6 +288,6 @@
}
} );
assert.strictEqual( html, 'By Author - Source, <a href="http://www.wtfpl.net/">WTFPL v2</a>, <a href="link">link</a>', 'Sanity check' );
assert.strictEqual( html, 'By Author - Source, <a href="http://www.wtfpl.net/">WTFPL v2</a>, <a href="some link">Link</a>', 'Sanity check' );
} );
}( mediaWiki ) );