From 0876fc3c2edf2f3912ed9b1f841964cce096baf0 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sun, 1 Sep 2019 17:13:03 +0200 Subject: [PATCH] Use the Fetch API instead of PrototypeJS --- static/admin.html | 5 ++--- static/js/youp0m.js | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/static/admin.html b/static/admin.html index c1b1445..2fc8f91 100644 --- a/static/admin.html +++ b/static/admin.html @@ -4,9 +4,6 @@ YouP0m Administration - - -

Welcome on YouP0m!

@@ -19,5 +16,7 @@ + + diff --git a/static/js/youp0m.js b/static/js/youp0m.js index 2cb2ad4..73dac11 100644 --- a/static/js/youp0m.js +++ b/static/js/youp0m.js @@ -50,6 +50,11 @@ function show_picture(id) { return; } + if (picts.length == 0) { + document.body.innerHTML = '

Welcome on YouP0m!

There is no image currently, come back soon!

'; + return + } + if (id == null || id == "") id = picts[Math.floor(Math.random() * picts.length)].name; @@ -112,7 +117,7 @@ function display_picture(pict, next) { } function display_error(msg) { - $$("body")[0].innerHTML = '

An error occurs

' + msg + '

'; + document.body.innerHTML = '

An error occurs

' + msg + '

'; } function sync() {