big doma bug
This commit is contained in:
parent
74b610a7b8
commit
a749d91425
@ -149,7 +149,7 @@ app.auth = (function (app) {
|
|||||||
function setToken(token) {
|
function setToken(token) {
|
||||||
localStorage.setItem("APIToken", token);
|
localStorage.setItem("APIToken", token);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
function setUserId(userid) {
|
function setUserId(userid) {
|
||||||
console.log("userid", userid);
|
console.log("userid", userid);
|
||||||
localStorage.setItem("userid", userid);
|
localStorage.setItem("userid", userid);
|
||||||
@ -158,6 +158,7 @@ app.auth = (function (app) {
|
|||||||
function setUsername(username) {
|
function setUsername(username) {
|
||||||
localStorage.setItem("username", username);
|
localStorage.setItem("username", username);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
function getToken() {
|
function getToken() {
|
||||||
return localStorage.getItem("APIToken");
|
return localStorage.getItem("APIToken");
|
||||||
@ -167,6 +168,7 @@ app.auth = (function (app) {
|
|||||||
if (getToken()) {
|
if (getToken()) {
|
||||||
return app.api.get("user/me", function (error, data) {
|
return app.api.get("user/me", function (error, data) {
|
||||||
if (!error) app.auth.user = data;
|
if (!error) app.auth.user = data;
|
||||||
|
$.scope.getUsername.push(data.username);
|
||||||
return callback(error, data);
|
return callback(error, data);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -204,8 +206,6 @@ app.auth = (function (app) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
localStorage.removeItem("APIToken");
|
localStorage.removeItem("APIToken");
|
||||||
localStorage.removeItem("userid");
|
|
||||||
localStorage.removeItem("username");
|
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,8 +244,6 @@ app.auth = (function (app) {
|
|||||||
return {
|
return {
|
||||||
getToken: getToken,
|
getToken: getToken,
|
||||||
setToken: setToken,
|
setToken: setToken,
|
||||||
setUserId: setUserId,
|
|
||||||
setUsername: setUsername,
|
|
||||||
isLoggedIn: isLoggedIn,
|
isLoggedIn: isLoggedIn,
|
||||||
//logIn: logIn,
|
//logIn: logIn,
|
||||||
logOut: logOut,
|
logOut: logOut,
|
||||||
|
305
consumerWebsite/public/js/jq-repeat.js
Normal file
305
consumerWebsite/public/js/jq-repeat.js
Normal file
@ -0,0 +1,305 @@
|
|||||||
|
(function($, Mustache){
|
||||||
|
'use strict';
|
||||||
|
if (!$.scope) {
|
||||||
|
$.scope = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
var make = function( element ){
|
||||||
|
|
||||||
|
//construct array
|
||||||
|
function makeArray( input , index ){
|
||||||
|
|
||||||
|
var result = [];
|
||||||
|
|
||||||
|
Object.defineProperty( result, "__repeatId", {
|
||||||
|
value: repeatId,
|
||||||
|
writable: true,
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true
|
||||||
|
} );
|
||||||
|
|
||||||
|
Object.defineProperty( result, "__rq_template", {
|
||||||
|
value: '',
|
||||||
|
writable: true,
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true
|
||||||
|
} );
|
||||||
|
|
||||||
|
Object.defineProperty( result, "__jq_index", {
|
||||||
|
value: index,
|
||||||
|
writable: true,
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true
|
||||||
|
} );
|
||||||
|
|
||||||
|
function removeEmpty(){
|
||||||
|
if(result.__jq_empty){
|
||||||
|
result.__jq_empty.remove();
|
||||||
|
delete result.__jq_empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.splice = function(inputValue, ...args){
|
||||||
|
//splice does all the heavy lifting by interacting with the DOM elements.
|
||||||
|
|
||||||
|
var toProto = [...args]
|
||||||
|
|
||||||
|
var index;
|
||||||
|
//if a string is submitted as the index, try to match it to index number
|
||||||
|
if( typeof arguments[0] === 'string' ){
|
||||||
|
index = this.indexOf( arguments[0] );//set where to start
|
||||||
|
if ( index === -1 ) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
index = arguments[0]; //set where to start
|
||||||
|
}
|
||||||
|
|
||||||
|
toProto.unshift(index)
|
||||||
|
|
||||||
|
|
||||||
|
var howMany = arguments[1]; //sets the amount of fields to remove
|
||||||
|
var args = Array.prototype.slice.call( arguments ); // coverts arguments into array
|
||||||
|
var toAdd = args.slice(2); // only keeps fields to add to array
|
||||||
|
|
||||||
|
// if the starting point is higher then the total index count, start at the end
|
||||||
|
if( index > this.length ) {
|
||||||
|
index = this.length;
|
||||||
|
}
|
||||||
|
// if the starting point is negative, start form the end of the array, minus the start point
|
||||||
|
if( index < 0 ) {
|
||||||
|
index = this.length - Math.abs( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
// if there are things to add, figure out the how many new indexes we need
|
||||||
|
if( !howMany && howMany !== 0 ) {
|
||||||
|
howMany = this.length - index;
|
||||||
|
}
|
||||||
|
//not sure why i put this here... but it does matter!
|
||||||
|
if( howMany > this.length - index ) {
|
||||||
|
howMany = this.length - index;
|
||||||
|
}
|
||||||
|
|
||||||
|
//figure out how many positions we need to shift the current elements
|
||||||
|
var shift = toAdd.length - howMany;
|
||||||
|
|
||||||
|
// figure out how big the new array will be
|
||||||
|
// var newLength = this.length + shift;
|
||||||
|
|
||||||
|
//removes fields from array based on howMany needs to be removed
|
||||||
|
for( var i = index; i < +index+howMany; i++ ) {
|
||||||
|
this.__take.apply( this[index].__jq_$el );
|
||||||
|
// this.__take.apply( $( '.jq-repeat-'+ this.__repeatId +'[jq-repeat-index="'+ ( i + index ) +'"]' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
//re-factor element index's
|
||||||
|
for(var i = 0; i < this.length; i++){
|
||||||
|
if( i >= index){
|
||||||
|
|
||||||
|
this[i].__jq_$el.attr( 'jq-repeat-index', i+shift );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//if there are fields to add to the array, add them
|
||||||
|
if( toAdd.length > 0 ){
|
||||||
|
removeEmpty()
|
||||||
|
|
||||||
|
//$.each( toAdd, function( key, value ){
|
||||||
|
for(var I = 0; I < toAdd.length; I++){
|
||||||
|
|
||||||
|
//figure out new elements index
|
||||||
|
var key = I + index;
|
||||||
|
// apply values to template
|
||||||
|
var render = Mustache.render( this.__rq_template, {__id:I, ...toAdd[I]} );
|
||||||
|
|
||||||
|
//set call name and index keys to DOM element
|
||||||
|
var $render = $( render ).addClass( 'jq-repeat-'+ this.__repeatId ).attr( 'jq-repeat-index', key );
|
||||||
|
|
||||||
|
|
||||||
|
//if add new elements in proper stop, or after the place holder.
|
||||||
|
if( key === 0 ){
|
||||||
|
$( '.jq-repeat-'+ this.__repeatId +'[jq-repeat-index="holder"]' ).after( $render );
|
||||||
|
}else{
|
||||||
|
$( '.jq-repeat-'+ this.__repeatId +'[jq-repeat-index="' + ( key -1 ) + '"]' ).after( $render );
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty( toAdd[I], "__jq_$el", {
|
||||||
|
value: $render,
|
||||||
|
writable: true,
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true
|
||||||
|
} );
|
||||||
|
|
||||||
|
//animate element
|
||||||
|
this.__put.apply($render, [toAdd[I]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//set and return new array
|
||||||
|
return Array.prototype.splice.apply(this, toProto);
|
||||||
|
};
|
||||||
|
result.push = function(){
|
||||||
|
//add one or more objects to the array
|
||||||
|
|
||||||
|
//set the index value, if none is set make it zero
|
||||||
|
var index = this.length || 0;
|
||||||
|
|
||||||
|
//loop each passed object and pass it to slice
|
||||||
|
for (var i = 0 ; i < arguments.length; ++i) {
|
||||||
|
this.splice( ( index + i ), 0, arguments[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
//return new array length
|
||||||
|
return this.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
result.unshift = function(item){
|
||||||
|
return this.splice(0, 0, item);
|
||||||
|
};
|
||||||
|
|
||||||
|
result.pop = function(){
|
||||||
|
//remove and return array element
|
||||||
|
|
||||||
|
return this.splice( -1, 1 )[0];
|
||||||
|
};
|
||||||
|
result.reverse = function() {
|
||||||
|
var temp = this.splice( 0 );
|
||||||
|
Array.prototype.reverse.apply( temp );
|
||||||
|
|
||||||
|
for( var i = 0; i < temp.length; i++ ){
|
||||||
|
this.push( temp[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
result.shift = function() {
|
||||||
|
return this.splice( 0, 1 )[0];
|
||||||
|
};
|
||||||
|
result.loop = function(){
|
||||||
|
var temp = this[0];
|
||||||
|
this.splice( 0,1 );
|
||||||
|
this.push( temp );
|
||||||
|
|
||||||
|
return temp;
|
||||||
|
};
|
||||||
|
result.loopUp = function(){
|
||||||
|
var temp = this[this.length-1];
|
||||||
|
this.splice( -1, 1 );
|
||||||
|
this.splice( 0, 0, temp );
|
||||||
|
return temp;
|
||||||
|
};
|
||||||
|
result.indexOf = function( key, value ){
|
||||||
|
if( !value ){
|
||||||
|
value = arguments[0];
|
||||||
|
key = this.__jq_index;
|
||||||
|
}
|
||||||
|
for ( var index = 0; index < this.length; ++index ) {
|
||||||
|
if( this[index][key] === value ){
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
result.update = function( key, value, update ){
|
||||||
|
//set variables using sting for index
|
||||||
|
|
||||||
|
// If update is called with no index/key, assume its the 0
|
||||||
|
if(typeof key === 'object'){
|
||||||
|
if(this[0]){
|
||||||
|
return this.update(0, key);
|
||||||
|
}
|
||||||
|
return this.splice(0, 1, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !update ){
|
||||||
|
update = arguments[1];
|
||||||
|
value = arguments[0];
|
||||||
|
key = this.__jq_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = this.indexOf( key, value );
|
||||||
|
|
||||||
|
if(index === -1) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
var object = $.extend( true, {}, this[index], update );
|
||||||
|
return this.splice( index, 1, object )[0];
|
||||||
|
};
|
||||||
|
result.__put = function(){
|
||||||
|
this.show();
|
||||||
|
};
|
||||||
|
result.__take = function(){
|
||||||
|
this.remove();
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!input) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
$.each( input, function( key, value ){
|
||||||
|
var type = typeof value;
|
||||||
|
if( type === 'object' ){
|
||||||
|
result.push( value );
|
||||||
|
}else if( type === 'string' ){
|
||||||
|
Object.defineProperty( result, "__jq_index", {
|
||||||
|
value: value,
|
||||||
|
writable: true,
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true
|
||||||
|
} );
|
||||||
|
} else if ( type === 'function'){
|
||||||
|
Object.defineProperty( result, value.name, {
|
||||||
|
value: value,
|
||||||
|
writable: true,
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var $this = $( element );
|
||||||
|
var repeatId = $this.attr( 'jq-repeat' );
|
||||||
|
var index = $this.attr( 'jq-repeat-index' );
|
||||||
|
var tempId = repeatId + 'Template';
|
||||||
|
var templateId = $( '#' + tempId ).html();
|
||||||
|
var empty = $(`[jq-repeat-defualt="${repeatId}"]`);
|
||||||
|
|
||||||
|
|
||||||
|
$this.removeAttr( 'jq-repeat' );
|
||||||
|
$this.removeAttr( 'jq-repeat-index' );
|
||||||
|
var template = element.outerHTML
|
||||||
|
|
||||||
|
$this.replaceWith( '<script type="x-tmpl-mustache" id="' + tempId + '" class="jq-repeat-' + repeatId + ' " jq-repeat-index="holder"><\/script>' );
|
||||||
|
|
||||||
|
Mustache.parse(templateId); // optional, speeds up future uses
|
||||||
|
|
||||||
|
$.scope[repeatId] = makeArray($.scope[repeatId], index);
|
||||||
|
$.scope[repeatId].__rq_template = template;
|
||||||
|
$.scope[repeatId].__jq_empty = empty;
|
||||||
|
};
|
||||||
|
|
||||||
|
$( document ).ready( function(){
|
||||||
|
console.log('jq-repeat', $.scope)
|
||||||
|
//$.jqrepeat = $.scope
|
||||||
|
|
||||||
|
$( '[jq-repeat]' ).each(function(key, value){
|
||||||
|
make(value);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('DOMNodeInserted', function(e) {
|
||||||
|
if ( $(e.target).is('[jq-repeat]') ){
|
||||||
|
make( e.target );
|
||||||
|
}else{
|
||||||
|
var t = $(e.target).find('[jq-repeat]');
|
||||||
|
t.each(function(key, value){
|
||||||
|
make(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} );
|
||||||
|
|
||||||
|
})(jQuery, Mustache);
|
File diff suppressed because one or more lines are too long
@ -37,54 +37,50 @@ module.exports = router;
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
var router = require('express').Router();
|
var router = require("express").Router();
|
||||||
|
|
||||||
//landing page of index
|
//landing page of index
|
||||||
router.get('/', function(req, res, next) {
|
router.get("/", function (req, res, next) {
|
||||||
res.render('index');
|
res.render("index");
|
||||||
});
|
});
|
||||||
|
|
||||||
//news page
|
//news page
|
||||||
router.get('/news', function(req, res, next) {
|
router.get("/news", function (req, res, next) {
|
||||||
res.render('news');
|
res.render("news");
|
||||||
});
|
});
|
||||||
|
|
||||||
//learn more page
|
//learn more page
|
||||||
router.get('/learnmore', function(req, res, next) {
|
router.get("/learnmore", function (req, res, next) {
|
||||||
res.render('learnmore');
|
res.render("learnmore");
|
||||||
});
|
});
|
||||||
|
|
||||||
//login | register page
|
//login | register page
|
||||||
router.get('/login', function(req, res, next) {
|
router.get("/login", function (req, res, next) {
|
||||||
res.render('signuplogin');
|
res.render("signuplogin");
|
||||||
});
|
});
|
||||||
|
|
||||||
//profile page
|
//profile page
|
||||||
router.get('/profile', function(req, res, next) {
|
router.get("/profile", function (req, res, next) {
|
||||||
res.render('profile');
|
res.render("profile");
|
||||||
});
|
});
|
||||||
|
|
||||||
//forgot password page
|
//forgot password page
|
||||||
router.get('/forgotPassword', function(req, res, next) {
|
router.get("/forgotPassword", function (req, res, next) {
|
||||||
res.render('forgotPassword');
|
res.render("forgotPassword");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//contact page
|
//contact page
|
||||||
router.get('/contact', function(req, res, next) {
|
router.get("/contact", function (req, res, next) {
|
||||||
res.render('contact');
|
res.render("contact");
|
||||||
});
|
});
|
||||||
|
|
||||||
//api doc
|
//api doc
|
||||||
router.get('/api', function(req, res, next) {
|
router.get("/api", function (req, res, next) {
|
||||||
res.render('api');
|
res.render("api");
|
||||||
});
|
});
|
||||||
|
|
||||||
//profile page
|
|
||||||
router.get('/profile', function(req, res, next) {
|
|
||||||
res.render('profile');
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
@ -86,7 +86,10 @@
|
|||||||
<script src="vendor/jquery/jquery.min.js"></script>
|
<script src="vendor/jquery/jquery.min.js"></script>
|
||||||
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
|
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||||
<script src="js/learnmore.js"></script>
|
<script src="js/learnmore.js"></script>
|
||||||
<script src="js/contact.js"></script>
|
|
||||||
<script src="js/search.js"></script>
|
<script src="js/search.js"></script>
|
||||||
<script src="js/api.js"></script>
|
<script src="js/api.js"></script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -23,6 +23,9 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
||||||
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
|
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
|
||||||
crossorigin="anonymous"></script>
|
crossorigin="anonymous"></script>
|
||||||
|
<!-- Mustache JS -->
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.1/mustache.min.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.1/mustache.js"></script>
|
||||||
|
|
||||||
|
|
||||||
<!-- jquery app.js -->
|
<!-- jquery app.js -->
|
||||||
@ -100,6 +103,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
@ -1,61 +1,56 @@
|
|||||||
<%- include('logintop') %>
|
<%- include('logintop') %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
app.auth.redirectIfLoggedIn();
|
app.auth.redirectIfLoggedIn();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<section class="wrapper">
|
<section class="wrapper">
|
||||||
<div class="form signup iot-card">
|
<div class="form signup iot-card">
|
||||||
<!--<div class="form signup card" -->
|
<!--<div class="form signup card" -->
|
||||||
<header>Signup</header>
|
<header>Signup</header>
|
||||||
<!-- localhost/api/v0/user/register -->
|
<!-- localhost/api/v0/user/register -->
|
||||||
<!-- evalAjax Fires when status 200 is returned -->
|
<!-- evalAjax Fires when status 200 is returned -->
|
||||||
<form action="auth/register" onsubmit="formAJAX(this)" evalAJAX="app.auth.logInRedirect();">
|
<form action="auth/register" onsubmit="formAJAX(this)" evalAJAX="app.auth.logInRedirect();">
|
||||||
<input type="text" name="firstname" placeholder="First Name" required />
|
<input type="text" name="firstname" placeholder="First Name" required />
|
||||||
<input type="text" name="lastname" placeholder="Last Name" required />
|
<input type="text" name="lastname" placeholder="Last Name" required />
|
||||||
<input type="text" name="username" placeholder="Username" required />
|
<input type="text" name="username" placeholder="Username" required />
|
||||||
<input type="text" name="email" placeholder="Email" required />
|
<input type="text" name="email" placeholder="Email" required />
|
||||||
<input type="text" name="address" placeholder="Address" required />
|
<input type="text" name="address" placeholder="Address" required />
|
||||||
<input type="text" name="phone" placeholder="Phone Number" required />
|
<input type="text" name="phone" placeholder="Phone Number" required />
|
||||||
<input type="password" name="password" placeholder="Password" required />
|
<input type="password" name="password" placeholder="Password" required />
|
||||||
<input type="password" name="confirmPassword" placeholder="Confirm Password" required />
|
<input type="password" name="confirmPassword" placeholder="Confirm Password" required />
|
||||||
<input type="submit" value="Signup" />
|
<input type="submit" value="Signup" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form login iot-card">
|
<div class="form login iot-card">
|
||||||
<header>Login</header>
|
<header>Login</header>
|
||||||
<div class="card-header shadow actionMessage" style="display:none"></div>
|
<div class="card-header shadow actionMessage" style="display:none"></div>
|
||||||
<!-- evalAjax Fires when status 200 is returned -->
|
<!-- evalAjax Fires when status 200 is returned -->
|
||||||
<form action="auth/login" onsubmit="formAJAX(this)"
|
<form action="auth/login" onsubmit="formAJAX(this)" evalAJAX="app.auth.homeRedirect();
|
||||||
evalAJAX="app.auth.homeRedirect();
|
app.auth.setToken(data.token);">
|
||||||
app.auth.setToken(data.token);
|
|
||||||
app.auth.setUserId(data.userid);
|
|
||||||
app.auth.setUsername(data.username);
|
|
||||||
">
|
|
||||||
|
|
||||||
<input type="text" name="userInfo" placeholder="Email address | Username" required />
|
|
||||||
<input type="password" name="password" placeholder="Password" required />
|
|
||||||
<a href="/resetPassword">Forgot password?</a>
|
|
||||||
<input type="submit" value="Login" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<input type="text" name="userInfo" placeholder="Email address | Username" required />
|
||||||
const wrapper = document.querySelector(".wrapper"),
|
<input type="password" name="password" placeholder="Password" required />
|
||||||
signupHeader = document.querySelector(".signup header"),
|
<a href="/resetPassword">Forgot password?</a>
|
||||||
loginHeader = document.querySelector(".login header");
|
<input type="submit" value="Login" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
loginHeader.addEventListener("click", () => {
|
<script>
|
||||||
wrapper.classList.add("active");
|
const wrapper = document.querySelector(".wrapper"),
|
||||||
});
|
signupHeader = document.querySelector(".signup header"),
|
||||||
signupHeader.addEventListener("click", () => {
|
loginHeader = document.querySelector(".login header");
|
||||||
wrapper.classList.remove("active");
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</body>
|
loginHeader.addEventListener("click", () => {
|
||||||
|
wrapper.classList.add("active");
|
||||||
|
});
|
||||||
|
signupHeader.addEventListener("click", () => {
|
||||||
|
wrapper.classList.remove("active");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</section>
|
||||||
|
|
||||||
</html>
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -1,120 +1,146 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta
|
||||||
<meta name="description" content="">
|
name="viewport"
|
||||||
<meta name="author" content="">
|
content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||||
<meta http-equiv="cleartype" content="on">
|
<meta name="description" content="" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="author" content="" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta http-equiv="cleartype" content="on" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
<!-- Bootstrap core CSS -->
|
<!-- Bootstrap core CSS -->
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
<link
|
||||||
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
|
||||||
|
rel="stylesheet"
|
||||||
|
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN"
|
||||||
|
crossorigin="anonymous" />
|
||||||
|
|
||||||
|
<!-- Custom styles for this template -->
|
||||||
|
<link href="css/all.css" rel="stylesheet" />
|
||||||
|
<link href="css/style.css" rel="stylesheet" />
|
||||||
|
<link href="css/learnmore.css" rel="stylesheet" />
|
||||||
|
<link href="css/contact.css" rel="stylesheet" />
|
||||||
|
<link rel="stylesheet" href="css/api.css" media="all" />
|
||||||
|
<!-- weird api page cdn -->
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;1,300&family=Source+Code+Pro:wght@300&display=swap"
|
||||||
|
rel="stylesheet" />
|
||||||
|
<!-- Mustache JS -->
|
||||||
|
<script src="https://sso.theta42.com/static/js/mustache.min.js"></script>
|
||||||
|
<!-- jQuery library -->
|
||||||
|
<script
|
||||||
|
src="https://code.jquery.com/jquery-3.7.1.min.js"
|
||||||
|
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<!-- Bootstrap 5 JavaScript -->
|
||||||
|
<script
|
||||||
|
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<!-- Custom styles for this template -->
|
<!-- weird api page cdn -->
|
||||||
<link href="css/all.css" rel="stylesheet">
|
<!-- https://github.com/floriannicolas/API-Documentation-HTML-Template/tree/master -->
|
||||||
<link href="css/style.css" rel="stylesheet">
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
|
||||||
<link href="css/learnmore.css" rel="stylesheet">
|
<script>
|
||||||
<link href="css/contact.css" rel="stylesheet">
|
hljs.initHighlightingOnLoad();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- jq-repeat -->
|
||||||
|
<script src="js/jq-repeat.js"></script>
|
||||||
|
|
||||||
<link href="css/contact.css" rel="stylesheet">
|
<!-- jquery app.js -->
|
||||||
<link rel="stylesheet" href="css/api.css" media="all">
|
<script src="js/app.js"></script>
|
||||||
<!-- weird api page cdn -->
|
</head>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<!-- javascript function to check if user is auth -->
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<script>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;1,300&family=Source+Code+Pro:wght@300&display=swap" rel="stylesheet">
|
//make document ready
|
||||||
|
$(document).ready(function () {
|
||||||
|
//check if user is logged in
|
||||||
|
app.auth.isLoggedIn(function (error, data) {
|
||||||
|
if (data) {
|
||||||
|
$("#cl-logout-button").show("fast");
|
||||||
|
$("#cl-profile-button").show("fast");
|
||||||
|
$("#cl-login-button").hide("fast");
|
||||||
|
} else {
|
||||||
|
$("#cl-login-button").show("fast");
|
||||||
|
}
|
||||||
|
$("body").show("fast");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- jQuery library -->
|
<body>
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
|
<nav
|
||||||
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
class="navbar fixed-top navbar-expand-lg navbar-dark bg-light top-nav fixed-top">
|
||||||
<!-- Bootstrap 5 JavaScript -->
|
<div class="container">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
<a class="navbar-brand" href="/">
|
||||||
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
|
<img src="images/logo.png" alt="logo" />
|
||||||
crossorigin="anonymous"></script>
|
</a>
|
||||||
<!-- weird api page cdn -->
|
<button
|
||||||
<!-- https://github.com/floriannicolas/API-Documentation-HTML-Template/tree/master -->
|
class="navbar-toggler"
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
|
type="button"
|
||||||
<!-- https://github.com/floriannicolas/API-Documentation-HTML-Template/tree/master -->
|
data-toggle="collapse"
|
||||||
<script>
|
data-target="#navbarResponsive"
|
||||||
hljs.initHighlightingOnLoad();
|
aria-controls="navbarResponsive"
|
||||||
</script>
|
aria-expanded="false"
|
||||||
<!-- jquery app.js -->
|
aria-label="Toggle navigation">
|
||||||
<script src="js/app.js"></script>
|
<span class="fas fa-bars"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarResponsive">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li jq-repeat="getUsername" class="nav-item">
|
||||||
|
{{ username }}
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/news">News</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/contact">Contact</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/api">API Doc</a>
|
||||||
|
</li>
|
||||||
|
<!-- profile button -->
|
||||||
|
<div class="form-inline mt-2 mt-md-0">
|
||||||
|
<!-- Profile Button -->
|
||||||
|
<a
|
||||||
|
id="cl-profile-button"
|
||||||
|
class="btn btn-outline-info btn-sm my-2 my-sm-0"
|
||||||
|
href="/profile"
|
||||||
|
style="display: none">
|
||||||
|
<i class="fas fa-sign-out"></i> Profile
|
||||||
|
</a>
|
||||||
|
|
||||||
</head>
|
<!-- Login Button -->
|
||||||
<!-- javascript function to check if user is auth -->
|
<a
|
||||||
<script>
|
id="cl-login-button"
|
||||||
//make document ready
|
class="btn btn-outline-danger btn-sm my-2 my-sm-0"
|
||||||
$(document).ready(function () {
|
onclick="app.auth.forceLogin()"
|
||||||
//check if user is logged in
|
style="display: none">
|
||||||
app.auth.isLoggedIn(function (error, data) {
|
<i class="fas fa-sign-out"></i> Login
|
||||||
if (data) {
|
</a>
|
||||||
$('#cl-logout-button').show('fast');
|
|
||||||
$('#cl-profile-button').show('fast');
|
|
||||||
$('#cl-login-button').hide('fast');
|
|
||||||
} else {
|
|
||||||
$('#cl-login-button').show('fast');
|
|
||||||
}
|
|
||||||
$('body').show('fast')
|
|
||||||
|
|
||||||
});
|
<!-- Logout Button -->
|
||||||
});
|
<button
|
||||||
|
id="cl-logout-button"
|
||||||
</script>
|
class="btn btn-outline-danger btn-sm my-2 my-sm-0"
|
||||||
|
href="/"
|
||||||
|
onclick="app.auth.logOut(e => window.location.href='/')"
|
||||||
|
style="display: none">
|
||||||
<body>
|
<i class="fas fa-sign-out"></i> Logout
|
||||||
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-light top-nav fixed-top">
|
</button>
|
||||||
<div class="container">
|
</div>
|
||||||
<a class="navbar-brand" href="/">
|
</ul>
|
||||||
<img src="images/logo.png" alt="logo" />
|
</div>
|
||||||
</a>
|
</div>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive"
|
</nav>
|
||||||
aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
|
</body>
|
||||||
<span class="fas fa-bars"></span>
|
</html>
|
||||||
</button>
|
|
||||||
<div class="collapse navbar-collapse" id="navbarResponsive">
|
|
||||||
<ul class="navbar-nav ms-auto">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="/">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="/news">News</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="/contact">Contact</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="/api">API Doc</a>
|
|
||||||
</li>
|
|
||||||
<!-- profile button -->
|
|
||||||
<div class="form-inline mt-2 mt-md-0">
|
|
||||||
<!-- Profile Button -->
|
|
||||||
<a id="cl-profile-button" class="btn btn-outline-info btn-sm my-2 my-sm-0" href="/profile" style="display: none;">
|
|
||||||
<i class="fas fa-sign-out"></i> Profile
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<!-- Login Button -->
|
|
||||||
<a id="cl-login-button" class="btn btn-outline-danger btn-sm my-2 my-sm-0" onclick="app.auth.forceLogin()" style="display: none;">
|
|
||||||
<i class="fas fa-sign-out"></i> Login
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<!-- Logout Button -->
|
|
||||||
<button id="cl-logout-button" class="btn btn-outline-danger btn-sm my-2 my-sm-0" href="/" onclick="app.auth.logOut(e => window.location.href='/')" style="display: none;">
|
|
||||||
<i class="fas fa-sign-out"></i> Logut
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
//model for getting API key from database
|
|
||||||
|
|
||||||
async function getAPIKey() {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = { getAPIKey }
|
|
Loading…
x
Reference in New Issue
Block a user