My favorites
▼
|
Sign in
fullcalendar
ISSUE TRACKER HAS MOVED. DO NOT USE THIS (more info)
Project Home
Issues
Export to GitHub
New issue
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
312
attachment: example-fcalendar-selectViaMouse.js
(1.9 KB)
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
//
// paste inside > $(document).ready(function() {
//
Date.prototype.addDays = function(days) {
this.setDate(this.getDate()+days);
}
Date.prototype.clone = function () {
return new Date(this.getTime());
}
function readAgendaTime(e) {
var
view = $('#calendar').fullCalendar('getView'),
col = parseInt($(e).attr('class').match(/fc-rowday(\d+)/)[1]),
date = view.visStart.clone();
date.addDays(col);
var
slot = parseInt($(e).closest('td').attr('class').match(/fc-slot(\d+)/)[1]),
mins = slot * view.options.slotMinutes,
hours = Math.floor(mins/60),
minMinutes = $.fullCalendar.parseTime(view.options.minTime);
date.setHours(hours);
date.setMinutes(mins%60 + minMinutes);
return date;
}
var selcol = -1;
var selOpts = {
autoRefresh: true,
filter: ".fc-rowcol",
start: function(e) {
$(".ui-selected", this).removeClass("ui-selected");
},
stop: function(e) {
var
firstTime = readAgendaTime($(".ui-selected:first", this)),
lastTime = readAgendaTime($(".ui-selected:last", this));
$("#.ui-selected:first").html("from <em>" +
firstTime.getHours().toString() + ':' + firstTime.getMinutes().toString() + '</em> to <em>' +
lastTime.getHours().toString() + ':' + lastTime.getMinutes().toString() + '</em>'
);
$(this).selectable('destroy');
selcol = -1;
},
selecting: function(e, ui) {
},
selected: function(e, ui) {
}
}
$("#calendar .fc-agenda-body div.fc-rowcol").mousedown(function() {
if (selcol < 0) {
selcol = parseInt(this.className.match(/fc\-rowday(\d+)/)[1]);
selOpts.filter = 'div.fc-rowtable div.fc-rowday' + selcol;
$("#calendar .fc-agenda-body").selectable(selOpts);
}
});
Powered by
Google Project Hosting