Use the Fetch API instead of PrototypeJS

This commit is contained in:
nemunaire 2019-09-01 17:13:03 +02:00
parent c622ada0df
commit 0876fc3c2e
2 changed files with 8 additions and 4 deletions

View File

@ -4,9 +4,6 @@
<title>YouP0m Administration</title> <title>YouP0m Administration</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" media="all" href="/css/style.css"> <link rel="stylesheet" media="all" href="/css/style.css">
<script type="text/javascript" src="/js/prototype.js"></script>
<script type="text/javascript" src="/js/youp0m.js"></script>
<script type="text/javascript" src="/js/youp0m-admin.js"></script>
</head> </head>
<body> <body>
<h1>Welcome on YouP0m!</h1> <h1>Welcome on YouP0m!</h1>
@ -19,5 +16,7 @@
<script type="text/javascript"> <script type="text/javascript">
document.write("<h2>We are loading the newest cute pictures for you, please wait&hellip;</h2>"); document.write("<h2>We are loading the newest cute pictures for you, please wait&hellip;</h2>");
</script> </script>
<script type="text/javascript" src="/js/youp0m.js"></script>
<script type="text/javascript" src="/js/youp0m-admin.js"></script>
</body> </body>
</html> </html>

View File

@ -50,6 +50,11 @@ function show_picture(id) {
return; return;
} }
if (picts.length == 0) {
document.body.innerHTML = '<h1>Welcome on YouP0m!</h1><h2>There is no image currently, come back soon!</h2>';
return
}
if (id == null || id == "") if (id == null || id == "")
id = picts[Math.floor(Math.random() * picts.length)].name; id = picts[Math.floor(Math.random() * picts.length)].name;
@ -112,7 +117,7 @@ function display_picture(pict, next) {
} }
function display_error(msg) { function display_error(msg) {
$$("body")[0].innerHTML = '<h1>An error occurs</h1><h2>' + msg + '</h2>'; document.body.innerHTML = '<h1>An error occurs</h1><h2>' + msg + '</h2>';
} }
function sync() { function sync() {