forked from cbonnet99/jquery-week-calendar
-
Notifications
You must be signed in to change notification settings - Fork 1
/
weekcalendar_json.html
117 lines (97 loc) · 3.66 KB
/
weekcalendar_json.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<style type='text/css'>
body {
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
margin: 0;
}
h1 {
margin: 0;
padding: 0.5em;
}
p.description {
font-size: 0.8em;
padding: 1em;
position: absolute;
top: 3.2em;
margin-right: 400px;
}
#message {
font-size: 0.7em;
position: absolute;
top: 1em;
right: 1em;
width: 350px;
display: none;
padding: 1em;
background: #ffc;
border: 1px solid #dda;
}
</style>
<link rel='stylesheet' type='text/css' href='reset.css' />
<!--
<link rel='stylesheet' type='text/css' href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/start/jquery-ui.css' />
-->
<link rel='stylesheet' type='text/css' href='libs/css/smoothness/jquery-ui-1.8.css' />
<link rel='stylesheet' type='text/css' href='jquery.weekcalendar.css' />
<link rel='stylesheet' type='text/css' href='demo.css' />
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
<!--
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js'></script>
-->
<script type='text/javascript' src='libs/jquery-ui-1.8.min.js'></script>
<script type='text/javascript' src='jquery.weekcalendar.js'></script>
<script type='text/javascript'>
var year = new Date().getFullYear();
var month = new Date().getMonth();
var day = new Date().getDate();
$(document).ready(function() {
$('#calendar').weekCalendar({
timeslotsPerHour: 4,
height: function($calendar){
return $(window).height() - $("h1").outerHeight();
},
eventRender : function(calEvent, $event) {
if(calEvent.end.getTime() < new Date().getTime()) {
$event.css("backgroundColor", "#aaa");
$event.find(".time").css({"backgroundColor": "#999", "border":"1px solid #888"});
}
},
eventNew : function(calEvent, $event) {
displayMessage("<strong>Added event</strong><br/>Start: " + calEvent.start + "<br/>End: " + calEvent.end);
alert("You've added a new event. You would capture this event, add the logic for creating a new event with your own fields, data and whatever backend persistence you require.");
},
eventDrop : function(calEvent, $event) {
displayMessage("<strong>Moved Event</strong><br/>Start: " + calEvent.start + "<br/>End: " + calEvent.end);
},
eventResize : function(calEvent, $event) {
displayMessage("<strong>Resized Event</strong><br/>Start: " + calEvent.start + "<br/>End: " + calEvent.end);
},
eventClick : function(calEvent, $event) {
displayMessage("<strong>Clicked Event</strong><br/>Start: " + calEvent.start + "<br/>End: " + calEvent.end);
},
eventMouseover : function(calEvent, $event) {
displayMessage("<strong>Mouseover Event</strong><br/>Start: " + calEvent.start + "<br/>End: " + calEvent.end);
},
eventMouseout : function(calEvent, $event) {
displayMessage("<strong>Mouseout Event</strong><br/>Start: " + calEvent.start + "<br/>End: " + calEvent.end);
},
noEvents : function() {
displayMessage("There are no events for this week");
},
data:"events.json"
});
function displayMessage(message) {
$("#message").html(message).fadeIn();
}
$("<div id=\"message\" class=\"ui-corner-all\"></div>").prependTo($("body"));
});
</script>
</head>
<body>
<h1>Week Calendar Demo (JSON data source)</h1>
<p class="description">Please Note ***. This demo uses static json data. For this reason, in order to see any event data, please edit events.json to use current dates.</p>
<div id='calendar'></div>
</body>
</html>