aboutsummaryrefslogtreecommitdiff
path: root/muamba.js
blob: 5d1c4db096e08c772ecef74e4b964ec0eb8800c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(function ($) {

  Drupal.behaviors.muamba = {
    attach: function (context, settings) {
      // Ajax colorbox support
      // See https://drupal.org/node/836160#comment-4870846
      $('.colorbox-ajax', context).each( function() {
        // get the current URL
        var oldUrl = $(this).attr('href');
        // append the required parameters
        // TODO: there might be already a ? at the url,
        // in that case use & instead
        var newUrl = oldUrl + '&template=colorbox';
        // update the links href
        $(this).attr('href', newUrl);
        });
    }
  };

}(jQuery));