Colours and stuff updated

This commit is contained in:
Martin Donnelly 2018-05-16 23:24:27 +01:00
parent a70d76127a
commit d09d261163
9 changed files with 454 additions and 84 deletions

View File

@ -27,7 +27,7 @@
"func-names": 1,
"indent": ["error", 2, { "SwitchCase": 1 }],
"lines-around-comment": ["error", { "beforeBlockComment": true, "allowArrayStart": true }],
"max-len": [1, 120, 2], // 2 spaces per tab, max 80 chars per line
"max-len": [1, 180, 2], // 2 spaces per tab, max 80 chars per line
"new-cap": 1,
"newline-before-return": "error",
"no-array-constructor": 1,

269
notes/directions.json Normal file
View File

@ -0,0 +1,269 @@
{
"@lang": "en-US",
"ResultSet": {
"@version": "2.0",
"@lang": "en-US",
"Error": "0",
"ErrorMessage": "No error",
"Locale": "en-US",
"Result": {
"yahoo_driving_directions": {
"routeHandle": "0",
"address": [
{
"type": "Origin",
"lat": "55.872407",
"lon": "-3.549003",
"line1": "",
"line2": "",
"line3": "",
"line4": "",
"country": ""
},
{
"type": "Destination",
"lat": "55.942673",
"lon": "-4.556334",
"line1": "",
"line2": "",
"line3": "",
"line4": "",
"country": ""
}
],
"total_distance": "81363",
"total_time": "62.0",
"total_time_with_traffic": "68.0",
"boundingbox": {
"north": "55.942587",
"south": "55.832605",
"east": "-3.540913",
"west": "-4.556462"
},
"route_id": "AIIACAAAAB4AAABSAAAAmQAAAJ4AAAB42mOYx8DAxMQABBVvKmufOO1OZ4CCuPnVYiuYF9kw/P8PEfiwnwEJcAHxoivLljMxFHUfqmnjPQHXaBBfI+bCsMgKj8bvHSxVjECL4YJpsZcOdANpUXaGwzI1DFxASQYJBicgCQAvuB+Jc1TTsQ==",
"directions": {
"route_leg": [
{
"@type": "PrivateRouteLeg",
"number": "1",
"lat": "55.872313",
"lon": "-3.547393",
"distance": "98",
"description": "Head northeast. Go for 98 m.",
"time": "0",
"time_with_traffic": "0",
"turn_angle": "0",
"exit_num": "",
"man_type": "0",
"street": ", "
},
{
"@type": "PrivateRouteLeg",
"number": "2",
"lat": "55.872978",
"lon": "-3.546385",
"distance": "252",
"description": "Take the 3rd exit from roundabout. Go for 252 m.",
"time": "1",
"time_with_traffic": "1",
"turn_angle": "-90",
"exit_num": "",
"man_type": "29",
"street": ", "
},
{
"@type": "PrivateRouteLeg",
"number": "3",
"lat": "55.872967",
"lon": "-3.543209",
"distance": "127",
"description": "Take the 2nd exit from Brotherton Roundabout roundabout. Go for 127 m.",
"time": "1",
"time_with_traffic": "1",
"turn_angle": "-90",
"exit_num": "",
"man_type": "29",
"street": ", "
},
{
"@type": "PrivateRouteLeg",
"number": "4",
"lat": "55.873493",
"lon": "-3.541557",
"distance": "2453",
"description": "Take the 1st exit from Rosebank Roundabout roundabout onto Simpson Parkway. Go for 2.5 km.",
"time": "3",
"time_with_traffic": "3",
"turn_angle": "-90",
"exit_num": "",
"man_type": "29",
"street": ", SIMPSON PARKWAY"
},
{
"@type": "PrivateRouteLeg",
"number": "5",
"lat": "55.885177",
"lon": "-3.557704",
"distance": "432",
"description": "Turn left onto A705. Go for 432 m.",
"time": "1",
"time_with_traffic": "1",
"turn_angle": "-90",
"exit_num": "",
"man_type": "9",
"street": "A705, "
},
{
"@type": "PrivateRouteLeg",
"number": "6",
"lat": "55.886142",
"lon": "-3.563454",
"distance": "623",
"description": "Take the 2nd exit from Toll Roundabout roundabout onto Starlaw Road (A779). Go for 623 m.",
"time": "1",
"time_with_traffic": "1",
"turn_angle": "-90",
"exit_num": "",
"man_type": "29",
"street": "A779, STARLAW ROAD"
},
{
"@type": "PrivateRouteLeg",
"number": "7",
"lat": "55.889865",
"lon": "-3.570009",
"distance": "1652",
"description": "Take the 1st exit from Tailend Roundabout roundabout onto Starlaw Road (A779). Go for 1.7 km.",
"time": "2",
"time_with_traffic": "2",
"turn_angle": "-90",
"exit_num": "",
"man_type": "29",
"street": "A779, STARLAW ROAD"
},
{
"@type": "PrivateRouteLeg",
"number": "8",
"lat": "55.890005",
"lon": "-3.596199",
"distance": "49437",
"description": "Take the 1st exit from Starlaw West Roundabout roundabout onto M8 toward Glasgow. Go for 49.4 km.",
"time": "33",
"time_with_traffic": "33",
"turn_angle": "-90",
"exit_num": "",
"man_type": "29",
"street": "M8, ",
"sign": "Glasgow"
},
{
"@type": "PrivateRouteLeg",
"number": "9",
"lat": "55.84886",
"lon": "-4.306791",
"distance": "14959",
"description": "Keep right onto M8. Go for 15.0 km.",
"time": "10",
"time_with_traffic": "10",
"turn_angle": "30",
"exit_num": "",
"man_type": "23",
"street": "M8, "
},
{
"@type": "PrivateRouteLeg",
"number": "10",
"lat": "55.898191",
"lon": "-4.483388",
"distance": "1391",
"description": "Take exit 30 toward Erskine Bridge/Erskine/Bishopton onto M898. Go for 1.4 km.",
"time": "1",
"time_with_traffic": "1",
"turn_angle": "-30",
"exit_num": "",
"man_type": "17",
"street": "M898, ",
"sign": "Bishopton, Erskine, Erskine Bridge"
},
{
"@type": "PrivateRouteLeg",
"number": "11",
"lat": "55.90745",
"lon": "-4.473388",
"distance": "2509",
"description": "Keep right onto A898 toward Erskine Br./Glasgow/Crianlarich/(A82). Go for 2.5 km.",
"time": "2",
"time_with_traffic": "2",
"turn_angle": "30",
"exit_num": "",
"man_type": "23",
"street": "A898, ",
"sign": "(A82), Crianlarich, Erskine Br., Glasgow"
},
{
"@type": "PrivateRouteLeg",
"number": "12",
"lat": "55.923564",
"lon": "-4.450718",
"distance": "3714",
"description": "Take ramp onto Great Western Road (A82) toward Crianlarich. Go for 3.7 km.",
"time": "3",
"time_with_traffic": "3",
"turn_angle": "-30",
"exit_num": "",
"man_type": "19",
"street": "A82, GREAT WESTERN ROAD",
"sign": "Crianlarich"
},
{
"@type": "PrivateRouteLeg",
"number": "13",
"lat": "55.931783",
"lon": "-4.502968",
"distance": "1656",
"description": "Take the 2nd exit from Dunglass Roundabout roundabout onto Dumbarton Road (A82) toward Crianlarich/Dumbarton. Go for 1.7 km.",
"time": "2",
"time_with_traffic": "2",
"turn_angle": "-90",
"exit_num": "",
"man_type": "29",
"street": "A82, DUMBARTON ROAD",
"sign": "Crianlarich, Dumbarton"
},
{
"@type": "PrivateRouteLeg",
"number": "14",
"lat": "55.935098",
"lon": "-4.526989",
"distance": "2060",
"description": "Turn left onto Glasgow Road (A814) toward Dumbarton/Town Centre/H'burgh. Go for 2.1 km.",
"time": "3",
"time_with_traffic": "3",
"turn_angle": "-90",
"exit_num": "",
"man_type": "9",
"street": "A814, GLASGOW ROAD",
"sign": "Dumbarton, H'burgh, Town Centre"
},
{
"@type": "PrivateRouteLeg",
"number": "15",
"lat": "55.942587",
"lon": "-4.556462",
"distance": "0",
"description": "Arrive at Glasgow Road (A814). Your destination is on the right.",
"time": "0",
"time_with_traffic": "0",
"turn_angle": "0",
"exit_num": "",
"man_type": "2",
"street": ", "
}
]
},
"copy_right": "Copyright © 2018 Yahoo! Inc. All rights reserved. © Navteq"
},
"geocode_results": null
}
}
}

2
package-lock.json generated
View File

@ -52,7 +52,7 @@
},
"@sinonjs/formatio": {
"version": "2.0.0",
"resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz",
"integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==",
"dev": true,
"requires": {

View File

@ -87,6 +87,55 @@ body {
color: rgb(236, 110, 5)
}
.temp21 {
color: #ea5a24;
}
.temp22 {
color: #e4572b;
}
.temp23 {
color: #e14a29;
}
.temp24 {
color: #e04127;
}
.temp25 {
color: #d9372b;
}
.temp26 {
color: #d63129;
}
.temp27 {
color: #d12b2b;
}
.temp28 {
color: #cd282f;
}
.temp29 {
color: #c82432;
}
.temp30 {
color: #c32334;
}
.temp31 {
color: #be2138;
}
.temp32, .temp33, .temp34, .temp35 {
color: #b9203b;
}
.day {
font-family: "Roboto Slab", "Helvetica Neue", Helvetica, Arial, sans-serif;
text-transform: uppercase;

View File

@ -284,6 +284,56 @@ li {
color: rgb(236, 110, 5)
}
.temp21 {
color: #ea5a24;
}
.temp22 {
color: #e4572b;
}
.temp23 {
color: #e14a29;
}
.temp24 {
color: #e04127;
}
.temp25 {
color: #d9372b;
}
.temp26 {
color: #d63129;
}
.temp27 {
color: #d12b2b;
}
.temp28 {
color: #cd282f;
}
.temp29 {
color: #c82432;
}
.temp30 {
color: #c32334;
}
.temp31 {
color: #be2138;
}
.temp32, .temp33, .temp34, .temp35 {
color: #b9203b;
}
.day {
font-family: "Roboto Slab", "Helvetica Neue", Helvetica, Arial, sans-serif;
text-transform: uppercase;

View File

@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const CACHE_VERSION = { 'version': '0.0.704' };
const CACHE_VERSION = { 'version': '0.0.705' };
const dataCacheName = 'jubileeData-v1';
const cacheName = 'jubilee-final-1';
const filesToCache = [

View File

@ -4,6 +4,7 @@ const Backbone = require('backbone');
const request = require('request');
const { get, isEmpty } = require('lodash');
const { createPanel, addPanel } = require('./libs/panel');
const templates = require('./libs/templates');
const ForecastModel = Backbone.Model.extend({
'defaults': function (obj) {
@ -58,82 +59,6 @@ const ForecastView = Backbone.View.extend({
this.eventBus.on('showForecast', this.showForecastPanel, this);
},
'templateCurrently': _.template(`
<div class="forecastCurrently mui-panel glassy">
<div class="mui--text-title"><i class="medium wi wi-forecast-io-<%= icon %>"></i> <%=summary%></div>
<div>
<i class="small fa fa-up mui--align-middle " ></i><%=tempMax%>°
<i class="small fa fa-down mui--align-middle " ></i><%=tempMin%>°
</div>
<div class="large temp<%=~~(temperature) %>"><%=temperature%>°</div>
</div>
`),
'templateForecast': _.template(`
<div class="forecastToday mui-panel glassy">
<h3>Forecast</h3>
<div class='scrolling-wrapper-flexbox hourly' style="height: 100px;">
<%_.forEach(today, function(i) {%>
<div class="hourlyCard">
<div class="mui--text-center"><%=i.time %></div>
<div class="mui--text-center"><i class="small wi wi-forecast-io-<%= i.icon %>"></i></div>
<div class="mui--text-center temp<%=~~(i.temp)%> normalWeight"><%=~~(i.temp)%>°</div>
</div>
<%}) %>
</div>
<div>
<div class="dailyCard">
<%_.forEach(daily, function(i) {%>
<div class="mui-row">
<div class="mui-col-xs-6 mui--text-left mui--text-title"><%=i.time %></div>
<div class="mui-col-xs-2 mui--text-center"><i class="mui--text-title wi wi-forecast-io-<%= i.icon %>"></i></div>
<div class="mui-col-xs-2 mui--text-center temp<%=~~(i.tempHigh) %> mui--text-title "><%=~~(i.tempHigh)%>°</div>
<div class="mui-col-xs-2 mui--text-center temp<%=~~(i.tempLow) %> mui--text-title"><%=~~(i.tempLow)%>°</div>
</div>
<%}) %>
</div>
</div>
</div>
`),
'templateDetails': _.template(`
<div class="forecastDetails mui-panel glassy">
<h3>Details</h3>
<div class="mui-row">
<div class="mui-col-xs-6 mui--text-left mui--text-body2">Humidity</div>
<div class="mui-col-xs-6 mui--text-right mui--text-title"><%=~~(humidity * 100) %>%</div>
</div>
<div class="mui-row">
<div class="mui-col-xs-6 mui--text-left mui--text-body2">Visibility</div>
<div class="mui-col-xs-6 mui--text-right mui--text-title"><%=visibility %><span class="mui--text-body1">km</span></div>
</div>
<div class="mui-row">
<div class="mui-col-xs-6 mui--text-left mui--text-body2">UV Index</div>
<div class="mui-col-xs-6 mui--text-right mui--text-title"><%=uvIndex %></div>
</div>
<div class="mui-row">
<div class="mui-col-xs-12 mui--text-left mui--text-body1"><%=summary%></div>
</div>
<h3>Wind & Pressure</h3>
<div class="mui-row">
<div class="mui-col-xs-6 mui-col-md-3 mui--text-left mui--text-body2">Wind</div>
<div class="mui-col-xs-6 mui-col-md-3 mui--text-right mui--text-title"><%=windSpeed %><span class="mui--text-body1">km/h</span></div>
<div class="mui-col-xs-6 mui-col-md-3 mui--text-left mui--text-body2">Barometer</div>
<div class="mui-col-xs-6 mui-col-md-3 mui--text-right mui--text-title"><%=pressure %><span class="mui--text-body1">mBar</span></div>
</div>
<h3>Sun & Moon</h3>
<div class="mui-row">
<div class="mui-col-xs-3 mui--text-left mui--text-body2">Sunrise</div>
<div class="mui-col-xs-3 mui--text-right mui--text-title"><%=sunriseTime %></div>
<div class="mui-col-xs-3 mui--text-left mui--text-body2">Sunset</div>
<div class="mui-col-xs-3 mui--text-right mui--text-title"><%=sunsetTime %></div>
</div>
</div>
`),
'showForecastPanel': function(ll) {
console.log('Showing forecast', ll);
const prevll = this.model.get('ll');
@ -186,10 +111,10 @@ const ForecastView = Backbone.View.extend({
const currently = this.model.get('currently');
const forcastToday = { 'today':this.model.get('forcastToday'), 'daily':this.model.get('dailyForecast') };
const details = this.model.get('details');
html.push('<div class="">');
html.push(this.templateCurrently(currently));
html.push(this.templateForecast(forcastToday));
html.push(this.templateDetails(details));
html.push('<div class="">');
html.push(templates.templateCurrently(currently));
html.push(templates.templateForecast(forcastToday));
html.push(templates.templateDetails(details));
html.push('</div>');
html.push('<div class="endbumper"></div>');

View File

@ -25,6 +25,7 @@ const TrafficModel = Backbone.Model.extend({
const hour = (new Date()).getHours();
const day = new Date().getDay();
console.log('>> day', day);
let doRequest = false;
if (day !== 0 && day !== 6)
@ -39,6 +40,7 @@ const TrafficModel = Backbone.Model.extend({
else
this.set('mode', 0);
console.log('doRequest', doRequest);
console.log('Delay', delay);
this.timerID = setTimeout(
() => this.tick(),

View File

@ -62,7 +62,82 @@ const templates = {
'openInFS' : _.template(`
<div class=""><a href="https://m.foursquare.com/v/<%=id%>">Open in Foursquare</a></div>
`),
'map': _.template('<div id="map"></div>')
'map': _.template('<div id="map"></div>'),
'templateCurrently': _.template(`
<div class="forecastCurrently mui-panel glassy">
<div class="mui--text-title"><i class="medium wi wi-forecast-io-<%= icon %>"></i> <%=summary%></div>
<div>
<i class="small fa fa-up mui--align-middle " ></i><%=tempMax%>°
<i class="small fa fa-down mui--align-middle " ></i><%=tempMin%>°
</div>
<div class="large temp<%=~~(temperature) %>"><%=temperature%>°</div>
</div>
`),
'templateForecast': _.template(`
<div class="forecastToday mui-panel glassy">
<h3>Forecast</h3>
<div class='scrolling-wrapper-flexbox hourly' style="height: 100px;">
<%_.forEach(today, function(i) {%>
<div class="hourlyCard">
<div class="mui--text-center"><%=i.time %></div>
<div class="mui--text-center"><i class="small wi wi-forecast-io-<%= i.icon %>"></i></div>
<div class="mui--text-center temp<%=~~(i.temp)%> normalWeight"><%=~~(i.temp)%>°</div>
</div>
<%}) %>
</div>
<div>
<div class="dailyCard">
<%_.forEach(daily, function(i) {%>
<div class="mui-row">
<div class="mui-col-xs-6 mui--text-left mui--text-title"><%=i.time %></div>
<div class="mui-col-xs-2 mui--text-center"><i class="mui--text-title wi wi-forecast-io-<%= i.icon %>"></i></div>
<div class="mui-col-xs-2 mui--text-center temp<%=~~(i.tempHigh) %> mui--text-title "><%=~~(i.tempHigh)%>°</div>
<div class="mui-col-xs-2 mui--text-center temp<%=~~(i.tempLow) %> mui--text-title"><%=~~(i.tempLow)%>°</div>
</div>
<%}) %>
</div>
</div>
</div>
`),
'templateDetails': _.template(`
<div class="forecastDetails mui-panel glassy">
<h3>Details</h3>
<div class="mui-row">
<div class="mui-col-xs-6 mui--text-left mui--text-body2">Humidity</div>
<div class="mui-col-xs-6 mui--text-right mui--text-title"><%=~~(humidity * 100) %>%</div>
</div>
<div class="mui-row">
<div class="mui-col-xs-6 mui--text-left mui--text-body2">Visibility</div>
<div class="mui-col-xs-6 mui--text-right mui--text-title"><%=visibility %><span class="mui--text-body1">km</span></div>
</div>
<div class="mui-row">
<div class="mui-col-xs-6 mui--text-left mui--text-body2">UV Index</div>
<div class="mui-col-xs-6 mui--text-right mui--text-title"><%=uvIndex %></div>
</div>
<div class="mui-row">
<div class="mui-col-xs-12 mui--text-left mui--text-body1"><%=summary%></div>
</div>
<h3>Wind & Pressure</h3>
<div class="mui-row">
<div class="mui-col-xs-6 mui-col-md-3 mui--text-left mui--text-body2">Wind</div>
<div class="mui-col-xs-6 mui-col-md-3 mui--text-right mui--text-title"><%=windSpeed %><span class="mui--text-body1">km/h</span></div>
<div class="mui-col-xs-6 mui-col-md-3 mui--text-left mui--text-body2">Barometer</div>
<div class="mui-col-xs-6 mui-col-md-3 mui--text-right mui--text-title"><%=pressure %><span class="mui--text-body1">mBar</span></div>
</div>
<h3>Sun & Moon</h3>
<div class="mui-row">
<div class="mui-col-xs-3 mui--text-left mui--text-body2">Sunrise</div>
<div class="mui-col-xs-3 mui--text-right mui--text-title"><%=sunriseTime %></div>
<div class="mui-col-xs-3 mui--text-left mui--text-body2">Sunset</div>
<div class="mui-col-xs-3 mui--text-right mui--text-title"><%=sunsetTime %></div>
</div>
</div>
`)
};
module.exports = templates;