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.checkPlain(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})(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.