Advertisement
jegtheme

fotorama

Aug 5th, 2014
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * jquery.jnormalblog.js
  3.  */
  4. (function ($, PhotoSwipe) {
  5.     "use strict";
  6.     $.fn.jnormalblog = function (options) {
  7.  
  8.         options = $.extend({
  9.             followlike: 0
  10.         }, options);
  11.  
  12.         return $(this).each(function () {
  13.  
  14.             var blog_content_type = function () {
  15.                 // gallery
  16.                 if ($(".article-slider-wrapper").length) {
  17.                     $(".article-slider-wrapper").each(function () {
  18.                         $(".article-slider-wrapper").imagesLoaded(function () {
  19.                             $(".article-slider-wrapper").removeClass('loading');
  20.                             $(".article-image-slider").fadeIn();
  21.                             create_fotorama();
  22.                         });
  23.                     });
  24.                 }
  25.  
  26.                 // youtube
  27.                 if ($("[data-type='youtube']").length) {
  28.                     $("[data-type='youtube']").each(function () {
  29.                         var autoplay = $(this).data('autoplay');
  30.                         var repeat = $(this).data('repeat');
  31.                         $.type_video_youtube($(this), autoplay, repeat);
  32.                     });
  33.                 }
  34.  
  35.                 // vimeo
  36.                 if ($("[data-type='vimeo']").length) {
  37.                     $("[data-type='vimeo']").each(function () {
  38.                         var autoplay = $(this).data('autoplay');
  39.                         var repeat = $(this).data('repeat');
  40.                         $.type_video_vimeo($(this), autoplay, repeat);
  41.                     });
  42.                 }
  43.  
  44.                 // sound cloud
  45.                 if ($("[data-type='soundcloud']").length) {
  46.                     $("[data-type='soundcloud']").each(function () {
  47.                         $.type_soundcloud($(this));
  48.                     });
  49.                 }
  50.  
  51.                 // html 5 video
  52.                 if ($("[data-type='html5video']").length) {
  53.                     $("[data-type='html5video']").each(function () {
  54.                         $.type_video_html5($(this), false, {
  55.                             enableAutosize: true,
  56.                             videoWidth: '100%',
  57.                             videoHeight: '100%',
  58.                             features: ['playpause', 'progress', 'current', 'duration', 'tracks', 'volume', 'fullscreen']
  59.                         }, '.video-container');
  60.                     });
  61.                 }
  62.             };
  63.  
  64.             var create_fotorama = function () {
  65.                 $(".article-image-slider").fotorama({
  66.                     allowfullscreen: false,
  67.                     arrows: false,
  68.                     width: '100%',
  69.                     maxWidth: '100%',
  70.                     autoplay: true
  71.                 });
  72.             };
  73.  
  74.             var followlike = function () {
  75.                 $(".article-share").jsharefollow();
  76.             };
  77.  
  78.             var blog_shortcode = function () {
  79.                 if ($("[data-toggle='tooltip']").length) {
  80.                     $("[data-toggle='tooltip']").tooltip();
  81.                }
  82.                 if ($(".jrmap").length) {
  83.                     do_load_googlemap('mapshortcode');
  84.                 }
  85.                 if ($(".skillgraph").length) {
  86.                     $(window).bind('load', function () {
  87.                         $(".skillgraph").jskill();
  88.                     });
  89.                 }
  90.             };
  91.  
  92.             var blog_photoswipe = function () {
  93.                 if ($(".photoswipe").length) {
  94.                     var photoswipe = $('.photoswipe').photoSwipe({
  95.                         slideshowDelay: 6000,
  96.                         nextPreviousSlideSpeed: 400,
  97.                         slideSpeed: 400,
  98.                         captionAndToolbarOpacity: 1,
  99.                         margin: 0,
  100.                         captionAndToolbarFlipPosition: true,
  101.                         getImageSource: function (obj) {
  102.                             return $(obj).attr('href');
  103.                         },
  104.                         getImageCaption: function (obj) {
  105.                             return $(obj).find('img').attr('alt');
  106.                         }
  107.                     });
  108.                 }
  109.             };
  110.  
  111.             var blog_360 = function () {
  112.                 if ($(".responsive360wrapper")) {
  113.                     $(".responsive360wrapper").each(function () {
  114.                         $(this).responsive360({
  115.                             imgpath: $(this).data('imagepath'),
  116.                             imgcount: $(this).data('imagecount'),
  117.                             autoplay: ( $(this).data('autoplay') == true ) ? 1 : 0
  118.                         });
  119.                     });
  120.  
  121.                 }
  122.             };
  123.  
  124.             var blog_facebook_widget = function(){
  125.                 if($(".blog-fb-likebox").length){
  126.                     window.fbAsyncInit = function() {
  127.                         FB.init({
  128.                             xfbml      : true,
  129.                             version    : 'v2.0'
  130.                         });
  131.                     };
  132.  
  133.                     (function(d, s, id){
  134.                         var js, fjs = d.getElementsByTagName(s)[0];
  135.                         if (d.getElementById(id)) {return;}
  136.                         js = d.createElement(s); js.id = id;
  137.                         js.src = "//connect.facebook.net/en_US/sdk.js";
  138.                         fjs.parentNode.insertBefore(js, fjs);
  139.                     }(document, 'script', 'facebook-jssdk'));
  140.                 }
  141.             };
  142.  
  143.             blog_shortcode();
  144.             blog_content_type();
  145.             blog_photoswipe();
  146.             blog_360();
  147.             blog_facebook_widget();
  148.  
  149.             $.bindComment();
  150.             if (options.followlike === 1) {
  151.                 $(window).bind('load', followlike);
  152.             }
  153.         });
  154.     };
  155. })(jQuery, window.Code.PhotoSwipe);
  156.  
  157. /** need to use asynch map and loaded only when it needed **/
  158. function mapshortcode() {
  159.     jQuery(".jrmap").jrmap();
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement