Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <!-- TCOH Website Template v1.0 -->
- <title>TCOH Website</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <script src="https://www.gstatic.com/firebasejs/4.8.1/firebase.js"></script>
- <script>
- // Initialize Firebase
- var config = {
- apiKey: "AIzaSyDThT5K9dsq_JkUAYw-GzspnivA5WhmDlw",
- authDomain: "jottocraft-web.firebaseapp.com",
- databaseURL: "https://jottocraft-web.firebaseio.com",
- projectId: "jottocraft-web",
- storageBucket: "jottocraft-web.appspot.com",
- messagingSenderId: "333372912033"
- };
- firebase.initializeApp(config);
- var user = firebase.auth().currentUser;
- if (user) {
- $( "#authwindow" ).toggle( "puff" );
- $( "#content" ).toggle( "puff" );
- setTimeout(function(){
- document.getElementById("logoutbtn").style.display = "";
- }, 100);
- }
- function logout() {
- firebase.auth().signOut().then(function() {
- window.location.reload();
- }, function(error) {
- // An error happened.
- });
- }
- </script>
- <style>
- body {
- margin: 0;
- }
- </style>
- <script>
- function auth() {
- document.getElementById("lbtn").style.display = "none";
- document.getElementById("loader").style.display = "block";
- loggedin = true;
- const pw = document.getElementById('authdata').value;
- const email = document.getElementById('emaildata').value;
- firebase.auth().signInWithEmailAndPassword(email, pw).catch(function(error) {
- loggedin = false;
- document.getElementById("loader").style.display = "none";
- $( "#logindiv" ).effect( "shake" );
- $( "#lbtn" ).show( "highlight" );
- }).then(function(user) {
- if (loggedin) {
- loggedin = true;
- $( "#authwindow" ).toggle( "puff" );
- $( "#content" ).toggle( "puff" );
- setTimeout(function(){
- document.getElementById("logoutbtn").style.display = "";
- }, 100);
- }
- });
- }
- var firebaseRef = firebase.database().ref().child("announcement");
- firebaseRef.on('value', function(datasnapshot){
- announcementval = datasnapshot.val();
- if (announcementval !== "none") {
- document.getElementById("abtn").style.display = "";
- } else {
- document.getElementById("abtn").style.display = "none";
- }
- });
- function announce() {
- window.alert(announcementval);
- }
- </script>
- <script>
- setTimeout(function(){
- document.getElementById('authdata').addEventListener('keypress', function(event) {
- if (event.keyCode == 13) {
- auth();
- }
- });
- }, 500);
- </script>
- </head>
- <body style="overflow:hidden;">
- <!-- Fluid UI -->
- <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
- <link type="text/css" rel="stylesheet" href="/fluid.css" media="screen,projection"/>
- <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
- <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
- <script type="text/javascript" src="/fluid.js"></script>
- <script>
- function darkmode() {
- $("body").toggleClass("dark");
- var mode = $("body").hasClass("dark");
- if (mode) {
- document.cookie = "fluid=dark";
- } else {
- document.cookie = "fluid=light";
- }
- }
- function getCookie(cname) {
- var name = cname + "=";
- var decodedCookie = decodeURIComponent(document.cookie);
- var ca = decodedCookie.split(';');
- for(var i = 0; i <ca.length; i++) {
- var c = ca[i];
- while (c.charAt(0) == ' ') {
- c = c.substring(1);
- }
- if (c.indexOf(name) == 0) {
- return c.substring(name.length, c.length);
- }
- }
- return "";
- }
- setTimeout(function(){
- var mode = getCookie("fluid");
- if (mode == "dark") {
- $("body").addClass("dark");
- } else {
- $("body").removeClass("dark");
- }
- }, 10);
- </script>
- <style>
- #themebtn {
- position: absolute;
- bottom: 0;
- right: 0;
- }
- body.dark .btn-flat {
- color:white;
- }
- </style>
- <div class="container" style="display:none" id="content">
- <h1>Empty Website</h1>
- <br>
- <p> This is an empty TCOH Website </p>
- </div>
- <div class="container" id="authwindow">
- <h1>Login</h1>
- <br><br>
- <div id="logindiv">
- <input id="emaildata" placeholder="Email" type="email">
- <input id="authdata" placeholder="Password" type="password">
- </div>
- <br><br>
- <button class="btn waves-effect" onclick="auth()" id="lbtn"><i class="material-icons right">lock</i>Login</button>
- <br><br>
- <loader id="loader" style="display:none"></loader>
- </div>
- <div class="fixed-action-btn horizontal">
- <a class="btn-flat waves-effect">
- <i class="large material-icons" onclick="darkmode()">format_paint</i>
- </a>
- <a id="abtn" style="display:none" class="btn-flat waves-effect">
- <i class="large material-icons" onclick="announce()">announcement</i>
- </a>
- <a id="logoutbtn" style="display:none" class="btn-flat waves-effect">
- <i class="large material-icons" onclick="logout()">lock</i>
- </a>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement