BetterDiscordApp-v1/v2/dist/js/main.js

165 lines
5.5 KiB
JavaScript
Raw Normal View History

(function() {
"use strict";
var electron = require("electron");
2016-11-02 06:38:32 +01:00
var src_js_modules_observermodule, src_js_modules_modules, src_js_utils, src_js_api, src_js_plugin, src_js_event, src_js_core;
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps)
defineProperties(Constructor.prototype, protoProps);
if (staticProps)
defineProperties(Constructor, staticProps);
return Constructor;
};
}();
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
2016-11-02 06:38:32 +01:00
src_js_modules_observermodule = function () {
var Observer = function () {
function Observer() {
_classCallCheck(this, Observer);
this.mutationObserver = new MutationObserver(this.observe);
this.mutationObserver.observe(document, {
childList: true,
subtree: true
});
}
_createClass(Observer, [{
key: 'observe',
value: function observe(mutations) {
mutations.forEach(function (mutation) {
BD.event.emit('raw-mutation', mutation);
});
}
}]);
return Observer;
}();
return new Observer();
}();
2016-11-02 06:38:32 +01:00
src_js_modules_modules = function (observerModule) {
var modules = { observerModule: observerModule };
return modules;
}(src_js_modules_observermodule);
src_js_utils = function () {
var Utils = function Utils() {
_classCallCheck(this, Utils);
};
return new Utils();
}();
src_js_api = function () {
var Api = function Api() {
_classCallCheck(this, Api);
};
return new Api();
}();
2016-11-02 06:38:32 +01:00
src_js_plugin = function () {
var Plugin = function () {
function Plugin(args) {
_classCallCheck(this, Plugin);
this.info = args;
}
_createClass(Plugin, [
{
key: 'author',
get: function get() {
return this.info.author;
}
},
{
key: 'name',
get: function get() {
return this.info.name;
}
},
{
key: 'version',
get: function get() {
return this.info.version;
}
}
]);
return Plugin;
}();
return Plugin;
}();
2016-11-01 04:42:15 +01:00
src_js_event = function () {
2016-11-02 06:38:32 +01:00
var EventEmitter = events.EventEmitter;
var Event = function () {
function Event() {
_classCallCheck(this, Event);
this.eventEmitter = new EventEmitter();
2016-11-01 04:42:15 +01:00
}
2016-11-02 06:38:32 +01:00
_createClass(Event, [
2016-11-01 04:42:15 +01:00
{
key: 'on',
value: function on(eventName, callback) {
2016-11-02 06:38:32 +01:00
this.eventEmitter.on(eventName, callback);
2016-11-01 04:42:15 +01:00
}
},
{
key: 'emit',
value: function emit() {
2016-11-02 06:38:32 +01:00
var _eventEmitter;
(_eventEmitter = this.eventEmitter).emit.apply(_eventEmitter, arguments);
2016-11-01 04:42:15 +01:00
}
}
]);
2016-11-02 06:38:32 +01:00
return Event;
2016-11-01 04:42:15 +01:00
}();
2016-11-02 06:38:32 +01:00
return new Event();
2016-11-01 04:42:15 +01:00
}();
src_js_core = function (modules, utils, api, plugin, event) {
var Core = function () {
function Core(args) {
_classCallCheck(this, Core);
2016-11-02 06:38:32 +01:00
console.log(event);
this.event = event;
this.modules = modules;
this.beta = true;
this.alpha = true;
2016-11-01 04:42:15 +01:00
this.plugin = plugin;
}
_createClass(Core, [
{
key: 'init',
value: function init() {
console.log('Initialized');
}
},
{
key: '__version',
get: function get() {
return '2.0.0';
}
},
{
key: '__versionString',
get: function get() {
return '' + this.__version + (this.alpha ? 'A' : this.beta ? 'B' : '');
}
}
]);
return Core;
}();
window.$B = function (s) {
return $('[data-bd=' + s);
};
2016-11-02 06:38:32 +01:00
window.BD = new Core();
2016-11-01 04:42:15 +01:00
BD.init();
2016-11-02 06:38:32 +01:00
}(src_js_modules_modules, src_js_utils, src_js_api, src_js_plugin, src_js_event);
}());