Several updates

This commit is contained in:
WolverinDEV 2018-08-11 11:28:25 +02:00
parent fb05359073
commit 6b483dafba
8 changed files with 19 additions and 7 deletions

View file

@ -71,7 +71,7 @@
gtag('config', 'UA-113151733-4');
</script>
<div id="scripts">
<script type="application/ecmascript" src="js/load.js" defer></script>
<script type="application/javascript" src="js/load.js" defer></script>
</div>
</head>
<body>

View file

@ -1,8 +1,10 @@
//Source: https://www.movable-type.co.uk/scripts/sha1.html
/*
declare class TextEncoder {
encode(msg) : ArrayBuffer;
}
*/
namespace sha {
export function sha1(message: string | ArrayBuffer) : PromiseLike<ArrayBuffer> {
let buffer = message instanceof ArrayBuffer ? message : new TextEncoder().encode(message);

View file

@ -57,6 +57,7 @@ namespace app {
l();
}
}
if(typeof Module === "undefined")
this["Module"] = {};
app.initialize();

View file

@ -327,7 +327,7 @@ class MusicInfoManager extends ClientInfoManager {
botid: bot.properties.client_database_id,
action: 1
}).then(updated => this.triggerUpdate()).catch(error => {
createErrorModal("Failed to execute play", "Failed to execute play.<br>{}".format(error)).open();
createErrorModal("Failed to execute play", MessageHelper.formatMessage("Failed to execute play.<br>{}", error)).open();
this.triggerUpdate();
});
}
@ -340,7 +340,7 @@ class MusicInfoManager extends ClientInfoManager {
botid: bot.properties.client_database_id,
action: 2
}).then(updated => this.triggerUpdate()).catch(error => {
createErrorModal("Failed to execute pause", "Failed to execute pause.<br>{}".format(error)).open();
createErrorModal("Failed to execute pause", MessageHelper.formatMessage("Failed to execute pause.<br>{}", error)).open();
this.triggerUpdate();
});
}

View file

@ -4,7 +4,7 @@ $(document).on("mousedown",function (e) {
}
});
type BodyCreator = (() => JQuery | string) | string | JQuery;
type BodyCreator = (() => JQuery | JQuery[] | string) | string | JQuery | JQuery[];
const ModalFunctions = {
divify: function (val: JQuery) {
if(val.length > 1) return $.spawn("div").append(val);
@ -13,6 +13,12 @@ const ModalFunctions = {
jqueriefy: function(val: BodyCreator) : JQuery {
if($.isFunction(val)) val = val();
if($.isArray(val)) {
let result = $.spawn("div");
for(let element of val)
this.jqueriefy(element).appendTo(result);
return result;
}
switch (typeof val){
case "string": return $("<div>" + val + "</div>");
case "object": return val as JQuery;

View file

@ -1,3 +1,6 @@
#!/usr/bin/env bash
tsc -p tsconfig/tsconfig_release.json
uglifyjs -c --source-map --verbose -o generated/js/client.min.js generated/js/client.js
#uglifyjs -c --source-map --verbose -o generated/js/client.min.js generated/js/client.js
mv generated/js/client.js generated/js/client.min.js

View file

@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "none",
"target": "es6",
"target": "es2016",
"sourceMap": true
},
"exclude": [

View file

@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "none",
"target": "es5",
"target": "es2016",
"sourceMap": true
},
"exclude": [