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"){ if(this.password.value == "" || this.username.value == ""){
$("#login_form").prepend("<input type='text' name='token' placeholder='Token' required autocomplete='off' />"); e.preventDefault();
$("#login_form").attr("action", "/signup"); }
} });
if(window.location.hash == "#failed") {
window.location.hash = ""; if(window.location.pathname == "/signup/" || window.location.pathname == "/signup"){
Materialize.toast("Couldn't find a user with that username or password..", 4000, "red lighten"); 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"});
}
}); });
$(document).on("submit", "#login_form", function(e){
if(this.password.value == "" || this.username.value == ""){
e.preventDefault();
}
})

View File

@@ -1,9 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title> <title>
Zoff Admin Zoff Admin
</title> </title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
@@ -15,56 +15,52 @@
<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%;
} }
.spinner-zoff-only { .spinner-zoff-only {
border-color: #2d2d2d !important; border-color: #2d2d2d !important;
} }
.tab a{ .tab a{
color: black !important; color: black !important;
} }
.name-chat { .name-chat {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.chat-icon { .chat-icon {
width: 16px; width: 16px;
height: auto; height: auto;
margin-right: 2px; margin-right: 2px;
} }
.tabs_admin{ .tabs_admin{
margin-bottom:20px; margin-bottom:20px;
} }
.tabs_admin .indicator{ .tabs_admin .indicator{
width: initial !important; width: initial !important;
background: black !important; background: black !important;
} }
</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>