pluginModule, themeModule and customcss
This commit is contained in:
parent
d28f8fc02d
commit
ad47b4e1a5
55
js/main.js
55
js/main.js
|
@ -1265,11 +1265,9 @@ function PluginModule() {
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginModule.prototype.loadPlugins = function () {
|
PluginModule.prototype.loadPlugins = function () {
|
||||||
|
|
||||||
this.loadPluginData();
|
this.loadPluginData();
|
||||||
|
|
||||||
var plugins = Object.keys(bdplugins);
|
var plugins = Object.keys(bdplugins);
|
||||||
|
|
||||||
for (var i = 0; i < plugins.length; i++) {
|
for (var i = 0; i < plugins.length; i++) {
|
||||||
var plugin, name;
|
var plugin, name;
|
||||||
|
|
||||||
|
@ -1304,33 +1302,39 @@ PluginModule.prototype.savePluginData = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
PluginModule.prototype.newMessage = function () {
|
PluginModule.prototype.newMessage = function () {
|
||||||
$.each(bdplugins, function () {
|
var plugins = Object.keys(bdplugins);
|
||||||
if (!pluginCookie[this.plugin.getName()]) return;
|
for (var i = 0; i < plugins.length; i++) {
|
||||||
if (typeof this.plugin.onMessage === "function") {
|
var plugin = bdplugins[plugins[i]].plugin;
|
||||||
try { this.plugin.onMessage(); }
|
if (!pluginCookie[plugin.getName()]) return;
|
||||||
catch (err) { utils.err("Unable to fire onMessage for " + this.plugin.getName() + ".", err); }
|
if (typeof plugin.onMessage === "function") {
|
||||||
|
try { plugin.onMessage(); }
|
||||||
|
catch (err) { utils.err("Unable to fire onMessage for " + plugin.getName() + ".", err); }
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PluginModule.prototype.channelSwitch = function () {
|
PluginModule.prototype.channelSwitch = function () {
|
||||||
$.each(bdplugins, function () {
|
var plugins = Object.keys(bdplugins);
|
||||||
if (!pluginCookie[this.plugin.getName()]) return;
|
for (var i = 0; i < plugins.length; i++) {
|
||||||
if (typeof this.plugin.onSwitch === "function") {
|
var plugin = bdplugins[plugins[i]].plugin;
|
||||||
try { this.plugin.onSwitch(); }
|
if (!pluginCookie[plugin.getName()]) return;
|
||||||
catch (err) { utils.err("Unable to fire onSwitch for " + this.plugin.getName() + ".", err); }
|
if (typeof plugin.onSwitch === "function") {
|
||||||
|
try { plugin.onSwitch(); }
|
||||||
|
catch (err) { utils.err("Unable to fire onSwitch for " + plugin.getName() + ".", err); }
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PluginModule.prototype.rawObserver = function(e) {
|
PluginModule.prototype.rawObserver = function(e) {
|
||||||
$.each(bdplugins, function() {
|
var plugins = Object.keys(bdplugins);
|
||||||
if (!pluginCookie[this.plugin.getName()]) return;
|
for (var i = 0; i < plugins.length; i++) {
|
||||||
if(typeof this.plugin.observer === "function") {
|
var plugin = bdplugins[plugins[i]].plugin;
|
||||||
try { this.plugin.observer(e); }
|
if (!pluginCookie[plugin.getName()]) return;
|
||||||
catch (err) { utils.err("Unable to fire observer for " + this.plugin.getName() + ".", err); }
|
if (typeof plugin.observer === "function") {
|
||||||
|
try { plugin.observer(e); }
|
||||||
|
catch (err) { utils.err("Unable to fire observer for " + plugin.getName() + ".", err); }
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1352,11 +1356,11 @@ ThemeModule.prototype.loadThemes = function () {
|
||||||
|
|
||||||
var themes = Object.keys(bdthemes);
|
var themes = Object.keys(bdthemes);
|
||||||
|
|
||||||
for (var i = 0; i < themes.length; i++) {
|
for (var i = 0; i < themes.length; i++) {
|
||||||
var name = bdthemes[themes[i]].name;
|
var name = bdthemes[themes[i]].name;
|
||||||
if (!themeCookie[name]) themeCookie[name] = false;
|
if (!themeCookie[name]) themeCookie[name] = false;
|
||||||
if (themeCookie[name]) $("head").append($('<style>', {id: utils.escapeID(name), html: unescape(bdthemes[name]["css"])}));
|
if (themeCookie[name]) $("head").append($('<style>', {id: utils.escapeID(name), html: unescape(bdthemes[name]["css"])}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ThemeModule.prototype.loadThemeData = function () {
|
ThemeModule.prototype.loadThemeData = function () {
|
||||||
|
@ -2002,6 +2006,7 @@ class V2C_CssEditorDetached extends BDV2.reactComponent {
|
||||||
case 'attach':
|
case 'attach':
|
||||||
if ($("#editor-detached").length) self.props.attach();
|
if ($("#editor-detached").length) self.props.attach();
|
||||||
BDV2.reactDom.unmountComponentAtNode(self.root);
|
BDV2.reactDom.unmountComponentAtNode(self.root);
|
||||||
|
self.root.remove();
|
||||||
break;
|
break;
|
||||||
case 'update':
|
case 'update':
|
||||||
self.updateCss();
|
self.updateCss();
|
||||||
|
|
Loading…
Reference in New Issue