| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 // $Id: calendar_overlap.js,v 1.1.2.1 2010/11/28 23:31:28 karens Exp $ 2 /* 3 * Create the splitter, set the viewport size, and set the position of the scrollbar to the first item. 4 */ 5 Drupal.behaviors.calendarSetScroll = function (context) { 6 7 // Make multi-day resizable - stolen/borrowed from textarea.js 8 $('.header-body-divider:not(.header-body-divider-processed)').each(function() { 9 var divider = $(this).addClass('header-body-divider-processed'); 10 var start_y = divider.offset().top; 11 12 // Add the grippie icon 13 $(this).prepend('<div class="grippie"></div>').mousedown(startDrag); 14 15 function startDrag(e) { 16 start_y = divider.offset().top; 17 $(document).mousemove(performDrag).mouseup(endDrag); 18 return false; 19 } 20 21 function performDrag(e) { 22 var offset = e.pageY - start_y; 23 var mwc = $('#multi-day-container'); 24 var sdc = $('#single-day-container'); 25 var mwc_height = mwc.height(); 26 var sdc_height = sdc.height(); 27 var max_height = mwc_height + sdc_height; 28 mwc.height(Math.min(max_height,Math.max(0,mwc_height + offset))); 29 sdc.height(Math.min(max_height,Math.max(0,sdc_height - offset))); 30 start_y = divider.offset().top; 31 return false; 32 } 33 34 function endDrag(e) { 35 $(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag); 36 } 37 }); 38 39 $('.single-day-footer:not(.single-day-footer-processed)').each(function() { 40 var divider = $(this).addClass('single-day-footer-processed'); 41 var start_y = divider.offset().top; 42 43 // Add the grippie icon 44 $(this).prepend('<div class="grippie"></div>').mousedown(startDrag); 45 46 function startDrag(e) { 47 start_y = divider.offset().top; 48 $(document).mousemove(performDrag).mouseup(endDrag); 49 return false; 50 } 51 52 function performDrag(e) { 53 var offset = e.pageY - start_y; 54 var sdc = $('#single-day-container'); 55 sdc.height(Math.max(0,sdc.height() + offset)); 56 start_y = divider.offset().top; 57 return false; 58 } 59 60 function endDrag(e) { 61 $(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag); 62 } 63 }); 64 65 // Size the window 66 calendar_resizeViewport(); 67 } 68 69 // Scroll the viewport to the first item 70 function calendar_scrollToFirst() { 71 if ($('div.first_item').size() > 0 ) { 72 var y = $('div.first_item').offset().top - $('#single-day-container').offset().top ; 73 $('#single-day-container').scrollTop(y); 74 } 75 } 76 77 // Size the single day view 78 function calendar_resizeViewport() { 79 80 // Size of the browser window 81 var viewportHeight = window.innerHeight ? window.innerHeight : $(window).height(); 82 var top = $('#single-day-container').offset().top; 83 84 // Give it a 20 pixel margin at the bottom 85 $('#single-day-container').height(viewportHeight - top - 20); 86 } 87
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |