Updated NPM packages + cleaned up context object usage.
This commit is contained in:
parent
7d23bea36c
commit
85a9fd2422
18 changed files with 250 additions and 267 deletions
130
package-lock.json
generated
130
package-lock.json
generated
|
@ -5,11 +5,11 @@
|
|||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@swc/core": "^1.3.104",
|
||||
"@swc/core": "^1.4.0",
|
||||
"autoprefixer": "^10.4.17",
|
||||
"cssnano": "^6.0.3",
|
||||
"html-minifier-terser": "^7.2.0",
|
||||
"postcss": "^8.4.33"
|
||||
"postcss": "^8.4.35"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
|
@ -65,9 +65,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core": {
|
||||
"version": "1.3.105",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.105.tgz",
|
||||
"integrity": "sha512-me2VZyr3OjqRpFrYQJJYy7x/zbFSl9nt+MAGnIcBtjDsN00iTVqEaKxBjPBFQV9BDAgPz2SRWes/DhhVm5SmMw==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.4.0.tgz",
|
||||
"integrity": "sha512-wc5DMI5BJftnK0Fyx9SNJKkA0+BZSJQx8430yutWmsILkHMBD3Yd9GhlMaxasab9RhgKqZp7Ht30hUYO5ZDvQg==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@swc/counter": "^0.1.1",
|
||||
|
@ -81,16 +81,16 @@
|
|||
"url": "https://opencollective.com/swc"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@swc/core-darwin-arm64": "1.3.105",
|
||||
"@swc/core-darwin-x64": "1.3.105",
|
||||
"@swc/core-linux-arm-gnueabihf": "1.3.105",
|
||||
"@swc/core-linux-arm64-gnu": "1.3.105",
|
||||
"@swc/core-linux-arm64-musl": "1.3.105",
|
||||
"@swc/core-linux-x64-gnu": "1.3.105",
|
||||
"@swc/core-linux-x64-musl": "1.3.105",
|
||||
"@swc/core-win32-arm64-msvc": "1.3.105",
|
||||
"@swc/core-win32-ia32-msvc": "1.3.105",
|
||||
"@swc/core-win32-x64-msvc": "1.3.105"
|
||||
"@swc/core-darwin-arm64": "1.4.0",
|
||||
"@swc/core-darwin-x64": "1.4.0",
|
||||
"@swc/core-linux-arm-gnueabihf": "1.4.0",
|
||||
"@swc/core-linux-arm64-gnu": "1.4.0",
|
||||
"@swc/core-linux-arm64-musl": "1.4.0",
|
||||
"@swc/core-linux-x64-gnu": "1.4.0",
|
||||
"@swc/core-linux-x64-musl": "1.4.0",
|
||||
"@swc/core-win32-arm64-msvc": "1.4.0",
|
||||
"@swc/core-win32-ia32-msvc": "1.4.0",
|
||||
"@swc/core-win32-x64-msvc": "1.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/helpers": "^0.5.0"
|
||||
|
@ -102,9 +102,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core-darwin-arm64": {
|
||||
"version": "1.3.105",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.105.tgz",
|
||||
"integrity": "sha512-buWeweLVDXXmcnfIemH4PGnpjwsDTUGitnPchdftb0u1FU8zSSP/lw/pUCBDG/XvWAp7c/aFxgN4CyG0j7eayA==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.0.tgz",
|
||||
"integrity": "sha512-UTJ/Vz+s7Pagef6HmufWt6Rs0aUu+EJF4Pzuwvr7JQQ5b1DZeAAUeUtkUTFx/PvCbM8Xfw4XdKBUZfrIKCfW8A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
@ -117,9 +117,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core-darwin-x64": {
|
||||
"version": "1.3.105",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.105.tgz",
|
||||
"integrity": "sha512-hFmXPApqjA/8sy/9NpljHVaKi1OvL9QkJ2MbbTCCbJERuHMpMUeMBUWipHRfepGHFhU+9B9zkEup/qJaJR4XIg==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.0.tgz",
|
||||
"integrity": "sha512-f8v58u2GsGak8EtZFN9guXqE0Ep10Suny6xriaW2d8FGqESPyNrnBzli3aqkSeQk5gGqu2zJ7WiiKp3XoUOidA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
@ -132,9 +132,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm-gnueabihf": {
|
||||
"version": "1.3.105",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.105.tgz",
|
||||
"integrity": "sha512-mwXyMC41oMKkKrPpL8uJpOxw7fyfQoVtIw3Y5p0Blabk+espNYqix0E8VymHdRKuLmM//z5wVmMsuHdGBHvZeg==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.4.0.tgz",
|
||||
"integrity": "sha512-q2KAkBzmPcTnRij/Y1fgHCKAGevUX/H4uUESrw1J5gmUg9Qip6onKV80lTumA1/aooGJ18LOsB31qdbwmZk9OA==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
|
@ -147,9 +147,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm64-gnu": {
|
||||
"version": "1.3.105",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.105.tgz",
|
||||
"integrity": "sha512-H7yEIVydnUtqBSUxwmO6vpIQn7j+Rr0DF6ZOORPyd/SFzQJK9cJRtmJQ3ZMzlJ1Bb+1gr3MvjgLEnmyCYEm2Hg==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.4.0.tgz",
|
||||
"integrity": "sha512-SknGu96W0mzHtLHWm+62fk5+Omp9fMPFO7AWyGFmz2tr8EgRRXtTSrBUnWhAbgcalnhen48GsvtMdxf1KNputg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
@ -162,9 +162,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm64-musl": {
|
||||
"version": "1.3.105",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.105.tgz",
|
||||
"integrity": "sha512-Jg7RTFT3pGFdGt5elPV6oDkinRy7q9cXpenjXnJnM2uvx3jOwnsAhexPyCDHom8SHL0j+9kaLLC66T3Gz1E4UA==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.4.0.tgz",
|
||||
"integrity": "sha512-/k3TDvpBRMDNskHooNN1KqwUhcwkfBlIYxRTnJvsfT2C7My4pffR+4KXmt0IKynlTTbCdlU/4jgX4801FSuliw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
@ -177,9 +177,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-x64-gnu": {
|
||||
"version": "1.3.105",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.105.tgz",
|
||||
"integrity": "sha512-DJghplpyusAmp1X5pW/y93MmS/u83Sx5GrpJxI6KLPa82+NItTgMcl8KBQmW5GYAJpVKZyaIvBanS5TdR8aN2w==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.4.0.tgz",
|
||||
"integrity": "sha512-GYsTMvNt5+WTVlwwQzOOWsPMw6P/F41u5PGHWmfev8Nd4QJ1h3rWPySKk4mV42IJwH9MgQCVSl3ygwNqwl6kFg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
@ -192,9 +192,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-x64-musl": {
|
||||
"version": "1.3.105",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.105.tgz",
|
||||
"integrity": "sha512-wD5jL2dZH/5nPNssBo6jhOvkI0lmWnVR4vnOXWjuXgjq1S0AJpO5jdre/6pYLmf26hft3M42bteDnjR4AAZ38w==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.4.0.tgz",
|
||||
"integrity": "sha512-jGVPdM/VwF7kK/uYRW5N6FwzKf/FnDjGIR3RPvQokjYJy7Auk+3Oj21C0Jev7sIT9RYnO/TrFEoEozKeD/z2Qw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
@ -207,9 +207,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-arm64-msvc": {
|
||||
"version": "1.3.105",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.105.tgz",
|
||||
"integrity": "sha512-UqJtwILUHRw2+3UTPnRkZrzM/bGdQtbR4UFdp79mZQYfryeOUVNg7aJj/bWUTkKtLiZ3o+FBNrM/x2X1mJX5bA==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.4.0.tgz",
|
||||
"integrity": "sha512-biHYm1AronEKlt47O/H8sSOBM2BKXMmWT+ApvlxUw50m1RGNnVnE0bgY7tylFuuSiWyXsQPJbmUV708JqORXVg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
@ -222,9 +222,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-ia32-msvc": {
|
||||
"version": "1.3.105",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.105.tgz",
|
||||
"integrity": "sha512-Z95C6vZgBEJ1snidYyjVKnVWiy/ZpPiIFIXGWkDr4ZyBgL3eZX12M6LzZ+NApHKffrbO4enbFyFomueBQgS2oA==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.4.0.tgz",
|
||||
"integrity": "sha512-TL5L2tFQb19kJwv6+elToGBj74QXCn9j+hZfwQatvZEJRA5rDK16eH6oAE751dGUArhnWlW3Vj65hViPvTuycw==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
|
@ -237,9 +237,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-x64-msvc": {
|
||||
"version": "1.3.105",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.105.tgz",
|
||||
"integrity": "sha512-3J8fkyDPFsS3mszuYUY4Wfk7/B2oio9qXUwF3DzOs2MK+XgdyMLIptIxL7gdfitXJBH8k39uVjrIw1JGJDjyFA==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.4.0.tgz",
|
||||
"integrity": "sha512-e2xVezU7XZ2Stzn4i7TOQe2Kn84oYdG0M3A7XI7oTdcpsKCcKwgiMoroiAhqCv+iN20KNqhnWwJiUiTj/qN5AA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
@ -252,9 +252,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/counter": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.2.tgz",
|
||||
"integrity": "sha512-9F4ys4C74eSTEUNndnER3VJ15oru2NumfQxS8geE+f3eB5xvfxpWyqE5XlVnxb/R14uoXi6SLbBwwiDSkv+XEw=="
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz",
|
||||
"integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ=="
|
||||
},
|
||||
"node_modules/@swc/types": {
|
||||
"version": "0.1.5",
|
||||
|
@ -322,9 +322,9 @@
|
|||
"integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="
|
||||
},
|
||||
"node_modules/browserslist": {
|
||||
"version": "4.22.2",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz",
|
||||
"integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==",
|
||||
"version": "4.22.3",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.3.tgz",
|
||||
"integrity": "sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
|
@ -340,8 +340,8 @@
|
|||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"caniuse-lite": "^1.0.30001565",
|
||||
"electron-to-chromium": "^1.4.601",
|
||||
"caniuse-lite": "^1.0.30001580",
|
||||
"electron-to-chromium": "^1.4.648",
|
||||
"node-releases": "^2.0.14",
|
||||
"update-browserslist-db": "^1.0.13"
|
||||
},
|
||||
|
@ -378,9 +378,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001579",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001579.tgz",
|
||||
"integrity": "sha512-u5AUVkixruKHJjw/pj9wISlcMpgFWzSrczLZbrqBSxukQixmg0SJ5sZTpvaFvxU0HoQKd4yoyAogyrAz9pzJnA==",
|
||||
"version": "1.0.30001585",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001585.tgz",
|
||||
"integrity": "sha512-yr2BWR1yLXQ8fMpdS/4ZZXpseBgE7o4g41x3a6AJOqZuOi+iE/WdJYAuZ6Y95i4Ohd2Y+9MzIWRR+uGABH4s3Q==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
|
@ -643,9 +643,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.4.643",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.643.tgz",
|
||||
"integrity": "sha512-QHscvvS7gt155PtoRC0dR2ilhL8E9LHhfTQEq1uD5AL0524rBLAwpAREFH06f87/e45B9XkR6Ki5dbhbCsVEIg=="
|
||||
"version": "1.4.665",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.665.tgz",
|
||||
"integrity": "sha512-UpyCWObBoD+nSZgOC2ToaIdZB0r9GhqT2WahPKiSki6ckkSuKhQNso8V2PrFcHBMleI/eqbKgVQgVC4Wni4ilw=="
|
||||
},
|
||||
"node_modules/entities": {
|
||||
"version": "4.5.0",
|
||||
|
@ -659,9 +659,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/escalade": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
|
||||
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz",
|
||||
"integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
|
@ -803,9 +803,9 @@
|
|||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.33",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz",
|
||||
"integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==",
|
||||
"version": "8.4.35",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz",
|
||||
"integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"@swc/core": "^1.3.104",
|
||||
"@swc/core": "^1.4.0",
|
||||
"autoprefixer": "^10.4.17",
|
||||
"cssnano": "^6.0.3",
|
||||
"html-minifier-terser": "^7.2.0",
|
||||
"postcss": "^8.4.33"
|
||||
"postcss": "^8.4.35"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,51 +1,15 @@
|
|||
#include common.js
|
||||
#include mszauth.js
|
||||
#include txtrigs.js
|
||||
#include audio/context.js
|
||||
#include controls/views.js
|
||||
#include sound/sndmgr.js
|
||||
#include sound/sndlibrary.js
|
||||
#include sound/sndpacks.js
|
||||
|
||||
const MamiContext = function(targetBody) {
|
||||
const MamiContext = function(props) {
|
||||
const pub = {};
|
||||
|
||||
let settings;
|
||||
pub.setSettings = inst => settings = inst;
|
||||
pub.getSettings = () => settings;
|
||||
for(const name in props) {
|
||||
if(!props.hasOwnProperty(name))
|
||||
continue;
|
||||
|
||||
const viewsCtx = new MamiViewsControl({ body: targetBody });
|
||||
pub.getViews = () => viewsCtx;
|
||||
const value = props[name];
|
||||
const descriptor = { enumerable: true };
|
||||
descriptor[typeof value === 'function' ? 'get' : 'value'] = value;
|
||||
Object.defineProperty(pub, name, descriptor);
|
||||
}
|
||||
|
||||
const audioCtx = new MamiAudioContext;
|
||||
pub.getAudio = () => audioCtx;
|
||||
|
||||
const soundMgr = new MamiSoundManager(audioCtx);
|
||||
const soundLib = new MamiSoundLibrary(soundMgr);
|
||||
const soundPck = new MamiSoundPacks;
|
||||
const sndPckPlay = new MamiSoundPackPlayer(soundLib);
|
||||
|
||||
pub.getSound = () => soundMgr;
|
||||
pub.getSoundLibrary = () => soundLib;
|
||||
pub.getSoundPacks = () => soundPck;
|
||||
pub.getSoundPackPlayer = () => sndPckPlay;
|
||||
|
||||
const txtTriggers = new MamiTextTriggers;
|
||||
pub.getTextTriggers = () => txtTriggers;
|
||||
|
||||
let eeprom;
|
||||
pub.hasEEPROM = () => eeprom !== undefined;
|
||||
pub.getEEPROM = () => eeprom;
|
||||
pub.createEEPROM = () => {
|
||||
if(eeprom !== undefined)
|
||||
return;
|
||||
|
||||
eeprom = new EEPROM(
|
||||
'1',
|
||||
futami.get('eeprom2'),
|
||||
MamiMisuzuAuth.getLine
|
||||
);
|
||||
};
|
||||
|
||||
return pub;
|
||||
return Object.freeze(pub);
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const Umi = { UI: {} };
|
||||
window.Umi = { UI: {}, Protocol: { SockChat: { Protocol: {} } } };
|
||||
|
||||
#include animate.js
|
||||
#include common.js
|
||||
|
@ -7,13 +7,16 @@ const Umi = { UI: {} };
|
|||
#include messages.js
|
||||
#include mszauth.js
|
||||
#include server.js
|
||||
#include txtrigs.js
|
||||
#include utility.js
|
||||
#include weeb.js
|
||||
#include audio/autoplay.js
|
||||
#include audio/context.js
|
||||
#include controls/views.js
|
||||
#include eeprom/eeprom.js
|
||||
#include settings/backup.js
|
||||
#include settings/settings.js
|
||||
#include sound/context.js
|
||||
#include sound/osukeys.js
|
||||
#include sound/umisound.js
|
||||
#include ui/chat-layout.js
|
||||
|
@ -29,33 +32,23 @@ const Umi = { UI: {} };
|
|||
#include ui/uploads.js
|
||||
|
||||
(async () => {
|
||||
const ctx = new MamiContext(document.body),
|
||||
views = ctx.getViews();
|
||||
const views = new MamiViewsControl({ body: document.body });
|
||||
const loadingOverlay = new Umi.UI.LoadingOverlay('spinner', 'Loading...');
|
||||
await views.push(loadingOverlay);
|
||||
|
||||
Object.defineProperty(window, 'mami', {
|
||||
value: ctx,
|
||||
writable: false,
|
||||
});
|
||||
|
||||
const sndLib = ctx.getSoundLibrary(),
|
||||
sndPacks = ctx.getSoundPacks();
|
||||
|
||||
const lo = new Umi.UI.LoadingOverlay('spinner', 'Loading...');
|
||||
await views.push(lo);
|
||||
|
||||
lo.setMessage('Loading environment...');
|
||||
loadingOverlay.setMessage('Loading environment...');
|
||||
try {
|
||||
window.futami = await FutamiCommon.load();
|
||||
} catch(ex) {
|
||||
console.error(ex);
|
||||
lo.setIcon('cross');
|
||||
lo.setHeader('Failed!');
|
||||
lo.setMessage('Failed to load common settings!');
|
||||
loadingOverlay.setIcon('cross');
|
||||
loadingOverlay.setHeader('Failed!');
|
||||
loadingOverlay.setMessage('Failed to load common settings!');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
lo.setMessage('Fetching credentials...');
|
||||
loadingOverlay.setMessage('Fetching credentials...');
|
||||
try {
|
||||
const auth = await MamiMisuzuAuth.update();
|
||||
if(!auth.ok)
|
||||
|
@ -75,10 +68,9 @@ const Umi = { UI: {} };
|
|||
}, 600000);
|
||||
|
||||
|
||||
lo.setMessage('Loading settings...');
|
||||
loadingOverlay.setMessage('Loading settings...');
|
||||
|
||||
const settings = new MamiSettings('umi-');
|
||||
ctx.setSettings(settings);
|
||||
|
||||
settings.define('style', 'string', 'dark');
|
||||
settings.define('compactView', 'boolean', false);
|
||||
|
@ -132,13 +124,15 @@ const Umi = { UI: {} };
|
|||
settings.define('notificationTriggers', 'string', '', noNotifSupport);
|
||||
|
||||
|
||||
lo.setMessage('Loading sounds...');
|
||||
loadingOverlay.setMessage('Loading sounds...');
|
||||
const soundCtx = new MamiSoundContext;
|
||||
|
||||
try {
|
||||
const sounds = await futami.getJson('sounds2');
|
||||
if(Array.isArray(sounds.library))
|
||||
sndLib.register(sounds.library, true);
|
||||
soundCtx.library.register(sounds.library, true);
|
||||
if(Array.isArray(sounds.packs))
|
||||
sndPacks.register(sounds.packs, true);
|
||||
soundCtx.packs.register(sounds.packs, true);
|
||||
} catch(ex) {
|
||||
console.error(ex);
|
||||
}
|
||||
|
@ -150,39 +144,36 @@ const Umi = { UI: {} };
|
|||
|
||||
settings.watch('soundEnable', (v, n, i) => {
|
||||
if(v) {
|
||||
const audio = mami.getAudio();
|
||||
if(!audio.isReady())
|
||||
audio.reset();
|
||||
if(!soundCtx.ready)
|
||||
soundCtx.reset();
|
||||
|
||||
settings.touch('soundVolume');
|
||||
settings.touch('soundPack');
|
||||
|
||||
const player = mami.getSoundPackPlayer();
|
||||
if(player !== null)
|
||||
player.playEvent('server');
|
||||
soundCtx.packPlayer.playEvent('server');
|
||||
}
|
||||
|
||||
mami.getAudio().setMuted(!v);
|
||||
soundCtx.muted = !v;
|
||||
});
|
||||
|
||||
settings.watch('soundPack', (v, n, i) => {
|
||||
const packs = mami.getSoundPacks();
|
||||
const packs = soundCtx.packs;
|
||||
if(!packs.has(v)) {
|
||||
settings.delete(n);
|
||||
return;
|
||||
}
|
||||
|
||||
const player = mami.getSoundPackPlayer();
|
||||
const player = soundCtx.packPlayer;
|
||||
player.loadPack(packs.get(v));
|
||||
if(!i) player.playEvent('server');
|
||||
});
|
||||
|
||||
settings.watch('soundVolume', v => {
|
||||
mami.getAudio().setVolume(v / 100);
|
||||
soundCtx.volume = v / 100;
|
||||
})
|
||||
|
||||
|
||||
lo.setMessage('Loading emoticons...');
|
||||
loadingOverlay.setMessage('Loading emoticons...');
|
||||
try {
|
||||
const emotes = await futami.getJson('emotes');
|
||||
MamiEmotes.loadLegacy(emotes);
|
||||
|
@ -223,7 +214,31 @@ const Umi = { UI: {} };
|
|||
});
|
||||
|
||||
|
||||
lo.setMessage('Preparing UI...');
|
||||
let eeprom;
|
||||
|
||||
loadingOverlay.setMessage('Loading EEPROM...');
|
||||
try {
|
||||
await MamiEEPROM.init();
|
||||
eeprom = new EEPROM('1', futami.get('eeprom2'), MamiMisuzuAuth.getLine);
|
||||
} catch(ex) {
|
||||
console.error(ex);
|
||||
eeprom = undefined;
|
||||
}
|
||||
|
||||
|
||||
loadingOverlay.setMessage('Preparing UI...');
|
||||
|
||||
const textTriggers = new MamiTextTriggers;
|
||||
|
||||
// define this as late as possible'
|
||||
const ctx = new MamiContext({
|
||||
settings: settings,
|
||||
views: views,
|
||||
sound: soundCtx,
|
||||
textTriggers: textTriggers,
|
||||
eeprom: eeprom,
|
||||
});
|
||||
Object.defineProperty(window, 'mami', { enumerable: true, value: ctx });
|
||||
|
||||
// should be dynamic when possible
|
||||
const layout = new Umi.UI.ChatLayout;
|
||||
|
@ -240,7 +255,7 @@ const Umi = { UI: {} };
|
|||
settings.watch('minecraft', (v, n, i) => {
|
||||
if(v !== 'no') {
|
||||
if(i)
|
||||
sndLib.play('minecraft:nether:enter');
|
||||
soundCtx.library.play('minecraft:nether:enter');
|
||||
else
|
||||
Umi.Sound.Play('join');
|
||||
}
|
||||
|
@ -261,9 +276,8 @@ const Umi = { UI: {} };
|
|||
settings.watch('playJokeSounds', v => {
|
||||
if(!v) return;
|
||||
|
||||
const triggers = mami.getTextTriggers();
|
||||
if(!triggers.hasTriggers())
|
||||
futami.getJson('texttriggers').then(trigInfos => triggers.addTriggers(trigInfos));
|
||||
if(!textTriggers.hasTriggers())
|
||||
futami.getJson('texttriggers').then(trigInfos => textTriggers.addTriggers(trigInfos));
|
||||
});
|
||||
|
||||
settings.watch('weeaboo', v => {
|
||||
|
@ -285,16 +299,7 @@ const Umi = { UI: {} };
|
|||
});
|
||||
|
||||
|
||||
lo.setMessage('Loading EEPROM...');
|
||||
try {
|
||||
await MamiEEPROM.init();
|
||||
ctx.createEEPROM();
|
||||
} catch(ex) {
|
||||
console.error(ex);
|
||||
}
|
||||
|
||||
|
||||
lo.setMessage('Building menus...');
|
||||
loadingOverlay.setMessage('Building menus...');
|
||||
|
||||
Umi.UI.Menus.Add('users', 'Users');
|
||||
Umi.UI.Menus.Add('channels', 'Channels', !settings.get('showChannelList'));
|
||||
|
@ -394,7 +399,7 @@ const Umi = { UI: {} };
|
|||
$r(explode);
|
||||
}, 1700);
|
||||
|
||||
sndLib.play('misc:explode');
|
||||
soundCtx.library.play('misc:explode');
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -413,12 +418,12 @@ const Umi = { UI: {} };
|
|||
}, 'Clear Logs');
|
||||
|
||||
|
||||
if(ctx.hasEEPROM()) {
|
||||
if(eeprom !== undefined) {
|
||||
Umi.UI.Menus.Add('uploads', 'Upload History', !FUTAMI_DEBUG);
|
||||
|
||||
const doUpload = async file => {
|
||||
const uploadEntry = Umi.UI.Uploads.create(file.name);
|
||||
const uploadTask = ctx.getEEPROM().create(file);
|
||||
const uploadTask = eeprom.create(file);
|
||||
|
||||
uploadTask.onProgress(prog => uploadEntry.setProgress(prog.progress));
|
||||
uploadEntry.addOption('Cancel', () => uploadTask.abort());
|
||||
|
@ -433,7 +438,7 @@ const Umi = { UI: {} };
|
|||
uploadEntry.addOption('Open', fileInfo.url);
|
||||
uploadEntry.addOption('Insert', () => Umi.UI.Markup.InsertRaw(insertText, ''));
|
||||
uploadEntry.addOption('Delete', () => {
|
||||
ctx.getEEPROM().delete(fileInfo)
|
||||
eeprom.delete(fileInfo)
|
||||
.then(() => uploadEntry.remove())
|
||||
.catch(ex => {
|
||||
console.error(ex);
|
||||
|
@ -529,7 +534,7 @@ const Umi = { UI: {} };
|
|||
});
|
||||
|
||||
|
||||
lo.setMessage('Connecting...');
|
||||
loadingOverlay.setMessage('Connecting...');
|
||||
Umi.Server.open(views, settings);
|
||||
|
||||
if(window.dispatchEvent)
|
||||
|
|
|
@ -225,7 +225,7 @@ Umi.Parsing = (function() {
|
|||
},
|
||||
});
|
||||
|
||||
if(mami.getSettings().get('motivationalImages'))
|
||||
if(mami.settings.get('motivationalImages'))
|
||||
html = motivFrame(
|
||||
extractMotiv(element),
|
||||
html
|
||||
|
@ -306,7 +306,7 @@ Umi.Parsing = (function() {
|
|||
},
|
||||
});
|
||||
|
||||
if(mami.getSettings().get('motivationalVideos'))
|
||||
if(mami.settings.get('motivationalVideos'))
|
||||
html = motivFrame(
|
||||
extractMotiv(element),
|
||||
html
|
||||
|
|
|
@ -18,10 +18,6 @@
|
|||
#include ui/loading-overlay.jsx
|
||||
#include sound/umisound.js
|
||||
|
||||
if(!Umi.Protocol) Umi.Protocol = {};
|
||||
if(!Umi.Protocol.SockChat) Umi.Protocol.SockChat = {};
|
||||
if(!Umi.Protocol.SockChat.Protocol) Umi.Protocol.SockChat.Protocol = {};
|
||||
|
||||
Umi.Protocol.SockChat.Protocol = function(views, settings) {
|
||||
const pub = {};
|
||||
Umi.Protocol.SockChat.Protocol.Instance = pub;
|
||||
|
@ -102,18 +98,17 @@ Umi.Protocol.SockChat.Protocol = function(views, settings) {
|
|||
};
|
||||
|
||||
const playBannedSfx = async () => {
|
||||
await mami.getSoundLibrary().play('touhou:pichuun');
|
||||
await mami.sound.library.play('touhou:pichuun');
|
||||
};
|
||||
const playBannedBgm = async preload => {
|
||||
const name = 'touhou:th10score';
|
||||
const soundLib = mami.getSoundLibrary();
|
||||
|
||||
if(preload) {
|
||||
await soundLib.loadBuffer(name);
|
||||
await mami.sound.library.loadBuffer(name);
|
||||
return;
|
||||
}
|
||||
|
||||
const source = await soundLib.loadSource(name);
|
||||
const source = await mami.sound.library.loadSource(name);
|
||||
source.setLoop(true, 10.512, 38.074);
|
||||
await source.play();
|
||||
};
|
||||
|
@ -564,10 +559,10 @@ Umi.Protocol.SockChat.Protocol = function(views, settings) {
|
|||
|
||||
if(settings.get('playJokeSounds'))
|
||||
try {
|
||||
const trigger = mami.getTextTriggers().getTrigger(text);
|
||||
const trigger = mami.textTriggers.getTrigger(text);
|
||||
if(trigger.isSoundType()) {
|
||||
sound = '';
|
||||
mami.getSoundLibrary().play(
|
||||
mami.sound.library.play(
|
||||
trigger.getRandomSoundName(),
|
||||
trigger.getVolume(),
|
||||
trigger.getRate()
|
||||
|
|
30
src/mami.js/sound/context.js
Normal file
30
src/mami.js/sound/context.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include audio/context.js
|
||||
#include sound/sndmgr.js
|
||||
#include sound/sndlibrary.js
|
||||
#include sound/sndpacks.js
|
||||
|
||||
const MamiSoundContext = function() {
|
||||
const audioCtx = new MamiAudioContext;
|
||||
const manager = new MamiSoundManager(audioCtx);
|
||||
const library = new MamiSoundLibrary(manager);
|
||||
const packs = new MamiSoundPacks;
|
||||
const packPlayer = new MamiSoundPackPlayer(library);
|
||||
|
||||
const pub = {};
|
||||
|
||||
Object.defineProperties(pub, {
|
||||
audio: { value: audioCtx, enumerable: true },
|
||||
manager: { value: manager, enumerable: true },
|
||||
library: { value: library, enumerable: true },
|
||||
packs: { value: packs, enumerable: true },
|
||||
packPlayer: { value: packPlayer, enumerable: true },
|
||||
|
||||
ready: { get: audioCtx.isReady, enumerable: true },
|
||||
volume: { get: audioCtx.getVolume, set: audioCtx.setVolume, enumerable: true },
|
||||
muted: { get: audioCtx.isMuted, set: audioCtx.setMuted, enumerable: true },
|
||||
});
|
||||
|
||||
pub.reset = audioCtx.reset;
|
||||
|
||||
return Object.freeze(pub);
|
||||
};
|
|
@ -20,7 +20,7 @@ const OsuKeys = (() => {
|
|||
else
|
||||
soundName = `press${rng.next(1, 5)}`;
|
||||
|
||||
mami.getSoundLibrary().play(
|
||||
mami.sound.library.play(
|
||||
`osu:key:${soundName}`,
|
||||
undefined,
|
||||
sndRng ? (1.8 - (rng.sample() * 1.5)) : undefined
|
||||
|
|
|
@ -6,121 +6,117 @@ Umi.Sound = (() => {
|
|||
if(!sound || sound === 'none')
|
||||
return;
|
||||
|
||||
const settings = mami.getSettings();
|
||||
const sndLib = mami.getSoundLibrary();
|
||||
const sndPackPlay = mami.getSoundPackPlayer();
|
||||
|
||||
switch(sound) {
|
||||
case 'join':
|
||||
if(!settings.get('soundEnableJoin'))
|
||||
if(!mami.settings.get('soundEnableJoin'))
|
||||
return;
|
||||
|
||||
if(settings.get('seinfeld')) {
|
||||
sndLib.play(Seinfeld.getRandom());
|
||||
if(mami.settings.get('seinfeld')) {
|
||||
mami.sound.library.play(Seinfeld.getRandom());
|
||||
break;
|
||||
}
|
||||
|
||||
switch(settings.get('minecraft')) {
|
||||
switch(mami.settings.get('minecraft')) {
|
||||
case 'yes':
|
||||
sndLib.play('minecraft:door:open');
|
||||
mami.sound.library.play('minecraft:door:open');
|
||||
break;
|
||||
|
||||
case 'old':
|
||||
sndLib.play('minecraft:door:open-old');
|
||||
mami.sound.library.play('minecraft:door:open-old');
|
||||
break;
|
||||
|
||||
default:
|
||||
sndPackPlay.playEvent('join');
|
||||
mami.sound.packPlayer.playEvent('join');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'leave':
|
||||
if(!settings.get('soundEnableLeave'))
|
||||
if(!mami.settings.get('soundEnableLeave'))
|
||||
return;
|
||||
|
||||
switch(settings.get('minecraft')) {
|
||||
switch(mami.settings.get('minecraft')) {
|
||||
case 'yes':
|
||||
sndLib.play('minecraft:door:close');
|
||||
mami.sound.library.play('minecraft:door:close');
|
||||
break;
|
||||
|
||||
case 'old':
|
||||
sndLib.play('minecraft:door:close-old');
|
||||
mami.sound.library.play('minecraft:door:close-old');
|
||||
break;
|
||||
|
||||
default:
|
||||
sndPackPlay.playEvent('leave');
|
||||
mami.sound.packPlayer.playEvent('leave');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'error':
|
||||
if(!settings.get('soundEnableError'))
|
||||
if(!mami.settings.get('soundEnableError'))
|
||||
return;
|
||||
|
||||
sndPackPlay.playEvent('error');
|
||||
mami.sound.packPlayer.playEvent('error');
|
||||
break;
|
||||
|
||||
case 'server':
|
||||
if(!settings.get('soundEnableServer'))
|
||||
if(!mami.settings.get('soundEnableServer'))
|
||||
return;
|
||||
|
||||
sndPackPlay.playEvent('server');
|
||||
mami.sound.packPlayer.playEvent('server');
|
||||
break;
|
||||
|
||||
case 'unban':
|
||||
if(!settings.get('soundEnableServer'))
|
||||
if(!mami.settings.get('soundEnableServer'))
|
||||
return;
|
||||
|
||||
sndPackPlay.playEvent(['unban', 'server']);
|
||||
mami.sound.packPlayer.playEvent(['unban', 'server']);
|
||||
break;
|
||||
|
||||
case 'incoming':
|
||||
if(!settings.get('soundEnableIncoming'))
|
||||
if(!mami.settings.get('soundEnableIncoming'))
|
||||
return;
|
||||
|
||||
if(settings.get('windowsLiveMessenger')) {
|
||||
sndLib.play('msn:incoming');
|
||||
if(mami.settings.get('windowsLiveMessenger')) {
|
||||
mami.sound.library.play('msn:incoming');
|
||||
} else {
|
||||
sndPackPlay.playEvent('incoming');
|
||||
mami.sound.packPlayer.playEvent('incoming');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'outgoing':
|
||||
if(!settings.get('soundEnableOutgoing'))
|
||||
if(!mami.settings.get('soundEnableOutgoing'))
|
||||
return;
|
||||
|
||||
sndPackPlay.playEvent('outgoing');
|
||||
mami.sound.packPlayer.playEvent('outgoing');
|
||||
break;
|
||||
|
||||
case 'private':
|
||||
case 'incoming-priv':
|
||||
if(!settings.get('soundEnablePrivate'))
|
||||
if(!mami.settings.get('soundEnablePrivate'))
|
||||
return;
|
||||
|
||||
sndPackPlay.playEvent(['incoming-priv', 'incoming']);
|
||||
mami.sound.packPlayer.playEvent(['incoming-priv', 'incoming']);
|
||||
break;
|
||||
|
||||
case 'flood':
|
||||
if(!settings.get('soundEnableForceLeave'))
|
||||
if(!mami.settings.get('soundEnableForceLeave'))
|
||||
return;
|
||||
|
||||
sndPackPlay.playEvent(['flood', 'kick', 'leave']);
|
||||
mami.sound.packPlayer.playEvent(['flood', 'kick', 'leave']);
|
||||
break;
|
||||
|
||||
case 'timeout':
|
||||
if(!settings.get('soundEnableForceLeave'))
|
||||
if(!mami.settings.get('soundEnableForceLeave'))
|
||||
return;
|
||||
|
||||
sndPackPlay.playEvent(['timeout', 'leave']);
|
||||
mami.sound.packPlayer.playEvent(['timeout', 'leave']);
|
||||
break;
|
||||
|
||||
case 'kick':
|
||||
case 'forceLeave':
|
||||
if(!settings.get('soundEnableForceLeave'))
|
||||
if(!mami.settings.get('soundEnableForceLeave'))
|
||||
return;
|
||||
|
||||
sndPackPlay.playEvent(['kick', 'leave']);
|
||||
mami.sound.packPlayer.playEvent(['kick', 'leave']);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -55,11 +55,9 @@ const MamiDomainTransition = function(onImport, onDismiss) {
|
|||
</div>
|
||||
</div>;
|
||||
|
||||
const soundLib = mami.getSoundLibrary();
|
||||
const soundRNG = new MamiRNG();
|
||||
const soundNames = soundLib.names();
|
||||
|
||||
const playRandomSound = () => soundLib.play(soundNames[soundRNG.next(soundNames.length)]);
|
||||
const soundNames = mami.sound.library.names();
|
||||
const playRandomSound = () => mami.sound.library.play(soundNames[soundRNG.next(soundNames.length)]);
|
||||
|
||||
for(let i = 0; i < 10; ++i)
|
||||
eggsTarget.appendChild(<i class="fas fa-egg fa-3x" onclick={() => playRandomSound()} />);
|
||||
|
|
|
@ -34,7 +34,7 @@ Umi.UI.Emoticons = (function() {
|
|||
});
|
||||
},
|
||||
Parse: function(element, message) {
|
||||
if(!mami.getSettings().get('enableEmoticons'))
|
||||
if(!mami.settings.get('enableEmoticons'))
|
||||
return element;
|
||||
|
||||
let inner = element.innerHTML;
|
||||
|
|
|
@ -37,12 +37,10 @@ Umi.UI.Hooks = (function() {
|
|||
if(!document.hidden)
|
||||
return;
|
||||
|
||||
const settings = mami.getSettings();
|
||||
|
||||
if(settings.get('flashTitle')) {
|
||||
if(mami.settings.get('flashTitle')) {
|
||||
let titleText = ' ' + msg.getUser().getName(),
|
||||
channel = Umi.Channels.Current() || null;
|
||||
if(msg.getUser().isBot() && settings.get('showServerMsgInTitle'))
|
||||
if(msg.getUser().isBot() && mami.settings.get('showServerMsgInTitle'))
|
||||
titleText = ' ' + msg.getText();
|
||||
|
||||
if(channel !== null && channel.getName() !== msg.getChannel())
|
||||
|
@ -54,14 +52,14 @@ Umi.UI.Hooks = (function() {
|
|||
]);
|
||||
}
|
||||
|
||||
if(settings.get('enableNotifications') && Umi.User.getCurrentUser() !== null) {
|
||||
const triggers = (settings.get('notificationTriggers') || '').toLowerCase().split(' '),
|
||||
if(mami.settings.get('enableNotifications') && Umi.User.getCurrentUser() !== null) {
|
||||
const triggers = (mami.settings.get('notificationTriggers') || '').toLowerCase().split(' '),
|
||||
options = {};
|
||||
|
||||
triggers.push((Umi.User.getCurrentUser() || { getName: function() { return ''; } }).getName().toLowerCase());
|
||||
options.body = 'Click here to see what they said.';
|
||||
|
||||
if(settings.get('notificationShowMessage'))
|
||||
if(mami.settings.get('notificationShowMessage'))
|
||||
options.body += "\n" + msg.getText();
|
||||
|
||||
const avatarUrl = futami.get('avatar');
|
||||
|
@ -76,7 +74,7 @@ Umi.UI.Hooks = (function() {
|
|||
|
||||
if(message.toLowerCase().indexOf(' ' + trigger + ' ') >= 0) {
|
||||
new Notification('{0} mentioned you!'.replace('{0}', msg.getUser().getName()), options);
|
||||
if(settings.get('onlySoundOnMention'))
|
||||
if(mami.settings.get('onlySoundOnMention'))
|
||||
Umi.Sound.Play('incoming');
|
||||
break;
|
||||
}
|
||||
|
@ -146,7 +144,7 @@ Umi.UI.Hooks = (function() {
|
|||
const elemParent = elemInput.parentNode;
|
||||
let height = 40;
|
||||
|
||||
if(mami.getSettings().get('expandTextBox') && elemInput.scrollHeight > elemInput.clientHeight)
|
||||
if(mami.settings.get('expandTextBox') && elemInput.scrollHeight > elemInput.clientHeight)
|
||||
height = elemInput.scrollHeight;
|
||||
|
||||
if(height > 40)
|
||||
|
|
|
@ -29,7 +29,6 @@ Umi.UI.Messages = (function() {
|
|||
eMeta = null,
|
||||
eUser = null;
|
||||
|
||||
const settings = mami.getSettings();
|
||||
const sender = msg.getUser();
|
||||
let avatarUser = sender,
|
||||
avatarSize = '80';
|
||||
|
@ -61,7 +60,7 @@ Umi.UI.Messages = (function() {
|
|||
+ ':' + msgDateTimeObj.getMinutes().toString().padStart(2, '0')
|
||||
+ ':' + msgDateTimeObj.getSeconds().toString().padStart(2, '0');
|
||||
|
||||
if(sender.isBot() && settings.get('fancyInfo')) {
|
||||
if(sender.isBot() && mami.settings.get('fancyInfo')) {
|
||||
const botInfo = msg.getBotInfo();
|
||||
|
||||
if(botInfo) {
|
||||
|
@ -153,7 +152,7 @@ Umi.UI.Messages = (function() {
|
|||
|
||||
const urls = [];
|
||||
|
||||
if(settings.get('autoParseUrls')) {
|
||||
if(mami.settings.get('autoParseUrls')) {
|
||||
const textSplit = eText.innerText.split(' ');
|
||||
for(const textPart of textSplit) {
|
||||
const uri = Umi.URI.Parse(textPart);
|
||||
|
@ -177,7 +176,7 @@ Umi.UI.Messages = (function() {
|
|||
}
|
||||
}
|
||||
|
||||
if(settings.get('weeaboo')) {
|
||||
if(mami.settings.get('weeaboo')) {
|
||||
eText.appendChild($t(Weeaboo.getTextSuffix(sender)));
|
||||
|
||||
const kaomoji = Weeaboo.getRandomKaomoji(true, msg);
|
||||
|
@ -187,7 +186,7 @@ Umi.UI.Messages = (function() {
|
|||
}
|
||||
}
|
||||
|
||||
if(settings.get('weeaboo'))
|
||||
if(mami.settings.get('weeaboo'))
|
||||
eUser.appendChild($t(Weeaboo.getNameSuffix(sender)));
|
||||
}
|
||||
|
||||
|
@ -210,14 +209,14 @@ Umi.UI.Messages = (function() {
|
|||
lastMsgUser = sender.getId();
|
||||
lastMsgChannel = msg.getChannel();
|
||||
|
||||
if(settings.get('autoEmbedV1')) {
|
||||
if(mami.settings.get('autoEmbedV1')) {
|
||||
const callEmbedOn = eBase.querySelectorAll('a[onclick^="Umi.Parser.SockChatBBcode.Embed"]');
|
||||
for(const embedElem of callEmbedOn)
|
||||
if(embedElem.dataset.embed !== '1')
|
||||
embedElem.click();
|
||||
}
|
||||
|
||||
if(settings.get('autoScroll'))
|
||||
if(mami.settings.get('autoScroll'))
|
||||
msgsList.scrollTop = msgsList.scrollHeight;
|
||||
|
||||
if(window.CustomEvent)
|
||||
|
|
|
@ -138,13 +138,13 @@ Umi.UI.Settings = (function() {
|
|||
title: 'Sound pack',
|
||||
type: 'select',
|
||||
options: () => {
|
||||
const registry = mami.getSoundPacks();
|
||||
const packs = {};
|
||||
const packs = mami.sound.packs;
|
||||
const options = {};
|
||||
|
||||
for(const name of registry.names())
|
||||
packs[name] = registry.info(name).getTitle();
|
||||
for(const name of packs.names())
|
||||
options[name] = packs.info(name).getTitle();
|
||||
|
||||
return packs;
|
||||
return options;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -293,10 +293,10 @@ Umi.UI.Settings = (function() {
|
|||
invoke: button => {
|
||||
button.disabled = true;
|
||||
|
||||
const triggers = mami.getTextTriggers();
|
||||
const triggers = mami.textTriggers;
|
||||
triggers.clearTriggers();
|
||||
|
||||
if(mami.getSettings().get('playJokeSounds'))
|
||||
if(mami.settings.get('playJokeSounds'))
|
||||
futami.getJson('texttriggers', true)
|
||||
.then(trigInfos => triggers.addTriggers(trigInfos))
|
||||
.finally(() => button.disabled = false);
|
||||
|
@ -325,7 +325,7 @@ Umi.UI.Settings = (function() {
|
|||
if(!confirm('Your current settings will be replaced with the ones in the export. Are you sure you want to continue?'))
|
||||
return;
|
||||
|
||||
(new MamiSettingsBackup(mami.getSettings())).importUpload(document.body);
|
||||
(new MamiSettingsBackup(mami.settings)).importUpload(document.body);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ Umi.UI.Settings = (function() {
|
|||
if(user !== null)
|
||||
fileName = `${user.getName()}'s settings.mami`;
|
||||
|
||||
(new MamiSettingsBackup(mami.getSettings())).exportDownload(document.body, fileName);
|
||||
(new MamiSettingsBackup(mami.settings)).exportDownload(document.body, fileName);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -347,7 +347,7 @@ Umi.UI.Settings = (function() {
|
|||
if(!confirm('This will reset all your settings to their defaults values. Are you sure you want to do this?'))
|
||||
return;
|
||||
|
||||
mami.getSettings().clear();
|
||||
mami.settings.clear();
|
||||
},
|
||||
},
|
||||
],
|
||||
|
@ -394,7 +394,7 @@ Umi.UI.Settings = (function() {
|
|||
type: 'button',
|
||||
invoke: async button => {
|
||||
button.disabled = true;
|
||||
await (new MamiYouAreAnIdiot()).pushOn(mami.getViews());
|
||||
await (new MamiYouAreAnIdiot()).pushOn(mami.views);
|
||||
button.disabled = false;
|
||||
},
|
||||
},
|
||||
|
@ -402,7 +402,7 @@ Umi.UI.Settings = (function() {
|
|||
title: 'Reset audio context',
|
||||
type: 'button',
|
||||
invoke: async () => {
|
||||
mami.getAudio().reset();
|
||||
mami.sound.reset();
|
||||
},
|
||||
},
|
||||
],
|
||||
|
@ -417,11 +417,10 @@ Umi.UI.Settings = (function() {
|
|||
};
|
||||
|
||||
const createSetting = function(display) {
|
||||
const settings = mami.getSettings();
|
||||
let setting;
|
||||
|
||||
if('name' in display)
|
||||
setting = settings.info(display.name);
|
||||
setting = mami.settings.info(display.name);
|
||||
|
||||
let input = display.type === 'select'
|
||||
? <select class="setting__input"/>
|
||||
|
@ -446,18 +445,18 @@ Umi.UI.Settings = (function() {
|
|||
input.disabled = true;
|
||||
|
||||
if(display.type === 'checkbox') {
|
||||
settings.watch(setting.name, v => input.checked = v);
|
||||
mami.settings.watch(setting.name, v => input.checked = v);
|
||||
input.addEventListener('change', () => {
|
||||
if(display.confirm !== undefined && input.checked !== setting.fallback && !confirm(display.confirm)) {
|
||||
input.checked = setting.fallback;
|
||||
return;
|
||||
}
|
||||
|
||||
settings.toggle(setting.name);
|
||||
mami.settings.toggle(setting.name);
|
||||
});
|
||||
} else {
|
||||
settings.watch(setting.name, v => input.value = v);
|
||||
input.addEventListener('change', () => settings.set(setting.name, input.value));
|
||||
mami.settings.watch(setting.name, v => input.value = v);
|
||||
input.addEventListener('change', () => mami.settings.set(setting.name, input.value));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ Umi.UI.Users = (function() {
|
|||
}
|
||||
|
||||
if(isClosed) {
|
||||
if(mami.getSettings().get('autoCloseUserContext'))
|
||||
if(mami.settings.get('autoCloseUserContext'))
|
||||
toggleTimeouts[prefix] = setTimeout(function() {
|
||||
if(mami.getSettings().get('autoCloseUserContext'))
|
||||
if(mami.settings.get('autoCloseUserContext'))
|
||||
toggleUser(id);
|
||||
}, 300000);
|
||||
|
||||
|
@ -155,7 +155,7 @@ Umi.UI.Users = (function() {
|
|||
if(isAFK)
|
||||
uName.appendChild($e({ attrs: { 'class': 'user-sidebar-afk' }, child: afkText }));
|
||||
|
||||
if(sbUserName.length > 16 || mami.getSettings().get('marqueeAllNames')) {
|
||||
if(sbUserName.length > 16 || mami.settings.get('marqueeAllNames')) {
|
||||
uName.appendChild($e({
|
||||
tag: 'marquee',
|
||||
attrs: {
|
||||
|
@ -205,7 +205,7 @@ Umi.UI.Users = (function() {
|
|||
if(isAFK)
|
||||
uName.appendChild($e({ attrs: { 'class': 'user-sidebar-afk' }, child: afkText }));
|
||||
|
||||
if(sbUserName.length > 16 || mami.getSettings().get('marqueeAllNames')) {
|
||||
if(sbUserName.length > 16 || mami.settings.get('marqueeAllNames')) {
|
||||
uName.appendChild($e({
|
||||
tag: 'marquee',
|
||||
attrs: {
|
||||
|
|
|
@ -27,8 +27,7 @@ Umi.UI.View = (function() {
|
|||
return {
|
||||
AccentColours: accentColours,
|
||||
AccentReload: function() {
|
||||
const settings = mami.getSettings()
|
||||
const style = settings.get('style');
|
||||
const style = mami.settings.get('style');
|
||||
|
||||
if(!accentColours.hasOwnProperty(style))
|
||||
return;
|
||||
|
@ -39,11 +38,11 @@ Umi.UI.View = (function() {
|
|||
|
||||
const chat = $i('umi-chat');
|
||||
if(chat instanceof Element) {
|
||||
const compactView = settings.get('compactView');
|
||||
const compactView = mami.settings.get('compactView');
|
||||
chat.classList.toggle('chat--compact', compactView);
|
||||
$i('umi-messages').classList.toggle('chat--compact', compactView);
|
||||
|
||||
const forceOldOff = settings.get('tmpDisableOldThemeSys');
|
||||
const forceOldOff = mami.settings.get('tmpDisableOldThemeSys');
|
||||
for(const name in accentColours)
|
||||
if(accentColours.hasOwnProperty(name))
|
||||
chat.classList.toggle(`umi--${name}`, !forceOldOff && name === style);
|
||||
|
|
|
@ -2,9 +2,9 @@ const UmiWebSocket = function(server, message, useWorker) {
|
|||
if(typeof useWorker === 'undefined')
|
||||
useWorker = (function() {
|
||||
// Overrides
|
||||
if(mami.getSettings().get('neverUseWorker'))
|
||||
if(mami.settings.get('neverUseWorker'))
|
||||
return false;
|
||||
if(mami.getSettings().get('forceUseWorker'))
|
||||
if(mami.settings.get('forceUseWorker'))
|
||||
return true;
|
||||
|
||||
// Detect chromosomes
|
||||
|
|
|
@ -23,7 +23,7 @@ const MamiYouAreAnIdiot = function() {
|
|||
getElement: () => html,
|
||||
onViewPush: async () => {
|
||||
try {
|
||||
soundSrc = await mami.getSoundLibrary().loadSource('misc:youare');
|
||||
soundSrc = await mami.sound.library.loadSource('misc:youare');
|
||||
soundSrc.setMuted(true);
|
||||
soundSrc.setLoop(true, 0.21, 5);
|
||||
soundSrc.play();
|
||||
|
|
Loading…
Reference in a new issue