2015-08-27 15:46:53 +02:00
/ * B e t t e r D i s c o r d A p p C o r e J a v a S c r i p t
2015-12-01 14:55:27 +01:00
* Version : 1.52
2015-08-27 15:46:53 +02:00
* Author : Jiiks | http : //jiiks.net
* Date : 27 / 08 / 2015 - 16 : 36
2015-10-26 06:27:55 +01:00
* Last Update : 24 / 010 / 2015 - 17 : 27
2015-08-27 15:46:53 +02:00
* https : //github.com/Jiiks/BetterDiscordApp
* /
2015-10-26 06:27:55 +01:00
2015-12-15 08:37:15 +01:00
var settingsPanel , emoteModule , utils , quickEmoteMenu , opublicServers , voiceMode , pluginModule , themeModule ;
2015-12-14 07:12:07 +01:00
var jsVersion = 1.54 ;
2015-12-11 10:21:16 +01:00
var supportedVersion = "0.2.3" ;
2015-08-29 11:36:47 +02:00
var mainObserver ;
2015-08-27 15:46:53 +02:00
var twitchEmoteUrlStart = "https://static-cdn.jtvnw.net/emoticons/v1/" ;
var twitchEmoteUrlEnd = "/1.0" ;
var ffzEmoteUrlStart = "https://cdn.frankerfacez.com/emoticon/" ;
var ffzEmoteUrlEnd = "/1" ;
2015-12-10 04:01:24 +01:00
var bttvEmoteUrlStart = "https://cdn.betterttv.net/emote/" ;
var bttvEmoteUrlEnd = "/1x" ;
2015-08-27 15:46:53 +02:00
2015-10-26 06:27:55 +01:00
var mainCore ;
2015-08-27 15:46:53 +02:00
2015-08-29 11:36:47 +02:00
var settings = {
2015-11-29 18:21:58 +01:00
"Save logs locally" : { "id" : "bda-gs-0" , "info" : "Saves chat logs locally" , "implemented" : false } ,
"Public Servers" : { "id" : "bda-gs-1" , "info" : "Display public servers button" , "implemented" : true } ,
"Minimal Mode" : { "id" : "bda-gs-2" , "info" : "Hide elements and reduce the size of elements." , "implemented" : true } ,
"Voice Mode" : { "id" : "bda-gs-4" , "info" : "Only show voice chat" , "implemented" : true } ,
"Hide Channels" : { "id" : "bda-gs-3" , "info" : "Hide channels in minimal mode" , "implemented" : true } ,
"Quick Emote Menu" : { "id" : "bda-es-0" , "info" : "Show quick emote menu for adding emotes" , "implemented" : true } ,
"Show Emotes" : { "id" : "bda-es-7" , "info" : "Show any emotes" , "implemented" : true } ,
"FrankerFaceZ Emotes" : { "id" : "bda-es-1" , "info" : "Show FrankerFaceZ Emotes" , "implemented" : true } ,
"BetterTTV Emotes" : { "id" : "bda-es-2" , "info" : "Show BetterTTV Emotes" , "implemented" : true } ,
"Emote Autocomplete" : { "id" : "bda-es-3" , "info" : "Autocomplete emote commands" , "implemented" : false } ,
"Emote Auto Capitalization" : { "id" : "bda-es-4" , "info" : "Autocapitalize emote commands" , "implemented" : true } ,
"Override Default Emotes" : { "id" : "bda-es-5" , "info" : "Override default emotes" , "implemented" : false } ,
"Show Names" : { "id" : "bda-es-6" , "info" : "Show emote names on hover" , "implemented" : true }
2015-12-12 17:29:06 +01:00
}
2015-08-29 11:36:47 +02:00
2015-11-27 01:14:33 +01:00
var links = {
"Jiiks.net" : { "text" : "Jiiks.net" , "href" : "http://jiiks.net" , "target" : "_blank" } ,
"twitter" : { "text" : "Twitter" , "href" : "http://twitter.com/jiiksi" , "target" : "_blank" } ,
"github" : { "text" : "Github" , "href" : "http://github.com/jiiks" , "target" : "_blank" }
} ;
2015-08-29 11:36:47 +02:00
var defaultCookie = {
2015-11-29 18:21:58 +01:00
"version" : jsVersion ,
"bda-gs-0" : false ,
"bda-gs-1" : true ,
"bda-gs-2" : false ,
"bda-gs-3" : false ,
"bda-gs-4" : false ,
"bda-es-0" : true ,
"bda-es-1" : false ,
"bda-es-2" : false ,
"bda-es-3" : false ,
"bda-es-4" : false ,
"bda-es-5" : true ,
"bda-es-6" : true ,
"bda-es-7" : true ,
"bda-jd" : true
} ;
var bdchangelog = {
2015-12-11 10:21:16 +01:00
"changes" : {
2015-12-14 07:12:07 +01:00
"favemotes" : {
"title" : "Favorite Emotes!" ,
"text" : "You can now favorite emotes and have them listed in the quick emote menu!" ,
"img" : ""
} ,
2015-12-11 10:21:16 +01:00
"plugins" : {
"title" : "Plugins!" ,
2015-12-12 10:24:23 +01:00
"text" : "Combined with Core 0.2.3, you can now write JavaScript plugins for Discord!" ,
2015-12-11 10:21:16 +01:00
"img" : ""
2015-12-12 09:35:14 +01:00
} ,
"settingsmenu" : {
2015-12-12 09:50:25 +01:00
"title" : "Settings Menu!" ,
2015-12-12 09:35:14 +01:00
"text" : "New and improved settings menu!" ,
"img" : ""
} ,
"csseditor" : {
2015-12-12 09:50:25 +01:00
"title" : "New CSS Editor!" ,
"text" : "New CSS Editor powered by <a href='http://codemirror.net' target='_blank'>CodeMirror!</a>" ,
2015-12-12 09:35:14 +01:00
"img" : ""
} ,
2015-12-12 10:24:23 +01:00
"minimalmode" : {
"title" : "Minimal mode makeover!" ,
"text" : "New and improved minimal mode!" ,
"img" : ""
}
2015-12-11 10:21:16 +01:00
} ,
2015-12-01 14:55:27 +01:00
"fixes" : {
2015-12-12 09:35:14 +01:00
"reload" : {
2015-12-12 09:50:25 +01:00
"title" : "Reload Fix!" ,
"text" : "Fixed an issue that caused Discord to crash on reload!" ,
2015-12-12 09:35:14 +01:00
"img" : ""
} ,
2015-12-11 10:21:16 +01:00
"eemotes" : {
"title" : "Edit Emotes!" ,
"text" : "Edited messages now display emotes properly!" ,
2015-12-01 14:55:27 +01:00
"img" : ""
2015-12-12 09:36:26 +01:00
} ,
"pservers" : {
"title" : "Public Servers" ,
"text" : "Public servers have been fixed!" ,
"img" : ""
} ,
"other" : {
2015-12-12 09:50:25 +01:00
"title" : "Bugfixes!" ,
"text" : "Several smaller bugs fixed!" ,
2015-12-12 09:36:26 +01:00
"img" : ""
}
2015-12-01 14:55:27 +01:00
} ,
2015-11-29 18:21:58 +01:00
"upcoming" : {
"ignore" : {
"title" : "Ignore User!" ,
2015-12-12 09:50:25 +01:00
"text" : "Ignore users you don't like!" ,
2015-11-29 18:21:58 +01:00
"img" : ""
} ,
2015-12-12 10:24:23 +01:00
"themes" : {
"title" : "Custom themes!" ,
"text" : "Write your own or download custom themes!" ,
"img" : ""
} ,
"favemotes" : {
"title" : "Favorite emotes!" ,
"text" : "Add your favorite emote(s) to the quick emote menu!" ,
"img" : ""
} ,
2015-11-29 18:21:58 +01:00
"more" : {
"title" : "More Things!" ,
2015-12-12 09:50:25 +01:00
"text" : "More things but probably not in the next version!" ,
2015-11-29 18:21:58 +01:00
"img" : ""
}
}
2015-08-29 11:36:47 +02:00
} ;
var settingsCookie = { } ;
2015-08-27 15:46:53 +02:00
2015-10-26 06:27:55 +01:00
function Core ( ) { }
2015-08-27 15:46:53 +02:00
2015-10-26 06:27:55 +01:00
Core . prototype . init = function ( ) {
2015-08-27 15:46:53 +02:00
2015-11-27 11:07:59 +01:00
var self = this ;
2015-10-26 06:27:55 +01:00
if ( version < supportedVersion ) {
2015-12-12 09:50:25 +01:00
alert ( "BetterDiscord v" + version + "(your version)" + " is not supported by the latest js(" + jsVersion + "). Please download the latest version from betterdiscord.net" ) ;
2015-10-26 06:27:55 +01:00
return ;
}
2015-08-29 11:36:47 +02:00
2015-08-27 15:46:53 +02:00
utils = new Utils ( ) ;
2015-11-01 12:37:04 +01:00
utils . getHash ( ) ;
2015-08-27 15:46:53 +02:00
emoteModule = new EmoteModule ( ) ;
quickEmoteMenu = new QuickEmoteMenu ( ) ;
2015-10-26 06:27:55 +01:00
voiceMode = new VoiceMode ( ) ;
2015-08-27 15:46:53 +02:00
emoteModule . init ( ) ;
2015-08-29 11:36:47 +02:00
this . initSettings ( ) ;
this . initObserver ( ) ;
2015-10-26 06:27:55 +01:00
//Incase were too fast
function gwDefer ( ) {
console . log ( new Date ( ) . getTime ( ) + " Defer" ) ;
if ( $ ( ".guilds-wrapper .guilds" ) . children ( ) . length > 0 ) {
console . log ( new Date ( ) . getTime ( ) + " Defer Loaded" ) ;
var guilds = $ ( ".guilds li:first-child" ) ;
2015-12-11 04:24:28 +01:00
guilds . after ( $ ( "<li></li>" , { id : "bd-pub-li" , css : { "height" : "20px" , "display" : settingsCookie [ "bda-gs-1" ] == true ? "" : "none" } } ) . append ( $ ( "<div/>" , { class : "guild-inner" , css : { "height" : "20px" , "border-radius" : "4px" } } ) . append ( $ ( "<a/>" ) . append ( $ ( "<div/>" , { css : { "line-height" : "20px" , "font-size" : "12px" } , text : "public" , id : "bd-pub-button" } ) ) ) ) ) ;
2015-08-27 15:46:53 +02:00
2015-11-27 11:07:59 +01:00
var showChannelsButton = $ ( "<button/>" , {
class : "btn" ,
id : "bd-show-channels" ,
text : "R" ,
css : {
"cursor" : "pointer"
} ,
click : function ( ) {
settingsCookie [ "bda-gs-3" ] = false ;
$ ( "body" ) . removeClass ( "bd-minimal-chan" ) ;
self . saveSettings ( ) ;
}
} ) ;
$ ( ".guilds-wrapper" ) . prepend ( showChannelsButton ) ;
opublicServers = new PublicServers ( ) ;
2015-12-12 07:07:56 +01:00
pluginModule = new PluginModule ( ) ;
pluginModule . loadPlugins ( ) ;
2015-12-15 10:13:40 +01:00
if ( typeof ( themesupport2 ) !== "undefined" ) {
2015-12-15 08:37:15 +01:00
themeModule = new ThemeModule ( ) ;
themeModule . loadThemes ( ) ;
}
2015-12-12 07:07:56 +01:00
2015-08-31 15:20:33 +02:00
settingsPanel = new SettingsPanel ( ) ;
settingsPanel . init ( ) ;
2015-10-26 06:27:55 +01:00
2015-08-31 15:20:33 +02:00
quickEmoteMenu . init ( false ) ;
2015-10-26 06:27:55 +01:00
$ ( "#tc-settings-button" ) . on ( "click" , function ( ) { settingsPanel . show ( ) ; } ) ;
$ ( "#bd-pub-button" ) . on ( "click" , function ( ) { opublicServers . show ( ) ; } ) ;
2015-12-11 04:24:28 +01:00
opublicServers . init ( ) ;
2015-10-26 06:27:55 +01:00
emoteModule . autoCapitalize ( ) ;
2015-11-29 18:21:58 +01:00
/*Display new features in BetterDiscord*/
if ( settingsCookie [ "version" ] < jsVersion ) {
var cl = self . constructChangelog ( ) ;
$ ( "body" ) . append ( cl ) ;
settingsCookie [ "version" ] = jsVersion ;
self . saveSettings ( ) ;
}
2015-12-02 23:14:30 +01:00
$ ( "head" ) . append ( ' < script > Date . now || ( Date . now = function ( ) { return ( new Date ) . getTime ( ) } ) , function ( ) { "use strict" ; for ( var t = [ "webkit" , "moz" ] , e = 0 ; e < t . length && ! window . requestAnimationFrame ; ++ e ) { var i = t [ e ] ; window . requestAnimationFrame = window [ i + "RequestAnimationFrame" ] , window . cancelAnimationFrame = window [ i + "CancelAnimationFrame" ] || window [ i + "CancelRequestAnimationFrame" ] } if ( /iP(ad|hone|od).*OS 6/ . test ( window . navigator . userAgent ) || ! window . requestAnimationFrame || ! window . cancelAnimationFrame ) { var s = 0 ; window . requestAnimationFrame = function ( t ) { var e = Date . now ( ) , i = Math . max ( s + 16 , e ) ; return setTimeout ( function ( ) { t ( s = i ) } , i - e ) } , window . cancelAnimationFrame = clearTimeout } } ( ) , function ( t ) { t . snowfall = function ( e , i ) { function s ( s , n , a , o ) { this . x = s , this . y = n , this . size = a , this . speed = o , this . step = 0 , this . stepSize = h ( 1 , 10 ) / 100 , i . collection && ( this . target = m [ h ( 0 , m . length - 1 ) ] ) ; var r = null ; i . image ? ( r = document . createElement ( "img" ) , r . src = i . image ) : ( r = document . createElement ( "div" ) , t ( r ) . css ( { background : i . flakeColor } ) ) , t ( r ) . attr ( { "class" : "snowfall-flakes" } ) . css ( { width : this . size , height : this . size , position : i . flakePosition , top : this . y , left : this . x , fontSize : 0 , zIndex : i . flakeIndex } ) , t ( e ) . get ( 0 ) . tagName === t ( document ) . get ( 0 ) . tagName ? ( t ( "body" ) . append ( t ( r ) ) , e = t ( "body" ) ) : t ( e ) . append ( t ( r ) ) , this . element = r , this . update = function ( ) { if ( this . y += this . speed , this . y > l - ( this . size + 6 ) && this . reset ( ) , this . element . style . top = this . y + "px" , this . element . style . left = this . x + "px" , this . step += this . stepSize , this . x += y === ! 1 ? Math . cos ( this . step ) : y + Math . cos ( this . step ) , i . collection && this . x > this . target . x && this . x < this . target . width + this . target . x && this . y > this . target . y && this . y < this . target . height + this . target . y ) { var t = this . target . element . getContext ( "2d" ) , e = this . x - this . target . x , s = this . y - this . target . y , n = this . target . colData ; if ( void 0 !== n [ parseInt ( e ) ] [ parseInt ( s + this . speed + this . size ) ] || s + this . speed + this . size > this . target . height ) if ( s + this . speed + this . size > this . target . height ) { for ( ; s + this . speed + this . size > this . target . height && this . speed > 0 ; ) this . speed *= . 5 ; t . fillStyle = "#fff" , void 0 == n [ parseInt ( e ) ] [ parseInt ( s + this . speed + this . size ) ] ? ( n [ parseInt ( e ) ] [ parseInt ( s + this . speed + this . size ) ] = 1 , t . fillRect ( e , s + this . speed + this . size , this . size , this . size ) ) : ( n [ parseInt ( e ) ] [ parseInt ( s + this . speed ) ] = 1 , t . fillRect ( e , s + this . speed , this . size , this . size ) ) , this . reset ( ) } else this . speed = 1 , this . stepSize = 0 , parseInt ( e ) + 1 < this . target . width && void 0 == n [ parseInt ( e ) + 1 ] [ parseInt ( s ) + 1 ] ? this . x ++ : parseInt ( e ) - 1 > 0 && void 0 == n [ parseInt ( e ) - 1 ] [ parseInt ( s ) + 1 ] ? this . x -- : ( t . fillStyle = "#fff" , t . fillRect ( e , s , this . size , this . size ) , n [ parseInt ( e ) ] [ parseInt ( s ) ] = 1 , this . reset ( ) ) } ( this . x + this . size > d - c || this . x < c ) && this . reset ( ) } , this . reset = function ( ) { this . y = 0 , this . x = h ( c , d - c ) , this . stepSize = h ( 1 , 10 ) / 100 , this . size = h ( 100 * i . minSize , 100 * i . maxSize ) / 100 , this . element . style . width = this . size + "px" , this . element . style . height = this . size + "px" , this . speed = h ( i . minSpeed , i . maxSpeed ) } } function n ( ) { for ( r = 0 ; r < a . length ; r += 1 ) a [ r ] . update ( ) ; f = requestAnimationFrame ( function ( ) { n ( ) } ) } var a = [ ] , o = { flakeCount : 35 , flakeColor : "#ffffff" , flakePosition : "absolute" , flakeIndex : 999999 , minSize : 1 , maxSize : 2 , minSpeed : 1 , maxSpeed : 5 , round : ! 1 , shadow : ! 1 , collection : ! 1 , collectionHeight : 40 , deviceorientation : ! 1 } , i = t . extend ( o , i ) , h = function ( t , e ) { return Math . round ( t + Math . random ( ) * ( e - t ) ) } ; t ( e ) . data ( "snowfall" , this ) ; var r = 0 , l = t ( e ) . height ( ) , d = t ( e ) . width ( ) , c = 0 , f = 0 ; if ( i . collection !== ! 1 ) { var p = document . createElement ( "canvas" ) ; if ( p . getContext && p . getContext ( "2d" ) ) for ( var m = [ ] , w = t ( i . collection ) , g = i . collectionHeight , r = 0 ; r < w . length ; r ++ ) { var u = w [ r ] . getBoundingClientRect ( ) , x = t ( "<canvas/>" , { "class" : "snowfall-canvas" } ) , z = [ ] ; if ( u . top - g > 0 ) { t ( "body" ) . append ( x ) , x . css ( { position : i . flakePosition , left : u . left + "px" , top : u . top - g + "px" } ) . prop ( { width : u . width , height : g } ) ; for ( var v = 0 ; v < u . width ; v ++ ) z [ v ] = [ ] ; m . push ( { element : x . get ( 0 ) , x : u . left , y : u . top - g , width : u . width , height : g , colData : z } ) } } else i . collection = ! 1 } for ( t ( e ) . get ( 0 ) . tagName === t ( document ) . get ( 0 ) . tagName && ( c = 25 ) , t ( window ) . bind ( "resize" , function ( ) { l = t ( e ) [ 0 ] . clientHeight , d = t ( e ) [ 0 ] . offsetWidth } ) , r = 0 ; r < i . flakeCount ; r += 1 ) a . push ( new s ( h ( c , d - c ) , h ( 0 , l ) , h ( 100 * i . minSize , 100 * i . maxSize ) / 100 , h ( i . minSpeed , i . maxSpeed ) ) ) ; i . round && t ( ".snowfall-flakes" ) . css ( { " - moz
//By http://www.somethinghitme.com
2015-12-12 03:28:42 +01:00
$ ( "head" ) . append ( "<style>.CodeMirror{ min-width:100%; }</style>" ) ;
2015-12-11 07:43:36 +01:00
2015-12-12 07:07:56 +01:00
2015-08-31 15:20:33 +02:00
} else {
2015-10-26 06:27:55 +01:00
setTimeout ( gwDefer , 100 ) ;
2015-08-31 15:20:33 +02:00
}
2015-10-26 06:27:55 +01:00
}
2015-08-31 15:59:34 +02:00
2015-10-26 06:27:55 +01:00
$ ( document ) . ready ( function ( ) {
setTimeout ( gwDefer , 1000 ) ;
} ) ;
} ;
2015-08-27 15:46:53 +02:00
2015-08-29 11:36:47 +02:00
Core . prototype . initSettings = function ( ) {
if ( $ . cookie ( "better-discord" ) == undefined ) {
settingsCookie = defaultCookie ;
this . saveSettings ( ) ;
} else {
this . loadSettings ( ) ;
for ( var setting in defaultCookie ) {
if ( settingsCookie [ setting ] == undefined ) {
2015-10-26 06:27:55 +01:00
settingsCookie [ setting ] = defaultCookie [ setting ] ;
2015-08-29 11:36:47 +02:00
this . saveSettings ( ) ;
}
2015-08-27 15:46:53 +02:00
}
}
2015-10-26 06:27:55 +01:00
} ;
2015-08-27 15:46:53 +02:00
2015-08-29 11:36:47 +02:00
Core . prototype . saveSettings = function ( ) {
$ . cookie ( "better-discord" , JSON . stringify ( settingsCookie ) , { expires : 365 , path : '/' } ) ;
2015-10-26 06:27:55 +01:00
} ;
2015-08-29 11:36:47 +02:00
Core . prototype . loadSettings = function ( ) {
settingsCookie = JSON . parse ( $ . cookie ( "better-discord" ) ) ;
2015-10-26 06:27:55 +01:00
} ;
2015-08-29 11:36:47 +02:00
Core . prototype . initObserver = function ( ) {
mainObserver = new MutationObserver ( function ( mutations ) {
mutations . forEach ( function ( mutation ) {
2015-08-29 21:02:20 +02:00
if ( mutation . target . getAttribute ( 'class' ) != null ) {
if ( mutation . target . getAttribute ( 'class' ) . indexOf ( "titlebar" ) != - 1 ) {
quickEmoteMenu . obsCallback ( ) ;
2015-11-19 00:35:39 +01:00
voiceMode . obsCallback ( ) ;
2015-08-29 21:02:20 +02:00
}
2015-08-29 11:36:47 +02:00
}
emoteModule . obsCallback ( mutation ) ;
} ) ;
} ) ;
2015-10-26 06:27:55 +01:00
//noinspection JSCheckFunctionSignatures
2015-08-29 11:36:47 +02:00
mainObserver . observe ( document , { childList : true , subtree : true } ) ;
2015-10-26 06:27:55 +01:00
} ;
2015-08-29 11:36:47 +02:00
2015-11-29 18:21:58 +01:00
Core . prototype . constructChangelog = function ( ) {
var changeLog = '' +
'<div id="bd-wn-modal" class="modal" style="opacity:1;">' +
' <div class="modal-inner">' +
' <div id="bdcl" class="change-log"> ' +
' <div class="header">' +
2015-12-14 07:12:07 +01:00
' <strong>What\'s new in BetterDiscord JS v1.53&' + jsVersion + '</strong>' +
2015-11-29 18:21:58 +01:00
' <button class="close" onclick=\'$("#bd-wn-modal").remove();\'></button>' +
' </div><!--header-->' +
' <div class="scroller-wrap">' +
' <div class="scroller">' ;
if ( bdchangelog . changes != null ) {
changeLog += '' +
'<h1 class="changelog-added">' +
' <span>New Stuff</span>' +
'</h1>' +
'<ul>' ;
for ( var change in bdchangelog . changes ) {
change = bdchangelog . changes [ change ] ;
changeLog += '' +
'<li>' +
' <strong>' + change . title + '</strong>' +
' <div>' + change . text + '</div>' +
'</li>' ;
}
changeLog += '</ul>' ;
}
if ( bdchangelog . fixes != null ) {
changeLog += '' +
'<h1 class="changelog-fixed">' +
' <span>Fixed</span>' +
'</h1>' +
'<ul>' ;
for ( var fix in bdchangelog . fixes ) {
fix = bdchangelog . fixes [ fix ] ;
changeLog += '' +
'<li>' +
' <strong>' + fix . title + '</strong>' +
' <div>' + fix . text + '</div>' +
'</li>' ;
}
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 ;
} ;
2015-08-27 15:46:53 +02:00
/ * B e t t e r D i s c o r d A p p E m o t e M o d u l e J a v a S c r i p t
2015-10-26 06:27:55 +01:00
* Version : 1.5
2015-08-27 15:46:53 +02:00
* Author : Jiiks | http : //jiiks.net
* Date : 26 / 08 / 2015 - 15 : 29
2015-10-14 08:50:34 +02:00
* Last Update : 14 / 10 / 2015 - 09 : 48
2015-08-27 15:46:53 +02:00
* https : //github.com/Jiiks/BetterDiscordApp
* Note : Due to conflicts autocapitalize only supports global emotes
* /
2015-10-26 06:27:55 +01:00
/ *
* = Changelog =
* - v1 . 5
* -- Twitchemotes . com api
* /
2015-08-27 15:46:53 +02:00
var emotesFfz = { } ;
var emotesBTTV = { } ;
2015-10-26 06:27:55 +01:00
var emotesTwitch = { "emotes" : { "emote" : { "image_id" : 0 } } } ; //for ide
var subEmotesTwitch = { } ;
2015-08-27 15:46:53 +02:00
2015-11-01 12:44:25 +01:00
function EmoteModule ( ) {
}
2015-08-29 11:36:47 +02:00
2015-11-01 12:44:25 +01:00
EmoteModule . prototype . init = function ( ) {
2015-11-01 12:57:10 +01:00
} ;
EmoteModule . prototype . getBlacklist = function ( ) {
2015-11-01 13:12:04 +01:00
$ . getJSON ( "https://cdn.rawgit.com/Jiiks/betterDiscordApp/" + _hash + "/emotefilter.json" , function ( data ) { bemotes = data . blacklist ; } ) ;
2015-11-01 12:44:25 +01:00
} ;
2015-08-27 15:46:53 +02:00
2015-08-29 11:36:47 +02:00
EmoteModule . prototype . obsCallback = function ( mutation ) {
var self = this ;
2015-10-29 14:46:08 +01:00
2015-11-27 01:14:33 +01:00
if ( ! settingsCookie [ "bda-es-7" ] ) return ;
2015-08-29 11:36:47 +02:00
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 ) {
2015-10-26 06:27:55 +01:00
if ( nodes . hasOwnProperty ( node ) ) {
self . injectEmote ( nodes [ node ] ) ;
}
2015-08-29 11:36:47 +02:00
}
}
}
2015-10-26 06:27:55 +01:00
} ;
2015-08-27 15:46:53 +02:00
EmoteModule . prototype . getNodes = function ( node ) {
var next ;
var nodes = [ ] ;
2015-10-31 22:49:42 +01:00
var treeWalker = document . createTreeWalker ( node , NodeFilter . SHOW _TEXT , null , false ) ;
2015-08-27 15:46:53 +02:00
while ( next = treeWalker . nextNode ( ) ) {
nodes . push ( next ) ;
}
2015-10-29 15:51:21 +01:00
2015-10-29 15:53:43 +01:00
2015-08-27 15:46:53 +02:00
return nodes ;
2015-10-26 06:27:55 +01:00
} ;
2015-08-27 15:46:53 +02:00
2015-11-01 12:44:25 +01:00
var bemotes = [ ] ;
2015-11-28 00:41:48 +01:00
var spoilered = [ ] ;
2015-10-27 16:41:46 +01:00
2015-08-27 15:46:53 +02:00
EmoteModule . prototype . injectEmote = function ( node ) {
if ( typeof emotesTwitch === 'undefined' ) return ;
if ( ! node . parentElement ) return ;
var parent = node . parentElement ;
2015-12-11 10:13:38 +01:00
2015-08-27 15:46:53 +02:00
if ( parent . tagName != "SPAN" ) return ;
2015-12-11 10:13:38 +01:00
var edited = false ;
if ( $ ( parent . parentElement ) . hasClass ( "edited" ) ) {
parent = parent . parentElement . parentElement . firstChild ; //:D
edited = true ;
}
//if(!$(parent.parentElement).hasClass("markup") && !$(parent.parentElement).hasClass("message-content")) return;
2015-08-27 15:46:53 +02:00
2015-12-11 10:13:38 +01:00
function inject ( ) {
if ( ! $ ( parent . parentElement ) . hasClass ( "markup" ) && ! $ ( parent . parentElement ) . hasClass ( "message-content" ) ) { return ; }
2015-08-27 15:46:53 +02:00
2015-12-11 10:13:38 +01:00
var parentInnerHTML = parent . innerHTML ;
var words = parentInnerHTML . split ( /\s+/g ) ;
2015-08-27 15:46:53 +02:00
2015-12-11 10:13:38 +01:00
if ( ! words ) return ;
2015-10-27 16:43:37 +01:00
2015-12-11 10:13:38 +01:00
words . some ( function ( word ) {
2015-11-28 00:29:53 +01:00
2015-12-11 10:13:38 +01:00
if ( word . slice ( 0 , 4 ) == "[!s]" ) {
2015-11-28 00:29:53 +01:00
2015-12-11 10:13:38 +01:00
parentInnerHTML = parentInnerHTML . replace ( "[!s]" , "" ) ;
var markup = $ ( parent ) . parent ( ) ;
var reactId = markup . attr ( "data-reactid" ) ;
if ( spoilered . indexOf ( reactId ) > - 1 ) {
return ;
}
2015-11-28 00:41:48 +01:00
2015-12-11 10:13:38 +01:00
markup . addClass ( "spoiler" ) ;
markup . on ( "click" , function ( ) {
$ ( this ) . removeClass ( "spoiler" ) ;
spoilered . push ( $ ( this ) . attr ( "data-reactid" ) ) ;
} ) ;
2015-11-28 00:41:48 +01:00
return ;
}
2015-12-11 07:46:37 +01:00
2015-12-11 10:21:16 +01:00
if ( word . length < 4 ) {
return ;
}
2015-12-11 07:46:37 +01:00
2015-12-11 10:21:16 +01:00
if ( $ . inArray ( word , bemotes ) != - 1 ) return ;
2015-10-26 06:27:55 +01:00
2015-12-11 10:21:16 +01:00
if ( emotesTwitch . emotes . hasOwnProperty ( word ) ) {
2015-12-11 10:13:38 +01:00
var len = Math . round ( word . length / 4 ) ;
2015-12-14 06:22:52 +01:00
parentInnerHTML = parentInnerHTML . replace ( word , '<img class="emote" alt="' + word . substr ( 0 , len ) + "\uFDD9" + word . substr ( len , len ) + "\uFDD9" + word . substr ( len * 2 , len ) + "\uFDD9" + word . substr ( len * 3 ) + '" src="' + twitchEmoteUrlStart + emotesTwitch . emotes [ word ] . image _id + twitchEmoteUrlEnd + '" />' ) ;
2015-12-11 10:13:38 +01:00
return ;
}
2015-10-26 06:27:55 +01:00
2015-12-11 10:21:16 +01:00
if ( typeof emotesFfz !== 'undefined' && settingsCookie [ "bda-es-1" ] ) {
if ( emotesFfz . hasOwnProperty ( word ) ) {
var len = Math . round ( word . length / 4 ) ;
2015-12-14 06:22:52 +01:00
var name = word . substr ( 0 , len ) + "\uFDD9" + word . substr ( len , len ) + "\uFDD9" + word . substr ( len * 2 , len ) + "\uFDD9" + word . substr ( len * 3 ) ;
var url = ffzEmoteUrlStart + emotesFfz [ word ] + ffzEmoteUrlEnd ;
parentInnerHTML = parentInnerHTML . replace ( word , '<div class="emotewrapper"><img class="emote" alt="' + name + '" src="' + url + '" /><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>' ) ;
2015-12-11 10:21:16 +01:00
return ;
}
}
if ( typeof emotesBTTV !== 'undefined' && settingsCookie [ "bda-es-2" ] ) {
if ( emotesBTTV . hasOwnProperty ( word ) ) {
var len = Math . round ( word . length / 4 ) ;
2015-12-14 06:22:52 +01:00
var name = word . substr ( 0 , len ) + "\uFDD9" + word . substr ( len , len ) + "\uFDD9" + word . substr ( len * 2 , len ) + "\uFDD9" + word . substr ( len * 3 ) ;
var url = emotesBTTV [ word ] ;
parentInnerHTML = parentInnerHTML . replace ( word , '<div class="emotewrapper"><img class="emote" alt="' + name + '" src="' + url + '" /><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>' ) ;
2015-12-11 10:21:16 +01:00
return ;
}
2015-08-27 15:46:53 +02:00
}
2015-12-10 04:06:30 +01:00
2015-12-11 10:21:16 +01:00
if ( typeof emotesBTTV2 !== 'undefined' && settingsCookie [ "bda-es-2" ] ) {
if ( emotesBTTV2 . hasOwnProperty ( word ) ) {
var len = Math . round ( word . length / 4 ) ;
2015-12-14 06:22:52 +01:00
var name = word . substr ( 0 , len ) + "\uFDD9" + word . substr ( len , len ) + "\uFDD9" + word . substr ( len * 2 , len ) + "\uFDD9" + word . substr ( len * 3 ) ;
var url = bttvEmoteUrlStart + emotesBTTV2 [ word ] + bttvEmoteUrlEnd ;
parentInnerHTML = parentInnerHTML . replace ( word , '<div class="emotewrapper"><img class="emote" alt="' + name + '" src="' + url + '" /><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>' ) ;
2015-12-11 10:21:16 +01:00
return ;
}
}
if ( subEmotesTwitch . hasOwnProperty ( word ) ) {
2015-12-10 04:01:24 +01:00
var len = Math . round ( word . length / 4 ) ;
2015-12-14 06:22:52 +01:00
var name = word . substr ( 0 , len ) + "\uFDD9" + word . substr ( len , len ) + "\uFDD9" + word . substr ( len * 2 , len ) + "\uFDD9" + word . substr ( len * 3 ) ;
var url = twitchEmoteUrlStart + subEmotesTwitch [ word ] + twitchEmoteUrlEnd ;
parentInnerHTML = parentInnerHTML . replace ( word , '<div class="emotewrapper"><img class="emote" alt="' + name + '" src="' + url + '" /><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>' ) ;
2015-12-10 04:01:24 +01:00
return ;
}
2015-12-11 10:21:16 +01:00
} ) ;
2015-08-27 15:46:53 +02:00
2015-12-11 10:21:16 +01:00
if ( parent . parentElement == null ) return ;
2015-10-26 06:27:55 +01:00
2015-12-11 10:21:16 +01:00
var oldHeight = parent . parentElement . offsetHeight ;
parent . innerHTML = parentInnerHTML . replace ( new RegExp ( "\uFDD9" , "g" ) , "" ) ;
var newHeight = parent . parentElement . offsetHeight ;
2015-10-14 08:50:34 +02:00
2015-12-11 10:21:16 +01:00
//Scrollfix
var scrollPane = $ ( ".scroller.messages" ) . first ( ) ;
scrollPane . scrollTop ( scrollPane . scrollTop ( ) + ( newHeight - oldHeight ) ) ;
2015-12-11 10:13:38 +01:00
}
if ( edited ) {
setTimeout ( inject , 250 ) ;
} else {
inject ( ) ;
}
2015-10-26 06:27:55 +01:00
} ;
2015-08-27 15:46:53 +02:00
EmoteModule . prototype . autoCapitalize = function ( ) {
2015-10-26 06:27:55 +01:00
2015-08-27 15:46:53 +02:00
var self = this ;
2015-08-31 15:36:28 +02:00
2015-08-27 15:46:53 +02:00
$ ( 'body' ) . delegate ( $ ( ".channel-textarea-inner textarea" ) , 'keyup change paste' , function ( ) {
2015-08-29 11:36:47 +02:00
if ( ! settingsCookie [ "bda-es-4" ] ) return ;
2015-08-27 15:46:53 +02:00
var text = $ ( ".channel-textarea-inner textarea" ) . val ( ) ;
2015-08-29 11:36:47 +02:00
if ( text == undefined ) return ;
2015-08-27 15:46:53 +02:00
var lastWord = text . split ( " " ) . pop ( ) ;
if ( lastWord . length > 3 ) {
var ret = self . capitalize ( lastWord . toLowerCase ( ) ) ;
if ( ret != null ) {
$ ( ".channel-textarea-inner textarea" ) . val ( text . replace ( lastWord , ret ) ) ;
}
}
} ) ;
2015-10-26 06:27:55 +01:00
} ;
2015-08-27 15:46:53 +02:00
EmoteModule . prototype . capitalize = function ( value ) {
2015-12-11 07:43:36 +01:00
var res = emotesTwitch . emotes ;
for ( var p in res ) {
if ( res . hasOwnProperty ( p ) && value == ( p + '' ) . toLowerCase ( ) ) {
return p ;
}
2015-08-27 15:46:53 +02:00
}
2015-10-26 06:27:55 +01:00
} ;
2015-08-27 15:46:53 +02:00
2015-10-26 06:27:55 +01:00
/ * B e t t e r D i s c o r d A p p P u b l i c S e v e r s J a v a S c r i p t s
2015-08-31 15:20:33 +02:00
* Version : 1.0
* Author : Jiiks | http : //jiiks.net
* Date : 27 / 08 / 2015 - 14 : 16
* https : //github.com/Jiiks/BetterDiscordApp
* /
2015-10-26 06:27:55 +01:00
var publicServers = { "servers" : { "server" : { "code" : 0 , "icon" : null , "title" : "title" , "language" : "EN" , "description" : "description" } } } ; //for ide
2015-08-31 15:20:33 +02:00
function PublicServers ( ) {
}
2015-10-26 06:27:55 +01:00
PublicServers . prototype . getPanel = function ( ) {
return this . container ;
} ;
2015-08-31 15:20:33 +02:00
PublicServers . prototype . init = function ( ) {
2015-10-26 06:27:55 +01:00
var self = this ;
this . container = $ ( "<div/>" , {
id : "bd-ps-container" ,
style : "display:none"
} ) ;
var header = $ ( "<div/>" , {
id : "bd-ps-header"
} ) ;
$ ( "<h2/>" , {
text : "Public Servers"
} ) . appendTo ( header ) ;
$ ( "<span/>" , {
id : "bd-ps-close" ,
style : "cursor:pointer;" ,
text : "X"
} ) . appendTo ( header ) ;
header . appendTo ( this . getPanel ( ) ) ;
var psbody = $ ( "<div/>" , {
id : "bd-ps-body"
} ) ;
psbody . appendTo ( this . getPanel ( ) ) ;
var table = $ ( "<table/>" , {
border : "0"
} ) ;
var thead = $ ( "<thead/>" ) ;
thead . appendTo ( table ) ;
var headers = $ ( "<tr/>" , {
} ) . append ( $ ( "<th/>" , {
text : "Name"
} ) ) . append ( $ ( "<th/>" , {
text : "Code"
} ) ) . append ( $ ( "<th/>" , {
text : "Language"
} ) ) . append ( $ ( "<th/>" , {
text : "Description"
2015-10-27 22:58:43 +01:00
} ) ) . append ( $ ( "<th/>" , {
text : "Join"
2015-10-26 06:27:55 +01:00
} ) ) ;
headers . appendTo ( thead ) ;
var tbody = $ ( "<tbody/>" , {
id : "bd-ps-tbody"
} ) ;
tbody . appendTo ( table ) ;
table . appendTo ( psbody ) ;
$ ( "body" ) . append ( this . getPanel ( ) ) ;
$ ( "#bd-ps-close" ) . on ( "click" , function ( ) { self . show ( ) ; } ) ;
var servers = publicServers . servers ;
for ( var server in servers ) {
if ( servers . hasOwnProperty ( server ) ) {
var s = servers [ server ] ;
var code = s . code ;
var title = s . title ;
var language = s . language ;
var description = s . description ;
this . addServer ( server , code , title , language , description ) ;
}
}
} ;
PublicServers . prototype . addServer = function ( name , code , title , language , description ) {
2015-10-27 22:58:43 +01:00
var self = this ;
2015-10-26 06:27:55 +01:00
var tableBody = $ ( "#bd-ps-tbody" ) ;
var desc = $ ( "<td/>" ) . append ( $ ( "<div/>" , {
class : "bd-ps-description" ,
text : description
} ) ) ;
var tr = $ ( "<tr/>" ) ;
tr . append ( $ ( "<td/>" , {
text : title
} ) ) ;
tr . append ( $ ( "<td/>" , {
css : {
"-webkit-user-select" : "initial" ,
"user-select" : "initial"
} ,
text : code
} ) ) ;
tr . append ( $ ( "<td/>" , {
text : language
} ) ) ;
2015-10-27 23:04:41 +01:00
tr . append ( desc ) ;
2015-10-27 23:13:23 +01:00
tr . append ( $ ( "<td/>" ) . append ( $ ( "<button/>" , {
2015-10-27 22:58:43 +01:00
text : "Join" ,
2015-10-27 23:04:41 +01:00
css : {
"height" : "30px" ,
"display" : "block" ,
"margin-top" : "10px" ,
"background-color" : "#36393E" ,
"border" : "1px solid #404040" ,
"outline" : "1px solid #000" ,
"color" : "#EDEDED"
} ,
2015-10-27 22:58:43 +01:00
click : function ( ) { self . joinServer ( code ) ; }
2015-10-27 23:13:23 +01:00
} ) ) ) ;
2015-10-27 22:58:43 +01:00
2015-10-26 06:27:55 +01:00
tableBody . append ( tr ) ;
} ;
PublicServers . prototype . show = function ( ) {
this . getPanel ( ) . toggle ( ) ;
var li = $ ( "#bd-pub-li" ) ;
li . removeClass ( ) ;
if ( this . getPanel ( ) . is ( ":visible" ) ) {
li . addClass ( "active" ) ;
}
} ;
2015-08-27 15:46:53 +02:00
2015-10-27 22:58:43 +01:00
//Workaround for joining a server
PublicServers . prototype . joinServer = function ( code ) {
$ ( ".guilds-add" ) . click ( ) ;
$ ( ".action.join .btn" ) . click ( ) ;
$ ( ".create-guild-container input" ) . val ( code ) ;
$ ( ".form.join-server .btn-primary" ) . click ( ) ;
2015-10-27 23:13:23 +01:00
} ;
2015-10-27 22:58:43 +01:00
2015-08-27 15:46:53 +02:00
/ * B e t t e r D i s c o r d A p p Q u i c k E m o t e M e n u J a v a S c r i p t
2015-10-26 06:27:55 +01:00
* Version : 1.3
2015-08-27 15:46:53 +02:00
* Author : Jiiks | http : //jiiks.net
* Date : 26 / 08 / 2015 - 11 : 49
2015-08-29 11:36:47 +02:00
* Last Update : 29 / 08 / 2015 - 11 : 46
2015-08-27 15:46:53 +02:00
* https : //github.com/Jiiks/BetterDiscordApp
* /
2015-08-29 11:36:47 +02:00
var emoteBtn , emoteMenu ;
2015-08-27 15:46:53 +02:00
function QuickEmoteMenu ( ) {
}
2015-10-26 06:27:55 +01:00
QuickEmoteMenu . prototype . init = function ( reload ) {
2015-08-31 15:36:28 +02:00
2015-08-29 11:36:47 +02:00
emoteBtn = null ;
2015-11-28 00:29:53 +01:00
$ ( ".channel-textarea" ) . first ( ) . removeClass ( "emotemenu-enabled" ) ;
2015-08-29 11:36:47 +02:00
if ( ! emoteMenu ) {
this . initEmoteList ( ) ;
}
2015-08-27 15:46:53 +02:00
var menuOpen ;
2015-08-29 11:36:47 +02:00
emoteBtn = $ ( "<div/>" , { id : "twitchcord-button-container" , style : "display:none" } ) . append ( $ ( "<button/>" , { id : "twitchcord-button" , onclick : "return false;" } ) ) ;
2015-08-27 15:46:53 +02:00
$ ( ".content.flex-spacer.flex-horizontal .flex-spacer.flex-vertical form" ) . append ( emoteBtn ) ;
2015-08-29 11:36:47 +02:00
emoteMenu . detach ( ) ;
2015-08-27 15:46:53 +02:00
emoteBtn . append ( emoteMenu ) ;
2015-08-29 11:36:47 +02:00
2015-08-27 15:46:53 +02:00
$ ( "#twitchcord-button" ) . on ( "click" , function ( ) {
menuOpen = ! menuOpen ;
if ( menuOpen ) {
emoteMenu . addClass ( "emotemenu-open" ) ;
$ ( this ) . addClass ( "twitchcord-button-open" ) ;
} else {
emoteMenu . removeClass ( ) ;
$ ( this ) . removeClass ( ) ;
}
} ) ;
2015-08-29 11:36:47 +02:00
if ( settingsCookie [ "bda-es-0" ] ) {
2015-11-28 00:29:53 +01:00
$ ( ".channel-textarea" ) . first ( ) . addClass ( "emotemenu-enabled" ) ;
2015-08-27 15:46:53 +02:00
emoteBtn . show ( ) ;
}
2015-10-26 06:27:55 +01:00
var emoteIcon = $ ( ".emote-icon" ) ;
emoteIcon . off ( ) ;
emoteIcon . on ( "click" , function ( ) {
2015-12-14 06:22:52 +01:00
var emote = $ ( this ) . attr ( "title" ) ;
2015-10-26 06:27:55 +01:00
var ta = $ ( ".channel-textarea-inner textarea" ) ;
ta . val ( ta . val ( ) . slice ( - 1 ) == " " ? ta . val ( ) + emote : ta . val ( ) + " " + emote ) ;
} ) ;
2015-12-14 06:22:52 +01:00
var fe = localStorage [ "bdfavemotes" ] ;
if ( fe != undefined ) {
favoriteEmotes = JSON . parse ( atob ( fe ) ) ;
this . updateFavorites ( ) ;
}
2015-10-26 06:27:55 +01:00
} ;
2015-08-29 11:36:47 +02:00
QuickEmoteMenu . prototype . obsCallback = function ( ) {
2015-12-05 14:29:46 +01:00
$ ( "#snowcover" ) . remove ( ) ;
$ ( "#decor" ) . remove ( ) ;
2015-12-20 04:07:35 +01:00
$ ( "#santasled" ) . remove ( ) ;
2015-12-05 14:29:46 +01:00
var customCss = $ ( "#customcss" ) . html ( ) ;
if ( window . location . pathname == "/channels/86004744966914048/86004744966914048" || customCss . indexOf ( "snow" ) > - 1 ) {
2015-12-02 23:14:30 +01:00
if ( $ ( "#customcss" ) . html ( ) . indexOf ( "nosnow" ) == - 1 ) {
2015-12-02 23:41:21 +01:00
$ ( ".scroller.messages" ) . snowfall ( 'clear' ) ;
2015-12-02 23:14:30 +01:00
$ ( ".scroller.messages" ) . snowfall ( { flakeCount : 100 , maxSpeed : 10 } ) ;
}
2015-12-05 14:29:46 +01:00
if ( customCss . indexOf ( "nodecor" ) > - 1 ) {
2015-12-06 19:59:40 +01:00
$ ( "#decor" ) . remove ( ) ;
2015-12-05 14:29:46 +01:00
} else {
2015-12-20 04:07:35 +01:00
$ ( "head" ) . append ( '<style id="decor"> .flex-spacer.flex-vertical { background-repeat: repeat no-repeat; background-image:url(\' data : image / png ; base64 , iVBORw0KGgoAAAANSUhEUgAAALAAAAAyCAMAAADLEaG / AAAC / VBMVEUAAAD75ZmWKxHevpJJex7YvokjXQvjrBopZxr04ZqnfUP11HXxwT9RjChSgCazjWOjaQz0yVQdSxArVxruthw5ahnFl1 / CnmXRq33hzqYkRhN0my + dSx7DeC756rQnVRgtVhNfhiQoXRfJp2olUhWAhSLjuWfoyHtPch7921IzeR2OeA + PbCyqXz0QNgzNhjKqbko7ahyaiZS9j1BkcR1vkkildRaSlilDchj45YrRl0Xy4p6AYUuvdTP75IvMkEf87KmxgUQnYhnquS3n0I3kvHDKvoR3UDiKqGZ3WXuqRisYRByktX6Fa4P / + MTCei / sszLs0YMJPgKbkzv ++ tKLg3vRnQ3d35f21VfbvmhxfzPmsy + WMx7ktFLRsD + Mc4fHw8Wjt6TwhQW4eQXNAArGAAe9AAPkrgSCEqPffQK / ehlDcxvNeha0AgV8DJvptAVyC5DGhBzHewLwymfAcQ3NignbjAbSAQb8 / Py / hibWgAmxaweufiyxcR7amhL3rALPZAC3bhe3SSOvORw5ahiQFwzZnCLspAXBhAXRlgTVojHgogRpE4NkkSizFA + eIQ6rBgjAAw + 6 agWXBATGZwPmhwGwXSelQBmhMRbMbwf + 8 K2KFaz324jJkybRkhetXghcI3hUBGnerTy4eib76hKhBwX7uALqlQL4nAGXd0jnYDrmry1UgyCxJBTkBQrTdQPZbAFxEZxlBJBwJ4Tmt0qoikbOlUSlfjG4hxeLBgNLAJFeBIA9BGRZHWFvPU7Dq03 + 9 JaPWCCxexu + HhRIA3r + 6 HKyo0 / z2gj8 + uRsA63wywbl4tn898liP3SZdWD780O / pDLPVjD + xxD8DQ ++ XQDaqlC9izSsli / lxCPxLByQQxK0Lfl0Lm2RXGNeM1HSwEp3Xx6YDfl9S3vCuTDtvQPuQyzFOh7PpBTYIhT9 + xOeLdiBBNHBoW6weWLjf0ugYzz / 0 iimXpTY1UmvuZbWwnDc1CjXhB63cpuSTESCKRWCKo9XSiQqEEB + Mg + 5 Ur6FRhNWAAAAY3RSTlMA / v4O / Cr9 / P0zLP7 + / O M c / v y V M v 7 f d G N E G x j + / v z 4 R l / + v I k L / v v 5 s / 7 + / f u 4 b 9 W V i W V K / f r 6 + c i W h 0 7 + + c q x a l 7 o 2 b p j / v 3 6 7 9 7 Z 9 t X L y b i C / c O X i W f + w a S W h t v B w a 7 z v O V B I 5 3 4 A A A R Y k l E Q V R o 3 p S U T 0 z T U B z H + z a X M V p k T R p 0 I l V j a K 0 T x Y i Y g U x 0 Y I w x C J H 4 X y 9 j m g z N M h 7 T 4 H Q J K F V K w m A S 0 K Z g U q M H G z 2 V 4 U 4 M T Q 2 H J S h h x n C R k / G A u h h j 9 G B i R 1 G q T J 2 f w 9 o 1 v 7 7 3 + X 3 f 6 0 M W y D 3 h d F o Q P c Z 8 7 V r t q F X v N F Z o d y a L E c m M 0 Y R k Z k X u k l J L u t a i e 2 6 s d V R r 4 6 v T 6 L E 4 n S e 2 I X p M 9 T 5 c A J W I n m M r t a s T o N I J R K N g l f p z u B 4 F j v 8 V L l g i 3 A C E + s O I a f H 5 Y R c K 4 p m F g Y D 7 6 n V 5 V m N E S I R 8 t b 5 o 5 Z Z j W j E p y J L P p V U X I E i l y 4 f B P w p b a r N O u B p A z O d a b 1 z M z C y j 5 H x o t a b f S n k o h s x Y A 6 J h q 0 E h F 1 C F l a O 6 m Y 8 e c 1 W k x 2 F 4 Q W a H M X y + m 9 0 2 B y Z 1 c T h w V m b 2 q t h l y 1 K 4 0 s l D r k u S a 2 z a X x w b H p Y F n r G o W R 1 c j + h x M D w q B j i I 1 q Q b q X F S Z I J m z + I A 6 I U d n B j 1 q 9 0 b F R 5 A d p g C a I P J Y q m g B C G p v k r G U x n F G k 6 d P m X L T p h R S C g G R J q m K 0 0 W U w M K 6 O E Q L v C K B b H V n 3 L 9 s l B H F Q C g O U Q n S M p Z g 4 Q k I S F g B A H 5 O K j W T T 0 6 9 + 5 x e r n q 4 r y A + T A w I U A I K X I C S j 4 c x A V n J i s T 5 J L + 2 u y E n U I c 4 D 6 C S i Q g C i E 6 Q W K + V y g f J 9 W s R D E 6 9 O v m i f M o 4 c P Q B M B C C I 1 D V O b 8 b q 8 3 y S 9 u 6 / y S b 1 + + z p T m q 8 J 0 l G O 7 M c j z W J f 8 i R R w 4 q w M A W j M Z G U b G 9 k 7 U J C d c C M A U D Y T O J 1 A z c M E 4 F G s m + W i d J 0 q f H n u X Z t R P y x P e b 1 u P y u j E K M R A F l J Z g O B F m + S / P m t l x o 6 0 9 x c X W p s p N r d L W 4 / B 2 U c A A q V h 7 z u Y L B N t x g 6 t o 3 P f P h a k p / d H g Z D w W D E P Z S E M k p C G Y p + d Z r 2 p C o 8 n 9 V u f W 0 d 5 W 8 J B F h Z C m E A w Z U x q y R L 1 4 k p p e 7 H A b E / d r O 3 p 6 e n d + B K 7 G R N P H W / 2 y y x F w K Y I C Y 5 V m J D F 0 K U u h h L y C 1 R 2 4 x 1 x g Z L c r M Q N p I 0 e 6 E r J H I t L K P g g U u s Z O 6 + n 1 I a d 5 9 U B 1 H D 2 q 9 T b l S m i O t m W b I + V 3 C E n C C X z U Z u u z l m y r G w E 2 c M v e f 7 P H 1 9 n j c D D 8 O x V 5 P i j c D n c 7 N 2 J l k + N 9 r G s i E i l a r L c N I a b t 6 b b / P K Y G d B F s d a X S p F d L P R J / Y j c Y G x l 3 k / B 2 6 I z G T V Q l Y d V z p P m n 5 u 4 i l G v N H S P 9 5 8 Z I J E I C k U b i y z 9 k e i 8 U q t 9 d W G 3 j O e J p W L T W d e F s U M Y 6 3 9 Q X v x n k P K 2 O z I p l l 7 J O K n J l 1 L j E p n 7 v X 2 p X l a d e t W Z + m / h U 9 P w r Z I J P m s M D H B M 4 f 2 r L M H + 1 u j H z r v n e 9 T O d N R F Q 4 b f h h b 4 s l I v 7 V s Y x 5 K o o i Z J c p y c p Y V l 0 8 n j Q s z D / Z 4 m h 6 l e f v i N X f V s P q x v T k v b 2 2 B M j K + a X z n 9 u L y Y F A 4 s P n 3 f G f C 5 / u a 5 v F 0 v A z H V v x L e P M + 0 D p t n d 1 7 Z A d O M 0 z F 1 r y 8 Z v s T L a s 0 n q d F A z G D E d G g p s u L l 6 m W Z t a M m K W p 4 p z m a 3 n L N 6 z V P s l x 6 8 O O o h c P V N 4 n P 0 b v D o Q H C 3 M 2 F i 4 / v q s o 2 B q 5 0 1 4 1 O n r Z 2 r 5 9 + R p E T / 7 M e K + n 6 a L W Z t H H g b D B 9 n f h 7 4 S W e X A L Y R j G d 9 b a h p F g I 4 M c 2 q Q p m a o 4 I 3 G N c R t h m L r P c S U l m 1 W K C h J l N 6 Q t m 4 S Q x F F n g r L B I H W r i m l T R 2 l r t D W a d h x V M + o q Z l w z v m 2 N c / C b + f 5 J 9 n v 3 e Z 9 9 9 / k 2 m q c y r u 5 M q 5 5 3 m h W V 0 a b F d C E u Q u K r x R 5 C B 4 q w 1 F T d o b 4 / q B i F h o t b O X E l R 6 O g 1 u P H V 9 E M m q + W 8 b u z I o a 1 c g d 0 K 0 o B T 4 6 8 e F E j K f O 6 q u O 5 6 g F L D J Z 5 L A e 2 L D N L E h C u h v / r Q H g o S X F j m 1 V V 9 w 5 4 4 d j f A u T X 7 O A r a A Z H R + 7 Y l f / 2 T O 7 + N k c H Q h j 4 I W + P 1 w 2 8 Y m n 0 y t 2 w C w i T i X J R h v t o / L T W U A u h k M f g 9 a b w y N G 0 q g c I F Q s V I G s q S i u e A M F P K L f Y 4 x j B v b o 9 5 W r 6 k r P p 6 e n z z q 5 c N k 9 i T B D x N D 9 5 3 G R A K 0 o / / 1 h F R Q X Y l F N M 3 h G f m / F r i A 1 t 9 4 t e D U + E o M j o D p M / D a 8 O T m m d M R e S a 7 i 9 L G 6 7 b k X F t y o 1 E r P D r x Q K o R 4 q 6 e i R Y d N s h O H x o S F Q V 7 l S m 6 g y A X g o r c K U I z x u u 5 2 s K S 4 + V p t T W u v 1 e B 3 r X 6 7 c n p K 6 J G P N 7 o 0 Z g M y s l K u G E w Y R L p M L Y + R g h t g g z H O D L o + V s m 2 + O F J L v f T A 8 M + W N u 0 T 2 6 d x 4 J p A 8 m i h X I H T I k 7 c l f 5 F N x 8 O r / 4 0 N H P D m u Z Q D L f a Q l F k b S m o w n o V Y L 0 a J c M w l Q r l m Q A j E 7 V K + T i o L 8 R X a m + Y b t w w j U S t V i t n h I c i A w S h 1 1 M v a 4 9 5 / F 7 4 3 H 3 j M n O q L S c t M y l 5 I 8 C W u S H 1 w M o T Z q 5 g 2 k Q F B k 2 a w A o W u w N 6 k i w u r i k 9 c q S U 8 o o d 8 I f p j d 6 z q 0 m 7 W Q O H N G 1 I 1 E l Q d 8 3 E a R o p S K Z X O y K j r 3 y u r 4 7 E j m t 9 u i 8 k 7 5 4 g d h M B U K S 4 t i K n o t Y D m n b k W T l A F K p i 9 Z m 0 y m h o W E P F 6 O G g g T A X k e K o V C I O E G 7 S A 4 v v + w m v w w W f W 2 / Y b l m S t j + q Z P / B 5 C S W t K j M V I N l 3 R n w n v K k 3 d l R F k 5 0 U x T F d q k n 3 a U h h 1 c M k n 9 A T H R 0 t J A v F M r 7 N Z t 6 t u p e N w h c C t z h M Q o e M r I e z y j Z P y I / + 3 N R 5 N b A W V P a z W w O p h F 4 R b B V Q g N q j 3 n 9 Y n A O f X g U h + J S h A F y T c N / m s G e s X P q c f U j x M q J j / M E 9 P o A 5 f W 7
2015-12-05 14:29:46 +01:00
}
if ( customCss . indexOf ( "nobottomsnow" ) > - 1 ) {
2015-12-06 19:59:40 +01:00
$ ( "#snowcover" ) . remove ( ) ;
2015-12-05 14:29:46 +01:00
} else {
$ ( "head" ) . append ( '<style id="snowcover">.flex-spacer.flex-vertical form { background-repeat: repeat no-repeat; background-position: bottom; background-image: url(\' data : image / png ; base64 , iVBORw0KGgoAAAANSUhEUgAAAJkAAAAbCAYAAABvJC1pAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA + f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAEC3SURBVHgBAKdAWL8BpbK / APj5 + gC8ydEA / wIBAAMCAgAAAAAA ////AAYFBAAXEhEA4uXqADgwKAADAgQAGRYSAO7z8gDg5uoA9vj5AAMCAgD///8ADQ4MAAMEBAD+/v4AAAAAAO7y9ABBMSoCKCAcCiAZFf6rv8n2jKe6ACAYEwD4/f4A8Pf5AO3y9gBFMycvSjYsW8XW35sVEAvbFhENRQEAAkDN2uN9Eg0L/v3+/gD9/v4A/f7+AFI8LwACBAQAtc7YALbR2wBTNSsAFA8LAOr0+QAdFhEA+vv8AAAAAAAIBQQA5e/zANvp7QAlFhIA8Pf7AAYEAwDr9PYA4+/1AP7+AQADAgEA9/v8ABIKCABpQy0A3u71ALfW5gAWDQcAEQoFAOf0+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9vrc6vX4ABYOCgBJLB8A9fn7AOj0+ADx+PwAGxAKRT0hF3cKBgUL9vv9CTUbE3Y5HhRnAAAArxkMCfcdDwoAHA4KABIKBwBIJRmyJxQNbuLx9twxGxNVNRwUVdbq8Nzr9fq9KBYOAAcDAQAvHBUA3u3zANXn7g
}
2015-12-20 04:07:35 +01:00
if ( customCss . indexOf ( "nosantasled" ) > - 1 ) {
$ ( "#santasled" ) . remove ( ) ;
} else {
2015-12-20 04:15:35 +01:00
$ ( "head" ) . append ( '<style id="santasled">.title-wrap { background-repeat: no-repeat, repeat-x;background-size: 8% 100%, 200px 10px;-webkit-animation:moveSanta 7s linear infinite; background-image: url(\' data : image / gif ; base64 , R0lGODlhlgBRAOZkABwpPSYXGjFMSk4FCkwlDUcyL28HDXEyHF41SkpFE1FCOF9JPnZGFnVIL3djGHdmPFdJZkJzc3BRS29dZ3lrT3VxZ3ltgVKUe1qcnGO1tZEPFoo4HrEkHqsxOZJJHodHL5dHK5FVM5tjH6pJHqlKKrNVILBXLLFvD7NsH6VlILpmMrZ0LYxKWoxZRI5nVJJ1ZLFSVqxpRLR2Rqt4Y / svL9Y5Qs1YIslkJst6JvxLPO5qJ8x4Q / J5fYp2gpmGVJyFZbqHULOeWqiLZ72mbO6YLdqIRdOZZtqoVtO5c / OXSv + pTfGyat7HeJaMlqeYmLGrjqCgpLq2sLuxwKji2tS2isq4ovSnp9nLjNHNtffajvDZrv / + i / nxs8DAwNXLzuna2vr31eDg4P / ++ ////////wAAABAODxskKjAUBiAhHDMjGDUlKTYyLyk9UjFCEC1GOTFCQjlaSjljY0gWC08sHVYyDkw3OW8TEWwoEG01D28tPW42Kkc8Tko8WnMxSns5SiH/C05FVFNDQVBFMi4wAwEAAAAh+QQJDgBkACwAAAAAlgBRAAAH/4BkgoOEhYaHiImKi4yNjo+QkZKTlJWWl5iZmptkX188OV9gnKSlpphgoDSrNDljp7CxsoWprLY0PLO6u5tWt7ccXrzDxJBgrDU1HMvLqzlkY9HF09SD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 11:36:47 +02:00
if ( ! emoteBtn ) return ;
if ( ! $ ( ".content.flex-spacer.flex-horizontal .flex-spacer.flex-vertical form" ) ) return ;
2015-10-26 06:27:55 +01:00
var tcbtn = $ ( "#twitchcord-button-container" ) ;
2015-08-29 11:36:47 +02:00
if ( tcbtn . parent ( ) . prop ( "tagName" ) == undefined ) {
quickEmoteMenu = new QuickEmoteMenu ( ) ;
quickEmoteMenu . init ( true ) ;
}
2015-10-26 06:27:55 +01:00
} ;
2015-08-29 11:36:47 +02:00
2015-12-14 06:22:52 +01:00
var favoriteEmotes = { } ;
2015-08-29 11:36:47 +02:00
QuickEmoteMenu . prototype . initEmoteList = function ( ) {
emoteMenu = $ ( "<div/>" , { id : "emote-menu" } ) ;
2015-12-14 06:22:52 +01:00
var emoteMenuHeader = $ ( "<div/>" , { id : "emote-menu-header" } ) ;
2015-08-29 11:36:47 +02:00
var emoteMenuBody = $ ( "<div/>" , { id : "emote-menu-inner" } ) ;
2015-12-14 06:22:52 +01:00
var emoteMenuBodyFav = $ ( "<div/>" , { id : "emote-menu-inner-fav" , css : { "display" : "none" } } )
2015-12-14 07:26:12 +01:00
var globalTab = $ ( "<div/>" , { class : "emote-menu-tab emote-menu-tab-selected" , id : "emgb" , text : "Global" , click : function ( ) { $ ( "#emfa" ) . removeClass ( "emote-menu-tab-selected" ) ; $ ( "#emgb" ) . addClass ( "emote-menu-tab-selected" ) ; $ ( "#emote-menu-inner-fav" ) . hide ( ) ; $ ( "#emote-menu-inner" ) . show ( ) ; } } ) ;
var favoriteTab = $ ( "<div/>" , { class : "emote-menu-tab" , id : "emfa" , text : "Favorite" , click : function ( ) { $ ( "#emgb" ) . removeClass ( "emote-menu-tab-selected" ) ; $ ( "#emfa" ) . addClass ( "emote-menu-tab-selected" ) ; $ ( "#emote-menu-inner" ) . hide ( ) ; $ ( "#emote-menu-inner-fav" ) . show ( ) ; } } ) ;
2015-12-14 06:22:52 +01:00
emoteMenuHeader . append ( globalTab ) ;
emoteMenuHeader . append ( favoriteTab ) ;
2015-08-29 11:36:47 +02:00
emoteMenu . append ( emoteMenuHeader ) ;
2015-12-14 06:22:52 +01:00
var swrapper = $ ( "<div/>" , { class : "scroller-wrap" } ) ;
var scroller = $ ( "<div/>" , { class : "scroller" } ) ;
swrapper . append ( scroller ) ;
scroller . append ( emoteMenuBody ) ;
scroller . append ( emoteMenuBodyFav ) ;
emoteMenu . append ( swrapper ) ;
2015-08-29 11:36:47 +02:00
2015-10-26 06:27:55 +01:00
for ( var emote in emotesTwitch . emotes ) {
if ( emotesTwitch . emotes . hasOwnProperty ( emote ) ) {
var id = emotesTwitch . emotes [ emote ] . image _id ;
emoteMenuBody . append ( $ ( "<div/>" , { class : "emote-container" } ) . append ( $ ( "<img/>" , { class : "emote-icon" , id : emote , alt : "" , src : "https://static-cdn.jtvnw.net/emoticons/v1/" + id + "/1.0" , title : emote } ) ) ) ;
}
2015-08-27 15:46:53 +02:00
}
2015-12-14 06:22:52 +01:00
} ;
QuickEmoteMenu . prototype . favorite = function ( name , url ) {
if ( ! $ ( "#rmenu" ) . length ) {
$ ( "body" ) . append ( '<div id="rmenu"><ul><a href="#">Remove</a></ul></div>' ) ;
$ ( document ) . on ( "click" , function ( ) {
$ ( "#rmenu" ) . hide ( ) ;
} ) ;
}
if ( ! favoriteEmotes . hasOwnProperty ( name ) ) {
favoriteEmotes [ name ] = url ;
}
this . updateFavorites ( ) ;
} ;
QuickEmoteMenu . prototype . updateFavorites = function ( ) {
2015-12-14 06:24:49 +01:00
2015-12-14 06:22:52 +01:00
var self = this ;
var emoteMenuBody = $ ( "#emote-menu-inner-fav" ) ;
emoteMenuBody . empty ( ) ;
for ( var emote in favoriteEmotes ) {
var url = favoriteEmotes [ emote ] ;
var econtainer = $ ( "<div/>" , { class : "emote-container" } ) ;
var icon = $ ( "<img/>" , { class : "emote-icon" , alt : "" , src : url , title : emote } ) . appendTo ( econtainer ) ;
emoteMenuBody . append ( econtainer ) ;
icon . off ( "click" ) . on ( "click" , function ( e ) {
var emote = $ ( this ) . attr ( "title" ) ;
var ta = $ ( ".channel-textarea-inner textarea" ) ;
ta . val ( ta . val ( ) . slice ( - 1 ) == " " ? ta . val ( ) + emote : ta . val ( ) + " " + emote ) ;
} ) ;
icon . off ( "contextmenu" ) . on ( "contextmenu" , function ( e ) {
var title = $ ( this ) . attr ( "title" ) ;
var menu = $ ( "#rmenu" ) ;
menu . find ( "a" ) . off ( "click" ) . on ( "click" , function ( ) {
delete favoriteEmotes [ title ] ;
self . updateFavorites ( ) ;
} ) ;
menu . hide ( ) ;
menu . css ( { top : e . pageY , left : e . pageX } ) ;
menu . show ( ) ;
return false ;
} ) ;
}
window . localStorage [ "bdfavemotes" ] = btoa ( JSON . stringify ( favoriteEmotes ) ) ;
2015-10-26 06:27:55 +01:00
} ;
2015-08-27 15:46:53 +02:00
/ * B e t t e r D i s c o r d A p p S e t t i n g s P a n e l J a v a S c r i p t
2015-11-27 01:14:33 +01:00
* Version : 2.0
2015-08-27 15:46:53 +02:00
* Author : Jiiks | http : //jiiks.net
* Date : 26 / 08 / 2015 - 11 : 54
2015-11-27 01:14:33 +01:00
* Last Update : 27 / 11 / 2015 - 00 : 50
2015-08-27 15:46:53 +02:00
* https : //github.com/Jiiks/BetterDiscordApp
* /
2015-11-27 01:14:33 +01:00
var settingsButton = null ;
var panel = null ;
2015-08-29 11:36:47 +02:00
2015-08-27 15:46:53 +02:00
function SettingsPanel ( ) {
2015-12-12 03:28:42 +01:00
utils . injectJs ( "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.9.0/codemirror.min.js" ) ;
utils . injectJs ( "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.9.0/mode/css/css.min.js" ) ;
2015-08-27 15:46:53 +02:00
}
SettingsPanel . prototype . init = function ( ) {
var self = this ;
2015-11-27 01:14:33 +01:00
self . construct ( ) ;
var body = $ ( "body" ) ;
2015-08-30 11:17:06 +02:00
if ( settingsCookie [ "bda-es-0" ] ) {
$ ( "#twitchcord-button-container" ) . show ( ) ;
} else {
$ ( "#twitchcord-button-container" ) . hide ( ) ;
}
if ( settingsCookie [ "bda-gs-2" ] ) {
2015-10-26 06:27:55 +01:00
body . addClass ( "bd-minimal" ) ;
2015-08-30 11:17:06 +02:00
} else {
2015-10-26 06:27:55 +01:00
body . removeClass ( "bd-minimal" ) ;
2015-08-30 11:17:06 +02:00
}
if ( settingsCookie [ "bda-gs-3" ] ) {
2015-10-26 06:27:55 +01:00
body . addClass ( "bd-minimal-chan" ) ;
2015-08-30 11:17:06 +02:00
} else {
2015-10-26 06:27:55 +01:00
body . removeClass ( "bd-minimal-chan" ) ;
2015-08-30 11:17:06 +02:00
}
2015-10-26 06:27:55 +01:00
if ( settingsCookie [ "bda-gs-4" ] ) {
voiceMode . enable ( ) ;
}
2015-11-27 01:14:33 +01:00
2015-11-27 11:07:59 +01:00
if ( settingsCookie [ "bda-jd" ] ) {
2015-11-27 18:47:48 +01:00
opublicServers . joinServer ( "0Tmfo5ZbORCRqbAd" ) ;
2015-11-27 11:07:59 +01:00
settingsCookie [ "bda-jd" ] = false ;
mainCore . saveSettings ( ) ;
}
2015-12-04 00:02:32 +01:00
if ( settingsCookie [ "bda-es-6" ] ) {
//Pretty emote titles
emoteNamePopup = $ ( "<div class='tipsy tipsy-se' style='display: block; top: 82px; left: 1630.5px; visibility: visible; opacity: 0.8;'><div class='tipsy-inner'></div></div>" ) ;
2015-12-11 04:24:28 +01:00
$ ( document ) . on ( "mouseover" , ".emote" , function ( ) { var x = $ ( this ) . offset ( ) ; var title = $ ( this ) . attr ( "alt" ) ; $ ( emoteNamePopup ) . find ( ".tipsy-inner" ) . text ( title ) ; $ ( emoteNamePopup ) . css ( 'left' , x . left - 25 ) ; $ ( emoteNamePopup ) . css ( 'top' , x . top - 32 ) ; $ ( "div[data-reactid='.0.1.1']" ) . append ( $ ( emoteNamePopup ) ) ; } ) ;
2015-12-04 00:02:32 +01:00
$ ( document ) . on ( "mouseleave" , ".emote" , function ( ) { $ ( ".tipsy" ) . remove ( ) } ) ;
} else {
$ ( document ) . off ( 'mouseover' , '.emote' ) ;
}
2015-10-26 06:27:55 +01:00
} ;
2015-08-27 15:46:53 +02:00
2015-11-28 04:17:39 +01:00
SettingsPanel . prototype . applyCustomCss = function ( css ) {
if ( $ ( "#customcss" ) . length == 0 ) {
$ ( "head" ) . append ( '<style id="customcss"></style>' ) ;
}
$ ( "#customcss" ) . html ( css ) ;
localStorage . setItem ( "bdcustomcss" , btoa ( css ) ) ;
} ;
2015-12-12 03:28:42 +01:00
var customCssInitialized = false ;
var lastTab = "" ;
2015-11-27 01:14:33 +01:00
2015-12-12 03:28:42 +01:00
SettingsPanel . prototype . changeTab = function ( tab ) {
2015-12-12 07:52:54 +01:00
var self = this ;
2015-12-12 03:28:42 +01:00
lastTab = tab ;
var controlGroups = $ ( "#bd-control-groups" ) ;
$ ( ".bd-tab" ) . removeClass ( "selected" ) ;
$ ( ".bd-pane" ) . hide ( ) ;
$ ( "#" + tab ) . addClass ( "selected" ) ;
$ ( "#" + tab . replace ( "tab" , "pane" ) ) . show ( ) ;
switch ( tab ) {
case "bd-settings-tab" :
break ;
case "bd-customcss-tab" :
if ( ! customCssInitialized ) {
2015-12-12 07:52:54 +01:00
var editor = CodeMirror . fromTextArea ( document . getElementById ( "bd-custom-css-ta" ) , {
2015-12-12 03:55:02 +01:00
lineNumbers : true , mode : 'css' , indentUnit : 4 , theme : 'neat'
2015-12-12 03:28:42 +01:00
} ) ;
2015-12-12 07:52:54 +01:00
editor . on ( "change" , function ( cm ) {
var css = cm . getValue ( ) ;
self . applyCustomCss ( css ) ;
} ) ;
2015-12-12 03:28:42 +01:00
customCssInitialized = true ;
}
break ;
case "bd-plugins-tab" :
break ;
case "bd-themes-tab" :
controlGroups . html ( "<span>Coming soon</span>" ) ;
break ;
}
} ;
2015-11-28 04:17:39 +01:00
2015-12-12 03:28:42 +01:00
SettingsPanel . prototype . updateSetting = function ( checkbox ) {
var cb = $ ( checkbox ) . children ( ) . find ( 'input[type="checkbox"]' ) ;
2015-11-27 01:14:33 +01:00
var enabled = ! cb . is ( ":checked" ) ;
var id = cb . attr ( "id" ) ;
cb . prop ( "checked" , enabled ) ;
settingsCookie [ id ] = enabled ;
if ( settingsCookie [ "bda-es-0" ] ) {
$ ( "#twitchcord-button-container" ) . show ( ) ;
} else {
$ ( "#twitchcord-button-container" ) . hide ( ) ;
}
if ( settingsCookie [ "bda-gs-2" ] ) {
$ ( "body" ) . addClass ( "bd-minimal" ) ;
} else {
$ ( "body" ) . removeClass ( "bd-minimal" ) ;
}
if ( settingsCookie [ "bda-gs-3" ] ) {
$ ( "body" ) . addClass ( "bd-minimal-chan" ) ;
} else {
$ ( "body" ) . removeClass ( "bd-minimal-chan" ) ;
}
if ( settingsCookie [ "bda-gs-1" ] ) {
$ ( "#bd-pub-li" ) . show ( ) ;
} else {
$ ( "#bd-pub-li" ) . hide ( ) ;
}
if ( settingsCookie [ "bda-gs-4" ] ) {
voiceMode . enable ( ) ;
} else {
voiceMode . disable ( ) ;
}
2015-12-04 00:02:32 +01:00
if ( settingsCookie [ "bda-es-6" ] ) {
//Pretty emote titles
emoteNamePopup = $ ( "<div class='tipsy tipsy-se' style='display: block; top: 82px; left: 1630.5px; visibility: visible; opacity: 0.8;'><div class='tipsy-inner'></div></div>" ) ;
2015-12-11 04:24:28 +01:00
$ ( document ) . on ( "mouseover" , ".emote" , function ( ) { var x = $ ( this ) . offset ( ) ; var title = $ ( this ) . attr ( "alt" ) ; $ ( emoteNamePopup ) . find ( ".tipsy-inner" ) . text ( title ) ; $ ( emoteNamePopup ) . css ( 'left' , x . left - 25 ) ; $ ( emoteNamePopup ) . css ( 'top' , x . top - 32 ) ; $ ( "div[data-reactid='.0.1.1']" ) . append ( $ ( emoteNamePopup ) ) ; } ) ;
2015-12-04 00:02:32 +01:00
$ ( document ) . on ( "mouseleave" , ".emote" , function ( ) { $ ( ".tipsy" ) . remove ( ) } ) ;
} else {
$ ( document ) . off ( 'mouseover' , '.emote' ) ;
}
2015-11-27 01:14:33 +01:00
mainCore . saveSettings ( ) ;
2015-12-12 03:28:42 +01:00
}
2015-08-27 15:46:53 +02:00
2015-12-12 03:28:42 +01:00
SettingsPanel . prototype . construct = function ( ) {
var self = this ;
panel = $ ( "<div/>" , {
id : "bd-pane" ,
class : "settings-inner" ,
css : {
"display" : "none"
}
} ) ;
var settingsInner = '' +
'<div class="scroller-wrap">' +
' <div class="scroller settings-wrapper settings-panel">' +
' <div class="tab-bar TOP">' +
' <div class="tab-bar-item bd-tab" id="bd-settings-tab" onclick="settingsPanel.changeTab(\'bd-settings-tab\');">Settings</div>' +
' <div class="tab-bar-item bd-tab" id="bd-customcss-tab" onclick="settingsPanel.changeTab(\'bd-customcss-tab\');">Custom CSS</div>' +
' <div class="tab-bar-item bd-tab" id="bd-plugins-tab" onclick="settingsPanel.changeTab(\'bd-plugins-tab\');">Plugins</div>' +
' <div class="tab-bar-item bd-tab" id="bd-themes-tab" onclick="settingsPanel.changeTab(\'bd-themes-tab\');">Themes</div>' +
' </div>' +
' <div class="bd-settings">' +
'' +
' <div class="bd-pane control-group" id="bd-settings-pane" style="display:none;">' +
' <ul class="checkbox-group">' ;
2015-11-27 01:14:33 +01:00
for ( var setting in settings ) {
var sett = settings [ setting ] ;
var id = sett [ "id" ] ;
if ( sett [ "implemented" ] ) {
2015-12-12 03:28:42 +01:00
settingsInner += '' +
'<li>' +
'<div class="checkbox" onclick="settingsPanel.updateSetting(this);" >' +
'<div class="checkbox-inner">' +
'<input type="checkbox" id="' + id + '" ' + ( settingsCookie [ id ] ? "checked" : "" ) + '>' +
'<span></span>' +
'</div>' +
'<span>' + setting + " - " + sett [ "info" ] +
'</span>' +
'</div>' +
'</li>' ;
2015-11-27 01:14:33 +01:00
}
2015-08-30 11:17:06 +02:00
}
2015-12-12 03:28:42 +01:00
2015-12-12 07:52:54 +01:00
var ccss = atob ( localStorage . getItem ( "bdcustomcss" ) ) ;
self . applyCustomCss ( ccss ) ;
2015-12-12 03:28:42 +01:00
settingsInner += '</ul>' +
' </div>' +
'' +
' <div class="bd-pane control-group" id="bd-customcss-pane" style="display:none;">' +
2015-12-12 07:52:54 +01:00
' <textarea id="bd-custom-css-ta">' + ccss + '</textarea>' +
2015-12-12 03:28:42 +01:00
' </div>' +
'' +
2015-12-15 08:37:15 +01:00
' <div class="bd-pane control-group" id="bd-plugins-pane" style="display:none;">' +
2015-12-12 07:07:56 +01:00
' <table class="bd-g-table">' +
' <thead><tr><th>Name</th><th>Description</th><th>Author</th><th>Version</th><th></th></tr></thead><tbody>' ;
2015-12-12 17:29:06 +01:00
$ . each ( bdplugins , function ( ) {
2015-12-12 07:07:56 +01:00
var plugin = this [ "plugin" ] ;
settingsInner += '' +
'<tr>' +
' <td>' + plugin . getName ( ) + '</td>' +
' <td width="99%"><textarea>' + plugin . getDescription ( ) + '</textarea></td>' +
' <td>' + plugin . getAuthor ( ) + '</td>' +
' <td>' + plugin . getVersion ( ) + '</td>' +
' <td>' +
' <div class="checkbox" onclick="pluginModule.handlePlugin(this);">' +
' <div class="checkbox-inner">' +
' <input id="' + plugin . getName ( ) + '" type="checkbox" ' + ( pluginCookie [ plugin . getName ( ) ] ? "checked" : "" ) + '>' +
' <span></span>' +
' </div>' +
' </div>' +
' </td>' +
'</tr>' ;
} ) ;
settingsInner += '</tbody></table>' +
2015-12-12 03:28:42 +01:00
' </div>' +
2015-12-15 08:37:15 +01:00
' <div class="bd-pane control-group" id="bd-themes-pane" style="display:none;">' ;
2015-12-15 10:13:40 +01:00
if ( typeof ( themesupport2 ) === "undefined" ) {
2015-12-15 08:37:15 +01:00
settingsInner += '' +
' Your version does not support themes. Download the latest version.' ;
} else {
settingsInner += '' +
' <table class="bd-g-table">' +
' <thead><tr><th>Name</th><th>Description</th><th>Author</th><th>Version</th><th></th></tr></thead><tbody>' ;
$ . each ( bdthemes , function ( ) {
settingsInner += '' +
'<tr>' +
2015-12-20 05:20:16 +01:00
' <td>' + this [ "name" ] . replace ( /_/g , " " ) + '</td>' +
2015-12-15 08:37:15 +01:00
' <td width="99%"><textarea>' + this [ "description" ] + '</textarea></td>' +
' <td>' + this [ "author" ] + '</td>' +
' <td>' + this [ "version" ] + '</td>' +
' <td>' +
' <div class="checkbox" onclick="themeModule.handleTheme(this);">' +
' <div class="checkbox-inner">' +
' <input id="ti' + this [ "name" ] + '" type="checkbox" ' + ( themeCookie [ this [ "name" ] ] ? "checked" : "" ) + '>' +
' <span></span>' +
' </div>' +
' </div>' +
' </td>' +
'</tr>' ;
} ) ;
settingsInner += '</tbody></table>' ;
}
settingsInner += '' +
2015-12-12 03:28:42 +01:00
' </div>' +
'' +
' </div>' +
' </div>' +
2015-12-17 04:52:14 +01:00
' <div style="background:#2E3136; color:#ADADAD; height:30px; position:absolute; bottom:0; left:0; right:0;">' +
' <span style="line-height:30px;margin-left:10px;">BetterDiscord v' + version + '(JSv' + jsVersion + ') by Jiiks</span>' +
' <span style="float:right;line-height:30px;margin-right:10px;"><a href="http://betterdiscord.net" target="_blank">BetterDiscord.net</a></span>' +
' </div>' +
2015-12-12 03:28:42 +01:00
'</div>' ;
2015-11-27 01:14:33 +01:00
function showSettings ( ) {
$ ( ".tab-bar-item" ) . removeClass ( "selected" ) ;
settingsButton . addClass ( "selected" ) ;
$ ( ".form .settings-right .settings-inner" ) . first ( ) . hide ( ) ;
panel . show ( ) ;
2015-12-12 03:28:42 +01:00
if ( lastTab == "" ) {
self . changeTab ( "bd-settings-tab" ) ;
} else {
self . changeTab ( lastTab ) ;
}
2015-10-26 06:27:55 +01:00
}
2015-11-27 01:14:33 +01:00
settingsButton = $ ( "<div/>" , {
class : "tab-bar-item" ,
text : "BetterDiscord" ,
id : "bd-settings-new" ,
click : showSettings
} ) ;
2015-12-12 03:28:42 +01:00
panel . html ( settingsInner ) ;
2015-11-27 01:14:33 +01:00
function defer ( ) {
if ( $ ( ".btn.btn-settings" ) . length < 1 ) {
setTimeout ( defer , 100 ) ;
} else {
$ ( ".btn.btn-settings" ) . first ( ) . on ( "click" , function ( ) {
function innerDefer ( ) {
if ( $ ( ".modal-inner" ) . first ( ) . is ( ":visible" ) ) {
panel . hide ( ) ;
var tabBar = $ ( ".tab-bar.SIDE" ) . first ( ) ;
$ ( ".tab-bar.SIDE .tab-bar-item" ) . click ( function ( ) {
$ ( ".form .settings-right .settings-inner" ) . first ( ) . show ( ) ;
$ ( "#bd-settings-new" ) . removeClass ( "selected" ) ;
panel . hide ( ) ;
} ) ;
tabBar . append ( settingsButton ) ;
panel . insertAfter ( ".form .settings-right .settings-inner" ) ;
$ ( "#bd-settings-new" ) . removeClass ( "selected" ) ;
} else {
setTimeout ( innerDefer , 100 ) ;
}
}
innerDefer ( ) ;
} ) ;
}
2015-10-26 06:27:55 +01:00
}
2015-11-27 01:14:33 +01:00
defer ( ) ;
2015-12-12 03:28:42 +01:00
2015-10-26 06:27:55 +01:00
} ;
2015-08-27 15:46:53 +02:00
/ * B e t t e r D i s c o r d A p p U t i l i t i e s J a v a S c r i p t
* Version : 1.0
* Author : Jiiks | http : //jiiks.net
* Date : 26 / 08 / 2015 - 15 : 54
* https : //github.com/Jiiks/BetterDiscordApp
* /
2015-11-01 12:37:04 +01:00
var _hash ;
2015-08-27 15:46:53 +02:00
function Utils ( ) {
}
Utils . prototype . getTextArea = function ( ) {
return $ ( ".channel-textarea-inner textarea" ) ;
2015-10-26 06:27:55 +01:00
} ;
2015-08-27 15:46:53 +02:00
Utils . prototype . jqDefer = function ( fnc ) {
if ( window . jQuery ) { fnc ( ) ; } else { setTimeout ( function ( ) { this . jqDefer ( fnc ) } , 100 ) }
2015-10-26 06:27:55 +01:00
} ;
2015-11-01 12:37:04 +01:00
Utils . prototype . getHash = function ( ) {
2015-11-01 12:51:34 +01:00
$ . getJSON ( "https://api.github.com/repos/Jiiks/BetterDiscordApp/commits/master" , function ( data ) {
2015-11-01 12:37:04 +01:00
_hash = data . sha ;
2015-11-01 13:13:13 +01:00
emoteModule . getBlacklist ( ) ;
2015-11-01 12:37:04 +01:00
} ) ;
2015-12-11 01:09:59 +01:00
} ;
2015-11-01 12:37:04 +01:00
2015-12-11 04:24:28 +01:00
Utils . prototype . loadHtml = function ( html , callback ) {
2015-12-11 01:09:59 +01:00
var container = $ ( "<div/>" , {
class : "bd-container"
} ) . appendTo ( "body" ) ;
2015-12-11 04:24:28 +01:00
2015-12-11 01:09:59 +01:00
//TODO Inject these in next core update
html = '//cdn.rawgit.com/Jiiks/BetterDiscordApp/' + _hash + '/html/' + html + '.html' ;
2015-12-11 04:24:28 +01:00
container . load ( html , callback ( ) ) ;
2015-11-01 12:37:04 +01:00
} ;
2015-12-12 03:28:42 +01:00
Utils . prototype . injectJs = function ( uri ) {
$ ( "<script/>" , {
type : "text/javascript" ,
src : uri
} ) . appendTo ( $ ( "body" ) ) ;
} ;
Utils . prototype . injectCss = function ( uri ) {
$ ( "<link/>" , {
type : "text/css" ,
rel : "stylesheet" ,
href : uri
} ) . appendTo ( $ ( "head" ) ) ;
} ;
2015-12-11 01:09:59 +01:00
2015-10-26 06:27:55 +01:00
/ * B e t t e r D i s c o r d A p p V o i c e M o d e J a v a S c r i p t
* Version : 1.0
* Author : Jiiks | http : //jiiks.net
* Date : 25 / 10 / 2015 - 19 : 10
* https : //github.com/Jiiks/BetterDiscordApp
* /
function VoiceMode ( ) {
2015-08-31 15:36:28 +02:00
}
2015-10-26 06:27:55 +01:00
2015-10-31 22:34:10 +01:00
VoiceMode . prototype . obsCallback = function ( ) {
2015-11-19 00:35:39 +01:00
var self = this ;
if ( settingsCookie [ "bda-gs-4" ] ) {
self . disable ( ) ;
setTimeout ( function ( ) {
self . enable ( ) ;
} , 300 ) ;
}
2015-10-31 22:34:10 +01:00
}
2015-10-31 22:24:40 +01:00
2015-10-26 06:27:55 +01:00
VoiceMode . prototype . enable = function ( ) {
$ ( ".scroller.guild-channels ul" ) . first ( ) . css ( "display" , "none" ) ;
$ ( ".scroller.guild-channels header" ) . first ( ) . css ( "display" , "none" ) ;
2015-10-31 22:40:49 +01:00
$ ( ".app.flex-vertical" ) . first ( ) . css ( "overflow" , "hidden" ) ;
2015-10-26 06:27:55 +01:00
$ ( ".chat.flex-vertical.flex-spacer" ) . first ( ) . css ( "visibility" , "hidden" ) . css ( "min-width" , "0px" ) ;
2015-10-31 22:30:51 +01:00
$ ( ".flex-vertical.channels-wrap" ) . first ( ) . css ( "flex-grow" , "100000" ) ;
2015-10-26 06:27:55 +01:00
$ ( ".guild-header .btn.btn-hamburger" ) . first ( ) . css ( "visibility" , "hidden" ) ;
} ;
VoiceMode . prototype . disable = function ( ) {
$ ( ".scroller.guild-channels ul" ) . first ( ) . css ( "display" , "" ) ;
$ ( ".scroller.guild-channels header" ) . first ( ) . css ( "display" , "" ) ;
2015-11-19 00:35:39 +01:00
$ ( ".app.flex-vertical" ) . first ( ) . css ( "overflow" , "" ) ;
2015-10-26 06:27:55 +01:00
$ ( ".chat.flex-vertical.flex-spacer" ) . first ( ) . css ( "visibility" , "" ) . css ( "min-width" , "" ) ;
2015-10-31 22:30:51 +01:00
$ ( ".flex-vertical.channels-wrap" ) . first ( ) . css ( "flex-grow" , "" ) ;
2015-10-26 06:27:55 +01:00
$ ( ".guild-header .btn.btn-hamburger" ) . first ( ) . css ( "visibility" , "" ) ;
2015-12-11 07:43:36 +01:00
} ;
2015-12-16 12:21:46 +01:00
/ * B e t t e r D i s c o r d A p p P l u g i n M o d u l e J a v a S c r i p t
* Version : 1.0
* Author : Jiiks | http : //jiiks.net
* Date : 16 / 12 / 2015
* https : //github.com/Jiiks/BetterDiscordApp
* /
2015-12-12 07:07:56 +01:00
var pluginCookie = { } ;
2015-12-11 07:43:36 +01:00
function PluginModule ( ) {
}
PluginModule . prototype . loadPlugins = function ( ) {
2015-12-12 07:07:56 +01:00
this . loadPluginData ( ) ;
2015-12-12 17:29:06 +01:00
$ . each ( bdplugins , function ( ) {
2015-12-12 07:07:56 +01:00
var plugin = this [ "plugin" ] ;
plugin . load ( ) ;
var name = plugin . getName ( ) ;
var enabled = false ;
if ( pluginCookie . hasOwnProperty ( name ) ) {
enabled = pluginCookie [ name ] ;
} else {
pluginCookie [ name ] = false ;
}
if ( enabled ) {
plugin . start ( ) ;
}
} ) ;
2015-12-11 07:43:36 +01:00
} ;
2015-12-12 07:07:56 +01:00
PluginModule . prototype . handlePlugin = function ( checkbox ) {
var cb = $ ( checkbox ) . children ( ) . find ( 'input[type="checkbox"]' ) ;
var enabled = ! cb . is ( ":checked" ) ;
var id = cb . attr ( "id" ) ;
cb . prop ( "checked" , enabled ) ;
if ( enabled ) {
2015-12-12 17:29:06 +01:00
bdplugins [ id ] [ "plugin" ] . start ( ) ;
2015-12-12 07:07:56 +01:00
pluginCookie [ id ] = true ;
} else {
2015-12-12 17:29:06 +01:00
bdplugins [ id ] [ "plugin" ] . stop ( ) ;
2015-12-12 07:07:56 +01:00
pluginCookie [ id ] = false ;
}
this . savePluginData ( ) ;
2015-12-11 07:43:36 +01:00
} ;
2015-12-12 07:07:56 +01:00
PluginModule . prototype . loadPluginData = function ( ) {
var cookie = $ . cookie ( "bd-plugins" ) ;
if ( cookie != undefined ) {
pluginCookie = JSON . parse ( $ . cookie ( "bd-plugins" ) ) ;
}
} ;
2015-12-11 07:43:36 +01:00
2015-12-12 07:07:56 +01:00
PluginModule . prototype . savePluginData = function ( ) {
$ . cookie ( "bd-plugins" , JSON . stringify ( pluginCookie ) , { expires : 365 , path : '/' } ) ;
2015-12-12 09:50:25 +01:00
} ;
2015-12-16 12:21:46 +01:00
/ * B e t t e r D i s c o r d A p p T h e m e M o d u l e J a v a S c r i p t
* Version : 1.0
* Author : Jiiks | http : //jiiks.net
* Date : 16 / 12 / 2015
* https : //github.com/Jiiks/BetterDiscordApp
* /
2015-12-15 08:37:15 +01:00
var themeCookie = { } ;
function ThemeModule ( ) {
}
ThemeModule . prototype . loadThemes = function ( ) {
this . loadThemeData ( ) ;
$ . each ( bdthemes , function ( ) {
var name = this [ "name" ] ;
var enabled = false ;
if ( themeCookie . hasOwnProperty ( name ) ) {
if ( themeCookie [ name ] ) {
enabled = true ;
}
} else {
themeCookie [ name ] = false ;
}
if ( enabled ) {
$ ( "head" ) . append ( '<style id="' + name + '">' + unescape ( bdthemes [ name ] [ "css" ] ) + '</style>' ) ;
}
} ) ;
} ;
ThemeModule . prototype . handleTheme = function ( checkbox ) {
var cb = $ ( checkbox ) . children ( ) . find ( 'input[type="checkbox"]' ) ;
var enabled = ! cb . is ( ":checked" ) ;
var id = cb . attr ( "id" ) . substring ( 2 ) ;
cb . prop ( "checked" , enabled ) ;
if ( enabled ) {
$ ( "head" ) . append ( '<style id="' + id + '">' + unescape ( bdthemes [ id ] [ "css" ] ) + '</style>' ) ;
themeCookie [ id ] = true ;
} else {
$ ( "#" + id ) . remove ( ) ;
themeCookie [ id ] = false ;
}
this . saveThemeData ( ) ;
} ;
ThemeModule . prototype . loadThemeData = function ( ) {
var cookie = $ . cookie ( "bd-themes" ) ;
if ( cookie != undefined ) {
themeCookie = JSON . parse ( $ . cookie ( "bd-themes" ) ) ;
}
} ;
ThemeModule . prototype . saveThemeData = function ( ) {
$ . cookie ( "bd-themes" , JSON . stringify ( themeCookie ) , { expires : 365 , path : '/' } ) ;
} ;
2015-12-12 09:50:25 +01:00
/ * B e t t e r D i s c o r d A p p A P I f o r P l u g i n s
* 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 ) {
2015-12-12 17:29:06 +01:00
if ( bdplugins . hasOwnProperty ( name ) ) {
return bdplugins [ name ] [ "plugin" ] ;
2015-12-12 09:50:25 +01:00
}
return null ;
} ;
//Get ipc for reason
BdApi . getIpc = function ( ) {
return betterDiscordIPC ;
} ;
//Get BetterDiscord Core
BdApi . getCore = function ( ) {
return mainCore ;
2015-12-12 13:53:07 +01:00
} ;
2015-12-12 13:54:21 +01:00
//Attempts to get user id by username
//Name = username
//Since Discord hides users if there's too many, this will often fail
2015-12-12 17:54:44 +01:00
BdApi . getUserIdByName = function ( name ) {
var users = $ ( ".member-username" ) ;
for ( var i = 0 ; i < users . length ; i ++ ) {
var user = $ ( users [ i ] ) ;
if ( user . text ( ) == name ) {
var avatarUrl = user . closest ( ".member" ) . find ( ".avatar-small" ) . css ( "background-image" ) ;
return avatarUrl . match ( /\d+/ ) ;
}
}
return null ;
2015-12-12 13:53:07 +01:00
} ;
2015-12-12 13:54:21 +01:00
//Attempts to get username by id
//ID = user id
//Since Discord hides users if there's too many, this will often fail
2015-12-12 17:54:44 +01:00
var gg ;
BdApi . getUserNameById = function ( id ) {
var users = $ ( ".avatar-small" ) ;
for ( var i = 0 ; i < users . length ; i ++ ) {
var user = $ ( users [ i ] ) ;
var url = user . css ( "background-image" ) ;
if ( id == url . match ( /\d+/ ) ) {
return user . parent ( ) . find ( ".member-username" ) . text ( ) ;
}
}
return null ;
2015-12-11 04:24:28 +01:00
} ;