2019-05-29 05:48:41 +02:00
var Core =
/******/ ( function ( modules ) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/
/******/ // Check if module is in cache
/******/ if ( installedModules [ moduleId ] ) {
/******/ return installedModules [ moduleId ] . exports ;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules [ moduleId ] = {
/******/ i : moduleId ,
/******/ l : false ,
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ modules [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/
/******/ // Flag the module as loaded
/******/ module . l = true ;
/******/
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ _ _webpack _require _ _ . m = modules ;
/******/
/******/ // expose the module cache
/******/ _ _webpack _require _ _ . c = installedModules ;
/******/
/******/ // define getter function for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , name , getter ) {
/******/ if ( ! _ _webpack _require _ _ . o ( exports , name ) ) {
/******/ Object . defineProperty ( exports , name , { enumerable : true , get : getter } ) ;
/******/ }
/******/ } ;
/******/
/******/ // define __esModule on exports
/******/ _ _webpack _require _ _ . r = function ( exports ) {
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
/******/ } ;
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ _ _webpack _require _ _ . t = function ( value , mode ) {
/******/ if ( mode & 1 ) value = _ _webpack _require _ _ ( value ) ;
/******/ if ( mode & 8 ) return value ;
/******/ if ( ( mode & 4 ) && typeof value === 'object' && value && value . _ _esModule ) return value ;
/******/ var ns = Object . create ( null ) ;
/******/ _ _webpack _require _ _ . r ( ns ) ;
/******/ Object . defineProperty ( ns , 'default' , { enumerable : true , value : value } ) ;
/******/ if ( mode & 2 && typeof value != 'string' ) for ( var key in value ) _ _webpack _require _ _ . d ( ns , key , function ( key ) { return value [ key ] ; } . bind ( null , key ) ) ;
/******/ return ns ;
/******/ } ;
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ _ _webpack _require _ _ . n = function ( module ) {
/******/ var getter = module && module . _ _esModule ?
/******/ function getDefault ( ) { return module [ 'default' ] ; } :
/******/ function getModuleExports ( ) { return module ; } ;
/******/ _ _webpack _require _ _ . d ( getter , 'a' , getter ) ;
/******/ return getter ;
/******/ } ;
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ _ _webpack _require _ _ . o = function ( object , property ) { return Object . prototype . hasOwnProperty . call ( object , property ) ; } ;
/******/
/******/ // __webpack_public_path__
/******/ _ _webpack _require _ _ . p = "" ;
/******/
/******/
/******/ // Load entry module and return exports
/******/ return _ _webpack _require _ _ ( _ _webpack _require _ _ . s = "./src/index.js" ) ;
/******/ } )
/************************************************************************/
/******/ ( {
2019-05-30 23:18:52 +02:00
/***/ "./src/builtins/24hour.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / builtins / 24 hour . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../structs/builtin */ "./src/structs/builtin.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class TwentyFourHour extends _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] {
get name ( ) {
return "24Hour" ;
}
get category ( ) {
return "Modules" ;
}
get id ( ) {
return "bda-gs-6" ;
}
enabled ( ) {
this . inject24Hour ( ) ;
}
disabled ( ) {
if ( this . cancel24Hour ) this . cancel24Hour ( ) ;
}
inject24Hour ( ) {
if ( this . cancel24Hour ) return ;
const twelveHour = new RegExp ( ` ([0-9]{1,2}):([0-9]{1,2}) \\ s(AM|PM) ` ) ;
const convert = data => {
const matched = data . returnValue . match ( twelveHour ) ;
if ( ! matched || matched . length !== 4 ) return ;
if ( matched [ 3 ] === "AM" ) return data . returnValue = data . returnValue . replace ( matched [ 0 ] , ` ${ matched [ 1 ] === "12" ? "00" : matched [ 1 ] . padStart ( 2 , "0" ) } : ${ matched [ 2 ] } ` ) ;
return data . returnValue = data . returnValue . replace ( matched [ 0 ] , ` ${ matched [ 1 ] === "12" ? "12" : parseInt ( matched [ 1 ] ) + 12 } : ${ matched [ 2 ] } ` ) ;
} ;
const cancelCozy = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Utilities" ] . monkeyPatch ( modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . TimeFormatter , "calendarFormat" , {
after : convert
} ) ; // Called in Cozy mode
const cancelCompact = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Utilities" ] . monkeyPatch ( modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . TimeFormatter , "dateFormat" , {
after : convert
} ) ; // Called in Compact mode
this . cancel24Hour = ( ) => {
cancelCozy ( ) ;
cancelCompact ( ) ;
} ; // Cancel both
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/builtins/builtins.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / builtins / builtins . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: VoiceMode, ClassNormalizer, DeveloperMode, PublicServers, DarkMode, MinimalMode, TwentyFourHour, ColoredText */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _voicemode _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./voicemode */ "./src/builtins/voicemode.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "VoiceMode" , function ( ) { return _voicemode _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _classnormalizer _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./classnormalizer */ "./src/builtins/classnormalizer.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ClassNormalizer" , function ( ) { return _classnormalizer _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _developermode _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./developermode */ "./src/builtins/developermode.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "DeveloperMode" , function ( ) { return _developermode _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _publicservers _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./publicservers */ "./src/builtins/publicservers.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "PublicServers" , function ( ) { return _publicservers _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _darkmode _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./darkmode */ "./src/builtins/darkmode.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "DarkMode" , function ( ) { return _darkmode _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _minimalmode _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./minimalmode */ "./src/builtins/minimalmode.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "MinimalMode" , function ( ) { return _minimalmode _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _24hour _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./24hour */ "./src/builtins/24hour.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "TwentyFourHour" , function ( ) { return _24hour _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _coloredtext _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./coloredtext */ "./src/builtins/coloredtext.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ColoredText" , function ( ) { return _coloredtext _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] ; } ) ;
/***/ } ) ,
/***/ "./src/builtins/classnormalizer.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / builtins / classnormalizer . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../structs/builtin */ "./src/structs/builtin.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
const normalizedPrefix = "da" ;
const randClass = new RegExp ( ` ^(?! ${ normalizedPrefix } -)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6} $ ` ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class ClassNormalizer extends _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] {
get id ( ) {
return "fork-ps-4" ;
}
get category ( ) {
return "Modules" ;
}
get name ( ) {
return "ClassNormalizer" ;
}
disabled ( ) {
if ( ! this . hasPatched ) return ;
this . unpatchClassModules ( modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "WebpackModules" ] . getModules ( this . moduleFilter . bind ( this ) ) ) ;
this . revertElement ( document . querySelector ( "#app-mount" ) ) ;
this . hasPatched = false ;
}
enabled ( ) {
if ( this . hasPatched ) return ;
this . patchClassModules ( modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "WebpackModules" ] . getModules ( this . moduleFilter . bind ( this ) ) ) ;
this . normalizeElement ( document . querySelector ( "#app-mount" ) ) ;
this . hasPatched = true ;
}
patchClassModules ( modules ) {
for ( const module of modules ) {
this . patchClassModule ( normalizedPrefix , module ) ;
}
}
unpatchClassModules ( modules ) {
for ( const module of modules ) {
this . unpatchClassModule ( normalizedPrefix , module ) ;
}
}
shouldIgnore ( value ) {
if ( ! isNaN ( value ) ) return true ;
if ( value . endsWith ( "px" ) || value . endsWith ( "ch" ) || value . endsWith ( "em" ) || value . endsWith ( "ms" ) ) return true ;
if ( value . startsWith ( "layerContainer-" ) ) return true ;
if ( value . startsWith ( "#" ) && ( value . length == 7 || value . length == 4 ) ) return true ;
if ( value . includes ( "calc(" ) || value . includes ( "rgba" ) ) return true ;
return false ;
}
moduleFilter ( module ) {
if ( typeof module !== "object" || Array . isArray ( module ) ) return false ;
if ( module . _ _esModule ) return false ;
if ( ! Object . keys ( module ) . length ) return false ;
for ( const baseClassName in module ) {
const value = module [ baseClassName ] ;
if ( typeof value !== "string" ) return false ;
if ( this . shouldIgnore ( value ) ) continue ;
if ( value . split ( "-" ) . length === 1 ) return false ;
if ( ! randClass . test ( value . split ( " " ) [ 0 ] ) ) return false ;
}
return true ;
}
patchClassModule ( componentName , classNames ) {
for ( const baseClassName in classNames ) {
const value = classNames [ baseClassName ] ;
if ( this . shouldIgnore ( value ) ) continue ;
const classList = value . split ( " " ) ;
for ( const normalClass of classList ) {
const match = normalClass . match ( randClass ) [ 1 ] ;
if ( ! match ) continue ; // Shouldn't ever happen since they passed the moduleFilter, but you never know
const camelCase = match . split ( "-" ) . map ( ( s , i ) => i ? s [ 0 ] . toUpperCase ( ) + s . slice ( 1 ) : s ) . join ( "" ) ;
classNames [ baseClassName ] += ` ${ componentName } - ${ camelCase } ` ;
}
}
}
unpatchClassModule ( componentName , classNames ) {
for ( const baseClassName in classNames ) {
const value = classNames [ baseClassName ] ;
if ( this . shouldIgnore ( value ) ) continue ;
let newString = "" ;
const classList = value . split ( " " ) ;
for ( const normalClass of classList ) {
if ( normalClass . startsWith ( ` ${ componentName } - ` ) ) continue ;
newString += ` ${ normalClass } ` ;
}
classNames [ baseClassName ] = newString . trim ( ) ;
}
}
normalizeElement ( element ) {
if ( ! ( element instanceof Element ) ) return ;
const classes = element . classList ;
for ( let c = 0 , clen = classes . length ; c < clen ; c ++ ) {
if ( ! randClass . test ( classes [ c ] ) ) continue ;
const match = classes [ c ] . match ( randClass ) [ 1 ] ;
const newClass = match . split ( "-" ) . map ( ( s , i ) => i ? s [ 0 ] . toUpperCase ( ) + s . slice ( 1 ) : s ) . join ( "" ) ;
element . classList . add ( ` ${ normalizedPrefix } - ${ newClass } ` ) ;
}
for ( const child of element . children ) this . normalizeElement ( child ) ;
}
revertElement ( element ) {
if ( ! ( element instanceof Element ) ) return ;
if ( element . children && element . children . length ) this . revertElement ( element . children [ 0 ] ) ;
if ( element . nextElementSibling ) this . revertElement ( element . nextElementSibling ) ;
const classes = element . classList ;
const toRemove = [ ] ;
for ( let c = 0 ; c < classes . length ; c ++ ) {
if ( classes [ c ] . startsWith ( ` ${ normalizedPrefix } - ` ) ) toRemove . push ( classes [ c ] ) ;
}
element . classList . remove ( ... toRemove ) ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/builtins/coloredtext.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / builtins / coloredtext . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../structs/builtin */ "./src/structs/builtin.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
const MessageContent = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "WebpackModules" ] . getModule ( m => m . defaultProps && m . defaultProps . hasOwnProperty ( "disableButtons" ) ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class ColoredText extends _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] {
get name ( ) {
return "ColoredText" ;
}
get category ( ) {
return "Modules" ;
}
get id ( ) {
return "bda-gs-7" ;
}
enabled ( ) {
this . injectColoredText ( ) ;
}
disabled ( ) {
if ( this . cancelColoredText ) this . cancelColoredText ( ) ;
}
injectColoredText ( ) {
if ( this . cancelColoredText ) return ;
this . cancelColoredText = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Utilities" ] . monkeyPatch ( MessageContent . prototype , "render" , {
after : data => {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Utilities" ] . monkeyPatch ( data . returnValue . props , "children" , {
silent : true ,
after : ( {
returnValue
} ) => {
const markup = returnValue . props . children [ 1 ] ;
const roleColor = data . thisObject . props . message . colorString ;
if ( markup && roleColor ) markup . props . style = {
color : roleColor
} ;
return returnValue ;
}
} ) ;
}
} ) ;
}
removeColoredText ( ) {
document . querySelectorAll ( ".markup-2BOw-j" ) . forEach ( elem => {
elem . style . setProperty ( "color" , "" ) ;
} ) ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/builtins/darkmode.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / builtins / darkmode . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../structs/builtin */ "./src/structs/builtin.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class DarkMode extends _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] {
get name ( ) {
return "DarkMode" ;
}
get category ( ) {
return "Modules" ;
}
get id ( ) {
return "bda-gs-5" ;
}
enabled ( ) {
$ ( "#app-mount" ) . addClass ( "bda-dark" ) . addClass ( "bd-dark" ) ;
}
disabled ( ) {
$ ( "#app-mount" ) . removeClass ( "bda-dark" ) . removeClass ( "bd-dark" ) ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/builtins/developermode.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / builtins / developermode . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../structs/builtin */ "./src/structs/builtin.js" ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class DeveloperMode extends _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] {
get name ( ) {
return "DeveloperMode" ;
}
get category ( ) {
return "Modules" ;
}
get id ( ) {
return "bda-gs-8" ;
}
get selectorModeID ( ) {
return "fork-dm-1" ;
}
get selectorMode ( ) {
return data _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "SettingsCookie" ] [ this . selectorModeID ] ;
}
constructor ( ) {
super ( ) ;
this . enableSelectors = this . enableSelectors . bind ( this ) ;
this . disableSelectors = this . disableSelectors . bind ( this ) ;
}
enabled ( ) {
$ ( window ) . on ( "keydown.bdDevmode" , e => {
if ( e . which === 119 || e . which == 118 ) {
//F8
this . log ( "Debugger Activated" ) ;
debugger ; // eslint-disable-line no-debugger
}
} ) ;
if ( this . selectorMode ) this . enableSelectors ( ) ;
this . selectorCancel = Object ( _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "onSettingChange" ] ) ( this . category , this . selectorModeID , this . enableSelectors , this . disableSelectors ) ;
}
disabled ( ) {
$ ( window ) . off ( "keydown.bdDevmode" ) ;
if ( this . selectorMode ) this . disableSelectors ( ) ;
if ( this . selectorCancel ) this . selectorCancel ( ) ;
}
enableSelectors ( ) {
$ ( document ) . on ( "contextmenu.bdDevmode" , e => {
this . lastSelector = this . getSelector ( e . toElement ) ;
const attach = ( ) => {
let cm = $ ( ".contextMenu-HLZMGh" ) ;
if ( cm . length <= 0 ) {
cm = $ ( "<div class=\"contextMenu-HLZMGh bd-context-menu\"></div>" ) ;
cm . addClass ( $ ( ".app, .app-2rEoOp" ) . hasClass ( "theme-dark" ) ? "theme-dark" : "theme-light" ) ;
cm . appendTo ( ".app, .app-2rEoOp" ) ;
cm . css ( "top" , e . clientY ) ;
cm . css ( "left" , e . clientX ) ;
$ ( document ) . on ( "click.bdDevModeCtx" , ( ) => {
cm . remove ( ) ;
$ ( document ) . off ( ".bdDevModeCtx" ) ;
} ) ;
$ ( document ) . on ( "contextmenu.bdDevModeCtx" , ( ) => {
cm . remove ( ) ;
$ ( document ) . off ( ".bdDevModeCtx" ) ;
} ) ;
$ ( document ) . on ( "keyup.bdDevModeCtx" , e => {
if ( e . keyCode === 27 ) {
cm . remove ( ) ;
$ ( document ) . off ( ".bdDevModeCtx" ) ;
}
} ) ;
}
const cmo = $ ( "<div/>" , {
"class" : "itemGroup-1tL0uz"
} ) ;
const cmi = $ ( "<div/>" , {
"class" : "item-1Yvehc" ,
"click" : ( ) => {
modules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "DiscordModules" ] . ElectronModule . copy ( this . lastSelector ) ;
cm . hide ( ) ;
}
} ) . append ( $ ( "<span/>" , {
text : "Copy Selector"
} ) ) ;
cmo . append ( cmi ) ;
cm . append ( cmo ) ;
if ( cm . hasClass ( "undefined" ) ) cm . css ( "top" , "-=" + cmo . outerHeight ( ) ) ;
} ;
setImmediate ( attach ) ;
e . stopPropagation ( ) ;
} ) ;
}
disableSelectors ( ) {
$ ( document ) . off ( "contextmenu.bdDevmode" ) ;
$ ( document ) . off ( "contextmenu.bdDevModeCtx" ) ;
}
getRules ( element , css = element . ownerDocument . styleSheets ) {
// return [].concat(...[...css].map(s => [...s.cssRules || []])).filter(r => r && r.selectorText && element.matches(r.selectorText) && r.style.length && r.selectorText.split(", ").length < 8);
const sheets = [ ... css ] . filter ( s => ! s . href || ! s . href . includes ( "BetterDiscordApp" ) ) ;
const rules = sheets . map ( s => [ ... ( s . cssRules || [ ] ) ] ) . flat ( ) ;
const elementRules = rules . filter ( r => r && r . selectorText && element . matches ( r . selectorText ) && r . style . length && r . selectorText . split ( ", " ) . length < 8 && ! r . selectorText . split ( ", " ) . includes ( "*" ) ) ;
return elementRules ;
}
getSelector ( element ) {
if ( element . id ) return ` # ${ element . id } ` ;
const rules = this . getRules ( element ) ;
const latestRule = rules [ rules . length - 1 ] ;
if ( latestRule ) return latestRule . selectorText ; else if ( element . classList . length ) return ` . ${ Array . from ( element . classList ) . join ( "." ) } ` ;
return ` . ${ Array . from ( element . parentElement . classList ) . join ( "." ) } ` ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/builtins/minimalmode.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / builtins / minimalmode . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../structs/builtin */ "./src/structs/builtin.js" ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class MinimalMode extends _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] {
get name ( ) {
return "MinimalMode" ;
}
get category ( ) {
return "Modules" ;
}
get id ( ) {
return "bda-gs-2" ;
}
get hideChannelsID ( ) {
return "bda-gs-3" ;
}
get hideChannels ( ) {
return data _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "SettingsCookie" ] [ this . hideChannelsID ] ;
}
constructor ( ) {
super ( ) ;
this . enableHideChannels = this . enableHideChannels . bind ( this ) ;
this . disableHideChannels = this . disableHideChannels . bind ( this ) ;
}
enabled ( ) {
$ ( "body" ) . addClass ( "bd-minimal" ) ;
if ( this . hideChannels ) this . enableHideChannels ( ) ;
this . hideChannelCancel = Object ( _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "onSettingChange" ] ) ( this . category , this . hideChannelsID , this . enableHideChannels , this . disableHideChannels ) ;
}
disabled ( ) {
$ ( "body" ) . removeClass ( "bd-minimal" ) ;
if ( this . hideChannels ) this . disableHideChannels ( ) ;
if ( this . hideChannelCancel ) this . hideChannelCancel ( ) ;
}
enableHideChannels ( ) {
$ ( "body" ) . addClass ( "bd-minimal-chan" ) ;
}
disableHideChannels ( ) {
$ ( "body" ) . removeClass ( "bd-minimal-chan" ) ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/builtins/publicservers.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / builtins / publicservers . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../structs/builtin */ "./src/structs/builtin.js" ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var ui _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ui */ "./src/ui/ui.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class PublicServers extends _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] {
get name ( ) {
return "PublicServers" ;
}
get category ( ) {
return "Modules" ;
}
get id ( ) {
return "bda-gs-1" ;
}
enabled ( ) {
const wrapper = modules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "BDV2" ] . guildClasses . wrapper . split ( " " ) [ 0 ] ;
const guilds = $ ( ` . ${ wrapper } .scroller-2FKFPG >:first-child ` ) ;
guilds . after ( this . button ) ;
}
disabled ( ) {
$ ( "#bd-pub-li" ) . remove ( ) ;
}
get component ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "DiscordModules" ] . React . createElement ( ui _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "PublicServers" ] . Layer , {
rootId : "pubslayerroot" ,
id : "pubslayer"
} , modules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "DiscordModules" ] . React . createElement ( ui _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "PublicServers" ] . Menu , {
rootId : "pubslayerroot"
} ) ) ;
}
get root ( ) {
const _root = document . getElementById ( "pubslayerroot" ) ;
if ( ! _root ) {
if ( ! this . injectRoot ( ) ) return null ;
return this . root ;
}
return _root ;
}
injectRoot ( ) {
if ( ! $ ( ".layers, .layers-3iHuyZ" ) . length ) return false ;
$ ( ".layers, .layers-3iHuyZ" ) . append ( $ ( "<div/>" , {
id : "pubslayerroot"
} ) ) ;
return true ;
}
render ( ) {
// BdApi.alert("Broken", "Sorry but the Public Servers modules is currently broken, I recommend disabling this feature for now.");
const root = this . root ;
if ( ! root ) {
console . log ( "FAILED TO LOCATE ROOT: .layers" ) ;
return ;
}
modules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "DiscordModules" ] . ReactDOM . render ( this . component , root ) ;
}
get button ( ) {
const btn = $ ( "<div/>" , {
"class" : modules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "BDV2" ] . guildClasses . listItem ,
"id" : "bd-pub-li" ,
"style" : data _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "SettingsCookie" ] [ "bda-gs-1" ] ? "" : "display: none;"
} ) . append ( $ ( "<div/>" , {
"class" : "wrapper-25eVIn " + modules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "BDV2" ] . guildClasses . circleButtonMask ,
"text" : "public" ,
"id" : "bd-pub-button" ,
"click" : ( ) => {
this . render ( ) ;
}
} ) ) ;
return btn ;
}
} ( ) ) ;
/***/ } ) ,
2019-05-30 17:44:05 +02:00
/***/ "./src/builtins/voicemode.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / builtins / voicemode . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../structs/builtin */ "./src/structs/builtin.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class VoiceMode extends _structs _builtin _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] {
get name ( ) {
return "VoiceMode" ;
}
get category ( ) {
return "Modules" ;
}
get id ( ) {
return "bda-gs-4" ;
}
enabled ( ) {
$ ( ".scroller.guild-channels ul" ) . first ( ) . css ( "display" , "none" ) ;
$ ( ".scroller.guild-channels header" ) . first ( ) . css ( "display" , "none" ) ;
$ ( ".app.flex-vertical, .app-2rEoOp" ) . first ( ) . css ( "overflow" , "hidden" ) ;
$ ( ".chat-3bRxxu" ) . first ( ) . css ( "visibility" , "hidden" ) . css ( "min-width" , "0px" ) ;
$ ( ".flex-vertical.channels-wrap" ) . first ( ) . css ( "flex-grow" , "100000" ) ;
$ ( ".guild-header .btn.btn-hamburger" ) . first ( ) . css ( "visibility" , "hidden" ) ;
}
disabled ( ) {
$ ( ".scroller.guild-channels ul" ) . first ( ) . css ( "display" , "" ) ;
$ ( ".scroller.guild-channels header" ) . first ( ) . css ( "display" , "" ) ;
$ ( ".app.flex-vertical, .app-2rEoOp" ) . first ( ) . css ( "overflow" , "" ) ;
$ ( ".chat-3bRxxu" ) . first ( ) . css ( "visibility" , "" ) . css ( "min-width" , "" ) ;
$ ( ".flex-vertical.channels-wrap" ) . first ( ) . css ( "flex-grow" , "" ) ;
$ ( ".guild-header .btn.btn-hamburger" ) . first ( ) . css ( "visibility" , "" ) ;
}
} ( ) ) ;
/***/ } ) ,
2019-05-29 05:48:41 +02:00
/***/ "./src/data/config.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / data / config . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( {
2019-05-30 07:06:17 +02:00
local : false ,
localServer : "//localhost:8080" ,
minified : true ,
version : "0.3.0" ,
branch : "master" ,
repo : "rauenzi" ,
minSupportedVersion : "0.3.0" ,
bbdVersion : "0.2.17"
2019-05-29 05:48:41 +02:00
} ) ;
/***/ } ) ,
2019-05-30 07:06:17 +02:00
/***/ "./src/data/cookies/plugincookie.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / data / cookies / plugincookie . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( { } ) ;
/***/ } ) ,
/***/ "./src/data/cookies/settingscookie.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / data / cookies / settingscookie . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( {
"bda-gs-1" : true ,
"bda-gs-2" : false ,
"bda-gs-3" : false ,
"bda-gs-4" : false ,
"bda-gs-5" : true ,
"bda-gs-6" : false ,
"bda-gs-7" : false ,
"bda-gs-8" : false ,
"bda-es-0" : true ,
"bda-es-1" : true ,
"bda-es-2" : true ,
"bda-es-4" : false ,
"bda-es-6" : true ,
"bda-es-7" : true ,
"bda-gs-b" : false ,
"bda-es-8" : true ,
"bda-dc-0" : false ,
"bda-css-0" : false ,
"bda-css-1" : false ,
"bda-es-9" : true ,
"fork-dm-1" : false ,
"fork-ps-1" : true ,
"fork-ps-2" : true ,
"fork-ps-3" : true ,
"fork-ps-4" : true ,
"fork-ps-5" : true ,
"fork-es-2" : false ,
"fork-es-3" : true ,
"fork-wp-1" : false ,
"fork-wp-2" : false
} ) ;
/***/ } ) ,
/***/ "./src/data/cookies/themecookie.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / data / cookies / themecookie . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( { } ) ;
/***/ } ) ,
2019-05-29 05:48:41 +02:00
/***/ "./src/data/data.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / data / data . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * /
2019-05-30 07:06:17 +02:00
/*! exports provided: SettingsInfo, SettingsCookie, Config, PluginCookie, ThemeCookie, Themes, Plugins, Emotes, EmoteBlacklist */
2019-05-29 05:48:41 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _settings _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./settings */ "./src/data/settings.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "SettingsInfo" , function ( ) { return _settings _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] ; } ) ;
2019-05-30 07:06:17 +02:00
/* harmony import */ var _cookies _settingscookie _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./cookies/settingscookie */ "./src/data/cookies/settingscookie.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "SettingsCookie" , function ( ) { return _cookies _settingscookie _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
/* harmony import */ var _config _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./config */ "./src/data/config.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Config" , function ( ) { return _config _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] ; } ) ;
2019-05-30 07:06:17 +02:00
/* harmony import */ var _cookies _plugincookie _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./cookies/plugincookie */ "./src/data/cookies/plugincookie.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "PluginCookie" , function ( ) { return _cookies _plugincookie _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
/* harmony import */ var _cookies _themecookie _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./cookies/themecookie */ "./src/data/cookies/themecookie.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ThemeCookie" , function ( ) { return _cookies _themecookie _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
/* harmony import */ var _themes _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./themes */ "./src/data/themes.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Themes" , function ( ) { return _themes _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _plugins _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./plugins */ "./src/data/plugins.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Plugins" , function ( ) { return _plugins _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] ; } ) ;
2019-05-30 07:06:17 +02:00
/* harmony import */ var _emotes _emotes _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./emotes/emotes */ "./src/data/emotes/emotes.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Emotes" , function ( ) { return _emotes _emotes _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _emotes _blacklist _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./emotes/blacklist */ "./src/data/emotes/blacklist.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "EmoteBlacklist" , function ( ) { return _emotes _blacklist _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-29 06:29:15 +02:00
/***/ } ) ,
2019-05-30 07:06:17 +02:00
/***/ "./src/data/emotes/blacklist.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / data / emotes / blacklist . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
2019-05-29 06:29:15 +02:00
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( [ ] ) ;
2019-05-29 05:48:41 +02:00
/***/ } ) ,
2019-05-30 07:06:17 +02:00
/***/ "./src/data/emotes/emotes.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / data / emotes / emotes . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
2019-05-29 05:48:41 +02:00
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2019-05-30 07:06:17 +02:00
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( {
TwitchGlobal : { } ,
TwitchSubscriber : { } ,
BTTV : { } ,
FrankerFaceZ : { } ,
BTTV2 : { }
} ) ;
2019-05-29 05:48:41 +02:00
/***/ } ) ,
/***/ "./src/data/plugins.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / data / plugins . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( { } ) ;
/***/ } ) ,
/***/ "./src/data/settings.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / data / settings . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( {
2019-05-30 07:06:17 +02:00
"Custom css live update" : {
id : "bda-css-0" ,
info : "" ,
implemented : true ,
hidden : true ,
cat : "core"
} ,
"Custom css auto udpate" : {
id : "bda-css-1" ,
info : "" ,
implemented : true ,
hidden : true ,
cat : "core"
} ,
"BetterDiscord Blue" : {
id : "bda-gs-b" ,
info : "Replace Discord blue with BD Blue" ,
implemented : false ,
hidden : false ,
cat : "core"
} ,
/* Core */
/* ====== */
"Public Servers" : {
id : "bda-gs-1" ,
info : "Display public servers button" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Minimal Mode" : {
id : "bda-gs-2" ,
info : "Hide elements and reduce the size of elements." ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Voice Mode" : {
id : "bda-gs-4" ,
info : "Only show voice chat" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Hide Channels" : {
id : "bda-gs-3" ,
info : "Hide channels in minimal mode" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Dark Mode" : {
id : "bda-gs-5" ,
info : "Make certain elements dark by default(wip)" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Voice Disconnect" : {
id : "bda-dc-0" ,
info : "Disconnect from voice server when closing Discord" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"24 Hour Timestamps" : {
id : "bda-gs-6" ,
info : "Replace 12hr timestamps with proper ones" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Coloured Text" : {
id : "bda-gs-7" ,
info : "Make text colour the same as role colour" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Normalize Classes" : {
id : "fork-ps-4" ,
info : "Adds stable classes to elements to help themes. (e.g. adds .da-channels to .channels-Ie2l6A)" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
/* Content */
"Content Error Modal" : {
id : "fork-ps-1" ,
info : "Shows a modal with plugin/theme errors" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "content manager"
} ,
"Show Toasts" : {
id : "fork-ps-2" ,
info : "Shows a small notification for important information" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "content manager"
} ,
"Scroll To Settings" : {
id : "fork-ps-3" ,
info : "Auto-scrolls to a plugin's settings when the button is clicked (only if out of view)" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "content manager"
} ,
"Automatic Loading" : {
id : "fork-ps-5" ,
info : "Automatically loads, reloads, and unloads plugins and themes" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "content manager"
} ,
/* Developer */
"Developer Mode" : {
id : "bda-gs-8" ,
info : "Developer Mode" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "developer settings"
} ,
"Copy Selector" : {
id : "fork-dm-1" ,
info : "Adds a \"Copy Selector\" option to context menus when developer mode is active" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "developer settings"
} ,
/* Window Prefs */
"Enable Transparency" : {
id : "fork-wp-1" ,
info : "Enables the main window to be see-through (requires restart)" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "window preferences"
} ,
"Window Frame" : {
id : "fork-wp-2" ,
info : "Adds the native os window frame to the main window" ,
implemented : false ,
hidden : true ,
cat : "core" ,
category : "window preferences"
} ,
/* Emotes */
/* ====== */
"Download Emotes" : {
id : "fork-es-3" ,
info : "Download emotes when the cache is expired" ,
implemented : true ,
hidden : false ,
cat : "emote"
} ,
"Twitch Emotes" : {
id : "bda-es-7" ,
info : "Show Twitch emotes" ,
implemented : true ,
hidden : false ,
cat : "emote"
} ,
"FrankerFaceZ Emotes" : {
id : "bda-es-1" ,
info : "Show FrankerFaceZ Emotes" ,
implemented : true ,
hidden : false ,
cat : "emote"
} ,
"BetterTTV Emotes" : {
id : "bda-es-2" ,
info : "Show BetterTTV Emotes" ,
implemented : true ,
hidden : false ,
cat : "emote"
} ,
"Emote Menu" : {
id : "bda-es-0" ,
info : "Show Twitch/Favourite emotes in emote menu" ,
implemented : true ,
hidden : false ,
cat : "emote"
} ,
"Emoji Menu" : {
id : "bda-es-9" ,
info : "Show Discord emoji menu" ,
implemented : true ,
hidden : false ,
cat : "emote"
} ,
"Emote Auto Capitalization" : {
id : "bda-es-4" ,
info : "Autocapitalize emote commands" ,
implemented : true ,
hidden : false ,
cat : "emote"
} ,
"Show Names" : {
id : "bda-es-6" ,
info : "Show emote names on hover" ,
implemented : true ,
hidden : false ,
cat : "emote"
} ,
"Show emote modifiers" : {
id : "bda-es-8" ,
info : "Enable emote mods (flip, spin, pulse, spin2, spin3, 1spin, 2spin, 3spin, tr, bl, br, shake, shake2, shake3, flap)" ,
implemented : true ,
hidden : false ,
cat : "emote"
} ,
"Animate On Hover" : {
id : "fork-es-2" ,
info : "Only animate the emote modifiers on hover" ,
implemented : true ,
hidden : false ,
cat : "emote"
}
2019-05-29 05:48:41 +02:00
} ) ;
/***/ } ) ,
/***/ "./src/data/themes.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / data / themes . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( { } ) ;
/***/ } ) ,
/***/ "./src/index.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / index . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * /
2019-05-30 07:06:17 +02:00
/*! exports provided: default, patchModuleLoad */
2019-05-29 05:48:41 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return CoreWrapper ; } ) ;
2019-05-30 07:06:17 +02:00
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "patchModuleLoad" , function ( ) { return patchModuleLoad ; } ) ;
2019-05-29 05:48:41 +02:00
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var _localstorage _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./localstorage */ "./src/localstorage.js" ) ;
/* harmony import */ var _modules _core _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./modules/core */ "./src/modules/core.js" ) ;
/* harmony import */ var _modules _pluginapi _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./modules/pluginapi */ "./src/modules/pluginapi.js" ) ;
/* harmony import */ var _modules _pluginmanager _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./modules/pluginmanager */ "./src/modules/pluginmanager.js" ) ;
/* harmony import */ var _modules _thememanager _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./modules/thememanager */ "./src/modules/thememanager.js" ) ;
2019-05-29 06:29:15 +02:00
/* harmony import */ var _modules _oldstorage _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./modules/oldstorage */ "./src/modules/oldstorage.js" ) ;
2019-05-30 17:44:05 +02:00
/* harmony import */ var _modules _emitter _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./modules/emitter */ "./src/modules/emitter.js" ) ;
2019-05-29 06:29:15 +02:00
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
// Perform some setup
2019-05-29 05:48:41 +02:00
Object ( _localstorage _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] ) ( ) ;
const loadingIcon = document . createElement ( "div" ) ;
loadingIcon . className = "bd-loaderv2" ;
loadingIcon . title = "BandagedBD is loading..." ;
2019-05-30 07:06:17 +02:00
document . body . appendChild ( loadingIcon ) ; // window.Core = Core;
2019-05-29 05:48:41 +02:00
window . BdApi = _modules _pluginapi _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] ;
window . settings = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsInfo" ] ;
window . settingsCookie = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] ;
window . pluginCookie = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] ;
window . themeCookie = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] ;
window . pluginModule = _modules _pluginmanager _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] ;
window . themeModule = _modules _thememanager _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] ;
2019-05-29 06:29:15 +02:00
window . bdthemes = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] ;
window . bdplugins = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] ;
2019-05-30 07:06:17 +02:00
window . bdEmotes = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] ;
2019-05-29 06:29:15 +02:00
window . bemotes = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "EmoteBlacklist" ] ;
window . bdPluginStorage = _modules _oldstorage _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "bdPluginStorage" ] ;
2019-05-30 17:44:05 +02:00
window . BDEvents = _modules _emitter _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] ;
2019-05-29 05:48:41 +02:00
class CoreWrapper {
2019-05-30 07:06:17 +02:00
constructor ( config ) {
_modules _core _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . setConfig ( config ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
init ( ) {
_modules _core _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . init ( ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
}
function patchModuleLoad ( ) {
const namespace = "betterdiscord" ;
const prefix = ` ${ namespace } / ` ;
const Module = _ _webpack _require _ _ ( /*! module */ "module" ) ;
const load = Module . _load ; // const resolveFilename = Module._resolveFilename;
Module . _load = function ( request ) {
if ( request === namespace || request . startsWith ( prefix ) ) {
const requested = request . substr ( prefix . length ) ;
if ( requested == "api" ) return _modules _pluginapi _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] ;
}
return load . apply ( this , arguments ) ;
} ; // Module._resolveFilename = function (request, parent, isMain) {
// if (request === "betterdiscord" || request.startsWith("betterdiscord/")) {
// const contentPath = PluginManager.getPluginPathByModule(parent);
// if (contentPath) return request;
// }
// return resolveFilename.apply(this, arguments);
// };
return function ( ) {
Module . _load = load ;
} ;
} // export function getPluginByModule(module) {
// return this.localContent.find(plugin => module.filename === plugin.contentPath || module.filename.startsWith(plugin.contentPath + path.sep));
// }
// export function getPluginPathByModule(module) {
// return Object.keys(this.pluginApiInstances).find(contentPath => module.filename === contentPath || module.filename.startsWith(contentPath + path.sep));
// }
2019-05-29 05:48:41 +02:00
// var settingsPanel, emoteModule, quickEmoteMenu, voiceMode,, dMode, publicServersModule;
2019-05-28 23:27:25 +02:00
// var bdConfig = null;
2019-05-29 05:48:41 +02:00
/***/ } ) ,
/***/ "./src/localstorage.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / localstorage . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* Localstorage fix */
2019-05-30 07:06:17 +02:00
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( function ( ) {
const fs = _ _webpack _require _ _ ( /*! fs */ "fs" ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
const platform = process . platform ;
const dataPath = ( platform === "win32" ? process . env . APPDATA : platform === "darwin" ? process . env . HOME + "/Library/Preferences" : process . env . HOME + "/.config" ) + "/BetterDiscord/" ;
const localStorageFile = "localStorage.json" ;
let data = { } ;
if ( fs . existsSync ( ` ${ dataPath } ${ localStorageFile } ` ) ) {
try {
data = JSON . parse ( fs . readFileSync ( ` ${ dataPath } ${ localStorageFile } ` ) ) ;
} catch ( err ) {
console . log ( err ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
} else if ( fs . existsSync ( localStorageFile ) ) {
try {
data = JSON . parse ( fs . readFileSync ( localStorageFile ) ) ;
} catch ( err ) {
console . log ( err ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
const storage = data ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
storage . setItem = function ( i , v ) {
storage [ i ] = v ;
this . save ( ) ;
} ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
storage . getItem = function ( i ) {
return storage [ i ] || null ;
} ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
storage . save = function ( ) {
fs . writeFileSync ( ` ${ dataPath } ${ localStorageFile } ` , JSON . stringify ( this ) , null , 4 ) ;
} ;
const lsProxy = new Proxy ( storage , {
set : function ( target , name , val ) {
storage [ name ] = val ;
storage . save ( ) ;
} ,
get : function ( target , name ) {
return storage [ name ] || null ;
}
} ) ;
window . localStorage = lsProxy ;
2019-05-29 05:48:41 +02:00
} ) ;
/***/ } ) ,
/***/ "./src/modules/bdv2.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / bdv2 . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2019-05-30 17:44:05 +02:00
/* harmony import */ var _webpackmodules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./webpackmodules */ "./src/modules/webpackmodules.js" ) ;
/* harmony import */ var _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./pluginapi */ "./src/modules/pluginapi.js" ) ;
/* harmony import */ var _ui _icons _bdlogo _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../ui/icons/bdlogo */ "./src/ui/icons/bdlogo.js" ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class V2 {
constructor ( ) {
this . editorDetached = false ;
}
initialize ( ) {
2019-05-30 17:44:05 +02:00
_pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchSocial . bind ( this ) , "BD Social Patch" ) ( ) ;
_pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchGuildPills . bind ( this ) , "BD Guild Pills Patch" ) ( ) ;
_pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchGuildListItems . bind ( this ) , "BD Guild List Items Patch" ) ( ) ;
_pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchGuildSeparator . bind ( this ) , "BD Guild Separator Patch" ) ( ) ;
2019-05-30 07:06:17 +02:00
}
get messageClasses ( ) {
2019-05-30 17:44:05 +02:00
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . getByProps ( "message" , "containerCozy" ) ;
2019-05-30 07:06:17 +02:00
}
get guildClasses ( ) {
2019-05-30 17:44:05 +02:00
const guildsWrapper = _webpackmodules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . getByProps ( "wrapper" , "unreadMentionsBar" ) ;
const guilds = _webpackmodules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . getByProps ( "guildsError" , "selected" ) ;
const pill = _webpackmodules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . getByProps ( "blobContainer" ) ;
2019-05-30 07:06:17 +02:00
return Object . assign ( { } , guildsWrapper , guilds , pill ) ;
}
get MessageContentComponent ( ) {
2019-05-30 17:44:05 +02:00
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . getModule ( m => m . defaultProps && m . defaultProps . hasOwnProperty ( "disableButtons" ) ) ;
2019-05-30 07:06:17 +02:00
}
get TimeFormatter ( ) {
2019-05-30 17:44:05 +02:00
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . getByProps ( "dateFormat" ) ;
2019-05-30 07:06:17 +02:00
}
get TooltipWrapper ( ) {
2019-05-30 17:44:05 +02:00
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . getByDisplayName ( "TooltipDeprecated" ) ;
2019-05-30 07:06:17 +02:00
}
get NativeModule ( ) {
2019-05-30 17:44:05 +02:00
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . getByProps ( "setBadge" ) ;
2019-05-30 07:06:17 +02:00
}
get Tooltips ( ) {
2019-05-30 17:44:05 +02:00
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . getModule ( m => m . hide && m . show && ! m . search && ! m . submit && ! m . search && ! m . activateRagingDemon && ! m . dismiss ) ;
2019-05-30 07:06:17 +02:00
}
get KeyGenerator ( ) {
2019-05-30 17:44:05 +02:00
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . getModule ( m => m . toString && /"binary"/ . test ( m . toString ( ) ) ) ;
2019-05-30 07:06:17 +02:00
}
patchSocial ( ) {
if ( this . socialPatch ) return ;
2019-05-30 17:44:05 +02:00
const TabBar = _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findModule ( m => m . displayName == "TabBar" ) ;
const Anchor = _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findModule ( m => m . displayName == "Anchor" ) ;
2019-05-30 07:06:17 +02:00
if ( ! TabBar || ! Anchor ) return ;
2019-05-30 17:44:05 +02:00
this . socialPatch = _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( TabBar . prototype , "render" , {
2019-05-30 07:06:17 +02:00
after : data => {
const children = data . returnValue . props . children ;
if ( ! children || ! children . length ) return ;
if ( children [ children . length - 2 ] . type . displayName !== "Separator" ) return ;
if ( ! children [ children . length - 1 ] . type . toString ( ) . includes ( "socialLinks" ) ) return ;
const original = children [ children . length - 1 ] . type ;
const newOne = function ( ) {
const returnVal = original ( ... arguments ) ;
2019-05-30 17:44:05 +02:00
returnVal . props . children . push ( _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . React . createElement ( Anchor , {
2019-05-30 07:06:17 +02:00
className : "bd-social-link" ,
href : "https://github.com/rauenzi/BetterDiscordApp" ,
rel : "author" ,
title : "BandagedBD" ,
target : "_blank"
2019-05-30 17:44:05 +02:00
} , _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . React . createElement ( _ui _icons _bdlogo _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , {
2019-05-30 07:06:17 +02:00
size : "16px" ,
className : "bd-social-logo"
} ) ) ) ;
return returnVal ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
children [ children . length - 1 ] . type = newOne ;
}
} ) ;
}
patchGuildListItems ( ) {
if ( this . guildListItemsPatch ) return ;
const listItemClass = this . guildClasses . listItem . split ( " " ) [ 0 ] ;
const blobClass = this . guildClasses . blobContainer . split ( " " ) [ 0 ] ;
2019-05-30 17:44:05 +02:00
const reactInstance = _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getInternalInstance ( document . querySelector ( ` . ${ listItemClass } . ${ blobClass } ` ) . parentElement ) ;
2019-05-30 07:06:17 +02:00
const GuildComponent = reactInstance . return . type ;
if ( ! GuildComponent ) return ;
2019-05-30 17:44:05 +02:00
this . guildListItemsPatch = _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( GuildComponent . prototype , "render" , {
2019-05-30 07:06:17 +02:00
after : data => {
const returnValue = data . returnValue ;
const guildData = data . thisObject . props ;
returnValue . props . className += " bd-guild" ;
if ( guildData . unread ) returnValue . props . className += " bd-unread" ;
if ( guildData . selected ) returnValue . props . className += " bd-selected" ;
if ( guildData . audio ) returnValue . props . className += " bd-audio" ;
if ( guildData . video ) returnValue . props . className += " bd-video" ;
if ( guildData . badge ) returnValue . props . className += " bd-badge" ;
if ( guildData . animatable ) returnValue . props . className += " bd-animatable" ;
return returnValue ;
}
} ) ;
}
2019-05-30 23:18:52 +02:00
patchGuildPills ( ) {
if ( this . guildPillPatch ) return ;
const guildPill = _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findModule ( m => m . default && m . default . toString && m . default . toString ( ) . includes ( "translate3d" ) ) ;
if ( ! guildPill ) return ;
this . guildPillPatch = _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( guildPill , "default" , {
after : data => {
const props = data . methodArguments [ 0 ] ;
if ( props . unread ) data . returnValue . props . className += " bd-unread" ;
if ( props . selected ) data . returnValue . props . className += " bd-selected" ;
if ( props . hovered ) data . returnValue . props . className += " bd-hovered" ;
return data . returnValue ;
}
} ) ;
2019-05-30 07:06:17 +02:00
}
2019-05-30 23:18:52 +02:00
patchGuildSeparator ( ) {
if ( this . guildSeparatorPatch ) return ;
const Guilds = _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findModuleByDisplayName ( "Guilds" ) ;
const guildComponents = _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findModuleByProps ( "renderListItem" ) ;
if ( ! guildComponents || ! Guilds ) return ;
2019-05-30 07:06:17 +02:00
2019-05-30 23:18:52 +02:00
const GuildSeparator = function ( ) {
const returnValue = guildComponents . Separator ( ... arguments ) ;
returnValue . props . className += " bd-guild-separator" ;
return returnValue ;
} ;
2019-05-29 05:48:41 +02:00
2019-05-30 23:18:52 +02:00
this . guildSeparatorPatch = _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( Guilds . prototype , "render" , {
after : data => {
data . returnValue . props . children [ 1 ] . props . children [ 3 ] . type = GuildSeparator ;
}
} ) ;
2019-05-30 07:06:17 +02:00
}
} ( ) ) ;
2019-05-29 05:48:41 +02:00
/***/ } ) ,
/***/ "./src/modules/contentmanager.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / contentmanager . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./utilities */ "./src/modules/utilities.js" ) ;
/* harmony import */ var _pluginmanager _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./pluginmanager */ "./src/modules/pluginmanager.js" ) ;
/* harmony import */ var _thememanager _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./thememanager */ "./src/modules/thememanager.js" ) ;
const path = _ _webpack _require _ _ ( /*! path */ "path" ) ;
2019-05-30 07:06:17 +02:00
2019-05-29 05:48:41 +02:00
const fs = _ _webpack _require _ _ ( /*! fs */ "fs" ) ;
2019-05-30 07:06:17 +02:00
2019-05-29 05:48:41 +02:00
const Module = _ _webpack _require _ _ ( /*! module */ "module" ) . Module ;
2019-05-30 07:06:17 +02:00
2019-05-29 05:48:41 +02:00
Module . globalPaths . push ( path . resolve ( _ _webpack _require _ _ ( /*! electron */ "electron" ) . remote . app . getAppPath ( ) , "node_modules" ) ) ;
2019-05-30 07:06:17 +02:00
2019-05-29 05:48:41 +02:00
class MetaError extends Error {
2019-05-30 07:06:17 +02:00
constructor ( message ) {
super ( message ) ;
this . name = "MetaError" ;
}
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
const originalJSRequire = Module . _extensions [ ".js" ] ;
const originalCSSRequire = Module . _extensions [ ".css" ] ? Module . _extensions [ ".css" ] : ( ) => {
return null ;
} ;
2019-05-29 05:48:41 +02:00
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class ContentManager {
2019-05-30 07:06:17 +02:00
constructor ( ) {
this . timeCache = { } ;
this . watchers = { } ;
Module . _extensions [ ".js" ] = this . getContentRequire ( "plugin" ) ;
Module . _extensions [ ".css" ] = this . getContentRequire ( "theme" ) ;
}
get pluginsFolder ( ) {
return this . _pluginsFolder || ( this . _pluginsFolder = fs . realpathSync ( path . resolve ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Config" ] . dataPath + "plugins/" ) ) ) ;
}
get themesFolder ( ) {
return this . _themesFolder || ( this . _themesFolder = fs . realpathSync ( path . resolve ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Config" ] . dataPath + "themes/" ) ) ) ;
}
watchContent ( contentType ) {
if ( this . watchers [ contentType ] ) return ;
const isPlugin = contentType === "plugin" ;
const baseFolder = isPlugin ? this . pluginsFolder : this . themesFolder ;
const fileEnding = isPlugin ? ".plugin.js" : ".theme.css" ;
this . watchers [ contentType ] = fs . watch ( baseFolder , {
persistent : false
} , async ( eventType , filename ) => {
if ( ! eventType || ! filename || ! filename . endsWith ( fileEnding ) ) return ;
await new Promise ( r => setTimeout ( r , 50 ) ) ;
try {
fs . statSync ( path . resolve ( baseFolder , filename ) ) ;
} catch ( err ) {
if ( err . code !== "ENOENT" ) return ;
delete this . timeCache [ filename ] ;
if ( isPlugin ) return _pluginmanager _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . unloadPlugin ( filename ) ;
return _thememanager _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . unloadTheme ( filename ) ;
}
if ( ! fs . statSync ( path . resolve ( baseFolder , filename ) ) . isFile ( ) ) return ;
const stats = fs . statSync ( path . resolve ( baseFolder , filename ) ) ;
if ( ! stats || ! stats . mtime || ! stats . mtime . getTime ( ) ) return ;
if ( typeof stats . mtime . getTime ( ) !== "number" ) return ;
if ( this . timeCache [ filename ] == stats . mtime . getTime ( ) ) return ;
this . timeCache [ filename ] = stats . mtime . getTime ( ) ;
if ( eventType == "rename" ) {
if ( isPlugin ) _pluginmanager _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . loadPlugin ( filename ) ; else _thememanager _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . loadTheme ( filename ) ;
}
if ( eventType == "change" ) {
if ( isPlugin ) _pluginmanager _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . reloadPlugin ( filename ) ; else _thememanager _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . reloadTheme ( filename ) ;
}
} ) ;
}
unwatchContent ( contentType ) {
if ( ! this . watchers [ contentType ] ) return ;
this . watchers [ contentType ] . close ( ) ;
delete this . watchers [ contentType ] ;
}
extractMeta ( content ) {
const meta = content . split ( "\n" ) [ 0 ] ;
const rawMeta = meta . substring ( meta . lastIndexOf ( "//META" ) + 6 , meta . lastIndexOf ( "*//" ) ) ;
if ( meta . indexOf ( "META" ) < 0 ) throw new MetaError ( "META was not found." ) ;
if ( ! _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . testJSON ( rawMeta ) ) throw new MetaError ( "META could not be parsed." ) ;
const parsed = JSON . parse ( rawMeta ) ;
if ( ! parsed . name ) throw new MetaError ( "META missing name data." ) ;
return parsed ;
}
getContentRequire ( type ) {
const isPlugin = type === "plugin" ;
const self = this ;
const originalRequire = isPlugin ? originalJSRequire : originalCSSRequire ;
return function ( module , filename ) {
const baseFolder = isPlugin ? self . pluginsFolder : self . themesFolder ;
const possiblePath = path . resolve ( baseFolder , path . basename ( filename ) ) ;
if ( ! fs . existsSync ( possiblePath ) || filename !== fs . realpathSync ( possiblePath ) ) return Reflect . apply ( originalRequire , this , arguments ) ;
let content = fs . readFileSync ( filename , "utf8" ) ;
content = _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . stripBOM ( content ) ;
const meta = self . extractMeta ( content ) ;
meta . filename = path . basename ( filename ) ;
if ( ! isPlugin ) {
meta . css = content . split ( "\n" ) . slice ( 1 ) . join ( "\n" ) ;
content = ` module.exports = ${ JSON . stringify ( meta ) } ; ` ;
}
if ( isPlugin ) {
content += ` \n module.exports = ${ JSON . stringify ( meta ) } ; \n module.exports.type = ${ meta . name } ; ` ;
}
module . _compile ( content , filename ) ;
} ;
}
makePlaceholderPlugin ( data ) {
return {
plugin : {
start : ( ) => { } ,
getName : ( ) => {
return data . name || data . filename ;
} ,
getAuthor : ( ) => {
return "???" ;
} ,
getDescription : ( ) => {
return data . message ? data . message : "This plugin was unable to be loaded. Check the author's page for updates." ;
} ,
getVersion : ( ) => {
return "???" ;
}
} ,
name : data . name || data . filename ,
filename : data . filename ,
source : data . source ? data . source : "" ,
website : data . website ? data . website : ""
} ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
loadContent ( filename , type ) {
if ( typeof filename === "undefined" || typeof type === "undefined" ) return ;
const isPlugin = type === "plugin" ;
const baseFolder = isPlugin ? this . pluginsFolder : this . themesFolder ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
try {
require ( path . resolve ( baseFolder , filename ) ) ;
} catch ( error ) {
return {
name : filename ,
file : filename ,
message : "Could not be compiled." ,
error : {
message : error . message ,
stack : error . stack
}
} ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
const content = require ( path . resolve ( baseFolder , filename ) ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( isPlugin ) {
if ( ! content . type ) return ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
try {
content . plugin = new content . type ( ) ;
delete data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ content . plugin . getName ( ) ] ;
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ content . plugin . getName ( ) ] = content ;
} catch ( error ) {
return {
name : filename ,
file : filename ,
message : "Could not be constructed." ,
error : {
message : error . message ,
stack : error . stack
}
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
}
} else {
delete data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ content . name ] ;
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ content . name ] = content ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
unloadContent ( filename , type ) {
if ( typeof filename === "undefined" || typeof type === "undefined" ) return ;
const isPlugin = type === "plugin" ;
const baseFolder = isPlugin ? this . pluginsFolder : this . themesFolder ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
try {
delete require . cache [ require . resolve ( path . resolve ( baseFolder , filename ) ) ] ;
} catch ( err ) {
return {
name : filename ,
file : filename ,
message : "Could not be unloaded." ,
error : {
message : err . message ,
stack : err . stack
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
} ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
isLoaded ( filename , type ) {
const isPlugin = type === "plugin" ;
const baseFolder = isPlugin ? this . pluginsFolder : this . themesFolder ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
try {
require . cache [ require . resolve ( path . resolve ( baseFolder , filename ) ) ] ;
} catch ( err ) {
return false ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
return true ;
}
reloadContent ( filename , type ) {
const cantUnload = this . unloadContent ( filename , type ) ;
if ( cantUnload ) return cantUnload ;
return this . loadContent ( filename , type ) ;
}
loadNewContent ( type ) {
const isPlugin = type === "plugin" ;
const fileEnding = isPlugin ? ".plugin.js" : ".theme.css" ;
const basedir = isPlugin ? this . pluginsFolder : this . themesFolder ;
const files = fs . readdirSync ( basedir ) ;
const contentList = Object . values ( isPlugin ? data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] ) ;
const removed = contentList . filter ( t => ! files . includes ( t . filename ) ) . map ( c => isPlugin ? c . plugin . getName ( ) : c . name ) ;
const added = files . filter ( f => ! contentList . find ( t => t . filename == f ) && f . endsWith ( fileEnding ) && fs . statSync ( path . resolve ( basedir , f ) ) . isFile ( ) ) ;
return {
added ,
removed
} ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
loadAllContent ( type ) {
const isPlugin = type === "plugin" ;
const fileEnding = isPlugin ? ".plugin.js" : ".theme.css" ;
const basedir = isPlugin ? this . pluginsFolder : this . themesFolder ;
const errors = [ ] ;
const files = fs . readdirSync ( basedir ) ;
for ( const filename of files ) {
if ( ! fs . statSync ( path . resolve ( basedir , filename ) ) . isFile ( ) || ! filename . endsWith ( fileEnding ) ) continue ;
const error = this . loadContent ( filename , type ) ;
if ( error ) errors . push ( error ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
return errors ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
loadPlugins ( ) {
return this . loadAllContent ( "plugin" ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
loadThemes ( ) {
return this . loadAllContent ( "theme" ) ;
}
} ( ) ) ;
2019-05-29 05:48:41 +02:00
/***/ } ) ,
/***/ "./src/modules/core.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / core . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _bdv2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./bdv2 */ "./src/modules/bdv2.js" ) ;
/* harmony import */ var _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./utilities */ "./src/modules/utilities.js" ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var _emotes _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./emotes */ "./src/modules/emotes.js" ) ;
/* harmony import */ var _emotemenu _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./emotemenu */ "./src/modules/emotemenu.js" ) ;
/* harmony import */ var _pluginmanager _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./pluginmanager */ "./src/modules/pluginmanager.js" ) ;
/* harmony import */ var _thememanager _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./thememanager */ "./src/modules/thememanager.js" ) ;
/* harmony import */ var _datastore _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./datastore */ "./src/modules/datastore.js" ) ;
2019-05-30 23:18:52 +02:00
/* harmony import */ var _settingspanel _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./settingspanel */ "./src/modules/settingspanel.js" ) ;
/* harmony import */ var builtins _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! builtins */ "./src/builtins/builtins.js" ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
// import VoiceMode from "./voicemode";
2019-05-29 05:48:41 +02:00
// import DevMode from "./devmode";
2019-05-30 23:18:52 +02:00
// import PublicServers from "./publicservers";
2019-05-29 05:48:41 +02:00
2019-05-30 17:44:05 +02:00
2019-05-30 07:06:17 +02:00
function Core ( ) { }
Core . prototype . setConfig = function ( config ) {
Object . assign ( data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Config" ] , config ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
Core . prototype . init = async function ( ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Config" ] . version < data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Config" ] . minSupportedVersion ) {
this . alert ( "Not Supported" , "BetterDiscord v" + data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Config" ] . version + " (your version)" + " is not supported by the latest js (" + data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Config" ] . bbdVersion + ").<br><br> Please download the latest version from <a href='https://github.com/rauenzi/BetterDiscordApp/releases/latest' target='_blank'>GitHub</a>" ) ;
return ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
const latestLocalVersion = data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Config" ] . updater ? data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Config" ] . updater . LatestVersion : data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Config" ] . latestVersion ;
if ( latestLocalVersion > data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Config" ] . version ) {
this . alert ( "Update Available" , `
2019-05-29 05:48:41 +02:00
An update for BandagedBD is available ( $ { latestLocalVersion } ) ! Please Reinstall ! < br / > < br / >
< a href = 'https://github.com/rauenzi/BetterDiscordApp/releases/latest' target = '_blank' > Download Installer < / a >
` );
2019-05-30 07:06:17 +02:00
}
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Initializing Settings" ) ;
this . initSettings ( ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Initializing EmoteModule" ) ;
window . emotePromise = _emotes _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . init ( ) . then ( ( ) => {
_emotes _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . initialized = true ;
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Initializing QuickEmoteMenu" ) ;
_emotemenu _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . init ( ) ;
} ) ;
this . injectExternals ( ) ;
await this . checkForGuilds ( ) ;
_bdv2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . initialize ( ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Updating Settings" ) ;
2019-05-30 23:18:52 +02:00
_settingspanel _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . initializeSettings ( ) ;
for ( const module in builtins _ _WEBPACK _IMPORTED _MODULE _9 _ _ ) builtins _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ module ] . initialize ( ) ;
2019-05-30 07:06:17 +02:00
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Loading Plugins" ) ;
const pluginErrors = _pluginmanager _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . loadPlugins ( ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Loading Themes" ) ;
const themeErrors = _thememanager _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . loadThemes ( ) ;
$ ( "#customcss" ) . detach ( ) . appendTo ( document . head ) ;
window . addEventListener ( "beforeunload" , function ( ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "SettingsCookie" ] [ "bda-dc-0" ] ) document . querySelector ( ".btn.btn-disconnect" ) . click ( ) ;
2019-05-30 23:18:52 +02:00
} ) ; // PublicServers.initialize();
2019-05-30 07:06:17 +02:00
_emotes _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . autoCapitalize ( ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Removing Loading Icon" ) ;
document . getElementsByClassName ( "bd-loaderv2" ) [ 0 ] . remove ( ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Initializing Main Observer" ) ;
this . initObserver ( ) ; // Show loading errors
if ( data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "SettingsCookie" ] [ "fork-ps-1" ] ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Collecting Startup Errors" ) ;
this . showContentErrors ( {
plugins : pluginErrors ,
themes : themeErrors
2019-05-29 05:48:41 +02:00
} ) ;
2019-05-30 07:06:17 +02:00
} // if (!DataStore.getBDData(bbdVersion)) {
// BdApi.alert("BBD Updated!", ["Lots of things were fixed in this update like Public Servers, Minimal Mode, Dark Mode and 24 Hour Timestamps.", BdApi.React.createElement("br"), BdApi.React.createElement("br"), "Feel free to test them all out!"]);
// DataStore.setBDData(bbdVersion, true);
// }
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
Core . prototype . checkForGuilds = function ( ) {
return new Promise ( resolve => {
const checkForGuilds = function ( ) {
const wrapper = _bdv2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . guildClasses . wrapper . split ( " " ) [ 0 ] ;
const guild = _bdv2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . guildClasses . listItem . split ( " " ) [ 0 ] ;
const blob = _bdv2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . guildClasses . blobContainer . split ( " " ) [ 0 ] ;
if ( document . querySelectorAll ( ` . ${ wrapper } . ${ guild } . ${ blob } ` ) . length > 0 ) return resolve ( data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Config" ] . deferLoaded = true ) ;
setTimeout ( checkForGuilds , 100 ) ;
} ;
$ ( document ) . ready ( function ( ) {
setTimeout ( checkForGuilds , 100 ) ;
2019-05-29 05:48:41 +02:00
} ) ;
2019-05-30 07:06:17 +02:00
} ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
Core . prototype . injectExternals = async function ( ) {
await _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . injectJs ( "https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js" ) ;
if ( window . require . original ) window . require = window . require . original ;
2019-05-29 05:48:41 +02:00
} ;
Core . prototype . initSettings = function ( ) {
2019-05-30 07:06:17 +02:00
_datastore _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . initialize ( ) ;
if ( ! _datastore _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . getSettingGroup ( "settings" ) ) return this . saveSettings ( ) ;
const savedSettings = this . loadSettings ( ) ;
$ ( "<style id=\"customcss\">" ) . text ( atob ( _datastore _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . getBDData ( "bdcustomcss" ) ) ) . appendTo ( document . head ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
for ( const setting in savedSettings ) {
if ( savedSettings [ setting ] !== undefined ) data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "SettingsCookie" ] [ setting ] = savedSettings [ setting ] ;
}
this . saveSettings ( ) ;
2019-05-29 05:48:41 +02:00
} ;
Core . prototype . saveSettings = function ( ) {
2019-05-30 07:06:17 +02:00
_datastore _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . setSettingGroup ( "settings" , data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "SettingsCookie" ] ) ;
2019-05-29 05:48:41 +02:00
} ;
Core . prototype . loadSettings = function ( ) {
2019-05-30 07:06:17 +02:00
return _datastore _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . getSettingGroup ( "settings" ) ;
2019-05-29 05:48:41 +02:00
} ;
Core . prototype . initObserver = function ( ) {
2019-05-30 07:06:17 +02:00
const mainObserver = new MutationObserver ( mutations => {
for ( let i = 0 , mlen = mutations . length ; i < mlen ; i ++ ) {
const mutation = mutations [ i ] ;
if ( typeof _pluginmanager _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] !== "undefined" ) _pluginmanager _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . rawObserver ( mutation ) ; // if there was nothing added, skip
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( ! mutation . addedNodes . length || ! ( mutation . addedNodes [ 0 ] instanceof Element ) ) continue ;
const node = mutation . addedNodes [ 0 ] ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( node . classList . contains ( "layer-3QrUeG" ) ) {
if ( node . getElementsByClassName ( "guild-settings-base-section" ) . length ) node . setAttribute ( "layer-id" , "server-settings" ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( node . getElementsByClassName ( "socialLinks-3jqNFy" ) . length ) {
node . setAttribute ( "layer-id" , "user-settings" ) ;
node . setAttribute ( "id" , "user-settings" ) ;
2019-05-30 23:18:52 +02:00
if ( ! document . getElementById ( "bd-settings-sidebar" ) ) _settingspanel _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . renderSidebar ( ) ;
2019-05-30 07:06:17 +02:00
}
} // Emoji Picker
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( node . classList . contains ( "popout-3sVMXz" ) && ! node . classList . contains ( "popoutLeft-30WmrD" ) && node . getElementsByClassName ( "emojiPicker-3m1S-j" ) . length ) _emotemenu _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . obsCallback ( node ) ;
}
} ) ;
mainObserver . observe ( document , {
childList : true ,
subtree : true
} ) ;
} ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
Core . prototype . alert = function ( title , content ) {
const modal = $ ( ` <div class="bd-modal-wrapper theme-dark">
2019-05-29 05:48:41 +02:00
< div class = "bd-backdrop backdrop-1wrmKB" > < / d i v >
< div class = "bd-modal modal-1UGdnR" >
< div class = "bd-modal-inner inner-1JeGVc" >
< div class = "header header-1R_AjF" >
< div class = "title" > $ { title } < / d i v >
< / d i v >
< div class = "bd-modal-body" >
< div class = "scroller-wrap fade" >
< div class = "scroller" >
$ { content }
< / d i v >
< / d i v >
< / d i v >
< div class = "footer footer-2yfCgX" >
< button type = "button" > Okay < / b u t t o n >
< / d i v >
< / d i v >
< / d i v >
< / d i v > ` ) ;
2019-05-30 07:06:17 +02:00
modal . find ( ".footer button" ) . on ( "click" , ( ) => {
modal . addClass ( "closing" ) ;
setTimeout ( ( ) => {
modal . remove ( ) ;
} , 300 ) ;
} ) ;
modal . find ( ".bd-backdrop" ) . on ( "click" , ( ) => {
modal . addClass ( "closing" ) ;
setTimeout ( ( ) => {
modal . remove ( ) ;
} , 300 ) ;
} ) ;
modal . appendTo ( "#app-mount" ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
Core . prototype . showContentErrors = function ( {
plugins : pluginErrors = [ ] ,
themes : themeErrors = [ ]
} ) {
if ( ! pluginErrors || ! themeErrors ) return ;
if ( ! pluginErrors . length && ! themeErrors . length ) return ;
const modal = $ ( ` <div class="bd-modal-wrapper theme-dark">
2019-05-29 05:48:41 +02:00
< div class = "bd-backdrop backdrop-1wrmKB" > < / d i v >
< div class = "bd-modal bd-content-modal modal-1UGdnR" >
< div class = "bd-modal-inner inner-1JeGVc" >
< div class = "header header-1R_AjF" > < div class = "title" > Content Errors < / d i v > < / d i v >
< div class = "bd-modal-body" >
< div class = "tab-bar-container" >
< div class = "tab-bar TOP" >
< div class = "tab-bar-item" > Plugins < / d i v >
< div class = "tab-bar-item" > Themes < / d i v >
< / d i v >
< / d i v >
< div class = "table-header" >
< div class = "table-column column-name" > Name < / d i v >
< div class = "table-column column-message" > Message < / d i v >
< div class = "table-column column-error" > Error < / d i v >
< / d i v >
< div class = "scroller-wrap fade" >
< div class = "scroller" >
< / d i v >
< / d i v >
< / d i v >
< div class = "footer footer-2yfCgX" >
< button type = "button" > Okay < / b u t t o n >
< / d i v >
< / d i v >
< / d i v >
< / d i v > ` ) ;
2019-05-30 07:06:17 +02:00
function generateTab ( errors ) {
const container = $ ( ` <div class="errors"> ` ) ;
for ( const err of errors ) {
const error = $ ( ` <div class="error">
2019-05-29 05:48:41 +02:00
< div class = "table-column column-name" > $ { err . name ? err . name : err . file } < / d i v >
< div class = "table-column column-message" > $ { err . message } < / d i v >
< div class = "table-column column-error" > < a class = "error-link" href = "" > $ { err . error ? err . error . message : "" } < / a > < / d i v >
< / d i v > ` ) ;
2019-05-30 07:06:17 +02:00
container . append ( error ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( err . error ) {
error . find ( "a" ) . on ( "click" , e => {
e . preventDefault ( ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . err ( "ContentManager" , ` Error details for ${ err . name ? err . name : err . file } . ` , err . error ) ;
} ) ;
}
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
return container ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
const tabs = [ generateTab ( pluginErrors ) , generateTab ( themeErrors ) ] ;
modal . find ( ".tab-bar-item" ) . on ( "click" , e => {
e . preventDefault ( ) ;
modal . find ( ".tab-bar-item" ) . removeClass ( "selected" ) ;
$ ( e . target ) . addClass ( "selected" ) ;
modal . find ( ".scroller" ) . empty ( ) . append ( tabs [ $ ( e . target ) . index ( ) ] ) ;
} ) ;
modal . find ( ".footer button" ) . on ( "click" , ( ) => {
modal . addClass ( "closing" ) ;
setTimeout ( ( ) => {
modal . remove ( ) ;
} , 300 ) ;
} ) ;
modal . find ( ".bd-backdrop" ) . on ( "click" , ( ) => {
modal . addClass ( "closing" ) ;
setTimeout ( ( ) => {
modal . remove ( ) ;
} , 300 ) ;
} ) ;
modal . appendTo ( "#app-mount" ) ;
if ( pluginErrors . length ) modal . find ( ".tab-bar-item" ) [ 0 ] . click ( ) ; else modal . find ( ".tab-bar-item" ) [ 1 ] . click ( ) ;
2019-05-29 05:48:41 +02:00
} ;
/ * *
* This shows a toast similar to android towards the bottom of the screen .
*
* @ param { string } content The string to show in the toast .
* @ param { object } options Options object . Optional parameter .
* @ param { string } options . type Changes the type of the toast stylistically and semantically . Choices : "" , "info" , "success" , "danger" / "error" , "warning" / "warn" . Default : ""
* @ param { boolean } options . icon Determines whether the icon should show corresponding to the type . A toast without type will always have no icon . Default : true
* @ param { number } options . timeout Adjusts the time ( in ms ) the toast should be shown for before disappearing automatically . Default : 3000
* /
2019-05-30 07:06:17 +02:00
Core . prototype . showToast = function ( content , options = { } ) {
if ( ! data _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Config" ] . deferLoaded ) return ;
if ( ! document . querySelector ( ".bd-toasts" ) ) {
const toastWrapper = document . createElement ( "div" ) ;
toastWrapper . classList . add ( "bd-toasts" ) ;
const boundingElement = document . querySelector ( ".chat-3bRxxu form, #friends, .noChannel-Z1DQK7, .activityFeed-28jde9" ) ;
toastWrapper . style . setProperty ( "left" , boundingElement ? boundingElement . getBoundingClientRect ( ) . left + "px" : "0px" ) ;
toastWrapper . style . setProperty ( "width" , boundingElement ? boundingElement . offsetWidth + "px" : "100%" ) ;
toastWrapper . style . setProperty ( "bottom" , ( document . querySelector ( ".chat-3bRxxu form" ) ? document . querySelector ( ".chat-3bRxxu form" ) . offsetHeight : 80 ) + "px" ) ;
document . querySelector ( ".app, .app-2rEoOp" ) . appendChild ( toastWrapper ) ;
}
const {
type = "" ,
icon = true ,
timeout = 3000
} = options ;
const toastElem = document . createElement ( "div" ) ;
toastElem . classList . add ( "bd-toast" ) ;
if ( type ) toastElem . classList . add ( "toast-" + type ) ;
if ( type && icon ) toastElem . classList . add ( "icon" ) ;
toastElem . innerText = content ;
document . querySelector ( ".bd-toasts" ) . appendChild ( toastElem ) ;
setTimeout ( ( ) => {
toastElem . classList . add ( "closing" ) ;
2019-05-29 05:48:41 +02:00
setTimeout ( ( ) => {
2019-05-30 07:06:17 +02:00
toastElem . remove ( ) ;
if ( ! document . querySelectorAll ( ".bd-toasts .bd-toast" ) . length ) document . querySelector ( ".bd-toasts" ) . remove ( ) ;
} , 300 ) ;
} , timeout ) ;
2019-05-29 05:48:41 +02:00
} ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new Core ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/datastore.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / datastore . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var _pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./pluginapi */ "./src/modules/pluginapi.js" ) ;
2019-05-30 07:06:17 +02:00
2019-05-29 05:48:41 +02:00
const fs = _ _webpack _require _ _ ( /*! fs */ "fs" ) ;
2019-05-30 07:06:17 +02:00
2019-05-29 05:48:41 +02:00
const path = _ _webpack _require _ _ ( /*! path */ "path" ) ;
2019-05-30 07:06:17 +02:00
const releaseChannel = DiscordNative . globals . releaseChannel ;
2019-05-29 05:48:41 +02:00
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class DataStore {
2019-05-30 07:06:17 +02:00
constructor ( ) {
this . data = {
settings : {
stable : { } ,
canary : { } ,
ptb : { }
}
} ;
this . pluginData = { } ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
initialize ( ) {
try {
if ( ! fs . existsSync ( this . BDFile ) ) fs . writeFileSync ( this . BDFile , JSON . stringify ( this . data , null , 4 ) ) ;
const data = require ( this . BDFile ) ;
if ( data . hasOwnProperty ( "settings" ) ) this . data = data ;
if ( ! fs . existsSync ( this . settingsFile ) ) return ;
let settings = require ( this . settingsFile ) ;
fs . unlinkSync ( this . settingsFile ) ;
if ( settings . hasOwnProperty ( "settings" ) ) settings = Object . assign ( {
stable : { } ,
canary : { } ,
ptb : { }
} , {
[ releaseChannel ] : settings
} ) ; else settings = Object . assign ( {
stable : { } ,
canary : { } ,
ptb : { }
} , settings ) ;
this . setBDData ( "settings" , settings ) ;
} catch ( err ) {
_pluginapi _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . alert ( "Corrupt Storage" , "The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload." ) ;
}
}
get BDFile ( ) {
return this . _BDFile || ( this . _BDFile = path . resolve ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Config" ] . dataPath , "bdstorage.json" ) ) ;
}
get settingsFile ( ) {
return this . _settingsFile || ( this . _settingsFile = path . resolve ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Config" ] . dataPath , "bdsettings.json" ) ) ;
}
getPluginFile ( pluginName ) {
return path . resolve ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Config" ] . dataPath , "plugins" , pluginName + ".config.json" ) ;
}
getSettingGroup ( key ) {
return this . data . settings [ releaseChannel ] [ key ] || null ;
}
setSettingGroup ( key , data ) {
this . data . settings [ releaseChannel ] [ key ] = data ;
fs . writeFileSync ( this . BDFile , JSON . stringify ( this . data , null , 4 ) ) ;
}
getBDData ( key ) {
return this . data [ key ] || "" ;
}
setBDData ( key , value ) {
this . data [ key ] = value ;
fs . writeFileSync ( this . BDFile , JSON . stringify ( this . data , null , 4 ) ) ;
}
getPluginData ( pluginName , key ) {
if ( this . pluginData [ pluginName ] !== undefined ) return this . pluginData [ pluginName ] [ key ] || undefined ;
if ( ! fs . existsSync ( this . getPluginFile ( pluginName ) ) ) return undefined ;
this . pluginData [ pluginName ] = JSON . parse ( fs . readFileSync ( this . getPluginFile ( pluginName ) ) ) ;
return this . pluginData [ pluginName ] [ key ] || undefined ;
}
setPluginData ( pluginName , key , value ) {
if ( value === undefined ) return ;
if ( this . pluginData [ pluginName ] === undefined ) this . pluginData [ pluginName ] = { } ;
this . pluginData [ pluginName ] [ key ] = value ;
fs . writeFileSync ( this . getPluginFile ( pluginName ) , JSON . stringify ( this . pluginData [ pluginName ] , null , 4 ) ) ;
}
deletePluginData ( pluginName , key ) {
if ( this . pluginData [ pluginName ] === undefined ) this . pluginData [ pluginName ] = { } ;
delete this . pluginData [ pluginName ] [ key ] ;
fs . writeFileSync ( this . getPluginFile ( pluginName ) , JSON . stringify ( this . pluginData [ pluginName ] , null , 4 ) ) ;
}
} ( ) ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
/***/ } ) ,
2019-05-29 05:48:41 +02:00
/***/ "./src/modules/emitter.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / emitter . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
const EventEmitter = _ _webpack _require _ _ ( /*! events */ "events" ) ;
2019-05-30 07:06:17 +02:00
2019-05-29 05:48:41 +02:00
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class BDEvents extends EventEmitter {
2019-05-30 07:06:17 +02:00
dispatch ( eventName , ... args ) {
this . emit ( eventName , ... args ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
} ( ) ) ;
2019-05-29 05:48:41 +02:00
/***/ } ) ,
/***/ "./src/modules/emotemenu.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / emotemenu . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var _datastore _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./datastore */ "./src/modules/datastore.js" ) ;
/* harmony import */ var _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./utilities */ "./src/modules/utilities.js" ) ;
2019-05-30 07:06:17 +02:00
function QuickEmoteMenu ( ) { }
QuickEmoteMenu . prototype . init = function ( ) {
this . initialized = true ;
$ ( document ) . on ( "mousedown" , function ( e ) {
if ( e . target . id != "rmenu" ) $ ( "#rmenu" ) . remove ( ) ;
} ) ;
this . favoriteEmotes = { } ;
const fe = _datastore _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getBDData ( "bdfavemotes" ) ;
if ( fe !== "" && fe !== null ) {
this . favoriteEmotes = JSON . parse ( atob ( fe ) ) ;
}
let 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 ;
let teContainer = "" ;
teContainer += "<div id=\"bda-qem-twitch-container\">" ;
teContainer += " <div class=\"scroller-wrap scrollerWrap-2lJEkd fade\">" ;
teContainer += " <div class=\"scroller scroller-2FKFPG\">" ;
teContainer += " <div class=\"emote-menu-inner\">" ;
let url = "" ;
for ( const emote in data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] . TwitchGlobal ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] . TwitchGlobal . hasOwnProperty ( emote ) ) {
url = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] . TwitchGlobal [ emote ] ;
teContainer += "<div class=\"emote-container\">" ;
teContainer += " <img class=\"emote-icon\" alt=\"\" src=\"" + url + "\" title=\"" + emote + "\">" ;
teContainer += " </img>" ;
teContainer += "</div>" ;
}
}
teContainer += " </div>" ;
teContainer += " </div>" ;
teContainer += " </div>" ;
teContainer += "</div>" ;
this . teContainer = teContainer ;
let faContainer = "" ;
faContainer += "<div id=\"bda-qem-favourite-container\">" ;
faContainer += " <div class=\"scroller-wrap scrollerWrap-2lJEkd fade\">" ;
faContainer += " <div class=\"scroller scroller-2FKFPG\">" ;
faContainer += " <div class=\"emote-menu-inner\">" ;
for ( const emote in this . favoriteEmotes ) {
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>" ;
2019-05-29 05:48:41 +02:00
faContainer += "</div>" ;
2019-05-30 07:06:17 +02:00
}
faContainer += " </div>" ;
faContainer += " </div>" ;
faContainer += " </div>" ;
faContainer += "</div>" ;
this . faContainer = faContainer ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
QuickEmoteMenu . prototype . favContext = function ( e , em ) {
e . stopPropagation ( ) ;
const menu = $ ( "<div>" , {
"id" : "removemenu" ,
"data-emoteid" : $ ( em ) . prop ( "title" ) ,
"text" : "Remove" ,
"class" : "bd-context-menu context-menu theme-dark"
} ) ;
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 ( ) ;
2019-05-29 05:48:41 +02:00
e . stopPropagation ( ) ;
2019-05-30 07:06:17 +02:00
$ ( this ) . remove ( ) ;
delete this . favoriteEmotes [ $ ( this ) . data ( "emoteid" ) ] ;
this . updateFavorites ( ) ;
2019-05-29 05:48:41 +02:00
return false ;
2019-05-30 07:06:17 +02:00
} ) ;
return false ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
QuickEmoteMenu . prototype . switchHandler = function ( e ) {
this . switchQem ( $ ( e ) . attr ( "id" ) ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
QuickEmoteMenu . prototype . switchQem = function ( id ) {
const twitch = $ ( "#bda-qem-twitch" ) ;
const fav = $ ( "#bda-qem-favourite" ) ;
const emojis = $ ( "#bda-qem-emojis" ) ;
twitch . removeClass ( "active" ) ;
fav . removeClass ( "active" ) ;
emojis . removeClass ( "active" ) ;
$ ( ".emojiPicker-3m1S-j" ) . 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" ) ;
$ ( ".emojiPicker-3m1S-j" ) . show ( ) ;
$ ( ".emojiPicker-3m1S-j .search-bar-inner input, .emojiPicker-3m1S-j .search-bar-inner input" ) . focus ( ) ;
break ;
}
this . lastTab = id ;
const emoteIcon = $ ( ".emote-icon" ) ;
emoteIcon . off ( ) ;
emoteIcon . on ( "click" , function ( ) {
const emote = $ ( this ) . attr ( "title" ) ;
const ta = _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . getTextArea ( ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . insertText ( ta [ 0 ] , ta . val ( ) . slice ( - 1 ) == " " ? ta . val ( ) + emote : ta . val ( ) + " " + emote ) ;
} ) ;
2019-05-29 05:48:41 +02:00
} ;
QuickEmoteMenu . prototype . obsCallback = function ( elem ) {
2019-05-30 07:06:17 +02:00
if ( ! this . initialized ) return ;
const e = $ ( elem ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "bda-es-9" ] ) {
e . addClass ( "bda-qme-hidden" ) ;
} else {
e . removeClass ( "bda-qme-hidden" ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "bda-es-0" ] ) return ;
e . prepend ( this . qmeHeader ) ;
e . append ( this . teContainer ) ;
e . append ( this . faContainer ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( this . lastTab == undefined ) {
this . lastTab = "bda-qem-emojis" ;
}
this . switchQem ( this . lastTab ) ;
2019-05-29 05:48:41 +02:00
} ;
QuickEmoteMenu . prototype . favorite = function ( name , url ) {
2019-05-30 07:06:17 +02:00
if ( ! this . favoriteEmotes . hasOwnProperty ( name ) ) {
this . favoriteEmotes [ name ] = url ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
this . updateFavorites ( ) ;
2019-05-29 05:48:41 +02:00
} ;
QuickEmoteMenu . prototype . updateFavorites = function ( ) {
2019-05-30 07:06:17 +02:00
let faContainer = "" ;
faContainer += "<div id=\"bda-qem-favourite-container\">" ;
faContainer += " <div class=\"scroller-wrap scrollerWrap-2lJEkd fade\">" ;
faContainer += " <div class=\"scroller scroller-2FKFPG\">" ;
faContainer += " <div class=\"emote-menu-inner\">" ;
for ( const emote in this . favoriteEmotes ) {
const 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>" ;
2019-05-29 05:48:41 +02:00
faContainer += "</div>" ;
2019-05-30 07:06:17 +02:00
}
faContainer += " </div>" ;
faContainer += " </div>" ;
faContainer += " </div>" ;
faContainer += "</div>" ;
this . faContainer = faContainer ;
$ ( "#bda-qem-favourite-container" ) . replaceWith ( faContainer ) ;
_datastore _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . setBDData ( "bdfavemotes" , btoa ( JSON . stringify ( this . favoriteEmotes ) ) ) ;
2019-05-29 05:48:41 +02:00
} ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new QuickEmoteMenu ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/emotes.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / emotes . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./utilities */ "./src/modules/utilities.js" ) ;
/* harmony import */ var _bdv2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./bdv2 */ "./src/modules/bdv2.js" ) ;
/* harmony import */ var _ui _emote _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../ui/emote */ "./src/ui/emote.js" ) ;
/* harmony import */ var _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./pluginapi */ "./src/modules/pluginapi.js" ) ;
/* harmony import */ var _datastore _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./datastore */ "./src/modules/datastore.js" ) ;
2019-05-30 07:06:17 +02:00
/* harmony import */ var _webpackmodules _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./webpackmodules */ "./src/modules/webpackmodules.js" ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
const bdEmoteSettingIDs = {
TwitchGlobal : "bda-es-7" ,
TwitchSubscriber : "bda-es-7" ,
BTTV : "bda-es-2" ,
FrankerFaceZ : "bda-es-1" ,
BTTV2 : "bda-es-2"
2019-05-29 05:48:41 +02:00
} ;
function EmoteModule ( ) {
2019-05-30 07:06:17 +02:00
Object . defineProperty ( this , "categories" , {
get : function ( ) {
const cats = [ ] ;
for ( const current in bdEmoteSettingIDs ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ bdEmoteSettingIDs [ current ] ] ) cats . push ( current ) ;
}
return cats ;
}
} ) ;
2019-05-29 05:48:41 +02:00
}
EmoteModule . prototype . init = async function ( ) {
2019-05-30 07:06:17 +02:00
this . modifiers = [ "flip" , "spin" , "pulse" , "spin2" , "spin3" , "1spin" , "2spin" , "3spin" , "tr" , "bl" , "br" , "shake" , "shake2" , "shake3" , "flap" ] ;
this . overrides = [ "twitch" , "bttv" , "ffz" ] ;
const emoteInfo = {
TwitchGlobal : {
url : "https://twitchemotes.com/api_cache/v3/global.json" ,
backup : ` https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_global.json ` ,
variable : "TwitchGlobal" ,
oldVariable : "emotesTwitch" ,
getEmoteURL : e => ` https://static-cdn.jtvnw.net/emoticons/v1/ ${ e . id } /1.0 ` ,
getOldData : ( url , name ) => {
return {
id : url . match ( /\/([0-9]+)\// ) [ 1 ] ,
code : name ,
emoticon _set : 0 ,
description : null
} ;
}
} ,
TwitchSubscriber : {
url : ` https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_subscriber.json ` ,
variable : "TwitchSubscriber" ,
oldVariable : "subEmotesTwitch" ,
getEmoteURL : e => ` https://static-cdn.jtvnw.net/emoticons/v1/ ${ e } /1.0 ` ,
getOldData : url => url . match ( /\/([0-9]+)\// ) [ 1 ]
} ,
FrankerFaceZ : {
url : ` https://rauenzi.github.io/BetterDiscordApp/data/emotedata_ffz.json ` ,
variable : "FrankerFaceZ" ,
oldVariable : "emotesFfz" ,
getEmoteURL : e => ` https://cdn.frankerfacez.com/emoticon/ ${ e } /1 ` ,
getOldData : url => url . match ( /\/([0-9]+)\// ) [ 1 ]
} ,
BTTV : {
url : "https://api.betterttv.net/emotes" ,
variable : "BTTV" ,
oldVariable : "emotesBTTV" ,
parser : data => {
const emotes = { } ;
for ( let e = 0 , len = data . emotes . length ; e < len ; e ++ ) {
const emote = data . emotes [ e ] ;
emotes [ emote . regex ] = emote . url ;
}
return emotes ;
} ,
getEmoteURL : e => ` ${ e } ` ,
getOldData : url => url
} ,
BTTV2 : {
url : ` https://rauenzi.github.io/BetterDiscordApp/data/emotedata_bttv.json ` ,
variable : "BTTV2" ,
oldVariable : "emotesBTTV2" ,
getEmoteURL : e => ` https://cdn.betterttv.net/emote/ ${ e } /1x ` ,
getOldData : url => url . match ( /emote\/(.+)\// ) [ 1 ]
}
} ;
await this . getBlacklist ( ) ;
await this . loadEmoteData ( emoteInfo ) ;
while ( ! _bdv2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . MessageContentComponent ) await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
if ( this . cancelEmoteRender ) return ;
this . cancelEmoteRender = _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( _bdv2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . MessageContentComponent . prototype , "render" , {
after : ( {
returnValue
} ) => {
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( returnValue . props , "children" , {
silent : true ,
after : ( {
returnValue
} ) => {
if ( this . categories . length == 0 ) return ;
const markup = returnValue . props . children [ 1 ] ;
if ( ! markup . props . children ) return ;
const nodes = markup . props . children [ 1 ] ;
if ( ! nodes || ! nodes . length ) return ;
for ( let n = 0 ; n < nodes . length ; n ++ ) {
const node = nodes [ n ] ;
if ( typeof node !== "string" ) continue ;
const words = node . split ( /([^\s]+)([\s]|$)/g ) ;
for ( let c = 0 , clen = this . categories . length ; c < clen ; c ++ ) {
for ( let w = 0 , wlen = words . length ; w < wlen ; w ++ ) {
const emote = words [ w ] ;
const emoteSplit = emote . split ( ":" ) ;
const emoteName = emoteSplit [ 0 ] ;
let emoteModifier = emoteSplit [ 1 ] ? emoteSplit [ 1 ] : "" ;
let emoteOverride = emoteModifier . slice ( 0 ) ;
if ( emoteName . length < 4 || data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "EmoteBlacklist" ] . includes ( emoteName ) ) continue ;
if ( ! this . modifiers . includes ( emoteModifier ) || ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "bda-es-8" ] ) emoteModifier = "" ;
if ( ! this . overrides . includes ( emoteOverride ) ) emoteOverride = "" ; else emoteModifier = emoteOverride ;
let current = this . categories [ c ] ;
if ( emoteOverride === "twitch" ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] . TwitchGlobal [ emoteName ] ) current = "TwitchGlobal" ; else if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] . TwitchSubscriber [ emoteName ] ) current = "TwitchSubscriber" ;
} else if ( emoteOverride === "bttv" ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] . BTTV [ emoteName ] ) current = "BTTV" ; else if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] . BTTV2 [ emoteName ] ) current = "BTTV2" ;
} else if ( emoteOverride === "ffz" ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] . FrankerFaceZ [ emoteName ] ) current = "FrankerFaceZ" ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] [ current ] [ emoteName ] || ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ bdEmoteSettingIDs [ current ] ] ) continue ;
const results = nodes [ n ] . match ( new RegExp ( ` ([ \\ s]|^) ${ _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . escape ( emoteModifier ? emoteName + ":" + emoteModifier : emoteName ) } ([ \\ s]| $ ) ` ) ) ;
if ( ! results ) continue ;
const pre = nodes [ n ] . substring ( 0 , results . index + results [ 1 ] . length ) ;
const post = nodes [ n ] . substring ( results . index + results [ 0 ] . length - results [ 2 ] . length ) ;
nodes [ n ] = pre ;
const emoteComponent = _webpackmodules _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "DiscordModules" ] . React . createElement ( _ui _emote _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
name : emoteName ,
url : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] [ current ] [ emoteName ] ,
modifier : emoteModifier
} ) ;
nodes . splice ( n + 1 , 0 , post ) ;
nodes . splice ( n + 1 , 0 , emoteComponent ) ;
}
}
}
const onlyEmotes = nodes . every ( r => {
if ( typeof r == "string" && r . replace ( /\s*/ , "" ) == "" ) return true ; else if ( r . type && r . type . name == "BDEmote" ) return true ; else if ( r . props && r . props . children && r . props . children . props && r . props . children . props . emojiName ) return true ;
return false ;
} ) ;
if ( ! onlyEmotes ) return ;
for ( const node of nodes ) {
if ( typeof node != "object" ) continue ;
if ( node . type . name == "BDEmote" ) node . props . jumboable = true ; else if ( node . props && node . props . children && node . props . children . props && node . props . children . props . emojiName ) node . props . children . props . jumboable = true ;
}
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
} ) ;
}
} ) ;
} ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
EmoteModule . prototype . disable = function ( ) {
this . disableAutoCapitalize ( ) ;
if ( this . cancelEmoteRender ) return ;
this . cancelEmoteRender ( ) ;
this . cancelEmoteRender = null ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
EmoteModule . prototype . clearEmoteData = async function ( ) {
const _fs = _ _webpack _require _ _ ( /*! fs */ "fs" ) ;
const emoteFile = "emote_data.json" ;
const file = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Config" ] . dataPath + emoteFile ;
const exists = _fs . existsSync ( file ) ;
if ( exists ) _fs . unlinkSync ( file ) ;
_datastore _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . setBDData ( "emoteCacheDate" , new Date ( ) . toJSON ( ) ) ;
Object . assign ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] , {
TwitchGlobal : { } ,
TwitchSubscriber : { } ,
BTTV : { } ,
FrankerFaceZ : { } ,
BTTV2 : { }
} ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
EmoteModule . prototype . isCacheValid = function ( ) {
const cacheLength = _datastore _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . getBDData ( "emoteCacheDays" ) || _datastore _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . setBDData ( "emoteCacheDays" , 7 ) || 7 ;
const cacheDate = new Date ( _datastore _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . getBDData ( "emoteCacheDate" ) || null ) ;
const currentDate = new Date ( ) ;
const daysBetween = Math . round ( Math . abs ( ( currentDate . getTime ( ) - cacheDate . getTime ( ) ) / ( 24 * 60 * 60 * 1000 ) ) ) ;
if ( daysBetween > cacheLength ) {
_datastore _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . setBDData ( "emoteCacheDate" , currentDate . toJSON ( ) ) ;
return false ;
}
return true ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
EmoteModule . prototype . loadEmoteData = async function ( emoteInfo ) {
const _fs = _ _webpack _require _ _ ( /*! fs */ "fs" ) ;
const emoteFile = "emote_data.json" ;
const file = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Config" ] . dataPath + emoteFile ;
const exists = _fs . existsSync ( file ) ;
if ( exists && this . isCacheValid ( ) ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( "Loading emotes from cache." , {
type : "info"
} ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Emotes" , "Loading emotes from local cache." ) ;
const data = await new Promise ( resolve => {
_fs . readFile ( file , "utf8" , ( err , data ) => {
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Emotes" , "Emotes loaded from cache." ) ;
if ( err ) data = { } ;
resolve ( data ) ;
} ) ;
} ) ;
let isValid = _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . testJSON ( data ) ;
if ( isValid ) Object . assign ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] , JSON . parse ( data ) ) ;
2019-05-29 06:29:15 +02:00
for ( const e in emoteInfo ) {
2019-05-30 07:06:17 +02:00
isValid = Object . keys ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] [ emoteInfo [ e ] . variable ] ) . length > 0 ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
if ( isValid ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( "Emotes successfully loaded." , {
type : "success"
} ) ;
return ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Emotes" , "Cache was corrupt, downloading..." ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
_fs . unlinkSync ( file ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-es-3" ] ) return ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( "Downloading emotes in the background do not reload." , {
type : "info"
} ) ;
for ( const e in emoteInfo ) {
await new Promise ( r => setTimeout ( r , 1000 ) ) ;
const data = await this . downloadEmotes ( emoteInfo [ e ] ) ;
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] [ emoteInfo [ e ] . variable ] = data ;
}
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( "All emotes successfully downloaded." , {
type : "success"
} ) ;
try {
_fs . writeFileSync ( file , JSON . stringify ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] ) , "utf8" ) ;
} catch ( err ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . err ( "Emotes" , "Could not save emote data." , err ) ;
}
} ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
EmoteModule . prototype . downloadEmotes = function ( emoteMeta ) {
const request = _ _webpack _require _ _ ( /*! request */ "request" ) ;
const options = {
url : emoteMeta . url ,
timeout : emoteMeta . timeout ? emoteMeta . timeout : 5000
} ;
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Emotes" , ` Downloading: ${ emoteMeta . variable } ( ${ emoteMeta . url } ) ` ) ;
return new Promise ( ( resolve , reject ) => {
request ( options , ( error , response , body ) => {
if ( error ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . err ( "Emotes" , "Could not download " + emoteMeta . variable , error ) ;
if ( emoteMeta . backup ) {
emoteMeta . url = emoteMeta . backup ;
emoteMeta . backup = null ;
if ( emoteMeta . backupParser ) emoteMeta . parser = emoteMeta . backupParser ;
return resolve ( this . downloadEmotes ( emoteMeta ) ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
return reject ( { } ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
let parsedData = { } ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
try {
parsedData = JSON . parse ( body ) ;
} catch ( err ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . err ( "Emotes" , "Could not download " + emoteMeta . variable , err ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( emoteMeta . backup ) {
emoteMeta . url = emoteMeta . backup ;
emoteMeta . backup = null ;
if ( emoteMeta . backupParser ) emoteMeta . parser = emoteMeta . backupParser ;
return resolve ( this . downloadEmotes ( emoteMeta ) ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
return reject ( { } ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( typeof emoteMeta . parser === "function" ) parsedData = emoteMeta . parser ( parsedData ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
for ( const emote in parsedData ) {
if ( emote . length < 4 || data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "EmoteBlacklist" ] . includes ( emote ) ) {
delete parsedData [ emote ] ;
continue ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
parsedData [ emote ] = emoteMeta . getEmoteURL ( parsedData [ emote ] ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
resolve ( parsedData ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Emotes" , "Downloaded: " + emoteMeta . variable ) ;
2019-05-29 05:48:41 +02:00
} ) ;
2019-05-30 07:06:17 +02:00
} ) ;
2019-05-29 05:48:41 +02:00
} ;
EmoteModule . prototype . getBlacklist = function ( ) {
2019-05-30 07:06:17 +02:00
return new Promise ( resolve => {
$ . getJSON ( ` https://rauenzi.github.io/BetterDiscordApp/data/emotefilter.json ` , function ( data ) {
resolve ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "EmoteBlacklist" ] . push ( ... data . blacklist ) ) ;
2019-05-29 05:48:41 +02:00
} ) ;
2019-05-30 07:06:17 +02:00
} ) ;
2019-05-29 05:48:41 +02:00
} ;
EmoteModule . prototype . autoCapitalize = function ( ) {
2019-05-30 07:06:17 +02:00
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "bda-es-4" ] || this . autoCapitalizeActive ) return ;
$ ( "body" ) . on ( "keyup.bdac change.bdac paste.bdac" , $ ( ".channelTextArea-1LDbYG textarea:first" ) , ( ) => {
const text = $ ( ".channelTextArea-1LDbYG textarea:first" ) . val ( ) ;
if ( text == undefined ) return ;
const lastWord = text . split ( " " ) . pop ( ) ;
if ( lastWord . length > 3 ) {
if ( lastWord == "danSgame" ) return ;
const ret = this . capitalize ( lastWord . toLowerCase ( ) ) ;
if ( ret !== null && ret !== undefined ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . insertText ( _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getTextArea ( ) [ 0 ] , text . replace ( lastWord , ret ) ) ;
}
}
} ) ;
this . autoCapitalizeActive = true ;
2019-05-29 05:48:41 +02:00
} ;
EmoteModule . prototype . capitalize = function ( value ) {
2019-05-30 07:06:17 +02:00
const res = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Emotes" ] . TwitchGlobal ;
for ( const p in res ) {
if ( res . hasOwnProperty ( p ) && value == ( p + "" ) . toLowerCase ( ) ) {
return p ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
EmoteModule . prototype . disableAutoCapitalize = function ( ) {
this . autoCapitalizeActive = false ;
$ ( "body" ) . off ( ".bdac" ) ;
2019-05-29 05:48:41 +02:00
} ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new EmoteModule ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/modules.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / modules . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
2019-05-30 23:18:52 +02:00
/*! exports provided: React, ReactDOM, BDV2, BdApi, Core, ContentManager, DataStore, Events, EmoteMenu, EmoteModule, PluginManager, ThemeManager, Utilities, WebpackModules, DiscordModules */
2019-05-29 05:48:41 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2019-05-30 07:06:17 +02:00
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "React" , function ( ) { return React ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ReactDOM" , function ( ) { return ReactDOM ; } ) ;
/* harmony import */ var _utilities _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./utilities */ "./src/modules/utilities.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Utilities" , function ( ) { return _utilities _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
/* harmony import */ var _webpackmodules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./webpackmodules */ "./src/modules/webpackmodules.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "WebpackModules" , function ( ) { return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "DiscordModules" , function ( ) { return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
/* harmony import */ var _bdv2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./bdv2 */ "./src/modules/bdv2.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "BDV2" , function ( ) { return _bdv2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
/* harmony import */ var _pluginapi _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./pluginapi */ "./src/modules/pluginapi.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "BdApi" , function ( ) { return _pluginapi _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
/* harmony import */ var _core _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./core */ "./src/modules/core.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Core" , function ( ) { return _core _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 23:18:52 +02:00
/* harmony import */ var _contentmanager _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./contentmanager */ "./src/modules/contentmanager.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ContentManager" , function ( ) { return _contentmanager _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 23:18:52 +02:00
/* harmony import */ var _datastore _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./datastore */ "./src/modules/datastore.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "DataStore" , function ( ) { return _datastore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 23:18:52 +02:00
/* harmony import */ var _emitter _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./emitter */ "./src/modules/emitter.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Events" , function ( ) { return _emitter _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 23:18:52 +02:00
/* harmony import */ var _emotemenu _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./emotemenu */ "./src/modules/emotemenu.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "EmoteMenu" , function ( ) { return _emotemenu _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 23:18:52 +02:00
/* harmony import */ var _emotes _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ./emotes */ "./src/modules/emotes.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "EmoteModule" , function ( ) { return _emotes _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 23:18:52 +02:00
/* harmony import */ var _pluginmanager _ _WEBPACK _IMPORTED _MODULE _10 _ _ = _ _webpack _require _ _ ( /*! ./pluginmanager */ "./src/modules/pluginmanager.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "PluginManager" , function ( ) { return _pluginmanager _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 23:18:52 +02:00
/* harmony import */ var _thememanager _ _WEBPACK _IMPORTED _MODULE _11 _ _ = _ _webpack _require _ _ ( /*! ./thememanager */ "./src/modules/thememanager.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ThemeManager" , function ( ) { return _thememanager _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] ; } ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 23:18:52 +02:00
// import DevMode from "./devmode";
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
// import PublicServers from "./publicservers";
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
const React = _webpackmodules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React ;
const ReactDOM = _webpackmodules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . ReactDOM ;
// export {{
// get React() {return DiscordModules.React;}
// }}
2019-05-29 05:48:41 +02:00
2019-05-29 06:29:15 +02:00
/***/ } ) ,
/***/ "./src/modules/oldstorage.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / oldstorage . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: bdStorage, bdPluginStorage */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "bdStorage" , function ( ) { return bdStorage ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "bdPluginStorage" , function ( ) { return bdPluginStorage ; } ) ;
/* harmony import */ var _utilities _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./utilities */ "./src/modules/utilities.js" ) ;
/* harmony import */ var _datastore _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./datastore */ "./src/modules/datastore.js" ) ;
class bdStorage {
2019-05-30 07:06:17 +02:00
static get ( key ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . warn ( "Deprecation Notice" , "Please use BdApi.getBDData(). bdStorage may be removed in future versions." ) ;
return _datastore _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getBDData ( key ) ;
}
2019-05-29 06:29:15 +02:00
2019-05-30 07:06:17 +02:00
static set ( key , data ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . warn ( "Deprecation Notice" , "Please use BdApi.setBDData(). bdStorage may be removed in future versions." ) ;
_datastore _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . setBDData ( key , data ) ;
}
2019-05-29 06:29:15 +02:00
2019-05-30 07:06:17 +02:00
}
2019-05-29 06:29:15 +02:00
class bdPluginStorage {
2019-05-30 07:06:17 +02:00
static get ( pluginName , key ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . warn ( "Deprecation Notice" , ` ${ pluginName } , please use BdApi.loadData() or BdApi.getData(). bdPluginStorage may be removed in future versions. ` ) ;
return _datastore _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getPluginData ( pluginName , key ) || null ;
}
static set ( pluginName , key , data ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . warn ( "Deprecation Notice" , ` ${ pluginName } , please use BdApi.saveData() or BdApi.setData(). bdPluginStorage may be removed in future versions. ` ) ;
if ( typeof data === "undefined" ) return _utilities _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . warn ( "Deprecation Notice" , "Trying to set undefined value in plugin " + pluginName ) ;
_datastore _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . setPluginData ( pluginName , key , data ) ;
}
static delete ( pluginName , key ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . warn ( "Deprecation Notice" , ` ${ pluginName } , please use BdApi.deleteData(). bdPluginStorage may be removed in future versions. ` ) ;
_datastore _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . deletePluginData ( pluginName , key ) ;
}
2019-05-29 06:29:15 +02:00
}
2019-05-29 05:48:41 +02:00
/***/ } ) ,
/***/ "./src/modules/pluginapi.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / pluginapi . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./utilities */ "./src/modules/utilities.js" ) ;
2019-05-30 07:06:17 +02:00
/* harmony import */ var _webpackmodules _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./webpackmodules */ "./src/modules/webpackmodules.js" ) ;
2019-05-29 05:48:41 +02:00
/* harmony import */ var _datastore _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./datastore */ "./src/modules/datastore.js" ) ;
/* harmony import */ var _core _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./core */ "./src/modules/core.js" ) ;
const BdApi = {
2019-05-30 07:06:17 +02:00
get React ( ) {
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "DiscordModules" ] . React ;
} ,
get ReactDOM ( ) {
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "DiscordModules" ] . ReactDOM ;
} ,
get WindowConfigFile ( ) {
if ( this . _windowConfigFile ) return this . _windowConfigFile ;
const electron = _ _webpack _require _ _ ( /*! electron */ "electron" ) . remote . app ;
const path = _ _webpack _require _ _ ( /*! path */ "path" ) ;
const base = electron . getAppPath ( ) ;
const roamingBase = electron . getPath ( "userData" ) ;
const roamingLocation = path . resolve ( roamingBase , electron . getVersion ( ) , "modules" , "discord_desktop_core" , "injector" , "config.json" ) ;
const location = path . resolve ( base , ".." , "app" , "config.json" ) ;
const fs = _ _webpack _require _ _ ( /*! fs */ "fs" ) ;
const realLocation = fs . existsSync ( location ) ? location : fs . existsSync ( roamingLocation ) ? roamingLocation : null ;
if ( ! realLocation ) return this . _windowConfigFile = null ;
return this . _windowConfigFile = realLocation ;
}
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
BdApi . getAllWindowPreferences = function ( ) {
if ( ! this . WindowConfigFile ) return { } ;
return require ( this . WindowConfigFile ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
BdApi . getWindowPreference = function ( key ) {
if ( ! this . WindowConfigFile ) return undefined ;
return this . getAllWindowPreferences ( ) [ key ] ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
BdApi . setWindowPreference = function ( key , value ) {
if ( ! this . WindowConfigFile ) return ;
const fs = _ _webpack _require _ _ ( /*! fs */ "fs" ) ;
const prefs = this . getAllWindowPreferences ( ) ;
prefs [ key ] = value ;
delete _ _webpack _require _ _ . c [ this . WindowConfigFile ] ;
fs . writeFileSync ( this . WindowConfigFile , JSON . stringify ( prefs , null , 4 ) ) ;
} ; //Inject CSS to document head
2019-05-29 05:48:41 +02:00
//id = id of element
//css = custom css
2019-05-30 07:06:17 +02:00
BdApi . injectCSS = function ( id , css ) {
$ ( "head" ) . append ( $ ( "<style>" , {
id : _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . escapeID ( id ) ,
text : css
} ) ) ;
} ; //Clear css/remove any element
2019-05-29 05:48:41 +02:00
//id = id of element
2019-05-30 07:06:17 +02:00
BdApi . clearCSS = function ( id ) {
$ ( "#" + _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . escapeID ( id ) ) . remove ( ) ;
} ; //Inject CSS to document head
2019-05-29 05:48:41 +02:00
//id = id of element
//css = custom css
2019-05-30 07:06:17 +02:00
BdApi . linkJS = function ( id , url ) {
$ ( "head" ) . append ( $ ( "<script>" , {
id : _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . escapeID ( id ) ,
src : url ,
type : "text/javascript"
} ) ) ;
} ; //Clear css/remove any element
2019-05-29 05:48:41 +02:00
//id = id of element
2019-05-30 07:06:17 +02:00
BdApi . unlinkJS = function ( id ) {
$ ( "#" + _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . escapeID ( id ) ) . remove ( ) ;
} ; //Get another plugin
2019-05-29 05:48:41 +02:00
//name = name of plugin
2019-05-30 07:06:17 +02:00
2019-05-29 05:48:41 +02:00
BdApi . getPlugin = function ( name ) {
2019-05-30 07:06:17 +02:00
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] . hasOwnProperty ( name ) ) {
return data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ name ] . plugin ;
}
return null ;
} ; //Get BetterDiscord Core
2019-05-29 05:48:41 +02:00
BdApi . getCore = function ( ) {
2019-05-30 07:06:17 +02:00
return _core _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] ;
2019-05-29 05:48:41 +02:00
} ;
/ * *
* Shows a generic but very customizable modal .
* @ param { string } title - title of the modal
* @ param { string } content - a string of text to display in the modal
* /
2019-05-30 07:06:17 +02:00
2019-05-29 05:48:41 +02:00
BdApi . alert = function ( title , content ) {
2019-05-30 07:06:17 +02:00
const ModalStack = BdApi . findModuleByProps ( "push" , "update" , "pop" , "popWithKey" ) ;
const AlertModal = BdApi . findModuleByPrototypes ( "handleCancel" , "handleSubmit" , "handleMinorConfirm" ) ;
if ( ! ModalStack || ! AlertModal ) return _core _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . alert ( title , content ) ;
ModalStack . push ( function ( props ) {
return BdApi . React . createElement ( AlertModal , Object . assign ( {
title : title ,
body : content
} , props ) ) ;
} ) ;
2019-05-29 05:48:41 +02:00
} ;
/ * *
* Shows a generic but very customizable confirmation modal with optional confirm and cancel callbacks .
* @ param { string } title - title of the modal
* @ param { ( string | ReactElement | Array < string | ReactElement > ) } children - a single or mixed array of react elements and strings . Everything is wrapped in Discord ' s ` TextElement ` component so strings will show and render properly .
* @ param { object } [ options ] - options to modify the modal
* @ param { boolean } [ options . danger = false ] - whether the main button should be red or not
* @ param { string } [ options . confirmText = Okay ] - text for the confirmation / submit button
* @ param { string } [ options . cancelText = Cancel ] - text for the cancel button
* @ param { callable } [ options . onConfirm = NOOP ] - callback to occur when clicking the submit button
* @ param { callable } [ options . onCancel = NOOP ] - callback to occur when clicking the cancel button
* /
2019-05-30 07:06:17 +02:00
2019-05-29 05:48:41 +02:00
BdApi . showConfirmationModal = function ( title , content , options = { } ) {
2019-05-30 07:06:17 +02:00
const ModalStack = BdApi . findModuleByProps ( "push" , "update" , "pop" , "popWithKey" ) ;
const TextElement = BdApi . findModuleByProps ( "Sizes" , "Weights" ) ;
const ConfirmationModal = BdApi . findModule ( m => m . defaultProps && m . key && m . key ( ) == "confirm-modal" ) ;
if ( ! ModalStack || ! ConfirmationModal || ! TextElement ) return _core _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . alert ( title , content ) ;
const {
onConfirm ,
onCancel ,
confirmText ,
cancelText ,
danger = false
} = options ;
if ( typeof content == "string" ) content = TextElement ( {
color : TextElement . Colors . PRIMARY ,
children : [ content ]
} ) ; else if ( Array . isArray ( content ) ) content = TextElement ( {
color : TextElement . Colors . PRIMARY ,
children : content
} ) ;
content = [ content ] ;
const emptyFunction = ( ) => { } ;
ModalStack . push ( function ( props ) {
return BdApi . React . createElement ( ConfirmationModal , Object . assign ( {
header : title ,
children : content ,
red : danger ,
confirmText : confirmText ? confirmText : "Okay" ,
cancelText : cancelText ? cancelText : "Cancel" ,
onConfirm : onConfirm ? onConfirm : emptyFunction ,
onCancel : onCancel ? onCancel : emptyFunction
} , props ) ) ;
} ) ;
} ; //Show toast alert
BdApi . showToast = function ( content , options = { } ) {
_core _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( content , options ) ;
} ; // Finds module
BdApi . findModule = function ( filter ) {
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . getModule ( filter ) ;
} ; // Finds module
BdApi . findAllModules = function ( filter ) {
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . getModule ( filter , false ) ;
} ; // Finds module
BdApi . findModuleByProps = function ( ... props ) {
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . getByProps ( ... props ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
BdApi . findModuleByPrototypes = function ( ... protos ) {
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . getByPrototypes ( ... protos ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
BdApi . findModuleByDisplayName = function ( name ) {
return _webpackmodules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . getByDisplayName ( name ) ;
} ; // Gets react instance
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
BdApi . getInternalInstance = function ( node ) {
if ( ! ( node instanceof window . jQuery ) && ! ( node instanceof Element ) ) return undefined ;
if ( node instanceof jQuery ) node = node [ 0 ] ;
return _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getInternalInstance ( node ) ;
} ; // Gets data
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
BdApi . loadData = function ( pluginName , key ) {
return _datastore _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . getPluginData ( pluginName , key ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
BdApi . getData = BdApi . loadData ; // Sets data
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
BdApi . saveData = function ( pluginName , key , data ) {
return _datastore _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . setPluginData ( pluginName , key , data ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
BdApi . setData = BdApi . saveData ; // Deletes data
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
BdApi . deleteData = function ( pluginName , key ) {
return _datastore _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . deletePluginData ( pluginName , key ) ;
} ; // Patches other functions
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
BdApi . monkeyPatch = function ( what , methodName , options ) {
return _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( what , methodName , options ) ;
} ; // Event when element is removed
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
BdApi . onRemoved = function ( node , callback ) {
return _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . onRemoved ( node , callback ) ;
} ; // Wraps function in try..catch
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
BdApi . suppressErrors = function ( method , message ) {
return _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( method , message ) ;
} ; // Tests for valid JSON
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
BdApi . testJSON = function ( data ) {
return _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . testJSON ( data ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
BdApi . isPluginEnabled = function ( name ) {
return ! ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ name ] ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
BdApi . isThemeEnabled = function ( name ) {
return ! ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] [ name ] ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
BdApi . isSettingEnabled = function ( id ) {
return ! ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ id ] ;
} ; // Gets data
BdApi . getBDData = function ( key ) {
return _datastore _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . getBDData ( key ) ;
} ; // Sets data
BdApi . setBDData = function ( key , data ) {
return _datastore _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . setBDData ( key , data ) ;
2019-05-29 05:48:41 +02:00
} ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( BdApi ) ;
/***/ } ) ,
/***/ "./src/modules/pluginmanager.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / pluginmanager . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./contentmanager */ "./src/modules/contentmanager.js" ) ;
/* harmony import */ var _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./utilities */ "./src/modules/utilities.js" ) ;
/* harmony import */ var _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./core */ "./src/modules/core.js" ) ;
/* harmony import */ var _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./pluginapi */ "./src/modules/pluginapi.js" ) ;
/* harmony import */ var _emitter _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./emitter */ "./src/modules/emitter.js" ) ;
/* harmony import */ var _datastore _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./datastore */ "./src/modules/datastore.js" ) ;
2019-05-30 07:06:17 +02:00
function PluginModule ( ) { }
2019-05-29 05:48:41 +02:00
PluginModule . prototype . loadPlugins = function ( ) {
2019-05-30 07:06:17 +02:00
this . loadPluginData ( ) ;
const errors = _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadPlugins ( ) ;
const plugins = Object . keys ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
for ( let i = 0 ; i < plugins . length ; i ++ ) {
let plugin , name ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
try {
plugin = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugins [ i ] ] . plugin ;
name = plugin . getName ( ) ;
if ( plugin . load && typeof plugin . load == "function" ) plugin . load ( ) ;
} catch ( err ) {
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ name ] = false ;
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "Plugins" , name + " could not be loaded." , err ) ;
errors . push ( {
name : name ,
file : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugins [ i ] ] . filename ,
message : "load() could not be fired." ,
error : {
message : err . message ,
stack : err . stack
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
} ) ;
continue ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ name ] ) data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ name ] = false ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ name ] ) {
try {
plugin . start ( ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showToast ( ` ${ plugin . getName ( ) } v ${ plugin . getVersion ( ) } has started. ` ) ;
} catch ( err ) {
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ name ] = false ;
2019-05-29 05:48:41 +02:00
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "Plugins" , name + " could not be started." , err ) ;
2019-05-30 07:06:17 +02:00
errors . push ( {
name : name ,
file : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugins [ i ] ] . filename ,
message : "start() could not be fired." ,
error : {
message : err . message ,
stack : err . stack
}
} ) ;
}
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
this . savePluginData ( ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
_ _webpack _require _ _ ( /*! electron */ "electron" ) . remote . getCurrentWebContents ( ) . on ( "did-navigate-in-page" , this . channelSwitch . bind ( this ) ) ; // if (SettingsCookie["fork-ps-5"]) ContentManager.watchContent("plugin");
return errors ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
PluginModule . prototype . startPlugin = function ( plugin , reload = false ) {
try {
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . start ( ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] && ! reload ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showToast ( ` ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . getName ( ) } v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . getVersion ( ) } has started. ` ) ;
} catch ( err ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] && ! reload ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showToast ( ` ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . getName ( ) } v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . getVersion ( ) } could not be started. ` , {
type : "error"
} ) ;
2019-05-29 05:48:41 +02:00
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ plugin ] = false ;
this . savePluginData ( ) ;
2019-05-30 07:06:17 +02:00
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "Plugins" , plugin + " could not be started." , err ) ;
}
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
PluginModule . prototype . stopPlugin = function ( plugin , reload = false ) {
try {
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . stop ( ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] && ! reload ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showToast ( ` ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . getName ( ) } v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . getVersion ( ) } has stopped. ` ) ;
} catch ( err ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] && ! reload ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showToast ( ` ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . getName ( ) } v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . getVersion ( ) } could not be stopped. ` , {
type : "error"
} ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "Plugins" , data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . getName ( ) + " could not be stopped." , err ) ;
}
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
PluginModule . prototype . enablePlugin = function ( plugin , reload = false ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ plugin ] ) return ;
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ plugin ] = true ;
this . savePluginData ( ) ;
this . startPlugin ( plugin , reload ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
PluginModule . prototype . disablePlugin = function ( plugin , reload = false ) {
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ plugin ] ) return ;
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ plugin ] = false ;
this . savePluginData ( ) ;
this . stopPlugin ( plugin , reload ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
PluginModule . prototype . togglePlugin = function ( plugin ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ plugin ] ) this . disablePlugin ( plugin ) ; else this . enablePlugin ( plugin ) ;
} ;
PluginModule . prototype . loadPlugin = function ( filename ) {
const error = _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadContent ( filename , "plugin" ) ;
if ( error ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-1" ] ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showContentErrors ( {
plugins : [ error ]
} ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ filename } could not be loaded. ` , {
type : "error"
} ) ;
return _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "ContentManager" , ` ${ filename } could not be loaded. ` , error ) ;
}
const plugin = Object . values ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] ) . find ( p => p . filename == filename ) . plugin ;
try {
if ( plugin . load && typeof plugin . load == "function" ) plugin . load ( ) ;
} catch ( err ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-1" ] ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showContentErrors ( {
plugins : [ err ]
} ) ;
}
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . log ( "ContentManager" , ` ${ plugin . getName ( ) } v ${ plugin . getVersion ( ) } was loaded. ` ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ plugin . getName ( ) } v ${ plugin . getVersion ( ) } was loaded. ` , {
type : "success"
} ) ;
_emitter _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . dispatch ( "plugin-loaded" , plugin . getName ( ) ) ;
} ;
PluginModule . prototype . unloadPlugin = function ( filenameOrName ) {
const bdplugin = Object . values ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] ) . find ( p => p . filename == filenameOrName ) || data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ filenameOrName ] ;
if ( ! bdplugin ) return ;
const plugin = bdplugin . plugin . getName ( ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ plugin ] ) this . disablePlugin ( plugin , true ) ;
const error = _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . unloadContent ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . filename , "plugin" ) ;
delete data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] ;
if ( error ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-1" ] ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showContentErrors ( {
plugins : [ error ]
} ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ plugin } could not be unloaded. It may have not been loaded yet. ` , {
type : "error"
} ) ;
return _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "ContentManager" , ` ${ plugin } could not be unloaded. It may have not been loaded yet. ` , error ) ;
}
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . log ( "ContentManager" , ` ${ plugin } was unloaded. ` ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ plugin } was unloaded. ` , {
type : "success"
} ) ;
_emitter _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . dispatch ( "plugin-unloaded" , plugin ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
PluginModule . prototype . reloadPlugin = function ( filenameOrName ) {
const bdplugin = Object . values ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] ) . find ( p => p . filename == filenameOrName ) || data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ filenameOrName ] ;
if ( ! bdplugin ) return this . loadPlugin ( filenameOrName ) ;
const plugin = bdplugin . plugin . getName ( ) ;
const enabled = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ plugin ] ;
if ( enabled ) this . stopPlugin ( plugin , true ) ;
const error = _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . reloadContent ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . filename , "plugin" ) ;
if ( error ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-1" ] ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showContentErrors ( {
plugins : [ error ]
} ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ plugin } could not be reloaded. ` , {
type : "error"
} ) ;
return _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "ContentManager" , ` ${ plugin } could not be reloaded. ` , error ) ;
}
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . load && typeof data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . load == "function" ) data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . load ( ) ;
if ( enabled ) this . startPlugin ( plugin , true ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . log ( "ContentManager" , ` ${ plugin } v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . getVersion ( ) } was reloaded. ` ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ plugin } v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin . getVersion ( ) } was reloaded. ` , {
type : "success"
} ) ;
_emitter _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . dispatch ( "plugin-reloaded" , plugin ) ;
} ;
PluginModule . prototype . updatePluginList = function ( ) {
const results = _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadNewContent ( "plugin" ) ;
for ( const filename of results . added ) this . loadPlugin ( filename ) ;
for ( const name of results . removed ) this . unloadPlugin ( name ) ;
2019-05-29 05:48:41 +02:00
} ;
PluginModule . prototype . loadPluginData = function ( ) {
2019-05-30 07:06:17 +02:00
const saved = _datastore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . getSettingGroup ( "plugins" ) ;
if ( ! saved ) return ;
Object . assign ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] , saved ) ;
2019-05-29 05:48:41 +02:00
} ;
PluginModule . prototype . savePluginData = function ( ) {
2019-05-30 07:06:17 +02:00
_datastore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . setSettingGroup ( "plugins" , data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] ) ;
2019-05-29 05:48:41 +02:00
} ;
PluginModule . prototype . newMessage = function ( ) {
2019-05-30 07:06:17 +02:00
const plugins = Object . keys ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] ) ;
for ( let i = 0 ; i < plugins . length ; i ++ ) {
const plugin = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugins [ i ] ] . plugin ;
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ plugin . getName ( ) ] ) continue ;
if ( typeof plugin . onMessage === "function" ) {
try {
plugin . onMessage ( ) ;
} catch ( err ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "Plugins" , "Unable to fire onMessage for " + plugin . getName ( ) + "." , err ) ;
}
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
} ;
PluginModule . prototype . channelSwitch = function ( ) {
2019-05-30 07:06:17 +02:00
const plugins = Object . keys ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] ) ;
for ( let i = 0 ; i < plugins . length ; i ++ ) {
const plugin = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugins [ i ] ] . plugin ;
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ plugin . getName ( ) ] ) continue ;
if ( typeof plugin . onSwitch === "function" ) {
try {
plugin . onSwitch ( ) ;
} catch ( err ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "Plugins" , "Unable to fire onSwitch for " + plugin . getName ( ) + "." , err ) ;
}
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
PluginModule . prototype . rawObserver = function ( e ) {
const plugins = Object . keys ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] ) ;
for ( let i = 0 ; i < plugins . length ; i ++ ) {
const plugin = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugins [ i ] ] . plugin ;
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ plugin . getName ( ) ] ) continue ;
if ( typeof plugin . observer === "function" ) {
try {
plugin . observer ( e ) ;
} catch ( err ) {
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "Plugins" , "Unable to fire observer for " + plugin . getName ( ) + "." , err ) ;
}
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
} ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new PluginModule ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/settingspanel.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / settingspanel . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
2019-05-30 23:18:52 +02:00
/* harmony import */ var _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./contentmanager */ "./src/modules/contentmanager.js" ) ;
/* harmony import */ var _pluginapi _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./pluginapi */ "./src/modules/pluginapi.js" ) ;
/* harmony import */ var _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./core */ "./src/modules/core.js" ) ;
/* harmony import */ var _emotes _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./emotes */ "./src/modules/emotes.js" ) ;
/* harmony import */ var _emitter _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./emitter */ "./src/modules/emitter.js" ) ;
/* harmony import */ var ui _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ui */ "./src/ui/ui.js" ) ;
// import ClassNormalizer from "./classnormalizer";
2019-05-29 05:48:41 +02:00
2019-05-30 23:18:52 +02:00
// import DevMode from "./devmode";
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class SettingsPanel {
constructor ( ) {
2019-05-30 23:18:52 +02:00
this . renderer = new ui _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "SettingsPanel" ] ( {
2019-05-30 07:06:17 +02:00
onChange : this . updateSettings . bind ( this )
} ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
renderSidebar ( ) {
this . renderer . renderSidebar ( ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
updateSettings ( id , enabled ) {
2019-05-30 23:18:52 +02:00
_emitter _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . dispatch ( "setting-updated" , "Modules" , id , enabled ) ;
2019-05-30 07:06:17 +02:00
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ id ] = enabled ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( id == "bda-es-4" ) {
2019-05-30 23:18:52 +02:00
if ( enabled ) _emotes _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . autoCapitalize ( ) ; else _emotes _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . disableAutoCapitalize ( ) ;
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( id == "fork-ps-5" ) {
if ( enabled ) {
2019-05-30 23:18:52 +02:00
_contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . watchContent ( "plugin" ) ;
_contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . watchContent ( "theme" ) ;
2019-05-30 07:06:17 +02:00
} else {
2019-05-30 23:18:52 +02:00
_contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . unwatchContent ( "plugin" ) ;
_contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . unwatchContent ( "theme" ) ;
2019-05-30 07:06:17 +02:00
}
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( id == "fork-wp-1" ) {
2019-05-30 23:18:52 +02:00
_pluginapi _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . setWindowPreference ( "transparent" , enabled ) ;
if ( enabled ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . setWindowPreference ( "backgroundColor" , null ) ; else _pluginapi _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . setWindowPreference ( "backgroundColor" , "#2f3136" ) ;
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 23:18:52 +02:00
_core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . saveSettings ( ) ;
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
initializeSettings ( ) {
2019-05-30 23:18:52 +02:00
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "bda-es-4" ] ) _emotes _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . autoCapitalize ( ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-5" ] ) {
2019-05-30 23:18:52 +02:00
_contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . watchContent ( "plugin" ) ;
_contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . watchContent ( "theme" ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 23:18:52 +02:00
_core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . saveSettings ( ) ;
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
} ( ) ) ;
2019-05-29 05:48:41 +02:00
/***/ } ) ,
/***/ "./src/modules/thememanager.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / thememanager . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./contentmanager */ "./src/modules/contentmanager.js" ) ;
/* harmony import */ var _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./utilities */ "./src/modules/utilities.js" ) ;
/* harmony import */ var _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./core */ "./src/modules/core.js" ) ;
/* harmony import */ var _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./pluginapi */ "./src/modules/pluginapi.js" ) ;
/* harmony import */ var _emitter _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./emitter */ "./src/modules/emitter.js" ) ;
/* harmony import */ var _datastore _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./datastore */ "./src/modules/datastore.js" ) ;
2019-05-30 07:06:17 +02:00
function ThemeModule ( ) { }
2019-05-29 05:48:41 +02:00
ThemeModule . prototype . loadThemes = function ( ) {
2019-05-30 07:06:17 +02:00
this . loadThemeData ( ) ;
const errors = _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadThemes ( ) ;
const themes = Object . keys ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] ) ;
for ( let i = 0 ; i < themes . length ; i ++ ) {
const name = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ themes [ i ] ] . name ;
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] [ name ] ) data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] [ name ] = false ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] [ name ] ) $ ( "head" ) . append ( $ ( "<style>" , {
id : _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . escapeID ( name ) ,
text : unescape ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ name ] . css )
} ) ) ;
}
for ( const theme in data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] ) {
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] ) delete data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] [ theme ] ;
}
this . saveThemeData ( ) ;
return errors ; // if (SettingsCookie["fork-ps-5"]) ContentManager.watchContent("theme");
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
ThemeModule . prototype . enableTheme = function ( theme , reload = false ) {
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] [ theme ] = true ;
this . saveThemeData ( ) ;
$ ( "head" ) . append ( $ ( "<style>" , {
id : _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . escapeID ( theme ) ,
text : unescape ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . css )
} ) ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] && ! reload ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showToast ( ` ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . name } v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . version } has been applied. ` ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
ThemeModule . prototype . disableTheme = function ( theme , reload = false ) {
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] [ theme ] = false ;
this . saveThemeData ( ) ;
$ ( ` # ${ _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . escapeID ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . name ) } ` ) . remove ( ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] && ! reload ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showToast ( ` ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . name } v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . version } has been disabled. ` ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
ThemeModule . prototype . toggleTheme = function ( theme ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] [ theme ] ) this . disableTheme ( theme ) ; else this . enableTheme ( theme ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
ThemeModule . prototype . loadTheme = function ( filename ) {
const error = _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadContent ( filename , "theme" ) ;
if ( error ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-1" ] ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showContentErrors ( {
themes : [ error ]
} ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ filename } could not be loaded. It may not have been loaded. ` , {
type : "error"
} ) ;
return _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "ContentManager" , ` ${ filename } could not be loaded. ` , error ) ;
}
const theme = Object . values ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] ) . find ( p => p . filename == filename ) ;
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . log ( "ContentManager" , ` ${ theme . name } v ${ theme . version } was loaded. ` ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme . name } v ${ theme . version } was loaded. ` , {
type : "success"
} ) ;
_emitter _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . dispatch ( "theme-loaded" , theme . name ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
ThemeModule . prototype . unloadTheme = function ( filenameOrName ) {
const bdtheme = Object . values ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] ) . find ( p => p . filename == filenameOrName ) || data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ filenameOrName ] ;
if ( ! bdtheme ) return ;
const theme = bdtheme . name ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] [ theme ] ) this . disableTheme ( theme , true ) ;
const error = _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . unloadContent ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . filename , "theme" ) ;
delete data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] ;
if ( error ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-1" ] ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showContentErrors ( {
themes : [ error ]
} ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme } could not be unloaded. It may have not been loaded yet. ` , {
type : "error"
} ) ;
return _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "ContentManager" , ` ${ theme } could not be unloaded. It may have not been loaded yet. ` , error ) ;
}
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . log ( "ContentManager" , ` ${ theme } was unloaded. ` ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme } was unloaded. ` , {
type : "success"
} ) ;
_emitter _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . dispatch ( "theme-unloaded" , theme ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
ThemeModule . prototype . reloadTheme = function ( filenameOrName ) {
const bdtheme = Object . values ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] ) . find ( p => p . filename == filenameOrName ) || data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ filenameOrName ] ;
if ( ! bdtheme ) return this . loadTheme ( filenameOrName ) ;
const theme = bdtheme . name ;
const error = _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . reloadContent ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . filename , "theme" ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] [ theme ] ) this . disableTheme ( theme , true ) , this . enableTheme ( theme , true ) ;
if ( error ) {
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-1" ] ) _core _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showContentErrors ( {
themes : [ error ]
} ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme } could not be reloaded. ` , {
type : "error"
} ) ;
return _utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "ContentManager" , ` ${ theme } could not be reloaded. ` , error ) ;
}
_utilities _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . log ( "ContentManager" , ` ${ theme } v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . version } was reloaded. ` ) ;
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-2" ] ) _pluginapi _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme } v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . version } was reloaded. ` , {
type : "success"
} ) ;
_emitter _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . dispatch ( "theme-reloaded" , theme ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
ThemeModule . prototype . updateThemeList = function ( ) {
const results = _contentmanager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadNewContent ( "theme" ) ;
for ( const filename of results . added ) this . loadTheme ( filename ) ;
for ( const name of results . removed ) this . unloadTheme ( name ) ;
2019-05-29 05:48:41 +02:00
} ;
2019-05-30 07:06:17 +02:00
ThemeModule . prototype . loadThemeData = function ( ) {
const saved = _datastore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . getSettingGroup ( "themes" ) ;
if ( ! saved ) return ;
Object . assign ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] , saved ) ;
2019-05-29 05:48:41 +02:00
} ;
ThemeModule . prototype . saveThemeData = function ( ) {
2019-05-30 07:06:17 +02:00
_datastore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . setSettingGroup ( "themes" , data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] ) ;
2019-05-29 05:48:41 +02:00
} ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new ThemeModule ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/utilities.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / utilities . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return Utilities ; } ) ;
class Utilities {
2019-05-30 07:06:17 +02:00
/** Document/window width */
static get screenWidth ( ) {
return Math . max ( document . documentElement . clientWidth , window . innerWidth || 0 ) ;
}
/** Document/window height */
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static get screenHeight ( ) {
return Math . max ( document . documentElement . clientHeight , window . innerHeight || 0 ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static stripBOM ( content ) {
if ( content . charCodeAt ( 0 ) === 0xFEFF ) {
content = content . slice ( 1 ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
return content ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static getTextArea ( ) {
return $ ( ".channelTextArea-1LDbYG textarea" ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static getInternalInstance ( node ) {
return node [ Object . keys ( node ) . find ( k => k . startsWith ( "__reactInternalInstance" ) ) ] || null ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static insertText ( textarea , text ) {
textarea . focus ( ) ;
textarea . selectionStart = 0 ;
textarea . selectionEnd = textarea . value . length ;
document . execCommand ( "insertText" , false , text ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static injectCss ( uri ) {
$ ( "<link/>" , {
type : "text/css" ,
rel : "stylesheet" ,
href : uri
} ) . appendTo ( $ ( "head" ) ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static injectJs ( uri ) {
return new Promise ( resolve => {
$ ( "<script/>" , {
type : "text/javascript" ,
src : uri ,
onload : resolve
} ) . appendTo ( $ ( "body" ) ) ;
} ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static escapeID ( id ) {
return id . replace ( /^[^a-z]+|[^\w-]+/gi , "" ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static log ( moduleName , message ) {
console . log ( ` %c[BandagedBD]%c [ ${ moduleName } ]%c ${ message } ` , "color: #3a71c1; font-weight: 700;" , "color: #3a71c1;" , "" ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static warn ( moduleName , message ) {
console . warn ( ` %c[BandagedBD]%c [ ${ moduleName } ]%c ${ message } ` , "color: #E8A400; font-weight: 700;" , "color: #E8A400;" , "" ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static err ( moduleName , message , error ) {
console . log ( ` %c[BandagedBD]%c [ ${ moduleName } ]%c ${ message } ` , "color: red; font-weight: 700;" , "color: red;" , "" ) ;
if ( error ) {
console . groupCollapsed ( "%cError: " + error . message , "color: red;" ) ;
console . error ( error . stack ) ;
console . groupEnd ( ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static escape ( s ) {
return s . replace ( /[-/\\^$*+?.()|[\]{}]/g , "\\$&" ) ;
}
static testJSON ( data ) {
try {
JSON . parse ( data ) ;
return true ;
} catch ( err ) {
return false ;
}
}
static suppressErrors ( method , message ) {
return ( ... params ) => {
try {
return method ( ... params ) ;
} catch ( e ) {
this . err ( "SuppressedError" , "Error occurred in " + message , e ) ;
}
} ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
static monkeyPatch ( what , methodName , options ) {
const {
before ,
after ,
instead ,
once = false ,
silent = false ,
force = false
} = options ;
const displayName = options . displayName || what . displayName || what . name || what . constructor . displayName || what . constructor . name ;
if ( ! silent ) console . log ( "patch" , methodName , "of" , displayName ) ; // eslint-disable-line no-console
if ( ! what [ methodName ] ) {
if ( force ) what [ methodName ] = function ( ) { } ; else return console . error ( methodName , "does not exist for" , displayName ) ; // eslint-disable-line no-console
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
const origMethod = what [ methodName ] ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
const cancel = ( ) => {
if ( ! silent ) console . log ( "unpatch" , methodName , "of" , displayName ) ; // eslint-disable-line no-console
what [ methodName ] = origMethod ;
} ;
what [ methodName ] = function ( ) {
const data = {
thisObject : this ,
methodArguments : arguments ,
cancelPatch : cancel ,
originalMethod : origMethod ,
callOriginalMethod : ( ) => data . returnValue = data . originalMethod . apply ( data . thisObject , data . methodArguments )
} ;
if ( instead ) {
const tempRet = Utilities . suppressErrors ( instead , "`instead` callback of " + what [ methodName ] . displayName ) ( data ) ;
if ( tempRet !== undefined ) data . returnValue = tempRet ;
} else {
if ( before ) Utilities . suppressErrors ( before , "`before` callback of " + what [ methodName ] . displayName ) ( data ) ;
data . callOriginalMethod ( ) ;
if ( after ) Utilities . suppressErrors ( after , "`after` callback of " + what [ methodName ] . displayName ) ( data ) ;
}
if ( once ) cancel ( ) ;
return data . returnValue ;
} ;
what [ methodName ] . _ _monkeyPatched = true ;
if ( ! what [ methodName ] . _ _originalMethod ) what [ methodName ] . _ _originalMethod = origMethod ;
what [ methodName ] . displayName = "patched " + ( what [ methodName ] . displayName || methodName ) ;
return cancel ;
}
static onRemoved ( node , callback ) {
const observer = new MutationObserver ( mutations => {
for ( let m = 0 ; m < mutations . length ; m ++ ) {
const mutation = mutations [ m ] ;
const nodes = Array . from ( mutation . removedNodes ) ;
const directMatch = nodes . indexOf ( node ) > - 1 ;
const parentMatch = nodes . some ( parent => parent . contains ( node ) ) ;
if ( directMatch || parentMatch ) {
observer . disconnect ( ) ;
callback ( ) ;
}
}
} ) ;
observer . observe ( document . body , {
subtree : true ,
childList : true
} ) ;
}
/ * *
* Generates an automatically memoizing version of an object .
* @ author Zerebos
* @ param { Object } object - object to memoize
* @ returns { Proxy } the proxy to the object that memoizes properties
* /
static memoizeObject ( object ) {
const proxy = new Proxy ( object , {
get : function ( obj , mod ) {
if ( ! obj . hasOwnProperty ( mod ) ) return undefined ;
if ( Object . getOwnPropertyDescriptor ( obj , mod ) . get ) {
const value = obj [ mod ] ;
delete obj [ mod ] ;
obj [ mod ] = value ;
}
return obj [ mod ] ;
} ,
set : function ( obj , mod , value ) {
if ( obj . hasOwnProperty ( mod ) ) return this . err ( "MemoizedObject" , "Trying to overwrite existing property" ) ;
obj [ mod ] = value ;
return obj [ mod ] ;
}
} ) ;
Object . defineProperty ( proxy , "hasOwnProperty" , {
value : function ( prop ) {
return this [ prop ] !== undefined ;
}
} ) ;
return proxy ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
2019-05-30 07:06:17 +02:00
/***/ "./src/modules/webpackmodules.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / webpackmodules . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: DiscordModules, Filters, default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "DiscordModules" , function ( ) { return DiscordModules ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Filters" , function ( ) { return Filters ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return WebpackModules ; } ) ;
/* harmony import */ var _utilities _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./utilities */ "./src/modules/utilities.js" ) ;
/ * *
* Allows for grabbing and searching through Discord ' s webpacked modules .
* @ module WebpackModules
* @ version 0.0 . 2
* /
const DiscordModules = _utilities _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . memoizeObject ( {
get React ( ) {
return WebpackModules . getByProps ( "createElement" , "cloneElement" ) ;
} ,
get ReactDOM ( ) {
return WebpackModules . getByProps ( "render" , "findDOMNode" ) ;
} ,
get Flux ( ) {
return WebpackModules . getByProps ( "connectStores" ) ;
} ,
get Events ( ) {
return WebpackModules . getByPrototypes ( "setMaxListeners" , "emit" ) ;
} ,
/* Guild Info, Stores, and Utilities */
get GuildStore ( ) {
return WebpackModules . getByProps ( "getGuild" ) ;
} ,
get SortedGuildStore ( ) {
return WebpackModules . getByProps ( "getSortedGuilds" ) ;
} ,
get SelectedGuildStore ( ) {
return WebpackModules . getByProps ( "getLastSelectedGuildId" ) ;
} ,
get GuildSync ( ) {
return WebpackModules . getByProps ( "getSyncedGuilds" ) ;
} ,
get GuildInfo ( ) {
return WebpackModules . getByProps ( "getAcronym" ) ;
} ,
get GuildChannelsStore ( ) {
return WebpackModules . getByProps ( "getChannels" , "getDefaultChannel" ) ;
} ,
get GuildMemberStore ( ) {
return WebpackModules . getByProps ( "getMember" ) ;
} ,
get MemberCountStore ( ) {
return WebpackModules . getByProps ( "getMemberCounts" ) ;
} ,
get GuildEmojiStore ( ) {
return WebpackModules . getByProps ( "getEmojis" ) ;
} ,
get GuildActions ( ) {
return WebpackModules . getByProps ( "markGuildAsRead" ) ;
} ,
get GuildPermissions ( ) {
return WebpackModules . getByProps ( "getGuildPermissions" ) ;
} ,
/* Channel Store & Actions */
get ChannelStore ( ) {
return WebpackModules . getByProps ( "getChannels" , "getDMFromUserId" ) ;
} ,
get SelectedChannelStore ( ) {
return WebpackModules . getByProps ( "getLastSelectedChannelId" ) ;
} ,
get ChannelActions ( ) {
return WebpackModules . getByProps ( "selectChannel" ) ;
} ,
get PrivateChannelActions ( ) {
return WebpackModules . getByProps ( "openPrivateChannel" ) ;
} ,
get ChannelSelector ( ) {
return WebpackModules . getByProps ( "selectGuild" , "selectChannel" ) ;
} ,
/* Current User Info, State and Settings */
get UserInfoStore ( ) {
return WebpackModules . getByProps ( "getToken" ) ;
} ,
get UserSettingsStore ( ) {
return WebpackModules . getByProps ( "guildPositions" ) ;
} ,
get AccountManager ( ) {
return WebpackModules . getByProps ( "register" , "login" ) ;
} ,
get UserSettingsUpdater ( ) {
return WebpackModules . getByProps ( "updateRemoteSettings" ) ;
} ,
get OnlineWatcher ( ) {
return WebpackModules . getByProps ( "isOnline" ) ;
} ,
get CurrentUserIdle ( ) {
return WebpackModules . getByProps ( "getIdleTime" ) ;
} ,
get RelationshipStore ( ) {
return WebpackModules . getByProps ( "isBlocked" , "getFriendIDs" ) ;
} ,
get RelationshipManager ( ) {
return WebpackModules . getByProps ( "addRelationship" ) ;
} ,
get MentionStore ( ) {
return WebpackModules . getByProps ( "getMentions" ) ;
} ,
/* User Stores and Utils */
get UserStore ( ) {
return WebpackModules . getByProps ( "getCurrentUser" ) ;
} ,
get UserStatusStore ( ) {
return WebpackModules . getByProps ( "getStatus" , "getState" ) ;
} ,
get UserTypingStore ( ) {
return WebpackModules . getByProps ( "isTyping" ) ;
} ,
get UserActivityStore ( ) {
return WebpackModules . getByProps ( "getActivity" ) ;
} ,
get UserNameResolver ( ) {
return WebpackModules . getByProps ( "getName" ) ;
} ,
get UserNoteStore ( ) {
return WebpackModules . getByProps ( "getNote" ) ;
} ,
get UserNoteActions ( ) {
return WebpackModules . getByProps ( "updateNote" ) ;
} ,
/* Emoji Store and Utils */
get EmojiInfo ( ) {
return WebpackModules . getByProps ( "isEmojiDisabled" ) ;
} ,
get EmojiUtils ( ) {
return WebpackModules . getByProps ( "getGuildEmoji" ) ;
} ,
get EmojiStore ( ) {
return WebpackModules . getByProps ( "getByCategory" , "EMOJI_NAME_RE" ) ;
} ,
/* Invite Store and Utils */
get InviteStore ( ) {
return WebpackModules . getByProps ( "getInvites" ) ;
} ,
get InviteResolver ( ) {
return WebpackModules . getByProps ( "findInvite" ) ;
} ,
get InviteActions ( ) {
return WebpackModules . getByProps ( "acceptInvite" ) ;
} ,
/* Discord Objects & Utils */
get DiscordConstants ( ) {
return WebpackModules . getByProps ( "Permissions" , "ActivityTypes" , "StatusTypes" ) ;
} ,
get DiscordPermissions ( ) {
return WebpackModules . getByProps ( "Permissions" , "ActivityTypes" , "StatusTypes" ) . Permissions ;
} ,
get PermissionUtils ( ) {
return WebpackModules . getByProps ( "getHighestRole" ) ;
} ,
get ColorConverter ( ) {
return WebpackModules . getByProps ( "hex2int" ) ;
} ,
get ColorShader ( ) {
return WebpackModules . getByProps ( "darken" ) ;
} ,
get TinyColor ( ) {
return WebpackModules . getByPrototypes ( "toRgb" ) ;
} ,
get ClassResolver ( ) {
return WebpackModules . getByProps ( "getClass" ) ;
} ,
get ButtonData ( ) {
return WebpackModules . getByProps ( "ButtonSizes" ) ;
} ,
get IconNames ( ) {
return WebpackModules . getByProps ( "IconNames" ) ;
} ,
get NavigationUtils ( ) {
return WebpackModules . getByProps ( "transitionTo" , "replaceWith" , "getHistory" ) ;
} ,
/* Discord Messages */
get MessageStore ( ) {
return WebpackModules . getByProps ( "getMessages" ) ;
} ,
get MessageActions ( ) {
return WebpackModules . getByProps ( "jumpToMessage" , "_sendMessage" ) ;
} ,
get MessageQueue ( ) {
return WebpackModules . getByProps ( "enqueue" ) ;
} ,
get MessageParser ( ) {
return WebpackModules . getByProps ( "createMessage" , "parse" , "unparse" ) ;
} ,
/* Text Processing */
get hljs ( ) {
return WebpackModules . getByProps ( "highlight" , "highlightBlock" ) ;
} ,
get SimpleMarkdown ( ) {
return WebpackModules . getByProps ( "parseBlock" , "parseInline" , "defaultOutput" ) ;
} ,
/* Experiments */
get ExperimentStore ( ) {
return WebpackModules . getByProps ( "getExperimentOverrides" ) ;
} ,
get ExperimentsManager ( ) {
return WebpackModules . getByProps ( "isDeveloper" ) ;
} ,
get CurrentExperiment ( ) {
return WebpackModules . getByProps ( "getExperimentId" ) ;
} ,
/* Images, Avatars and Utils */
get ImageResolver ( ) {
return WebpackModules . getByProps ( "getUserAvatarURL" , "getGuildIconURL" ) ;
} ,
get ImageUtils ( ) {
return WebpackModules . getByProps ( "getSizedImageSrc" ) ;
} ,
get AvatarDefaults ( ) {
return WebpackModules . getByProps ( "getUserAvatarURL" , "DEFAULT_AVATARS" ) ;
} ,
/* Window, DOM, HTML */
get WindowInfo ( ) {
return WebpackModules . getByProps ( "isFocused" , "windowSize" ) ;
} ,
get TagInfo ( ) {
return WebpackModules . getByProps ( "VALID_TAG_NAMES" ) ;
} ,
get DOMInfo ( ) {
return WebpackModules . getByProps ( "canUseDOM" ) ;
} ,
/* Locale/Location and Time */
get LocaleManager ( ) {
return WebpackModules . getByProps ( "setLocale" ) ;
} ,
get Moment ( ) {
return WebpackModules . getByProps ( "parseZone" ) ;
} ,
get LocationManager ( ) {
return WebpackModules . getByProps ( "createLocation" ) ;
} ,
get Timestamps ( ) {
return WebpackModules . getByProps ( "fromTimestamp" ) ;
} ,
2019-05-30 23:18:52 +02:00
get TimeFormatter ( ) {
return WebpackModules . getByProps ( "dateFormat" ) ;
} ,
2019-05-30 07:06:17 +02:00
/* Strings and Utils */
get Strings ( ) {
return WebpackModules . getByProps ( "Messages" ) . Messages ;
} ,
get StringFormats ( ) {
return WebpackModules . getByProps ( "a" , "z" ) ;
} ,
get StringUtils ( ) {
return WebpackModules . getByProps ( "toASCII" ) ;
} ,
/* URLs and Utils */
get URLParser ( ) {
return WebpackModules . getByProps ( "Url" , "parse" ) ;
} ,
get ExtraURLs ( ) {
return WebpackModules . getByProps ( "getArticleURL" ) ;
} ,
/* Drag & Drop */
get DNDActions ( ) {
return WebpackModules . getByProps ( "beginDrag" ) ;
} ,
get DNDSources ( ) {
return WebpackModules . getByProps ( "addTarget" ) ;
} ,
get DNDObjects ( ) {
return WebpackModules . getByProps ( "DragSource" ) ;
} ,
/* Media Stuff (Audio/Video) */
get MediaDeviceInfo ( ) {
return WebpackModules . getByProps ( "Codecs" , "SUPPORTED_BROWSERS" ) ;
} ,
get MediaInfo ( ) {
return WebpackModules . getByProps ( "getOutputVolume" ) ;
} ,
get MediaEngineInfo ( ) {
return WebpackModules . getByProps ( "MediaEngineFeatures" ) ;
} ,
get VoiceInfo ( ) {
return WebpackModules . getByProps ( "EchoCancellation" ) ;
} ,
get VideoStream ( ) {
return WebpackModules . getByProps ( "getVideoStream" ) ;
} ,
get SoundModule ( ) {
return WebpackModules . getByProps ( "playSound" ) ;
} ,
/* Electron & Other Internals with Utils*/
get ElectronModule ( ) {
return WebpackModules . getByProps ( "setBadge" ) ;
} ,
get Dispatcher ( ) {
return WebpackModules . getByProps ( "dirtyDispatch" ) ;
} ,
get PathUtils ( ) {
return WebpackModules . getByProps ( "hasBasename" ) ;
} ,
get NotificationModule ( ) {
return WebpackModules . getByProps ( "showNotification" ) ;
} ,
get RouterModule ( ) {
return WebpackModules . getByProps ( "Router" ) ;
} ,
get APIModule ( ) {
return WebpackModules . getByProps ( "getAPIBaseURL" ) ;
} ,
get AnalyticEvents ( ) {
return WebpackModules . getByProps ( "AnalyticEventConfigs" ) ;
} ,
get KeyGenerator ( ) {
return WebpackModules . getByRegex ( /"binary"/ ) ;
} ,
get Buffers ( ) {
return WebpackModules . getByProps ( "Buffer" , "kMaxLength" ) ;
} ,
get DeviceStore ( ) {
return WebpackModules . getByProps ( "getDevices" ) ;
} ,
get SoftwareInfo ( ) {
return WebpackModules . getByProps ( "os" ) ;
} ,
get CurrentContext ( ) {
return WebpackModules . getByProps ( "setTagsContext" ) ;
}
2019-05-29 05:48:41 +02:00
} ) ;
2019-05-30 07:06:17 +02:00
/ * *
* Checks if a given module matches a set of parameters .
* @ callback module : WebpackModules . Filters ~ filter
* @ param { * } module - module to check
* @ returns { boolean } - True if the module matches the filter , false otherwise
* /
/ * *
* Filters for use with { @ link module : WebpackModules } but may prove useful elsewhere .
* /
class Filters {
/ * *
* Generates a { @ link module : WebpackModules . Filters ~ filter } that filters by a set of properties .
* @ param { Array < string > } props - Array of property names
* @ param { module : WebpackModules . Filters ~ filter } filter - Additional filter
* @ returns { module : WebpackModules . Filters ~ filter } - A filter that checks for a set of properties
* /
static byProperties ( props , filter = m => m ) {
return module => {
const component = filter ( module ) ;
if ( ! component ) return false ;
return props . every ( property => component [ property ] !== undefined ) ;
} ;
}
/ * *
* Generates a { @ link module : WebpackModules . Filters ~ filter } that filters by a set of properties on the object ' s prototype .
* @ param { Array < string > } fields - Array of property names
* @ param { module : WebpackModules . Filters ~ filter } filter - Additional filter
* @ returns { module : WebpackModules . Filters ~ filter } - A filter that checks for a set of properties on the object ' s prototype
* /
static byPrototypeFields ( fields , filter = m => m ) {
return module => {
const component = filter ( module ) ;
if ( ! component ) return false ;
if ( ! component . prototype ) return false ;
return fields . every ( field => component . prototype [ field ] !== undefined ) ;
} ;
}
/ * *
* Generates a { @ link module : WebpackModules . Filters ~ filter } that filters by a regex .
* @ param { RegExp } search - A RegExp to check on the module
* @ param { module : WebpackModules . Filters ~ filter } filter - Additional filter
* @ returns { module : WebpackModules . Filters ~ filter } - A filter that checks for a set of properties
* /
static byCode ( search , filter = m => m ) {
return module => {
const method = filter ( module ) ;
if ( ! method ) return false ;
return method . toString ( [ ] ) . search ( search ) !== - 1 ;
} ;
}
/ * *
* Generates a { @ link module : WebpackModules . Filters ~ filter } that filters by strings .
* @ param { ... String } search - A RegExp to check on the module
* @ returns { module : WebpackModules . Filters ~ filter } - A filter that checks for a set of strings
* /
static byString ( ... strings ) {
return module => {
const moduleString = module . toString ( [ ] ) ;
for ( const s of strings ) {
if ( ! moduleString . includes ( s ) ) return false ;
}
return true ;
} ;
}
/ * *
* Generates a { @ link module : WebpackModules . Filters ~ filter } that filters by a set of properties .
* @ param { string } name - Name the module should have
* @ param { module : WebpackModules . Filters ~ filter } filter - Additional filter
* @ returns { module : WebpackModules . Filters ~ filter } - A filter that checks for a set of properties
* /
static byDisplayName ( name ) {
return module => {
return module && module . displayName === name ;
} ;
}
/ * *
* Generates a combined { @ link module : WebpackModules . Filters ~ filter } from a list of filters .
* @ param { ... module : WebpackModules . Filters ~ filter } filters - A list of filters
* @ returns { module : WebpackModules . Filters ~ filter } - Combinatory filter of all arguments
* /
static combine ( ... filters ) {
return module => {
return filters . every ( filter => filter ( module ) ) ;
} ;
}
}
class WebpackModules {
static find ( filter , first = true ) {
return this . getModule ( filter , first ) ;
}
static findAll ( filter ) {
return this . getModule ( filter , false ) ;
}
static findByUniqueProperties ( props , first = true ) {
return first ? this . getByProps ( ... props ) : this . getAllByProps ( ... props ) ;
}
static findByDisplayName ( name ) {
return this . getByDisplayName ( name ) ;
}
/ * *
* Finds a module using a filter function .
* @ param { Function } filter A function to use to filter modules
* @ param { Boolean } first Whether to return only the first matching module
* @ return { Any }
* /
static getModule ( filter , first = true ) {
const modules = this . getAllModules ( ) ;
const rm = [ ] ;
for ( const index in modules ) {
if ( ! modules . hasOwnProperty ( index ) ) continue ;
const module = modules [ index ] ;
const {
exports
} = module ;
let foundModule = null ;
if ( ! exports ) continue ;
if ( exports . _ _esModule && exports . default && filter ( exports . default ) ) foundModule = exports . default ;
if ( filter ( exports ) ) foundModule = exports ;
if ( ! foundModule ) continue ;
if ( first ) return foundModule ;
rm . push ( foundModule ) ;
}
return first || rm . length == 0 ? undefined : rm ;
}
/ * *
* Finds all modules matching a filter function .
* @ param { Function } filter A function to use to filter modules
* /
static getModules ( filter ) {
return this . getModule ( filter , false ) ;
}
/ * *
* Finds a module by its name .
* @ param { String } name The name of the module
* @ param { Function } fallback A function to use to filter modules if not finding a known module
* @ return { Any }
* /
static getModuleByName ( name , fallback ) {
if ( DiscordModules . hasOwnProperty ( name ) ) return DiscordModules [ name ] ;
if ( ! fallback ) return undefined ;
const module = this . getModule ( fallback , true ) ;
return module ? DiscordModules [ name ] = module : undefined ;
}
/ * *
* Finds a module by its display name .
* @ param { String } name The display name of the module
* @ return { Any }
* /
static getByDisplayName ( name ) {
return this . getModule ( Filters . byDisplayName ( name ) , true ) ;
}
/ * *
* Finds a module using its code .
* @ param { RegEx } regex A regular expression to use to filter modules
* @ param { Boolean } first Whether to return the only the first matching module
* @ return { Any }
* /
static getByRegex ( regex , first = true ) {
return this . getModule ( Filters . byCode ( regex ) , first ) ;
}
/ * *
* Finds a single module using properties on its prototype .
* @ param { ... string } prototypes Properties to use to filter modules
* @ return { Any }
* /
static getByPrototypes ( ... prototypes ) {
return this . getModule ( Filters . byPrototypeFields ( prototypes ) , true ) ;
}
/ * *
* Finds all modules with a set of properties of its prototype .
* @ param { ... string } prototypes Properties to use to filter modules
* @ return { Any }
* /
static getAllByPrototypes ( ... prototypes ) {
return this . getModule ( Filters . byPrototypeFields ( prototypes ) , false ) ;
}
/ * *
* Finds a single module using its own properties .
* @ param { ... string } props Properties to use to filter modules
* @ return { Any }
* /
static getByProps ( ... props ) {
return this . getModule ( Filters . byProperties ( props ) , true ) ;
}
/ * *
* Finds all modules with a set of properties .
* @ param { ... string } props Properties to use to filter modules
* @ return { Any }
* /
static getAllByProps ( ... props ) {
return this . getModule ( Filters . byProperties ( props ) , false ) ;
}
/ * *
* Finds a single module using a set of strings .
* @ param { ... String } props Strings to use to filter modules
* @ return { Any }
* /
static getByString ( ... strings ) {
return this . getModule ( Filters . byString ( ... strings ) , true ) ;
}
/ * *
* Finds all modules with a set of strings .
* @ param { ... String } strings Strings to use to filter modules
* @ return { Any }
* /
static getAllByString ( ... strings ) {
return this . getModule ( Filters . byString ( ... strings ) , false ) ;
}
/ * *
* Discord ' s _ _webpack _require _ _ function .
* /
static get require ( ) {
if ( this . _require ) return this . _require ;
const id = "bbd-webpackmodules" ;
const _ _webpack _require _ _ = typeof window . webpackJsonp == "function" ? window . webpackJsonp ( [ ] , {
[ id ] : ( module , exports , _ _webpack _require _ _ ) => exports . default = _ _webpack _require _ _
} , [ id ] ) . default : window . webpackJsonp . push ( [ [ ] , {
[ id ] : ( module , exports , _ _webpack _require _ _ ) => module . exports = _ _webpack _require _ _
} , [ [ id ] ] ] ) ;
delete _ _webpack _require _ _ . m [ id ] ;
delete _ _webpack _require _ _ . c [ id ] ;
return this . _require = _ _webpack _require _ _ ;
}
/ * *
* Returns all loaded modules .
* @ return { Array }
* /
static getAllModules ( ) {
return this . require . c ;
}
}
2019-05-29 05:48:41 +02:00
/***/ } ) ,
2019-05-30 17:44:05 +02:00
/***/ "./src/structs/builtin.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / structs / builtin . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
2019-05-30 23:18:52 +02:00
/*! exports provided: onSettingChange, default */
2019-05-30 17:44:05 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2019-05-30 23:18:52 +02:00
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "onSettingChange" , function ( ) { return onSettingChange ; } ) ;
2019-05-30 17:44:05 +02:00
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return BuiltinModule ; } ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var _modules _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../modules/utilities */ "./src/modules/utilities.js" ) ;
/* harmony import */ var _modules _emitter _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../modules/emitter */ "./src/modules/emitter.js" ) ;
2019-05-30 23:18:52 +02:00
function onSettingChange ( category , identifier , onEnable , onDisable ) {
const handler = ( cat , id , enabled ) => {
if ( category !== cat || id !== identifier ) return ;
if ( enabled ) onEnable ( ) ; else onDisable ( ) ;
} ;
_modules _emitter _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . on ( "setting-updated" , handler ) ;
return ( ) => {
_modules _emitter _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . off ( "setting-updated" , handler ) ;
} ;
}
2019-05-30 17:44:05 +02:00
class BuiltinModule {
get name ( ) {
return "Unnamed Builtin" ;
}
get category ( ) {
return "Modules" ;
}
get id ( ) {
return "None" ;
}
2019-05-30 23:18:52 +02:00
async initialize ( ) {
2019-05-30 17:44:05 +02:00
if ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ this . id ] ) await this . enable ( ) ;
2019-05-30 23:18:52 +02:00
_modules _emitter _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . on ( "setting-updated" , ( category , id , enabled ) => {
2019-05-30 17:44:05 +02:00
if ( category !== this . category || id !== this . id ) return ;
2019-05-30 23:18:52 +02:00
if ( enabled ) this . enable ( ) ; else this . disable ( ) ;
2019-05-30 17:44:05 +02:00
} ) ;
}
async enable ( ) {
this . log ( "Enabled" ) ;
await this . enabled ( ) ;
}
async disable ( ) {
this . log ( "Disabled" ) ;
await this . disabled ( ) ;
}
async enabled ( ) { }
async disabled ( ) { }
2019-05-30 23:18:52 +02:00
log ( ... message ) {
_modules _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( this . name , ... message ) ;
2019-05-30 17:44:05 +02:00
}
2019-05-30 23:18:52 +02:00
warn ( ... message ) {
_modules _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . warn ( this . name , ... message ) ;
2019-05-30 17:44:05 +02:00
}
2019-05-30 23:18:52 +02:00
error ( ... message ) {
_modules _utilities _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . err ( this . name , ... message ) ;
2019-05-30 17:44:05 +02:00
}
}
/***/ } ) ,
2019-05-29 05:48:41 +02:00
/***/ "./src/ui/customcss/detached.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / customcss / detached . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _CssEditorDetached ; } ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _settings _checkbox _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../settings/checkbox */ "./src/ui/settings/checkbox.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _CssEditorDetached extends modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . Component {
constructor ( props ) {
super ( props ) ;
this . onClick = this . onClick . bind ( this ) ;
this . updateCss = this . updateCss . bind ( this ) ;
this . saveCss = this . saveCss . bind ( this ) ;
this . onChange = this . onChange . bind ( this ) ;
}
componentDidMount ( ) {
$ ( "#app-mount" ) . addClass ( "bd-detached-editor" ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "BDV2" ] . editorDetached = true ; // this.updateLineCount();
this . editor = ace . edit ( "bd-customcss-editor-detached" ) ;
this . editor . setTheme ( "ace/theme/monokai" ) ;
this . editor . session . setMode ( "ace/mode/css" ) ;
this . editor . setShowPrintMargin ( false ) ;
this . editor . setFontSize ( 14 ) ;
this . editor . on ( "change" , ( ) => {
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "bda-css-0" ] ) return ;
this . saveCss ( ) ;
this . updateCss ( ) ;
} ) ;
}
componentWillUnmount ( ) {
$ ( "#app-mount" ) . removeClass ( "bd-detached-editor" ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "BDV2" ] . editorDetached = false ;
this . editor . destroy ( ) ;
}
updateLineCount ( ) {
const lineCount = this . refs . editor . value . split ( "\n" ) . length ;
if ( lineCount == this . props . lines ) return ;
this . refs . lines . textContent = Array . from ( new Array ( lineCount ) , ( _ , i ) => i + 1 ) . join ( ".\n" ) + "." ;
this . props . lines = lineCount ;
}
get options ( ) {
return {
lineNumbers : true ,
mode : "css" ,
indentUnit : 4 ,
theme : "material" ,
scrollbarStyle : "simple"
} ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
get css ( ) {
const _ccss = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DataStore" ] . getBDData ( "bdcustomcss" ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
let ccss = "" ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( _ccss && _ccss !== "" ) {
ccss = atob ( _ccss ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
return ccss ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
get root ( ) {
const _root = $ ( "#bd-customcss-detach-container" ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( ! _root . length ) {
if ( ! this . injectRoot ( ) ) return null ;
return this . detachedRoot ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
return _root [ 0 ] ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
injectRoot ( ) {
if ( ! $ ( ".app, .app-2rEoOp" ) . length ) return false ;
$ ( "<div/>" , {
id : "bd-customcss-detach-container"
} ) . insertAfter ( $ ( ".app, .app-2rEoOp" ) ) ;
return true ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
render ( ) {
const self = this ;
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
className : "bd-detached-css-editor" ,
id : "bd-customcss-detach-editor"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
id : "bd-customcss-innerpane"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
className : "editor-wrapper"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
id : "bd-customcss-editor-detached" ,
className : "editor" ,
ref : "editor"
} , self . css ) ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
id : "bd-customcss-attach-controls"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "ul" , {
className : "checkbox-group"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( _settings _checkbox _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , {
id : "live-update" ,
text : "Live Update" ,
onChange : self . onChange ,
checked : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "bda-css-0" ]
} ) ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
id : "bd-customcss-detach-controls-button"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "button" , {
style : {
borderRadius : "3px 0 0 3px" ,
borderRight : "1px solid #3f4146"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "update" ) ;
}
} , "Update" ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "button" , {
style : {
borderRadius : "0" ,
borderLeft : "1px solid #2d2d2d" ,
borderRight : "1px solid #2d2d2d"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "save" ) ;
}
} , "Save" ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "button" , {
style : {
borderRadius : "0 3px 3px 0" ,
borderLeft : "1px solid #3f4146"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "attach" ) ;
}
} , "Attach" ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "span" , {
style : {
fontSize : "10px" ,
marginLeft : "5px"
}
} , "Unsaved changes are lost on attach" ) ) ) ) ) ;
}
onChange ( id , checked ) {
switch ( id ) {
case "live-update" :
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "bda-css-0" ] = checked ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Core" ] . saveSettings ( ) ;
break ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
onClick ( id ) {
const self = this ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
switch ( id ) {
case "attach" :
if ( $ ( "#editor-detached" ) . length ) self . props . attach ( ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . ReactDOM . unmountComponentAtNode ( self . root ) ;
self . root . remove ( ) ;
break ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
case "update" :
self . updateCss ( ) ;
break ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
case "save" :
self . saveCss ( ) ;
break ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
updateCss ( ) {
if ( $ ( "#customcss" ) . length == 0 ) {
$ ( "head" ) . append ( "<style id=\"customcss\"></style>" ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
$ ( "#customcss" ) . text ( this . editor . session . getValue ( ) ) . detach ( ) . appendTo ( document . head ) ;
}
saveCss ( ) {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DataStore" ] . setBDData ( "bdcustomcss" , btoa ( this . editor . session . getValue ( ) ) ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/customcss/editor.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / customcss / editor . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _CssEditor ; } ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _detached _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./detached */ "./src/ui/customcss/detached.js" ) ;
/* harmony import */ var _settings _checkbox _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../settings/checkbox */ "./src/ui/settings/checkbox.js" ) ;
/* harmony import */ var _settings _title _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ../settings/title */ "./src/ui/settings/title.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _CssEditor extends modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . Component {
constructor ( props ) {
super ( props ) ;
this . props . lines = 0 ;
this . setInitialState ( ) ;
this . attach = this . attach . bind ( this ) ;
this . detachedEditor = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( _detached _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , {
attach : this . attach
} ) ;
this . onClick = this . onClick . bind ( this ) ;
this . updateCss = this . updateCss . bind ( this ) ;
this . saveCss = this . saveCss . bind ( this ) ;
this . detach = this . detach . bind ( this ) ;
}
setInitialState ( ) {
this . state = {
detached : this . props . detached || modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "BDV2" ] . editorDetached
} ;
}
componentDidMount ( ) {
// this.updateLineCount();
this . editor = ace . edit ( "bd-customcss-editor" ) ;
this . editor . setTheme ( "ace/theme/monokai" ) ;
this . editor . session . setMode ( "ace/mode/css" ) ;
this . editor . setShowPrintMargin ( false ) ;
this . editor . setFontSize ( 14 ) ;
this . editor . on ( "change" , ( ) => {
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "bda-css-0" ] ) return ;
this . saveCss ( ) ;
this . updateCss ( ) ;
} ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
componentWillUnmount ( ) {
this . editor . destroy ( ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
componentDidUpdate ( prevProps , prevState ) {
if ( prevState . detached && ! this . state . detached ) {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . ReactDOM . unmountComponentAtNode ( this . detachedRoot ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
codeMirror ( ) { }
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
get options ( ) {
return {
lineNumbers : true ,
mode : "css" ,
indentUnit : 4 ,
theme : "material" ,
scrollbarStyle : "simple"
} ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
get css ( ) {
const _ccss = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DataStore" ] . getBDData ( "bdcustomcss" ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
let ccss = "" ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( _ccss && _ccss !== "" ) {
ccss = atob ( _ccss ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
return ccss ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
updateLineCount ( ) {
const lineCount = this . refs . editor . value . split ( "\n" ) . length ;
if ( lineCount == this . props . lines ) return ;
this . refs . lines . textContent = Array . from ( new Array ( lineCount ) , ( _ , i ) => i + 1 ) . join ( ".\n" ) + "." ;
this . props . lines = lineCount ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
render ( ) {
const self = this ;
const {
detached
} = self . state ;
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
className : "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default" ,
style : {
padding : "60px 40px 0px"
}
} , detached && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
id : "editor-detached"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( _settings _title _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
text : "Custom CSS Editor"
} ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "h3" , null , "Editor Detached" ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "button" , {
className : "btn btn-primary" ,
onClick : ( ) => {
self . attach ( ) ;
}
} , "Attach" ) ) , ! detached && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , null , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( _settings _title _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
text : "Custom CSS Editor"
} ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
className : "editor-wrapper"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
id : "bd-customcss-editor" ,
className : "editor" ,
ref : "editor"
} , self . css ) ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
id : "bd-customcss-attach-controls"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "ul" , {
className : "checkbox-group"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( _settings _checkbox _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
id : "live-update" ,
text : "Live Update" ,
onChange : this . onChange ,
checked : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "bda-css-0" ]
} ) ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
id : "bd-customcss-detach-controls-button"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "button" , {
style : {
borderRadius : "3px 0 0 3px" ,
borderRight : "1px solid #3f4146"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "update" ) ;
}
} , "Update" ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "button" , {
style : {
borderRadius : "0" ,
borderLeft : "1px solid #2d2d2d" ,
borderRight : "1px solid #2d2d2d"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "save" ) ;
}
} , "Save" ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "button" , {
style : {
borderRadius : "0 3px 3px 0" ,
borderLeft : "1px solid #3f4146"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "detach" ) ;
}
} , "Detach" ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "span" , {
style : {
fontSize : "10px" ,
marginLeft : "5px"
}
} , "Unsaved changes are lost on detach" ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
className : "help-text"
} , "Press " , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "code" , {
className : "inline"
} , "ctrl" ) , "+" , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "span" , {
className : "inline"
} , "," ) , " with the editor focused to access the editor's settings." ) ) ) ) ) ;
}
onClick ( arg ) {
switch ( arg ) {
case "update" :
this . updateCss ( ) ;
break ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
case "save" :
this . saveCss ( ) ;
break ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
case "detach" :
this . detach ( ) ;
break ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
onChange ( id , checked ) {
switch ( id ) {
case "live-update" :
data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "bda-css-0" ] = checked ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Core" ] . saveSettings ( ) ;
break ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
updateCss ( ) {
if ( $ ( "#customcss" ) . length == 0 ) {
$ ( "head" ) . append ( "<style id=\"customcss\"></style>" ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
$ ( "#customcss" ) . text ( this . editor . session . getValue ( ) ) . detach ( ) . appendTo ( document . head ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
saveCss ( ) {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DataStore" ] . setBDData ( "bdcustomcss" , btoa ( this . editor . session . getValue ( ) ) ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
detach ( ) {
this . setState ( {
detached : true
} ) ;
const droot = this . detachedRoot ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( ! droot ) {
console . log ( "FAILED TO INJECT ROOT: .app" ) ;
return ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . ReactDOM . render ( this . detachedEditor , droot ) ;
}
get detachedRoot ( ) {
const _root = $ ( "#bd-customcss-detach-container" ) ;
if ( ! _root . length ) {
if ( ! this . injectDetachedRoot ( ) ) return null ;
return this . detachedRoot ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
return _root [ 0 ] ;
}
injectDetachedRoot ( ) {
if ( ! $ ( ".app, .app-2rEoOp" ) . length ) return false ;
$ ( "<div/>" , {
id : "bd-customcss-detach-container"
} ) . insertAfter ( $ ( ".app, .app-2rEoOp" ) ) ;
return true ;
}
attach ( ) {
this . setState ( {
detached : false
} ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/emote.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / emote . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return BDEmote ; } ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class BDEmote extends modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . Component {
constructor ( props ) {
super ( props ) ;
const isFav = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "EmoteMenu" ] && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "EmoteMenu" ] . favoriteEmotes && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "EmoteMenu" ] . favoriteEmotes [ this . label ] ? true : false ;
this . state = {
shouldAnimate : ! this . animateOnHover ,
isFavorite : isFav
} ;
this . onMouseEnter = this . onMouseEnter . bind ( this ) ;
this . onMouseLeave = this . onMouseLeave . bind ( this ) ;
this . onClick = this . onClick . bind ( this ) ;
}
get animateOnHover ( ) {
return data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-es-2" ] ;
}
get label ( ) {
return this . props . modifier ? ` ${ this . props . name } : ${ this . props . modifier } ` : this . props . name ;
}
get modifierClass ( ) {
return this . props . modifier ? ` emote ${ this . props . modifier } ` : "" ;
}
onMouseEnter ( ) {
if ( ! this . state . shouldAnimate && this . animateOnHover ) this . setState ( {
shouldAnimate : true
} ) ;
if ( ! this . state . isFavorite && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "EmoteMenu" ] . favoriteEmotes [ this . label ] ) this . setState ( {
isFavorite : true
} ) ; else if ( this . state . isFavorite && ! modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "EmoteMenu" ] . favoriteEmotes [ this . label ] ) this . setState ( {
isFavorite : false
} ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
onMouseLeave ( ) {
if ( this . state . shouldAnimate && this . animateOnHover ) this . setState ( {
shouldAnimate : false
} ) ;
}
onClick ( e ) {
if ( this . props . onClick ) this . props . onClick ( e ) ;
}
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "BDV2" ] . TooltipWrapper , {
color : "black" ,
position : "top" ,
text : this . label ,
delay : 750
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "div" , {
className : "emotewrapper" + ( this . props . jumboable ? " jumboable" : "" ) ,
onMouseEnter : this . onMouseEnter ,
onMouseLeave : this . onMouseLeave ,
onClick : this . onClick
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "img" , {
draggable : false ,
className : "emote" + this . modifierClass + ( this . props . jumboable ? " jumboable" : "" ) + ( ! this . state . shouldAnimate ? " stop-animation" : "" ) ,
dataModifier : this . props . modifier ,
alt : this . label ,
src : this . props . url
} ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "DiscordModules" ] . React . createElement ( "input" , {
className : "fav" + ( this . state . isFavorite ? " active" : "" ) ,
title : "Favorite!" ,
type : "button" ,
onClick : e => {
e . preventDefault ( ) ;
e . stopPropagation ( ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( this . state . isFavorite ) {
delete modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "EmoteMenu" ] . favoriteEmotes [ this . label ] ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "EmoteMenu" ] . updateFavorites ( ) ;
} else {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "EmoteMenu" ] . favorite ( this . label , this . props . url ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
this . setState ( {
isFavorite : ! this . state . isFavorite
} ) ;
}
} ) ) ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
/***/ } ) ,
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
/***/ "./src/ui/icons/bdlogo.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / icons / bdlogo . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return BDLogo ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
class BDLogo extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "svg" , {
height : "100%" ,
width : this . props . size || "16px" ,
className : "bd-logo " + this . props . className ,
style : {
fillRule : "evenodd" ,
clipRule : "evenodd" ,
strokeLinecap : "round" ,
strokeLinejoin : "round"
} ,
viewBox : "0 0 2000 2000"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "metadata" , null ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "defs" , null , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "filter" , {
id : "shadow1"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "feDropShadow" , {
"dx" : "20" ,
"dy" : "0" ,
"stdDeviation" : "20" ,
"flood-color" : "rgba(0,0,0,0.35)"
} ) ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "filter" , {
id : "shadow2"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "feDropShadow" , {
"dx" : "15" ,
"dy" : "0" ,
"stdDeviation" : "20" ,
"flood-color" : "rgba(255,255,255,0.15)"
} ) ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "filter" , {
id : "shadow3"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "feDropShadow" , {
"dx" : "10" ,
"dy" : "0" ,
"stdDeviation" : "20" ,
"flood-color" : "rgba(0,0,0,0.35)"
} ) ) ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "g" , null , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "path" , {
style : {
filter : "url(#shadow3)"
} ,
d : "M1195.44+135.442L1195.44+135.442L997.6+136.442C1024.2+149.742+1170.34+163.542+1193.64+179.742C1264.34+228.842+1319.74+291.242+1358.24+365.042C1398.14+441.642+1419.74+530.642+1422.54+629.642L1422.54+630.842L1422.54+632.042C1422.54+773.142+1422.54+1228.14+1422.54+1369.14L1422.54+1370.34L1422.54+1371.54C1419.84+1470.54+1398.24+1559.54+1358.24+1636.14C1319.74+1709.94+1264.44+1772.34+1193.64+1821.44C1171.04+1837.14+1025.7+1850.54+1000+1863.54L1193.54+1864.54C1539.74+1866.44+1864.54+1693.34+1864.54+1296.64L1864.54+716.942C1866.44+312.442+1541.64+135.442+1195.44+135.442Z" ,
fill : "#171717" ,
opacity : "1"
} ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "path" , {
style : {
filter : "url(#shadow2)"
} ,
d : "M1695.54+631.442C1685.84+278.042+1409.34+135.442+1052.94+135.442L361.74+136.442L803.74+490.442L1060.74+490.442C1335.24+490.442+1335.24+835.342+1060.74+835.342L1060.74+1164.84C1150.22+1164.84+1210.53+1201.48+1241.68+1250.87C1306.07+1353+1245.76+1509.64+1060.74+1509.64L361.74+1863.54L1052.94+1864.54C1409.24+1864.54+1685.74+1721.94+1695.54+1368.54C1695.54+1205.94+1651.04+1084.44+1572.64+999.942C1651.04+915.542+1695.54+794.042+1695.54+631.442Z" ,
fill : "#3E82E5" ,
opacity : "1"
} ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "path" , {
style : {
filter : "url(#shadow1)"
} ,
d : "M1469.25+631.442C1459.55+278.042+1183.05+135.442+826.65+135.442L135.45+135.442L135.45+1004C135.45+1004+135.427+1255.21+355.626+1255.21C575.825+1255.21+575.848+1004+575.848+1004L577.45+490.442L834.45+490.442C1108.95+490.442+1108.95+835.342+834.45+835.342L664.65+835.342L664.65+1164.84L834.45+1164.84C923.932+1164.84+984.244+1201.48+1015.39+1250.87C1079.78+1353+1019.47+1509.64+834.45+1509.64L135.45+1509.64L135.45+1864.54L826.65+1864.54C1182.95+1864.54+1459.45+1721.94+1469.25+1368.54C1469.25+1205.94+1424.75+1084.44+1346.35+999.942C1424.75+915.542+1469.25+794.042+1469.25+631.442Z" ,
fill : "#FFFFFF" ,
opacity : "1"
} ) ) ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/icons/close.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / icons / close . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _XSvg ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _XSvg extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "svg" , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 12 12" ,
style : {
width : "18px" ,
height : "18px"
}
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "g" , {
className : "background" ,
fill : "none" ,
fillRule : "evenodd"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "path" , {
d : "M0 0h12v12H0"
} ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "path" , {
className : "fill" ,
fill : "#dcddde" ,
d : "M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"
} ) ) ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/icons/reload.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / icons / reload . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _ReloadIcon ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _ReloadIcon extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "svg" , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24" ,
fill : "#dcddde" ,
className : "bd-reload " + this . props . className ,
onClick : this . props . onClick ,
style : {
width : this . props . size || "24px" ,
height : this . props . size || "24px"
}
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "path" , {
d : "M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"
} ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "path" , {
fill : "none" ,
d : "M0 0h24v24H0z"
} ) ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/layer.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / layer . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _Layer ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _Layer extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
componentDidMount ( ) {
$ ( window ) . on ( ` keyup. ${ this . props . id } ` , e => {
if ( e . which === 27 ) {
modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ReactDOM" ] . unmountComponentAtNode ( this . refs . root . parentNode ) ;
}
} ) ;
$ ( ` # ${ this . props . id } ` ) . animate ( {
opacity : 1
} , {
step : function ( now ) {
$ ( this ) . css ( "transform" , ` scale( ${ 1.1 - 0.1 * now } ) translateZ(0px) ` ) ;
} ,
duration : 200 ,
done : ( ) => {
$ ( ` # ${ this . props . id } ` ) . css ( "opacity" , "" ) . css ( "transform" , "" ) ;
}
} ) ;
}
componentWillUnmount ( ) {
$ ( window ) . off ( ` keyup. ${ this . props . id } ` ) ;
$ ( ` # ${ this . props . id } ` ) . animate ( {
opacity : 0
} , {
step : function ( now ) {
$ ( this ) . css ( "transform" , ` scale( ${ 1.1 - 0.1 * now } ) translateZ(0px) ` ) ;
} ,
duration : 200 ,
done : ( ) => {
$ ( ` # ${ this . props . rootId } ` ) . remove ( ) ;
}
} ) ;
$ ( "[class*=\"layer-\"]" ) . removeClass ( "publicServersOpen" ) . animate ( {
opacity : 1
} , {
step : function ( now ) {
$ ( this ) . css ( "transform" , ` scale( ${ 0.07 * now + 0.93 } ) translateZ(0px) ` ) ;
} ,
duration : 200 ,
done : ( ) => {
$ ( "[class*=\"layer-\"]" ) . css ( "opacity" , "" ) . css ( "transform" , "" ) ;
}
} ) ;
}
componentWillMount ( ) {
$ ( "[class*=\"layer-\"]" ) . addClass ( "publicServersOpen" ) . animate ( {
opacity : 0
} , {
step : function ( now ) {
$ ( this ) . css ( "transform" , ` scale( ${ 0.07 * now + 0.93 } ) translateZ(0px) ` ) ;
} ,
duration : 200
} ) ;
}
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "layer bd-layer layer-3QrUeG" ,
id : this . props . id ,
ref : "root" ,
style : {
opacity : 0 ,
transform : "scale(1.1) translateZ(0px)"
}
} , this . props . children ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
2019-05-30 07:06:17 +02:00
/***/ "./src/ui/list.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / list . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * /
2019-05-29 05:48:41 +02:00
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _List ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _List extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "ul" , {
className : this . props . className
} , this . props . children ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/publicservers/card.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / publicservers / card . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _ServerCard ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _ServerCard extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
if ( ! this . props . server . iconUrl ) this . props . server . iconUrl = this . props . fallback ;
this . state = {
imageError : false ,
joined : this . props . guildList . includes ( this . props . server . identifier )
} ;
}
render ( ) {
const {
server
} = this . props ;
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , // cardPrimary-1Hv-to
{
className : ` card-3Qj_Yx cardPrimary-1Hv-to marginBottom8-AtZOdT bd-server-card ${ server . pinned ? " bd-server-card-pinned" : "" } `
} , // React.createElement(
// "div",
// { className: "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY flex-1O1GKY directionRow-3v3tfG justifyStart-2yIZo0 alignStretch-1hwxMa noWrap-3jynv6" },
modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "img" , {
ref : "img" ,
className : "bd-server-image" ,
src : server . iconUrl ,
onError : this . handleError . bind ( this )
} ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "flexChild-faoVW3 bd-server-content"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-header"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "h5" , {
className : "h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"
} , server . name ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "h5" , {
className : "h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"
} , server . members , " Members" ) ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "scroller-2FKFPG scroller bd-server-description"
} , server . description ) ) ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "flexChild-faoVW3 bd-server-tags" ,
style : {
flex : "1 1 auto"
}
} , server . categories . join ( ", " ) ) , this . state . joined && modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "button" , {
type : "button" ,
className : "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN colorGreen-29iAKY" ,
style : {
minHeight : "12px" ,
marginTop : "4px" ,
backgroundColor : "#3ac15c"
}
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-button-contents"
} , "Joined" ) ) , server . error && modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "button" , {
type : "button" ,
className : "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN disabled-9aF2ug" ,
style : {
minHeight : "12px" ,
marginTop : "4px" ,
backgroundColor : "#c13a3a"
}
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-button-contents"
} , "Error" ) ) , ! server . error && ! this . state . joined && modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "button" , {
type : "button" ,
className : "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN" ,
style : {
minHeight : "12px" ,
marginTop : "4px"
} ,
onClick : ( ) => {
this . join ( ) ;
}
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-button-contents"
} , "Join" ) ) ) ) // )
) ;
}
handleError ( ) {
this . props . server . iconUrl = this . props . fallback ;
this . setState ( {
imageError : true
} ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
join ( ) {
this . props . join ( this ) ; //this.setState({joined: true});
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/publicservers/menu.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / publicservers / menu . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _PublicServers ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _sidebarview _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../sidebarview */ "./src/ui/sidebarview.js" ) ;
/* harmony import */ var _settings _exitbutton _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../settings/exitbutton */ "./src/ui/settings/exitbutton.js" ) ;
/* harmony import */ var _settings _tabbar _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../settings/tabbar */ "./src/ui/settings/tabbar.js" ) ;
/* harmony import */ var _settings _title _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ../settings/title */ "./src/ui/settings/title.js" ) ;
/* harmony import */ var _card _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./card */ "./src/ui/publicservers/card.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _PublicServers extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
this . setInitialState ( ) ;
this . close = this . close . bind ( this ) ;
this . changeCategory = this . changeCategory . bind ( this ) ;
this . search = this . search . bind ( this ) ;
this . searchKeyDown = this . searchKeyDown . bind ( this ) ;
this . checkConnection = this . checkConnection . bind ( this ) ;
this . join = this . join . bind ( this ) ;
this . connect = this . connect . bind ( this ) ;
this . GuildStore = modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "WebpackModules" ] . getByProps ( "getGuilds" ) ;
this . AvatarDefaults = modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "WebpackModules" ] . getByProps ( "getUserAvatarURL" , "DEFAULT_AVATARS" ) ;
this . InviteActions = modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "WebpackModules" ] . getByProps ( "acceptInvite" ) ;
this . SortedGuildStore = modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "WebpackModules" ] . getByProps ( "getSortedGuilds" ) ;
}
componentDidMount ( ) {
this . checkConnection ( ) ;
}
setInitialState ( ) {
this . state = {
selectedCategory : - 1 ,
title : "Loading..." ,
loading : true ,
servers : [ ] ,
next : null ,
connection : {
state : 0 ,
user : null
}
} ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
close ( ) {
modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ReactDOM" ] . unmountComponentAtNode ( document . getElementById ( this . props . rootId ) ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
search ( query , clear ) {
const self = this ;
$ . ajax ( {
method : "GET" ,
url : ` ${ self . endPoint } ${ query } ${ query ? "&schema=new" : "?schema=new" } ` ,
success : data => {
let servers = data . results . reduce ( ( arr , server ) => {
server . joined = false ;
arr . push ( server ) ; // arr.push(<ServerCard server={server} join={self.join}/>);
return arr ;
} , [ ] ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( ! clear ) {
servers = self . state . servers . concat ( servers ) ;
} else { //servers.unshift(self.bdServer);
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
let end = data . size + data . from ;
data . next = ` ?from= ${ end } ` ;
if ( self . state . term ) data . next += ` &term= ${ self . state . term } ` ;
if ( self . state . selectedCategory ) data . next += ` &category= ${ self . categoryButtons [ self . state . selectedCategory ] } ` ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( end >= data . total ) {
end = data . total ;
data . next = null ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
let title = ` Showing 1- ${ end } of ${ data . total } results in ${ self . categoryButtons [ self . state . selectedCategory ] } ` ;
if ( self . state . term ) title += ` for ${ self . state . term } ` ;
self . setState ( {
loading : false ,
title : title ,
servers : servers ,
next : data . next
2019-05-29 05:48:41 +02:00
} ) ;
2019-05-30 07:06:17 +02:00
if ( clear ) {
//console.log(self);
self . refs . sbv . refs . contentScroller . scrollTop = 0 ;
}
} ,
error : ( ) => {
self . setState ( {
loading : false ,
title : "Failed to load servers. Check console for details"
2019-05-29 05:48:41 +02:00
} ) ;
2019-05-30 07:06:17 +02:00
}
} ) ;
}
join ( serverCard ) {
if ( serverCard . props . pinned ) return this . InviteActions . acceptInvite ( serverCard . props . invite _code ) ;
$ . ajax ( {
method : "GET" ,
url : ` ${ this . joinEndPoint } / ${ serverCard . props . server . identifier } ` ,
headers : {
"Accept" : "application/json;" ,
"Content-Type" : "application/json;" ,
"x-discord-token" : this . state . connection . user . accessToken
} ,
crossDomain : true ,
xhrFields : {
withCredentials : true
} ,
success : ( ) => {
serverCard . setState ( {
joined : true
2019-05-29 05:48:41 +02:00
} ) ;
2019-05-30 07:06:17 +02:00
}
} ) ;
}
connect ( ) {
const options = this . windowOptions ;
options . x = Math . round ( window . screenX + window . innerWidth / 2 - options . width / 2 ) ;
options . y = Math . round ( window . screenY + window . innerHeight / 2 - options . height / 2 ) ;
this . joinWindow = new ( window . require ( "electron" ) . remote . BrowserWindow ) ( options ) ;
const url = "https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=https://auth.discordservers.com/info" ;
this . joinWindow . webContents . on ( "did-navigate" , ( event , url ) => {
if ( url != "https://auth.discordservers.com/info" ) return ;
this . joinWindow . close ( ) ;
this . checkConnection ( ) ;
} ) ;
this . joinWindow . loadURL ( url ) ;
}
get windowOptions ( ) {
return {
width : 500 ,
height : 550 ,
backgroundColor : "#282b30" ,
show : true ,
resizable : false ,
maximizable : false ,
minimizable : false ,
alwaysOnTop : true ,
frame : false ,
center : false ,
webPreferences : {
nodeIntegration : false
}
} ;
}
get bdServer ( ) {
const server = {
name : "BetterDiscord" ,
online : "7500+" ,
members : "20000+" ,
categories : [ "community" , "programming" , "support" ] ,
description : "Official BetterDiscord server for support etc" ,
identifier : "86004744966914048" ,
iconUrl : "https://cdn.discordapp.com/icons/86004744966914048/292e7f6bfff2b71dfd13e508a859aedd.webp" ,
nativejoin : true ,
invite _code : "0Tmfo5ZbORCRqbAd" ,
pinned : true
} ;
const guildList = this . SortedGuildStore . guildPositions ;
const defaultList = this . AvatarDefaults . DEFAULT _AVATARS ;
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _card _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] , {
server : server ,
pinned : true ,
join : this . join ,
guildList : guildList ,
fallback : defaultList [ Math . floor ( Math . random ( ) * 5 ) ]
} ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
get endPoint ( ) {
return "https://search.discordservers.com" ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
get joinEndPoint ( ) {
return "https://j.discordservers.com" ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
get connectEndPoint ( ) {
return "https://join.discordservers.com/connect" ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
checkConnection ( ) {
const self = this ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
try {
$ . ajax ( {
method : "GET" ,
url : ` https://auth.discordservers.com/info ` ,
headers : {
"Accept" : "application/json;" ,
"Content-Type" : "application/json;"
} ,
crossDomain : true ,
xhrFields : {
withCredentials : true
} ,
success : data => {
// Utils.log("PublicServer", "Got data: " + JSON.stringify(data));
self . setState ( {
selectedCategory : 0 ,
connection : {
state : 2 ,
user : data
}
} ) ;
self . search ( "" , true ) ;
} ,
error : ( ) => {
self . setState ( {
title : "Not connected to discordservers.com!" ,
loading : true ,
selectedCategory : - 1 ,
connection : {
state : 1 ,
user : null
}
} ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
} ) ;
} catch ( error ) {
self . setState ( {
title : "Not connected to discordservers.com!" ,
loading : true ,
selectedCategory : - 1 ,
connection : {
state : 1 ,
user : null
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
} ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _sidebarview _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , {
ref : "sbv" ,
children : this . component
} ) ;
}
get component ( ) {
return {
sidebar : {
component : this . sidebar
} ,
content : {
component : this . content
} ,
tools : {
component : modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _settings _exitbutton _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , {
key : "pt" ,
ref : "tools" ,
onClick : this . close
} )
}
} ;
}
get sidebar ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "sidebar" ,
key : "ps"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-tab-bar SIDE"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-tab-bar-header" ,
style : {
fontSize : "16px"
}
} , "Public Servers" ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _settings _tabbar _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . Separator , null ) , this . searchInput , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _settings _tabbar _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . Separator , null ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _settings _tabbar _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . Header , {
text : "Categories"
} ) , this . categoryButtons . map ( ( value , index ) => {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _settings _tabbar _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . Item , {
id : index ,
onClick : this . changeCategory ,
key : index ,
text : value ,
selected : this . state . selectedCategory === index
} ) ;
} ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _settings _tabbar _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . Separator , null ) , this . footer , this . connection ) ) ;
}
get searchInput ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-form-item"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-text-input flex-vertical" ,
style : {
width : "172px" ,
marginLeft : "10px"
}
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "input" , {
ref : "searchinput" ,
onKeyDown : this . searchKeyDown ,
onChange : ( ) => { } ,
type : "text" ,
className : "input default" ,
placeholder : "Search..." ,
maxLength : "50"
} ) ) ) ;
}
searchKeyDown ( e ) {
const self = this ;
if ( self . state . loading || e . which !== 13 ) return ;
self . setState ( {
loading : true ,
title : "Loading..." ,
term : e . target . value
} ) ;
let query = ` ?term= ${ e . target . value } ` ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( self . state . selectedCategory !== 0 ) {
query += ` &category= ${ self . categoryButtons [ self . state . selectedCategory ] } ` ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
self . search ( query , true ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
get categoryButtons ( ) {
return [ "All" , "FPS Games" , "MMO Games" , "Strategy Games" , "MOBA Games" , "RPG Games" , "Tabletop Games" , "Sandbox Games" , "Simulation Games" , "Music" , "Community" , "Language" , "Programming" , "Other" ] ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
changeCategory ( id ) {
const self = this ;
if ( self . state . loading ) return ;
self . refs . searchinput . value = "" ;
self . setState ( {
loading : true ,
selectedCategory : id ,
title : "Loading..." ,
term : null
} ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( id === 0 ) {
self . search ( "" , true ) ;
return ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
self . search ( ` ?category= ${ self . categoryButtons [ id ] } ` , true ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
get content ( ) {
const self = this ;
const guildList = this . SortedGuildStore . guildPositions ;
const defaultList = this . AvatarDefaults . DEFAULT _AVATARS ;
if ( self . state . connection . state === 1 ) return self . notConnected ;
return [ modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
ref : "content" ,
key : "pc" ,
className : "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _settings _title _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
text : self . state . title
} ) , self . bdServer , self . state . servers . map ( server => {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _card _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] , {
key : server . identifier ,
server : server ,
join : self . join ,
guildList : guildList ,
fallback : defaultList [ Math . floor ( Math . random ( ) * 5 ) ]
} ) ;
} ) , self . state . next && modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "button" , {
type : "button" ,
onClick : ( ) => {
if ( self . state . loading ) return ;
self . setState ( {
loading : true
} ) ;
self . search ( self . state . next , false ) ;
} ,
className : "ui-button filled brand small grow" ,
style : {
width : "100%" ,
marginTop : "10px" ,
marginBottom : "10px"
}
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-button-contents"
} , self . state . loading ? "Loading" : "Load More" ) ) , self . state . servers . length > 0 && modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _settings _title _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
text : self . state . title
} ) ) ] ;
}
get notConnected ( ) {
const self = this ; //return React.createElement(SettingsTitle, { text: self.state.title });
return [ modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
key : "ncc" ,
ref : "content" ,
className : "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "h2" , {
className : "ui-form-title h2 margin-reset margin-bottom-20"
} , "Not connected to discordservers.com!" , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "button" , {
onClick : self . connect ,
type : "button" ,
className : "ui-button filled brand small grow" ,
style : {
display : "inline-block" ,
minHeight : "18px" ,
marginLeft : "10px" ,
lineHeight : "14px"
}
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-button-contents"
} , "Connect" ) ) ) , self . bdServer ) ] ;
}
get footer ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-tab-bar-header"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "a" , {
href : "https://discordservers.com" ,
target : "_blank"
} , "Discordservers.com" ) ) ;
}
get connection ( ) {
const self = this ;
const {
connection
} = self . state ;
if ( connection . state !== 2 ) return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "span" , null ) ;
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "span" , null , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _settings _tabbar _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . Separator , null ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "span" , {
style : {
color : "#b9bbbe" ,
fontSize : "10px" ,
marginLeft : "10px"
}
} , "Connected as: " , ` ${ connection . user . username } # ${ connection . user . discriminator } ` ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
style : {
padding : "5px 10px 0 10px"
}
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "button" , {
style : {
width : "100%" ,
minHeight : "20px"
} ,
type : "button" ,
className : "ui-button filled brand small grow"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-button-contents" ,
onClick : self . connect
} , "Reconnect" ) ) ) ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/publicservers/publicservers.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / publicservers / publicservers . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: Menu, Card, Layer */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _menu _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./menu */ "./src/ui/publicservers/menu.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Menu" , function ( ) { return _menu _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _card _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./card */ "./src/ui/publicservers/card.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Card" , function ( ) { return _card _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _layer _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../layer */ "./src/ui/layer.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Layer" , function ( ) { return _layer _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] ; } ) ;
/***/ } ) ,
/***/ "./src/ui/scroller.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / scroller . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _Scroller ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _Scroller extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
render ( ) {
//scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y
let wrapperClass = ` scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d ${ this . props . fade ? " scrollerFade-1Ijw5y" : "" } ` ;
let scrollerClass = "scroller-2FKFPG scroller" ;
/* fuck */
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( this . props . sidebar ) scrollerClass = "scroller-2FKFPG firefoxFixScrollFlex-cnI2ix sidebarRegionScroller-3MXcoP sidebar-region-scroller scroller" ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( this . props . contentColumn ) {
scrollerClass = "scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller" ;
/* fuck */
wrapperClass = "scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv" ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
const {
children
} = this . props ;
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
key : "scrollerwrap" ,
className : wrapperClass
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
key : "scroller" ,
ref : "scroller" ,
className : scrollerClass
} , children ) ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/checkbox.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / checkbox . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _Checkbox ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _Checkbox extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
this . onClick = this . onClick . bind ( this ) ;
this . setInitialState ( ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
setInitialState ( ) {
this . state = {
checked : this . props . checked || false
} ;
}
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "li" , null , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "checkbox checkbox-3kaeSU da-checkbox checkbox-3EVISJ da-checkbox" ,
onClick : this . onClick
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "checkbox-inner checkboxInner-3yjcPe da-checkboxInner"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "input" , {
className : "checkboxElement-1qV33p da-checkboxElement" ,
checked : this . state . checked ,
onChange : ( ) => { } ,
type : "checkbox"
} ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "span" , null ) ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "span" , null , this . props . text ) ) ) ;
}
onClick ( ) {
this . props . onChange ( this . props . id , ! this . state . checked ) ;
this . setState ( {
checked : ! this . state . checked
} ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/contentcolumn.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / contentcolumn . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _ContentColumn ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _ContentColumn extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "h2" , {
className : "ui-form-title h2 margin-reset margin-bottom-20"
} , this . props . title ) , this . props . children ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/exitbutton.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / exitbutton . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _Tools ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _icons _close _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../icons/close */ "./src/ui/icons/close.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _Tools extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
this . onClick = this . onClick . bind ( this ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "tools-container toolsContainer-1edPuj"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "tools tools-3-3s-N"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "container-1sFeqf"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "btn-close closeButton-1tv5uR" ,
onClick : this . onClick
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _icons _close _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , null ) ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "esc-text keybind-KpFkfr"
} , "ESC" ) ) ) ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
onClick ( ) {
if ( this . props . onClick ) {
this . props . onClick ( ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
$ ( ".closeButton-1tv5uR" ) . first ( ) . click ( ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/panel.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / panel . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _SettingsPanel ; } ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _title _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./title */ "./src/ui/settings/title.js" ) ;
/* harmony import */ var _switch _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./switch */ "./src/ui/settings/switch.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _SettingsPanel extends modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
const {
settings
} = this . props ;
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _title _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , {
text : this . props . title
} ) , this . props . button && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "button" , {
key : "title-button" ,
className : "bd-pfbtn" ,
onClick : this . props . button . onClick
} , this . props . button . title ) , settings . map ( setting => {
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _switch _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
id : setting . id ,
key : setting . id ,
data : setting ,
checked : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ setting . id ] ,
onChange : ( id , checked ) => {
this . props . onChange ( id , checked ) ;
}
} ) ;
} ) ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/plugincard.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / plugincard . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _PluginCard ; } ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _icons _close _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../icons/close */ "./src/ui/icons/close.js" ) ;
/* harmony import */ var _icons _reload _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../icons/reload */ "./src/ui/icons/reload.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _PluginCard extends modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
this . onChange = this . onChange . bind ( this ) ;
this . showSettings = this . showSettings . bind ( this ) ;
this . setInitialState ( ) ;
this . hasSettings = typeof this . props . plugin . getSettingsPanel === "function" ;
this . settingsPanel = "" ;
this . reload = this . reload . bind ( this ) ;
this . onReload = this . onReload . bind ( this ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
setInitialState ( ) {
this . state = {
checked : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "PluginCookie" ] [ this . props . plugin . getName ( ) ] ,
settings : false ,
reloads : 0
} ;
} // componentDidMount() {
// BDEvents.on("plugin-reloaded", this.onReload);
// }
// componentWillUnmount() {
// BDEvents.off("plugin-reloaded", this.onReload);
// }
onReload ( pluginName ) {
if ( pluginName !== this . props . plugin . getName ( ) ) return ;
this . setState ( {
reloads : this . state . reloads + 1
} ) ;
}
componentDidUpdate ( ) {
if ( this . state . settings ) {
if ( typeof this . settingsPanel === "object" ) {
this . refs . settingspanel . appendChild ( this . settingsPanel ) ;
}
if ( ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-3" ] ) return ;
const isHidden = ( container , element ) => {
const cTop = container . scrollTop ;
const cBottom = cTop + container . clientHeight ;
const eTop = element . offsetTop ;
const eBottom = eTop + element . clientHeight ;
return eTop < cTop || eBottom > cBottom ;
} ;
const self = $ ( modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ReactDOM" ] . findDOMNode ( this ) ) ;
const container = self . parents ( ".scroller" ) ;
if ( ! isHidden ( container [ 0 ] , self [ 0 ] ) ) return ;
container . animate ( {
scrollTop : self . offset ( ) . top - container . offset ( ) . top + container . scrollTop ( ) - 30
} , 300 ) ;
}
}
reload ( ) {
const plugin = this . props . plugin . getName ( ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "PluginManager" ] . reloadPlugin ( plugin ) ;
this . props . plugin = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ plugin ] . plugin ;
this . onReload ( this . props . plugin . getName ( ) ) ;
}
getString ( value ) {
return typeof value == "string" ? value : value . toString ( ) ;
}
render ( ) {
const self = this ;
const {
plugin
} = this . props ;
const name = this . getString ( plugin . getName ( ) ) ;
const author = this . getString ( plugin . getAuthor ( ) ) ;
const description = this . getString ( plugin . getDescription ( ) ) ;
const version = this . getString ( plugin . getVersion ( ) ) ;
const website = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ name ] . website ;
const source = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ name ] . source ;
if ( this . state . settings ) {
try {
self . settingsPanel = plugin . getSettingsPanel ( ) ;
} catch ( err ) {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Utilities" ] . err ( "Plugins" , "Unable to get settings panel for " + plugin . getName ( ) + "." , err ) ;
}
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "li" , {
className : "settings-open ui-switch-item"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
style : {
"float" : "right" ,
"cursor" : "pointer"
} ,
onClick : ( ) => {
this . refs . settingspanel . innerHTML = "" ;
self . setState ( {
settings : false
} ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _icons _close _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , null ) ) , typeof self . settingsPanel === "object" && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
id : ` plugin-settings- ${ name } ` ,
className : "plugin-settings" ,
ref : "settingspanel"
} ) , typeof self . settingsPanel !== "object" && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
id : ` plugin-settings- ${ name } ` ,
className : "plugin-settings" ,
ref : "settingspanel" ,
dangerouslySetInnerHTML : {
_ _html : self . settingsPanel
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
} ) ) ;
}
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "li" , {
"data-name" : name ,
"data-version" : version ,
"className" : "settings-closed ui-switch-item"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : "bda-header"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "span" , {
className : "bda-header-title"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "span" , {
className : "bda-name"
} , name ) , " v" , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "span" , {
className : "bda-version"
} , version ) , " by " , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "span" , {
className : "bda-author"
} , author ) ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : "bda-controls"
} , ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-5" ] && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _icons _reload _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
className : "bd-reload-card" ,
onClick : this . reload
} ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "label" , {
className : "ui-switch-wrapper ui-flex-child" ,
style : {
flex : "0 0 auto"
}
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "input" , {
checked : this . state . checked ,
onChange : this . onChange ,
className : "ui-switch-checkbox" ,
type : "checkbox"
} ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : this . state . checked ? "ui-switch checked" : "ui-switch"
} ) ) ) ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : "bda-description-wrap scroller-wrap fade"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : "bda-description scroller"
} , description ) ) , ( website || source || this . hasSettings ) && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : "bda-footer"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "span" , {
className : "bda-links"
} , website && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "a" , {
className : "bda-link bda-link-website" ,
href : website ,
target : "_blank"
} , "Website" ) , website && source && " | " , source && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "a" , {
className : "bda-link bda-link-source" ,
href : source ,
target : "_blank"
} , "Source" ) ) , this . hasSettings && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "button" , {
onClick : this . showSettings ,
className : "bda-settings-button" ,
disabled : ! this . state . checked
} , "Settings" ) ) ) ;
}
onChange ( ) {
this . setState ( {
checked : ! this . state . checked
} ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "PluginManager" ] . togglePlugin ( this . props . plugin . getName ( ) ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
showSettings ( ) {
if ( ! this . hasSettings ) return ;
this . setState ( {
settings : true
} ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/sectionedsettings.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / sectionedsettings . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _SectionedSettingsPanel ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _settingsgroup _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./settingsgroup */ "./src/ui/settings/settingsgroup.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _SectionedSettingsPanel extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"
} , this . props . sections . map ( section => {
2019-05-30 17:44:05 +02:00
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _settingsgroup _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , Object . assign ( { } , section , {
onChange : this . props . onChange
} ) ) ;
2019-05-30 07:06:17 +02:00
} ) ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/settings.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / settings . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2 _SettingsPanel ; } ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _sidebar _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./sidebar */ "./src/ui/settings/sidebar.js" ) ;
/* harmony import */ var _scroller _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../scroller */ "./src/ui/scroller.js" ) ;
2019-05-30 07:06:17 +02:00
/* harmony import */ var _list _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ../list */ "./src/ui/list.jsx" ) ;
2019-05-29 05:48:41 +02:00
/* harmony import */ var _contentcolumn _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./contentcolumn */ "./src/ui/settings/contentcolumn.js" ) ;
/* harmony import */ var _sectionedsettings _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./sectionedsettings */ "./src/ui/settings/sectionedsettings.js" ) ;
/* harmony import */ var _exitbutton _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./exitbutton */ "./src/ui/settings/exitbutton.js" ) ;
/* harmony import */ var _panel _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./panel */ "./src/ui/settings/panel.js" ) ;
/* harmony import */ var _plugincard _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ./plugincard */ "./src/ui/settings/plugincard.js" ) ;
/* harmony import */ var _themecard _ _WEBPACK _IMPORTED _MODULE _10 _ _ = _ _webpack _require _ _ ( /*! ./themecard */ "./src/ui/settings/themecard.js" ) ;
/* harmony import */ var _icons _reload _ _WEBPACK _IMPORTED _MODULE _11 _ _ = _ _webpack _require _ _ ( /*! ../icons/reload */ "./src/ui/icons/reload.js" ) ;
/* harmony import */ var _customcss _editor _ _WEBPACK _IMPORTED _MODULE _12 _ _ = _ _webpack _require _ _ ( /*! ../customcss/editor */ "./src/ui/customcss/editor.js" ) ;
class V2 _SettingsPanel {
2019-05-30 07:06:17 +02:00
constructor ( props ) {
this . sideBarOnClick = this . sideBarOnClick . bind ( this ) ;
this . onChange = props . onChange ;
this . sidebar = new _sidebar _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] ( this . sideBarOnClick ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
get root ( ) {
const _root = $ ( "#bd-settingspane-container" ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( ! _root . length ) {
if ( ! this . injectRoot ( ) ) return null ;
return this . root ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
return _root [ 0 ] ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
injectRoot ( ) {
if ( ! $ ( ".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view" ) . length ) return false ;
const root = $ ( "<div/>" , {
"class" : "contentRegion-3nDuYy content-region" ,
"id" : "bd-settingspane-container"
} ) ;
$ ( ".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view" ) . append ( root ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Utilities" ] . onRemoved ( root [ 0 ] , ( ) => {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ReactDOM" ] . unmountComponentAtNode ( root [ 0 ] ) ;
} ) ;
return true ;
}
get coreSettings ( ) {
const settings = this . getSettings ( "core" ) ;
const categories = [ ... new Set ( settings . map ( s => s . category ) ) ] ;
const sections = categories . map ( c => {
return {
title : c ,
settings : settings . filter ( s => s . category == c )
} ;
} ) ;
return sections ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
get emoteSettings ( ) {
return this . getSettings ( "emote" ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
getSettings ( category ) {
return Object . keys ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsInfo" ] ) . reduce ( ( arr , key ) => {
const setting = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsInfo" ] [ key ] ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( setting . cat === category && setting . implemented && ! setting . hidden ) {
setting . text = key ;
arr . push ( setting ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
return arr ;
} , [ ] ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
sideBarOnClick ( id ) {
const self = this ;
$ ( ".contentRegion-3nDuYy, .content-region" ) . first ( ) . hide ( ) ;
$ ( self . root ) . show ( ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
switch ( id ) {
case "core" :
self . renderCoreSettings ( ) ;
break ;
case "emotes" :
self . renderEmoteSettings ( ) ;
break ;
case "customcss" :
self . renderCustomCssEditor ( ) ;
break ;
case "plugins" :
self . renderPluginPane ( ) ;
break ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
case "themes" :
self . renderThemePane ( ) ;
break ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
renderSidebar ( ) {
const self = this ;
$ ( "[class*='side-'] > [class*='item-']" ) . off ( "click.v2settingspanel" ) . on ( "click.v2settingspanel" , ( ) => {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ReactDOM" ] . unmountComponentAtNode ( self . root ) ;
$ ( self . root ) . hide ( ) ;
$ ( ".contentRegion-3nDuYy, .content-region" ) . first ( ) . show ( ) ;
} ) ;
self . sidebar . render ( ) ;
}
get coreComponent ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _scroller _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
contentColumn : true ,
fade : true ,
dark : true ,
children : [ modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _sectionedsettings _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] , {
key : "cspanel" ,
onChange : this . onChange ,
sections : this . coreSettings
} ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _exitbutton _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] , {
key : "tools"
} ) ]
} ) ;
}
get emoteComponent ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _scroller _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
contentColumn : true ,
fade : true ,
dark : true ,
children : [ modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _panel _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] , {
key : "espanel" ,
title : "Emote Settings" ,
onChange : this . onChange ,
settings : this . emoteSettings ,
button : {
title : "Clear Emote Cache" ,
onClick : ( ) => {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "EmoteModule" ] . clearEmoteData ( ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "EmoteModule" ] . init ( ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "EmoteMenu" ] . init ( ) ;
}
}
} ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _exitbutton _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] , {
key : "tools"
} ) ]
} ) ;
}
get customCssComponent ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _scroller _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
contentColumn : true ,
fade : true ,
dark : true ,
children : [ modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _customcss _editor _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "default" ] , {
key : "csseditor"
} ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _exitbutton _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] , {
key : "tools"
} ) ]
} ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
contentComponent ( type ) {
const componentElement = type == "plugins" ? this . pluginsComponent : this . themesComponent ;
const prefix = type . replace ( "s" , "" ) ;
const settingsList = this ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
class ContentList extends modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
this . onChange = this . onChange . bind ( this ) ;
}
componentDidMount ( ) {
2019-05-30 17:44:05 +02:00
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . on ( ` ${ prefix } -reloaded ` , this . onChange ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . on ( ` ${ prefix } -loaded ` , this . onChange ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . on ( ` ${ prefix } -unloaded ` , this . onChange ) ;
2019-05-30 07:06:17 +02:00
}
componentWillUnmount ( ) {
2019-05-30 17:44:05 +02:00
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . off ( ` ${ prefix } -reloaded ` , this . onChange ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . off ( ` ${ prefix } -loaded ` , this . onChange ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . off ( ` ${ prefix } -unloaded ` , this . onChange ) ;
2019-05-30 07:06:17 +02:00
}
onChange ( ) {
settingsList . sideBarOnClick ( type ) ;
}
render ( ) {
return componentElement ;
}
}
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( ContentList ) ;
}
get pluginsComponent ( ) {
const plugins = Object . keys ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] ) . sort ( ( a , b ) => a . toLowerCase ( ) . localeCompare ( b . toLowerCase ( ) ) ) . reduce ( ( arr , key ) => {
arr . push ( modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _plugincard _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] , {
key : key ,
plugin : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Plugins" ] [ key ] . plugin
} ) ) ;
return arr ;
} , [ ] ) ;
const list = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _list _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
key : "plugin-list" ,
className : "bda-slist" ,
children : plugins
} ) ;
const refreshIcon = ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-5" ] && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _icons _reload _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] , {
className : "bd-reload-header" ,
size : "18px" ,
onClick : async ( ) => {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "PluginManager" ] . updatePluginList ( ) ;
this . sideBarOnClick ( "plugins" ) ;
}
} ) ;
const pfBtn = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "button" , {
key : "folder-button" ,
className : "bd-pfbtn" ,
onClick : ( ) => {
_ _webpack _require _ _ ( /*! electron */ "electron" ) . shell . openItem ( modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ContentManager" ] . pluginsFolder ) ;
}
} , "Open Plugin Folder" ) ;
const contentColumn = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _contentcolumn _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] , {
key : "pcolumn" ,
title : "Plugins" ,
children : [ refreshIcon , pfBtn , list ]
} ) ;
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _scroller _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
contentColumn : true ,
fade : true ,
dark : true ,
children : [ contentColumn , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _exitbutton _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] , {
key : "tools"
} ) ]
} ) ;
}
get themesComponent ( ) {
const themes = Object . keys ( data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] ) . sort ( ( a , b ) => a . toLowerCase ( ) . localeCompare ( b . toLowerCase ( ) ) ) . reduce ( ( arr , key ) => {
arr . push ( modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _themecard _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] , {
key : key ,
theme : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ key ]
} ) ) ;
return arr ;
} , [ ] ) ;
const list = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _list _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
key : "theme-list" ,
className : "bda-slist" ,
children : themes
} ) ;
const refreshIcon = ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-5" ] && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _icons _reload _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] , {
className : "bd-reload-header" ,
size : "18px" ,
onClick : async ( ) => {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ThemeManager" ] . updateThemeList ( ) ;
this . sideBarOnClick ( "themes" ) ;
}
} ) ;
const tfBtn = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "button" , {
key : "folder-button" ,
className : "bd-pfbtn" ,
onClick : ( ) => {
_ _webpack _require _ _ ( /*! electron */ "electron" ) . shell . openItem ( modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ContentManager" ] . themesFolder ) ;
}
} , "Open Theme Folder" ) ;
const contentColumn = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _contentcolumn _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] , {
key : "tcolumn" ,
title : "Themes" ,
children : [ refreshIcon , tfBtn , list ]
} ) ;
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _scroller _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
contentColumn : true ,
fade : true ,
dark : true ,
children : [ contentColumn , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _exitbutton _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] , {
key : "tools"
} ) ]
} ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
renderCoreSettings ( ) {
const root = this . root ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( ! root ) {
console . log ( "FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i" ) ;
return ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ReactDOM" ] . render ( this . coreComponent , root ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
renderEmoteSettings ( ) {
const root = this . root ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( ! root ) {
console . log ( "FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i" ) ;
return ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ReactDOM" ] . render ( this . emoteComponent , root ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
renderCustomCssEditor ( ) {
const root = this . root ;
if ( ! root ) {
console . log ( "FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i" ) ;
return ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ReactDOM" ] . render ( this . customCssComponent , root ) ;
}
renderPluginPane ( ) {
const root = this . root ;
if ( ! root ) {
console . log ( "FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i" ) ;
return ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ReactDOM" ] . render ( this . contentComponent ( "plugins" ) , root ) ;
}
renderThemePane ( ) {
const root = this . root ;
if ( ! root ) {
console . log ( "FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i" ) ;
return ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ReactDOM" ] . render ( this . contentComponent ( "themes" ) , root ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/settingsgroup.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / settingsgroup . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _SettingsGroup ; } ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _title _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./title */ "./src/ui/settings/title.js" ) ;
/* harmony import */ var _switch _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./switch */ "./src/ui/settings/switch.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _SettingsGroup extends modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
const {
title ,
settings ,
button
} = this . props ;
const buttonComponent = button ? modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "button" , {
key : "title-button" ,
className : "bd-pfbtn" ,
onClick : button . onClick
} , button . title ) : null ;
return [ modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _title _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , {
text : title
} ) , buttonComponent , settings . map ( setting => {
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _switch _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
id : setting . id ,
key : setting . id ,
data : setting ,
checked : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ setting . id ] ,
onChange : ( id , checked ) => {
this . props . onChange ( id , checked ) ;
}
} ) ;
} ) ] ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/sidebar.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / sidebar . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2 _SettingsPanel _Sidebar ; } ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _sidebarmenu _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./sidebarmenu */ "./src/ui/settings/sidebarmenu.js" ) ;
class V2 _SettingsPanel _Sidebar {
2019-05-30 07:06:17 +02:00
constructor ( onClick ) {
this . onClick = onClick ;
}
get items ( ) {
return [ {
text : "Settings" ,
id : "core"
} , {
text : "Emotes" ,
id : "emotes"
} , {
text : "Plugins" ,
id : "plugins"
} , {
text : "Themes" ,
id : "themes"
} , {
text : "Custom CSS" ,
id : "customcss"
} ] ;
}
get component ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "span" , null , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _sidebarmenu _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , {
onClick : this . onClick ,
headerText : "Bandaged BD" ,
items : this . items
} ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
style : {
fontSize : "12px" ,
fontWeight : "600" ,
color : "#72767d" ,
padding : "2px 10px"
}
} , ` BD v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Config" ] . version } by ` , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "a" , {
href : "https://github.com/Jiiks/" ,
target : "_blank"
} , "Jiiks" ) ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
style : {
fontSize : "12px" ,
fontWeight : "600" ,
color : "#72767d" ,
padding : "2px 10px"
}
} , ` BBD v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Config" ] . bbdVersion } by ` , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "a" , {
href : "https://github.com/rauenzi/" ,
target : "_blank"
} , "Zerebos" ) ) ) ;
}
get root ( ) {
const _root = $ ( "#bd-settings-sidebar" ) ;
if ( ! _root . length ) {
if ( ! this . injectRoot ( ) ) return null ;
return this . root ;
}
return _root [ 0 ] ;
}
injectRoot ( ) {
const changeLog = $ ( "[class*='side-'] > [class*='item-']:not([class*=Danger])" ) . last ( ) ;
if ( ! changeLog . length ) return false ;
$ ( "<span/>" , {
id : "bd-settings-sidebar"
} ) . insertBefore ( changeLog . prev ( ) ) ;
return true ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
render ( ) {
const root = this . root ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( ! root ) {
console . log ( "FAILED TO LOCATE ROOT: [class*='side-'] > [class*='item-']:not([class*=Danger])" ) ;
return ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ReactDOM" ] . render ( this . component , root ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Utilities" ] . onRemoved ( root , ( ) => {
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ReactDOM" ] . unmountComponentAtNode ( root ) ;
} ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/sidebarmenu.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / sidebarmenu . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _SideBar ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _tabbar _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./tabbar */ "./src/ui/settings/tabbar.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _SideBar extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
const self = this ;
const si = $ ( "[class*=side] > [class*=selected]" ) ;
if ( si . length ) self . scn = si . attr ( "class" ) ;
const ns = $ ( "[class*=side] > [class*=notSelected]" ) ;
if ( ns . length ) self . nscn = ns . attr ( "class" ) ;
$ ( "[class*='side-'] > [class*='item-']" ) . on ( "click" , ( ) => {
self . setState ( {
selected : null
} ) ;
} ) ;
self . setInitialState ( ) ;
self . onClick = self . onClick . bind ( self ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
setInitialState ( ) {
const self = this ;
self . state = {
selected : null ,
items : self . props . items
} ;
const initialSelection = self . props . items . find ( item => {
return item . selected ;
} ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( initialSelection ) {
self . state . selected = initialSelection . id ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
render ( ) {
const self = this ;
const {
headerText
} = self . props ;
const {
items ,
selected
} = self . state ;
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , null , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _tabbar _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . Separator , null ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _tabbar _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . Header , {
text : headerText
} ) , items . map ( item => {
const {
id ,
text
} = item ;
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _tabbar _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . Item , {
key : id ,
selected : selected === id ,
text : text ,
id : id ,
onClick : self . onClick
} ) ;
} ) ) ;
}
onClick ( id ) {
const self = this ;
const si = $ ( "[class*=side] > [class*=selected]" ) ;
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
if ( si . length ) {
si . off ( "click.bdsb" ) . on ( "click.bsb" , e => {
$ ( e . target ) . attr ( "class" , self . scn ) ;
} ) ;
si . attr ( "class" , self . nscn ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
self . setState ( {
selected : null
} ) ;
self . setState ( {
selected : id
} ) ;
if ( self . props . onClick ) self . props . onClick ( id ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/switch.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / switch . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _Switch ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _Switch extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
this . setInitialState ( ) ;
this . onChange = this . onChange . bind ( this ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
setInitialState ( ) {
this . state = {
checked : this . props . checked
} ;
}
render ( ) {
const {
text ,
info
} = this . props . data ;
const {
checked
} = this . state ;
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "h3" , {
className : "ui-form-title h3 margin-reset margin-reset ui-flex-child"
} , text ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "label" , {
className : "ui-switch-wrapper ui-flex-child" ,
style : {
flex : "0 0 auto"
}
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "input" , {
className : "ui-switch-checkbox" ,
type : "checkbox" ,
checked : checked ,
onChange : e => this . onChange ( e )
} ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : ` ui-switch ${ checked ? "checked" : "" } `
} ) ) ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-form-text style-description margin-top-4" ,
style : {
flex : "1 1 auto"
}
} , info ) ) ;
}
onChange ( ) {
this . props . onChange ( this . props . id , ! this . state . checked ) ;
this . setState ( {
checked : ! this . state . checked
} ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/tabbar.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / tabbar . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2Cs _TabBar ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _TabBarItem extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
this . setInitialState ( ) ;
this . onClick = this . onClick . bind ( this ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
setInitialState ( ) {
this . state = {
selected : this . props . selected || false
} ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : ` ui-tab-bar-item ${ this . props . selected ? " selected" : "" } ` ,
onClick : this . onClick
} , this . props . text ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
onClick ( ) {
if ( this . props . onClick ) {
this . props . onClick ( this . props . id ) ;
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
}
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
class V2C _TabBarSeparator extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-tab-bar-separator margin-top-8 margin-bottom-8"
} ) ;
}
2019-05-29 05:48:41 +02:00
}
2019-05-30 07:06:17 +02:00
class V2C _TabBarHeader extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "ui-tab-bar-header"
} , this . props . text ) ;
}
2019-05-29 05:48:41 +02:00
}
class V2Cs _TabBar {
2019-05-30 07:06:17 +02:00
static get Item ( ) {
return V2C _TabBarItem ;
}
static get Header ( ) {
return V2C _TabBarHeader ;
}
static get Separator ( ) {
return V2C _TabBarSeparator ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/themecard.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / themecard . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _ThemeCard ; } ) ;
/* harmony import */ var data _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! data */ "./src/data/data.js" ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _icons _reload _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../icons/reload */ "./src/ui/icons/reload.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _ThemeCard extends modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
this . setInitialState ( ) ;
this . onChange = this . onChange . bind ( this ) ;
this . reload = this . reload . bind ( this ) ;
}
2019-05-29 05:48:41 +02:00
2019-05-30 07:06:17 +02:00
setInitialState ( ) {
this . state = {
checked : data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ThemeCookie" ] [ this . props . theme . name ] ,
reloads : 0
} ;
} // componentDidMount() {
// BDEvents.on("theme-reloaded", this.onReload);
// }
// componentWillUnmount() {
// BDEvents.off("theme-reloaded", this.onReload);
// }
onReload ( themeName ) {
if ( themeName !== this . props . theme . name ) return ;
this . setState ( {
reloads : this . state . reloads + 1
} ) ;
}
reload ( ) {
const theme = this . props . theme . name ;
const error = modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ThemeManager" ] . reloadTheme ( theme ) ;
if ( error ) modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Core" ] . showToast ( ` Could not reload ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . name } . Check console for details. ` , {
type : "error"
} ) ; else modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Core" ] . showToast ( ` ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . name } v ${ data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] . version } has been reloaded. ` , {
type : "success"
} ) ; // this.setState(this.state);
this . props . theme = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ theme ] ;
this . onReload ( this . props . theme . name ) ;
}
render ( ) {
const {
theme
} = this . props ;
const name = theme . name ;
const description = theme . description ;
const version = theme . version ;
const author = theme . author ;
const website = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ name ] . website ;
const source = data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Themes" ] [ name ] . source ;
return modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "li" , {
"data-name" : name ,
"data-version" : version ,
"className" : "settings-closed ui-switch-item"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : "bda-header"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "span" , {
className : "bda-header-title"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "span" , {
className : "bda-name"
} , name ) , " v" , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "span" , {
className : "bda-version"
} , version ) , " by " , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "span" , {
className : "bda-author"
} , author ) ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : "bda-controls"
} , ! data _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "SettingsCookie" ] [ "fork-ps-5" ] && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( _icons _reload _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , {
className : "bd-reload-card" ,
onClick : this . reload
} ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "label" , {
className : "ui-switch-wrapper ui-flex-child" ,
style : {
flex : "0 0 auto"
}
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "input" , {
checked : this . state . checked ,
onChange : this . onChange ,
className : "ui-switch-checkbox" ,
type : "checkbox"
} ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : this . state . checked ? "ui-switch checked" : "ui-switch"
} ) ) ) ) , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : "bda-description-wrap scroller-wrap fade"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : "bda-description scroller"
} , description ) ) , ( website || source ) && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "div" , {
className : "bda-footer"
} , modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "span" , {
className : "bda-links"
} , website && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "a" , {
className : "bda-link" ,
href : website ,
target : "_blank"
} , "Website" ) , website && source && " | " , source && modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "React" ] . createElement ( "a" , {
className : "bda-link" ,
href : source ,
target : "_blank"
} , "Source" ) ) ) ) ;
}
onChange ( ) {
this . setState ( {
checked : ! this . state . checked
} ) ;
modules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ThemeManager" ] . toggleTheme ( this . props . theme . name ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settings/title.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settings / title . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _SettingsTitle ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _SettingsTitle extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
} //h2-2gWE-o title-3sZWYQ size16-14cGz5 height20-mO2eIN weightSemiBold-NJexzi da-h2 da-title da-size16 da-height20 da-weightSemiBold defaultColor-1_ajX0 da-defaultColor marginTop60-3PGbtK da-marginTop60 marginBottom20-32qID7 da-marginBottom20
render ( ) {
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "h2" , {
className : "ui-form-title h2 margin-reset margin-bottom-20 marginTop60-3PGbtK da-marginTop6"
} , this . props . text ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/sidebarview.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / sidebarview . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _SidebarView ; } ) ;
/* harmony import */ var modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! modules */ "./src/modules/modules.js" ) ;
/* harmony import */ var _scroller _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./scroller */ "./src/ui/scroller.js" ) ;
2019-05-30 07:06:17 +02:00
class V2C _SidebarView extends modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . Component {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
const {
sidebar ,
content ,
tools
} = this . props . children ;
return modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "standardSidebarView-3F1I7i ui-standard-sidebar-view"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "sidebarRegion-VFTUkN sidebar-region"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( _scroller _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , {
key : "sidebarScroller" ,
ref : "sidebarScroller" ,
sidebar : true ,
fade : sidebar . fade || true ,
dark : sidebar . dark || true ,
children : sidebar . component
} ) ) , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "contentRegion-3nDuYy content-region"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "contentTransitionWrap-3hqOEW content-transition-wrap"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller" ,
ref : "contentScroller"
} , modules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "React" ] . createElement ( "div" , {
className : "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"
} , content . component ) , tools . component ) ) ) ) ) ;
}
2019-05-29 05:48:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/ui.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / ui . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: SettingsPanel, PublicServers */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _settings _settings _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./settings/settings */ "./src/ui/settings/settings.js" ) ;
/* harmony reexport (safe) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "SettingsPanel" , function ( ) { return _settings _settings _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] ; } ) ;
/* harmony import */ var _publicservers _publicservers _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./publicservers/publicservers */ "./src/ui/publicservers/publicservers.js" ) ;
/* harmony reexport (module object) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "PublicServers" , function ( ) { return _publicservers _publicservers _ _WEBPACK _IMPORTED _MODULE _1 _ _ ; } ) ;
/***/ } ) ,
/***/ "electron" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "require(\"electron\")" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "electron" ) ;
/***/ } ) ,
/***/ "events" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "require(\"events\")" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "events" ) ;
/***/ } ) ,
/***/ "fs" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "require(\"fs\")" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "fs" ) ;
/***/ } ) ,
/***/ "module" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "module" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "module" ) ;
/***/ } ) ,
/***/ "path" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "require(\"path\")" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "path" ) ;
/***/ } ) ,
/***/ "request" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "require(\"request\")" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "request" ) ;
/***/ } )
/******/ } ) [ "default" ] ;