PageSourceSearch

https://www.rfgenealogie.com/sites/all/modules/colorbox/js/colorbox.js?thyms2

js rfgenealogie.com collected 2026-09-24 09:43:03 UTC 2,555 bytes, 98 lines download raw bytes

1/**
2 * @file
3 * Colorbox module init js.
4 */
5
6(function ($) {
7
8Drupal.behaviors.initColorbox = {
9  attach: function (context, settings) {
10    if (!$.isFunction($('a, area, input', context).colorbox) || typeof settings.colorbox === 'undefined') {
11      return;
12    }
13
14    if (settings.colorbox.mobiledetect && window.matchMedia) {
15      // Disable Colorbox for small screens.
16      var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
17      if (mq.matches) {
18        return;
19      }
20    }
21
22    // Use "data-colorbox-gallery" if set otherwise use "rel".
23    settings.colorbox.rel = function () {
24      if ($(this).data('colorbox-gallery')) {
25        return $(this).data('colorbox-gallery');
26      }
27      else {
28        return $(this).attr('rel');
29      }
30    };
31
32    $('.colorbox', context)
33      .once('init-colorbox').each(function(){
34        // Only images are supported for the "colorbox" class.
35        // The "photo" setting forces the href attribute to be treated as an image.
36        var extendParams = {
37          photo: true
38        };
39        // If a title attribute is supplied, sanitize it.
40        var title = $(this).attr('title');
41        if (title) {
42          extendParams.title = Drupal.colorbox.sanitizeMarkup(title);
43        }
44        $(this).colorbox($.extend({}, settings.colorbox, extendParams));
45      });
46
47    $(context).bind('cbox_complete', function () {
48      Drupal.attachBehaviors('#cboxLoadedContent');
49    });
50  }
51};
52
53// Create colorbox namespace if it doesn't exist.
54if (!Drupal.hasOwnProperty('colorbox')) {
55  Drupal.colorbox = {};
56}
57
58/**
59 * Global function to allow sanitizing captions and control strings.
60 *
61 * @param markup
62 *   String containing potential markup.
63 * @return @string
64 *  Sanitized string with potentially dangerous markup removed.
65 */
66Drupal.colorbox.sanitizeMarkup = function(markup) {
67  // If DOMPurify installed, allow some HTML. Otherwise, treat as plain text.
68  if (typeof DOMPurify !== 'undefined') {
69    var purifyConfig = {
70      ALLOWED_TAGS: [
71        'a',
72        'b',
73        'strong',
74        'i',
75        'em',
76        'u',
77        'cite',
78        'code',
79        'br'
80      ],
81      ALLOWED_ATTR: [
82        'href',
83        'hreflang',
84        'title',
85        'target'
86      ]
87    }
88    if (Drupal.settings.hasOwnProperty('dompurify_custom_config')) {
89      purifyConfig = Drupal.settings.dompurify_custom_config;
90    }
91    return DOMPurify.sanitize(markup, purifyConfig);
92  }
93  else {
94    return Drupal.checkPlain(markup);
95  }
96}
97
98})(jQuery);

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.