Support for twitchemotes v3 api
This commit is contained in:
parent
1d07436569
commit
9ab77a8217
18
js/main.js
18
js/main.js
|
@ -540,10 +540,8 @@ Core.prototype.alert = function (title, text) {
|
|||
var emotesFfz = {};
|
||||
var emotesBTTV = {};
|
||||
var emotesTwitch = {
|
||||
"emotes": {
|
||||
"emote": {
|
||||
"image_id": 0
|
||||
}
|
||||
"emote": {
|
||||
"id": 0
|
||||
}
|
||||
}; //for ide
|
||||
var subEmotesTwitch = {};
|
||||
|
@ -673,9 +671,9 @@ EmoteModule.prototype.injectEmote = function(node) {
|
|||
if ($.inArray(sw, bemotes) == -1) {
|
||||
|
||||
if(typeof emotesTwitch !== 'undefined' && settingsCookie["bda-es-7"]) {
|
||||
if(emotesTwitch.emotes.hasOwnProperty(sw) && sw.length >= 4) {
|
||||
if(emotesTwitch.hasOwnProperty(sw) && sw.length >= 4) {
|
||||
if(text != null) { contents.splice(i + splice++, 0, document.createTextNode(text)); text = null;}
|
||||
var url = twitchEmoteUrlStart + emotesTwitch.emotes[sw].image_id + twitchEmoteUrlEnd;
|
||||
var url = twitchEmoteUrlStart + emotesTwitch[sw].id + twitchEmoteUrlEnd;
|
||||
contents.splice(i + splice++, 0, self.createEmoteElement(sw, url, emoteClass));
|
||||
doInject = true;
|
||||
return;
|
||||
|
@ -783,7 +781,7 @@ EmoteModule.prototype.autoCapitalize = function () {
|
|||
};
|
||||
|
||||
EmoteModule.prototype.capitalize = function (value) {
|
||||
var res = emotesTwitch.emotes;
|
||||
var res = emotesTwitch;
|
||||
for (var p in res) {
|
||||
if (res.hasOwnProperty(p) && value == (p + '').toLowerCase()) {
|
||||
return p;
|
||||
|
@ -1304,9 +1302,9 @@ QuickEmoteMenu.prototype.init = function() {
|
|||
teContainer += " <div class=\"scroller-wrap fade\">";
|
||||
teContainer += " <div class=\"scroller\">";
|
||||
teContainer += " <div class=\"emote-menu-inner\">";
|
||||
for (var emote in emotesTwitch.emotes) {
|
||||
if (emotesTwitch.emotes.hasOwnProperty(emote)) {
|
||||
var id = emotesTwitch.emotes[emote].image_id;
|
||||
for (var emote in emotesTwitch) {
|
||||
if (emotesTwitch.hasOwnProperty(emote)) {
|
||||
var id = emotesTwitch[emote].id;
|
||||
teContainer += "<div class=\"emote-container\">";
|
||||
teContainer += " <img class=\"emote-icon\" id=\""+emote+"\" alt=\"\" src=\"https://static-cdn.jtvnw.net/emoticons/v1/"+id+"/1.0\" title=\""+emote+"\">";
|
||||
teContainer += " </img>";
|
||||
|
|
|
@ -18,13 +18,13 @@ changeLog+='</ul>';}
|
|||
if(bdchangelog.upcoming!=null){changeLog+=''+'<h1 class="changelog-in-progress">'+' <span>Coming Soon</span>'+'</h1>'+'<ul>';for(var upc in bdchangelog.upcoming){upc=bdchangelog.upcoming[upc];changeLog+=''+'<li>'+' <strong>'+upc.title+'</strong>'+' <div>'+upc.text+'</div>'+'</li>';}
|
||||
changeLog+='</ul>';}
|
||||
changeLog+=''+' </div><!--scoller-->'+' </div><!--scroller-wrap-->'+' <div class="footer">'+' </div><!--footer-->'+' </div><!--change-log-->'+' </div><!--modal-inner-->'+'</div><!--modal-->';return changeLog;};Core.prototype.alert=function(title,text){var id='';for(var i=0;i<5;i++)
|
||||
id+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".length));var bdAlert=' <div id="bda-alert-'+id+'" class="modal bda-alert" style="opacity:1" data-bdalert="'+id+'"> <div class="modal-inner" style="box-shadow:0 0 8px -2px #000;"> <div class="markdown-modal"> <div class="markdown-modal-header"> <strong style="float:left"><span>BetterDiscord - </span><span>'+title+'</span></strong> <span></span> <button class="markdown-modal-close" onclick=\'document.getElementById("bda-alert-'+id+'").remove(); utils.removeBackdrop("'+id+'");\'></button> </div> <div class="scroller-wrap fade"> <div style="font-weight:700" class="scroller">'+text+'</div> </div> <div class="markdown-modal-footer"> <span style="float:right"> for support.</span> <a style="float:right" href="https://discord.gg/0Tmfo5ZbOR9NxvDd" target="_blank">#support</a> <span style="float:right">Join </span> </div> </div> </div> </div> ';$("body").append(bdAlert);utils.addBackdrop(id);};var emotesFfz={};var emotesBTTV={};var emotesTwitch={"emotes":{"emote":{"image_id":0}}};var subEmotesTwitch={};function EmoteModule(){}
|
||||
id+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".length));var bdAlert=' <div id="bda-alert-'+id+'" class="modal bda-alert" style="opacity:1" data-bdalert="'+id+'"> <div class="modal-inner" style="box-shadow:0 0 8px -2px #000;"> <div class="markdown-modal"> <div class="markdown-modal-header"> <strong style="float:left"><span>BetterDiscord - </span><span>'+title+'</span></strong> <span></span> <button class="markdown-modal-close" onclick=\'document.getElementById("bda-alert-'+id+'").remove(); utils.removeBackdrop("'+id+'");\'></button> </div> <div class="scroller-wrap fade"> <div style="font-weight:700" class="scroller">'+text+'</div> </div> <div class="markdown-modal-footer"> <span style="float:right"> for support.</span> <a style="float:right" href="https://discord.gg/0Tmfo5ZbOR9NxvDd" target="_blank">#support</a> <span style="float:right">Join </span> </div> </div> </div> </div> ';$("body").append(bdAlert);utils.addBackdrop(id);};var emotesFfz={};var emotesBTTV={};var emotesTwitch={"emote":{"id":0}};var subEmotesTwitch={};function EmoteModule(){}
|
||||
EmoteModule.prototype.init=function(){};EmoteModule.prototype.getBlacklist=function(){$.getJSON("https://cdn.rawgit.com/Jiiks/betterDiscordApp/"+_hash+"/data/emotefilter.json",function(data){bemotes=data.blacklist;});};EmoteModule.prototype.obsCallback=function(mutation){var self=this;for(var i=0;i<mutation.addedNodes.length;++i){var next=mutation.addedNodes.item(i);if(next){var nodes=self.getNodes(next);for(var node in nodes){if(nodes.hasOwnProperty(node)){var elem=nodes[node].parentElement;if(elem&&elem.classList.contains('edited')){self.injectEmote(elem);}else{self.injectEmote(nodes[node]);}}}}}};EmoteModule.prototype.getNodes=function(node){var next;var nodes=[];var treeWalker=document.createTreeWalker(node,NodeFilter.SHOW_TEXT,null,false);while(next=treeWalker.nextNode()){nodes.push(next);}
|
||||
return nodes;};var bemotes=[];var spoilered=[];EmoteModule.prototype.injectEmote=function(node){var self=this;if(!node.parentElement)return;var parent=$(node).parent();if(!parent.hasClass("markup")&&!parent.hasClass("message-content"))return;function inject(){var contents=parent.contents();contents.each(function(i){if(contents[i]==undefined)return;var nodeValue=contents[i].nodeValue;if(nodeValue==null)return;if(contents[i].nodeType==8)return;contents.splice(i,1);var words=nodeValue.split(/([^\s]+)([\s]|$)/g).filter(function(e){return e});var splice=0;var doInject=false;var text=null;words.forEach(function(w,index,a){if(w.indexOf("[!s]")>-1){w=w.replace("[!s]","");parent.data("spoilered",false);parent.addClass("spoiler");}
|
||||
var allowedClasses=["flip","spin","pulse","spin2","spin3","1spin","2spin","3spin","tr","bl","br","shake","shake2","shake3","flap"];var useEmoteClass=false;var emoteClass="";var skipffz=false;var sw=w;if(w.indexOf(":")>-1){var split=w.split(":");if(split[0]!=""&&split[1]!=""){if(allowedClasses.indexOf(split[1])>-1){sw=split[0];emoteClass=settingsCookie["bda-es-8"]?"emote"+split[1]:"";}
|
||||
if(split[1]=="bttv"){sw=split[0];skipffz=true;}}}
|
||||
if($.inArray(sw,bemotes)==-1){if(typeof emotesTwitch!=='undefined'&&settingsCookie["bda-es-7"]){if(emotesTwitch.emotes.hasOwnProperty(sw)&&sw.length>=4){if(text!=null){contents.splice(i+splice++,0,document.createTextNode(text));text=null;}
|
||||
var url=twitchEmoteUrlStart+emotesTwitch.emotes[sw].image_id+twitchEmoteUrlEnd;contents.splice(i+splice++,0,self.createEmoteElement(sw,url,emoteClass));doInject=true;return;}}
|
||||
if($.inArray(sw,bemotes)==-1){if(typeof emotesTwitch!=='undefined'&&settingsCookie["bda-es-7"]){if(emotesTwitch.hasOwnProperty(sw)&&sw.length>=4){if(text!=null){contents.splice(i+splice++,0,document.createTextNode(text));text=null;}
|
||||
var url=twitchEmoteUrlStart+emotesTwitch[sw].id+twitchEmoteUrlEnd;contents.splice(i+splice++,0,self.createEmoteElement(sw,url,emoteClass));doInject=true;return;}}
|
||||
if(typeof subEmotesTwitch!=='undefined'&&settingsCookie["bda-es-7"]){if(subEmotesTwitch.hasOwnProperty(sw)&&sw.length>=4){if(text!=null){contents.splice(i+splice++,0,document.createTextNode(text));text=null;}
|
||||
var url=twitchEmoteUrlStart+subEmotesTwitch[sw]+twitchEmoteUrlEnd;contents.splice(i+splice++,0,self.createEmoteElement(sw,url,emoteClass));doInject=true;return;}}
|
||||
if(typeof emotesBTTV!=='undefined'&&settingsCookie["bda-es-2"]){if(emotesBTTV.hasOwnProperty(sw)&&sw.length>=4){if(text!=null){contents.splice(i+splice++,0,document.createTextNode(text));text=null;}
|
||||
|
@ -35,7 +35,7 @@ if(typeof emotesBTTV2!=='undefined'&&settingsCookie["bda-es-2"]){if(emotesBTTV2.
|
|||
var url=bttvEmoteUrlStart+emotesBTTV2[sw]+bttvEmoteUrlEnd;if(skipffz&&emotesFfz.hasOwnProperty(sw))sw=sw+":bttv";contents.splice(i+splice++,0,self.createEmoteElement(sw,url,emoteClass));doInject=true;return;}}}
|
||||
if(text==null){text=w;}else{text+=""+w;}
|
||||
if(index===a.length-1){contents.splice(i+splice,0,document.createTextNode(text));}});if(doInject){var oldHeight=parent.outerHeight();parent.html(contents);var scrollPane=$(".scroller.messages").first();scrollPane.scrollTop(scrollPane.scrollTop()+(parent.outerHeight()-oldHeight));}});}
|
||||
inject();if(parent.children().hasClass("edited")){setTimeout(inject,250);}};EmoteModule.prototype.createEmoteElement=function(word,url,mod){var len=Math.round(word.length / 4);var name=word.substr(0,len)+"\uFDD9"+word.substr(len,len)+"\uFDD9"+word.substr(len*2,len)+"\uFDD9"+word.substr(len*3);var html='<span class="emotewrapper"><img draggable="false" style="max-height:32px;" class="emote '+mod+'" alt="'+name+'" src="'+url+'"/><input onclick=\'quickEmoteMenu.favorite(\"'+name+'\", \"'+url+'\");\' class="fav" title="Favorite!" type="button"></span>';return $.parseHTML(html.replace(new RegExp("\uFDD9","g"),""))[0];};EmoteModule.prototype.autoCapitalize=function(){var self=this;$('body').delegate($(".channel-text-area-default textarea:first"),'keyup change paste',function(){if(!settingsCookie["bda-es-4"])return;var text=$(".channel-text-area-default textarea:first").val();if(text==undefined)return;var lastWord=text.split(" ").pop();if(lastWord.length>3){if(lastWord=="danSgame")return;var ret=self.capitalize(lastWord.toLowerCase());if(ret!==null&&ret!==undefined){$(".channel-text-area-default textarea:first").val(text.replace(lastWord,ret));}}});};EmoteModule.prototype.capitalize=function(value){var res=emotesTwitch.emotes;for(var p in res){if(res.hasOwnProperty(p)&&value==(p+'').toLowerCase()){return p;}}};class PublicServers{constructor(){this.v2p=new V2_PublicServers();}
|
||||
inject();if(parent.children().hasClass("edited")){setTimeout(inject,250);}};EmoteModule.prototype.createEmoteElement=function(word,url,mod){var len=Math.round(word.length / 4);var name=word.substr(0,len)+"\uFDD9"+word.substr(len,len)+"\uFDD9"+word.substr(len*2,len)+"\uFDD9"+word.substr(len*3);var html='<span class="emotewrapper"><img draggable="false" style="max-height:32px;" class="emote '+mod+'" alt="'+name+'" src="'+url+'"/><input onclick=\'quickEmoteMenu.favorite(\"'+name+'\", \"'+url+'\");\' class="fav" title="Favorite!" type="button"></span>';return $.parseHTML(html.replace(new RegExp("\uFDD9","g"),""))[0];};EmoteModule.prototype.autoCapitalize=function(){var self=this;$('body').delegate($(".channel-text-area-default textarea:first"),'keyup change paste',function(){if(!settingsCookie["bda-es-4"])return;var text=$(".channel-text-area-default textarea:first").val();if(text==undefined)return;var lastWord=text.split(" ").pop();if(lastWord.length>3){if(lastWord=="danSgame")return;var ret=self.capitalize(lastWord.toLowerCase());if(ret!==null&&ret!==undefined){$(".channel-text-area-default textarea:first").val(text.replace(lastWord,ret));}}});};EmoteModule.prototype.capitalize=function(value){var res=emotesTwitch;for(var p in res){if(res.hasOwnProperty(p)&&value==(p+'').toLowerCase()){return p;}}};class PublicServers{constructor(){this.v2p=new V2_PublicServers();}
|
||||
get endPoint(){return'https://search.discordservers.com';}
|
||||
get button(){let self=this;let btn=$("<div/>",{class:'guild',id:'bd-pub-li',css:{'height':'20px','display':settingsCookie['bda-gs-1']?"":"none"}}).append($("<div/>",{class:'guild-inner',css:{'height':'20px','border-radius':'4px'}}).append($("<a/>",{}).append($("<div/>",{text:'public',id:'bd-pub-button',css:{'line-height':'20px','font-size':'12px'},click:()=>{self.v2p.render();}}))));return btn;}
|
||||
init(){let self=this;let guilds=$(".guilds>:first-child");guilds.after(self.button);}
|
||||
|
@ -60,7 +60,7 @@ escape(unsafe){console.log("pubs escape");}
|
|||
query(params){return require('querystring').stringify(params);}}
|
||||
function QuickEmoteMenu(){}
|
||||
QuickEmoteMenu.prototype.init=function(){$(document).on("mousedown",function(e){if(e.target.id!="rmenu")$("#rmenu").remove();});this.favoriteEmotes={};var fe=bdStorage.get("bdfavemotes");if(fe!==""&&fe!==null){this.favoriteEmotes=JSON.parse(atob(fe));}
|
||||
var qmeHeader="";qmeHeader+="<div id=\"bda-qem\">";qmeHeader+=" <button class=\"active\" id=\"bda-qem-twitch\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Twitch<\/button>";qmeHeader+=" <button id=\"bda-qem-favourite\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Favourite<\/button>";qmeHeader+=" <button id=\"bda-qem-emojis\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Emojis<\/buttond>";qmeHeader+="<\/div>";this.qmeHeader=qmeHeader;var teContainer="";teContainer+="<div id=\"bda-qem-twitch-container\">";teContainer+=" <div class=\"scroller-wrap fade\">";teContainer+=" <div class=\"scroller\">";teContainer+=" <div class=\"emote-menu-inner\">";for(var emote in emotesTwitch.emotes){if(emotesTwitch.emotes.hasOwnProperty(emote)){var id=emotesTwitch.emotes[emote].image_id;teContainer+="<div class=\"emote-container\">";teContainer+=" <img class=\"emote-icon\" id=\""+emote+"\" alt=\"\" src=\"https://static-cdn.jtvnw.net/emoticons/v1/"+id+"/1.0\" title=\""+emote+"\">";teContainer+=" </img>";teContainer+="</div>";}}
|
||||
var qmeHeader="";qmeHeader+="<div id=\"bda-qem\">";qmeHeader+=" <button class=\"active\" id=\"bda-qem-twitch\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Twitch<\/button>";qmeHeader+=" <button id=\"bda-qem-favourite\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Favourite<\/button>";qmeHeader+=" <button id=\"bda-qem-emojis\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Emojis<\/buttond>";qmeHeader+="<\/div>";this.qmeHeader=qmeHeader;var teContainer="";teContainer+="<div id=\"bda-qem-twitch-container\">";teContainer+=" <div class=\"scroller-wrap fade\">";teContainer+=" <div class=\"scroller\">";teContainer+=" <div class=\"emote-menu-inner\">";for(var emote in emotesTwitch){if(emotesTwitch.hasOwnProperty(emote)){var id=emotesTwitch[emote].id;teContainer+="<div class=\"emote-container\">";teContainer+=" <img class=\"emote-icon\" id=\""+emote+"\" alt=\"\" src=\"https://static-cdn.jtvnw.net/emoticons/v1/"+id+"/1.0\" title=\""+emote+"\">";teContainer+=" </img>";teContainer+="</div>";}}
|
||||
teContainer+=" <\/div>";teContainer+=" <\/div>";teContainer+=" <\/div>";teContainer+="<\/div>";this.teContainer=teContainer;var faContainer="";faContainer+="<div id=\"bda-qem-favourite-container\">";faContainer+=" <div class=\"scroller-wrap fade\">";faContainer+=" <div class=\"scroller\">";faContainer+=" <div class=\"emote-menu-inner\">";for(var emote in this.favoriteEmotes){var url=this.favoriteEmotes[emote];faContainer+="<div class=\"emote-container\">";faContainer+=" <img class=\"emote-icon\" alt=\"\" src=\""+url+"\" title=\""+emote+"\" oncontextmenu='quickEmoteMenu.favContext(event, this);'>";faContainer+=" </img>";faContainer+="</div>";}
|
||||
faContainer+=" <\/div>";faContainer+=" <\/div>";faContainer+=" <\/div>";faContainer+="<\/div>";this.faContainer=faContainer;};QuickEmoteMenu.prototype.favContext=function(e,em){e.stopPropagation();var menu=$('<div/>',{id:"rmenu","data-emoteid":$(em).prop("title"),text:"Remove"});menu.css({top:e.pageY-$("#bda-qem-favourite-container").offset().top,left:e.pageX-$("#bda-qem-favourite-container").offset().left});$(em).parent().append(menu);menu.on("click",function(e){e.preventDefault();e.stopPropagation();$(this).remove();delete quickEmoteMenu.favoriteEmotes[$(this).data("emoteid")];quickEmoteMenu.updateFavorites();return false;});return false;};QuickEmoteMenu.prototype.switchHandler=function(e){this.switchQem($(e).attr("id"));};QuickEmoteMenu.prototype.switchQem=function(id){var twitch=$("#bda-qem-twitch");var fav=$("#bda-qem-favourite");var emojis=$("#bda-qem-emojis");twitch.removeClass("active");fav.removeClass("active");emojis.removeClass("active");$(".emoji-picker").hide();$("#bda-qem-favourite-container").hide();$("#bda-qem-twitch-container").hide();switch(id){case"bda-qem-twitch":twitch.addClass("active");$("#bda-qem-twitch-container").show();break;case"bda-qem-favourite":fav.addClass("active");$("#bda-qem-favourite-container").show();break;case"bda-qem-emojis":emojis.addClass("active");$(".emoji-picker").show();break;}
|
||||
this.lastTab=id;var emoteIcon=$(".emote-icon");emoteIcon.off();emoteIcon.on("click",function(){var emote=$(this).attr("title");var ta=$(".channel-text-area-default textarea");ta.val(ta.val().slice(-1)==" "?ta.val()+emote:ta.val()+" "+emote);});};QuickEmoteMenu.prototype.obsCallback=function(e){if(!settingsCookie["bda-es-9"]){e.addClass("bda-qme-hidden");}else{e.removeClass("bda-qme-hidden");}
|
||||
|
@ -342,4 +342,4 @@ BDV2.reactDom.render(this.customCssComponent,root);}
|
|||
renderPluginPane(){let root=this.root;if(!root){console.log("FAILED TO LOCATE ROOT: .layer .ui-standard-sidebar-view");return;}
|
||||
BDV2.reactDom.render(this.pluginsComponent,root);}
|
||||
renderThemePane(){let root=this.root;if(!root){console.log("FAILED TO LOCATE ROOT: .layer .ui-standard-sidebar-view");return;}
|
||||
BDV2.reactDom.render(this.themesComponent,root);}}
|
||||
BDV2.reactDom.render(this.themesComponent,root);}}
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
var _fs = require("fs");
|
||||
var _config = require("./config.json");
|
||||
var _utils;
|
||||
var _utils = require("./utils");
|
||||
var _utils2;
|
||||
var _bdIpc = require('electron').ipcMain;
|
||||
var _error = false;
|
||||
|
@ -34,9 +34,9 @@ bdPluginStorage.defaults = {
|
|||
};
|
||||
|
||||
function initStorage() {
|
||||
if(!_fs.existsSync(_cfg.dataPath + "/bdStorage.json")) {
|
||||
if(!_fs.existsSync(_cfg.dataPath + "/bdstorage.json")) {
|
||||
bdStorage.data = bdStorage.defaults.data;
|
||||
_fs.writeFileSync(_cfg.dataPath + "/bdStorage.json", JSON.stringify(bdStorage, null, 4));
|
||||
_fs.writeFileSync(_cfg.dataPath + "/bdstorage.json", JSON.stringify(bdStorage, null, 4));
|
||||
} else {
|
||||
bdStorage.data = JSON.parse(_fs.readFileSync(_cfg.dataPath + "/bdStorage.json"));
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ bdStorage.get = function(i, m, pn) {
|
|||
bdStorage.set = function(i, v, m, pn) {
|
||||
if(m) {
|
||||
bdStorage.data[i] = v;
|
||||
_fs.writeFileSync(_cfg.dataPath + "/bdStorage.json", JSON.stringify(bdStorage.data, null, 4));
|
||||
_fs.writeFileSync(_cfg.dataPath + "/bdstorage.json", JSON.stringify(bdStorage.data, null, 4));
|
||||
} else {
|
||||
if(bdPluginStorage[pn] === undefined) bdPluginStorage[pn] = {};
|
||||
bdPluginStorage[pn][i] = v;
|
||||
|
@ -79,7 +79,6 @@ function BetterDiscord(mainWindow) {
|
|||
_cfg = _config.cfg;
|
||||
_cfg.version = _config.Core.Version;
|
||||
_cfg.os = process.platform;
|
||||
_utils = _cfg.os == "linux" ? require("./Utils") : require("./utils");
|
||||
_utils2 = new _utils.Utils(mainWindow);
|
||||
hook();
|
||||
createAndCheckData();
|
||||
|
@ -88,7 +87,7 @@ function BetterDiscord(mainWindow) {
|
|||
function createAndCheckData() {
|
||||
getUtils().log("Checking data/cache");
|
||||
|
||||
_cfg.dataPath = (_cfg.os == 'win32' ? process.env.APPDATA : _cfg.os == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + '/.config') + '/BetterDiscord/';
|
||||
_cfg.dataPath = (_cfg.os == 'win32' ? process.env.APPDATA : _cfg.os == 'darwin' ? process.env.HOME + '/Library/Preferences' : '/var/local') + '/BetterDiscord/';
|
||||
_cfg.userFile = _cfg.dataPath + 'user.json';
|
||||
|
||||
try {
|
||||
|
@ -228,7 +227,7 @@ function updateExtData() {
|
|||
'type': 'javascript',
|
||||
'resource': 'Main JS',
|
||||
'domain': _cfg.updater.CDN,
|
||||
'url': '//' + _cfg.updater.CDN + '/' + _cfg.repo + '/BetterDiscordApp/' + _cfg.hash + '/js/main.js',
|
||||
'url': '//' + _cfg.updater.CDN + '/' + _cfg.repo + '/BetterDiscordApp/' + _cfg.hash + '/js/main.min.js',
|
||||
'localurl': _cfg.localServer + '/BetterDiscordApp/js/main.js?v=1.1',
|
||||
'message': 'load-emoteData-twitchGlobal',
|
||||
'cacheable': false,
|
||||
|
@ -248,7 +247,7 @@ function updateExtData() {
|
|||
'type': 'emotedata',
|
||||
'resource': 'Twitch Global Emotedata',
|
||||
'domain': 'twitchemotes.com',
|
||||
'url': '/api_cache/v2/global.json',
|
||||
'url': '/api_cache/v3/global.json',
|
||||
'localurl': null,
|
||||
'message': 'load-emoteData-twitchSub',
|
||||
'cacheable': true,
|
||||
|
@ -282,7 +281,7 @@ function updateExtData() {
|
|||
'type': 'emotedata',
|
||||
'resource': 'Twitch Subscriber Emotedata',
|
||||
'domain': 'twitchemotes.com',
|
||||
'url': '/api_cache/v2/subscriber.json',
|
||||
'url': '/api_cache/v3/subscriber.json',
|
||||
'localurl': null,
|
||||
'message': 'load-emoteData-ffz',
|
||||
'cacheable': true,
|
||||
|
@ -780,12 +779,12 @@ function parseEmoteData(extData, data) {
|
|||
|
||||
data = JSON.parse(data);
|
||||
|
||||
var channels = data["channels"];
|
||||
var channels = data;
|
||||
for(var channel in channels) {
|
||||
var emotes = channels[channel]["emotes"];
|
||||
for(var i = 0 ; i < emotes.length ; i++) {
|
||||
var code = emotes[i]["code"];
|
||||
var id = emotes[i]["image_id"];
|
||||
var id = emotes[i]["id"];
|
||||
returnData[code] = id;
|
||||
}
|
||||
}
|
||||
|
@ -834,4 +833,4 @@ function exit(reason) {
|
|||
|
||||
BetterDiscord.prototype.init = function() {}//Compatibility
|
||||
|
||||
exports.BetterDiscord = BetterDiscord;
|
||||
exports.BetterDiscord = BetterDiscord;
|
Loading…
Reference in New Issue