PageSourceSearch

https://www.quebec-cite.com/modules/custom/otq_ckeditor_rm/js/readmore.js?v=1.x

js quebec-cite.com collected 2026-10-02 04:05:08 UTC 1,831 bytes, 55 lines download raw bytes

1/**
2 * @file
3 * CKEditor Read more functionality.
4 */
5
6(function($, Drupal, once) {
7  'use strict';
8  Drupal.behaviors.ckeditorReadmore = {
9    attach: function(context, settings) {
10      const ckeditorReadmore = once('ckeditor-readmore', '.ckeditor-readmore', context);
11
12      if (ckeditorReadmore.length) {
13        $(ckeditorReadmore)
14          .wrap('<div class="ckeditor-readmore-wrapper"></div>')
15          .parent()
16          .prepend('<button class="btn btn-secondary btn-color-rhino ckeditor-readmore-btn">' + Drupal.t('btn-read-more') + '</button>');
17
18        $(document).ready(function() {
19          $(ckeditorReadmore).html(function(i, html) {
20            return html.replace(/&nbsp;/, '');
21          });
22
23          $(ckeditorReadmore).each(function() {
24            let $this = $(this);
25
26            if ($this.text() === '') {
27              $this.parent().find('.ckeditor-readmore-btn').hide();
28            } else {
29              $this.append('<button class="btn btn-secondary btn-color-rhino readless">' + Drupal.t('btn-read-less') + '</button>');
30            }
31          });
32        });
33
34        once('ckeditorReadmoreToggleEvent', 'body', context).forEach(function(element) {
35          $(element).on('click', '.ckeditor-readmore-btn', function(ev) {
36            let $this = $(this);
37            let $container = $this.next();
38
39            $container.slideToggle();
40            $container.find('.readless').removeClass('is-hidden');
41            $this.addClass('is-hidden');
42          });
43        });
44
45        $(context).on('click', '.readless', function(ev) {
46          let $this = $(this);
47
48          $this.parents('div:eq(0)').slideUp();
49          $this.parent().prev('.ckeditor-readmore-btn').removeClass('is-hidden');
50          $this.addClass('is-hidden');
51        });
52      }
53    }
54  };
55})(jQuery, Drupal, once);

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.