summaryrefslogtreecommitdiff
path: root/sites/all/modules/colorbox/js/colorbox_inline.js
diff options
context:
space:
mode:
Diffstat (limited to 'sites/all/modules/colorbox/js/colorbox_inline.js')
-rw-r--r--sites/all/modules/colorbox/js/colorbox_inline.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/sites/all/modules/colorbox/js/colorbox_inline.js b/sites/all/modules/colorbox/js/colorbox_inline.js
new file mode 100644
index 000000000..0b27b655c
--- /dev/null
+++ b/sites/all/modules/colorbox/js/colorbox_inline.js
@@ -0,0 +1,56 @@
+(function ($) {
+
+Drupal.behaviors.initColorboxInline = {
+ attach: function (context, settings) {
+ if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
+ 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);