diff --git a/WindowsInstaller/BetterDiscordWI/BetterDiscordWI.csproj b/WindowsInstaller/BetterDiscordWI/BetterDiscordWI.csproj
index 5caffa7f..362beb7b 100644
--- a/WindowsInstaller/BetterDiscordWI/BetterDiscordWI.csproj
+++ b/WindowsInstaller/BetterDiscordWI/BetterDiscordWI.csproj
@@ -36,10 +36,6 @@
..\..\..\..\VSProjects\asardotnet\asardotnet\bin\Release\asardotnet.dll
-
- False
- ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll
-
diff --git a/WindowsInstaller/BetterDiscordWI/panels/Panel1.cs b/WindowsInstaller/BetterDiscordWI/panels/Panel1.cs
index 973561bb..d81aed77 100644
--- a/WindowsInstaller/BetterDiscordWI/panels/Panel1.cs
+++ b/WindowsInstaller/BetterDiscordWI/panels/Panel1.cs
@@ -1,13 +1,6 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
using System.Diagnostics;
-using System.Drawing;
-using System.Data;
using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace BetterDiscordWI.panels
diff --git a/WindowsInstaller/BetterDiscordWI/panels/Panel2.cs b/WindowsInstaller/BetterDiscordWI/panels/Panel2.cs
index 55123890..30964dc6 100644
--- a/WindowsInstaller/BetterDiscordWI/panels/Panel2.cs
+++ b/WindowsInstaller/BetterDiscordWI/panels/Panel2.cs
@@ -175,6 +175,54 @@ namespace BetterDiscordWI.panels
AppendLog("Splicing function call");
lines.Add(line);
lines.Add("betterDiscord(mainWindow);");
+ AppendLog("Splicing plugin&theme loaders");
+
+ lines.Add(" mainWindow.webContents.on('dom-ready', function() {");
+ lines.Add(" var fs = require('fs');");
+ lines.Add(" fs.readdir('G:/BetterDiscord/plugins/',function(err,files) {");
+ lines.Add(" if (err) { console.log(err); return; } ");
+ lines.Add(" mainWindow.webContents.executeJavaScript('var bdplugins = {};');");
+ lines.Add(" files.forEach(function(fileName){");
+ lines.Add(" var plugin = fs.readFileSync('G:/BetterDiscord/plugins/' + fileName,'utf8');");
+ lines.Add(" var meta = plugin.split('\\n')[0];");
+ lines.Add(" if(meta.indexOf('META') < 0) {");
+ lines.Add(" console.log('BetterDiscord: ERROR[Plugin META not found in file: '+fileName+']');");
+ lines.Add(" return;");
+ lines.Add(" }");
+ lines.Add(" var pluginVar = meta.substring(meta.lastIndexOf('//META')+6, meta.lastIndexOf('*//'));");
+ lines.Add(" var parse = JSON.parse(pluginVar);");
+ lines.Add(" var pluginName = parse['name'];");
+ lines.Add(" console.log('BetterDiscord: Loading Plugin: ' + pluginName);");
+ lines.Add(" mainWindow.webContents.executeJavaScript(plugin);");
+ lines.Add(" mainWindow.webContents.executeJavaScript('(function() { var plugin = new '+pluginName+'(); bdplugins[plugin.getName()] = { \"plugin\": plugin, \"enabled\": false } })();')");
+ lines.Add(" });");
+ lines.Add(" });");
+ lines.Add("\n");
+ lines.Add(" fs.readdir('G:/BetterDiscord/themes/', function(err, files) {");
+ lines.Add(" if (err) { console.log(err); return; }");
+ lines.Add(" mainWindow.webContents.executeJavaScript('var bdthemes = {};');");
+ lines.Add(" files.forEach(function(fileName) {");
+ lines.Add(" var theme = fs.readFileSync('G:/BetterDiscord/themes/' + fileName, 'utf8');");
+ lines.Add(" var split = theme.split('\\n');");
+ lines.Add(" var meta = split[0];");
+ lines.Add(" if(meta.indexOf('META') < 0) {");
+ lines.Add(" console.log('BetterDiscord: ERROR[Theme META not found in file: '+fileName+']');");
+ lines.Add(" return;");
+ lines.Add(" }");
+ lines.Add(" var themeVar = meta.substring(meta.lastIndexOf('//META')+6, meta.lastIndexOf('*//'));");
+ lines.Add(" var parse = JSON.parse(themeVar);");
+ lines.Add(" var themeName = parse['name'];");
+ lines.Add(" console.log('BetterDiscord: Loading Theme: ' + themeName);");
+ lines.Add(" split.splice(0, 1);");
+ lines.Add(" theme = split.join('\\n');");
+ lines.Add(" theme = theme.replace(/(\\r\\n|\\n|\\r)/gm,'');");
+ lines.Add(" theme = theme.replace(/\\s/g, '');");
+ lines.Add(" mainWindow.webContents.executeJavaScript('var theme' + themeName + ' = \"' + escape(theme) + '\";');");
+ lines.Add(" mainWindow.webContents.executeJavaScript('(function() { bdthemes[theme'+themeName+'] = false })();');");
+ lines.Add(" });");
+ lines.Add(" });");
+ lines.Add(" });\n");
+
}
else if (line.Contains("main();"))
{
diff --git a/WindowsInstaller/BetterDiscordWI/panels/Panel3.cs b/WindowsInstaller/BetterDiscordWI/panels/Panel3.cs
index 724b7c4b..a33b1880 100644
--- a/WindowsInstaller/BetterDiscordWI/panels/Panel3.cs
+++ b/WindowsInstaller/BetterDiscordWI/panels/Panel3.cs
@@ -1,12 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
+using System.Windows.Forms;
namespace BetterDiscordWI.panels
{
diff --git a/WindowsInstaller/rel/BetterDiscordWI.exe b/WindowsInstaller/rel/BetterDiscordWI.exe
new file mode 100644
index 00000000..793688fa
Binary files /dev/null and b/WindowsInstaller/rel/BetterDiscordWI.exe differ
diff --git a/WindowsInstaller/rel/Newtonsoft.Json.dll b/WindowsInstaller/rel/Newtonsoft.Json.dll
new file mode 100644
index 00000000..d4c90377
Binary files /dev/null and b/WindowsInstaller/rel/Newtonsoft.Json.dll differ
diff --git a/WindowsInstaller/rel/WindowsInstaller0.1.zip b/WindowsInstaller/rel/WindowsInstaller0.1.zip
new file mode 100644
index 00000000..9c487a57
Binary files /dev/null and b/WindowsInstaller/rel/WindowsInstaller0.1.zip differ
diff --git a/WindowsInstaller/rel/asardotnet.dll b/WindowsInstaller/rel/asardotnet.dll
new file mode 100644
index 00000000..da7743dc
Binary files /dev/null and b/WindowsInstaller/rel/asardotnet.dll differ
diff --git a/js/main.js b/js/main.js
index 571ed276..b013cb55 100644
--- a/js/main.js
+++ b/js/main.js
@@ -36,7 +36,7 @@ var settings = {
"Emote Auto Capitalization": { "id": "bda-es-4", "info": "Autocapitalize emote commands", "implemented": true },
"Override Default Emotes": { "id": "bda-es-5", "info": "Override default emotes", "implemented": false },
"Show Names": { "id": "bda-es-6", "info": "Show emote names on hover", "implemented": true }
-};
+}
var links = {
"Jiiks.net": { "text": "Jiiks.net", "href": "http://jiiks.net", "target": "_blank" },
@@ -417,7 +417,6 @@ EmoteModule.prototype.getNodes = function(node) {
var bemotes = [];
var spoilered = [];
-//TODO Edited emotes
EmoteModule.prototype.injectEmote = function(node) {
if(typeof emotesTwitch === 'undefined') return;
@@ -1054,7 +1053,7 @@ SettingsPanel.prototype.construct = function() {
' Name | Description | Author | Version | |
---|
';
- $.each(plugins, function() {
+ $.each(bdplugins, function() {
var plugin = this["plugin"];
settingsInner += '' +
@@ -1245,7 +1244,7 @@ PluginModule.prototype.loadPlugins = function() {
this.loadPluginData();
- $.each(plugins, function() {
+ $.each(bdplugins, function() {
var plugin = this["plugin"];
plugin.load();
@@ -1272,10 +1271,10 @@ PluginModule.prototype.handlePlugin = function(checkbox) {
cb.prop("checked", enabled);
if(enabled) {
- plugins[id]["plugin"].start();
+ bdplugins[id]["plugin"].start();
pluginCookie[id] = true;
} else {
- plugins[id]["plugin"].stop();
+ bdplugins[id]["plugin"].stop();
pluginCookie[id] = false;
}
@@ -1328,8 +1327,8 @@ BdApi.clearCSS = function(id) {
//Get another plugin
//name = name of plugin
BdApi.getPlugin = function(name) {
- if(plugins.hasOwnProperty(name)) {
- return plugins[name]["plugin"];
+ if(bdplugins.hasOwnProperty(name)) {
+ return bdplugins[name]["plugin"];
}
return null;
};