mirror of
https://github.com/mue/mue.git
synced 2026-07-18 14:34:12 +02:00
fix: improve welcome modal text, cleanup settings helpers slightly
This commit is contained in:
@@ -121,7 +121,7 @@ export default class WelcomeSections extends PureComponent {
|
||||
const chooseLanguage = (
|
||||
<>
|
||||
<h1>{language.sections.language.title}</h1>
|
||||
<p>{language.sections.language.description}</p>
|
||||
<p>{language.sections.language.description} <a href='https://docs.muetab.com/translations/' className='resetLink' target='_blank' rel='noopener noreferrer'>GitHub</a>!</p>
|
||||
<Radio name='language' options={languages} category='welcomeLanguage'/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -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]);
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user