PageSourceSearch

https://www.auxologico.com/core/misc/collapse.js?v=8.9.20

js auxologico.com collected 2026-10-01 15:50:51 UTC 2,891 bytes, 87 lines download raw bytes

1/**
2* DO NOT EDIT THIS FILE.
3* See the following change record for more information,
4* https://www.drupal.org/node/2815083
5* @preserve
6**/
7
8(function ($, Modernizr, Drupal) {
9  function CollapsibleDetails(node) {
10    this.$node = $(node);
11    this.$node.data('details', this);
12
13    var anchor = window.location.hash && window.location.hash !== '#' ? ', ' + window.location.hash : '';
14    if (this.$node.find('.error' + anchor).length) {
15      this.$node.attr('open', true);
16    }
17
18    this.setupSummary();
19
20    this.setupLegend();
21  }
22
23  $.extend(CollapsibleDetails, {
24    instances: []
25  });
26
27  $.extend(CollapsibleDetails.prototype, {
28    setupSummary: function setupSummary() {
29      this.$summary = $('<span class="summary"></span>');
30      this.$node.on('summaryUpdated', $.proxy(this.onSummaryUpdated, this)).trigger('summaryUpdated');
31    },
32    setupLegend: function setupLegend() {
33      var $legend = this.$node.find('> summary');
34
35      $('<span class="details-summary-prefix visually-hidden"></span>').append(this.$node.attr('open') ? Drupal.t('Hide') : Drupal.t('Show')).prependTo($legend).after(document.createTextNode(' '));
36
37      $('<a class="details-title"></a>').attr('href', '#' + this.$node.attr('id')).prepend($legend.contents()).appendTo($legend);
38
39      $legend.append(this.$summary).on('click', $.proxy(this.onLegendClick, this));
40    },
41    onLegendClick: function onLegendClick(e) {
42      this.toggle();
43      e.preventDefault();
44    },
45    onSummaryUpdated: function onSummaryUpdated() {
46      var text = $.trim(this.$node.drupalGetSummary());
47      this.$summary.html(text ? ' (' + text + ')' : '');
48    },
49    toggle: function toggle() {
50      var _this = this;
51
52      var isOpen = !!this.$node.attr('open');
53      var $summaryPrefix = this.$node.find('> summary span.details-summary-prefix');
54      if (isOpen) {
55        $summaryPrefix.html(Drupal.t('Show'));
56      } else {
57        $summaryPrefix.html(Drupal.t('Hide'));
58      }
59
60      setTimeout(function () {
61        _this.$node.attr('open', !isOpen);
62      }, 0);
63    }
64  });
65
66  Drupal.behaviors.collapse = {
67    attach: function attach(context) {
68      if (Modernizr.details) {
69        return;
70      }
71      var $collapsibleDetails = $(context).find('details').once('collapse').addClass('collapse-processed');
72      if ($collapsibleDetails.length) {
73        for (var i = 0; i < $collapsibleDetails.length; i++) {
74          CollapsibleDetails.instances.push(new CollapsibleDetails($collapsibleDetails[i]));
75        }
76      }
77    }
78  };
79
80  var handleFragmentLinkClickOrHashChange = function handleFragmentLinkClickOrHashChange(e, $target) {
81    $target.parents('details').not('[open]').find('> summary').trigger('click');
82  };
83
84  $('body').on('formFragmentLinkClickOrHashChange.details', handleFragmentLinkClickOrHashChange);
85
86  Drupal.CollapsibleDetails = CollapsibleDetails;
87})(jQuery, Modernizr, Drupal);

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.