From 6b483dafbae13c585b60008e9f605f758b966308 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sat, 11 Aug 2018 11:28:25 +0200 Subject: [PATCH] Several updates --- index.php | 2 +- js/crypto/sha.ts | 2 ++ js/load.ts | 1 + js/ui/frames/SelectedItemInfo.ts | 4 ++-- js/utils/modal.ts | 8 +++++++- public_files.sh | 5 ++++- tsconfig.json | 2 +- tsconfig/tsconfig_base.json | 2 +- 8 files changed, 19 insertions(+), 7 deletions(-) diff --git a/index.php b/index.php index 9e6d7d67..0f40c17b 100644 --- a/index.php +++ b/index.php @@ -71,7 +71,7 @@ gtag('config', 'UA-113151733-4');
- +
diff --git a/js/crypto/sha.ts b/js/crypto/sha.ts index 0af3eeff..761b216e 100644 --- a/js/crypto/sha.ts +++ b/js/crypto/sha.ts @@ -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 { let buffer = message instanceof ArrayBuffer ? message : new TextEncoder().encode(message); diff --git a/js/load.ts b/js/load.ts index c7d56383..2bd97645 100644 --- a/js/load.ts +++ b/js/load.ts @@ -57,6 +57,7 @@ namespace app { l(); } } + if(typeof Module === "undefined") this["Module"] = {}; app.initialize(); diff --git a/js/ui/frames/SelectedItemInfo.ts b/js/ui/frames/SelectedItemInfo.ts index 4e6d2761..1e3a9383 100644 --- a/js/ui/frames/SelectedItemInfo.ts +++ b/js/ui/frames/SelectedItemInfo.ts @@ -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.
{}".format(error)).open(); + createErrorModal("Failed to execute play", MessageHelper.formatMessage("Failed to execute play.
{}", 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.
{}".format(error)).open(); + createErrorModal("Failed to execute pause", MessageHelper.formatMessage("Failed to execute pause.
{}", error)).open(); this.triggerUpdate(); }); } diff --git a/js/utils/modal.ts b/js/utils/modal.ts index 236cf660..ca1a7b09 100644 --- a/js/utils/modal.ts +++ b/js/utils/modal.ts @@ -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 $("
" + val + "
"); case "object": return val as JQuery; diff --git a/public_files.sh b/public_files.sh index 924d3d14..383d513e 100755 --- a/public_files.sh +++ b/public_files.sh @@ -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 \ No newline at end of file +#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 + + diff --git a/tsconfig.json b/tsconfig.json index 42cc88e8..dbba4680 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "none", - "target": "es6", + "target": "es2016", "sourceMap": true }, "exclude": [ diff --git a/tsconfig/tsconfig_base.json b/tsconfig/tsconfig_base.json index 72e10888..1eb047d6 100644 --- a/tsconfig/tsconfig_base.json +++ b/tsconfig/tsconfig_base.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "none", - "target": "es5", + "target": "es2016", "sourceMap": true }, "exclude": [