enable jsx, react, reactdom

This commit is contained in:
Zack Rauen 2019-05-30 01:06:17 -04:00
parent 8be57da242
commit 47b3dbef68
51 changed files with 6898 additions and 4500 deletions

View File

@ -1,5 +1,5 @@
{ {
"extends": "eslint:recommended", "extends": ["eslint:recommended", "plugin:react/recommended"],
"env": { "env": {
"browser": true, "browser": true,
"node": true, "node": true,
@ -7,7 +7,10 @@
}, },
"parserOptions": { "parserOptions": {
"ecmaVersion": 8, "ecmaVersion": 8,
"sourceType": "module" "sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
}, },
"rules": { "rules": {
"semi": 2, "semi": 2,
@ -24,7 +27,9 @@
"quote-props": ["error", "consistent-as-needed", {"keywords": true}], "quote-props": ["error", "consistent-as-needed", {"keywords": true}],
"object-curly-spacing": ["error", "never", { "objectsInObjects": false }], "object-curly-spacing": ["error", "never", { "objectsInObjects": false }],
"no-var": "error", "no-var": "error",
"prefer-const": "error" "prefer-const": "error",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error"
}, },
"globals": { "globals": {
"webpackJsonp": false, "webpackJsonp": false,

9637
js/main.js

File diff suppressed because it is too large Load Diff

2
js/main.min.js vendored

File diff suppressed because one or more lines are too long

259
package-lock.json generated
View File

@ -84,6 +84,16 @@
"@babel/types": "^7.0.0" "@babel/types": "^7.0.0"
} }
}, },
"@babel/helper-builder-react-jsx": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.3.0.tgz",
"integrity": "sha512-MjA9KgwCuPEkQd9ncSXvSyJ5y+j2sICHyrI0M3L+6fnS4wMSNDc1ARXsbTfbb2cXHn17VisSnU/sHFTCxVxSMw==",
"dev": true,
"requires": {
"@babel/types": "^7.3.0",
"esutils": "^2.0.0"
}
},
"@babel/helper-call-delegate": { "@babel/helper-call-delegate": {
"version": "7.4.4", "version": "7.4.4",
"resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz",
@ -355,6 +365,15 @@
"@babel/helper-plugin-utils": "^7.0.0" "@babel/helper-plugin-utils": "^7.0.0"
} }
}, },
"@babel/plugin-syntax-jsx": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.2.0.tgz",
"integrity": "sha512-VyN4QANJkRW6lDBmENzRszvZf3/4AXaj9YR7GwrWeeN9tEBPuXbmDYVU9bYBN0D70zCWVwUy0HWq2553VCb6Hw==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0"
}
},
"@babel/plugin-syntax-object-rest-spread": { "@babel/plugin-syntax-object-rest-spread": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz",
@ -602,6 +621,46 @@
"@babel/helper-plugin-utils": "^7.0.0" "@babel/helper-plugin-utils": "^7.0.0"
} }
}, },
"@babel/plugin-transform-react-display-name": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.2.0.tgz",
"integrity": "sha512-Htf/tPa5haZvRMiNSQSFifK12gtr/8vwfr+A9y69uF0QcU77AVu4K7MiHEkTxF7lQoHOL0F9ErqgfNEAKgXj7A==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0"
}
},
"@babel/plugin-transform-react-jsx": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.3.0.tgz",
"integrity": "sha512-a/+aRb7R06WcKvQLOu4/TpjKOdvVEKRLWFpKcNuHhiREPgGRB4TQJxq07+EZLS8LFVYpfq1a5lDUnuMdcCpBKg==",
"dev": true,
"requires": {
"@babel/helper-builder-react-jsx": "^7.3.0",
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-syntax-jsx": "^7.2.0"
}
},
"@babel/plugin-transform-react-jsx-self": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.2.0.tgz",
"integrity": "sha512-v6S5L/myicZEy+jr6ielB0OR8h+EH/1QFx/YJ7c7Ua+7lqsjj/vW6fD5FR9hB/6y7mGbfT4vAURn3xqBxsUcdg==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-syntax-jsx": "^7.2.0"
}
},
"@babel/plugin-transform-react-jsx-source": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.2.0.tgz",
"integrity": "sha512-A32OkKTp4i5U6aE88GwwcuV4HAprUgHcTq0sSafLxjr6AW0QahrCRCjxogkbbcdtpbXkuTOlgpjophCxb6sh5g==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-syntax-jsx": "^7.2.0"
}
},
"@babel/plugin-transform-regenerator": { "@babel/plugin-transform-regenerator": {
"version": "7.4.5", "version": "7.4.5",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz",
@ -734,6 +793,19 @@
"semver": "^5.5.0" "semver": "^5.5.0"
} }
}, },
"@babel/preset-react": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.0.0.tgz",
"integrity": "sha512-oayxyPS4Zj+hF6Et11BwuBkmpgT/zMxyuZgFrMeZID6Hdh3dGlk4sHCAhdBCpuCKW2ppBfl2uCCetlrUIJRY3w==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-transform-react-display-name": "^7.0.0",
"@babel/plugin-transform-react-jsx": "^7.0.0",
"@babel/plugin-transform-react-jsx-self": "^7.0.0",
"@babel/plugin-transform-react-jsx-source": "^7.0.0"
}
},
"@babel/register": { "@babel/register": {
"version": "7.4.4", "version": "7.4.4",
"resolved": "https://registry.npmjs.org/@babel/register/-/register-7.4.4.tgz", "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.4.4.tgz",
@ -1158,6 +1230,16 @@
"integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=",
"dev": true "dev": true
}, },
"array-includes": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz",
"integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=",
"dev": true,
"requires": {
"define-properties": "^1.1.2",
"es-abstract": "^1.7.0"
}
},
"array-initial": { "array-initial": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz", "resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz",
@ -1351,6 +1433,18 @@
"integrity": "sha512-m2CvfDW4+1qfDdsrtf4dwOslQC3yhbgyBFptncp4wvtdrDHqueW7slsYv4gArie056phvQFhT2nRcGS4bnm6mA==", "integrity": "sha512-m2CvfDW4+1qfDdsrtf4dwOslQC3yhbgyBFptncp4wvtdrDHqueW7slsYv4gArie056phvQFhT2nRcGS4bnm6mA==",
"dev": true "dev": true
}, },
"babel-loader": {
"version": "8.0.6",
"resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.6.tgz",
"integrity": "sha512-4BmWKtBOBm13uoUwd08UwjZlaw3O9GWf456R9j+5YykFZ6LUIjIKLc0zEZf+hauxPOJs96C8k6FvYD09vWzhYw==",
"dev": true,
"requires": {
"find-cache-dir": "^2.0.0",
"loader-utils": "^1.0.2",
"mkdirp": "^0.5.1",
"pify": "^4.0.1"
}
},
"babel-plugin-minify-builtins": { "babel-plugin-minify-builtins": {
"version": "0.5.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.5.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.5.0.tgz",
@ -2416,6 +2510,15 @@
"randombytes": "^2.0.0" "randombytes": "^2.0.0"
} }
}, },
"doctrine": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"requires": {
"esutils": "^2.0.2"
}
},
"domain-browser": { "domain-browser": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz",
@ -2520,6 +2623,31 @@
"is-arrayish": "^0.2.1" "is-arrayish": "^0.2.1"
} }
}, },
"es-abstract": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz",
"integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==",
"dev": true,
"requires": {
"es-to-primitive": "^1.2.0",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"is-callable": "^1.1.4",
"is-regex": "^1.0.4",
"object-keys": "^1.0.12"
}
},
"es-to-primitive": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz",
"integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==",
"dev": true,
"requires": {
"is-callable": "^1.1.4",
"is-date-object": "^1.0.1",
"is-symbol": "^1.0.2"
}
},
"es5-ext": { "es5-ext": {
"version": "0.10.49", "version": "0.10.49",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.49.tgz", "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.49.tgz",
@ -2570,6 +2698,32 @@
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true "dev": true
}, },
"eslint-plugin-react": {
"version": "7.13.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.13.0.tgz",
"integrity": "sha512-uA5LrHylu8lW/eAH3bEQe9YdzpPaFd9yAJTwTi/i/BKTD7j6aQMKVAdGM/ML72zD6womuSK7EiGtMKuK06lWjQ==",
"dev": true,
"requires": {
"array-includes": "^3.0.3",
"doctrine": "^2.1.0",
"has": "^1.0.3",
"jsx-ast-utils": "^2.1.0",
"object.fromentries": "^2.0.0",
"prop-types": "^15.7.2",
"resolve": "^1.10.1"
},
"dependencies": {
"resolve": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz",
"integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
}
}
}
},
"eslint-scope": { "eslint-scope": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
@ -2985,14 +3139,12 @@
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -3007,20 +3159,17 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -3137,8 +3286,7 @@
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -3150,7 +3298,6 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -3165,7 +3312,6 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -3173,14 +3319,12 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -3199,7 +3343,6 @@
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -3280,8 +3423,7 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -3293,7 +3435,6 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -3415,7 +3556,6 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -3872,6 +4012,15 @@
"glogg": "^1.0.0" "glogg": "^1.0.0"
} }
}, },
"has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"requires": {
"function-bind": "^1.1.1"
}
},
"has-flag": { "has-flag": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
@ -4096,6 +4245,12 @@
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
"dev": true "dev": true
}, },
"is-callable": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
"integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==",
"dev": true
},
"is-data-descriptor": { "is-data-descriptor": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
@ -4116,6 +4271,12 @@
} }
} }
}, },
"is-date-object": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
"dev": true
},
"is-descriptor": { "is-descriptor": {
"version": "0.1.6", "version": "0.1.6",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
@ -4197,6 +4358,15 @@
"isobject": "^3.0.1" "isobject": "^3.0.1"
} }
}, },
"is-regex": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
"integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
"dev": true,
"requires": {
"has": "^1.0.1"
}
},
"is-relative": { "is-relative": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz",
@ -4212,6 +4382,15 @@
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
"dev": true "dev": true
}, },
"is-symbol": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz",
"integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==",
"dev": true,
"requires": {
"has-symbols": "^1.0.0"
}
},
"is-unc-path": { "is-unc-path": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz",
@ -4308,6 +4487,15 @@
"minimist": "^1.2.0" "minimist": "^1.2.0"
} }
}, },
"jsx-ast-utils": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.1.0.tgz",
"integrity": "sha512-yDGDG2DS4JcqhA6blsuYbtsT09xL8AoLuUR2Gb5exrw7UEM19sBcOTq+YBBhrNbl0PUC4R4LnFu+dHg2HKeVvA==",
"dev": true,
"requires": {
"array-includes": "^3.0.3"
}
},
"just-debounce": { "just-debounce": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz", "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz",
@ -4966,6 +5154,18 @@
"isobject": "^3.0.0" "isobject": "^3.0.0"
} }
}, },
"object.fromentries": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.0.tgz",
"integrity": "sha512-9iLiI6H083uiqUuvzyY6qrlmc/Gz8hLQFOcb/Ri/0xXFkSNS3ctV+CbE6yM2+AnkYfOB3dGjdzC0wrMLIhQICA==",
"dev": true,
"requires": {
"define-properties": "^1.1.2",
"es-abstract": "^1.11.0",
"function-bind": "^1.1.1",
"has": "^1.0.1"
}
},
"object.map": { "object.map": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz", "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz",
@ -5311,6 +5511,17 @@
"integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=",
"dev": true "dev": true
}, },
"prop-types": {
"version": "15.7.2",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz",
"integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
"dev": true,
"requires": {
"loose-envify": "^1.4.0",
"object-assign": "^4.1.1",
"react-is": "^16.8.1"
}
},
"prr": { "prr": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
@ -5401,6 +5612,12 @@
"safe-buffer": "^5.1.0" "safe-buffer": "^5.1.0"
} }
}, },
"react-is": {
"version": "16.8.6",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz",
"integrity": "sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==",
"dev": true
},
"read-pkg": { "read-pkg": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",

View File

@ -25,13 +25,16 @@
}, },
"homepage": "https://github.com/rauenzi/BetterDiscordApp#readme", "homepage": "https://github.com/rauenzi/BetterDiscordApp#readme",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-loader": "^8.0.6",
"eslint-plugin-react": "^7.13.0",
"gulp": "^4.0.0", "gulp": "^4.0.0",
"gulp-babel-minify": "^0.5.0", "gulp-babel-minify": "^0.5.0",
"gulp-csso": "^3.0.1", "gulp-csso": "^3.0.1",
"gulp-rename": "^1.4.0", "gulp-rename": "^1.4.0",
"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"@babel/register": "^7.0.0",
"webpack": "^4.29.6", "webpack": "^4.29.6",
"webpack-cli": "^3.2.3" "webpack-cli": "^3.2.3"
} }

View File

@ -1,10 +1,11 @@
import SettingsInfo from "./settings"; import SettingsInfo from "./settings";
import SettingsCookie from "./settingscookie"; import SettingsCookie from "./cookies/settingscookie";
import Config from "./config"; import Config from "./config";
import PluginCookie from "./plugincookie"; import PluginCookie from "./cookies/plugincookie";
import ThemeCookie from "./themecookie"; import ThemeCookie from "./cookies/themecookie";
import Themes from "./themes"; import Themes from "./themes";
import Plugins from "./plugins"; import Plugins from "./plugins";
import EmoteBlacklist from "./emoteblacklist"; import Emotes from "./emotes/emotes";
import EmoteBlacklist from "./emotes/blacklist";
export {SettingsInfo, SettingsCookie, Config, PluginCookie, ThemeCookie, Themes, Plugins, EmoteBlacklist}; export {SettingsInfo, SettingsCookie, Config, PluginCookie, ThemeCookie, Themes, Plugins, Emotes, EmoteBlacklist};

View File

@ -0,0 +1,7 @@
export default {
TwitchGlobal: {},
TwitchSubscriber: {},
BTTV: {},
FrankerFaceZ: {},
BTTV2: {}
};

View File

