PageSourceSearch

https://engagetheteam.com/sites/engagetheteam.com/files/js/js_CCMdLWpOaAMVdRru7iPkDn2z5xjzbNGTkOjmGB0Vssw.js

js engagetheteam.com collected 2026-09-29 05:10:21 UTC 9,938 bytes, 270 lines download raw bytes

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

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.