diff --git a/functions/views/css/style.css b/functions/views/css/style.css index 5947c89..b91fd4c 100644 --- a/functions/views/css/style.css +++ b/functions/views/css/style.css @@ -19,6 +19,7 @@ src: url(../fonts/Nunito-Bold.ttf); } + :root { --white: #FFFFFF; --light-gray: #F0F0F0; @@ -33,9 +34,12 @@ --placeholder: #aaaaaa; --input-border: #979797; --input-shadow: #A5A5A5; + --input-shadow-alt: #E5E5E5; --uname: #898989; --red: red; --login-btn: #3D10FF; + --login-hover: whitesmoke; + --login-active: #00df90; --google-login-btn: #cacaca; --google-login-btn-hover: #A5A5A5; --add-item-btn: #ff6619; @@ -137,12 +141,127 @@ input:focus, textarea:focus, select:focus{ .navbar { background-color: var(--white); - height: 55px; + height: 60px; +} + +.login-prompt a{ + float: left; + position: relative; + font-family: osl; + font-size: 23px; + color: var(--uname); + cursor: pointer; + transition: 0.3s; +} +.login-prompt a:hover{ + color: var(--red); +} +.login-prompt a:active{ + color: var(--violet); + transition: 0.1s; +} + +.login-form { + position: absolute; + height: 230px; + width: 230px; + z-index: 3; + top: 45px; + margin-left: 2%; + padding: 10px; + display: block; + border: 0.5px solid var(--input-border); + background-color: var(--white); + box-shadow: 0px 1px 2px var(--input-shadow); +} +.login-form p { + color: var(--search-extra); + font-family: osl; +} +.login-form .login-row { + position: relative; + width: 100%; + display: inline-flex; + height: 30px; + margin-top: 6px; + margin-bottom: 6px; +} +.login-row input { + position: relative; + width: 100%; + padding-left: 5px; + font-family: osl; + font-size: 15px; + border: 0.5px solid var(--input-border); + box-shadow: 0px 2px 3px var(--input-shadow-alt); + +} +.login-row button { + margin-left: 7px; + width: 40px; + background-color: var(--login-btn); + border: none; + font-size: 22px; + color: var(--white); + box-shadow: 0px 2px 3px var(--input-shadow); +} +.a-login-btn { + background-image: url("/media/a_big_logon.png") !important; + background-repeat: no-repeat; + background-size: cover; + border: none; + background-position: 50% 50%; + border-radius: 0; + box-shadow: 0px 2px 3px var(--input-shadow); + cursor: pointer; + transition: 0.3s; +} +.a-login-btn:hover { + box-shadow: 0px 2px 3px var(--login-hover); +} +.a-login-btn:active { + box-shadow: 0px 2px 3px var(--red); + transition: 0.1s; +} +.g-login-btn { + background-image: url("/media/g_big_logon.png") !important; + background-repeat: no-repeat; + background-size: cover; + border: none; + border-radius: 5px; + box-shadow: 0px 2px 3px var(--input-shadow); + cursor: pointer; + transition: 0.3s; +} +.g-login-btn:hover { + box-shadow: 0px 2px 3px var(--login-hover); +} +.g-login-btn:active { + box-shadow: 0px 2px 3px var(--login-active); + transition: 0.1s; +} +.fb-login-btn { + background-image: url("/media/fb_big_logon.png") !important; + background-repeat: no-repeat; + background-size: cover; + background-position: 50% 50%; + border: none; + box-shadow: 0px 2px 3px var(--input-shadow); + cursor: pointer; + transition: 0.3s; +} +.fb-login-btn:hover { + box-shadow: 0px 2px 3px var(--login-hover); +} +.fb-login-btn:active { + box-shadow: 0px 2px 3px var(--login-active); + transition: 0.1s; } .logon-crumbs { - padding-top: 10px; + padding-top: 17px; padding-bottom: 10px; + display: inline-flex; } .logon-crumbs input { @@ -249,7 +368,9 @@ input:focus, textarea:focus, select:focus{ float: right; position: relative; display: inline-flex; - bottom: 10%; + padding-top: 20px; + padding-bottom: 10px; + /* bottom: 10%; */ font-family: osl } @@ -323,10 +444,6 @@ input:focus, textarea:focus, select:focus{ font-family: osl; font-size: 17px; box-shadow: 0px 3px 4px var(--input-shadow); - - /*position: absolute; - left: 50%; - transform: translate(-50%, 0);*/ } .sbar button { @@ -985,4 +1102,5 @@ input:focus, textarea:focus, select:focus{ background: rgb(20, 20, 20); box-shadow: none; } -} */ \ No newline at end of file +} */ + diff --git a/functions/views/js/fAuth.js b/functions/views/js/fAuth.js index 1dd458b..47c7c81 100644 --- a/functions/views/js/fAuth.js +++ b/functions/views/js/fAuth.js @@ -1 +1 @@ -function checkAuth(){firebase.auth().onAuthStateChanged(function(e){if(e){if("dev@dev.dev"==e.email)try{document.getElementById("admin").setAttribute("style","display: block;")}catch(e){}try{document.getElementById("uname-dom").innerHTML="Loading..."}catch(e){}firebase.auth().currentUser.getIdToken().then(function(e){let t={uToken:e},n={method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}};fetch("login-user-api",n).then(e=>e.json()).then(function(e){if(1==e.success)if(e.registered)document.getElementById("uname-dom").innerHTML="Hello, "+e.name;else{try{document.getElementById("uname-dom").innerHTML="Unregistered!",document.getElementById("notifications").innerHTML="🔔 | Register your account",document.getElementById("notifications").setAttribute("href","registration"),document.getElementById("notifications").setAttribute("style","color: red;")}catch(e){}"registration"!=window.location.href.split("/").pop()&&window.location.replace("registration")}else console.log(e.error),document.getElementById("notifications").innerHTML="🔔 | What the fuck just happened.....",document.getElementById("notifications").setAttribute("style","color: pink;")})});try{document.getElementById("uname-field").setAttribute("style","display: block;"),document.getElementById("login-field").setAttribute("style","display: none;"),document.getElementById("uname-field").setAttribute("style","display: block;"),document.getElementById("login-field").setAttribute("style","display: none;")}catch(e){}try{document.getElementById("uAuthMsg").setAttribute("style","display: none;")}catch(e){}try{document.getElementById("authField").setAttribute("style","display: block;")}catch(e){}}else{document.getElementById("uname-field").setAttribute("style","display: none;"),document.getElementById("login-field").setAttribute("style","display: block;"),document.getElementById("uname-dom").innerHTML="Unregistered";try{document.getElementById("uAuthMsg").setAttribute("style","display: block;")}catch(e){}try{document.getElementById("authField").setAttribute("style","display: none;")}catch(e){}}})}function admin_review(){firebase.auth().currentUser.getIdToken().then(function(e){window.location.replace("admin-review?authToken="+e)})}function signinwithgoogle(){var e=new firebase.auth.GoogleAuthProvider;firebase.auth().signInWithPopup(e).then(function(e){console.log("User signed in...")}).catch(function(e){console.log(e)})}function signinwithfb(){var e=new firebase.auth.FacebookAuthProvider;firebase.auth().signInWithPopup(e).then(function(e){console.log("User signed in...")}).catch(function(e){console.log(e)})}function signinwithemail(){const e=document.getElementById("fuid"),t=document.getElementById("fpwd");var n=e.value,i=t.value;firebase.auth().signInWithEmailAndPassword(n,i).catch(e=>console.log(e.message)).then(function(n){t.value="",e.value=""})}function signout(){firebase.auth().signOut(),window.location.replace("home")}checkAuth();try{var pwField=document.getElementById("fpwd");pwField.addEventListener("keyup",function(e){13===e.keyCode&&(e.preventDefault(),document.getElementById("blogin").click())})}catch(e){} \ No newline at end of file +function checkAuth(){firebase.auth().onAuthStateChanged(function(e){if(e){if("dev@dev.dev"==e.email)try{document.getElementById("admin").setAttribute("style","display: block;")}catch(e){}try{document.getElementById("uname-dom").innerHTML="Loading...",document.getElementById("login-form").setAttribute("style","display: none;")}catch(e){}firebase.auth().currentUser.getIdToken().then(function(e){let t={uToken:e},n={method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}};fetch("login-user-api",n).then(e=>e.json()).then(function(e){if(1==e.success)if(e.registered)document.getElementById("uname-dom").innerHTML="Hello, "+e.name;else{try{document.getElementById("uname-dom").innerHTML="Unregistered!",document.getElementById("notifications").innerHTML="🔔 | Register your account",document.getElementById("notifications").setAttribute("href","registration"),document.getElementById("notifications").setAttribute("style","color: red;")}catch(e){}"registration"!=window.location.href.split("/").pop()&&window.location.replace("registration")}else console.log(e.error),document.getElementById("notifications").innerHTML="🔔 | What the fuck just happened.....",document.getElementById("notifications").setAttribute("style","color: pink;")})});try{document.getElementById("uname-field").setAttribute("style","display: block;"),document.getElementById("login-field").setAttribute("style","display: none;")}catch(e){}try{document.getElementById("uAuthMsg").setAttribute("style","display: none;")}catch(e){}try{document.getElementById("authField").setAttribute("style","display: block;")}catch(e){}}else{document.getElementById("uname-field").setAttribute("style","display: none;"),document.getElementById("login-field").setAttribute("style","display: block;"),document.getElementById("uname-dom").innerHTML="Unregistered";try{document.getElementById("uAuthMsg").setAttribute("style","display: block;")}catch(e){}try{document.getElementById("authField").setAttribute("style","display: none;")}catch(e){}}})}function loginFormListener(){let e=document.getElementById("login-form");document.addEventListener("click",function(t){try{var n=e.contains(t.target);"login-form-btn"==t.target.id||n||document.getElementById("login-form").setAttribute("style","display: none;")}catch(e){}},!1)}function login_form(){document.getElementById("login-form").setAttribute("style","display: block;"),document.getElementById("fuid").focus()}function admin_review(){firebase.auth().currentUser.getIdToken().then(function(e){window.location.replace("admin-review?authToken="+e)})}function signinwithgoogle(){var e=new firebase.auth.GoogleAuthProvider;firebase.auth().signInWithPopup(e).then(function(e){console.log("User signed in...")}).catch(function(e){console.log(e)})}function signinwithapple(){console.log("Coming later!")}function signinwithfb(){var e=new firebase.auth.FacebookAuthProvider;firebase.auth().signInWithPopup(e).then(function(e){console.log("User signed in...")}).catch(function(e){console.log(e)})}function signinwithemail(){const e=document.getElementById("fuid"),t=document.getElementById("fpwd");var n=e.value,i=t.value;firebase.auth().signInWithEmailAndPassword(n,i).catch(e=>console.log(e.message)).then(function(n){t.value="",e.value=""})}function signout(){firebase.auth().signOut(),window.location.replace("home")}checkAuth(),loginFormListener();try{var pwField=document.getElementById("fpwd");pwField.addEventListener("keyup",function(e){13===e.keyCode&&(e.preventDefault(),document.getElementById("blogin").click())})}catch(e){} \ No newline at end of file diff --git a/functions/views/js/fAuth.src.js b/functions/views/js/fAuth.src.js index 6c4ad91..6388740 100644 --- a/functions/views/js/fAuth.src.js +++ b/functions/views/js/fAuth.src.js @@ -2,14 +2,13 @@ function checkAuth(){ firebase.auth().onAuthStateChanged(function(user){ if (user) { if (user.email == "dev@dev.dev") { - try { - document.getElementById('admin').setAttribute('style', 'display: block;') - } + try {document.getElementById('admin').setAttribute('style', 'display: block;')} catch(error){} } - - try {document.getElementById('uname-dom').innerHTML = "Loading..."} - catch(error){} + try { + document.getElementById('uname-dom').innerHTML = "Loading..." + document.getElementById('login-form').setAttribute("style", "display: none;") + }catch(error){} firebase.auth().currentUser.getIdToken().then(function(idToken) { let url = 'login-user-api' @@ -44,9 +43,6 @@ function checkAuth(){ try { document.getElementById('uname-field').setAttribute("style", "display: block;") document.getElementById('login-field').setAttribute("style", "display: none;") - - document.getElementById('uname-field').setAttribute("style", "display: block;") - document.getElementById('login-field').setAttribute("style", "display: none;") } catch(error) {} try {document.getElementById('uAuthMsg').setAttribute("style", "display: none;")} @@ -65,9 +61,26 @@ function checkAuth(){ } }) } - checkAuth() +function loginFormListener() { + let loginForm = document.getElementById('login-form'); + document.addEventListener('click', function (event) { + try{ + var isClickInside = loginForm.contains(event.target); + if (event.target.id != "login-form-btn" && !isClickInside) { + document.getElementById('login-form').setAttribute("style", "display: none;") + } + }catch(err){} + }, false) +} +loginFormListener() + +function login_form() { + document.getElementById('login-form').setAttribute("style", "display: block;") + document.getElementById("fuid").focus() +} + function admin_review() { firebase.auth().currentUser.getIdToken().then(function(idToken) { window.location.replace("admin-review?authToken="+idToken) @@ -86,6 +99,10 @@ function signinwithgoogle(){ }) } +function signinwithapple(){ + console.log("Coming later!") +} + function signinwithfb(){ var fbAuthProvider = new firebase.auth.FacebookAuthProvider() firebase.auth().signInWithPopup(fbAuthProvider) diff --git a/functions/views/media/a_big_logon.png b/functions/views/media/a_big_logon.png new file mode 100644 index 0000000..fa57f6f Binary files /dev/null and b/functions/views/media/a_big_logon.png differ diff --git a/functions/views/media/fb_big_logon.png b/functions/views/media/fb_big_logon.png new file mode 100644 index 0000000..12fe7db Binary files /dev/null and b/functions/views/media/fb_big_logon.png differ diff --git a/functions/views/media/g_big_logon.png b/functions/views/media/g_big_logon.png new file mode 100644 index 0000000..770060c Binary files /dev/null and b/functions/views/media/g_big_logon.png differ diff --git a/functions/views/partials/header.ejs b/functions/views/partials/header.ejs index a1de85c..8b93f2e 100644 --- a/functions/views/partials/header.ejs +++ b/functions/views/partials/header.ejs @@ -22,19 +22,29 @@