@ -1,4 +1,4 @@
import {SettingsCookie, SettingsInfo, PluginCookie, ThemeCookie, Plugins, Themes, EmoteBlacklist} from "data"; import {SettingsCookie, SettingsInfo, PluginCookie, ThemeCookie, Plugins, Themes, Emotes, EmoteBlacklist} from "data";
import proxyLocalStorage from "./localstorage"; import proxyLocalStorage from "./localstorage";
import Core from "./modules/core"; import Core from "./modules/core";
import BdApi from "./modules/pluginapi"; import BdApi from "./modules/pluginapi";
@ -23,6 +23,7 @@ window.pluginModule = PluginManager;
window.themeModule = ThemeManager; window.themeModule = ThemeManager;
window.bdthemes = Themes; window.bdthemes = Themes;
window.bdplugins = Plugins; window.bdplugins = Plugins;
window.bdEmotes = Emotes;
window.bemotes = EmoteBlacklist; window.bemotes = EmoteBlacklist;
window.bdPluginStorage = bdPluginStorage; window.bdPluginStorage = bdPluginStorage;
@ -36,5 +37,43 @@ export default class CoreWrapper {
} }
} }
export function patchModuleLoad() {
const namespace = "betterdiscord";
const prefix = `${namespace}/`;
const Module = require("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 BdApi;
}
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));
// }
// var settingsPanel, emoteModule, quickEmoteMenu, voiceMode,, dMode, publicServersModule; // var settingsPanel, emoteModule, quickEmoteMenu, voiceMode,, dMode, publicServersModule;
// var bdConfig = null; // var bdConfig = null;

View File

@ -1,111 +1,58 @@
import {SettingsInfo} from "data"; import {SettingsInfo} from "data";
import WebpackModules, {DiscordModules} from "./webpackmodules";
import BdApi from "./pluginapi"; import BdApi from "./pluginapi";
// import BDLogo from "../ui/icons/bdlogo"; import BDLogo from "../ui/icons/bdlogo";
export default new class V2 { export default new class V2 {
constructor() { constructor() {
this.editorDetached = false; this.editorDetached = false;
this.WebpackModules = (() => {
const req = webpackJsonp.push([[], {__extra_id__: (module, exports, req) => module.exports = req}, [["__extra_id__"]]]);
delete req.m.__extra_id__;
delete req.c.__extra_id__;
const find = (filter) => {
for (const i in req.c) {
if (req.c.hasOwnProperty(i)) {
const m = req.c[i].exports;
if (m && m.__esModule && m.default && filter(m.default)) return m.default;
if (m && filter(m)) return m;
}
}
console.warn("Cannot find loaded module in cache");
return null;
};
const findAll = (filter) => {
const modules = [];
for (const i in req.c) {
if (req.c.hasOwnProperty(i)) {
const m = req.c[i].exports;
if (m && m.__esModule && m.default && filter(m.default)) modules.push(m.default);
else if (m && filter(m)) modules.push(m);
}
}
return modules;
};
const findByUniqueProperties = (propNames) => find(module => propNames.every(prop => module[prop] !== undefined));
const findByPrototypes = (protoNames) => find(module => module.prototype && protoNames.every(protoProp => module.prototype[protoProp] !== undefined));
const findByDisplayName = (displayName) => find(module => module.displayName === displayName);
return {find, findAll, findByUniqueProperties, findByPrototypes, findByDisplayName};
})();
this.internal = {
react: this.WebpackModules.findByUniqueProperties(["Component", "PureComponent", "Children", "createElement", "cloneElement"]),
reactDom: this.WebpackModules.findByUniqueProperties(["findDOMNode"])
};
this.getInternalInstance = e => e[Object.keys(e).find(k => k.startsWith("__reactInternalInstance"))];
} }
initialize() { initialize() {
// BdApi.suppressErrors(this.patchSocial.bind(this), "BD Social Patch")(); BdApi.suppressErrors(this.patchSocial.bind(this), "BD Social Patch")();
BdApi.suppressErrors(this.patchGuildPills.bind(this), "BD Guild Pills Patch")(); BdApi.suppressErrors(this.patchGuildPills.bind(this), "BD Guild Pills Patch")();
BdApi.suppressErrors(this.patchGuildListItems.bind(this), "BD Guild List Items Patch")(); BdApi.suppressErrors(this.patchGuildListItems.bind(this), "BD Guild List Items Patch")();
BdApi.suppressErrors(this.patchGuildSeparator.bind(this), "BD Guild Separator Patch")(); BdApi.suppressErrors(this.patchGuildSeparator.bind(this), "BD Guild Separator Patch")();
} }
get react() {return this.internal.react;} get messageClasses() {return WebpackModules.getByProps("message", "containerCozy");}
get reactDom() {return this.internal.reactDom;}
get reactComponent() {return this.internal.react.Component;}
get messageClasses() {return this.WebpackModules.findByUniqueProperties(["message", "containerCozy"]);}
get guildClasses() { get guildClasses() {
const guildsWrapper = this.WebpackModules.findByUniqueProperties(["wrapper", "unreadMentionsBar"]); const guildsWrapper = WebpackModules.getByProps("wrapper", "unreadMentionsBar");
const guilds = this.WebpackModules.findByUniqueProperties(["guildsError", "selected"]); const guilds = WebpackModules.getByProps("guildsError", "selected");
const pill = this.WebpackModules.findByUniqueProperties(["blobContainer"]); const pill = WebpackModules.getByProps("blobContainer");
return Object.assign({}, guildsWrapper, guilds, pill); return Object.assign({}, guildsWrapper, guilds, pill);
} }
get MessageContentComponent() {return this.WebpackModules.find(m => m.defaultProps && m.defaultProps.hasOwnProperty("disableButtons"));} get MessageContentComponent() {return WebpackModules.getModule(m => m.defaultProps && m.defaultProps.hasOwnProperty("disableButtons"));}
get TimeFormatter() {return this.WebpackModules.findByUniqueProperties(["dateFormat"]);} get TimeFormatter() {return WebpackModules.getByProps("dateFormat");}
get TooltipWrapper() {return this.WebpackModules.findByDisplayName("TooltipDeprecated");} get TooltipWrapper() {return WebpackModules.getByDisplayName("TooltipDeprecated");}
get NativeModule() {return this.WebpackModules.findByUniqueProperties(["setBadge"]);} get NativeModule() {return WebpackModules.getByProps("setBadge");}
get Tooltips() {return this.WebpackModules.find(m => m.hide && m.show && !m.search && !m.submit && !m.search && !m.activateRagingDemon && !m.dismiss);} get Tooltips() {return WebpackModules.getModule(m => m.hide && m.show && !m.search && !m.submit && !m.search && !m.activateRagingDemon && !m.dismiss);}
get KeyGenerator() {return this.WebpackModules.find(m => m.toString && /"binary"/.test(m.toString()));} get KeyGenerator() {return WebpackModules.getModule(m => m.toString && /"binary"/.test(m.toString()));}
parseSettings(cat) { patchSocial() {
return Object.keys(SettingsInfo).reduce((arr, key) => { if (this.socialPatch) return;
const setting = SettingsInfo[key]; const TabBar = BdApi.findModule(m => m.displayName == "TabBar");
if (setting.cat === cat && setting.implemented && !setting.hidden) { const Anchor = BdApi.findModule(m => m.displayName == "Anchor");
setting.text = key; if (!TabBar || !Anchor) return;
arr.push(setting); this.socialPatch = BdApi.monkeyPatch(TabBar.prototype, "render", {after: (data) => {
} return arr; 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);
returnVal.props.children.push(BdApi.React.createElement(Anchor, {className: "bd-social-link", href: "https://github.com/rauenzi/BetterDiscordApp", rel: "author", title: "BandagedBD", target: "_blank"},
BdApi.React.createElement(BDLogo, {size: "16px", className: "bd-social-logo"})
));
return returnVal;
};
children[children.length - 1].type = newOne;
}});
} }
// patchSocial() {
// if (this.socialPatch) return;
// const TabBar = BdApi.findModule(m => m.displayName == "TabBar");
// const Anchor = BdApi.findModule(m => m.displayName == "Anchor");
// if (!TabBar || !Anchor) return;
// this.socialPatch = BdApi.monkeyPatch(TabBar.prototype, "render", {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);
// returnVal.props.children.push(BdApi.React.createElement(Anchor, {className: "bd-social-link", href: "https://github.com/rauenzi/BetterDiscordApp", rel: "author", title: "BandagedBD", target: "_blank"},
// BdApi.React.createElement(BDLogo, {size: "16px", className: "bd-social-logo"})
// ));
// return returnVal;
// };
// children[children.length - 1].type = newOne;
// }});
// }
patchGuildListItems() { patchGuildListItems() {
if (this.guildListItemsPatch) return; if (this.guildListItemsPatch) return;
const listItemClass = this.guildClasses.listItem.split(" ")[0]; const listItemClass = this.guildClasses.listItem.split(" ")[0];

View File

@ -0,0 +1,146 @@
/**
* A large list of known and useful webpack modules internal to Discord.
* Click the source link down below to view more info. Otherwise, if you
* have the library installed or have a plugin using this library,
* do `Object.keys(ZLibrary.DiscordModules)` in console for a list of modules.
* @module DiscordModules
* @version 0.0.3
*/
import Utilities from "./utilities";
import WebpackModules from "./webpackmodules";
export default Utilities.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");},
/* 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");}
});

View File

@ -7,4 +7,4 @@ export default new class BDEvents extends EventEmitter {
off(eventName, eventAction) { off(eventName, eventAction) {
this.removeListener(eventName, eventAction); this.removeListener(eventName, eventAction);
} }
} };

View File

@ -1,4 +1,4 @@
import {SettingsCookie} from "data"; import {SettingsCookie, Emotes} from "data";
import DataStore from "./datastore"; import DataStore from "./datastore";
import Utilities from "./utilities"; import Utilities from "./utilities";
@ -31,9 +31,9 @@ QuickEmoteMenu.prototype.init = function() {
teContainer += " <div class=\"scroller scroller-2FKFPG\">"; teContainer += " <div class=\"scroller scroller-2FKFPG\">";
teContainer += " <div class=\"emote-menu-inner\">"; teContainer += " <div class=\"emote-menu-inner\">";
let url = ""; let url = "";
for (const emote in window.bdEmotes.TwitchGlobal) { for (const emote in Emotes.TwitchGlobal) {
if (window.bdEmotes.TwitchGlobal.hasOwnProperty(emote)) { if (Emotes.TwitchGlobal.hasOwnProperty(emote)) {
url = window.bdEmotes.TwitchGlobal[emote]; url = Emotes.TwitchGlobal[emote];
teContainer += "<div class=\"emote-container\">"; teContainer += "<div class=\"emote-container\">";
teContainer += " <img class=\"emote-icon\" alt=\"\" src=\"" + url + "\" title=\"" + emote + "\">"; teContainer += " <img class=\"emote-icon\" alt=\"\" src=\"" + url + "\" title=\"" + emote + "\">";
teContainer += " </img>"; teContainer += " </img>";

View File

@ -1,25 +1,12 @@
import {Config, SettingsCookie, EmoteBlacklist} from "data"; import {Config, SettingsCookie, Emotes, EmoteBlacklist} from "data";
import Utilities from "./utilities"; import Utilities from "./utilities";
import BDV2 from "./bdv2"; import BDV2 from "./bdv2";
import BDEmote from "../ui/emote"; import BDEmote from "../ui/emote";
import BdApi from "./pluginapi"; import BdApi from "./pluginapi";
import DataStore from "./datastore"; import DataStore from "./datastore";
import {DiscordModules} from "./webpackmodules";
window.emotesFfz = {}; const bdEmoteSettingIDs = {
window.emotesBTTV = {};
window.emotesBTTV2 = {};
window.emotesTwitch = {};
window.subEmotesTwitch = {};
window.bdEmotes = {
TwitchGlobal: {},
TwitchSubscriber: {},
BTTV: {},
FrankerFaceZ: {},
BTTV2: {}
};
window.bdEmoteSettingIDs = {
TwitchGlobal: "bda-es-7", TwitchGlobal: "bda-es-7",
TwitchSubscriber: "bda-es-7", TwitchSubscriber: "bda-es-7",
BTTV: "bda-es-2", BTTV: "bda-es-2",
@ -31,8 +18,8 @@ function EmoteModule() {
Object.defineProperty(this, "categories", { Object.defineProperty(this, "categories", {
get: function() { get: function() {
const cats = []; const cats = [];
for (const current in window.bdEmoteSettingIDs) { for (const current in bdEmoteSettingIDs) {
if (SettingsCookie[window.bdEmoteSettingIDs[current]]) cats.push(current); if (SettingsCookie[bdEmoteSettingIDs[current]]) cats.push(current);
} }
return cats; return cats;
} }
@ -122,24 +109,24 @@ EmoteModule.prototype.init = async function () {
let current = this.categories[c]; let current = this.categories[c];
if (emoteOverride === "twitch") { if (emoteOverride === "twitch") {
if (window.bdEmotes.TwitchGlobal[emoteName]) current = "TwitchGlobal"; if (Emotes.TwitchGlobal[emoteName]) current = "TwitchGlobal";
else if (window.bdEmotes.TwitchSubscriber[emoteName]) current = "TwitchSubscriber"; else if (Emotes.TwitchSubscriber[emoteName]) current = "TwitchSubscriber";
} }
else if (emoteOverride === "bttv") { else if (emoteOverride === "bttv") {
if (window.bdEmotes.BTTV[emoteName]) current = "BTTV"; if (Emotes.BTTV[emoteName]) current = "BTTV";
else if (window.bdEmotes.BTTV2[emoteName]) current = "BTTV2"; else if (Emotes.BTTV2[emoteName]) current = "BTTV2";
} }
else if (emoteOverride === "ffz") { else if (emoteOverride === "ffz") {
if (window.bdEmotes.FrankerFaceZ[emoteName]) current = "FrankerFaceZ"; if (Emotes.FrankerFaceZ[emoteName]) current = "FrankerFaceZ";
} }
if (!window.bdEmotes[current][emoteName] || !SettingsCookie[window.bdEmoteSettingIDs[current]]) continue; if (!Emotes[current][emoteName] || !SettingsCookie[bdEmoteSettingIDs[current]]) continue;
const results = nodes[n].match(new RegExp(`([\\s]|^)${Utilities.escape(emoteModifier ? emoteName + ":" + emoteModifier : emoteName)}([\\s]|$)`)); const results = nodes[n].match(new RegExp(`([\\s]|^)${Utilities.escape(emoteModifier ? emoteName + ":" + emoteModifier : emoteName)}([\\s]|$)`));
if (!results) continue; if (!results) continue;
const pre = nodes[n].substring(0, results.index + results[1].length); const pre = nodes[n].substring(0, results.index + results[1].length);
const post = nodes[n].substring(results.index + results[0].length - results[2].length); const post = nodes[n].substring(results.index + results[0].length - results[2].length);
nodes[n] = pre; nodes[n] = pre;
const emoteComponent = BDV2.react.createElement(BDEmote, {name: emoteName, url: window.bdEmotes[current][emoteName], modifier: emoteModifier}); const emoteComponent = DiscordModules.React.createElement(BDEmote, {name: emoteName, url: Emotes[current][emoteName], modifier: emoteModifier});
nodes.splice(n + 1, 0, post); nodes.splice(n + 1, 0, post);
nodes.splice(n + 1, 0, emoteComponent); nodes.splice(n + 1, 0, emoteComponent);
} }
@ -177,21 +164,13 @@ EmoteModule.prototype.clearEmoteData = async function() {
if (exists) _fs.unlinkSync(file); if (exists) _fs.unlinkSync(file);
DataStore.setBDData("emoteCacheDate", (new Date()).toJSON()); DataStore.setBDData("emoteCacheDate", (new Date()).toJSON());
window.bdEmotes = { Object.assign(Emotes, {
TwitchGlobal: {}, TwitchGlobal: {},
TwitchSubscriber: {}, TwitchSubscriber: {},
BTTV: {}, BTTV: {},
FrankerFaceZ: {}, FrankerFaceZ: {},
BTTV2: {} BTTV2: {}
}; });
};
EmoteModule.prototype.goBack = async function(emoteInfo) {
for (const e in emoteInfo) {
for (const emote in window.bdEmotes[emoteInfo[e].variable]) {
window[emoteInfo[e].oldVariable][emote] = emoteInfo[e].getOldData(window.bdEmotes[emoteInfo[e].variable][emote], emote);
}
}
}; };
EmoteModule.prototype.isCacheValid = function() { EmoteModule.prototype.isCacheValid = function() {
@ -225,10 +204,10 @@ EmoteModule.prototype.loadEmoteData = async function(emoteInfo) {
}); });
let isValid = Utilities.testJSON(data); let isValid = Utilities.testJSON(data);
if (isValid) window.bdEmotes = JSON.parse(data); if (isValid) Object.assign(Emotes, JSON.parse(data));
for (const e in emoteInfo) { for (const e in emoteInfo) {
isValid = Object.keys(window.bdEmotes[emoteInfo[e].variable]).length > 0; isValid = Object.keys(Emotes[emoteInfo[e].variable]).length > 0;
} }
if (isValid) { if (isValid) {
@ -246,12 +225,12 @@ EmoteModule.prototype.loadEmoteData = async function(emoteInfo) {
for (const e in emoteInfo) { for (const e in emoteInfo) {
await new Promise(r => setTimeout(r, 1000)); await new Promise(r => setTimeout(r, 1000));
const data = await this.downloadEmotes(emoteInfo[e]); const data = await this.downloadEmotes(emoteInfo[e]);
window.bdEmotes[emoteInfo[e].variable] = data; Emotes[emoteInfo[e].variable] = data;
} }
if (SettingsCookie["fork-ps-2"]) BdApi.showToast("All emotes successfully downloaded.", {type: "success"}); if (SettingsCookie["fork-ps-2"]) BdApi.showToast("All emotes successfully downloaded.", {type: "success"});
try { _fs.writeFileSync(file, JSON.stringify(window.bdEmotes), "utf8"); } try { _fs.writeFileSync(file, JSON.stringify(Emotes), "utf8"); }
catch (err) { Utilities.err("Emotes", "Could not save emote data.", err); } catch (err) { Utilities.err("Emotes", "Could not save emote data.", err); }
}; };
@ -333,7 +312,7 @@ EmoteModule.prototype.autoCapitalize = function () {
}; };
EmoteModule.prototype.capitalize = function (value) { EmoteModule.prototype.capitalize = function (value) {
const res = window.bdEmotes.TwitchGlobal; const res = Emotes.TwitchGlobal;
for (const p in res) { for (const p in res) {
if (res.hasOwnProperty(p) && value == (p + "").toLowerCase()) { if (res.hasOwnProperty(p) && value == (p + "").toLowerCase()) {
return p; return p;

View File

@ -1,6 +1,12 @@
import Utilities from "./utilities";
import WebpackModules, {DiscordModules} from "./webpackmodules";
import BDV2 from "./bdv2"; import BDV2 from "./bdv2";
import BdApi from "./pluginapi"; import BdApi from "./pluginapi";
import Core from "./core"; import Core from "./core";
import ClassNormalizer from "./classnormalizer"; import ClassNormalizer from "./classnormalizer";
import ContentManager from "./contentmanager"; import ContentManager from "./contentmanager";
import DataStore from "./datastore"; import DataStore from "./datastore";
@ -9,11 +15,19 @@ import Emitter from "./emitter";
import EmoteMenu from "./emotemenu"; import EmoteMenu from "./emotemenu";
import EmoteModule from "./emotes"; import EmoteModule from "./emotes";
import PluginManager from "./pluginmanager"; import PluginManager from "./pluginmanager";
import PublicServer from "./publicservers"; // import PublicServers from "./publicservers";
import ThemeManager from "./thememanager"; import ThemeManager from "./thememanager";
import VoiceMode from "./voicemode"; import VoiceMode from "./voicemode";
import Utilities from "./utilities";
export const React = DiscordModules.React;
export const ReactDOM = DiscordModules.ReactDOM;
export {BDV2, BdApi, Core, ClassNormalizer, ContentManager, DataStore, DevMode, export {BDV2, BdApi, Core, ClassNormalizer, ContentManager, DataStore, DevMode,
Emitter, EmoteMenu, EmoteModule, PluginManager, PublicServer, ThemeManager, Emitter, EmoteMenu, EmoteModule, PluginManager, /*PublicServers,*/ ThemeManager,
VoiceMode, Utilities}; VoiceMode, Utilities, WebpackModules, DiscordModules};
// export {{
// get React() {return DiscordModules.React;}
// }}

View File

@ -1,36 +1,39 @@
import {Config, Plugins, SettingsCookie, PluginCookie, ThemeCookie} from "data"; import {Plugins, SettingsCookie, PluginCookie, ThemeCookie} from "data";
import Utilities from "./utilities"; import Utilities from "./utilities";
import BDV2 from "./bdv2"; import WebpackModules, {DiscordModules} from "./webpackmodules";
import DataStore from "./datastore"; import DataStore from "./datastore";
import Core from "./core"; import Core from "./core";
const BdApi = { const BdApi = {
get React() { return BDV2.react; }, get React() { return DiscordModules.React; },
get ReactDOM() { return BDV2.reactDom; }, get ReactDOM() { return DiscordModules.ReactDOM; },
get WindowConfigFile() { get WindowConfigFile() {
if (this._windowConfigFile) return this._windowConfigFile; if (this._windowConfigFile) return this._windowConfigFile;
const base = require("electron").remote.app.getAppPath(); const electron = require("electron").remote.app;
const path = require("path"); const path = require("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 location = path.resolve(base, "..", "app", "config.json");
const fs = require("fs"); const fs = require("fs");
if (!fs.existsSync(path.resolve(base, "..", "app"))) return this._windowConfigFile = null; const realLocation = fs.existsSync(location) ? location : fs.existsSync(roamingLocation) ? roamingLocation : null;
if (!fs.existsSync(location)) fs.writeFileSync(location, JSON.stringify({})); if (!realLocation) return this._windowConfigFile = null;
return this._windowConfigFile = location; return this._windowConfigFile = realLocation;
} }
}; };
BdApi.getAllWindowPreferences = function() { BdApi.getAllWindowPreferences = function() {
if ((Config.os !== "win32" && Config.os !== "darwin") || !this.WindowConfigFile) return {}; // Tempfix until new injection on other platforms if (!this.WindowConfigFile) return {};
return __non_webpack_require__(this.WindowConfigFile); return __non_webpack_require__(this.WindowConfigFile);
}; };
BdApi.getWindowPreference = function(key) { BdApi.getWindowPreference = function(key) {
if ((Config.os !== "win32" && Config.os !== "darwin") || !this.WindowConfigFile) return undefined; // Tempfix until new injection on other platforms if (!this.WindowConfigFile) return undefined;
return this.getAllWindowPreferences()[key]; return this.getAllWindowPreferences()[key];
}; };
BdApi.setWindowPreference = function(key, value) { BdApi.setWindowPreference = function(key, value) {
if ((Config.os !== "win32" && Config.os !== "darwin") || !this.WindowConfigFile) return; // Tempfix until new injection on other platforms if (!this.WindowConfigFile) return;
const fs = require("fs"); const fs = require("fs");
const prefs = this.getAllWindowPreferences(); const prefs = this.getAllWindowPreferences();
prefs[key] = value; prefs[key] = value;
@ -140,32 +143,32 @@ BdApi.showToast = function(content, options = {}) {
// Finds module // Finds module
BdApi.findModule = function(filter) { BdApi.findModule = function(filter) {
return BDV2.WebpackModules.find(filter); return WebpackModules.getModule(filter);
}; };
// Finds module // Finds module
BdApi.findAllModules = function(filter) { BdApi.findAllModules = function(filter) {
return BDV2.WebpackModules.findAll(filter); return WebpackModules.getModule(filter, false);
}; };
// Finds module // Finds module
BdApi.findModuleByProps = function(...props) { BdApi.findModuleByProps = function(...props) {
return BDV2.WebpackModules.findByUniqueProperties(props); return WebpackModules.getByProps(...props);
}; };
BdApi.findModuleByPrototypes = function(...protos) { BdApi.findModuleByPrototypes = function(...protos) {
return BDV2.WebpackModules.findByPrototypes(protos); return WebpackModules.getByPrototypes(...protos);
}; };
BdApi.findModuleByDisplayName = function(name) { BdApi.findModuleByDisplayName = function(name) {
return BDV2.WebpackModules.findByDisplayName(name); return WebpackModules.getByDisplayName(name);
}; };
// Gets react instance // Gets react instance
BdApi.getInternalInstance = function(node) { BdApi.getInternalInstance = function(node) {
if (!(node instanceof window.jQuery) && !(node instanceof Element)) return undefined; if (!(node instanceof window.jQuery) && !(node instanceof Element)) return undefined;
if (node instanceof jQuery) node = node[0]; if (node instanceof jQuery) node = node[0];
return BDV2.getInternalInstance(node); return Utilities.getInternalInstance(node);
}; };
// Gets data // Gets data

View File

@ -59,7 +59,7 @@ PluginModule.prototype.startPlugin = function(plugin, reload = false) {
if (SettingsCookie["fork-ps-2"] && !reload) Core.showToast(`${Plugins[plugin].plugin.getName()} v${Plugins[plugin].plugin.getVersion()} could not be started.`, {type: "error"}); if (SettingsCookie["fork-ps-2"] && !reload) Core.showToast(`${Plugins[plugin].plugin.getName()} v${Plugins[plugin].plugin.getVersion()} could not be started.`, {type: "error"});
PluginCookie[plugin] = false; PluginCookie[plugin] = false;
this.savePluginData(); this.savePluginData();
Utilities.err("Plugins", name + " could not be started.", err); Utilities.err("Plugins", plugin + " could not be started.", err);
} }
}; };

View File

@ -1,5 +1,5 @@
import {SettingsCookie} from "data"; import {SettingsCookie} from "data";
import {BDV2} from "modules"; import {BDV2, DiscordModules} from "modules";
import {PublicServers} from "ui"; import {PublicServers} from "ui";
export default new class { export default new class {
@ -11,10 +11,10 @@ export default new class {
} }
get component() { get component() {
return BDV2.react.createElement(PublicServers.Layer, { return DiscordModules.React.createElement(PublicServers.Layer, {
rootId: "pubslayerroot", rootId: "pubslayerroot",
id: "pubslayer", id: "pubslayer",
children: BDV2.react.createElement(PublicServers.Menu, {rootId: "pubslayerroot"}) children: DiscordModules.React.createElement(PublicServers.Menu, {rootId: "pubslayerroot"})
}); });
} }
@ -42,7 +42,7 @@ export default new class {
console.log("FAILED TO LOCATE ROOT: .layers"); console.log("FAILED TO LOCATE ROOT: .layers");
return; return;
} }
BDV2.reactDom.render(this.component, root); DiscordModules.ReactDOM.render(this.component, root);
} }
get button() { get button() {

View File

@ -153,7 +153,7 @@ export default class Utilities {
get: function(obj, mod) { get: function(obj, mod) {
if (!obj.hasOwnProperty(mod)) return undefined; if (!obj.hasOwnProperty(mod)) return undefined;
if (Object.getOwnPropertyDescriptor(obj, mod).get) { if (Object.getOwnPropertyDescriptor(obj, mod).get) {
let value = obj[mod]; const value = obj[mod];
delete obj[mod]; delete obj[mod];
obj[mod] = value; obj[mod] = value;
} }

View File

@ -0,0 +1,388 @@
/**
* Allows for grabbing and searching through Discord's webpacked modules.
* @module WebpackModules
* @version 0.0.2
*/
import Utilities from "./utilities";
const DiscordModules = Utilities.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");},
/* 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");}
});
export {DiscordModules};
/**
* 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.
*/
export 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));
};
}
}
export default 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;
}
}

View File

