refactor: cleanup and remove unused stuff

This commit is contained in:
David Ralph
2022-04-16 19:25:42 +01:00
parent 987a7eda6e
commit 4691ccf166
60 changed files with 414 additions and 491 deletions

View File

@@ -11,7 +11,7 @@ export const OPENSTREETMAP_URL = 'https://www.openstreetmap.org';
// Mue URLs
export const WEBSITE_URL = 'https://muetab.com';
export const PRIVACY_URL = 'https://muetab.com/privacy';
export const BLOG_POST = 'https://blog.muetab.com/posts/version-6-0';
export const BLOG_POST = 'https://blog.muetab.com/posts/version-7-0';
export const TRANSLATIONS_URL = 'https://docs.muetab.com/translations/';
export const REPORT_ITEM =
'https://github.com/mue/marketplace/issues/new?assignees=&labels=item+report&template=item-report.md&title=%5BItem+Report%5D+';
@@ -28,8 +28,8 @@ export const DISCORD_SERVER = 'zv8C9F8';
export const COPYRIGHT_NAME = 'The Mue Authors';
export const COPYRIGHT_YEAR = '2018';
export const COPYRIGHT_LICENSE = 'BSD-3-Clause License';
export const SPONSORS_USERNAME = 'davidcralph';
export const LIBERAPAY_USERNAME = 'mue';
export const SPONSORS_USERNAME = 'davidcralph';
export const KOFI_USERNAME = 'davidcralph';
export const PATREON_USERNAME = 'davidcralph';

View File

@@ -1,3 +1,5 @@
// one day it might be a good idea to replace all this with redux, but it'd take
// a lot of rewriting
export default class EventBus {
static on(event, callback) {
document.addEventListener(event, (e) => {

View File

@@ -1,4 +1,4 @@
// todo: add more
// mainly this is just to make life easier when debugging stuff like hover
export default function ExperimentalInit() {
if (localStorage.getItem('debug') === 'true') {
document.onkeydown = (e) => {

View File

@@ -1,4 +1,8 @@
// based on https://stackoverflow.com/a/47009962
// it has been brought to my attention (many) times that this is horribly broken if the time
// on the "Change every" setting is longer than 1 minute. I wasn't going to wait days to see
// if the function worked, so i just assumed it did. i apologise. this function will be
// replaced entirely in the future probably
export default function interval(callback, interval, name) {
const key = name + 'interval';
const ms = localStorage.getItem(key);

View File

@@ -29,7 +29,7 @@ export function setDefaultSettings(reset) {
localStorage.setItem('showWelcome', false);
}
// Finally we set this to true so it doesn't run the function on every load
// finally we set this to true so it doesn't run the function on every load
localStorage.setItem('firstRun', true);
}

View File

@@ -17,6 +17,7 @@ export function saveFile(data, filename = 'file', type = 'text/json') {
a.download = filename;
a.dataset.downloadurl = [type, a.download, a.href].join(':');
// i need to see what all this actually does, i think wessel wrote this function
event.initMouseEvent(
'click',
true,
@@ -39,9 +40,13 @@ export function saveFile(data, filename = 'file', type = 'text/json') {
export function exportSettings() {
const settings = {};
Object.keys(localStorage).forEach((key) => {
settings[key] = localStorage.getItem(key);
});
// i think a good improvement would be to make the file names more descriptive, or allow for saving as custom
// otherwise you'll end up with mue-settings (6000).json and have absolutely no idea what any of them are for
saveFile(settings, 'mue-settings.json');
variables.stats.postEvent('tab', 'Settings exported');
}

View File

@@ -1,4 +1,4 @@
import * as Constants from 'modules/constants';
import * as constants from 'modules/constants';
const variables = {
language: {},
@@ -8,7 +8,7 @@ const variables = {
postEvent: () => '',
},
//keybinds: {},
constants: Constants,
constants,
};
export default variables;