#98 Added demo to homepage

master
Keith Irwin 2017-06-27 14:26:20 -04:00
parent c467378528
commit fd6a1443e1
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
7 changed files with 37 additions and 9 deletions

View File

@ -5,6 +5,8 @@ const fs = require('fs'),
debug = require('debug')('tracman-demo'); debug = require('debug')('tracman-demo');
module.exports = (io)=>{ module.exports = (io)=>{
// File is space-seperated: delay, lat, lon, dir, spd
fs.readFile(__dirname+'/demo.txt', (err,data)=>{ fs.readFile(__dirname+'/demo.txt', (err,data)=>{
if (err){ console.error(`${err.stack}`); } if (err){ console.error(`${err.stack}`); }
@ -13,6 +15,7 @@ module.exports = (io)=>{
(function sendLoc(ln) { (function sendLoc(ln) {
if (ln>20754){ sendLoc(0) } if (ln>20754){ sendLoc(0) }
else { else {
let loc = lines[ln].split(' '); let loc = lines[ln].split(' ');
debug(`Sending demo location: ${loc[1]}, ${loc[2]}`); debug(`Sending demo location: ${loc[1]}, ${loc[2]}`);
io.to('demo').emit('get', { io.to('demo').emit('get', {
@ -22,9 +25,12 @@ module.exports = (io)=>{
dir: loc[3], dir: loc[3],
spd: loc[4] spd: loc[4]
}); });
// Repeat after delay in milliseconds
setTimeout(()=>{ setTimeout(()=>{
sendLoc(ln+1); sendLoc(ln+1); // next line of file
}, loc[0]); }, loc[0]);
} }
})(5667); })(5667);

View File

@ -33,8 +33,8 @@ router.get('/demo', (req,res,next)=>{
marker: 'marker-red', marker: 'marker-red',
showAlt: false, showAlt: false,
showTemp: false, showTemp: false,
showSpeed: true, showSpeed: false,
showScale: true, showScale: false,
defaultZoom: 13, defaultZoom: 13,
defaultMap: 'road', defaultMap: 'road',
units: 'standard' units: 'standard'

View File

@ -19,14 +19,32 @@
.splash { .splash {
background: #090909; background: #090909;
background-image: url("/static/img/style/map.jpg"); /*background-image: url("/static/img/style/map.jpg");*/
background-size: cover; background-size: cover;
color: #FFF; color: #FFF;
height: 100vh; height: 100vh;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
} }
.splash #shade {
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
position: absolute;
background-color: #000;
opacity: 0.5;
}
.splash #demo {
position: absolute;
width: 95vw;
height: 100%;
left: 0;
top: 0;
}
.splash:after, .splash:before { .splash:after, .splash:before {
z-index: 5;
content: ""; content: "";
display: block; display: block;
position: absolute; position: absolute;
@ -46,15 +64,18 @@
position: relative; position: relative;
top: 48%; top: 48%;
transform: translateY(-50%); transform: translateY(-50%);
z-index: 5; z-index: 8;
} }
.splash h1 { .splash h1 {
z-index: 10;
color: #fbc93d; color: #fbc93d;
} }
.splash h2 { .splash h2 {
z-index: 10;
margin-bottom: 40px; margin-bottom: 40px;
} }
.splash .btn { .splash .btn {
z-index: 20;
margin: 0 20px 10px 0; margin: 0 20px 10px 0;
} }
.splash .btn:hover { .splash .btn:hover {

View File

@ -73,7 +73,6 @@
/* global navigator $ socket userid token mapuser toggleMaps */ /* global navigator $ socket userid token mapuser toggleMaps */
$(function(){ $(function(){
var wpid, newloc; var wpid, newloc;
// Set location // Set location

View File

@ -3579,7 +3579,7 @@ __WEBPACK_IMPORTED_MODULE_2_load_google_maps_api___default.a({ key:mapKey })
map = new googlemaps.Map( mapElem, { map = new googlemaps.Map( mapElem, {
center: new googlemaps.LatLng( mapuser.last.lat, mapuser.last.lon ), center: new googlemaps.LatLng( mapuser.last.lat, mapuser.last.lon ),
panControl: false, panControl: false,
scaleControl: mapuser.settings.showScale, scaleControl: (mapuser.settings.showScale)?true:false,
draggable: false, draggable: false,
zoom: mapuser.settings.defaultZoom, zoom: mapuser.settings.defaultZoom,
streetViewControl: false, streetViewControl: false,
@ -3597,7 +3597,7 @@ __WEBPACK_IMPORTED_MODULE_2_load_google_maps_api___default.a({ key:mapKey })
}); });
// Create iFrame logo // Create iFrame logo
if (noHeader!=='0') { if (noHeader!=='0' && mapuser._id!=='demo') {
//console.log("Creating iFrame logo..."); //console.log("Creating iFrame logo...");
const logoDiv = document.createElement('div'); const logoDiv = document.createElement('div');
logoDiv.id = 'map-logo'; logoDiv.id = 'map-logo';

View File

@ -83,7 +83,7 @@ loadGoogleMapsAPI({ key:mapKey })
}); });
// Create iFrame logo // Create iFrame logo
if (noHeader!=='0') { if (noHeader!=='0' && mapuser._id!=='demo') {
//console.log("Creating iFrame logo..."); //console.log("Creating iFrame logo...");
const logoDiv = document.createElement('div'); const logoDiv = document.createElement('div');
logoDiv.id = 'map-logo'; logoDiv.id = 'map-logo';

View File

@ -7,6 +7,8 @@
{% block main %} {% block main %}
<section class='splash dark' id='splash'> <section class='splash dark' id='splash'>
<div id='shade'></div>
<iframe id='demo' src="/map/demo?noheader=1&disp=0"></iframe>
<div class='container'> <div class='container'>
<h1>Tracman</h1> <h1>Tracman</h1>
<h3>Display your realtime GPS location on a map</h3> <h3>Display your realtime GPS location on a map</h3>