theme buttons fix

This commit is contained in:
Evert Prants 2016-10-01 18:28:53 +03:00
parent d35c203974
commit f5e1f2a295
2 changed files with 39 additions and 24 deletions

View File

@ -959,23 +959,10 @@ class Buffer {
}
}
class Settings extends Buffer {
constructor() {
super("", "settings", "Settings", "applet");
this.tab = null;
this.isOpen = false;
this.timeout = null;
this.themeSelection = "";
clientdom.settings.save.onclick = (e) => {
this.saveSpecified();
}
clientdom.settings.open.onclick = (e) => {
this.open();
}
this.theme_buttons();
class ThemeSelector {
constructor(settings, variable) {
this.settings = settings;
this.variable = variable;
}
set_active_selection(name) {
@ -994,25 +981,53 @@ class Settings extends Buffer {
}
}
theme_buttons() {
bindButton(button, theme) {
button.onclick = (e) => {
this.settings.themeSelection = theme;
this.set_active_selection(theme);
}
}
render() {
clientdom.settings.available_themes.innerHTML = "";
for(let n in window.themes.available) {
let theme = window.themes.available[n];
let button = composer.theme_selection(n, theme);
clientdom.settings.available_themes.appendChild(button);
button.onclick = (e) => {
this.themeSelection = n;
this.set_active_selection(this.themeSelection);
this.bindButton(button, n);
}
}
}
class Settings extends Buffer {
constructor() {
super("", "settings", "Settings", "applet");
this.tab = null;
this.isOpen = false;
this.timeout = null;
this.themeSelection = "";
this.themeSelector = new ThemeSelector(this);
this.themeSelector.render();
clientdom.settings.save.onclick = (e) => {
this.saveSpecified();
}
clientdom.settings.open.onclick = (e) => {
this.open();
}
}
switch_theme() {
if(this.themeSelection != '') {
window.themes.change_theme(this.themeSelection);
irc.config.theme = this.themeSelection;
this.set_active_selection(this.themeSelection);
this.themeSelector.set_active_selection(this.themeSelection);
}
}

View File

@ -26,7 +26,7 @@ window.themes = {
nick_pallete: {
H: [1, 360],
S: [30, 100],
L: [40, 90]
L: [50, 100]
},
stylesheet: "theme_night",
default: false,