Skip to content

Instantly share code, notes, and snippets.

@Rajesh-jai

Rajesh-jai/schedule.html

Last active Apr 15, 2016
Embed
What would you like to do?
Cricket API schedule calendar view sample code using http://fullcalendar.io/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> Cricket Schedule Calender view - Cricket API Static Widget from Roanuz</title>
<!-- Library required, for more info refer http://fullcalendar.io/ , http://fullcalendar.io/docs/ -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.6.1/fullcalendar.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.6.1/fullcalendar.print.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.6.1/fullcalendar.min.js" type="text/javascript"></script>
<!-- CricketAPI black theme -->
<link rel="stylesheet" href="https://s3-ap-southeast-1.amazonaws.com/cricketapi-widgets/css/black_theme.css"/>
</head>
<body>
<div id="calendar" class="rca-tab-content active"></div>
<script type="text/javascript">
$(document).ready(function(){
var year_str = '2016';
var month_str = '4';
var new_month_str = parseInt(month_str);
if (new_month_str < 10){
month_str = "0"+month_str;
}
if(year_str && month_str){
var show_date = year_str+'-'+month_str+"-"+"01";
}
else{
var show_date = moment().format('YYYY-MM-DD')
}
// Need to give list of dictionary(Match data).
var data = JSON.parse('[{"borderColor": "#FF1300", "end": "2016-04-03T17:30+00:00", "title": "ENG vs WI", "url": "http://www.litzscore.com/series/icc_wc_t20_2016/icc_wc_t20_2016_final/", "venue": "Eden Gardens, Kolkata, India", "start": "2016-04-03T13:30+00:00", "sub_card_name": "Final Match"}, {"borderColor": "#FF1300", "end": "2016-04-09T18:30+00:00", "title": "MI vs RPS", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g1/", "venue": "Wankhede Stadium, Mumbai, India", "start": "2016-04-09T14:30+00:00", "sub_card_name": "1st Match"}, {"borderColor": "#FF1300", "end": "2016-04-10T18:30+00:00", "title": "KKR vs DD", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g2/", "venue": "Eden Gardens, Kolkata, India", "start": "2016-04-10T14:30+00:00", "sub_card_name": "2nd Match"}, {"borderColor": "#FF1300", "end": "2016-04-11T18:30+00:00", "title": "KXIP vs GL", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g3/", "venue": "Punjab Cricket Association IS Bindra Stadium, Mohali, Chandigarh, India", "start": "2016-04-11T14:30+00:00", "sub_card_name": "3rd Match"}, {"borderColor": "#FF1300", "end": "2016-04-12T18:30+00:00", "title": "RCB vs SRH", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g4/", "venue": "M Chinnaswamy Stadium, Bangalore, India", "start": "2016-04-12T14:30+00:00", "sub_card_name": "4th Match"}, {"borderColor": "#FF1300", "end": "2016-04-13T18:30+00:00", "title": "KKR vs MI", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g5/", "venue": "Eden Gardens, Kolkata, India", "start": "2016-04-13T14:30+00:00", "sub_card_name": "5th Match"}, {"borderColor": "#FF1300", "end": "2016-04-14T18:30+00:00", "title": "GL vs RPS", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g6/", "venue": "Saurashtra Cricket Association Stadium, Rajkot, India", "start": "2016-04-14T14:30+00:00", "sub_card_name": "6th Match"}, {"borderColor": "#FF1300", "end": "2016-04-15T18:30+00:00", "title": "DD vs KXIP", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g7/", "venue": "Feroz Shah Kotla, Delhi, India", "start": "2016-04-15T14:30+00:00", "sub_card_name": "7th Match"}, {"borderColor": "#FF1300", "end": "2016-04-16T14:30+00:00", "title": "SRH vs KKR", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g8/", "venue": "Rajiv Gandhi International Stadium, Uppal, Hyderabad, India", "start": "2016-04-16T10:30+00:00", "sub_card_name": "8th Match"}, {"borderColor": "#FF1300", "end": "2016-04-16T18:30+00:00", "title": "MI vs GL", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g9/", "venue": "Wankhede Stadium, Mumbai, India", "start": "2016-04-16T14:30+00:00", "sub_card_name": "9th Match"}, {"borderColor": "#FF1300", "end": "2016-04-17T14:30+00:00", "title": "KXIP vs RPS", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g10/", "venue": "Punjab Cricket Association IS Bindra Stadium, Mohali, Chandigarh, India", "start": "2016-04-17T10:30+00:00", "sub_card_name": "10th Match"}, {"borderColor": "#FF1300", "end": "2016-04-17T18:30+00:00", "title": "RCB vs DD", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g11/", "venue": "M Chinnaswamy Stadium, Bangalore, India", "start": "2016-04-17T14:30+00:00", "sub_card_name": "11th Match"}, {"borderColor": "#FF1300", "end": "2016-04-18T18:30+00:00", "title": "SRH vs MI", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g12/", "venue": "Rajiv Gandhi International Stadium, Uppal, Hyderabad, India", "start": "2016-04-18T14:30+00:00", "sub_card_name": "12th Match"}, {"borderColor": "#FF1300", "end": "2016-04-19T18:30+00:00", "title": "KXIP vs KKR", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g13/", "venue": "Punjab Cricket Association IS Bindra Stadium, Mohali, Chandigarh, India", "start": "2016-04-19T14:30+00:00", "sub_card_name": "13th Match"}, {"borderColor": "#FF1300", "end": "2016-04-20T18:30+00:00", "title": "MI vs RCB", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g14/", "venue": "Wankhede Stadium, Mumbai, India", "start": "2016-04-20T14:30+00:00", "sub_card_name": "14th Match"}, {"borderColor": "#FF1300", "end": "2016-04-21T18:30+00:00", "title": "GL vs SRH", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g15/", "venue": "Saurashtra Cricket Association Stadium, Rajkot, India", "start": "2016-04-21T14:30+00:00", "sub_card_name": "15th Match"}, {"borderColor": "#FF1300", "end": "2016-04-22T18:30+00:00", "title": "RPS vs RCB", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g16/", "venue": "Maharashtra Cricket Association Stadium, Pune, India", "start": "2016-04-22T14:30+00:00", "sub_card_name": "16th Match"}, {"borderColor": "#FF1300", "end": "2016-04-23T14:30+00:00", "title": "DD vs MI", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g17/", "venue": "Feroz Shah Kotla, Delhi, India", "start": "2016-04-23T10:30+00:00", "sub_card_name": "17th Match"}, {"borderColor": "#FF1300", "end": "2016-04-23T18:30+00:00", "title": "SRH vs KXIP", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g18/", "venue": "Rajiv Gandhi International Stadium, Uppal, Hyderabad, India", "start": "2016-04-23T14:30+00:00", "sub_card_name": "18th Match"}, {"borderColor": "#FF1300", "end": "2016-04-24T14:30+00:00", "title": "GL vs RCB", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g19/", "venue": "Saurashtra Cricket Association Stadium, Rajkot, India", "start": "2016-04-24T10:30+00:00", "sub_card_name": "19th Match"}, {"borderColor": "#FF1300", "end": "2016-04-24T18:30+00:00", "title": "RPS vs KKR", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g20/", "venue": " Maharashtra Cricket Association Stadium, Pune, India", "start": "2016-04-24T14:30+00:00", "sub_card_name": "20th Match"}, {"borderColor": "#FF1300", "end": "2016-04-25T18:30+00:00", "title": "KXIP vs MI", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g21/", "venue": "Punjab Cricket Association Stadium, Mohali, Chandigarh, India", "start": "2016-04-25T14:30+00:00", "sub_card_name": "21st Match"}, {"borderColor": "#FF1300", "end": "2016-04-26T18:30+00:00", "title": "SRH vs RPS", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g22/", "venue": "Rajiv Gandhi International Stadium, Uppal, Hyderabad, India", "start": "2016-04-26T14:30+00:00", "sub_card_name": "22nd Match"}, {"borderColor": "#FF1300", "end": "2016-04-27T18:30+00:00", "title": "DD vs GL", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g23/", "venue": "Feroz Shah Kotla, Delhi, India", "start": "2016-04-27T14:30+00:00", "sub_card_name": "23rd Match"}, {"borderColor": "#FF1300", "end": "2016-04-28T18:30+00:00", "title": "MI vs KKR", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g24/", "venue": "Wankhede Stadium, Mumbai, India", "start": "2016-04-28T14:30+00:00", "sub_card_name": "24th Match"}, {"borderColor": "#FF1300", "end": "2016-04-29T18:30+00:00", "title": "RPS vs GL", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g25/", "venue": "Maharashtra Cricket Association Stadium, Pune, India", "start": "2016-04-29T14:30+00:00", "sub_card_name": "25th Match"}, {"borderColor": "#FF1300", "end": "2016-04-30T14:30+00:00", "title": "DD vs KKR", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g26/", "venue": "Feroz Shah Kotla, Delhi, India", "start": "2016-04-30T10:30+00:00", "sub_card_name": "26th Match"}, {"borderColor": "#FF1300", "end": "2016-04-30T18:30+00:00", "title": "SRH vs RCB", "url": "http://www.litzscore.com/series/iplt20_2016/iplt20_2016_g27/", "venue": "Rajiv Gandhi International Stadium, Uppal, Hyderabad, India", "start": "2016-04-30T14:30+00:00", "sub_card_name": "27th Match"}]');
for (var i in data) {
data[i].start = moment(data[i].start).format("YYYY-MM-DDTHH:mm:ss");
data[i].end = moment(data[i].end).format("YYYY-MM-DDTHH:mm:ss");
}
$('#calendar').fullCalendar({
header: {
left: 'month',
right: ''
},
defaultDate: show_date,
timeFormat: 'h(:mm)a',
editable: false,
eventLimit: true, // allow "more" link when too many events
events: data
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment