first import
This commit is contained in:
27
sites/all/modules/calendar/js/calendar_colorpicker.js
Normal file
27
sites/all/modules/calendar/js/calendar_colorpicker.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Implementation of hook_elements.
|
||||
*
|
||||
* Much of the colorpicker code was adapted from the Colorpicker module.
|
||||
* That module has no stable release yet nor any D6 branch.
|
||||
*/
|
||||
/*
|
||||
* Bind the colorpicker event to the form element
|
||||
*/
|
||||
(function ($) {
|
||||
Drupal.behaviors.field_example_colorpicker = {
|
||||
attach: function(context) {
|
||||
$(".edit-calendar-colorpicker").live("focus", function(event) {
|
||||
var edit_field = this;
|
||||
var picker = $(this).closest('div').parent().find(".calendar-colorpicker");
|
||||
|
||||
// Hide all color pickers except this one.
|
||||
$(".calendar-colorpicker").hide();
|
||||
$(picker).show();
|
||||
$.farbtastic(picker, function(color) {
|
||||
edit_field.value = color;
|
||||
}).setColor(edit_field.value);
|
||||
});
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
|
87
sites/all/modules/calendar/js/calendar_overlap.js
Normal file
87
sites/all/modules/calendar/js/calendar_overlap.js
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Create the splitter, set the viewport size, and set the position of the scrollbar to the first item.
|
||||
*/
|
||||
(function($){
|
||||
Drupal.behaviors.calendarSetScroll = {
|
||||
attach: function(context) {
|
||||
// Make multi-day resizable - stolen/borrowed from textarea.js
|
||||
$('.header-body-divider:not(.header-body-divider-processed)').each(function() {
|
||||
var divider = $(this).addClass('header-body-divider-processed');
|
||||
var start_y = divider.offset().top;
|
||||
|
||||
// Add the grippie icon
|
||||
$(this).prepend('<div class="grippie"></div>').mousedown(startDrag);
|
||||
|
||||
function startDrag(e) {
|
||||
start_y = divider.offset().top;
|
||||
$(document).mousemove(performDrag).mouseup(endDrag);
|
||||
return false;
|
||||
}
|
||||
|
||||
function performDrag(e) {
|
||||
var offset = e.pageY - start_y;
|
||||
var mwc = $('#multi-day-container');
|
||||
var sdc = $('#single-day-container');
|
||||
var mwc_height = mwc.height();
|
||||
var sdc_height = sdc.height();
|
||||
var max_height = mwc_height + sdc_height;
|
||||
mwc.height(Math.min(max_height,Math.max(0,mwc_height + offset)));
|
||||
sdc.height(Math.min(max_height,Math.max(0,sdc_height - offset)));
|
||||
start_y = divider.offset().top;
|
||||
return false;
|
||||
}
|
||||
|
||||
function endDrag(e) {
|
||||
$(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag);
|
||||
}
|
||||
});
|
||||
|
||||
$('.single-day-footer:not(.single-day-footer-processed)').each(function() {
|
||||
var divider = $(this).addClass('single-day-footer-processed');
|
||||
var start_y = divider.offset().top;
|
||||
|
||||
// Add the grippie icon
|
||||
$(this).prepend('<div class="grippie"></div>').mousedown(startDrag);
|
||||
|
||||
function startDrag(e) {
|
||||
start_y = divider.offset().top;
|
||||
$(document).mousemove(performDrag).mouseup(endDrag);
|
||||
return false;
|
||||
}
|
||||
|
||||
function performDrag(e) {
|
||||
var offset = e.pageY - start_y;
|
||||
var sdc = $('#single-day-container');
|
||||
sdc.height(Math.max(0,sdc.height() + offset));
|
||||
start_y = divider.offset().top;
|
||||
return false;
|
||||
}
|
||||
|
||||
function endDrag(e) {
|
||||
$(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag);
|
||||
}
|
||||
});
|
||||
|
||||
// Size the window
|
||||
calendar_resizeViewport($);
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
// Scroll the viewport to the first item
|
||||
function calendar_scrollToFirst($) {
|
||||
if ($('div.first_item').size() > 0 ) {
|
||||
var y = $('div.first_item').offset().top - $('#single-day-container').offset().top ;
|
||||
$('#single-day-container').scrollTop(y);
|
||||
}
|
||||
}
|
||||
|
||||
// Size the single day view
|
||||
function calendar_resizeViewport($) {
|
||||
// Size of the browser window
|
||||
var viewportHeight = window.innerHeight ? window.innerHeight : $(window).height();
|
||||
var top = $('#single-day-container').offset().top;
|
||||
|
||||
// Give it a 20 pixel margin at the bottom
|
||||
$('#single-day-container').height(viewportHeight - top - 20);
|
||||
}
|
Reference in New Issue
Block a user