diff --git a/resources/assets/less/yuuno/bem/busy.less b/resources/assets/less/yuuno/bem/busy.less deleted file mode 100644 index 82df6b0..0000000 --- a/resources/assets/less/yuuno/bem/busy.less +++ /dev/null @@ -1,27 +0,0 @@ -.busy { - background: #222; - background: linear-gradient(0deg, rgba(0, 0, 0, .4), transparent) rgba(0, 0, 0, .8); - position: fixed; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 5; - text-align: center; - opacity: 1; - display: flex; - align-items: center; - justify-content: center; - - &__content { - line-height: 2em; - color: #FFF; - display: inline-block; - padding: 10px 20px 15px; - border-radius: 10px; - } - - &__text { - line-height: 2em; - } -} diff --git a/resources/assets/less/yuuno/main.less b/resources/assets/less/yuuno/main.less index 1174180..4af1864 100644 --- a/resources/assets/less/yuuno/main.less +++ b/resources/assets/less/yuuno/main.less @@ -10,7 +10,6 @@ @import "bem/auth"; @import "bem/avatar"; @import "bem/bbcode"; -@import "bem/busy"; @import "bem/comment"; @import "bem/container"; @import "bem/content"; diff --git a/resources/assets/typescript/Yuuno/Busy.ts b/resources/assets/typescript/Yuuno/Busy.ts deleted file mode 100644 index 0f71c9c..0000000 --- a/resources/assets/typescript/Yuuno/Busy.ts +++ /dev/null @@ -1,47 +0,0 @@ -namespace Yuuno -{ - export class Busy - { - private static Container: HTMLElement; - private static Text: HTMLElement; - private static Icon: HTMLElement; - - public static Init(): void - { - this.Container = Sakura.DOM.ID('busy-window'); - this.Text = Sakura.DOM.ID('busy-status'); - this.Icon = Sakura.DOM.ID('busy-icon'); - } - - public static Hide(): void - { - Sakura.DOM.AddClass(this.Container, ['hidden']); - } - - public static Show(mode: BusyMode = BusyMode.BUSY, text: string = null, hideAfter: number = 0): void - { - var icon: string = "fa fa-4x "; - - switch (mode) { - case BusyMode.OK: - icon += 'fa-check'; - break; - case BusyMode.FAIL: - icon += 'fa-remove'; - break; - case BusyMode.BUSY: - default: - icon += 'fa-refresh fa-spin'; - } - - Sakura.DOM.RemoveClass(this.Icon, Sakura.DOM.ClassNames(this.Icon)); - Sakura.DOM.AddClass(this.Icon, icon.split(' ')); - this.Text.innerText = text || ''; - Sakura.DOM.RemoveClass(this.Container, ['hidden']); - - if (hideAfter > 0) { - setTimeout(Busy.Hide, hideAfter); - } - } - } -} diff --git a/resources/assets/typescript/Yuuno/BusyMode.ts b/resources/assets/typescript/Yuuno/BusyMode.ts deleted file mode 100644 index bf28d17..0000000 --- a/resources/assets/typescript/Yuuno/BusyMode.ts +++ /dev/null @@ -1,9 +0,0 @@ -namespace Yuuno -{ - export enum BusyMode - { - OK, - FAIL, - BUSY - } -} diff --git a/resources/assets/typescript/Yuuno/Main.ts b/resources/assets/typescript/Yuuno/Main.ts index a05ce6e..7996248 100644 --- a/resources/assets/typescript/Yuuno/Main.ts +++ b/resources/assets/typescript/Yuuno/Main.ts @@ -9,7 +9,6 @@ namespace Yuuno Sakura.TimeAgo.Init(); Sakura.Friend.Init(); Notifications.Init(); - Busy.Init(); } } } diff --git a/resources/views/yuuno/elements/comments.twig b/resources/views/yuuno/elements/comments.twig index a177f78..e199bf1 100644 --- a/resources/views/yuuno/elements/comments.twig +++ b/resources/views/yuuno/elements/comments.twig @@ -42,21 +42,28 @@ commentClient.ContentType("application/x-www-form-urlencoded"); + function commentError(text) { + var error = new Sakura.Dialogue; + error.Title = "Error"; + error.Text = text; + error.AddCallback(Sakura.DialogueButton.Ok, function () { + this.Close(); + }); + error.Display(); + } + function commentPost(element, url) { var text = element.querySelector('[name="text"]'), session = element.querySelector('[name="session"]'); commentClient.SetSend({"text":text.value,"session":session.value}); - text.value = ''; - commentClient.SetUrl(url); - commentClient.AddCallback(200, function () { - var resp = JSON.parse(commentClient.Response()); + var resp = commentClient.JSON(); if (resp.error) { - Yuuno.Busy.Show(Yuuno.BusyMode.FAIL, resp.error, 1500); + commentError(resp.error); } else { commentAdd(resp); } @@ -243,7 +250,7 @@ var resp = JSON.parse(commentClient.Response()); if (resp.error) { - Yuuno.Busy.Show(Yuuno.BusyMode.FAIL, resp.error, 1500); + commentError(resp.error); } else { Sakura.DOM.Remove(Sakura.DOM.ID('comment-' + id)); } @@ -263,7 +270,7 @@ var resp = JSON.parse(commentClient.Response()); if (resp.error) { - Yuuno.Busy.Show(Yuuno.BusyMode.FAIL, resp.error, 1500); + commentError(resp.error); } else { upvotes.innerText = resp.upvotes; downvotes.innerText = resp.downvotes; diff --git a/resources/views/yuuno/master.twig b/resources/views/yuuno/master.twig index c08c31f..66ddfc4 100644 --- a/resources/views/yuuno/master.twig +++ b/resources/views/yuuno/master.twig @@ -26,12 +26,6 @@ {% endif %} > -