PageSourceSearch

https://derivative.ca/sites/default/files/advagg_js/js__0QglKWmvPr…pF0XZBfK20DpQR-usK1PKLzYFEHTRU3F7doNzOxY.js

js derivative.ca collected 2026-09-24 08:47:06 UTC 2,994 bytes, 89 lines download raw bytes

1(function ($) {
2
3/**
4 * Toggle the visibility of a fieldset using smooth animations.
5 */
6Drupal.toggleFieldset = function (fieldset) {
7  var $toggle = $($(fieldset).find('[data-toggle=collapse]').data('target'));
8  if ($toggle.length) {
9    $toggle.collapse('toggle');
10  }
11};
12
13/**
14 * Scroll a given fieldset into view as much as possible.
15 */
16Drupal.collapseScrollIntoView = function (node) {
17  var h = document.documentElement.clientHeight || document.body.clientHeight || 0;
18  var offset = document.documentElement.scrollTop || document.body.scrollTop || 0;
19  var posY = $(node).offset().top;
20  var fudge = 55;
21  if (posY + node.offsetHeight + fudge > h + offset) {
22    if (node.offsetHeight > h) {
23      window.scrollTo(0, posY);
24    }
25    else {
26      window.scrollTo(0, posY + node.offsetHeight - h + fudge);
27    }
28  }
29};
30
31Drupal.behaviors.collapse = {
32  attach: function (context, settings) {
33    $('fieldset.collapsible', context).once('collapse', function () {
34      var $fieldset = $(this);
35      var $body = $fieldset.find('> .panel-collapse');
36      // Expand fieldset if there are errors inside, or if it contains an
37      // element that is targeted by the URI fragment identifier.
38      var anchor = location.hash && location.hash != '#' ? ', ' + location.hash : '';
39      if ($fieldset.find('.error' + anchor).length) {
40        $fieldset.removeClass('collapsed');
41        $body.removeClass('collapsed');
42      }
43
44      var summary = $('<span class="summary"></span>');
45      $fieldset.
46        bind('summaryUpdated', function () {
47          var text = $.trim($fieldset.drupalGetSummary());
48          summary.html(text ? ' (' + text + ')' : '');
49        })
50        .trigger('summaryUpdated');
51
52      // Turn the legend into a clickable link, but retain span.fieldset-legend
53      // for CSS positioning.
54      var $legend = $('> legend .fieldset-legend', this);
55
56      $('<span class="fieldset-legend-prefix element-invisible"></span>')
57        .append($fieldset.hasClass('collapsed') ? Drupal.t('Show') : Drupal.t('Hide'))
58        .prependTo($legend);
59
60      // Bind Bootstrap events with Drupal core events.
61      $fieldset
62        .append(summary)
63        .on('show.bs.collapse', function () {
64          $fieldset
65            .removeClass('collapsed')
66            .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Hide'));
67          $body.removeClass('collapsed');
68        })
69        .on('shown.bs.collapse', function () {
70          $fieldset.trigger({ type: 'collapsed', value: false });
71          Drupal.collapseScrollIntoView($fieldset.get(0));
72        })
73        .on('hide.bs.collapse', function () {
74          $fieldset
75            .addClass('collapsed')
76            .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Show'));
77          $body.addClass('collapsed');
78        })
79        .on('hidden.bs.collapse', function () {
80          $fieldset.trigger({ type: 'collapsed', value: true });
81        });
82    });
83  }
84};
85
86})(jQuery);
87
88;/*})'"*/
89;/*})'"*/

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.