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){
e.preventDefault();
$("#login_form").submit();
})
window.addEventListener("DOMContentLoaded", function() {
document.getElementById("login_button").addEventListener("click", function(event) {
this.preventDefault();
document.querySelector("#login_form").submit();
});
$(document).ready(function(){
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.getElementById("login_form").addEventListener("submit", function(event) {
if(this.password.value == "" || this.username.value == ""){
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"});
}
});
$(document).on("submit", "#login_form", function(e){
if(this.password.value == "" || this.username.value == ""){
e.preventDefault();
}
})

View File

@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<head>
<meta charset="utf-8" />
<title>
Zoff Admin
Zoff Admin
</title>
<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">
@@ -15,56 +15,52 @@
<meta property="og:description" content="Zoff admin panel">
<meta property="og:type" content="website">
<link rel="icon" id="favicon" type="image/png" href="https://zoff.me/assets/images/favicon.png">
<script
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">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<!-- Compiled and minified JavaScript -->
<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 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="/assets/admin/{{{where_get}}}/js/main.js"></script>
<style>
.preloader-wrapper {
.preloader-wrapper {
margin-top:15%;
}
}
.spinner-zoff-only {
.spinner-zoff-only {
border-color: #2d2d2d !important;
}
.tab a{
}
.tab a{
color: black !important;
}
}
.name-chat {
.name-chat {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
}
.chat-icon {
.chat-icon {
width: 16px;
height: auto;
margin-right: 2px;
}
}
.tabs_admin{
.tabs_admin{
margin-bottom:20px;
}
}
.tabs_admin .indicator{
.tabs_admin .indicator{
width: initial !important;
background: black !important;
}
}
</style>
</head>
<body>
</head>
<body>
{{{body}}}
</body>
<script type="text/javascript" src="/assets/admin/{{{where_get}}}/js/main.js"></script>
</body>
</html>