Removed AccentReload method.
This commit is contained in:
parent
3949d8daed
commit
48a98e7448
2 changed files with 20 additions and 39 deletions
|
@ -11,6 +11,7 @@ window.Umi = { UI: {} };
|
|||
#include events.js
|
||||
#include mobile.js
|
||||
#include mszauth.js
|
||||
#include themes.js
|
||||
#include txtrigs.js
|
||||
#include uniqstr.js
|
||||
#include users.js
|
||||
|
@ -146,7 +147,6 @@ const MamiInit = async args => {
|
|||
settings.define('dumpPackets').default(FUTAMI_DEBUG).create();
|
||||
settings.define('dumpEvents').default(FUTAMI_DEBUG).create();
|
||||
settings.define('marqueeAllNames').default(false).create();
|
||||
settings.define('tmpDisableOldThemeSys').default(false).critical().create();
|
||||
settings.define('dbgAnimDurationMulti').default(1).min(0).max(10).create();
|
||||
settings.define('newLineOnEnter').default(false).create();
|
||||
|
||||
|
@ -292,13 +292,21 @@ const MamiInit = async args => {
|
|||
const layout = new Umi.UI.ChatLayout(sidebar);
|
||||
await ctx.views.unshift(layout);
|
||||
|
||||
Umi.UI.View.AccentReload();
|
||||
Umi.UI.Hooks.AddHooks();
|
||||
|
||||
settings.watch('style', ev => { if(!ev.detail.initial) Umi.UI.View.AccentReload(); });
|
||||
settings.watch('compactView', ev => { if(!ev.detail.initial) Umi.UI.View.AccentReload(); });
|
||||
settings.watch('style', ev => {
|
||||
for(const className of layout.getElement().classList)
|
||||
if(className.startsWith('umi--'))
|
||||
layout.getElement().classList.remove(className);
|
||||
layout.getElement().classList.add(`umi--${ev.detail.value}`);
|
||||
|
||||
UmiThemeApply(ev.detail.value);
|
||||
});
|
||||
settings.watch('compactView', ev => {
|
||||
layout.getElement().classList.toggle('chat--compact', ev.detail.value);
|
||||
layout.getInterface().getMessageList().getElement().classList.toggle('chat--compact', ev.detail.value);
|
||||
});
|
||||
settings.watch('preventOverflow', ev => args.parent.classList.toggle('prevent-overflow', ev.detail.value));
|
||||
settings.watch('tmpDisableOldThemeSys', ev => { if(!ev.detail.initial) Umi.UI.View.AccentReload(); });
|
||||
|
||||
settings.watch('minecraft', ev => {
|
||||
if(ev.detail.initial && ev.detail.value === 'no')
|
||||
|
@ -433,7 +441,13 @@ const MamiInit = async args => {
|
|||
|
||||
sbSettings.category(category => {
|
||||
category.header('Interface');
|
||||
category.setting('style').title('Style').type('select').options(() => Umi.UI.View.AccentColours).done();
|
||||
category.setting('style').title('Theme').type('select').options(() => {
|
||||
const themes = {};
|
||||
for(const theme of UmiThemes)
|
||||
themes[theme.id] = theme.name;
|
||||
|
||||
return themes;
|
||||
}).done();
|
||||
category.setting('compactView').title('Use compact view').done();
|
||||
category.setting('autoScroll').title('Enable auto scroll').done();
|
||||
category.setting('closeTabConfirm').title('Confirm tab close').done();
|
||||
|
@ -599,7 +613,6 @@ const MamiInit = async args => {
|
|||
category.setting('dumpPackets').title('Dump packets to console').done();
|
||||
category.setting('dumpEvents').title('Dump events to console').done();
|
||||
category.setting('marqueeAllNames').title('Apply marquee on everyone').done();
|
||||
category.setting('tmpDisableOldThemeSys').title('Disable old theme system').done();
|
||||
category.setting('dbgAnimDurationMulti').title('Animation multiplier').type('range').done();
|
||||
category.button('Test kick/ban notice', async button => {
|
||||
button.disabled = true;
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
#include themes.js
|
||||
#include utility.js
|
||||
|
||||
Umi.UI.View = (function() {
|
||||
const accentColours = {
|
||||
'dark': 'Dark',
|
||||
'light': 'Light',
|
||||
'blue': 'Blue',
|
||||
'purple': 'Purple',
|
||||
'archaic': 'Archaic'
|
||||
};
|
||||
|
||||
const getPosition = function(end) {
|
||||
return $i('umi-msg-text')[end ? 'selectionEnd' : 'selectionStart'];
|
||||
};
|
||||
|
@ -25,29 +16,6 @@ Umi.UI.View = (function() {
|
|||
};
|
||||
|
||||
return {
|
||||
AccentColours: accentColours,
|
||||
AccentReload: function() {
|
||||
const style = mami.settings.get('style');
|
||||
|
||||
if(!accentColours.hasOwnProperty(style))
|
||||
return;
|
||||
|
||||
// should probably be moved elsewhere eventually
|
||||
// the entire AccentReload function should probably be axed
|
||||
UmiThemeApply(style);
|
||||
|
||||
const chat = $i('umi-chat');
|
||||
if(chat instanceof Element) {
|
||||
const compactView = mami.settings.get('compactView');
|
||||
chat.classList.toggle('chat--compact', compactView);
|
||||
$i('umi-messages').classList.toggle('chat--compact', compactView);
|
||||
|
||||
const forceOldOff = mami.settings.get('tmpDisableOldThemeSys');
|
||||
for(const name in accentColours)
|
||||
if(accentColours.hasOwnProperty(name))
|
||||
chat.classList.toggle(`umi--${name}`, !forceOldOff && name === style);
|
||||
}
|
||||
},
|
||||
Focus: function() {
|
||||
$i('umi-msg-text').focus();
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue