Projet

Général

Profil

Paste
Télécharger (1,83 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / colorbox / js / colorbox_inline.js @ 62f5c69e

1
(function ($) {
2

    
3
Drupal.behaviors.initColorboxInline = {
4
  attach: function (context, settings) {
5
    if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
6
      return;
7
    }
8
    $.urlParam = function(name, url){
9
      if (name == 'fragment') {
10
        var results = new RegExp('(#[^&#]*)').exec(url);
11
      }
12
      else {
13
        var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);
14
      }
15
      if (!results) { return ''; }
16
      return results[1] || '';
17
    };
18
    $('.colorbox-inline', context).once('init-colorbox-inline').colorbox({
19
      transition:settings.colorbox.transition,
20
      speed:settings.colorbox.speed,
21
      opacity:settings.colorbox.opacity,
22
      slideshow:settings.colorbox.slideshow,
23
      slideshowAuto:settings.colorbox.slideshowAuto,
24
      slideshowSpeed:settings.colorbox.slideshowSpeed,
25
      slideshowStart:settings.colorbox.slideshowStart,
26
      slideshowStop:settings.colorbox.slideshowStop,
27
      current:settings.colorbox.current,
28
      previous:settings.colorbox.previous,
29
      next:settings.colorbox.next,
30
      close:settings.colorbox.close,
31
      overlayClose:settings.colorbox.overlayClose,
32
      maxWidth:settings.colorbox.maxWidth,
33
      maxHeight:settings.colorbox.maxHeight,
34
      innerWidth:function(){
35
        return $.urlParam('width', $(this).attr('href'));
36
      },
37
      innerHeight:function(){
38
        return $.urlParam('height', $(this).attr('href'));
39
      },
40
      title:function(){
41
        return decodeURIComponent($.urlParam('title', $(this).attr('href')));
42
      },
43
      iframe:function(){
44
        return $.urlParam('iframe', $(this).attr('href'));
45
      },
46
      inline:function(){
47
        return $.urlParam('inline', $(this).attr('href'));
48
      },
49
      href:function(){
50
        return $.urlParam('fragment', $(this).attr('href'));
51
      }
52
    });
53
  }
54
};
55

    
56
})(jQuery);