feat: add work in progress 7.0 code

Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
David Ralph
2022-04-08 14:48:36 +01:00
parent e0820c6b2a
commit 361fae7f25
136 changed files with 8631 additions and 3500 deletions

View File

@@ -13,21 +13,22 @@ 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 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+';
export const BUG_REPORT = 'https://github.com/mue/mue/issues/new?assignees=&labels=issue+report&template=bug-report.md&title=%5BBug%5D+';
export const DONATE_LINK = 'https://muetab.com/donate';
// Mue Info
export const ORG_NAME = 'mue';
export const REPO_NAME = 'mue';
export const EMAIL = 'hello@muetab.com';
export const TWITTER_HANDLE = 'getmue';
export const INSTAGRAM_HANDLE = 'mue.tab';
export const FACEBOOK_HANDLE = 'muetab';
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 KOFI_USERNAME = 'davidcralph';
export const PATREON_USERNAME = 'davidcralph';
export const OFFLINE_IMAGES = 20;
export const VERSION = '6.0.5';
export const VERSION = '7.0.0';

View File

@@ -80,7 +80,7 @@
"value": true
},
{
"name": "tweetButton",
"name": "quoteShareButton",
"value": false
},
{
@@ -125,7 +125,7 @@
},
{
"name": "order",
"value": "[\"greeting\", \"time\", \"quicklinks\", \"quote\", \"date\", \"message\"]"
"value": "[\"greeting\", \"time\", \"quicklinks\", \"quote\", \"date\", \"message\", \"reminder\"]"
},
{
"name": "theme",
@@ -222,7 +222,7 @@
{
"name": "photoInformation",
"value": true
},
},
{
"name": "quicklinksddgProxy",
"value": true
@@ -246,5 +246,13 @@
{
"name": "animations",
"value": true
},
{
"name": "textBorder",
"value": "new"
},
{
"name": "widgetStyle",
"value": "new"
}
]

View File

@@ -59,7 +59,7 @@ export function getGradient() {
export function randomColourStyleBuilder(type) {
// randomColour based on https://stackoverflow.com/a/5092872
const randomColour = () => '#000000'.replace(/0/g, () => {return (~~(Math.random()*16)).toString(16)});
const randomColour = () => '#000000'.replace(/0/g, () => { return (~~(Math.random()*16)).toString(16) });
let style = `background:${randomColour()};`;
if (type === 'random_gradient') {

View File

@@ -1,14 +1,14 @@
import EventBus from './eventbus';
function showReminder() {
document.querySelector('.reminder-info').style.display = 'block';
document.querySelector('.reminder-info').style.display = 'flex';
localStorage.setItem('showReminder', true);
}
// based on https://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links
export function urlParser(input) {
const urlPattern = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_+.~#?&//=]*)/;
return input.replace(urlPattern, '<a href="$&" target="_blank">$&</a>');
return input.replace(urlPattern, '<br/><a href="$&" target="_blank">$&</a>');
}
export function install(type, input, sideload) {
@@ -32,7 +32,11 @@ export function install(type, input, sideload) {
break;
case 'photos':
localStorage.setItem('photo_packs', JSON.stringify(input.photos));
const currentPhotos = JSON.parse(localStorage.getItem('photo_packs')) || [];
input.photos.forEach(photo => {
currentPhotos.push(photo);
});
localStorage.setItem('photo_packs', JSON.stringify(currentPhotos));
localStorage.setItem('oldBackgroundType', localStorage.getItem('backgroundType'));
localStorage.setItem('backgroundType', 'photo_pack');
EventBus.dispatch('refresh', 'background');
@@ -89,7 +93,16 @@ export function uninstall(type, name) {
break;
case 'photos':
localStorage.removeItem('photo_packs');
const installedContents = JSON.parse(localStorage.getItem('photo_packs'));
const packContents = JSON.parse(localStorage.getItem('installed')).find(content => content.name === name);
// todo: make it find in photo_packs all the ones in installed for that pack and remove
console.log(packContents)
installedContents.forEach((item, index) => {
if (packContents.photos.includes(item)) {
installedContents.splice(index, 1);
}
});
localStorage.setItem('photo_packs', JSON.stringify(installedContents));
localStorage.setItem('backgroundType', localStorage.getItem('oldBackgroundType'));
localStorage.removeItem('oldBackgroundType');
EventBus.dispatch('refresh', 'marketplacebackgrounduninstall');

View File

@@ -34,15 +34,18 @@ export function loadSettings(hotreload) {
switch (localStorage.getItem('theme')) {
case 'dark':
document.body.classList.add('dark');
document.body.classList.remove('light');
break;
case 'auto':
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.body.classList.add('dark');
} else {
document.body.classList.remove('dark');
document.body.classList.add('light');
}
break;
default:
document.body.classList.add('light');
document.body.classList.remove('dark');
}
@@ -66,7 +69,11 @@ export function loadSettings(hotreload) {
document.body.classList.remove('no-animations');
}
if (localStorage.getItem('textBorder') === 'true') {
// technically, this is text SHADOW, and not BORDER
// however it's a mess and we'll just leave it at this for now
const textBorder = localStorage.getItem('textBorder');
// enable/disable old text border from before redesign
if (textBorder === 'true') {
const elements = ['greeting', 'clock', 'quote', 'quoteauthor', 'date'];
elements.forEach((element) => {
try {
@@ -86,6 +93,13 @@ export function loadSettings(hotreload) {
});
}
// remove actual default shadow
if (textBorder === 'none') {
document.getElementById('center').classList.add('no-textBorder');
} else {
document.getElementById('center').classList.remove('no-textBorder');
}
const css = localStorage.getItem('customcss');
if (css) {
document.head.insertAdjacentHTML('beforeend', '<style id="customcss">' + css + '</style>');

View File

@@ -34,9 +34,5 @@
{
"name": "中文 (简体)",
"value": "zh_CN"
},
{
"name": "Bahasa Indonesia",
"value": "id_ID"
}
]