@ -1,9 +1,9 @@
import {SettingsCookie} from "data"; import {SettingsCookie} from "data";
import {BDV2, DataStore, Core} from "modules"; import {BDV2, DataStore, Core, DiscordModules} from "modules";
import Checkbox from "../settings/checkbox"; import Checkbox from "../settings/checkbox";
export default class V2C_CssEditorDetached extends BDV2.reactComponent { export default class V2C_CssEditorDetached extends DiscordModules.React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -81,48 +81,48 @@ export default class V2C_CssEditorDetached extends BDV2.reactComponent {
render() { render() {
const self = this; const self = this;
return BDV2.react.createElement( return DiscordModules.React.createElement(
"div", "div",
{className: "bd-detached-css-editor", id: "bd-customcss-detach-editor"}, {className: "bd-detached-css-editor", id: "bd-customcss-detach-editor"},
BDV2.react.createElement( DiscordModules.React.createElement(
"div", "div",
{id: "bd-customcss-innerpane"}, {id: "bd-customcss-innerpane"},
BDV2.react.createElement("div", {className: "editor-wrapper"}, DiscordModules.React.createElement("div", {className: "editor-wrapper"},
BDV2.react.createElement("div", {id: "bd-customcss-editor-detached", className: "editor", ref: "editor"}, self.css) DiscordModules.React.createElement("div", {id: "bd-customcss-editor-detached", className: "editor", ref: "editor"}, self.css)
), ),
BDV2.react.createElement( DiscordModules.React.createElement(
"div", "div",
{id: "bd-customcss-attach-controls"}, {id: "bd-customcss-attach-controls"},
BDV2.react.createElement( DiscordModules.React.createElement(
"ul", "ul",
{className: "checkbox-group"}, {className: "checkbox-group"},
BDV2.react.createElement(Checkbox, {id: "live-update", text: "Live Update", onChange: self.onChange, checked: SettingsCookie["bda-css-0"]}) DiscordModules.React.createElement(Checkbox, {id: "live-update", text: "Live Update", onChange: self.onChange, checked: SettingsCookie["bda-css-0"]})
), ),
BDV2.react.createElement( DiscordModules.React.createElement(
"div", "div",
{id: "bd-customcss-detach-controls-button"}, {id: "bd-customcss-detach-controls-button"},
BDV2.react.createElement( DiscordModules.React.createElement(
"button", "button",
{style: {borderRadius: "3px 0 0 3px", borderRight: "1px solid #3f4146"}, className: "btn btn-primary", onClick: () => { {style: {borderRadius: "3px 0 0 3px", borderRight: "1px solid #3f4146"}, className: "btn btn-primary", onClick: () => {
self.onClick("update"); self.onClick("update");
}}, }},
"Update" "Update"
), ),
BDV2.react.createElement( DiscordModules.React.createElement(
"button", "button",
{style: {borderRadius: "0", borderLeft: "1px solid #2d2d2d", borderRight: "1px solid #2d2d2d"}, className: "btn btn-primary", onClick: () => { {style: {borderRadius: "0", borderLeft: "1px solid #2d2d2d", borderRight: "1px solid #2d2d2d"}, className: "btn btn-primary", onClick: () => {
self.onClick("save"); self.onClick("save");
}}, }},
"Save" "Save"
), ),
BDV2.react.createElement( DiscordModules.React.createElement(
"button", "button",
{style: {borderRadius: "0 3px 3px 0", borderLeft: "1px solid #3f4146"}, className: "btn btn-primary", onClick: () => { {style: {borderRadius: "0 3px 3px 0", borderLeft: "1px solid #3f4146"}, className: "btn btn-primary", onClick: () => {
self.onClick("attach"); self.onClick("attach");
}}, }},
"Attach" "Attach"
), ),
BDV2.react.createElement( DiscordModules.React.createElement(
"span", "span",
{style: {fontSize: "10px", marginLeft: "5px"}}, {style: {fontSize: "10px", marginLeft: "5px"}},
"Unsaved changes are lost on attach" "Unsaved changes are lost on attach"
@ -147,7 +147,7 @@ export default class V2C_CssEditorDetached extends BDV2.reactComponent {
switch (id) { switch (id) {
case "attach": case "attach":
if ($("#editor-detached").length) self.props.attach(); if ($("#editor-detached").length) self.props.attach();
BDV2.reactDom.unmountComponentAtNode(self.root); DiscordModules.ReactDOM.unmountComponentAtNode(self.root);
self.root.remove(); self.root.remove();
break; break;
case "update": case "update":

View File

@ -1,18 +1,18 @@
import {SettingsCookie} from "data"; import {SettingsCookie} from "data";
import {BDV2, DataStore, Core} from "modules"; import {BDV2, DataStore, Core, DiscordModules} from "modules";
import EditorDetached from "./detached"; import EditorDetached from "./detached";
import Checkbox from "../settings/checkbox"; import Checkbox from "../settings/checkbox";
import SettingsTitle from "../settings/title"; import SettingsTitle from "../settings/title";
export default class V2C_CssEditor extends BDV2.reactComponent { export default class V2C_CssEditor extends DiscordModules.React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.props.lines = 0; this.props.lines = 0;
this.setInitialState(); this.setInitialState();
this.attach = this.attach.bind(this); this.attach = this.attach.bind(this);
this.detachedEditor = BDV2.react.createElement(EditorDetached, {attach: this.attach}); this.detachedEditor = DiscordModules.React.createElement(EditorDetached, {attach: this.attach});
this.onClick = this.onClick.bind(this); this.onClick = this.onClick.bind(this);
this.updateCss = this.updateCss.bind(this); this.updateCss = this.updateCss.bind(this);
this.saveCss = this.saveCss.bind(this); this.saveCss = this.saveCss.bind(this);
@ -45,7 +45,7 @@ export default class V2C_CssEditor extends BDV2.reactComponent {
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if (prevState.detached && !this.state.detached) { if (prevState.detached && !this.state.detached) {
BDV2.reactDom.unmountComponentAtNode(this.detachedRoot); DiscordModules.ReactDOM.unmountComponentAtNode(this.detachedRoot);
} }
} }
@ -82,19 +82,19 @@ export default class V2C_CssEditor extends BDV2.reactComponent {
const self = this; const self = this;
const {detached} = self.state; const {detached} = self.state;
return BDV2.react.createElement( return DiscordModules.React.createElement(
"div", "div",
{className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default", style: {padding: "60px 40px 0px"}}, {className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default", style: {padding: "60px 40px 0px"}},
detached && BDV2.react.createElement( detached && DiscordModules.React.createElement(
"div", "div",
{id: "editor-detached"}, {id: "editor-detached"},
BDV2.react.createElement(SettingsTitle, {text: "Custom CSS Editor"}), DiscordModules.React.createElement(SettingsTitle, {text: "Custom CSS Editor"}),
BDV2.react.createElement( DiscordModules.React.createElement(
"h3", "h3",
null, null,
"Editor Detached" "Editor Detached"
), ),
BDV2.react.createElement( DiscordModules.React.createElement(
"button", "button",
{className: "btn btn-primary", onClick: () => { {className: "btn btn-primary", onClick: () => {
self.attach(); self.attach();
@ -102,55 +102,55 @@ export default class V2C_CssEditor extends BDV2.reactComponent {
"Attach" "Attach"
) )
), ),
!detached && BDV2.react.createElement( !detached && DiscordModules.React.createElement(
"div", "div",
null, null,
BDV2.react.createElement(SettingsTitle, {text: "Custom CSS Editor"}), DiscordModules.React.createElement(SettingsTitle, {text: "Custom CSS Editor"}),
BDV2.react.createElement("div", {className: "editor-wrapper"}, DiscordModules.React.createElement("div", {className: "editor-wrapper"},
BDV2.react.createElement("div", {id: "bd-customcss-editor", className: "editor", ref: "editor"}, self.css) DiscordModules.React.createElement("div", {id: "bd-customcss-editor", className: "editor", ref: "editor"}, self.css)
), ),
BDV2.react.createElement( DiscordModules.React.createElement(
"div", "div",
{id: "bd-customcss-attach-controls"}, {id: "bd-customcss-attach-controls"},
BDV2.react.createElement( DiscordModules.React.createElement(
"ul", "ul",
{className: "checkbox-group"}, {className: "checkbox-group"},
BDV2.react.createElement(Checkbox, {id: "live-update", text: "Live Update", onChange: this.onChange, checked: SettingsCookie["bda-css-0"]}) DiscordModules.React.createElement(Checkbox, {id: "live-update", text: "Live Update", onChange: this.onChange, checked: SettingsCookie["bda-css-0"]})
), ),
BDV2.react.createElement( DiscordModules.React.createElement(
"div", "div",
{id: "bd-customcss-detach-controls-button"}, {id: "bd-customcss-detach-controls-button"},
BDV2.react.createElement( DiscordModules.React.createElement(
"button", "button",
{style: {borderRadius: "3px 0 0 3px", borderRight: "1px solid #3f4146"}, className: "btn btn-primary", onClick: () => { {style: {borderRadius: "3px 0 0 3px", borderRight: "1px solid #3f4146"}, className: "btn btn-primary", onClick: () => {
self.onClick("update"); self.onClick("update");
}}, }},
"Update" "Update"
), ),
BDV2.react.createElement( DiscordModules.React.createElement(
"button", "button",
{style: {borderRadius: "0", borderLeft: "1px solid #2d2d2d", borderRight: "1px solid #2d2d2d"}, className: "btn btn-primary", onClick: () => { {style: {borderRadius: "0", borderLeft: "1px solid #2d2d2d", borderRight: "1px solid #2d2d2d"}, className: "btn btn-primary", onClick: () => {
self.onClick("save"); self.onClick("save");
}}, }},
"Save" "Save"
), ),
BDV2.react.createElement( DiscordModules.React.createElement(
"button", "button",
{style: {borderRadius: "0 3px 3px 0", borderLeft: "1px solid #3f4146"}, className: "btn btn-primary", onClick: () => { {style: {borderRadius: "0 3px 3px 0", borderLeft: "1px solid #3f4146"}, className: "btn btn-primary", onClick: () => {
self.onClick("detach"); self.onClick("detach");
}}, }},
"Detach" "Detach"
), ),
BDV2.react.createElement( DiscordModules.React.createElement(
"span", "span",
{style: {fontSize: "10px", marginLeft: "5px"}}, {style: {fontSize: "10px", marginLeft: "5px"}},
"Unsaved changes are lost on detach" "Unsaved changes are lost on detach"
), ),
BDV2.react.createElement("div", {className: "help-text"}, DiscordModules.React.createElement("div", {className: "help-text"},
"Press ", "Press ",
BDV2.react.createElement("code", {className: "inline"}, "ctrl"), DiscordModules.React.createElement("code", {className: "inline"}, "ctrl"),
"+", "+",
BDV2.react.createElement("span", {className: "inline"}, ","), DiscordModules.React.createElement("span", {className: "inline"}, ","),
" with the editor focused to access the editor's settings." " with the editor focused to access the editor's settings."
) )
) )
@ -202,7 +202,7 @@ export default class V2C_CssEditor extends BDV2.reactComponent {
console.log("FAILED TO INJECT ROOT: .app"); console.log("FAILED TO INJECT ROOT: .app");
return; return;
} }
BDV2.reactDom.render(this.detachedEditor, droot); DiscordModules.ReactDOM.render(this.detachedEditor, droot);
} }
get detachedRoot() { get detachedRoot() {

View File

@ -1,7 +1,7 @@
import {SettingsCookie} from "data"; import {SettingsCookie} from "data";
import {BDV2, EmoteMenu} from "modules"; import {BDV2, EmoteMenu, DiscordModules} from "modules";
export default class BDEmote extends BDV2.reactComponent { export default class BDEmote extends DiscordModules.React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -43,26 +43,26 @@ export default class BDEmote extends BDV2.reactComponent {
} }
render() { render() {
return BDV2.react.createElement(BDV2.TooltipWrapper, { return DiscordModules.React.createElement(BDV2.TooltipWrapper, {
color: "black", color: "black",
position: "top", position: "top",
text: this.label, text: this.label,
delay: 750 delay: 750
}, },
BDV2.react.createElement("div", { DiscordModules.React.createElement("div", {
className: "emotewrapper" + (this.props.jumboable ? " jumboable" : ""), className: "emotewrapper" + (this.props.jumboable ? " jumboable" : ""),
onMouseEnter: this.onMouseEnter, onMouseEnter: this.onMouseEnter,
onMouseLeave: this.onMouseLeave, onMouseLeave: this.onMouseLeave,
onClick: this.onClick onClick: this.onClick
}, },
BDV2.react.createElement("img", { DiscordModules.React.createElement("img", {
draggable: false, draggable: false,
className: "emote" + this.modifierClass + (this.props.jumboable ? " jumboable" : "") + (!this.state.shouldAnimate ? " stop-animation" : ""), className: "emote" + this.modifierClass + (this.props.jumboable ? " jumboable" : "") + (!this.state.shouldAnimate ? " stop-animation" : ""),
dataModifier: this.props.modifier, dataModifier: this.props.modifier,
alt: this.label, alt: this.label,
src: this.props.url src: this.props.url
}), }),
BDV2.react.createElement("input", { DiscordModules.React.createElement("input", {
className: "fav" + (this.state.isFavorite ? " active" : ""), className: "fav" + (this.state.isFavorite ? " active" : ""),
title: "Favorite!", title: "Favorite!",
type: "button", type: "button",

View File

@ -1,20 +1,19 @@
import {BDV2} from "modules"; import {React} from "modules";
export default class BDLogo extends BDV2.reactComponent { export default class BDLogo extends React.Component {
render() { render() {
return BDV2.react.createElement( return React.createElement("svg",
"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"}, {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"},
BDV2.react.createElement("metadata", null), React.createElement("metadata", null),
BDV2.react.createElement("defs", null, React.createElement("defs", null,
BDV2.react.createElement("filter", {id: "shadow1"}, BDV2.react.createElement("feDropShadow", {"dx": "20", "dy": "0", "stdDeviation": "20", "flood-color": "rgba(0,0,0,0.35)"})), React.createElement("filter", {id: "shadow1"}, React.createElement("feDropShadow", {"dx": "20", "dy": "0", "stdDeviation": "20", "flood-color": "rgba(0,0,0,0.35)"})),
BDV2.react.createElement("filter", {id: "shadow2"}, BDV2.react.createElement("feDropShadow", {"dx": "15", "dy": "0", "stdDeviation": "20", "flood-color": "rgba(255,255,255,0.15)"})), React.createElement("filter", {id: "shadow2"}, React.createElement("feDropShadow", {"dx": "15", "dy": "0", "stdDeviation": "20", "flood-color": "rgba(255,255,255,0.15)"})),
BDV2.react.createElement("filter", {id: "shadow3"}, BDV2.react.createElement("feDropShadow", {"dx": "10", "dy": "0", "stdDeviation": "20", "flood-color": "rgba(0,0,0,0.35)"})) React.createElement("filter", {id: "shadow3"}, React.createElement("feDropShadow", {"dx": "10", "dy": "0", "stdDeviation": "20", "flood-color": "rgba(0,0,0,0.35)"}))
), ),
BDV2.react.createElement("g", null, React.createElement("g", null,
BDV2.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"}), 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"}),
BDV2.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"}), 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"}),
BDV2.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"}) 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"})
) )
); );
} }

View File

@ -1,19 +1,19 @@
import {BDV2} from "modules"; import {React} from "modules";
export default class V2C_XSvg extends BDV2.reactComponent { export default class V2C_XSvg extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
render() { render() {
return BDV2.react.createElement( return React.createElement(
"svg", "svg",
{xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 12", style: {width: "18px", height: "18px"}}, {xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 12", style: {width: "18px", height: "18px"}},
BDV2.react.createElement( React.createElement(
"g", "g",
{className: "background", fill: "none", fillRule: "evenodd"}, {className: "background", fill: "none", fillRule: "evenodd"},
BDV2.react.createElement("path", {d: "M0 0h12v12H0"}), React.createElement("path", {d: "M0 0h12v12H0"}),
BDV2.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"}) 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"})
) )
); );
} }

View File

@ -1,12 +1,12 @@
import {BDV2} from "modules"; import {React} from "modules";
export default class V2C_ReloadIcon extends BDV2.reactComponent { export default class V2C_ReloadIcon extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
render() { render() {
return BDV2.react.createElement("svg", { return React.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg", xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24", viewBox: "0 0 24 24",
fill: "#dcddde", fill: "#dcddde",
@ -14,8 +14,8 @@ export default class V2C_ReloadIcon extends BDV2.reactComponent {
onClick: this.props.onClick, onClick: this.props.onClick,
style: {width: this.props.size || "24px", height: this.props.size || "24px"} style: {width: this.props.size || "24px", height: this.props.size || "24px"}
}, },
BDV2.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"}), 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"}),
BDV2.react.createElement("path", {fill: "none", d: "M0 0h24v24H0z"}) React.createElement("path", {fill: "none", d: "M0 0h24v24H0z"})
); );
} }
} }

View File

@ -1,6 +1,6 @@
import {BDV2} from "modules"; import {React, ReactDOM} from "modules";
export default class V2C_Layer extends BDV2.reactComponent { export default class V2C_Layer extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -9,7 +9,7 @@ export default class V2C_Layer extends BDV2.reactComponent {
componentDidMount() { componentDidMount() {
$(window).on(`keyup.${this.props.id}`, e => { $(window).on(`keyup.${this.props.id}`, e => {
if (e.which === 27) { if (e.which === 27) {
BDV2.reactDom.unmountComponentAtNode(this.refs.root.parentNode); ReactDOM.unmountComponentAtNode(this.refs.root.parentNode);
} }
}); });
@ -52,7 +52,7 @@ export default class V2C_Layer extends BDV2.reactComponent {
} }
render() { render() {
return BDV2.react.createElement( return React.createElement(
"div", "div",
{className: "layer bd-layer layer-3QrUeG", id: this.props.id, ref: "root", style: {opacity: 0, transform: "scale(1.1) translateZ(0px)"}}, {className: "layer bd-layer layer-3QrUeG", id: this.props.id, ref: "root", style: {opacity: 0, transform: "scale(1.1) translateZ(0px)"}},
this.props.children this.props.children

View File

@ -1,15 +0,0 @@
import {BDV2} from "modules";
export default class V2C_List extends BDV2.reactComponent {
constructor(props) {
super(props);
}
render() {
return BDV2.react.createElement(
"ul",
{className: this.props.className},
this.props.children
);
}
}

11
src/ui/list.jsx Normal file
View File

@ -0,0 +1,11 @@
import {React} from "modules";
export default class V2C_List extends React.Component {
constructor(props) {
super(props);
}
render() {
return <ul className={this.props.className}>{this.props.children}</ul>;
}
}

View File

@ -1,6 +1,6 @@
import {BDV2} from "modules"; import {React} from "modules";
export default class V2C_ServerCard extends BDV2.reactComponent { export default class V2C_ServerCard extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
if (!this.props.server.iconUrl) this.props.server.iconUrl = this.props.fallback; if (!this.props.server.iconUrl) this.props.server.iconUrl = this.props.fallback;
@ -12,74 +12,74 @@ export default class V2C_ServerCard extends BDV2.reactComponent {
render() { render() {
const {server} = this.props; const {server} = this.props;
return BDV2.react.createElement( return React.createElement(
"div", // cardPrimary-1Hv-to "div", // cardPrimary-1Hv-to
{className: `card-3Qj_Yx cardPrimary-1Hv-to marginBottom8-AtZOdT bd-server-card${server.pinned ? " bd-server-card-pinned" : ""}`}, {className: `card-3Qj_Yx cardPrimary-1Hv-to marginBottom8-AtZOdT bd-server-card${server.pinned ? " bd-server-card-pinned" : ""}`},
// BDV2.react.createElement( // React.createElement(
// "div", // "div",
// { className: "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY flex-1O1GKY directionRow-3v3tfG justifyStart-2yIZo0 alignStretch-1hwxMa noWrap-3jynv6" }, // { className: "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY flex-1O1GKY directionRow-3v3tfG justifyStart-2yIZo0 alignStretch-1hwxMa noWrap-3jynv6" },
BDV2.react.createElement("img", {ref: "img", className: "bd-server-image", src: server.iconUrl, onError: this.handleError.bind(this)}), React.createElement("img", {ref: "img", className: "bd-server-image", src: server.iconUrl, onError: this.handleError.bind(this)}),
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "flexChild-faoVW3 bd-server-content"}, {className: "flexChild-faoVW3 bd-server-content"},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-header"}, {className: "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-header"},
BDV2.react.createElement( React.createElement(
"h5", "h5",
{className: "h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"}, {className: "h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"},
server.name server.name
), ),
BDV2.react.createElement( React.createElement(
"h5", "h5",
{className: "h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"}, {className: "h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"},
server.members, server.members,
" Members" " Members"
) )
), ),
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6"}, {className: "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6"},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"}, {className: "scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "scroller-2FKFPG scroller bd-server-description"}, {className: "scroller-2FKFPG scroller bd-server-description"},
server.description server.description
) )
) )
), ),
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"}, {className: "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "flexChild-faoVW3 bd-server-tags", style: {flex: "1 1 auto"}}, {className: "flexChild-faoVW3 bd-server-tags", style: {flex: "1 1 auto"}},
server.categories.join(", ") server.categories.join(", ")
), ),
this.state.joined && BDV2.react.createElement( this.state.joined && React.createElement(
"button", "button",
{type: "button", className: "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN colorGreen-29iAKY", style: {minHeight: "12px", marginTop: "4px", backgroundColor: "#3ac15c"}}, {type: "button", className: "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN colorGreen-29iAKY", style: {minHeight: "12px", marginTop: "4px", backgroundColor: "#3ac15c"}},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "ui-button-contents"}, {className: "ui-button-contents"},
"Joined" "Joined"
) )
), ),
server.error && BDV2.react.createElement( server.error && React.createElement(
"button", "button",
{type: "button", className: "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN disabled-9aF2ug", style: {minHeight: "12px", marginTop: "4px", backgroundColor: "#c13a3a"}}, {type: "button", className: "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN disabled-9aF2ug", style: {minHeight: "12px", marginTop: "4px", backgroundColor: "#c13a3a"}},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "ui-button-contents"}, {className: "ui-button-contents"},
"Error" "Error"
) )
), ),
!server.error && !this.state.joined && BDV2.react.createElement( !server.error && !this.state.joined && React.createElement(
"button", "button",
{type: "button", className: "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN", style: {minHeight: "12px", marginTop: "4px"}, onClick: () => {this.join();}}, {type: "button", className: "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN", style: {minHeight: "12px", marginTop: "4px"}, onClick: () => {this.join();}},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "ui-button-contents"}, {className: "ui-button-contents"},
"Join" "Join"

View File

@ -1,11 +1,11 @@
import {BDV2} from "modules"; import {React, ReactDOM, WebpackModules} from "modules";
import SidebarView from "../sidebarview"; import SidebarView from "../sidebarview";
import Tools from "../settings/exitbutton"; import Tools from "../settings/exitbutton";
import TabBar from "../settings/tabbar"; import TabBar from "../settings/tabbar";
import SettingsTitle from "../settings/title"; import SettingsTitle from "../settings/title";
import ServerCard from "./card"; import ServerCard from "./card";
export default class V2C_PublicServers extends BDV2.reactComponent { export default class V2C_PublicServers extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -18,10 +18,10 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
this.join = this.join.bind(this); this.join = this.join.bind(this);
this.connect = this.connect.bind(this); this.connect = this.connect.bind(this);
this.GuildStore = BDV2.WebpackModules.findByUniqueProperties(["getGuilds"]); this.GuildStore = WebpackModules.getByProps("getGuilds");
this.AvatarDefaults = BDV2.WebpackModules.findByUniqueProperties(["getUserAvatarURL", "DEFAULT_AVATARS"]); this.AvatarDefaults = WebpackModules.getByProps("getUserAvatarURL", "DEFAULT_AVATARS");
this.InviteActions = BDV2.WebpackModules.findByUniqueProperties(["acceptInvite"]); this.InviteActions = WebpackModules.getByProps("acceptInvite");
this.SortedGuildStore = BDV2.WebpackModules.findByUniqueProperties(["getSortedGuilds"]); this.SortedGuildStore = WebpackModules.getByProps("getSortedGuilds");
} }
componentDidMount() { componentDidMount() {
@ -43,7 +43,7 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
} }
close() { close() {
BDV2.reactDom.unmountComponentAtNode(document.getElementById(this.props.rootId)); ReactDOM.unmountComponentAtNode(document.getElementById(this.props.rootId));
} }
search(query, clear) { search(query, clear) {
@ -168,7 +168,7 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
}; };
const guildList = this.SortedGuildStore.guildPositions; const guildList = this.SortedGuildStore.guildPositions;
const defaultList = this.AvatarDefaults.DEFAULT_AVATARS; const defaultList = this.AvatarDefaults.DEFAULT_AVATARS;
return BDV2.react.createElement(ServerCard, {server: server, pinned: true, join: this.join, guildList: guildList, fallback: defaultList[Math.floor(Math.random() * 5)]}); return React.createElement(ServerCard, {server: server, pinned: true, join: this.join, guildList: guildList, fallback: defaultList[Math.floor(Math.random() * 5)]});
} }
get endPoint() { get endPoint() {
@ -236,7 +236,7 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
} }
render() { render() {
return BDV2.react.createElement(SidebarView, {ref: "sbv", children: this.component}); return React.createElement(SidebarView, {ref: "sbv", children: this.component});
} }
get component() { get component() {
@ -248,31 +248,31 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
component: this.content component: this.content
}, },
tools: { tools: {
component: BDV2.react.createElement(Tools, {key: "pt", ref: "tools", onClick: this.close}) component: React.createElement(Tools, {key: "pt", ref: "tools", onClick: this.close})
} }
}; };
} }
get sidebar() { get sidebar() {
return BDV2.react.createElement( return React.createElement(
"div", "div",
{className: "sidebar", key: "ps"}, {className: "sidebar", key: "ps"},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "ui-tab-bar SIDE"}, {className: "ui-tab-bar SIDE"},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "ui-tab-bar-header", style: {fontSize: "16px"}}, {className: "ui-tab-bar-header", style: {fontSize: "16px"}},
"Public Servers" "Public Servers"
), ),
BDV2.react.createElement(TabBar.Separator, null), React.createElement(TabBar.Separator, null),
this.searchInput, this.searchInput,
BDV2.react.createElement(TabBar.Separator, null), React.createElement(TabBar.Separator, null),
BDV2.react.createElement(TabBar.Header, {text: "Categories"}), React.createElement(TabBar.Header, {text: "Categories"}),
this.categoryButtons.map((value, index) => { this.categoryButtons.map((value, index) => {
return BDV2.react.createElement(TabBar.Item, {id: index, onClick: this.changeCategory, key: index, text: value, selected: this.state.selectedCategory === index}); return React.createElement(TabBar.Item, {id: index, onClick: this.changeCategory, key: index, text: value, selected: this.state.selectedCategory === index});
}), }),
BDV2.react.createElement(TabBar.Separator, null), React.createElement(TabBar.Separator, null),
this.footer, this.footer,
this.connection this.connection
) )
@ -280,13 +280,13 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
} }
get searchInput() { get searchInput() {
return BDV2.react.createElement( return React.createElement(
"div", "div",
{className: "ui-form-item"}, {className: "ui-form-item"},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "ui-text-input flex-vertical", style: {width: "172px", marginLeft: "10px"}}, {className: "ui-text-input flex-vertical", style: {width: "172px", marginLeft: "10px"}},
BDV2.react.createElement("input", {ref: "searchinput", onKeyDown: this.searchKeyDown, onChange: () => {}, type: "text", className: "input default", placeholder: "Search...", maxLength: "50"}) React.createElement("input", {ref: "searchinput", onKeyDown: this.searchKeyDown, onChange: () => {}, type: "text", className: "input default", placeholder: "Search...", maxLength: "50"})
) )
); );
} }
@ -332,40 +332,40 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
const guildList = this.SortedGuildStore.guildPositions; const guildList = this.SortedGuildStore.guildPositions;
const defaultList = this.AvatarDefaults.DEFAULT_AVATARS; const defaultList = this.AvatarDefaults.DEFAULT_AVATARS;
if (self.state.connection.state === 1) return self.notConnected; if (self.state.connection.state === 1) return self.notConnected;
return [BDV2.react.createElement( return [React.createElement(
"div", "div",
{ref: "content", key: "pc", className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"}, {ref: "content", key: "pc", className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},
BDV2.react.createElement(SettingsTitle, {text: self.state.title}), React.createElement(SettingsTitle, {text: self.state.title}),
self.bdServer, self.bdServer,
self.state.servers.map((server) => { self.state.servers.map((server) => {
return BDV2.react.createElement(ServerCard, {key: server.identifier, server: server, join: self.join, guildList: guildList, fallback: defaultList[Math.floor(Math.random() * 5)]}); return React.createElement(ServerCard, {key: server.identifier, server: server, join: self.join, guildList: guildList, fallback: defaultList[Math.floor(Math.random() * 5)]});
}), }),
self.state.next && BDV2.react.createElement( self.state.next && React.createElement(
"button", "button",
{type: "button", onClick: () => { {type: "button", onClick: () => {
if (self.state.loading) return;self.setState({loading: true}); self.search(self.state.next, false); 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"}}, }, className: "ui-button filled brand small grow", style: {width: "100%", marginTop: "10px", marginBottom: "10px"}},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "ui-button-contents"}, {className: "ui-button-contents"},
self.state.loading ? "Loading" : "Load More" self.state.loading ? "Loading" : "Load More"
) )
), ),
self.state.servers.length > 0 && BDV2.react.createElement(SettingsTitle, {text: self.state.title}) self.state.servers.length > 0 && React.createElement(SettingsTitle, {text: self.state.title})
)]; )];
} }
get notConnected() { get notConnected() {
const self = this; const self = this;
//return BDV2.react.createElement(SettingsTitle, { text: self.state.title }); //return React.createElement(SettingsTitle, { text: self.state.title });
return [BDV2.react.createElement( return [React.createElement(
"div", "div",
{key: "ncc", ref: "content", className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"}, {key: "ncc", ref: "content", className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},
BDV2.react.createElement( React.createElement(
"h2", "h2",
{className: "ui-form-title h2 margin-reset margin-bottom-20"}, {className: "ui-form-title h2 margin-reset margin-bottom-20"},
"Not connected to discordservers.com!", "Not connected to discordservers.com!",
BDV2.react.createElement( React.createElement(
"button", "button",
{ {
onClick: self.connect, onClick: self.connect,
@ -378,7 +378,7 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
lineHeight: "14px" lineHeight: "14px"
} }
}, },
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "ui-button-contents"}, {className: "ui-button-contents"},
"Connect" "Connect"
@ -389,10 +389,10 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
} }
get footer() { get footer() {
return BDV2.react.createElement( return React.createElement(
"div", "div",
{className: "ui-tab-bar-header"}, {className: "ui-tab-bar-header"},
BDV2.react.createElement( React.createElement(
"a", "a",
{href: "https://discordservers.com", target: "_blank"}, {href: "https://discordservers.com", target: "_blank"},
"Discordservers.com" "Discordservers.com"
@ -403,25 +403,25 @@ export default class V2C_PublicServers extends BDV2.reactComponent {
get connection() { get connection() {
const self = this; const self = this;
const {connection} = self.state; const {connection} = self.state;
if (connection.state !== 2) return BDV2.react.createElement("span", null); if (connection.state !== 2) return React.createElement("span", null);
return BDV2.react.createElement( return React.createElement(
"span", "span",
null, null,
BDV2.react.createElement(TabBar.Separator, null), React.createElement(TabBar.Separator, null),
BDV2.react.createElement( React.createElement(
"span", "span",
{style: {color: "#b9bbbe", fontSize: "10px", marginLeft: "10px"}}, {style: {color: "#b9bbbe", fontSize: "10px", marginLeft: "10px"}},
"Connected as: ", "Connected as: ",
`${connection.user.username}#${connection.user.discriminator}` `${connection.user.username}#${connection.user.discriminator}`
), ),
BDV2.react.createElement( React.createElement(
"div", "div",
{style: {padding: "5px 10px 0 10px"}}, {style: {padding: "5px 10px 0 10px"}},
BDV2.react.createElement( React.createElement(
"button", "button",
{style: {width: "100%", minHeight: "20px"}, type: "button", className: "ui-button filled brand small grow"}, {style: {width: "100%", minHeight: "20px"}, type: "button", className: "ui-button filled brand small grow"},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "ui-button-contents", onClick: self.connect}, {className: "ui-button-contents", onClick: self.connect},
"Reconnect" "Reconnect"

View File

@ -1,6 +1,6 @@
import {BDV2} from "modules"; import {React} from "modules";
export default class V2C_Scroller extends BDV2.reactComponent { export default class V2C_Scroller extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -16,10 +16,10 @@ export default class V2C_Scroller extends BDV2.reactComponent {
wrapperClass = "scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"; wrapperClass = "scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv";
} }
const {children} = this.props; const {children} = this.props;
return BDV2.react.createElement( return React.createElement(
"div", "div",
{key: "scrollerwrap", className: wrapperClass}, {key: "scrollerwrap", className: wrapperClass},
BDV2.react.createElement( React.createElement(
"div", "div",
{key: "scroller", ref: "scroller", className: scrollerClass}, {key: "scroller", ref: "scroller", className: scrollerClass},
children children

View File

@ -1,6 +1,6 @@
import {BDV2} from "modules"; import {React} from "modules";
export default class V2C_Checkbox extends BDV2.reactComponent { export default class V2C_Checkbox extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.onClick = this.onClick.bind(this); this.onClick = this.onClick.bind(this);
@ -14,19 +14,19 @@ export default class V2C_Checkbox extends BDV2.reactComponent {
} }
render() { render() {
return BDV2.react.createElement( return React.createElement(
"li", "li",
null, null,
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "checkbox checkbox-3kaeSU da-checkbox checkbox-3EVISJ da-checkbox", onClick: this.onClick}, {className: "checkbox checkbox-3kaeSU da-checkbox checkbox-3EVISJ da-checkbox", onClick: this.onClick},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "checkbox-inner checkboxInner-3yjcPe da-checkboxInner"}, {className: "checkbox-inner checkboxInner-3yjcPe da-checkboxInner"},
BDV2.react.createElement("input", {className: "checkboxElement-1qV33p da-checkboxElement", checked: this.state.checked, onChange: () => {}, type: "checkbox"}), React.createElement("input", {className: "checkboxElement-1qV33p da-checkboxElement", checked: this.state.checked, onChange: () => {}, type: "checkbox"}),
BDV2.react.createElement("span", null) React.createElement("span", null)
), ),
BDV2.react.createElement( React.createElement(
"span", "span",
null, null,
this.props.text this.props.text

View File

@ -1,15 +1,15 @@
import {BDV2} from "modules"; import {React} from "modules";
export default class V2C_ContentColumn extends BDV2.reactComponent { export default class V2C_ContentColumn extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
render() { render() {
return BDV2.react.createElement( return React.createElement(
"div", "div",
{className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"}, {className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},
BDV2.react.createElement( React.createElement(
"h2", "h2",
{className: "ui-form-title h2 margin-reset margin-bottom-20"}, {className: "ui-form-title h2 margin-reset margin-bottom-20"},
this.props.title this.props.title

View File

@ -1,7 +1,7 @@
import {BDV2} from "modules"; import {React} from "modules";
import CloseButton from "../icons/close"; import CloseButton from "../icons/close";
export default class V2C_Tools extends BDV2.reactComponent { export default class V2C_Tools extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -9,14 +9,14 @@ export default class V2C_Tools extends BDV2.reactComponent {
} }
render() { render() {
return BDV2.react.createElement("div", {className: "tools-container toolsContainer-1edPuj"}, return React.createElement("div", {className: "tools-container toolsContainer-1edPuj"},
BDV2.react.createElement("div", {className: "tools tools-3-3s-N"}, React.createElement("div", {className: "tools tools-3-3s-N"},
BDV2.react.createElement("div", {className: "container-1sFeqf"}, React.createElement("div", {className: "container-1sFeqf"},
BDV2.react.createElement("div", React.createElement("div",
{className: "btn-close closeButton-1tv5uR", onClick: this.onClick}, {className: "btn-close closeButton-1tv5uR", onClick: this.onClick},
BDV2.react.createElement(CloseButton, null) React.createElement(CloseButton, null)
), ),
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "esc-text keybind-KpFkfr"}, {className: "esc-text keybind-KpFkfr"},
"ESC" "ESC"

View File

@ -1,9 +1,9 @@
import {SettingsCookie} from "data"; import {SettingsCookie} from "data";
import {BDV2} from "modules"; import {React} from "modules";
import SettingsTitle from "./title"; import SettingsTitle from "./title";
import Switch from "./switch"; import Switch from "./switch";
export default class V2C_SettingsPanel extends BDV2.reactComponent { export default class V2C_SettingsPanel extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -11,13 +11,13 @@ export default class V2C_SettingsPanel extends BDV2.reactComponent {
render() { render() {
const {settings} = this.props; const {settings} = this.props;
return BDV2.react.createElement( return React.createElement(
"div", "div",
{className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"}, {className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},
BDV2.react.createElement(SettingsTitle, {text: this.props.title}), React.createElement(SettingsTitle, {text: this.props.title}),
this.props.button && BDV2.react.createElement("button", {key: "title-button", className: "bd-pfbtn", onClick: this.props.button.onClick}, this.props.button.title), this.props.button && React.createElement("button", {key: "title-button", className: "bd-pfbtn", onClick: this.props.button.onClick}, this.props.button.title),
settings.map(setting => { settings.map(setting => {
return BDV2.react.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: SettingsCookie[setting.id], onChange: (id, checked) => { return React.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: SettingsCookie[setting.id], onChange: (id, checked) => {
this.props.onChange(id, checked); this.props.onChange(id, checked);
}}); }});
}) })

View File

@ -1,9 +1,9 @@
import {SettingsCookie, PluginCookie, Plugins} from "data"; import {SettingsCookie, PluginCookie, Plugins} from "data";
import {BDV2, Utilities, PluginManager} from "modules"; import {React, ReactDOM, Utilities, PluginManager} from "modules";
import CloseButton from "../icons/close"; import CloseButton from "../icons/close";
import ReloadIcon from "../icons/reload"; import ReloadIcon from "../icons/reload";
export default class V2C_PluginCard extends BDV2.reactComponent { export default class V2C_PluginCard extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -56,7 +56,7 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
return (eTop < cTop || eBottom > cBottom); return (eTop < cTop || eBottom > cBottom);
}; };
const self = $(BDV2.reactDom.findDOMNode(this)); const self = $(ReactDOM.findDOMNode(this));
const container = self.parents(".scroller"); const container = self.parents(".scroller");
if (!isHidden(container[0], self[0])) return; if (!isHidden(container[0], self[0])) return;
container.animate({ container.animate({
@ -90,45 +90,45 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
try { self.settingsPanel = plugin.getSettingsPanel(); } try { self.settingsPanel = plugin.getSettingsPanel(); }
catch (err) { Utilities.err("Plugins", "Unable to get settings panel for " + plugin.getName() + ".", err); } catch (err) { Utilities.err("Plugins", "Unable to get settings panel for " + plugin.getName() + ".", err); }
return BDV2.react.createElement("li", {className: "settings-open ui-switch-item"}, return React.createElement("li", {className: "settings-open ui-switch-item"},
BDV2.react.createElement("div", {style: {"float": "right", "cursor": "pointer"}, onClick: () => { React.createElement("div", {style: {"float": "right", "cursor": "pointer"}, onClick: () => {
this.refs.settingspanel.innerHTML = ""; this.refs.settingspanel.innerHTML = "";
self.setState({settings: false}); self.setState({settings: false});
}}, }},
BDV2.react.createElement(CloseButton, null) React.createElement(CloseButton, null)
), ),
typeof self.settingsPanel === "object" && BDV2.react.createElement("div", {id: `plugin-settings-${name}`, className: "plugin-settings", ref: "settingspanel"}), typeof self.settingsPanel === "object" && React.createElement("div", {id: `plugin-settings-${name}`, className: "plugin-settings", ref: "settingspanel"}),
typeof self.settingsPanel !== "object" && BDV2.react.createElement("div", {id: `plugin-settings-${name}`, className: "plugin-settings", ref: "settingspanel", dangerouslySetInnerHTML: {__html: self.settingsPanel}}) typeof self.settingsPanel !== "object" && React.createElement("div", {id: `plugin-settings-${name}`, className: "plugin-settings", ref: "settingspanel", dangerouslySetInnerHTML: {__html: self.settingsPanel}})
); );
} }
return BDV2.react.createElement("li", {"data-name": name, "data-version": version, "className": "settings-closed ui-switch-item"}, return React.createElement("li", {"data-name": name, "data-version": version, "className": "settings-closed ui-switch-item"},
BDV2.react.createElement("div", {className: "bda-header"}, React.createElement("div", {className: "bda-header"},
BDV2.react.createElement("span", {className: "bda-header-title"}, React.createElement("span", {className: "bda-header-title"},
BDV2.react.createElement("span", {className: "bda-name"}, name), React.createElement("span", {className: "bda-name"}, name),
" v", " v",
BDV2.react.createElement("span", {className: "bda-version"}, version), React.createElement("span", {className: "bda-version"}, version),
" by ", " by ",
BDV2.react.createElement("span", {className: "bda-author"}, author) React.createElement("span", {className: "bda-author"}, author)
), ),
BDV2.react.createElement("div", {className: "bda-controls"}, React.createElement("div", {className: "bda-controls"},
!SettingsCookie["fork-ps-5"] && BDV2.react.createElement(ReloadIcon, {className: "bd-reload-card", onClick: this.reload}), !SettingsCookie["fork-ps-5"] && React.createElement(ReloadIcon, {className: "bd-reload-card", onClick: this.reload}),
BDV2.react.createElement("label", {className: "ui-switch-wrapper ui-flex-child", style: {flex: "0 0 auto"}}, React.createElement("label", {className: "ui-switch-wrapper ui-flex-child", style: {flex: "0 0 auto"}},
BDV2.react.createElement("input", {checked: this.state.checked, onChange: this.onChange, className: "ui-switch-checkbox", type: "checkbox"}), React.createElement("input", {checked: this.state.checked, onChange: this.onChange, className: "ui-switch-checkbox", type: "checkbox"}),
BDV2.react.createElement("div", {className: this.state.checked ? "ui-switch checked" : "ui-switch"}) React.createElement("div", {className: this.state.checked ? "ui-switch checked" : "ui-switch"})
) )
) )
), ),
BDV2.react.createElement("div", {className: "bda-description-wrap scroller-wrap fade"}, React.createElement("div", {className: "bda-description-wrap scroller-wrap fade"},
BDV2.react.createElement("div", {className: "bda-description scroller"}, description) React.createElement("div", {className: "bda-description scroller"}, description)
), ),
(website || source || this.hasSettings) && BDV2.react.createElement("div", {className: "bda-footer"}, (website || source || this.hasSettings) && React.createElement("div", {className: "bda-footer"},
BDV2.react.createElement("span", {className: "bda-links"}, React.createElement("span", {className: "bda-links"},
website && BDV2.react.createElement("a", {className: "bda-link bda-link-website", href: website, target: "_blank"}, "Website"), website && React.createElement("a", {className: "bda-link bda-link-website", href: website, target: "_blank"}, "Website"),
website && source && " | ", website && source && " | ",
source && BDV2.react.createElement("a", {className: "bda-link bda-link-source", href: source, target: "_blank"}, "Source") source && React.createElement("a", {className: "bda-link bda-link-source", href: source, target: "_blank"}, "Source")
), ),
this.hasSettings && BDV2.react.createElement("button", {onClick: this.showSettings, className: "bda-settings-button", disabled: !this.state.checked}, "Settings") this.hasSettings && React.createElement("button", {onClick: this.showSettings, className: "bda-settings-button", disabled: !this.state.checked}, "Settings")
) )
); );
} }

View File

@ -1,17 +1,17 @@
import {BDV2} from "modules"; import {React} from "modules";
import SettingsGroup from "./settingsgroup"; import SettingsGroup from "./settingsgroup";
export default class V2C_SectionedSettingsPanel extends BDV2.reactComponent { export default class V2C_SectionedSettingsPanel extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
render() { render() {
return BDV2.react.createElement( return React.createElement(
"div", {className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"}, "div", {className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},
this.props.sections.map(section => { this.props.sections.map(section => {
return BDV2.react.createElement(SettingsGroup, Object.assign({}, section, this.props.onChange)); return React.createElement(SettingsGroup, Object.assign({}, section, this.props.onChange));
}) })
); );
} }

View File

@ -1,5 +1,5 @@
import {SettingsInfo, SettingsCookie, Plugins, Themes} from "data"; import {SettingsInfo, SettingsCookie, Plugins, Themes} from "data";
import {BDV2, Utilities, ContentManager, Emitter, EmoteModule, EmoteMenu, PluginManager, ThemeManager} from "modules"; import {React, ReactDOM, Utilities, ContentManager, Emitter, EmoteModule, EmoteMenu, PluginManager, ThemeManager} from "modules";
import Sidebar from "./sidebar"; import Sidebar from "./sidebar";
import Scroller from "../scroller"; import Scroller from "../scroller";
import List from "../list"; import List from "../list";
@ -39,7 +39,7 @@ export default class V2_SettingsPanel {
$(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view").append(root); $(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view").append(root);
Utilities.onRemoved(root[0], () => { Utilities.onRemoved(root[0], () => {
BDV2.reactDom.unmountComponentAtNode(root[0]); ReactDOM.unmountComponentAtNode(root[0]);
}); });
return true; return true;
} }
@ -91,7 +91,7 @@ export default class V2_SettingsPanel {
renderSidebar() { renderSidebar() {
const self = this; const self = this;
$("[class*='side-'] > [class*='item-']").off("click.v2settingspanel").on("click.v2settingspanel", () => { $("[class*='side-'] > [class*='item-']").off("click.v2settingspanel").on("click.v2settingspanel", () => {
BDV2.reactDom.unmountComponentAtNode(self.root); ReactDOM.unmountComponentAtNode(self.root);
$(self.root).hide(); $(self.root).hide();
$(".contentRegion-3nDuYy, .content-region").first().show(); $(".contentRegion-3nDuYy, .content-region").first().show();
}); });
@ -99,32 +99,32 @@ export default class V2_SettingsPanel {
} }
get coreComponent() { get coreComponent() {
return BDV2.react.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [ return React.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [
BDV2.react.createElement(SectionedSettingsPanel, {key: "cspanel", onChange: this.onChange, sections: this.coreSettings}), React.createElement(SectionedSettingsPanel, {key: "cspanel", onChange: this.onChange, sections: this.coreSettings}),
BDV2.react.createElement(Tools, {key: "tools"}) React.createElement(Tools, {key: "tools"})
]}); ]});
} }
get emoteComponent() { get emoteComponent() {
return BDV2.react.createElement(Scroller, { return React.createElement(Scroller, {
contentColumn: true, fade: true, dark: true, children: [ contentColumn: true, fade: true, dark: true, children: [
BDV2.react.createElement(SettingsPanel, {key: "espanel", title: "Emote Settings", onChange: this.onChange, settings: this.emoteSettings, button: { React.createElement(SettingsPanel, {key: "espanel", title: "Emote Settings", onChange: this.onChange, settings: this.emoteSettings, button: {
title: "Clear Emote Cache", title: "Clear Emote Cache",
onClick: () => { EmoteModule.clearEmoteData(); EmoteModule.init(); EmoteMenu.init(); } onClick: () => { EmoteModule.clearEmoteData(); EmoteModule.init(); EmoteMenu.init(); }
}}), }}),
BDV2.react.createElement(Tools, {key: "tools"}) React.createElement(Tools, {key: "tools"})
]}); ]});
} }
get customCssComponent() { get customCssComponent() {
return BDV2.react.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [BDV2.react.createElement(CssEditor, {key: "csseditor"}), BDV2.react.createElement(Tools, {key: "tools"})]}); return React.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [React.createElement(CssEditor, {key: "csseditor"}), React.createElement(Tools, {key: "tools"})]});
} }
contentComponent(type) { contentComponent(type) {
const componentElement = type == "plugins" ? this.pluginsComponent : this.themesComponent; const componentElement = type == "plugins" ? this.pluginsComponent : this.themesComponent;
const prefix = type.replace("s", ""); const prefix = type.replace("s", "");
const settingsList = this; const settingsList = this;
class ContentList extends BDV2.react.Component { class ContentList extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.onChange = this.onChange.bind(this); this.onChange = this.onChange.bind(this);
@ -148,35 +148,35 @@ export default class V2_SettingsPanel {
render() {return componentElement;} render() {return componentElement;}
} }
return BDV2.react.createElement(ContentList); return React.createElement(ContentList);
} }
get pluginsComponent() { get pluginsComponent() {
const plugins = Object.keys(Plugins).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())).reduce((arr, key) => { const plugins = Object.keys(Plugins).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())).reduce((arr, key) => {
arr.push(BDV2.react.createElement(PluginCard, {key: key, plugin: Plugins[key].plugin}));return arr; arr.push(React.createElement(PluginCard, {key: key, plugin: Plugins[key].plugin}));return arr;
}, []); }, []);
const list = BDV2.react.createElement(List, {key: "plugin-list", className: "bda-slist", children: plugins}); const list = React.createElement(List, {key: "plugin-list", className: "bda-slist", children: plugins});
const refreshIcon = !SettingsCookie["fork-ps-5"] && BDV2.react.createElement(ReloadIcon, {className: "bd-reload-header", size: "18px", onClick: async () => { const refreshIcon = !SettingsCookie["fork-ps-5"] && React.createElement(ReloadIcon, {className: "bd-reload-header", size: "18px", onClick: async () => {
PluginManager.updatePluginList(); PluginManager.updatePluginList();
this.sideBarOnClick("plugins"); this.sideBarOnClick("plugins");
}}); }});
const pfBtn = BDV2.react.createElement("button", {key: "folder-button", className: "bd-pfbtn", onClick: () => { require("electron").shell.openItem(ContentManager.pluginsFolder); }}, "Open Plugin Folder"); const pfBtn = React.createElement("button", {key: "folder-button", className: "bd-pfbtn", onClick: () => { require("electron").shell.openItem(ContentManager.pluginsFolder); }}, "Open Plugin Folder");
const contentColumn = BDV2.react.createElement(ContentColumn, {key: "pcolumn", title: "Plugins", children: [refreshIcon, pfBtn, list]}); const contentColumn = React.createElement(ContentColumn, {key: "pcolumn", title: "Plugins", children: [refreshIcon, pfBtn, list]});
return BDV2.react.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [contentColumn, BDV2.react.createElement(Tools, {key: "tools"})]}); return React.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [contentColumn, React.createElement(Tools, {key: "tools"})]});
} }
get themesComponent() { get themesComponent() {
const themes = Object.keys(Themes).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())).reduce((arr, key) => { const themes = Object.keys(Themes).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())).reduce((arr, key) => {
arr.push(BDV2.react.createElement(ThemeCard, {key: key, theme: Themes[key]}));return arr; arr.push(React.createElement(ThemeCard, {key: key, theme: Themes[key]}));return arr;
}, []); }, []);
const list = BDV2.react.createElement(List, {key: "theme-list", className: "bda-slist", children: themes}); const list = React.createElement(List, {key: "theme-list", className: "bda-slist", children: themes});
const refreshIcon = !SettingsCookie["fork-ps-5"] && BDV2.react.createElement(ReloadIcon, {className: "bd-reload-header", size: "18px", onClick: async () => { const refreshIcon = !SettingsCookie["fork-ps-5"] && React.createElement(ReloadIcon, {className: "bd-reload-header", size: "18px", onClick: async () => {
ThemeManager.updateThemeList(); ThemeManager.updateThemeList();
this.sideBarOnClick("themes"); this.sideBarOnClick("themes");
}}); }});
const tfBtn = BDV2.react.createElement("button", {key: "folder-button", className: "bd-pfbtn", onClick: () => { require("electron").shell.openItem(ContentManager.themesFolder); }}, "Open Theme Folder"); const tfBtn = React.createElement("button", {key: "folder-button", className: "bd-pfbtn", onClick: () => { require("electron").shell.openItem(ContentManager.themesFolder); }}, "Open Theme Folder");
const contentColumn = BDV2.react.createElement(ContentColumn, {key: "tcolumn", title: "Themes", children: [refreshIcon, tfBtn, list]}); const contentColumn = React.createElement(ContentColumn, {key: "tcolumn", title: "Themes", children: [refreshIcon, tfBtn, list]});
return BDV2.react.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [contentColumn, BDV2.react.createElement(Tools, {key: "tools"})]}); return React.createElement(Scroller, {contentColumn: true, fade: true, dark: true, children: [contentColumn, React.createElement(Tools, {key: "tools"})]});
} }
renderCoreSettings() { renderCoreSettings() {
@ -185,7 +185,7 @@ export default class V2_SettingsPanel {
console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i"); console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");
return; return;
} }
BDV2.reactDom.render(this.coreComponent, root); ReactDOM.render(this.coreComponent, root);
} }
renderEmoteSettings() { renderEmoteSettings() {
@ -194,7 +194,7 @@ export default class V2_SettingsPanel {
console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i"); console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");
return; return;
} }
BDV2.reactDom.render(this.emoteComponent, root); ReactDOM.render(this.emoteComponent, root);
} }
renderCustomCssEditor() { renderCustomCssEditor() {
@ -203,7 +203,7 @@ export default class V2_SettingsPanel {
console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i"); console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");
return; return;
} }
BDV2.reactDom.render(this.customCssComponent, root); ReactDOM.render(this.customCssComponent, root);
} }
renderPluginPane() { renderPluginPane() {
@ -212,7 +212,7 @@ export default class V2_SettingsPanel {
console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i"); console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");
return; return;
} }
BDV2.reactDom.render(this.contentComponent("plugins"), root); ReactDOM.render(this.contentComponent("plugins"), root);
} }
renderThemePane() { renderThemePane() {
@ -221,6 +221,6 @@ export default class V2_SettingsPanel {
console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i"); console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");
return; return;
} }
BDV2.reactDom.render(this.contentComponent("themes"), root); ReactDOM.render(this.contentComponent("themes"), root);
} }
} }

View File

@ -1,9 +1,9 @@
import {SettingsCookie} from "data"; import {SettingsCookie} from "data";
import {BDV2} from "modules"; import {React} from "modules";
import SettingsTitle from "./title"; import SettingsTitle from "./title";
import Switch from "./switch"; import Switch from "./switch";
export default class V2C_SettingsGroup extends BDV2.reactComponent { export default class V2C_SettingsGroup extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -11,11 +11,11 @@ export default class V2C_SettingsGroup extends BDV2.reactComponent {
render() { render() {
const {title, settings, button} = this.props; const {title, settings, button} = this.props;
const buttonComponent = button ? BDV2.react.createElement("button", {key: "title-button", className: "bd-pfbtn", onClick: button.onClick}, button.title) : null; const buttonComponent = button ? React.createElement("button", {key: "title-button", className: "bd-pfbtn", onClick: button.onClick}, button.title) : null;
return [BDV2.react.createElement(SettingsTitle, {text: title}), return [React.createElement(SettingsTitle, {text: title}),
buttonComponent, buttonComponent,
settings.map(setting => { settings.map(setting => {
return BDV2.react.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: SettingsCookie[setting.id], onChange: (id, checked) => { return React.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: SettingsCookie[setting.id], onChange: (id, checked) => {
this.props.onChange(id, checked); this.props.onChange(id, checked);
}}); }});
})]; })];

View File

@ -1,6 +1,6 @@
import {Config} from "data"; import {Config} from "data";
import {BDV2, Utilities} from "modules"; import {React, ReactDOM, Utilities} from "modules";
import SideBar from "./sidebarmenu"; import SideBar from "./sidebarmenu";
export default class V2_SettingsPanel_Sidebar { export default class V2_SettingsPanel_Sidebar {
@ -14,25 +14,25 @@ export default class V2_SettingsPanel_Sidebar {
} }
get component() { get component() {
return BDV2.react.createElement( return React.createElement(
"span", "span",
null, null,
BDV2.react.createElement(SideBar, {onClick: this.onClick, headerText: "Bandaged BD", items: this.items}), React.createElement(SideBar, {onClick: this.onClick, headerText: "Bandaged BD", items: this.items}),
BDV2.react.createElement( React.createElement(
"div", "div",
{style: {fontSize: "12px", fontWeight: "600", color: "#72767d", padding: "2px 10px"}}, {style: {fontSize: "12px", fontWeight: "600", color: "#72767d", padding: "2px 10px"}},
`BD v${Config.version} by `, `BD v${Config.version} by `,
BDV2.react.createElement( React.createElement(
"a", "a",
{href: "https://github.com/Jiiks/", target: "_blank"}, {href: "https://github.com/Jiiks/", target: "_blank"},
"Jiiks" "Jiiks"
) )
), ),
BDV2.react.createElement( React.createElement(
"div", "div",
{style: {fontSize: "12px", fontWeight: "600", color: "#72767d", padding: "2px 10px"}}, {style: {fontSize: "12px", fontWeight: "600", color: "#72767d", padding: "2px 10px"}},
`BBD v${Config.bbdVersion} by `, `BBD v${Config.bbdVersion} by `,
BDV2.react.createElement( React.createElement(
"a", "a",
{href: "https://github.com/rauenzi/", target: "_blank"}, {href: "https://github.com/rauenzi/", target: "_blank"},
"Zerebos" "Zerebos"
@ -63,9 +63,9 @@ export default class V2_SettingsPanel_Sidebar {
console.log("FAILED TO LOCATE ROOT: [class*='side-'] > [class*='item-']:not([class*=Danger])"); console.log("FAILED TO LOCATE ROOT: [class*='side-'] > [class*='item-']:not([class*=Danger])");
return; return;
} }
BDV2.reactDom.render(this.component, root); ReactDOM.render(this.component, root);
Utilities.onRemoved(root, () => { Utilities.onRemoved(root, () => {
BDV2.reactDom.unmountComponentAtNode(root); ReactDOM.unmountComponentAtNode(root);
}); });
} }
} }

View File

@ -1,7 +1,7 @@
import {BDV2} from "modules"; import {React} from "modules";
import TabBar from "./tabbar"; import TabBar from "./tabbar";
export default class V2C_SideBar extends BDV2.reactComponent { export default class V2C_SideBar extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -38,14 +38,14 @@ export default class V2C_SideBar extends BDV2.reactComponent {
const self = this; const self = this;
const {headerText} = self.props; const {headerText} = self.props;
const {items, selected} = self.state; const {items, selected} = self.state;
return BDV2.react.createElement( return React.createElement(
"div", "div",
null, null,
BDV2.react.createElement(TabBar.Separator, null), React.createElement(TabBar.Separator, null),
BDV2.react.createElement(TabBar.Header, {text: headerText}), React.createElement(TabBar.Header, {text: headerText}),
items.map(item => { items.map(item => {
const {id, text} = item; const {id, text} = item;
return BDV2.react.createElement(TabBar.Item, {key: id, selected: selected === id, text: text, id: id, onClick: self.onClick}); return React.createElement(TabBar.Item, {key: id, selected: selected === id, text: text, id: id, onClick: self.onClick});
}) })
); );
} }

View File

@ -1,6 +1,6 @@
import {BDV2} from "modules"; import {React} from "modules";
export default class V2C_Switch extends BDV2.reactComponent { export default class V2C_Switch extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -17,25 +17,25 @@ export default class V2C_Switch extends BDV2.reactComponent {
render() { render() {
const {text, info} = this.props.data; const {text, info} = this.props.data;
const {checked} = this.state; const {checked} = this.state;
return BDV2.react.createElement( return React.createElement(
"div", "div",
{className: "ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"}, {className: "ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"}, {className: "ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"},
BDV2.react.createElement( React.createElement(
"h3", "h3",
{className: "ui-form-title h3 margin-reset margin-reset ui-flex-child"}, {className: "ui-form-title h3 margin-reset margin-reset ui-flex-child"},
text text
), ),
BDV2.react.createElement( React.createElement(
"label", "label",
{className: "ui-switch-wrapper ui-flex-child", style: {flex: "0 0 auto"}}, {className: "ui-switch-wrapper ui-flex-child", style: {flex: "0 0 auto"}},
BDV2.react.createElement("input", {className: "ui-switch-checkbox", type: "checkbox", checked: checked, onChange: e => this.onChange(e)}), React.createElement("input", {className: "ui-switch-checkbox", type: "checkbox", checked: checked, onChange: e => this.onChange(e)}),
BDV2.react.createElement("div", {className: `ui-switch ${checked ? "checked" : ""}`}) React.createElement("div", {className: `ui-switch ${checked ? "checked" : ""}`})
) )
), ),
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "ui-form-text style-description margin-top-4", style: {flex: "1 1 auto"}}, {className: "ui-form-text style-description margin-top-4", style: {flex: "1 1 auto"}},
info info

View File

@ -1,6 +1,6 @@
import {BDV2} from "modules"; import {React} from "modules";
class V2C_TabBarItem extends BDV2.reactComponent { class V2C_TabBarItem extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -15,7 +15,7 @@ class V2C_TabBarItem extends BDV2.reactComponent {
} }
render() { render() {
return BDV2.react.createElement( return React.createElement(
"div", "div",
{className: `ui-tab-bar-item${this.props.selected ? " selected" : ""}`, onClick: this.onClick}, {className: `ui-tab-bar-item${this.props.selected ? " selected" : ""}`, onClick: this.onClick},
this.props.text this.props.text
@ -29,23 +29,23 @@ class V2C_TabBarItem extends BDV2.reactComponent {
} }
} }
class V2C_TabBarSeparator extends BDV2.reactComponent { class V2C_TabBarSeparator extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
render() { render() {
return BDV2.react.createElement("div", {className: "ui-tab-bar-separator margin-top-8 margin-bottom-8"}); return React.createElement("div", {className: "ui-tab-bar-separator margin-top-8 margin-bottom-8"});
} }
} }
class V2C_TabBarHeader extends BDV2.reactComponent { class V2C_TabBarHeader extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
render() { render() {
return BDV2.react.createElement( return React.createElement(
"div", "div",
{className: "ui-tab-bar-header"}, {className: "ui-tab-bar-header"},
this.props.text this.props.text

View File

@ -1,8 +1,8 @@
import {SettingsCookie, ThemeCookie, Themes} from "data"; import {SettingsCookie, ThemeCookie, Themes} from "data";
import {BDV2, Core, ThemeManager} from "modules"; import {React, Core, ThemeManager} from "modules";
import ReloadIcon from "../icons/reload"; import ReloadIcon from "../icons/reload";
export default class V2C_ThemeCard extends BDV2.reactComponent { export default class V2C_ThemeCard extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -50,31 +50,31 @@ export default class V2C_ThemeCard extends BDV2.reactComponent {
const website = Themes[name].website; const website = Themes[name].website;
const source = Themes[name].source; const source = Themes[name].source;
return BDV2.react.createElement("li", {"data-name": name, "data-version": version, "className": "settings-closed ui-switch-item"}, return React.createElement("li", {"data-name": name, "data-version": version, "className": "settings-closed ui-switch-item"},
BDV2.react.createElement("div", {className: "bda-header"}, React.createElement("div", {className: "bda-header"},
BDV2.react.createElement("span", {className: "bda-header-title"}, React.createElement("span", {className: "bda-header-title"},
BDV2.react.createElement("span", {className: "bda-name"}, name), React.createElement("span", {className: "bda-name"}, name),
" v", " v",
BDV2.react.createElement("span", {className: "bda-version"}, version), React.createElement("span", {className: "bda-version"}, version),
" by ", " by ",
BDV2.react.createElement("span", {className: "bda-author"}, author) React.createElement("span", {className: "bda-author"}, author)
), ),
BDV2.react.createElement("div", {className: "bda-controls"}, React.createElement("div", {className: "bda-controls"},
!SettingsCookie["fork-ps-5"] && BDV2.react.createElement(ReloadIcon, {className: "bd-reload-card", onClick: this.reload}), !SettingsCookie["fork-ps-5"] && React.createElement(ReloadIcon, {className: "bd-reload-card", onClick: this.reload}),
BDV2.react.createElement("label", {className: "ui-switch-wrapper ui-flex-child", style: {flex: "0 0 auto"}}, React.createElement("label", {className: "ui-switch-wrapper ui-flex-child", style: {flex: "0 0 auto"}},
BDV2.react.createElement("input", {checked: this.state.checked, onChange: this.onChange, className: "ui-switch-checkbox", type: "checkbox"}), React.createElement("input", {checked: this.state.checked, onChange: this.onChange, className: "ui-switch-checkbox", type: "checkbox"}),
BDV2.react.createElement("div", {className: this.state.checked ? "ui-switch checked" : "ui-switch"}) React.createElement("div", {className: this.state.checked ? "ui-switch checked" : "ui-switch"})
) )
) )
), ),
BDV2.react.createElement("div", {className: "bda-description-wrap scroller-wrap fade"}, React.createElement("div", {className: "bda-description-wrap scroller-wrap fade"},
BDV2.react.createElement("div", {className: "bda-description scroller"}, description) React.createElement("div", {className: "bda-description scroller"}, description)
), ),
(website || source) && BDV2.react.createElement("div", {className: "bda-footer"}, (website || source) && React.createElement("div", {className: "bda-footer"},
BDV2.react.createElement("span", {className: "bda-links"}, React.createElement("span", {className: "bda-links"},
website && BDV2.react.createElement("a", {className: "bda-link", href: website, target: "_blank"}, "Website"), website && React.createElement("a", {className: "bda-link", href: website, target: "_blank"}, "Website"),
website && source && " | ", website && source && " | ",
source && BDV2.react.createElement("a", {className: "bda-link", href: source, target: "_blank"}, "Source") source && React.createElement("a", {className: "bda-link", href: source, target: "_blank"}, "Source")
) )
) )
); );

View File

@ -1,12 +1,12 @@
import {BDV2} from "modules"; import {React} from "modules";
export default class V2C_SettingsTitle extends BDV2.reactComponent { export default class V2C_SettingsTitle extends React.Component {
constructor(props) { constructor(props) {
super(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 //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() { render() {
return BDV2.react.createElement( return React.createElement(
"h2", "h2",
{className: "ui-form-title h2 margin-reset margin-bottom-20 marginTop60-3PGbtK da-marginTop6"}, {className: "ui-form-title h2 margin-reset margin-bottom-20 marginTop60-3PGbtK da-marginTop6"},
this.props.text this.props.text

View File

@ -1,7 +1,7 @@
import {BDV2} from "modules"; import {React} from "modules";
import Scroller from "./scroller"; import Scroller from "./scroller";
export default class V2C_SidebarView extends BDV2.reactComponent { export default class V2C_SidebarView extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -9,19 +9,19 @@ export default class V2C_SidebarView extends BDV2.reactComponent {
render() { render() {
const {sidebar, content, tools} = this.props.children; const {sidebar, content, tools} = this.props.children;
return BDV2.react.createElement( return React.createElement(
"div", "div",
{className: "standardSidebarView-3F1I7i ui-standard-sidebar-view"}, {className: "standardSidebarView-3F1I7i ui-standard-sidebar-view"},
BDV2.react.createElement( React.createElement(
"div", "div",
{className: "sidebarRegion-VFTUkN sidebar-region"}, {className: "sidebarRegion-VFTUkN sidebar-region"},
BDV2.react.createElement(Scroller, {key: "sidebarScroller", ref: "sidebarScroller", sidebar: true, fade: sidebar.fade || true, dark: sidebar.dark || true, children: sidebar.component}) React.createElement(Scroller, {key: "sidebarScroller", ref: "sidebarScroller", sidebar: true, fade: sidebar.fade || true, dark: sidebar.dark || true, children: sidebar.component})
), ),
BDV2.react.createElement("div", {className: "contentRegion-3nDuYy content-region"}, React.createElement("div", {className: "contentRegion-3nDuYy content-region"},
BDV2.react.createElement("div", {className: "contentTransitionWrap-3hqOEW content-transition-wrap"}, React.createElement("div", {className: "contentTransitionWrap-3hqOEW content-transition-wrap"},
BDV2.react.createElement("div", {className: "scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"}, React.createElement("div", {className: "scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"},
BDV2.react.createElement("div", {className: "scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller", ref: "contentScroller"}, React.createElement("div", {className: "scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller", ref: "contentScroller"},
BDV2.react.createElement("div", {className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"}, content.component), React.createElement("div", {className: "contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"}, content.component),
tools.component tools.component
) )
) )

View File

@ -20,11 +20,28 @@ module.exports = {
events: `require("events")` events: `require("events")`
}, },
resolve: { resolve: {
extensions: [".js"], extensions: [".js", ".jsx"],
modules: [ modules: [
path.resolve("src", "data"), path.resolve("src", "data"),
path.resolve("src", "modules"), path.resolve("src", "modules"),
path.resolve("src", "ui") path.resolve("src", "ui")
] ]
},
module: {
rules: [
{
test: /.jsx?$/,
loader: "babel-loader",
exclude: /node_modules/,
query: {
presets: [["@babel/env", {
targets: {
node: "10.11.0",
chrome: "69"
}
}], "@babel/react"]
}
}
]
} }
}; };