2018-08-02 17:18:12 +00:00
|
|
|
<?php
|
2018-08-19 21:13:11 +00:00
|
|
|
if (isset($_GET["location"])):
|
2018-08-11 21:18:23 +00:00
|
|
|
$options = array(
|
|
|
|
'http' => array(
|
|
|
|
'method' => 'GET',
|
|
|
|
'header' => 'x-ha-access: nXa7LiR1PG'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$context = stream_context_create($options);
|
|
|
|
$data = json_decode(file_get_contents("http://192.168.0.25:8123/api/states", false, $context), true);
|
|
|
|
|
|
|
|
foreach($data as $item) {
|
|
|
|
$output[$item["entity_id"]] = $item;
|
|
|
|
}
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
echo json_encode($output['device_tracker.jasonsphone_jason']);
|
|
|
|
exit();
|
|
|
|
|
2018-08-19 21:13:11 +00:00
|
|
|
elseif (isset($_GET["calendar"])):
|
|
|
|
$options = array(
|
|
|
|
'http' => array(
|
|
|
|
'header' => 'Host: internal.jnf.me'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$context = stream_context_create($options);
|
|
|
|
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
echo file_get_contents("http://192.168.0.25/public/pages/display/calendar.php?location", false, $context);
|
|
|
|
|
2018-08-11 21:18:23 +00:00
|
|
|
else:
|
2018-08-02 17:18:12 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
2018-08-06 21:25:31 +00:00
|
|
|
<link href="//fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
|
2018-08-02 17:18:12 +00:00
|
|
|
<style type="text/css">
|
2018-08-06 21:25:31 +00:00
|
|
|
* {box-sizing: border-box; margin: 0; border: 0; padding: 0; font-family: 'Open Sans', sans-serif; font-weight: 400; text-align: center;}
|
2018-08-02 17:18:12 +00:00
|
|
|
html, body {height: 100%; min-height: 100%;}
|
|
|
|
body {background-color: #333333;}
|
2018-08-19 23:12:42 +00:00
|
|
|
p {font-size: 2.5vw; color: #FFFFFF; opacity: 0.5;}
|
|
|
|
h1 {font-size: 7vw; color: #FFFFFF;}
|
2018-08-11 21:33:25 +00:00
|
|
|
#map {width: 100; height: 100%;}
|
2018-08-13 02:31:24 +00:00
|
|
|
#container {position: absolute; top: 0; width: 100%; height: 100%; background: linear-gradient(135deg, rgba(139,51,175,0.8) 0%, rgba(0,131,214,0.8) 100%), radial-gradient(ellipse at center, rgba(255,255,255,0) 35%, rgba(255,255,255,1) 95%);}
|
2018-08-02 23:17:40 +00:00
|
|
|
#centered {position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);}
|
2018-08-19 23:12:42 +00:00
|
|
|
#plan {position: absolute; bottom: 2vh; left: -45vw; font-size: 1vw; color: #FFFFFF; background-color: #000000; opacity: 0.8;}
|
|
|
|
#plan::after{content: ""; clear: both; display: table;}
|
|
|
|
#plan div {width: 12.5vw; float: left; border-left: 1px solid #FFFFFF;}
|
|
|
|
#plan #plantitle {width: 7.5vw; padding: 0 1%; border-left: 0; text-align: left; color: #71C5E8;}
|
2018-08-02 17:18:12 +00:00
|
|
|
</style>
|
2018-08-11 21:20:54 +00:00
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
2018-08-11 20:53:02 +00:00
|
|
|
<script src="https://maps.googleapis.com/maps/api/js?key=&AIzaSyCo79O07nOpWmdxKBUdgslJRrBwYSykDxwv=3.exp"></script>
|
|
|
|
<script>
|
2018-08-20 00:48:11 +00:00
|
|
|
var map, today = new Date(), days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
2018-08-11 21:18:23 +00:00
|
|
|
|
2018-08-11 20:53:02 +00:00
|
|
|
$(function() {
|
2018-08-11 21:18:23 +00:00
|
|
|
var locConnaught = new google.maps.LatLng(51.0426695, -114.0898373);
|
2018-08-11 20:53:02 +00:00
|
|
|
var mapOptions = {
|
|
|
|
zoom: 15,
|
2018-08-11 21:18:23 +00:00
|
|
|
center: locConnaught,
|
2018-08-11 20:53:02 +00:00
|
|
|
disableDefaultUI: true,
|
|
|
|
styles: [{"featureType":"poi","elementType":"all","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"off"}]},{"featureType":"poi","elementType":"all","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"off"}]},{"featureType":"administrative","elementType":"all","stylers":[{"hue":"#000000"},{"saturation":0},{"lightness":-100},{"visibility":"off"}]},{"featureType":"road","elementType":"labels","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"water","elementType":"labels","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"off"}]},{"featureType":"road.local","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"on"}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"on"}]},{"featureType":"transit","elementType":"labels","stylers":[{"hue":"#000000"},{"saturation":0},{"lightness":-100},{"visibility":"off"}]},{"featureType":"landscape","elementType":"labels","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"off"}]},{"featureType":"road","elementType":"geometry","stylers":[{"hue":"#bbbbbb"},{"saturation":-100},{"lightness":26},{"visibility":"on"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"hue":"#dddddd"},{"saturation":-100},{"lightness":-3},{"visibility":"on"}]}]
|
|
|
|
}
|
|
|
|
|
|
|
|
map = new google.maps.Map(document.getElementById('map'), mapOptions);
|
2018-08-11 21:18:23 +00:00
|
|
|
|
|
|
|
updateLocation();
|
2018-08-19 23:12:42 +00:00
|
|
|
updatePlan();
|
2018-08-11 21:18:23 +00:00
|
|
|
|
|
|
|
setInterval(function() {
|
|
|
|
updateLocation();
|
|
|
|
}, 60000);
|
2018-08-19 23:12:42 +00:00
|
|
|
|
|
|
|
setInterval(function() {
|
|
|
|
updatePlan();
|
|
|
|
}, 900000);
|
|
|
|
});
|
|
|
|
|
|
|
|
$(window).focus(function() {
|
|
|
|
$('#plan').delay(500).animate({left: 0}, 500);
|
|
|
|
});
|
|
|
|
|
|
|
|
$(window).blur(function() {
|
|
|
|
$('#plan').css({left: '-45vw'});
|
2018-08-11 20:53:02 +00:00
|
|
|
});
|
2018-08-11 21:18:23 +00:00
|
|
|
|
|
|
|
function updateLocation() {
|
2018-08-19 21:13:11 +00:00
|
|
|
$.getJSON('?location', function(data) {
|
2018-08-13 00:30:30 +00:00
|
|
|
$('h1').html((data.state == 'not_home') ? 'Nobody Knows' : 'At ' + data.state.replace(/^\w/, c => c.toUpperCase()));
|
2018-08-11 21:18:23 +00:00
|
|
|
var locLive = new google.maps.LatLng(data.attributes.latitude, data.attributes.longitude);
|
|
|
|
map.setCenter(locLive);
|
2018-08-19 23:12:42 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function updatePlan() {
|
|
|
|
$.getJSON('?calendar', function(data) {
|
|
|
|
|
2018-08-20 00:48:11 +00:00
|
|
|
d1 = nextWorkday(today);
|
|
|
|
d2 = nextWorkday(d1);
|
|
|
|
d3 = nextWorkday(d2);
|
2018-08-19 23:12:42 +00:00
|
|
|
|
|
|
|
$('#plantitle').html('Three Day Plan');
|
2018-08-20 00:48:11 +00:00
|
|
|
|
|
|
|
if (data.find(x => x.start.date == getYMDstring(d1))) $('#d1').html(days[d1.getDay()] + "<br>" + data.find(x => x.start.date == getYMDstring(d1)).summary); else $('#d1').html(days[d1.getDay()] + "<br><i>No Plan</i>");
|
|
|
|
if (data.find(x => x.start.date == getYMDstring(d2))) $('#d2').html(days[d2.getDay()] + "<br>" + data.find(x => x.start.date == getYMDstring(d2)).summary); else $('#d2').html(days[d2.getDay()] + "<br><i>No Plan</i>");
|
|
|
|
if (data.find(x => x.start.date == getYMDstring(d3))) $('#d3').html(days[d3.getDay()] + "<br>" + data.find(x => x.start.date == getYMDstring(d3)).summary); else $('#d3').html(days[d3.getDay()] + "<br><i>No Plan</i>");
|
2018-08-19 23:12:42 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function nextWorkday(d) {
|
2018-08-20 00:48:11 +00:00
|
|
|
var nd = new Date(d.getTime());
|
|
|
|
|
|
|
|
var day = nd.getDay(), ddif = 1;
|
2018-08-19 23:12:42 +00:00
|
|
|
|
|
|
|
if (day === 5) ddif = 3;
|
|
|
|
else if (day === 6) ddif = 2;
|
|
|
|
|
2018-08-20 00:48:11 +00:00
|
|
|
nd.setDate(nd.getDate() + ddif);
|
|
|
|
return nd;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getYMDstring(d) {
|
|
|
|
var output = '';
|
|
|
|
output += d.getFullYear() + '-';
|
|
|
|
output += (d.getMonth() < 9) ? '0' + (d.getMonth() + 1) : d.getMonth() + 1;
|
|
|
|
output += (d.getDate() < 10) ? '-0' + d.getDate() : '-' + d.getDate();
|
|
|
|
return output;
|
2018-08-11 21:18:23 +00:00
|
|
|
}
|
2018-08-11 20:53:02 +00:00
|
|
|
</script>
|
2018-08-02 17:18:12 +00:00
|
|
|
<body>
|
2018-08-11 20:53:02 +00:00
|
|
|
<div id="map"></div>
|
2018-08-02 23:17:40 +00:00
|
|
|
<div id="container">
|
|
|
|
<div id="centered">
|
|
|
|
<p>Where tf is Jason?</p>
|
2018-08-11 21:18:23 +00:00
|
|
|
<h1>Nobody Knows</h1>
|
2018-08-02 23:17:40 +00:00
|
|
|
</div>
|
2018-08-19 23:12:42 +00:00
|
|
|
|
|
|
|
<div id="plan">
|
|
|
|
<div id="plantitle"></div>
|
|
|
|
<div id="d1" class="plancolumn"></div>
|
|
|
|
<div id="d2" class="plancolumn"></div>
|
|
|
|
<div id="d3" class="plancolumn"></div>
|
|
|
|
</div>
|
2018-08-02 23:17:40 +00:00
|
|
|
</div>
|
2018-08-02 17:18:12 +00:00
|
|
|
</body>
|
|
|
|
</html>
|
2018-08-11 21:18:23 +00:00
|
|
|
<? endif; ?>
|