diff --git a/src/components/modals/welcome/WelcomeSections.jsx b/src/components/modals/welcome/WelcomeSections.jsx index df4efab3..91e98717 100644 --- a/src/components/modals/welcome/WelcomeSections.jsx +++ b/src/components/modals/welcome/WelcomeSections.jsx @@ -121,7 +121,7 @@ export default class WelcomeSections extends PureComponent { const chooseLanguage = ( <>

{language.sections.language.title}

-

{language.sections.language.description}

+

{language.sections.language.description} GitHub!

); diff --git a/src/modules/helpers/settings/index.js b/src/modules/helpers/settings/index.js index b1b866f6..dceb649d 100644 --- a/src/modules/helpers/settings/index.js +++ b/src/modules/helpers/settings/index.js @@ -30,8 +30,7 @@ export function setDefaultSettings(reset) { export function loadSettings(hotreload) { document.getElementById('widgets').style.zoom = localStorage.getItem('widgetzoom') + '%'; - const theme = localStorage.getItem('theme'); - switch (theme) { + switch (localStorage.getItem('theme')) { case 'dark': document.body.classList.add('dark'); break; @@ -46,16 +45,16 @@ export function loadSettings(hotreload) { document.body.classList.remove('dark'); } - const tabName = localStorage.getItem('tabName') || window.language.tabname; - document.title = tabName; + document.title = localStorage.getItem('tabName') || window.language.tabname; if (hotreload === true) { - const custom = ['customcss', 'customjs', 'customfont']; + // remove old custom stuff and add new + const custom = ['customcss', 'customfont']; custom.forEach((element) => { try { document.head.removeChild(document.getElementById(element)); } catch (e) { - // Disregard exception + // Disregard exception if custom stuff doesn't exist } }); } @@ -92,8 +91,8 @@ export function loadSettings(hotreload) { const js = localStorage.getItem('customjs'); if (js) { try { - // eslint-disable-next-line no-eval - eval(js); + // eslint-disable-next-line no-new-func + Function(`'use strict'; return (${js})`)(); } catch (e) { console.error('Failed to run custom JS: ', e); } @@ -126,18 +125,19 @@ export function loadSettings(hotreload) { // in a nutshell, this function saves all of the current settings, resets them, sets the defaults and then overrides // the new settings with the old saved messages where they exist export function moveSettings() { - if (Object.keys(localStorage).length === 0) { + const currentSettings = Object.keys(localStorage); + if (currentSettings.length === 0) { return this.setDefaultSettings(); } - let settings = {}; - Object.keys(localStorage).forEach((key) => { + const settings = {}; + currentSettings.forEach((key) => { settings[key] = localStorage.getItem(key); }); localStorage.clear(); - setDefaultSettings(); + Object.keys(settings).forEach((key) => { localStorage.setItem(key, settings[key]); }); diff --git a/src/modules/helpers/settings/modals.js b/src/modules/helpers/settings/modals.js index 66e9725f..d4afb4a3 100644 --- a/src/modules/helpers/settings/modals.js +++ b/src/modules/helpers/settings/modals.js @@ -6,21 +6,22 @@ export function saveFile(data, filename = 'file') { } const blob = new Blob([data], { type: 'text/json' }); - let e = document.createEvent('MouseEvents'); - let a = document.createElement('a'); + + const event = document.createEvent('MouseEvents'); + const a = document.createElement('a'); a.href = window.URL.createObjectURL(blob); a.download = filename; a.dataset.downloadurl = ['text/json', a.download, a.href].join(':'); - e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); - a.dispatchEvent(e); + event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); + a.dispatchEvent(event); } export function exportSettings() { - let settings = {}; + const settings = {}; Object.keys(localStorage).forEach((key) => { - settings[key] = localStorage.getItem(key); + settings[key] = localStorage.getItem(key); }); saveFile(settings, 'mue-settings.json'); window.stats.postEvent('tab', 'Settings exported'); diff --git a/src/translations/de_DE.json b/src/translations/de_DE.json index 39806fc7..db1e757d 100644 --- a/src/translations/de_DE.json +++ b/src/translations/de_DE.json @@ -435,7 +435,7 @@ }, "language": { "title": "Choose your language", - "description": "Mue can be displayed the languages listed below. You can also add new translations on our GitHub!" + "description": "Mue can be displayed the languages listed below. You can also add new translations on our" }, "theme": { "title": "Select a theme", diff --git a/src/translations/en_GB.json b/src/translations/en_GB.json index ed3d4027..f9d3209e 100644 --- a/src/translations/en_GB.json +++ b/src/translations/en_GB.json @@ -431,11 +431,11 @@ "sections": { "intro": { "title": "Welcome to Mue Tab", - "description": "Thank you for installing, we hope you enjoy your time with our extension." + "description": "Thank you for installing Mue, we hope you enjoy your time with our extension." }, "language": { "title": "Choose your language", - "description": "Mue can be displayed the languages listed below. You can also add new translations on our GitHub!" + "description": "Mue can be displayed the languages listed below. You can also add new translations on our" }, "theme": { "title": "Select a theme", diff --git a/src/translations/en_US.json b/src/translations/en_US.json index 7b69c309..68cfeec9 100644 --- a/src/translations/en_US.json +++ b/src/translations/en_US.json @@ -431,11 +431,11 @@ "sections": { "intro": { "title": "Welcome to Mue Tab", - "description": "Thank you for installing, we hope you enjoy your time with our extension." + "description": "Thank you for installing Mue, we hope you enjoy your time with our extension." }, "language": { "title": "Choose your language", - "description": "Mue can be displayed the languages listed below. You can also add new translations on our GitHub!" + "description": "Mue can be displayed the languages listed below. You can also add new translations on our" }, "theme": { "title": "Select a theme", diff --git a/src/translations/es.json b/src/translations/es.json index b0add4d2..9c98d789 100644 --- a/src/translations/es.json +++ b/src/translations/es.json @@ -431,11 +431,11 @@ "sections": { "intro": { "title": "Bienvenido a Mue Tab", - "description": "Gracias por instalar, esperamos que disfrute de su tiempo con nuestra extensión." + "description": "Gracias por instalar Mue, esperamos que disfrute de su tiempo con nuestra extensión." }, "language": { "title": "Elige el idioma", - "description": "Mue puede mostrarse en los idiomas que se indican debajo. ¡También puedes contribuir con traducciones en nuestro GitHub!" + "description": "Mue puede mostrarse en los idiomas que se indican debajo. ¡También puedes contribuir con traducciones en nuestro" }, "theme": { "title": "Selecciona un tema", diff --git a/src/translations/fr.json b/src/translations/fr.json index 6723d8ec..f9b95f03 100644 --- a/src/translations/fr.json +++ b/src/translations/fr.json @@ -431,11 +431,11 @@ "sections": { "intro": { "title": "Bienvenue en Mue Tab", - "description": "Merci d'avoir installé, nous espérons que vous apprécierez votre temps avec notre extension." + "description": "Merci d'avoir installé Mue, nous espérons que vous apprécierez votre temps avec notre extension." }, "language": { "title": "Choose your language", - "description": "Mue can be displayed the languages listed below. You can also add new translations on our GitHub!" + "description": "Mue can be displayed the languages listed below. You can also add new translations on our" }, "theme": { "title": "Select a theme", diff --git a/src/translations/nl.json b/src/translations/nl.json index d8c20efb..d9817565 100644 --- a/src/translations/nl.json +++ b/src/translations/nl.json @@ -431,11 +431,11 @@ "sections": { "intro": { "title": "Welcome to Mue Tab", - "description": "Thank you for installing, we hope you enjoy your time with our extension." + "description": "Thank you for installing Mue, we hope you enjoy your time with our extension." }, "language": { "title": "Choose your language", - "description": "Mue can be displayed the languages listed below. You can also add new translations on our GitHub!" + "description": "Mue can be displayed the languages listed below. You can also add new translations on our" }, "theme": { "title": "Select a theme", diff --git a/src/translations/no.json b/src/translations/no.json index 32539a57..39d2bad2 100644 --- a/src/translations/no.json +++ b/src/translations/no.json @@ -431,11 +431,11 @@ "sections": { "intro": { "title": "Welcome to Mue Tab", - "description": "Thank you for installing, we hope you enjoy your time with our extension." + "description": "Thank you for installing Mue, we hope you enjoy your time with our extension." }, "language": { "title": "Choose your language", - "description": "Mue can be displayed the languages listed below. You can also add new translations on our GitHub!" + "description": "Mue can be displayed the languages listed below. You can also add new translations on our" }, "theme": { "title": "Select a theme", diff --git a/src/translations/ru.json b/src/translations/ru.json index d1f7b1aa..0f1fbcd8 100644 --- a/src/translations/ru.json +++ b/src/translations/ru.json @@ -432,11 +432,11 @@ "sections": { "intro": { "title": "Welcome to Mue Tab", - "description": "Thank you for installing, we hope you enjoy your time with our extension." + "description": "Thank you for installing Mue, we hope you enjoy your time with our extension." }, "language": { "title": "Choose your language", - "description": "Mue can be displayed the languages listed below. You can also add new translations on our GitHub!" + "description": "Mue can be displayed the languages listed below. You can also add new translations on our" }, "theme": { "title": "Select a theme", diff --git a/src/translations/zh_CN.json b/src/translations/zh_CN.json index 6b3979f9..af841189 100644 --- a/src/translations/zh_CN.json +++ b/src/translations/zh_CN.json @@ -435,7 +435,7 @@ }, "language": { "title": "Choose your language", - "description": "Mue can be displayed the languages listed below. You can also add new translations on our GitHub!" + "description": "Mue can be displayed the languages listed below. You can also add new translations on our" }, "theme": { "title": "Select a theme",