~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to media/fancybox/helpers/jquery.fancybox-media.js

  • Committer: franku
  • Date: 2016-04-18 13:29:23 UTC
  • mto: This revision was merged to the branch mainline in revision 409.
  • Revision ID: somal@arcor.de-20160418132923-bfzkb5mvdr7l8mz4
added migrations to each app

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 /*!
 
2
 * Media helper for fancyBox
 
3
 * version: 1.0.0
 
4
 * @requires fancyBox v2.0 or later
 
5
 *
 
6
 * Usage:
 
7
 *     $(".fancybox").fancybox({
 
8
 *         media: {}
 
9
 *     });
 
10
 *
 
11
 *  Supports:
 
12
 *      Youtube
 
13
 *          http://www.youtube.com/watch?v=opj24KnzrWo
 
14
 *          http://youtu.be/opj24KnzrWo
 
15
 *      Vimeo
 
16
 *          http://vimeo.com/25634903
 
17
 *      Metacafe
 
18
 *          http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/
 
19
 *          http://www.metacafe.com/watch/7635964/
 
20
 *      Dailymotion
 
21
 *          http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people
 
22
 *      Twitvid
 
23
 *          http://twitvid.com/QY7MD
 
24
 *      Twitpic
 
25
 *          http://twitpic.com/7p93st
 
26
 *      Instagram
 
27
 *          http://instagr.am/p/IejkuUGxQn/
 
28
 *          http://instagram.com/p/IejkuUGxQn/
 
29
 *      Google maps
 
30
 *          http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17
 
31
 *          http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16
 
32
 *          http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56
 
33
 */
 
34
(function ($) {
 
35
        //Shortcut for fancyBox object
 
36
        var F = $.fancybox;
 
37
 
 
38
        //Add helper object
 
39
        F.helpers.media = {
 
40
                beforeLoad : function(opts, obj) {
 
41
                        var href = obj.href || '',
 
42
                                type = false,
 
43
                                rez;
 
44
 
 
45
                        if ((rez = href.match(/(youtube\.com|youtu\.be)\/(v\/|u\/|embed\/|watch\?v=)?([^#\&\?]*).*/i))) {
 
46
                                href = '//www.youtube.com/embed/' + rez[3] + '?autoplay=1&autohide=1&fs=1&rel=0&enablejsapi=1';
 
47
                                type = 'iframe';
 
48
 
 
49
                        } else if ((rez = href.match(/vimeo.com\/(\d+)\/?(.*)/))) {
 
50
                                href = '//player.vimeo.com/video/' + rez[1] + '?hd=1&autoplay=1&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1';
 
51
                                type = 'iframe';
 
52
 
 
53
                        } else if ((rez = href.match(/metacafe.com\/watch\/(\d+)\/?(.*)/))) {
 
54
                                href = '//www.metacafe.com/fplayer/' + rez[1] + '/.swf?playerVars=autoPlay=yes';
 
55
                                type = 'swf';
 
56
 
 
57
                        } else if ((rez = href.match(/dailymotion.com\/video\/(.*)\/?(.*)/))) {
 
58
                                href = '//www.dailymotion.com/swf/video/' + rez[1] + '?additionalInfos=0&autoStart=1';
 
59
                                type = 'swf';
 
60
 
 
61
                        } else if ((rez = href.match(/twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i))) {
 
62
                                href = '//www.twitvid.com/embed.php?autoplay=0&guid=' + rez[1];
 
63
                                type = 'iframe';
 
64
 
 
65
                        } else if ((rez = href.match(/twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i))) {
 
66
                                href = '//twitpic.com/show/full/' + rez[1];
 
67
                                type = 'image';
 
68
 
 
69
                        } else if ((rez = href.match(/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i))) {
 
70
                                href = '//' + rez[1] + '/p/' + rez[2] + '/media/?size=l';
 
71
                                type = 'image';
 
72
 
 
73
                        } else if ((rez = href.match(/maps\.google\.com\/(\?ll=|maps\/?\?q=)(.*)/i))) {
 
74
                                href = '//maps.google.com/' + rez[1] + '' + rez[2] + '&output=' + (rez[2].indexOf('layer=c') ? 'svembed' : 'embed');
 
75
                                type = 'iframe';
 
76
                        }
 
77
 
 
78
                        if (type) {
 
79
                                obj.href = href;
 
80
                                obj.type = type;
 
81
                        }
 
82
                }
 
83
        }
 
84
 
 
85
}(jQuery));
 
 
b'\\ No newline at end of file'