Letlabo Nature Reserve
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

jquery.fancybox-media.js 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*!
  2. * Media helper for fancyBox
  3. * version: 1.0.5 (Tue, 23 Oct 2012)
  4. * @requires fancyBox v2.0 or later
  5. *
  6. * Usage:
  7. * $(".fancybox").fancybox({
  8. * helpers : {
  9. * media: true
  10. * }
  11. * });
  12. *
  13. * Set custom URL parameters:
  14. * $(".fancybox").fancybox({
  15. * helpers : {
  16. * media: {
  17. * youtube : {
  18. * params : {
  19. * autoplay : 0
  20. * }
  21. * }
  22. * }
  23. * }
  24. * });
  25. *
  26. * Or:
  27. * $(".fancybox").fancybox({,
  28. * helpers : {
  29. * media: true
  30. * },
  31. * youtube : {
  32. * autoplay: 0
  33. * }
  34. * });
  35. *
  36. * Supports:
  37. *
  38. * Youtube
  39. * http://www.youtube.com/watch?v=opj24KnzrWo
  40. * http://www.youtube.com/embed/opj24KnzrWo
  41. * http://youtu.be/opj24KnzrWo
  42. * Vimeo
  43. * http://vimeo.com/40648169
  44. * http://vimeo.com/channels/staffpicks/38843628
  45. * http://vimeo.com/groups/surrealism/videos/36516384
  46. * http://player.vimeo.com/video/45074303
  47. * Metacafe
  48. * http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/
  49. * http://www.metacafe.com/watch/7635964/
  50. * Dailymotion
  51. * http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people
  52. * Twitvid
  53. * http://twitvid.com/QY7MD
  54. * Twitpic
  55. * http://twitpic.com/7p93st
  56. * Instagram
  57. * http://instagr.am/p/IejkuUGxQn/
  58. * http://instagram.com/p/IejkuUGxQn/
  59. * Google maps
  60. * http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17
  61. * http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16
  62. * 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
  63. */
  64. (function ($) {
  65. "use strict";
  66. //Shortcut for fancyBox object
  67. var F = $.fancybox,
  68. format = function( url, rez, params ) {
  69. params = params || '';
  70. if ( $.type( params ) === "object" ) {
  71. params = $.param(params, true);
  72. }
  73. $.each(rez, function(key, value) {
  74. url = url.replace( '$' + key, value || '' );
  75. });
  76. if (params.length) {
  77. url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params;
  78. }
  79. return url;
  80. };
  81. //Add helper object
  82. F.helpers.media = {
  83. defaults : {
  84. youtube : {
  85. matcher : /(youtube\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i,
  86. params : {
  87. autoplay : 1,
  88. autohide : 1,
  89. fs : 1,
  90. rel : 0,
  91. hd : 1,
  92. wmode : 'opaque',
  93. enablejsapi : 1
  94. },
  95. type : 'iframe',
  96. url : '//www.youtube.com/embed/$3'
  97. },
  98. vimeo : {
  99. matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/,
  100. params : {
  101. autoplay : 1,
  102. hd : 1,
  103. show_title : 1,
  104. show_byline : 1,
  105. show_portrait : 0,
  106. fullscreen : 1
  107. },
  108. type : 'iframe',
  109. url : '//player.vimeo.com/video/$1'
  110. },
  111. metacafe : {
  112. matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/,
  113. params : {
  114. autoPlay : 'yes'
  115. },
  116. type : 'swf',
  117. url : function( rez, params, obj ) {
  118. obj.swf.flashVars = 'playerVars=' + $.param( params, true );
  119. return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf';
  120. }
  121. },
  122. dailymotion : {
  123. matcher : /dailymotion.com\/video\/(.*)\/?(.*)/,
  124. params : {
  125. additionalInfos : 0,
  126. autoStart : 1
  127. },
  128. type : 'swf',
  129. url : '//www.dailymotion.com/swf/video/$1'
  130. },
  131. twitvid : {
  132. matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i,
  133. params : {
  134. autoplay : 0
  135. },
  136. type : 'iframe',
  137. url : '//www.twitvid.com/embed.php?guid=$1'
  138. },
  139. twitpic : {
  140. matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i,
  141. type : 'image',
  142. url : '//twitpic.com/show/full/$1/'
  143. },
  144. instagram : {
  145. matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,
  146. type : 'image',
  147. url : '//$1/p/$2/media/'
  148. },
  149. google_maps : {
  150. matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i,
  151. type : 'iframe',
  152. url : function( rez ) {
  153. return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed');
  154. }
  155. }
  156. },
  157. beforeLoad : function(opts, obj) {
  158. var url = obj.href || '',
  159. type = false,
  160. what,
  161. item,
  162. rez,
  163. params;
  164. for (what in opts) {
  165. item = opts[ what ];
  166. rez = url.match( item.matcher );
  167. if (rez) {
  168. type = item.type;
  169. params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null));
  170. url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params );
  171. break;
  172. }
  173. }
  174. if (type) {
  175. obj.href = url;
  176. obj.type = type;
  177. obj.autoHeight = false;
  178. }
  179. }
  180. };
  181. }(jQuery));