summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien MUETTON <the.mouette@gmail.com>2010-07-28 16:55:28 +0200
committerJulien MUETTON <the.mouette@gmail.com>2010-07-28 16:55:28 +0200
commitc7dedabfa3d23978ca08191ed99c5764a43b1437 (patch)
tree656186661535d9d27a1e9576ae72c0b54d83e272
parent28326e2feea09db5b1b1657dcde71302898db3e3 (diff)
parentaf716db1af66ad5432f95a77549d99bc50b3735b (diff)
downloadjquery-week-calendar-c7dedabfa3d23978ca08191ed99c5764a43b1437.zip
jquery-week-calendar-c7dedabfa3d23978ca08191ed99c5764a43b1437.tar.gz
jquery-week-calendar-c7dedabfa3d23978ca08191ed99c5764a43b1437.tar.bz2
Merge branch 'master' into gh-pages
-rw-r--r--jquery.weekcalendar.js43
1 files changed, 23 insertions, 20 deletions
diff --git a/jquery.weekcalendar.js b/jquery.weekcalendar.js
index 253ba63..dcf133a 100644
--- a/jquery.weekcalendar.js
+++ b/jquery.weekcalendar.js
@@ -61,7 +61,7 @@
resizable : function(calEvent, element) {
return true;
},
- eventClick : function() {
+ eventClick : function(calEvent, element, dayFreeBusyManager, calendar, clickEvent) {
},
eventRender : function(calEvent, element) {
return element;
@@ -78,7 +78,7 @@
},
eventResize : function(calEvent, element) {
},
- eventNew : function(calEvent, element, dayFreeBusyManager, calendar) {
+ eventNew : function(calEvent, element, dayFreeBusyManager, calendar, mouseupEvent) {
},
eventMouseover : function(calEvent, $event) {
},
@@ -234,7 +234,8 @@
* returns formatted header for day display
* @param {function(date,calendar)}
*/
- getHeaderDate: null
+ getHeaderDate: null,
+ preventDragOnEventCreation: false
},
/***********************
@@ -979,29 +980,31 @@
$newEvent.css({lineHeight: (options.timeslotHeight - 2) + "px", fontSize: (options.timeslotHeight / 2) + "px"});
$target.append($newEvent);
-
+
var columnOffset = $target.offset().top;
var clickY = event.pageY - columnOffset;
var clickYRounded = (clickY - (clickY % options.timeslotHeight)) / options.timeslotHeight;
var topPosition = clickYRounded * options.timeslotHeight;
$newEvent.css({top: topPosition});
- $target.bind("mousemove.newevent", function(event) {
- $newEvent.show();
- $newEvent.addClass("ui-resizable-resizing");
- var height = Math.round(event.pageY - columnOffset - topPosition);
- var remainder = height % options.timeslotHeight;
- //snap to closest timeslot
- if (remainder < (height / 2)) {
- var useHeight = height - remainder;
- $newEvent.css("height", useHeight < options.timeslotHeight ? options.timeslotHeight : useHeight);
- } else {
- $newEvent.css("height", height + (options.timeslotHeight - remainder));
- }
- }).mouseup(function() {
- $target.unbind("mousemove.newevent");
- $newEvent.addClass("ui-corner-all");
- });
+ if(!options.preventDragOnEventCreation){
+ $target.bind("mousemove.newevent", function(event) {
+ $newEvent.show();
+ $newEvent.addClass("ui-resizable-resizing");
+ var height = Math.round(event.pageY - columnOffset - topPosition);
+ var remainder = height % options.timeslotHeight;
+ //snap to closest timeslot
+ if (remainder < (height / 2)) {
+ var useHeight = height - remainder;
+ $newEvent.css("height", useHeight < options.timeslotHeight ? options.timeslotHeight : useHeight);
+ } else {
+ $newEvent.css("height", height + (options.timeslotHeight - remainder));
+ }
+ }).mouseup(function() {
+ $target.unbind("mousemove.newevent");
+ $newEvent.addClass("ui-corner-all");
+ });
+ }
}
}).mouseup(function(event) {