added rain day for today
This commit is contained in:
1 parent
7a447278be
commit
813a4968b0
2 files changed
+22
-7
No files matched your search
@@ -92,6 +92,7 @@
|
|||||||
home: rouge
|
home: rouge
|
||||||
home_points: ~
|
home_points: ~
|
||||||
away_points: ~
|
away_points: ~
|
||||||
|
rain: true
|
||||||
|
|
||||||
-
|
-
|
||||||
date: 2016/6/16 # year/month/day
|
date: 2016/6/16 # year/month/day
|
||||||
@@ -100,6 +101,7 @@
|
|||||||
home: gris
|
home: gris
|
||||||
home_points: ~
|
home_points: ~
|
||||||
away_points: ~
|
away_points: ~
|
||||||
|
rain: true
|
||||||
|
|
||||||
-
|
-
|
||||||
date: 2016/6/23 # year/month/day
|
date: 2016/6/23 # year/month/day
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['m', '_', 'util', 'resultParser', 'views/topNavBar', 'views/footer', 'articles/articles'], function (m, _ , util, resultParser, topNavBar, footer, articles) {
|
define(['m', '_', 'util', 'resultParser', 'views/topNavBar', 'views/footer', 'articles/articles', 'images/rain.svg'], function (m, _ , util, resultParser, topNavBar, footer, articles, rainSvg) {
|
||||||
var mainPageLogo = {};
|
var mainPageLogo = {};
|
||||||
|
|
||||||
mainPageLogo.view = function(){
|
mainPageLogo.view = function(){
|
||||||
@@ -24,19 +24,25 @@ define(['m', '_', 'util', 'resultParser', 'views/topNavBar', 'views/footer', 'ar
|
|||||||
|
|
||||||
var nextGameDaySchedule = {};
|
var nextGameDaySchedule = {};
|
||||||
|
|
||||||
|
nextGameDaySchedule._toDay = function(){
|
||||||
|
var now = new Date();
|
||||||
|
return new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||||
|
};
|
||||||
|
|
||||||
nextGameDaySchedule.controller = function(){
|
nextGameDaySchedule.controller = function(){
|
||||||
var games = m.prop([]);
|
var games = m.prop([]);
|
||||||
|
var toDay = new Date();
|
||||||
return m.request({method: "GET", url: util.resultatsURL()})
|
return m.request({method: "GET", url: util.resultatsURL()})
|
||||||
.then(games)
|
.then(games)
|
||||||
.then(resultParser.getNightGames)
|
.then(resultParser.getNightGames)
|
||||||
.then(function(nightGames){
|
.then(function(nightGames){
|
||||||
return nextGameDaySchedule._getNextNightGame(nightGames, _.now()).games;
|
return nextGameDaySchedule._getNextNightGame(nightGames, nextGameDaySchedule._toDay()).games;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
nextGameDaySchedule._getNextNightGame = function(games, date){
|
nextGameDaySchedule._getNextNightGame = function(games, date){
|
||||||
return _.first(_.filter(games, function(game){
|
return _.first(_.filter(games, function(game){
|
||||||
return game.jsDate.getTime() > date;
|
return game.jsDate.getTime() >= date.getTime();
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -49,15 +55,22 @@ define(['m', '_', 'util', 'resultParser', 'views/topNavBar', 'views/footer', 'ar
|
|||||||
]));
|
]));
|
||||||
};
|
};
|
||||||
|
|
||||||
nextGameDaySchedule._responsoveText = function(largeText, smallText){
|
nextGameDaySchedule._responsoveText = function(largeText, smallText, rain){
|
||||||
return [m('span.uk-visible-large', largeText),
|
var ret = [];
|
||||||
m('span.uk-hidden-large', smallText)];
|
if(rain){
|
||||||
|
ret.push(rainSvg('1.5em'));
|
||||||
|
ret.push(' ');
|
||||||
|
}
|
||||||
|
ret.push(m('span.uk-visible-large', largeText));
|
||||||
|
ret.push(m('span.uk-hidden-large', smallText));
|
||||||
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
nextGameDaySchedule._getGamesRow = function(game){
|
nextGameDaySchedule._getGamesRow = function(game){
|
||||||
return m('tr', [
|
return m('tr', [
|
||||||
m('td', nextGameDaySchedule._responsoveText(util.formatDate(game.jsDate),
|
m('td', nextGameDaySchedule._responsoveText(util.formatDate(game.jsDate),
|
||||||
util.formatDateSmall(game.jsDate))),
|
util.formatDateSmall(game.jsDate),
|
||||||
|
game.rain)),
|
||||||
m('td', game.time),
|
m('td', game.time),
|
||||||
m('td', game.away),
|
m('td', game.away),
|
||||||
m('td', game.home)
|
m('td', game.home)
|
||||||
|
|||||||
Reference in new issue
Block a user