1/** 2 * @file 3 * Colorbox module load js. 4 */ 5(function ($) { 6 7Drupal.behaviors.initColorboxLoad = { 8 attach: function (context, settings) { 9 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 10 return; 11 } 12 13 if (settings.colorbox.mobiledetect && window.matchMedia) { 14 // Disable Colorbox for small screens. 15 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 16 if (mq.matches) { 17 return; 18 } 19 } 20 21 $.urlParams = function (url) { 22 var p = {}, 23 e, 24 a = /\+/g, // Regex for replacing addition symbol with a space. 25 r = /([^&=]+)=?([^&]*)/g, 26 d = function (s) { return decodeURIComponent(s.replace(a, ' ')); }, 27 q = url.split('?'); 28 while (e = r.exec(q[1])) { 29 e[1] = d(e[1]); 30 e[2] = d(e[2]); 31 switch (e[2].toLowerCase()) { 32 case 'true': 33 case 'yes': 34 e[2] = true; 35 break; 36 case 'false': 37 case 'no': 38 e[2] = false; 39 break; 40 } 41 if (e[1] == 'width') { e[1] = 'innerWidth'; } 42 if (e[1] == 'height') { e[1] = 'innerHeight'; } 43 p[e[1]] = e[2]; 44 } 45 return p; 46 }; 47 $('.colorbox-load', context) 48 .once('init-colorbox-load', function () { 49 var params = $.urlParams($(this).attr('href')); 50 $(this).colorbox($.extend({}, settings.colorbox, params)); 51 }); 52 } 53}; 54 55})(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.