Started refactoring

This commit is contained in:
Kasper Rynning-Tønnesen
2018-08-13 12:40:05 +02:00
parent cc60c48cc4
commit c699db6769
3 changed files with 764 additions and 506 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +1,21 @@
$(document).on("click", "#login_button", function(e){ window.addEventListener("DOMContentLoaded", function() {
e.preventDefault(); document.getElementById("login_button").addEventListener("click", function(event) {
$("#login_form").submit(); this.preventDefault();
}) document.querySelector("#login_form").submit();
});
$(document).ready(function(){ document.getElementById("login_form").addEventListener("submit", function(event) {
if(window.location.pathname == "/signup/" || window.location.pathname == "/signup"){
$("#login_form").prepend("<input type='text' name='token' placeholder='Token' required autocomplete='off' />");
$("#login_form").attr("action", "/signup");
}
if(window.location.hash == "#failed") {
window.location.hash = "";
Materialize.toast("Couldn't find a user with that username or password..", 4000, "red lighten");
}
});
$(document).on("submit", "#login_form", function(e){
if(this.password.value == "" || this.username.value == ""){ if(this.password.value == "" || this.username.value == ""){
e.preventDefault(); e.preventDefault();
} }
}) });
if(window.location.pathname == "/signup/" || window.location.pathname == "/signup"){
document.querySelector("#login_form").insertAdjacentHTML("afterbegin", "<input type='text' name='token' placeholder='Token' required autocomplete='off' />");
document.querySelector("#login_form").setAttribute("action", "/signup");
}
if(window.location.hash == "#failed") {
window.location.hash = "";
M.toast({ html: "Couldn't find a user with that username or password..", displayLength: 4000, classes: "red lighten"});
}
});

View File

@@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title> <title>
Zoff Admin Zoff Admin
@@ -15,19 +15,14 @@
<meta property="og:description" content="Zoff admin panel"> <meta property="og:description" content="Zoff admin panel">
<meta property="og:type" content="website"> <meta property="og:type" content="website">
<link rel="icon" id="favicon" type="image/png" href="https://zoff.me/assets/images/favicon.png"> <link rel="icon" id="favicon" type="image/png" href="https://zoff.me/assets/images/favicon.png">
<script <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/css/materialize.min.css">
src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<!-- Compiled and minified JavaScript --> <!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/js/materialize.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://zoff.me/assets/css/style.css" title="Default" /> <link rel="stylesheet" type="text/css" href="https://zoff.me/assets/css/style.css" title="Default" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.0/socket.io.slim.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.0/socket.io.slim.js"></script>
<script type="text/javascript" src="/assets/admin/{{{where_get}}}/js/main.js"></script>
<style> <style>
.preloader-wrapper { .preloader-wrapper {
margin-top:15%; margin-top:15%;
@@ -63,8 +58,9 @@
} }
</style> </style>
</head> </head>
<body> <body>
{{{body}}} {{{body}}}
</body> <script type="text/javascript" src="/assets/admin/{{{where_get}}}/js/main.js"></script>
</body>
</html> </html>