1jQuery.extend({ 2 getUrlParams: function(){ 3 var vars = [], hash; 4 var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 5 for(var i = 0; i < hashes.length; i++) 6 { 7 hash = hashes[i].split('='); 8 vars.push(hash[0]); 9 vars[hash[0]] = hash[1]; 10 } 11 return vars; 12 }, 13 getUrlParam: function(name){ 14 return $.getUrlVars()[name]; 15 } 16});; 17(function ($) { 18 19Drupal.behaviors.textarea = { 20 attach: function (context, settings) { 21 $('.form-textarea-wrapper.resizable', context).once('textarea', function () { 22 var staticOffset = null; 23 var textarea = $(this).addClass('resizable-textarea').find('textarea'); 24 var grippie = $('<div class="grippie"></div>').mousedown(startDrag); 25 26 grippie.insertAfter(textarea); 27 28 function startDrag(e) { 29 staticOffset = textarea.height() - e.pageY; 30 textarea.css('opacity', 0.25); 31 $(document).mousemove(performDrag).mouseup(endDrag); 32 return false; 33 } 34 35 function performDrag(e) { 36 textarea.height(Math.max(32, staticOffset + e.pageY) + 'px'); 37 return false; 38 } 39 40 function endDrag(e) { 41 $(document).unbind('mousemove', performDrag).unbind('mouseup', endDrag); 42 textarea.css('opacity', 1); 43 } 44 }); 45 } 46}; 47 48})(jQuery); 49; 50(function ($) { 51 52/** 53 * Toggle the visibility of a fieldset using smooth animations. 54 */ 55Drupal.toggleFieldset = function (fieldset) { 56 var $fieldset = $(fieldset); 57 if ($fieldset.is('.collapsed')) { 58 var $content = $('> .fieldset-wrapper', fieldset).hide(); 59 $fieldset 60 .removeClass('collapsed') 61 .trigger({ type: 'collapsed', value: false }) 62 .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Hide')); 63 $content.slideDown({ 64 duration: 'fast', 65 easing: 'linear', 66 complete: function () { 67 Drupal.collapseScrollIntoView(fieldset); 68 fieldset.animating = false; 69 }, 70 step: function () { 71 // Scroll the fieldset into view. 72 Drupal.collapseScrollIntoView(fieldset); 73 } 74 }); 75 } 76 else { 77 $fieldset.trigger({ type: 'collapsed', value: true }); 78 $('> .fieldset-wrapper', fieldset).slideUp('fast', function () { 79 $fieldset 80 .addClass('collapsed') 81 .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Show')); 82 fieldset.animating = false; 83 }); 84 } 85}; 86 87/** 88 * Scroll a given fieldset into view as much as possible. 89 */ 90Drupal.collapseScrollIntoView = function (node) { 91 var h = document.documentElement.clientHeight || document.body.clientHeight || 0; 92 var offset = document.documentElement.scrollTop || document.body.scrollTop || 0; 93 var posY = $(node).offset().top; 94 var fudge = 55; 95 if (posY + node.offsetHeight + fudge > h + offset) { 96 if (node.offsetHeight > h) { 97 window.scrollTo(0, posY); 98 } 99 else { 100 window.scrollTo(0, posY + node.offsetHeight - h + fudge); 101 } 102 } 103}; 104 105Drupal.behaviors.collapse = { 106 attach: function (context, settings) { 107 $('fieldset.collapsible', context).once('collapse', function () { 108 var $fieldset = $(this); 109 // Expand fieldset if there are errors inside, or if it contains an 110 // element that is targeted by the URI fragment identifier. 111 var anchor = location.hash && location.hash != '#' ? ', ' + location.hash : ''; 112 if ($fieldset.find('.error' + anchor).length) { 113 $fieldset.removeClass('collapsed'); 114 } 115 116 var summary = $('<span class="summary"></span>'); 117 $fieldset. 118 bind('summaryUpdated', function () { 119 var text = $.trim($fieldset.drupalGetSummary()); 120 summary.html(text ? ' (' + text + ')' : ''); 121 }) 122 .trigger('summaryUpdated'); 123 124 // Turn the legend into a clickable link, but retain span.fieldset-legend 125 // for CSS positioning. 126 var $legend = $('> legend .fieldset-legend', this); 127 128 $('<span class="fieldset-legend-prefix element-invisible"></span>') 129 .append($fieldset.hasClass('collapsed') ? Drupal.t('Show') : Drupal.t('Hide')) 130 .prependTo($legend) 131 .after(' '); 132 133 // .wrapInner() does not retain bound events. 134 var $link = $('<a class="fieldset-title" href="#"></a>') 135 .prepend($legend.contents()) 136 .appendTo($legend) 137 .click(function () { 138 var fieldset = $fieldset.get(0); 139 // Don't animate multiple times. 140 if (!fieldset.animating) { 141 fieldset.animating = true; 142 Drupal.toggleFieldset(fieldset); 143 } 144 return false;
145 }); 146 147 $legend.append(summary); 148 }); 149 } 150}; 151 152})(jQuery); 153;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.