1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- (function ($) {
- Drupal.behaviors.initColorboxInline = {
- attach: function (context, settings) {
- if (!$.isFunction($.colorbox)) {
- return;
- }
- $.urlParam = function(name, url){
- if (name == 'fragment') {
- var results = new RegExp('(#[^&#]*)').exec(url);
- }
- else {
- var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);
- }
- if (!results) { return ''; }
- return results[1] || '';
- };
- $('.colorbox-inline', context).once('init-colorbox-inline').colorbox({
- transition:settings.colorbox.transition,
- speed:settings.colorbox.speed,
- opacity:settings.colorbox.opacity,
- slideshow:settings.colorbox.slideshow,
- slideshowAuto:settings.colorbox.slideshowAuto,
- slideshowSpeed:settings.colorbox.slideshowSpeed,
- slideshowStart:settings.colorbox.slideshowStart,
- slideshowStop:settings.colorbox.slideshowStop,
- current:settings.colorbox.current,
- previous:settings.colorbox.previous,
- next:settings.colorbox.next,
- close:settings.colorbox.close,
- overlayClose:settings.colorbox.overlayClose,
- maxWidth:settings.colorbox.maxWidth,
- maxHeight:settings.colorbox.maxHeight,
- innerWidth:function(){
- return $.urlParam('width', $(this).attr('href'));
- },
- innerHeight:function(){
- return $.urlParam('height', $(this).attr('href'));
- },
- title:function(){
- return decodeURIComponent($.urlParam('title', $(this).attr('href')));
- },
- iframe:function(){
- return $.urlParam('iframe', $(this).attr('href'));
- },
- inline:function(){
- return $.urlParam('inline', $(this).attr('href'));
- },
- href:function(){
- return $.urlParam('fragment', $(this).attr('href'));
- }
- });
- }
- };
- })(jQuery);
|