mirror of
https://github.com/mue/mue.git
synced 2026-07-16 05:23:49 +02:00
@@ -145,16 +145,20 @@ class Quote extends PureComponent {
|
||||
`https://${
|
||||
variables.languagecode.split('_')[0]
|
||||
}.wikipedia.org/w/api.php?action=query&prop=imageinfo&iiprop=extmetadata&titles=File:${
|
||||
authorPage.pageimage
|
||||
authorPage.pageimage
|
||||
}&origin=*&format=json`,
|
||||
)
|
||||
).json();
|
||||
|
||||
const authorImagePage = authorimglicensedata.query.pages[Object.keys(authorimglicensedata.query.pages)[0]];
|
||||
const authorImagePage =
|
||||
authorimglicensedata.query.pages[Object.keys(authorimglicensedata.query.pages)[0]];
|
||||
const metadata = authorImagePage?.imageinfo?.[0]?.extmetadata;
|
||||
const license = metadata?.LicenseShortName;
|
||||
const photographer =
|
||||
this.stripHTML(metadata?.Attribution?.value || metadata?.Artist?.value || '').replace(/ \(talk\)/, '') || // talk page link (if applicable) is only removed for English
|
||||
this.stripHTML(metadata?.Attribution?.value || metadata?.Artist?.value || '').replace(
|
||||
/ \(talk\)/,
|
||||
'',
|
||||
) || // talk page link (if applicable) is only removed for English
|
||||
'Unknown';
|
||||
authorimglicense = `© ${photographer}. ${license.value}`;
|
||||
authorimglicense = authorimglicense.replace(/copyright\s/i, '').replace(/©\s©\s/, '© ');
|
||||
@@ -281,7 +285,9 @@ class Quote extends PureComponent {
|
||||
author: data.author,
|
||||
authorlink: this.getAuthorLink(data.author),
|
||||
authorimg: authorimgdata.authorimg,
|
||||
authorimglicense: authorimgdata.authorimglicense && authorimgdata.authorimglicense.replace(' undefined. ', ' '),
|
||||
authorimglicense:
|
||||
authorimgdata.authorimglicense &&
|
||||
authorimgdata.authorimglicense.replace(' undefined. ', ' '),
|
||||
quoteLanguage: quoteLanguage,
|
||||
authorOccupation: data.author_occupation,
|
||||
};
|
||||
@@ -455,8 +461,10 @@ class Quote extends PureComponent {
|
||||
{this.state.authorOccupation !== 'Unknown' && (
|
||||
<span className="subtitle">{this.state.authorOccupation}</span>
|
||||
)}
|
||||
<span className="author-license" title={this.state.authorimglicense}>
|
||||
{this.state.authorimglicense && (this.state.authorimglicense.substring(0, 40) + (this.state.authorimglicense.length > 40 ? '…' : ''))}
|
||||
<span className="author-license" title={this.state.authorimglicense}>
|
||||
{this.state.authorimglicense &&
|
||||
this.state.authorimglicense.substring(0, 40) +
|
||||
(this.state.authorimglicense.length > 40 ? '…' : '')}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@@ -102,7 +102,8 @@ h1.quoteauthor {
|
||||
padding: 20px;
|
||||
text-align: left;
|
||||
|
||||
.title, .subtitle {
|
||||
.title,
|
||||
.subtitle {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user