-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
144 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
############################## | ||
# komodo project files | ||
|
||
*.kpf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
//////////////////////////////////// | ||
// football.db api wrapper | ||
|
||
var sportdb_api_new = function( opts ) | ||
{ | ||
var _defaults = { | ||
apiPathPrefix: 'http://footballdb.herokuapp.com/api/v1' | ||
}; | ||
var _settings; | ||
|
||
function _debug( msg ) { | ||
if( window.console && window.console.log ) { | ||
window.console.log( '[debug] '+msg ); | ||
} | ||
} | ||
|
||
function _init( opts ) | ||
{ | ||
_settings = _.extend( {}, _defaults, opts ); | ||
|
||
_debug( 'apiPathPrefix: ' + _settings.apiPathPrefix ); | ||
} | ||
|
||
function _fetch_round( event_key, round_pos, onsuccess ) | ||
{ | ||
var api_url = _settings.apiPathPrefix + '/event/' + event_key + '/round/' + round_pos + '?callback=?'; | ||
$.getJSON( api_url, onsuccess ); | ||
} | ||
|
||
// call "c'tor/constructor" | ||
_init( opts ); | ||
|
||
// return/export public api | ||
return { | ||
fetch_round: _fetch_round | ||
} | ||
} // fn sportdb_api_new | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='UTF-8'> | ||
<title>Matchday Example / sport.db JSON(P) API</title> | ||
|
||
<script src='js/libs/jquery-2.0.2.min.js'></script> | ||
<script src='js/libs/underscore-1.4.4.min.js'></script> | ||
|
||
<script src='js/jquery.football.api.js'></script> | ||
<script src='js/jquery.football.widget.js'></script> | ||
|
||
<style> | ||
|
||
a { | ||
color: black; | ||
text-decoration: none; | ||
} | ||
|
||
#widget, #widget2 { | ||
/* background-color: lime; */ | ||
border: 1px solid green; | ||
padding: 4px; | ||
} | ||
</style> | ||
|
||
<script> | ||
|
||
function debug( msg ) { | ||
if( window.console && window.console.log ) { | ||
window.console.log( '[debug] '+msg ); | ||
} | ||
} | ||
|
||
var sportdb_widget; | ||
|
||
$(document).ready( function() { | ||
|
||
debug( 'enter document.ready' ); | ||
|
||
sportdb_widget = sportdb_widget_new( '#widget', | ||
{ event: 'de.2012_13', | ||
rounds: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12' ], | ||
tplId: '#widgetTpl'} ); | ||
}); | ||
</script> | ||
|
||
</head> | ||
<body> | ||
|
||
<script type='text/template' id='widgetTpl'> | ||
<h3> | ||
<%= data.event.title %> | ||
- | ||
<%= data.round.title %> | ||
</h3> | ||
|
||
<table> | ||
<% _.each( data.games, function( game, index ) { %> | ||
<tr> | ||
<td> | ||
<%= game.play_at %> | ||
</td> | ||
<td style='text-align: right;'> | ||
<%= game.team1_title %> (<%= game.team1_code %>) | ||
</td> | ||
|
||
<td> | ||
<% if( game.score1 != null && game.score2 != null ) { %> | ||
<% if( game.score1ot != null && game.score2ot != null ) { %> | ||
<% if ( game.score1p != null && game.score2p != null ) { %> | ||
<%= game.score1p %> - <%= game.score2p %> iE / | ||
<% } %> | ||
<%= game.score1ot %> - <%= game.score2ot %> nV / | ||
<% } %> | ||
<%= game.score1 %> - <%= game.score2 %> | ||
<% } else { %> | ||
- | ||
<% } %> | ||
</td> | ||
<td> | ||
<%= game.team2_title %> (<%= game.team2_code %>) | ||
</td> | ||
</tr> | ||
<% }); %> | ||
</table> | ||
</script> | ||
|
||
|
||
|
||
<h1>Matchday Example / sport.db JSON(P) API</h1> | ||
|
||
<div id='widget'></div> | ||
|
||
</body> | ||
</html> |