1(function ($) { 2 3/** 4 * Override Drupal's AJAX prototype beforeSend function so it can append the 5 * throbber inside the pager links. 6 */ 7Drupal.ajax.prototype.beforeSend = function (xmlhttprequest, options) { 8 // For forms without file inputs, the jQuery Form plugin serializes the form 9 // values, and then calls jQuery's $.ajax() function, which invokes this 10 // handler. In this circumstance, options.extraData is never used. For forms 11 // with file inputs, the jQuery Form plugin uses the browser's normal form 12 // submission mechanism, but captures the response in a hidden IFRAME. In this 13 // circumstance, it calls this handler first, and then appends hidden fields 14 // to the form to submit the values in options.extraData. There is no simple 15 // way to know which submission mechanism will be used, so we add to extraData 16 // regardless, and allow it to be ignored in the former case. 17 if (this.form) { 18 options.extraData = options.extraData || {}; 19 20 // Let the server know when the IFRAME submission mechanism is used. The 21 // server can use this information to wrap the JSON response in a TEXTAREA, 22 // as per http://jquery.malsup.com/form/#file-upload. 23 options.extraData.ajax_iframe_upload = '1'; 24 25 // The triggering element is about to be disabled (see below), but if it 26 // contains a value (e.g., a checkbox, textfield, select, etc.), ensure that 27 // value is included in the submission. As per above, submissions that use 28 // $.ajax() are already serialized prior to the element being disabled, so 29 // this is only needed for IFRAME submissions. 30 var v = $.fieldValue(this.element); 31 if (v !== null) { 32 options.extraData[this.element.name] = v; 33 } 34 } 35 36 var $element = $(this.element); 37 38 // Disable the element that received the change to prevent user interface 39 // interaction while the Ajax request is in progress. ajax.ajaxing prevents 40 // the element from triggering a new request, but does not prevent the user 41 // from changing its value. 42 $element.addClass('progress-disabled').attr('disabled', true); 43 44 // Insert progressbar or throbber. 45 if (this.progress.type == 'bar') { 46 var progressBar = new Drupal.progressBar('ajax-progress-' + this.element.id, eval(this.progress.update_callback), this.progress.method, eval(this.progress.error_callback)); 47 if (this.progress.message) { 48 progressBar.setProgress(-1, this.progress.message); 49 } 50 if (this.progress.url) { 51 progressBar.startMonitoring(this.progress.url, this.progress.interval || 500); 52 } 53 this.progress.element = $(progressBar.element).addClass('ajax-progress ajax-progress-bar'); 54 this.progress.object = progressBar; 55 if (!$element.closest('.file-widget,.form-item').length) { 56 $element.before(this.progress.element); 57 } 58 else { 59 $element.closest('.file-widget,.form-item').after(this.progress.element); 60 } 61 } 62 else if (this.progress.type == 'throbber') { 63 this.progress.element = $('<div class="ajax-progress ajax-progress-throbber"><i class="glyphicon glyphicon-refresh glyphicon-spin"></i></div>'); 64 if (this.progress.message) { 65 $('.throbber', this.progress.element).after('<div class="message">' + this.progress.message + '</div>'); 66 } 67 68 // If element is an input type, append after. 69 if ($element.is('input')) { 70 $element.after(this.progress.element); 71 } 72 else if ($element.is('select')) { 73 var $inputGroup = $element.closest('.form-item').find('.input-group-addon, .input-group-btn'); 74 if (!$inputGroup.length) { 75 $element.wrap('<div class="input-group">'); 76 $inputGroup = $('<span class="input-group-addon">'); 77 $element.after($inputGroup); 78 } 79 $inputGroup.append(this.progress.element); 80 } 81 // Otherwise append the throbber inside the element. 82 else { 83 $element.append(this.progress.element); 84 } 85 } 86}; 87 88})(jQuery); 89; 90/** 91 * @file 92 * 93 * Overrides for ctools modal. 94 * 95 */ 96 97(function ($) { 98 /** 99 * Override CTools modal show function so it can recognize the Bootstrap modal classes correctly 100 */ 101 Drupal.CTools.Modal.show = function(choice) { 102 var opts = {}; 103 104 if (choice && typeof choice === 'string' && Drupal.settings[choice]) { 105 // This notation guarantees we are actually copying it. 106 $.extend(true, opts, Drupal.settings[choice]); 107 } 108 else if (choice) { 109 $.extend(true, opts, choice); 110 } 111 112 var defaults = { 113 modalTheme: 'CToolsModalDialog', 114 throbberTheme: 'CToolsModalThrobber', 115 animation: 'show', 116 animationSpeed: 'fast', 117 modalSize: { 118 type: 'scale', 119 width: 0.8, 120 height: 0.8, 121 addWidth: 0, 122 addHeight: 0, 123 // How much to remove from the inner content to make space for the 124 // theming. 125 contentRight: 25, 126 contentBottom: 45 127 }, 128 modalOptions: { 129 opacity: 0.55, 130 background: '#fff' 131 }, 132 modalClass: 'default' 133 }; 134 135 var settings = {}; 136 $.extend(true, settings, defaults, Drupal.settings.CToolsModal, opts); 137 138 if (Drupal.CTools.Modal.currentSettings && Drupal.CTools.Modal.currentSettings !== settings) { 139 Drupal.CTools.Modal.modal.remove(); 140 Drupal.CTools.Modal.modal = null; 141 } 142 143 Drupal.CTools.Modal.currentSettings = settings; 144 145 var resize = function(e) { 146 // When creating the modal, it actually exists only in a theoretical 147 // place that is not in the DOM. But once the modal exists, it is in the 148 // DOM so the context must be set appropriately. 149 var context = e ? document : Drupal.CTools.Modal.modal; 150 var width = 0; 151 var height = 0; 152 153 // Handle fixed navbars. Grab the body top offset in pixels. 154 var topOffset = parseInt($('body').css("padding-top"), 10); 155 156 if (Drupal.CTools.Modal.currentSettings.modalSize.type === 'scale') { 157 width = $(window).width() * Drupal.CTools.Modal.currentSettings.modalSize.width; 158 height = ($(window).height() - topOffset) * Drupal.CTools.Modal.currentSettings.modalSize.height; 159 } 160 else { 161 width = Drupal.CTools.Modal.currentSettings.modalSize.width; 162 height = Drupal.CTools.Modal.currentSettings.modalSize.height; 163 } 164 165 // Add padding for the offset. 166 $('#modalContent').css('padding-top', topOffset + 'px'); 167 168 // Use the additionol pixels for creating the width and height. 169 $('div.ctools-modal-dialog', context).css({ 170 'width': width + Drupal.CTools.Modal.currentSettings.modalSize.addWidth + 'px', 171 'height': height + Drupal.CTools.Modal.currentSettings.modalSize.addHeight + 'px' 172 }); 173
174 $('div.ctools-modal-dialog .modal-body', context).css({ 175 'width': (width - Drupal.CTools.Modal.currentSettings.modalSize.contentRight) + 'px', 176 'max-height': (height - Drupal.CTools.Modal.currentSettings.modalSize.contentBottom) + 'px' 177 }); 178 }; 179 180 if (!Drupal.CTools.Modal.modal) { 181 Drupal.CTools.Modal.modal = $(Drupal.theme(settings.modalTheme)); 182 if (settings.modalSize.type === 'scale') { 183 $(window).bind('resize', resize); 184 } 185 } 186 187 $('body').addClass('modal-open'); 188 189 resize(); 190 191 $('.modal-title', Drupal.CTools.Modal.modal).html(Drupal.CTools.Modal.currentSettings.loadingText); 192 Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed, settings.modalClass); 193 $('#modalContent .modal-body').html(Drupal.theme(settings.throbberTheme)).addClass('ctools-modal-loading'); 194 }; 195 196 /** 197 * Remove modal class from body when closing modal. 198 */ 199 $(document).on('CToolsDetachBehaviors', function() { 200 $('body').removeClass('modal-open'); 201 }); 202 203 /** 204 * Provide the HTML to create the modal dialog in the Bootstrap style. 205 */ 206 Drupal.theme.prototype.CToolsModalDialog = function () { 207 var html = ''; 208 html += '<div id="ctools-modal">'; 209 html += ' <div class="ctools-modal-dialog modal-dialog">'; 210 html += ' <div class="modal-content">'; 211 html += ' <div class="modal-header">'; 212 html += ' <button type="button" class="close ctools-close-modal" aria-hidden="true">×</button>'; 213 html += ' <h4 id="modal-title" class="modal-title"> </h4>'; 214 html += ' </div>'; 215 html += ' <div id="modal-content" class="modal-body">'; 216 html += ' </div>'; 217 html += ' </div>'; 218 html += ' </div>'; 219 html += '</div>'; 220 221 return html; 222 }; 223 224 /** 225 * Provide the HTML to create a nice looking loading progress bar. 226 */ 227 Drupal.theme.prototype.CToolsModalThrobber = function () { 228 var html = ''; 229 html += '<div class="loading-spinner" style="width: 200px; margin: -20px 0 0 -100px; position: absolute; top: 45%; left: 50%">'; 230 html += ' <div class="progress progress-striped active">'; 231 html += ' <div class="progress-bar" style="width: 100%;"></div>'; 232 html += ' </div>'; 233 html += '</div>'; 234 235 return html; 236 }; 237 238 239})(jQuery); 240;
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.