[gnomeweb-wp] added support to integrate youtube and vimeo videos to fancybox



commit dba6ffd4a51e642cf7b092fc7986019be3c9ec1f
Author: Vinicius Depizzol <vdepizzol gmail com>
Date:   Tue Apr 5 00:36:51 2011 -0300

    added support to integrate youtube and vimeo videos to fancybox
    
    by adding 'play_youtube' or 'play_vimeo' classes in links pointing to youtube or vimeo

 wp-content/themes/gnome-grass/js/template.js |   28 ++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/wp-content/themes/gnome-grass/js/template.js b/wp-content/themes/gnome-grass/js/template.js
index c7678f1..85abb3b 100644
--- a/wp-content/themes/gnome-grass/js/template.js
+++ b/wp-content/themes/gnome-grass/js/template.js
@@ -73,4 +73,32 @@ $(document).ready(function() {
         'overlayColor'  :   '#000',
         'hideOnContentClick' : true
     });
+    
+    $(".play_youtube, .play_vimeo").click(function() {
+        
+        var href = this.href;
+        
+        if($(this).hasClass('play_youtube')) {
+            href = this.href.replace(new RegExp("watch\\?v=", "i"), 'v/')  + '&autoplay=1';
+        } else if($(this).hasClass('play_vimeo')) {
+            href = this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1') + '&autoplay=1'
+        }
+        
+        $.fancybox({
+            'padding'       : 10,
+            'autoScale'     : false,
+            'transitionIn'  : 'none',
+            'transitionOut' : 'none',
+            'title'         : this.title,
+            'width'         : 680,
+            'height'        : 410,
+            'href'          : href,
+            'type'          : 'swf',
+            'swf'           : {'allowfullscreen':'true'},
+            'hideOnContentClick' : false,
+            'hideOnOverlayClick' : false
+        });
+        return false;
+    });
+
 });



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]