Make plugin switch actually do something

This commit is contained in:
Jiiks 2018-01-23 18:19:45 +02:00
parent 19b88b4be0
commit 098ac8fb17
3 changed files with 20 additions and 11 deletions

View File

@ -17,6 +17,7 @@ class Plugin {
constructor(pluginInternals) {
this.__pluginInternals = pluginInternals;
this.userConfig.enabled = this.userConfig.enabled || false;
this.start = this.start.bind(this);
this.stop = this.stop.bind(this);
}
@ -42,7 +43,7 @@ class Plugin {
}
return false;
}
return true; //Assume plugin started since it doesn't have onStart
return this.userConfig.enabled = true; //Assume plugin started since it doesn't have onStart
}
stop() {
@ -54,6 +55,7 @@ class Plugin {
}
return false;
}
this.userConfig.enabled = false;
return true; //Assume plugin stopped since it doesn't have onStop
}

View File

@ -17,7 +17,6 @@
} catch (err) {
}
this.localPlugins = PluginManager.plugins;
}
function showLocal() {
@ -29,8 +28,11 @@
}
function togglePlugin(plugin) {
if (plugin.enabled) return PluginManager.stopPlugin(plugin.name);
PluginManager.startPlugin(plugin.name);
if (plugin.enabled) {
this.pluginManager.stopPlugin(plugin.name);
} else {
this.pluginManager.startPlugin(plugin.name);
}
}
const methods = { showLocal, showOnline, refreshLocalPlugins, togglePlugin };
@ -39,8 +41,13 @@
components,
data() {
return {
localPlugins: [],
local: true
local: true,
pluginManager: PluginManager
}
},
computed: {
localPlugins: function () {
return this.pluginManager.plugins;
}
},
methods,

View File

@ -167,7 +167,7 @@
display: block;
}
.bd-setting-switch .bd-switch-wrapper input {
.bd-switch-wrapper input {
position: absolute;
opacity: 0;
cursor: pointer;
@ -176,7 +176,7 @@
z-index: 1;
}
.bd-setting-switch .bd-switch-wrapper .bd-switch {
.bd-switch-wrapper .bd-switch {
position: absolute;
top: 0;
right: 0;
@ -206,7 +206,7 @@
border-bottom: 0px solid hsla(218,5%,47%,.1);
}
.bd-setting-switch .bd-switch-wrapper .bd-switch:before {
.bd-switch-wrapper .bd-switch:before {
content: "";
display: block;
width: 18px;
@ -221,11 +221,11 @@
box-shadow: 0 3px 1px 0 rgba(0,0,0,.05), 0 2px 2px 0 rgba(0,0,0,.1), 0 3px 3px 0 rgba(0,0,0,.05);
}
.bd-setting-switch .bd-switch-wrapper .bd-switch.bd-checked {
.bd-switch-wrapper .bd-switch.bd-checked {
background: $colbdblue;
}
.bd-setting-switch .bd-switch-wrapper .bd-switch.bd-checked:before {
.bd-switch-wrapper .bd-switch.bd-checked:before {
transform: translateX(20px);
}