backwards support for emote plugins
This commit is contained in:
parent
d60461023d
commit
2250bf1a8e
|
@ -1 +0,0 @@
|
||||||
*.sh text=auto
|
|
|
@ -1,17 +0,0 @@
|
||||||
.idea/*
|
|
||||||
*.name
|
|
||||||
devjs/.idea/devjs.iml
|
|
||||||
*.bak
|
|
||||||
*.bak.*
|
|
||||||
*.xpi
|
|
||||||
Firefox/data/js/jquery-2.1.4.min.js
|
|
||||||
*.dev.*
|
|
||||||
/nbproject/private/
|
|
||||||
node_modules
|
|
||||||
.sass-cache
|
|
||||||
/*.jiiks
|
|
||||||
Installers/dotNet/bin/
|
|
||||||
Installers/dotNet/packages/
|
|
||||||
Installers/dotNet/dlls/
|
|
||||||
v2/dist/vendor/
|
|
||||||
v2/lib/static.js
|
|
33
js/main.js
33
js/main.js
|
@ -654,19 +654,22 @@ function EmoteModule() {}
|
||||||
EmoteModule.prototype.init = function () {
|
EmoteModule.prototype.init = function () {
|
||||||
this.modifiers = ["flip", "spin", "pulse", "spin2", "spin3", "1spin", "2spin", "3spin", "tr", "bl", "br", "shake", "shake2", "shake3", "flap"];
|
this.modifiers = ["flip", "spin", "pulse", "spin2", "spin3", "1spin", "2spin", "3spin", "tr", "bl", "br", "shake", "shake2", "shake3", "flap"];
|
||||||
this.overrides = ['twitch', 'bttv', 'ffz'];
|
this.overrides = ['twitch', 'bttv', 'ffz'];
|
||||||
this.categories = Object.keys(window.bdEmoteSettingIDs);
|
this.categories = ["TwitchGlobal", "TwitchSubscriber", "BTTV", "FrankerFaceZ", "BTTV2"];
|
||||||
|
|
||||||
let emoteInfo = {
|
let emoteInfo = {
|
||||||
'TwitchGlobal': {
|
'TwitchGlobal': {
|
||||||
url: 'https://twitchemotes.com/api_cache/v3/global.json',
|
url: 'https://twitchemotes.com/api_cache/v3/global.json',
|
||||||
backup: "https://" + bdConfig.updater.CDN + '/' + bdConfig.repo + '/BetterDiscordApp/' + bdConfig.hash + '/data/emotedata_twitch_global.json',
|
backup: "https://" + bdConfig.updater.CDN + '/' + bdConfig.repo + '/BetterDiscordApp/' + bdConfig.hash + '/data/emotedata_twitch_global.json',
|
||||||
variable: 'TwitchGlobal',
|
variable: 'TwitchGlobal',
|
||||||
getEmoteURL: (e) => `https://static-cdn.jtvnw.net/emoticons/v1/${e.id}/1.0`
|
oldVariable: 'emotesTwitch',
|
||||||
|
getEmoteURL: (e) => `https://static-cdn.jtvnw.net/emoticons/v1/${e.id}/1.0`,
|
||||||
|
getOldData: (url, name) => { return {id: url.match(/\/([0-9]+)\//)[1], code: name, emoticon_set: 0, description: null} }
|
||||||
},
|
},
|
||||||
'TwitchSubscriber': {
|
'TwitchSubscriber': {
|
||||||
url: 'https://twitchemotes.com/api_cache/v3/subscriber.json',
|
url: 'https://twitchemotes.com/api_cache/v3/subscriber.json',
|
||||||
backup: "https://" + bdConfig.updater.CDN + '/' + bdConfig.repo + '/BetterDiscordApp/' + bdConfig.hash + '/data/emotedata_twitch_subscriber.json',
|
backup: "https://" + bdConfig.updater.CDN + '/' + bdConfig.repo + '/BetterDiscordApp/' + bdConfig.hash + '/data/emotedata_twitch_subscriber.json',
|
||||||
variable: 'TwitchSubscriber',
|
variable: 'TwitchSubscriber',
|
||||||
|
oldVariable: 'subEmotesTwitch',
|
||||||
parser: (data) => {
|
parser: (data) => {
|
||||||
let emotes = {};
|
let emotes = {};
|
||||||
for (let c in data) {
|
for (let c in data) {
|
||||||
|
@ -678,16 +681,20 @@ EmoteModule.prototype.init = function () {
|
||||||
}
|
}
|
||||||
return emotes;
|
return emotes;
|
||||||
},
|
},
|
||||||
getEmoteURL: (e) => `https://static-cdn.jtvnw.net/emoticons/v1/${e}/1.0`
|
getEmoteURL: (e) => `https://static-cdn.jtvnw.net/emoticons/v1/${e}/1.0`,
|
||||||
|
getOldData: (url) => url.match(/\/([0-9]+)\//)[1]
|
||||||
},
|
},
|
||||||
'FrankerFaceZ': {
|
'FrankerFaceZ': {
|
||||||
url: "https://" + bdConfig.updater.CDN + '/' + bdConfig.repo + '/BetterDiscordApp/' + bdConfig.hash + '/data/emotedata_ffz.json',
|
url: "https://" + bdConfig.updater.CDN + '/' + bdConfig.repo + '/BetterDiscordApp/' + bdConfig.hash + '/data/emotedata_ffz.json',
|
||||||
variable: 'FrankerFaceZ',
|
variable: 'FrankerFaceZ',
|
||||||
getEmoteURL: (e) => `https://cdn.frankerfacez.com/emoticon/${e}/1`
|
oldVariable: "emotesFfz",
|
||||||
|
getEmoteURL: (e) => `https://cdn.frankerfacez.com/emoticon/${e}/1`,
|
||||||
|
getOldData: (url) => url.match(/\/([0-9]+)\//)[1]
|
||||||
},
|
},
|
||||||
'BTTV': {
|
'BTTV': {
|
||||||
url: 'https://api.betterttv.net/emotes',
|
url: 'https://api.betterttv.net/emotes',
|
||||||
variable: 'BTTV',
|
variable: 'BTTV',
|
||||||
|
oldVariable: "emotesBTTV",
|
||||||
parser: (data) => {
|
parser: (data) => {
|
||||||
let emotes = {};
|
let emotes = {};
|
||||||
for (let e = 0, len = data.emotes.length; e < len; e++) {
|
for (let e = 0, len = data.emotes.length; e < len; e++) {
|
||||||
|
@ -696,12 +703,15 @@ EmoteModule.prototype.init = function () {
|
||||||
}
|
}
|
||||||
return emotes;
|
return emotes;
|
||||||
},
|
},
|
||||||
getEmoteURL: (e) => `${e}`
|
getEmoteURL: (e) => `${e}`,
|
||||||
|
getOldData: (url) => url
|
||||||
},
|
},
|
||||||
'BTTV2': {
|
'BTTV2': {
|
||||||
url: "https://" + bdConfig.updater.CDN + '/' + bdConfig.repo + '/BetterDiscordApp/' + bdConfig.hash + '/data/emotedata_bttv.json',
|
url: "https://" + bdConfig.updater.CDN + '/' + bdConfig.repo + '/BetterDiscordApp/' + bdConfig.hash + '/data/emotedata_bttv.json',
|
||||||
variable: 'BTTV2',
|
variable: 'BTTV2',
|
||||||
getEmoteURL: (e) => `https://cdn.betterttv.net/emote/${e}/1x`
|
oldVariable: "emotesBTTV2",
|
||||||
|
getEmoteURL: (e) => `https://cdn.betterttv.net/emote/${e}/1x`,
|
||||||
|
getOldData: (url) => url.match(/emote\/(.+)\//)[1]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -742,6 +752,14 @@ EmoteModule.prototype.clearEmoteData = async function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EmoteModule.prototype.goBack = async function(emoteInfo) {
|
||||||
|
for (let e in emoteInfo) {
|
||||||
|
for (let emote in bdEmotes[emoteInfo[e].variable]) {
|
||||||
|
window[emoteInfo[e].oldVariable][emote] = emoteInfo[e].getOldData(bdEmotes[emoteInfo[e].variable][emote], emote)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EmoteModule.prototype.loadEmoteData = async function(emoteInfo) {
|
EmoteModule.prototype.loadEmoteData = async function(emoteInfo) {
|
||||||
let _fs = require("fs");
|
let _fs = require("fs");
|
||||||
let emoteFile = "emote_data.json";
|
let emoteFile = "emote_data.json";
|
||||||
|
@ -763,6 +781,7 @@ EmoteModule.prototype.loadEmoteData = async function(emoteInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
|
await this.goBack(emoteInfo)
|
||||||
mainCore.showToast("Emotes successfully loaded.", {type: "success"})
|
mainCore.showToast("Emotes successfully loaded.", {type: "success"})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -778,6 +797,8 @@ EmoteModule.prototype.loadEmoteData = async function(emoteInfo) {
|
||||||
bdEmotes[emoteInfo[e].variable] = data;
|
bdEmotes[emoteInfo[e].variable] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await this.goBack(emoteInfo)
|
||||||
|
|
||||||
mainCore.showToast("All emotes successfully downloaded.", {type: "success"});
|
mainCore.showToast("All emotes successfully downloaded.", {type: "success"});
|
||||||
|
|
||||||
try { _fs.writeFileSync(file, JSON.stringify(bdEmotes), "utf8"); }
|
try { _fs.writeFileSync(file, JSON.stringify(bdEmotes), "utf8"); }
|
||||||
|
|
File diff suppressed because one or more lines are too long
13
package.json
13
package.json
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
"name": "betterdiscord",
|
|
||||||
"description": "Better Discord enhances Discord.",
|
|
||||||
"version": "0.2.7",
|
|
||||||
"homepage": "https://github.com/Jiiks/BetterDiscordApp",
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "betterdiscord.js",
|
|
||||||
"devDependencies": {
|
|
||||||
"grunt-contrib-concat": "^1.0.0",
|
|
||||||
"grunt-contrib-sass": "^1.0.0",
|
|
||||||
"grunt-contrib-uglify": "^1.0.1"
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue