|
|
@@ -22,6 +22,14 @@ var events = {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ changeContent: (e) => {
|
|
|
+ state.content[e.target.name] = !state.content[e.target.name]
|
|
|
+ chrome.runtime.sendMessage({
|
|
|
+ message: 'content',
|
|
|
+ content: state.content
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
changeTheme: (e) => {
|
|
|
state.theme = state.themes[e.target.selectedIndex]
|
|
|
chrome.runtime.sendMessage({
|
|
|
@@ -84,8 +92,8 @@ function init (res) {
|
|
|
function oncreate (vnode) {
|
|
|
componentHandler.upgradeElements(vnode.dom)
|
|
|
}
|
|
|
-var onupdate = (key) => (vnode) => {
|
|
|
- if (vnode.dom.classList.contains('is-checked') !== state.compiler[key]) {
|
|
|
+var onupdate = (tab, key) => (vnode) => {
|
|
|
+ if (vnode.dom.classList.contains('is-checked') !== state[tab][key]) {
|
|
|
vnode.dom.classList.toggle('is-checked')
|
|
|
}
|
|
|
}
|
|
|
@@ -125,7 +133,7 @@ m.mount(document.querySelector('body'), {
|
|
|
m('.mdl-grid', Object.keys(state.compiler).map((key) =>
|
|
|
m('.mdl-cell',
|
|
|
m('label.mdl-switch mdl-js-switch mdl-js-ripple-effect',
|
|
|
- {oncreate, onupdate: onupdate(key), title: description.compiler[key]}, [
|
|
|
+ {oncreate, onupdate: onupdate('compiler', key), title: description.compiler[key]}, [
|
|
|
m('input[type="checkbox"].mdl-switch__input', {
|
|
|
name: key,
|
|
|
checked: state.compiler[key],
|
|
|
@@ -141,7 +149,7 @@ m.mount(document.querySelector('body'), {
|
|
|
m('.mdl-grid', Object.keys(state.content).map((key) =>
|
|
|
m('.mdl-cell',
|
|
|
m('label.mdl-switch mdl-js-switch mdl-js-ripple-effect',
|
|
|
- {oncreate, onupdate: onupdate(key), title: description.content[key]}, [
|
|
|
+ {oncreate, onupdate: onupdate('content', key), title: description.content[key]}, [
|
|
|
m('input[type="checkbox"].mdl-switch__input', {
|
|
|
name: key,
|
|
|
checked: state.content[key],
|