-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcalendar.html
159 lines (138 loc) · 3.33 KB
/
calendar.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!--
Calendar aside/plugin for octopress blogging framework.
Copyright (C) 2012 Neeraj Kumar ( [email protected], [email protected])
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<style>
.highlighted-calendar-day
{
color : #CCC;
font-weight : bold;
}
.calendar-header-day{
font-weight : bold;
color : #AAA;
font-size : 14px;
}
.highlighted-calendar-day a
{
}
.prev-link
{
float:left;
}
.next-link
{
float: right;
}
.calendar-day
{
color : #888;
font-weight : 12px;
}
.calendar-table
{
width : 100%;
}
.calendar-table td
{
border-right : dotted 1px lightgrey;
text-align : center;
}
.calendar-table td:last-child
{
border-right : none;
}
.calendar-table th
{
background-color : lightgrey;
text-align : center;
}
.prevCalendarLink img
{
width : 20px;
height : 20px;
border: 0px;
float: left;
}
.nextCalendarLink img
{
width : 20px;
height: 20px;
border: 0px;
float: right;
}
</style>
<script type="text/javascript" src="{{ root_url }}/javascripts/calendar.js"></script>
<section id="calendarDiv">
<span style="display:block" id="calendarSpan"></span>
<div>
<a href="#" class="previousMonth show"/><a href="#" class="nextMonth hide"/>
</div>
</section>
<script type="text/javascript">
monthCalendar = function(id,year,month)
{
var highlightArray = new Array();
var hightlightLinks = new Array();
{% for post in site.posts limit: site.recent_posts %}
highlightArray.push('{{ post.date|date : "%m/%d/%Y") }}');
hightlightLinks.push('{{ root_url }}{{ post.url }}');
{% endfor %}
var cal = new Calendar(month,year,highlightArray,hightlightLinks);
cal.generateHTML(id);
var element = document.getElementById(id);
element.innerHTML = cal.getHTML();
}
loadCalendar = function(){
var now = new Date();
var month = now.getMonth();
var year = now.getFullYear();
monthCalendar('calendarDiv',year,month);
}
if(Array.prototype.indexOf == undefined)
{
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this == null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
return -1;
}
var n = 0;
if (arguments.length > 0) {
n = Number(arguments[1]);
if (n != n) { // shortcut for verifying if it's NaN
n = 0;
} else if (n != 0 && n != Infinity && n != -Infinity) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
}
if (n >= len) {
return -1;
}
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;
}
}
return -1;
}
}
$(document).ready(function(){
loadCalendar();
});
</script>