Plugin API
This commit is contained in:
parent
0caedb5a51
commit
b66146d881
71
js/main.js
71
js/main.js
|
@ -70,20 +70,20 @@ var bdchangelog = {
|
||||||
"img": ""
|
"img": ""
|
||||||
},
|
},
|
||||||
"settingsmenu": {
|
"settingsmenu": {
|
||||||
"title": "Settings Menu",
|
"title": "Settings Menu!",
|
||||||
"text": "New and improved settings menu!",
|
"text": "New and improved settings menu!",
|
||||||
"img": ""
|
"img": ""
|
||||||
},
|
},
|
||||||
"csseditor": {
|
"csseditor": {
|
||||||
"title": "New CSS Editor",
|
"title": "New CSS Editor!",
|
||||||
"text": "New CSS Editor powered by codemirror!",
|
"text": "New CSS Editor powered by <a href='http://codemirror.net' target='_blank'>CodeMirror!</a>",
|
||||||
"img": ""
|
"img": ""
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"fixes": {
|
"fixes": {
|
||||||
"reload": {
|
"reload": {
|
||||||
"title": "Reload Fix",
|
"title": "Reload Fix!",
|
||||||
"text": "Fixed an issue that caused Discord to crash on reload",
|
"text": "Fixed an issue that caused Discord to crash on reload!",
|
||||||
"img": ""
|
"img": ""
|
||||||
},
|
},
|
||||||
"eemotes": {
|
"eemotes": {
|
||||||
|
@ -97,20 +97,20 @@ var bdchangelog = {
|
||||||
"img": ""
|
"img": ""
|
||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"title": "Bugfixes",
|
"title": "Bugfixes!",
|
||||||
"text": "Several smaller bugs fixed",
|
"text": "Several smaller bugs fixed!",
|
||||||
"img": ""
|
"img": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"upcoming": {
|
"upcoming": {
|
||||||
"ignore": {
|
"ignore": {
|
||||||
"title": "Ignore User!",
|
"title": "Ignore User!",
|
||||||
"text": "Ignore users you don't like",
|
"text": "Ignore users you don't like!",
|
||||||
"img": ""
|
"img": ""
|
||||||
},
|
},
|
||||||
"more": {
|
"more": {
|
||||||
"title": "More Things!",
|
"title": "More Things!",
|
||||||
"text": "More things but probably not in the next version.",
|
"text": "More things but probably not in the next version!",
|
||||||
"img": ""
|
"img": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ Core.prototype.init = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if(version < supportedVersion) {
|
if(version < supportedVersion) {
|
||||||
alert("BetterDiscord v" + version + "(your version)" + " is not supported by the latest js("+jsVersion+"). Please download the latest version from GitHub.");
|
alert("BetterDiscord v" + version + "(your version)" + " is not supported by the latest js("+jsVersion+"). Please download the latest version from betterdiscord.net");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,3 +1277,54 @@ PluginModule.prototype.loadPluginData = function() {
|
||||||
PluginModule.prototype.savePluginData = function() {
|
PluginModule.prototype.savePluginData = function() {
|
||||||
$.cookie("bd-plugins", JSON.stringify(pluginCookie), { expires: 365, path: '/' });
|
$.cookie("bd-plugins", JSON.stringify(pluginCookie), { expires: 365, path: '/' });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* BetterDiscordApp API for Plugins
|
||||||
|
* Version: 1.0
|
||||||
|
* Author: Jiiks | http://jiiks.net
|
||||||
|
* Date: 11/12/2015
|
||||||
|
* Last Update: 11/12/2015
|
||||||
|
* https://github.com/Jiiks/BetterDiscordApp
|
||||||
|
*
|
||||||
|
* Plugin Template: https://gist.github.com/Jiiks/71edd5af0beafcd08956
|
||||||
|
*/
|
||||||
|
|
||||||
|
function BdApi() {}
|
||||||
|
|
||||||
|
//Joins a server
|
||||||
|
//code = server invite code
|
||||||
|
BdApi.joinServer = function(code) {
|
||||||
|
opublicServers.joinServer(code);
|
||||||
|
};
|
||||||
|
|
||||||
|
//Inject CSS to document head
|
||||||
|
//id = id of element
|
||||||
|
//css = custom css
|
||||||
|
BdApi.injectCSS = function(id, css) {
|
||||||
|
$("head").append('<style id="'+id+'"></style>')
|
||||||
|
$("#" + id).html(css);
|
||||||
|
};
|
||||||
|
|
||||||
|
//Clear css/remove any element
|
||||||
|
//id = id of element
|
||||||
|
BdApi.clearCSS = function(id) {
|
||||||
|
$("#"+id).remove();
|
||||||
|
};
|
||||||
|
|
||||||
|
//Get another plugin
|
||||||
|
//name = name of plugin
|
||||||
|
BdApi.getPlugin = function(name) {
|
||||||
|
if(plugins.hasOwnProperty(name)) {
|
||||||
|
return plugins[name]["plugin"];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Get ipc for reason
|
||||||
|
BdApi.getIpc = function() {
|
||||||
|
return betterDiscordIPC;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Get BetterDiscord Core
|
||||||
|
BdApi.getCore = function() {
|
||||||
|
return mainCore;
|
||||||
|
};
|
Loading…
Reference in New Issue