PageSourceSearch

https://exalumnos.itam.mx/sites/all/modules/magnific_popup/js/behaviors.mfp-formatter.js?v=1

js itam.mx collected 2026-10-01 10:18:15 UTC 5,729 bytes, 128 lines download raw bytes

1(function ($) {
2  // Sanity check because sometimes we might be included on a page with jQuery
3  // < 1.7, in which case Magnific Popup's use of $().on/$().off will blow up.
4  if (!("off" in $.fn)) {
5    if (window.console) {
6      console.log('Magnific Popup disabled: legacy jQuery detected (no "off" method).');
7    }
8    return;
9  }
10  Drupal.settings.magnific_popup = Drupal.settings.magnific_popup || {};
11  Drupal.settings.magnific_popup_api = Drupal.settings.magnific_popup_api || {};
12  Drupal.settings.magnific_popup.common_options = {
13    disableOn: 300,
14    mainClass: 'mfp-fade',
15    removalDelay: 160,
16    preloader: false,
17    fixedContentPos: 'auto'
18  };
19  var youtube_id = function (url) {
20    // Get video ID and extra params (if they exist). Sometimes the order of
21    // parameters in "/watch?"-style URLs can change, so allow "v=" to appear
22    // anywhere.
23    // Example URLs:
24    //  http://www.youtube.com/watch?v=VIDEOID&t=60&list=PLAYLISTID
25    //  https://www.youtube.com/v/VIDEOID?t=60&list=PLAYLISTID
26    //  https://www.youtube.com/embed/VIDEOID?t=60&list=PLAYLISTID
27    //  https://youtu.be/VIDEOID?t=60&list=PLAYLISTID
28    var video_ID = /(youtu\.be\/|youtube\.com\/(embed|v)\/|watch\?v=|watch\?.*&v=)([a-zA-Z0-9_-]+)/.exec(url);
29    if (!video_ID || !video_ID.length || typeof video_ID[3] === 'undefined') {
30      return false;
31    }
32    var video_params_test = /\?+(.+)/.exec(url), video_params = '';
33    if (!!video_params_test && typeof video_params_test[1] !== 'undefined') {
34      video_params = '&' + video_params_test[1];
35      // Remove redundant video param, if it exists.
36      video_params = video_params.replace(/&v=.*?(?=$|&)/gi, '');
37      // Remove autoplay param, if it exists.
38      video_params = video_params.replace(/&autoplay=.*?(?=$|&)/gi, '');
39      // Convert "t"/"time_continue" to "start" param.
40      video_params = video_params.replace(/&(t|time_continue)=/gi, '&start=');
41      // Adjust "start" param; the YT share GUI generates URLs like ?t=1h2m3s
42      // but the embed endpoint requires time in seconds with no units or text
43      // chars of any kind.
44      var start_times = /&start=((\d+h)?(\d+m)?(\d+s)?)/i.exec(video_params);
45      if (start_times && start_times.length && start_times[1] !== '') {
46        var time = 0;
47        for (var i = 2; i < start_times.length; ++i) {
48          if (typeof start_times[i] !== 'undefined') {
49            time += parseInt(start_times[i]) * Math.pow(60, 4 - i);
50          }
51        }
52        video_params = video_params.replace(/&start=.*?(?=$|&)/gi, '&start=' + time);
53      }
54    }
55    return video_ID[3] + '?autoplay=1' + video_params;
56  };
57  Drupal.settings.magnific_popup.common_options_iframe = {
58    type: 'iframe',
59    iframe: {
60      markup: '<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" id="mfp-iframe" frameborder="0" seamless="seamless" allowfullscreen="allowfullscreen"></iframe></div>',
61      patterns: {
62        youtube_short: {
63          index: 'youtu.be/',
64          id: youtube_id,
65          src: '//www.youtube.com/embed/%id%'
66        },
67        // To override the default "youtube" handler, we need to name ours the
68        // same.
69        youtube: {
70          index: 'www.youtube.com/',
71          id: youtube_id,
72          src: '//www.youtube.com/embed/%id%'
73        }
74      }
75    }
76  };
77  Drupal.behaviors.magnific_popup = {
78    attach: function (context, settings) {
79      settings.magnific_popup = settings.magnific_popup || {
80          common_options: {},
81          common_options_iframe: {}
82        };
83      var common_options = settings.magnific_popup.common_options || {};
84      var common_options_iframe = settings.magnific_popup.common_options_iframe || {};
85      // Allow modules to extend the set of patterns we support via iframe.
86      if (settings.magnific_popup_api && settings.magnific_popup_api.iframe_patterns) {
87        jQuery.extend(settings.magnific_popup.common_options_iframe.iframe.patterns, settings.magnific_popup_api.iframe_patterns);
88        // There are some bugs around the delete operator, so make sure we never
89        // double-up on iframe patterns.
90        settings.magnific_popup_api.iframe_patterns = {};
91        // Attempt to delete the iframe patterns from our settings object.
92        delete settings.magnific_popup_api.iframe_patterns;
93      }
94      var common_options_image = {
95        type: 'image',
96        image: {
97          titleSrc: function (item) {
98            return $('img.mfp-thumbnail,span.mfp-title', item.el).attr('title') || '';
99          }
100        }
101      };
102      var common_options_gallery = {
103        gallery: {enabled: true},
104        delegate: 'a'
105      };
106      // Instantiate no-gallery, images.
107      var options = {};
108      $.extend(options, common_options, common_options_image);
109      $('.mfp-nogallery-image .mfp-item', context).once('magnific_popup').magnificPopup(options);
110      // Instantiate no-gallery, iframes.
111      options = {};
112      $.extend(options, common_options, common_options_iframe);
113      $('.mfp-nogallery-iframe .mfp-item', context).once('magnific_popup').magnificPopup(options);
114      // Instantiate galleries, images.
115      options = {};
116      $.extend(options, common_options, common_options_image, common_options_gallery);
117      $('.mfp-gallery-image', context).once('magnific_popup').each(function (el, i) {
118        $(this).magnificPopup(options);
119      });
120      // Instantiate galleries, iframes.
121      options = {};
122      $.extend(options, common_options, common_options_iframe, common_options_gallery);
123      $('.mfp-gallery-iframe', context).once('magnific_popup').each(function (el, i) {
124        $(this).magnificPopup(options);
125      });
126    }
127  }
128})(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.