mirror of
https://github.com/mue/mue.git
synced 2026-07-28 03:01:10 +02:00
feature : Option to show / hide author details (#899)
* feature : option to show author details * added languages * feat: added dates proper format final
This commit is contained in:
@@ -82,6 +82,8 @@ class Quote extends PureComponent {
|
||||
this.quote = createRef();
|
||||
this.quotediv = createRef();
|
||||
this.quoteauthor = createRef();
|
||||
this.authorDetails = localStorage.getItem('authorDetails') === 'true' ? true : false;
|
||||
console.log("authorDetails", this.authorDetails);
|
||||
}
|
||||
|
||||
useFavourite() {
|
||||
@@ -355,8 +357,12 @@ class Quote extends PureComponent {
|
||||
|
||||
setZoom() {
|
||||
const zoomQuote = Number((localStorage.getItem('zoomQuote') || 100) / 100);
|
||||
this.quote.current.style.fontSize = `${0.8 * zoomQuote}em`;
|
||||
this.quoteauthor.current.style.fontSize = `${0.9 * zoomQuote}em`;
|
||||
if (this.quote.current) {
|
||||
this.quote.current.style.fontSize = `${0.8 * zoomQuote}em`;
|
||||
}
|
||||
if (this.quoteauthor.current) {
|
||||
this.quoteauthor.current.style.fontSize = `${0.9 * zoomQuote}em`;
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -429,6 +435,8 @@ class Quote extends PureComponent {
|
||||
|
||||
{localStorage.getItem('widgetStyle') === 'legacy' ? (
|
||||
<>
|
||||
{ this.authorDetails && (
|
||||
<>
|
||||
<div>
|
||||
<h1 className="quoteauthor" ref={this.quoteauthor}>
|
||||
<a
|
||||
@@ -445,8 +453,13 @@ class Quote extends PureComponent {
|
||||
<div style={{ display: 'flex', justifyContent: 'center', gap: '20px' }}>
|
||||
{this.state.copy} {this.state.share} {this.state.favourited}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{ this.authorDetails && (
|
||||
<>
|
||||
<div className="author-holder">
|
||||
<div className="author">
|
||||
{localStorage.getItem('authorImg') !== 'false' ? (
|
||||
@@ -499,6 +512,9 @@ class Quote extends PureComponent {
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -144,15 +144,22 @@ class QuoteOptions extends PureComponent {
|
||||
subtitle={variables.getMessage(`${QUOTE_SECTION}.additional`)}
|
||||
/>
|
||||
<Action>
|
||||
<Checkbox
|
||||
name="authorDetails"
|
||||
text = {variables.getMessage(`${QUOTE_SECTION}.author_details`)}
|
||||
element=".other"
|
||||
/>
|
||||
<Checkbox
|
||||
name="authorLink"
|
||||
text={variables.getMessage(`${QUOTE_SECTION}.author_link`)}
|
||||
element=".other"
|
||||
disabled={localStorage.getItem('authorDetails')==='false'}
|
||||
/>
|
||||
<Checkbox
|
||||
name="authorImg"
|
||||
text={variables.getMessage(`${QUOTE_SECTION}.author_img`)}
|
||||
element=".other"
|
||||
disabled={localStorage.getItem('authorDetails')==='false'}
|
||||
/>
|
||||
</Action>
|
||||
</Row>
|
||||
|
||||
@@ -45,7 +45,7 @@ export default class DateWidget extends PureComponent {
|
||||
if (timezone && timezone !== 'auto') {
|
||||
date = convertTimezone(date, timezone);
|
||||
}
|
||||
|
||||
|
||||
if (localStorage.getItem('weeknumber') === 'true') {
|
||||
this.getWeekNumber(date);
|
||||
} else if (this.state.weekNumber !== null) {
|
||||
@@ -53,18 +53,18 @@ export default class DateWidget extends PureComponent {
|
||||
weekNumber: null,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (localStorage.getItem('dateType') === 'short') {
|
||||
const dateDay = date.getDate();
|
||||
const dateMonth = date.getMonth() + 1;
|
||||
const dateYear = date.getFullYear();
|
||||
|
||||
|
||||
const zero = localStorage.getItem('datezero') === 'true';
|
||||
|
||||
|
||||
let day = zero ? ('00' + dateDay).slice(-2) : dateDay;
|
||||
let month = zero ? ('00' + dateMonth).slice(-2) : dateMonth;
|
||||
let year = dateYear;
|
||||
|
||||
|
||||
switch (localStorage.getItem('dateFormat')) {
|
||||
case 'MDY':
|
||||
day = dateMonth;
|
||||
@@ -78,7 +78,7 @@ export default class DateWidget extends PureComponent {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
let format;
|
||||
switch (localStorage.getItem('shortFormat')) {
|
||||
case 'dots':
|
||||
@@ -96,47 +96,41 @@ export default class DateWidget extends PureComponent {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
this.setState({
|
||||
date: format,
|
||||
});
|
||||
} else {
|
||||
// Long date
|
||||
const lang = variables.languagecode.split('_')[0];
|
||||
|
||||
const datenth =
|
||||
localStorage.getItem('datenth') === 'true' ? nth(date.getDate()) : date.getDate();
|
||||
|
||||
const dateDay =
|
||||
localStorage.getItem('dayofweek') === 'true'
|
||||
? date.toLocaleDateString(lang, { weekday: 'long' })
|
||||
: '';
|
||||
const datenth = localStorage.getItem('datenth') === 'true' ? nth(date.getDate()) : date.getDate();
|
||||
const dateDay = localStorage.getItem('dayofweek') === 'true'
|
||||
? date.toLocaleDateString(lang, { weekday: 'long' })
|
||||
: '';
|
||||
const dateMonth = date.toLocaleDateString(lang, { month: 'long' });
|
||||
const dateYear = date.getFullYear();
|
||||
|
||||
let day = dateDay + ' ' + datenth;
|
||||
let month = dateMonth;
|
||||
let year = dateYear;
|
||||
|
||||
let formattedDate;
|
||||
|
||||
switch (localStorage.getItem('longFormat')) {
|
||||
case 'MDY':
|
||||
day = dateMonth;
|
||||
month = dateDay + ' ' + datenth;
|
||||
formattedDate = `${dateMonth} ${datenth}, ${dateYear}${dateDay ? `, ${dateDay}` : ''}`;
|
||||
break;
|
||||
case 'YMD':
|
||||
day = dateYear;
|
||||
year = dateDay + ' ' + datenth;
|
||||
formattedDate = `${dateYear} ${dateMonth} ${datenth}${dateDay ? `, ${dateDay}` : ''}`;
|
||||
break;
|
||||
// DMY
|
||||
default:
|
||||
formattedDate = `${datenth} ${dateMonth} ${dateYear}${dateDay ? `, ${dateDay}` : ''}`;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
this.setState({
|
||||
date: `${day} ${month} ${year}`,
|
||||
date: formattedDate,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
EventBus.on('refresh', (data) => {
|
||||
if (data === 'date' || data === 'timezone') {
|
||||
|
||||
@@ -413,6 +413,7 @@
|
||||
"author": "Müəllif",
|
||||
"author_img": "Müəllif şəkli göstər",
|
||||
"author_link": "Müəllif linki",
|
||||
"author_details": "Müəllif məlumatlarını",
|
||||
"buttons": {
|
||||
"copy": "Kopyala",
|
||||
"favourite": "Sevimli",
|
||||
|
||||
@@ -413,6 +413,7 @@
|
||||
"author": "Müəllif",
|
||||
"author_img": "Müəllif şəklini göstər",
|
||||
"author_link": "Müəllif linki",
|
||||
"author_details": "Müəllif məlumatlarını",
|
||||
"buttons": {
|
||||
"copy": "Kopyala",
|
||||
"favourite": "Sevimli",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Quote",
|
||||
"additional": "উদ্ধৃতি উইজেটের শৈলী কাস্টমাইজ করার জন্য অন্যান্য সেটিংস",
|
||||
"author_link": "লেখকের লিঙ্ক",
|
||||
"author_details": "লেখকের বিস্তারিত তথ্য",
|
||||
"custom": "Custom quote",
|
||||
"custom_subtitle": "Set your own custom quotes",
|
||||
"no_quotes": "No quotes",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Zitat",
|
||||
"additional": "Zusätzliche Einstellungen zum Anpassen des Zitate-Widgets",
|
||||
"author_link": "Autor Link",
|
||||
"author_details": "Autor Details",
|
||||
"custom": "Benutzerdefiniertes Zitat",
|
||||
"custom_subtitle": "Legen Sie Ihre eigenen Zitate fest",
|
||||
"no_quotes": "Keine Zitate",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Quote",
|
||||
"additional": "Other settings to customise the style of the quote widget",
|
||||
"author_link": "Author link",
|
||||
"author_details": "Author details",
|
||||
"custom": "Custom quote",
|
||||
"custom_subtitle": "Set your own custom quotes",
|
||||
"no_quotes": "No quotes",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Quote",
|
||||
"additional": "Other settings to customise the style of the quote widget",
|
||||
"author_link": "Author link",
|
||||
"author_details": "Author details",
|
||||
"custom": "Custom quote",
|
||||
"custom_subtitle": "Set your own custom quotes",
|
||||
"no_quotes": "No quotes",
|
||||
|
||||
@@ -413,6 +413,7 @@
|
||||
"author": "Autor",
|
||||
"author_img": "Mostrar la imagen del autor",
|
||||
"author_link": "Enlace del autor",
|
||||
"author_details": "Detalles del autor",
|
||||
"buttons": {
|
||||
"copy": "Botón de copiar",
|
||||
"favourite": "Botón de favoritos",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Citación",
|
||||
"additional": "Other settings to customise the style of the quote widget",
|
||||
"author_link": "Enlace del autor",
|
||||
"author_details": "Detalles del autor",
|
||||
"custom": "Citación personalizada",
|
||||
"custom_subtitle": "Set your own custom quotes",
|
||||
"no_quotes": "No quotes",
|
||||
|
||||
@@ -413,6 +413,7 @@
|
||||
"author": "Autor",
|
||||
"author_img": "Näita autori pilti",
|
||||
"author_link": "Autori link",
|
||||
"author_details": "Näita autori üksikasju",
|
||||
"buttons": {
|
||||
"copy": "Kopeeri",
|
||||
"favourite": "Lisa lemmikuks",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Quote",
|
||||
"additional": "Other settings to customise the style of the quote widget",
|
||||
"author_link": "Author link",
|
||||
"author_details": "Author details",
|
||||
"custom": "Custom quote",
|
||||
"custom_subtitle": "Set your own custom quotes",
|
||||
"no_quotes": "No quotes",
|
||||
|
||||
@@ -413,6 +413,7 @@
|
||||
"author": "Auteur",
|
||||
"author_img": "Afficher l'image de l'auteur",
|
||||
"author_link": "Lien de l'auteur",
|
||||
"author_details": "Détails de l'auteur",
|
||||
"buttons": {
|
||||
"copy": "Copier",
|
||||
"favourite": "Favori",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Kutipan",
|
||||
"additional": "Pengaturan lain untuk menyesuaikan gaya widget kutipan",
|
||||
"author_link": "Pranala penulis",
|
||||
"author_details": "Tampilkan detail penulis",
|
||||
"custom": "Kutipan kustom",
|
||||
"custom_subtitle": "Tetapkan kutipan khusus Anda sendiri",
|
||||
"no_quotes": "Tidak ada kutipan",
|
||||
|
||||
@@ -413,6 +413,7 @@
|
||||
"author": "Autorius",
|
||||
"author_img": "Rodyti autoriaus nuotrauką",
|
||||
"author_link": "Autoriaus nuoroda",
|
||||
"author_details": "Rodyti autoriaus informaciją",
|
||||
"buttons": {
|
||||
"copy": "Kopijuoti",
|
||||
"favourite": "Mėgstama",
|
||||
|
||||
@@ -413,6 +413,7 @@
|
||||
"author": "Autors",
|
||||
"author_img": "Rādīt autora attēlu",
|
||||
"author_link": "Autora saite",
|
||||
"author_details": "Rādīt autora detaļas",
|
||||
"buttons": {
|
||||
"copy": "Kopēt",
|
||||
"favourite": "Pievienot izlasei",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Citaat",
|
||||
"additional": "Andere instellingen om de stijl van het citaten widget te veranderen",
|
||||
"author_link": "Author link",
|
||||
"author_details": "Author details",
|
||||
"custom": "Custom quote",
|
||||
"custom_subtitle": "Schrijf je eigen citaten",
|
||||
"no_quotes": "Geen citaten",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Sitat",
|
||||
"additional": "Other settings to customise the style of the quote widget",
|
||||
"author_link": "Author link",
|
||||
"author_details": "Author details",
|
||||
"custom": "Custom quote",
|
||||
"custom_subtitle": "Set your own custom quotes",
|
||||
"no_quotes": "No quotes",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Citações",
|
||||
"additional": "Outras configurações para personalizar o estilo do widget de citações",
|
||||
"author_link": "Ligação do autor",
|
||||
"author_details": "Detalhes do autor",
|
||||
"custom": "Citação personalizada",
|
||||
"custom_subtitle": "Define as suas próprias citações personalizadas",
|
||||
"no_quotes": "sem aspas",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Citações",
|
||||
"additional": "Outras configurações para personalizar o estilo do widget de citações",
|
||||
"author_link": "link do autor",
|
||||
"author_details": "Detalhes do autor",
|
||||
"custom": "Citação personalizada",
|
||||
"custom_subtitle": "Defina suas próprias citações personalizadas",
|
||||
"no_quotes": "sem aspas",
|
||||
|
||||
@@ -162,7 +162,8 @@
|
||||
"quote": {
|
||||
"title": "Цитата",
|
||||
"additional": "Другие настройки для настройки стиля виджета котировок",
|
||||
"author_link": "Author link",
|
||||
"author_link": "Ссылка на автора",
|
||||
"author_details:": "Сведения об авторе",
|
||||
"custom": "Пользовательская цитата",
|
||||
"custom_subtitle": "Установите свои собственные пользовательские цитаты",
|
||||
"no_quotes": "Без кавычек",
|
||||
|
||||
@@ -413,6 +413,7 @@
|
||||
"author": "Avtor",
|
||||
"author_img": "Prikaži sliko avtorja",
|
||||
"author_link": "Povezava avtorja",
|
||||
"author_details": "Podrobnosti avtorja",
|
||||
"buttons": {
|
||||
"copy": "Kopiraj",
|
||||
"favourite": "Priljubljeno",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Alıntı",
|
||||
"additional": "Alıntı aracının stilini özelleştirmek için diğer ayarlar",
|
||||
"author_link": "Yazara dair bilgilendirme bağlantısı göster.",
|
||||
"author_details": "Yazar hakkında daha fazla bilgi göster.",
|
||||
"custom": "Özel Alıntı",
|
||||
"custom_subtitle": "Kendi özel alıntınızı belirleyin, ekleyin.",
|
||||
"no_quotes": "Alıntı yok",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "名言警句",
|
||||
"additional": "Other settings to customise the style of the quote widget",
|
||||
"author_link": "出处链接",
|
||||
"author_details": "作者详情",
|
||||
"custom": "自定义名言",
|
||||
"custom_subtitle": "Set your own custom quotes",
|
||||
"no_quotes": "No quotes",
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
"title": "Quote",
|
||||
"additional": "Other settings to customise the style of the quote widget",
|
||||
"author_link": "Author link",
|
||||
"author_details": "Author details",
|
||||
"custom": "Custom quote",
|
||||
"custom_subtitle": "Set your own custom quotes",
|
||||
"no_quotes": "No quotes",
|
||||
|
||||
Reference in New Issue
Block a user