From a52f2c3da7f08d4337ef1520547bffbe936ff9af Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Tue, 2 Aug 2022 14:13:35 +0100 Subject: [PATCH] Preparing to add AJAX --- account/account.php | 1 + account/login.php | 1 + account/password-reset.php | 1 + account/signup.php | 1 + css/master.css | 27 ++++++++++++++------------- image.php | 7 +++++-- index.php | 8 ++++---- scripts/flyout.js | 28 +++++++++++++++------------- scripts/top.js | 18 ++++++++++-------- ui/functions.php | 5 ++++- ui/header.php | 14 -------------- ui/required.php | 20 ++++++++++++++++++++ upload.php | 1 + 13 files changed, 77 insertions(+), 55 deletions(-) create mode 100644 ui/required.php diff --git a/account/account.php b/account/account.php index ae2bfa1..624ca5e 100644 --- a/account/account.php +++ b/account/account.php @@ -11,6 +11,7 @@ diff --git a/account/login.php b/account/login.php index 8046253..c013abf 100644 --- a/account/login.php +++ b/account/login.php @@ -11,6 +11,7 @@ - +
-
+
"; diff --git a/index.php b/index.php index 5714c56..5392535 100644 --- a/index.php +++ b/index.php @@ -10,7 +10,10 @@ - +
"; - include("ui/top.html"); include("ui/footer.php"); ?> diff --git a/scripts/flyout.js b/scripts/flyout.js index d9a3a70..12a99cb 100644 --- a/scripts/flyout.js +++ b/scripts/flyout.js @@ -1,17 +1,19 @@ console.log(" . . /|/| . . . . . . . \n .. /0 0 \\ . . . . . .. \n (III% . \\________, . . \n .. .\\_, .%###%/ \\'\\,.. \n . . . .||#####| |'\\ \\. \n .. . . ||. . .|/. .\\V. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . .|| . . || . . . \n .. . . ||. . .||. . .. \n . . . cc/ . .cc/ . . ."); -let show = document.querySelectorAll(".flyout-display"); -let hide = document.querySelector(".flyout-close"); +$(document).ready(function() { + let show = document.querySelectorAll(".flyout-display"); + let hide = document.querySelector(".flyout-close"); -show.forEach(function(){ - document.querySelector(".flyout").style.transform= "translateX(-50%) scale(1)"; - document.querySelector(".flyout").style.bottom= "-1rem"; - document.querySelector(".flyout-dim").style.display= "block"; -}); - - -hide.addEventListener("click", function(){ - document.querySelector(".flyout").style.transform= "translateX(-50%) scale(0.8)"; - document.querySelector(".flyout").style.bottom= "-20rem"; - document.querySelector(".flyout-dim").style.display= "none"; + show.forEach(function(){ + document.querySelector(".flyout").style.transform= "translateX(-50%) scale(1)"; + document.querySelector(".flyout").style.bottom= "-1rem"; + document.querySelector(".flyout-dim").style.display= "block"; + }); + + + hide.addEventListener("click", function(){ + document.querySelector(".flyout").style.transform= "translateX(-50%) scale(0.8)"; + document.querySelector(".flyout").style.bottom= "-20rem"; + document.querySelector(".flyout-dim").style.display= "none"; + }); }); diff --git a/scripts/top.js b/scripts/top.js index 3fef094..87f2b5c 100644 --- a/scripts/top.js +++ b/scripts/top.js @@ -1,11 +1,13 @@ -button = document.getElementById("back-to-top"); +$(document).ready(function() { + button = document.getElementById("back-to-top"); -window.onscroll = function() {scrollFunction()}; + window.onscroll = function() {scrollFunction()}; -function scrollFunction() { - if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) { - button.style.right = "1rem"; - } else { - button.style.right = "-2.5rem"; + function scrollFunction() { + if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) { + button.style.right = "1rem"; + } else { + button.style.right = "-2.5rem"; + } } -} +}); diff --git a/ui/functions.php b/ui/functions.php index f5a341a..fadd86b 100644 --- a/ui/functions.php +++ b/ui/functions.php @@ -150,6 +150,9 @@ function flyout($header, $content, $action) { // Exit button + Div End echo "
"; + + // Must be included with flyout.php + echo ""; } @@ -166,7 +169,7 @@ function flyout($header, $content, $action) { returns notification html including classes - ===== Editors note ================================== + ===== Programmers note ============================== I made this so I didn't have to remake the html portion of the notification, it was annoying. This also allows for expanding the system later on! diff --git a/ui/header.php b/ui/header.php index 47a98d8..13a6f0c 100644 --- a/ui/header.php +++ b/ui/header.php @@ -1,18 +1,4 @@ connect_error) { - echo "

Could not connect to database

"; -} - // Check which directory icons are in if (is_dir("assets/icons/")) { $dir = "assets/icons/"; diff --git a/ui/required.php b/ui/required.php new file mode 100644 index 0000000..8f575e0 --- /dev/null +++ b/ui/required.php @@ -0,0 +1,20 @@ +connect_error) { + echo "

Could not connect to database

"; +} +?> + diff --git a/upload.php b/upload.php index 5420e60..e8f2e06 100644 --- a/upload.php +++ b/upload.php @@ -11,6 +11,7 @@