PageSourceSearch

https://cbirt.org/sites/cbirt.org/files/js/js_3Qav7gpzfzQbTCjc3C2EtYMiigokf3uPRMpZkzdDVeM.js

js cbirt.org collected 2026-09-24 09:23:12 UTC 3,257 bytes, 82 lines download raw bytes

1/**
2 * @file
3 * CKEditor Accordion functionality.
4 */
5
6(function ($) {
7  'use strict';
8  Drupal.behaviors.ckeditorAccordion = {
9    attach: function (context, settings) {
10
11      // Create accordion functionality if the required elements exist is available.
12      var $ckeditorAccordion = $('.ckeditor-accordion');
13      if ($ckeditorAccordion.length > 0) {
14        // Create simple accordion mechanism for each tab.
15        $ckeditorAccordion.each(function () {
16          var $accordion = $(this);
17          if ($accordion.hasClass('styled')) {
18            return;
19          }
20
21          // The first one is the correct one.
22          if (typeof Drupal.settings.ckeditor_accordion == 'undefined' ||
23             (typeof Drupal.settings.ckeditor_accordion != 'undefined' && Drupal.settings.ckeditor_accordion.collapseAll != 1)) {
24            $accordion.children('dt:first').addClass('active');
25            $accordion.children('dd:first').addClass('active');
26            $accordion.children('dd:first').css('display', 'block');
27          }
28
29          // Turn the accordion tabs to links so that the content is accessible & can be traversed using keyboard.
30          $accordion.children('dt').each(function () {
31            var $tab = $(this);
32            var tabText = $tab.text().trim();
33            var toggleClass = $tab.hasClass('active') ? ' active' : '';
34            $tab.html('<span class="ckeditor-accordion-toggle' + toggleClass + '"></span><a class="ckeditor-accordion-toggler" href="#">' + tabText + '</a>');
35          });
36
37          // Wrap the accordion in a div element so that quick edit function shows the source correctly.
38          $accordion.addClass('styled').removeClass('ckeditor-accordion').wrap('<div class="ckeditor-accordion-container"></div>');
39
40          // Fire an event so other modules know when the accordion has been created.
41          $accordion.trigger('ckeditorAccordionAttached');
42        });
43
44        // Add click event to body once because quick edits & ajax calls might reset the HTML.
45        $('body').once('ckeditorAccordionToggleEvent').on('click', '.ckeditor-accordion-toggler', function (e) {
46          var $t = $(this).parent();
47          var $parent = $t.parent();
48
49          // Clicking on open element, close it.
50          if ($t.hasClass('active')) {
51            $t.removeClass('active');
52            $t.next().slideUp(0);
53          }
54          else {
55            // Remove active classes.
56            $parent.children('dt.active').removeClass('active').children('a').removeClass('active');
57            $parent.children('dd.active').slideUp(0,function () {
58              $(this).removeClass('active');
59            });
60
61            // Show the selected tab.
62            $t.addClass('active');
63
64            $t.next().slideDown(0).addClass('active');
65
66            var scrolltoptarget = $(this);
67            //setTimeout(function(){
68              $('html, body').scrollTop(scrolltoptarget.offset().top - 100);
69//              $('body').scrollTop(scrolltop);
70              console.log(scrolltoptarget.offset().top);
71              console.log('test');
72            //},100,scrolltoptarget);
73          }
74
75          // Don't add hash to url.
76          e.preventDefault();
77        });
78      }
79    }
80  };
81})(jQuery);
82;

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.