v0.1.2 working
This commit is contained in:
parent
806eeabd24
commit
927105de96
|
@ -1,9 +1,51 @@
|
|||
function BetterDiscord() {
|
||||
/* BetterDiscordApp Entry
|
||||
* Version: 1.0
|
||||
* Author: Jiiks | http://jiiks.net
|
||||
* Date: 27/08/2015 - 15:51
|
||||
* https://github.com/Jiiks/BetterDiscordApp
|
||||
*/
|
||||
|
||||
var _config = require("./config.json");
|
||||
var _utils = require("./utils");
|
||||
|
||||
var version;
|
||||
|
||||
var _mainWindow;
|
||||
|
||||
function BetterDiscord(mainWindow) {
|
||||
_mainWindow = mainWindow;
|
||||
version = _config.Core.Version;
|
||||
_utils = new _utils.Utils(mainWindow);
|
||||
}
|
||||
|
||||
BetterDiscord.prototype.getUtils = function() {
|
||||
return _utils;
|
||||
}
|
||||
|
||||
BetterDiscord.prototype.init = function() {
|
||||
console.log("WOLOLOLOLO");
|
||||
var self = this;
|
||||
console.log("BetterDiscord v" + version + " Initialized");
|
||||
|
||||
self.getUtils().getWebContents().on('did-finish-load', function() {
|
||||
|
||||
});
|
||||
|
||||
self.getUtils().getWebContents().on('dom-ready', function() {
|
||||
|
||||
self.getUtils().injectJavaScript("//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"); //jquery
|
||||
|
||||
//CSS
|
||||
self.getUtils().execJs('function injectCss() { $(\'head\').append(\'<link rel=\"stylesheet\" type=\"text\/css\" href=\"https:\/\/rawgit.com\/Jiiks\/BetterDiscordApp\/master\/css\/main.min.css\">\') }');
|
||||
self.getUtils().execJs('var deferCount = 0; function defer() { if(window.jQuery) { injectCss() } else { setTimeout( function() { if(deferCount < 100) { deferCount++; defer(); } else { alert("BetterDiscord failed to load :( try restarting Discord. code:0x01"); } }, 100 ); } } deferCount = 0; defer();');
|
||||
|
||||
//JavaScript
|
||||
setTimeout(function() {
|
||||
self.getUtils().injectJavaScript("//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js");
|
||||
self.getUtils().injectJavaScript("https://rawgit.com/Jiiks/BetterDiscordApp/806eeabd2473d7b65746bc67a4c1e2cf77a55bd6/js/main.min.js");
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
exports.BetterDiscord = BetterDiscord;
|
|
@ -73,4 +73,12 @@ Utils.prototype.injectStylesheet = function(url) {
|
|||
});
|
||||
}
|
||||
|
||||
Utils.prototype.headStyleSheet = function(url) {
|
||||
this.execJs('(function() { var stylesheet = document.createElement("link"); stylesheet.type = "text/css"; document.getElementsByTagName("head")[0].appendChild(stylesheet); stylesheet.href = "'+url+'" })();')
|
||||
}
|
||||
|
||||
Utils.prototype.injectJavaScript = function(url) {
|
||||
this.execJs('(function() { var script = document.createElement("script"); script.type = "text/javascript"; document.getElementsByTagName("body")[0].appendChild(script); script.src = "'+url+'"; })();');
|
||||
}
|
||||
|
||||
exports.Utils = Utils;
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Core": {
|
||||
"Version": "0.1.2"
|
||||
},
|
||||
"EmoteModule": {
|
||||
"Twitch":{
|
||||
"EmoteData": "emotedata_twitch.json",
|
||||
|
@ -11,7 +14,7 @@
|
|||
"EmoteUrlEnd": "/1"
|
||||
},
|
||||
"BetterTTV": {
|
||||
"EmoteData": "",
|
||||
"EmoteData": "emotedata_bttv.json",
|
||||
"EmoteUrlStart": "",
|
||||
"EmoteUrlEnd": ""
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue