Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ require('app/models/sources/time_source');
require('app/models/sources/rss_source');
require('app/models/sources/twitter_timeline_source');
require('app/models/sources/stock_source');
require('app/models/sources/worldCup_source');

require('app/views/gridster_view');
require('app/views/last_updated_view');
Expand Down
36 changes: 36 additions & 0 deletions app/css/widgets/ticker_widget.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.widget-ticker {
background-color: #373737;
padding: 0px 0px 0px 0px;
}

/* Make it a marquee */
.marquee {
overflow: hidden;
white-space: nowrap;
margin:0 auto;
max-width:1314px;
}

.marquee span {
display: inline-block;
padding-left: 100%;
-webkit-animation: marquee 40s linear infinite;
-moz-animation: marquee 40s linear infinite;
letter-spacing: 0.1em;
text-transform: uppercase;
}

@keyframes marquee {
0% { -webkit-transform: translate(0, 0); }
100% { -webkit-transform: translate(-100%, 0); }
}

@-webkit-keyframes marquee {
0% { -webkit-transform: translate(0, 0); }
100% { -webkit-transform: translate(-100%, 0); }
}

@-moz-keyframes marquee {
0% { -moz-transform: translate(0, 0); }
100% { -moz-transform: translate(-100%, 0); }
}
24 changes: 24 additions & 0 deletions app/models/sources/worldCup_source.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Provides bitcoin ticker data from Bitstamp.
*
* The data is provided to widgets as single floating point values.
*/
Dashboard.WorldCupSource = Dashboard.PeriodicSource.extend({

inGame: false,

period: function() {
return this.get('inGame') ? 30000 : 5 * 60000;
}.property(),

dataUpdate: function(callback) {
$.get("http://worldcup.sfg.io/matches/today", function(data) {
callback(data.map(function(match) {

return match.home_team.code + " " + match.home_team.goals + "-" +
match.away_team.goals + " " + match.away_team.code;

}));
});
}
});
40 changes: 40 additions & 0 deletions app/models/widgets/ticker_widget.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
//
//
*/
Dashboard.TickerWidget = Dashboard.Widget.extend({
sourceData: "",

showLastUpdated: true,
templateName: 'ticker_widget',
classNames: ['widget', 'widget-ticker'],

formatSourceData: function(){
if( typeof this.get('content') == 'string' ){
return this.get('content');
}else{
return this.get('content').join(' ');
});
}
}.property('content'),

widgetView: function() {
return this._super().reopen({
didInsertElement: function() {
var span = this.$();
var that = this;

var setScale = function() {
var scaleFactor = 0.5;
var scaleSource = span.height();

var fontSize = scaleSource * scaleFactor;

that.$().css('font-size', fontSize + 'px');
}

setScale();
}
});
}.property()
});
3 changes: 3 additions & 0 deletions app/templates/ticker_widget.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{#if content}}
<p class="marquee"><span>{{formateSourceData}}</span></p>
{{/if}}