Added source javascript files
parent
f57101c18f
commit
37dea8fde5
|
@ -0,0 +1,37 @@
|
|||
#controls {
|
||||
width: 100vw;
|
||||
position: absolute;
|
||||
bottom: 50px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
#controls .btn {
|
||||
z-index: 50;
|
||||
background: #222;
|
||||
height: 10vh;
|
||||
padding: 2vh 0;
|
||||
}
|
||||
#controls .btn .fa {
|
||||
margin: 0 2vw;
|
||||
}
|
||||
#controls .btn:hover {
|
||||
background: #333;
|
||||
}
|
||||
#controls .btn.set, #controls .btn.clear {
|
||||
width: 30vw;
|
||||
}
|
||||
#controls .btn.track {
|
||||
width: 35vw;
|
||||
}
|
||||
@media (max-width:250px) {
|
||||
#controls .btn { font-size:.8em; }
|
||||
}
|
||||
@media (min-width:250px) and (max-width:350px) {
|
||||
#controls .btn { font-size:1em; }
|
||||
}
|
||||
@media (min-width:350px) and (max-width:450px) {
|
||||
#controls .btn { font-size:1.15em; }
|
||||
}
|
||||
@media (min-width:450px) {
|
||||
#controls .btn { font-size:1.3em; }
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
'use strict';
|
||||
/* global ga */
|
||||
|
||||
import css from '../css/base.css';
|
||||
|
||||
// Google analytics
|
||||
(function(t,r,a,c,m,o,n){t['GoogleAnalyticsObject']=m;t[m]=t[m]||function(){
|
||||
(t[m].q=t[m].q||[]).push(arguments);},t[m].l=1*new Date();o=r.createElement(a),
|
||||
n=r.getElementsByTagName(a)[0];o.async=1;o.src=c;n.parentNode.insertBefore(o,n);
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
ga('create','UA-44266909-3','auto');
|
||||
ga('require','linkid');
|
||||
ga('send','pageview');
|
|
@ -0,0 +1,11 @@
|
|||
'use strict';
|
||||
/* global $ */
|
||||
|
||||
import css from '../css/contact.css';
|
||||
|
||||
function onSubmit() {
|
||||
|
||||
//TODO: Clientside validations
|
||||
|
||||
$('#contact-form').submit();
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
'use strict';
|
||||
/* global navigator $ socket userid token mapuser toggleMaps */
|
||||
|
||||
import css from '../css/controls.css';
|
||||
|
||||
$(function(){
|
||||
var wpid, newloc;
|
||||
|
||||
// Set location
|
||||
$('#set-loc').click(function(){
|
||||
if (!userid===mapuser._id){ alert('You are not logged in! '); }
|
||||
else { if (!navigator.geolocation){ alert('Geolocation not enabled. '); }
|
||||
|
||||
else { navigator.geolocation.getCurrentPosition(
|
||||
|
||||
// Success callback
|
||||
function(pos){
|
||||
var newloc = {
|
||||
ts: Date.now(),
|
||||
tok: token,
|
||||
usr: userid,
|
||||
lat: pos.coords.latitude,
|
||||
lon: pos.coords.longitude,
|
||||
spd: (pos.coords.speed||0)
|
||||
};
|
||||
socket.emit('set', newloc);
|
||||
toggleMaps(newloc);
|
||||
console.log('⚜ Set location:',newloc.lat+", "+newloc.lon);
|
||||
},
|
||||
|
||||
// Error callback
|
||||
function(err) {
|
||||
alert("Unable to set location.");
|
||||
console.error('❌️',err.message);
|
||||
},
|
||||
|
||||
// Options
|
||||
{ enableHighAccuracy:true }
|
||||
|
||||
); } }
|
||||
|
||||
});
|
||||
|
||||
// Track location
|
||||
$('#track-loc').click(function(){
|
||||
if (!userid===mapuser._id) { alert('You are not logged in! '); }
|
||||
else {
|
||||
|
||||
// Start tracking
|
||||
if (!wpid) {
|
||||
if (!navigator.geolocation) { alert('Unable to track location. '); }
|
||||
else {
|
||||
$('#track-loc').html('<i class="fa fa-crosshairs fa-spin"></i>Stop').prop('title',"Click here to stop tracking your location. ");
|
||||
wpid = navigator.geolocation.watchPosition(
|
||||
|
||||
// Success callback
|
||||
function(pos) {
|
||||
newloc = {
|
||||
ts: Date.now(),
|
||||
tok: token,
|
||||
usr: userid,
|
||||
lat: pos.coords.latitude,
|
||||
lon: pos.coords.longitude,
|
||||
spd: (pos.coords.speed||0)
|
||||
}; socket.emit('set',newloc);
|
||||
toggleMaps(newloc);
|
||||
console.log('⚜ Set location:',newloc.lat+", "+newloc.lon);
|
||||
},
|
||||
|
||||
// Error callback
|
||||
function(err){
|
||||
alert("Unable to track location.");
|
||||
console.error(err.message);
|
||||
},
|
||||
|
||||
// Options
|
||||
{ enableHighAccuracy:true }
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Stop tracking
|
||||
else {
|
||||
$('#track-loc').html('<i class="fa fa-crosshairs"></i>Track').prop('title',"Click here to track your location. ");
|
||||
navigator.geolocation.clearWatch(wpid);
|
||||
wpid = undefined;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// Clear location
|
||||
$('#clear-loc').click(function(){
|
||||
if (!userid===mapuser._id) { alert('You are not logged in! '); }
|
||||
else {
|
||||
// Stop tracking
|
||||
if (wpid) {
|
||||
$('#track-loc').html('<i class="fa fa-crosshairs"></i>Track');
|
||||
navigator.geolocation.clearWatch(wpid);
|
||||
wpid = undefined;
|
||||
}
|
||||
|
||||
// Clear location
|
||||
newloc = {
|
||||
ts: Date.now(),
|
||||
tok: token,
|
||||
usr: userid,
|
||||
lat:0, lon:0, spd:0
|
||||
}; socket.emit('set',newloc);
|
||||
|
||||
// Turn off map
|
||||
toggleMaps(newloc);
|
||||
console.log('⚜ Cleared location');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
import css from '../css/form.css';
|
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
import css from '../css/index.css';
|
|
@ -0,0 +1,17 @@
|
|||
'use strict';
|
||||
/* global $ */
|
||||
|
||||
import css from '../css/login.css';
|
||||
|
||||
$(function(){
|
||||
|
||||
// On clocking 'show'
|
||||
$('#show').click(function(){
|
||||
if ($('#password').attr('type')==="password") {
|
||||
$('#password').attr('type','text');
|
||||
} else {
|
||||
$('#password').attr('type','password');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
import css from '../css/table.css';
|
Loading…
Reference in New Issue