j1-template 2021.1.4 → 2021.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/layout_metadata_generator.html +4 -4
  3. data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +7 -15
  4. data/_includes/themes/j1/modules/connectors/ads +18 -7
  5. data/_includes/themes/j1/modules/connectors/analytic/google-analytics.html +7 -3
  6. data/_includes/themes/j1/modules/connectors/analytics +17 -3
  7. data/_includes/themes/j1/modules/connectors/comments +22 -8
  8. data/_includes/themes/j1/modules/connectors/translator +20 -6
  9. data/_includes/themes/j1/modules/navigator/generator.html +2 -2
  10. data/_includes/themes/j1/procedures/global/select_location.proc +3 -3
  11. data/_layouts/default.html +4 -7
  12. data/assets/data/cookieconsent.html +249 -0
  13. data/assets/data/quicklinks.html +18 -16
  14. data/assets/data/themes.json +6 -6
  15. data/assets/error_pages/HTTP204.html +30 -10
  16. data/assets/error_pages/HTTP400.html +29 -8
  17. data/assets/error_pages/HTTP401.html +29 -9
  18. data/assets/error_pages/HTTP403.html +29 -8
  19. data/assets/error_pages/HTTP404.html +29 -8
  20. data/assets/error_pages/HTTP500.html +29 -8
  21. data/assets/error_pages/HTTP501.html +29 -8
  22. data/assets/error_pages/HTTP502.html +29 -8
  23. data/assets/error_pages/HTTP503.html +30 -8
  24. data/assets/themes/j1/adapter/js/cookieConsent.js +290 -0
  25. data/assets/themes/j1/adapter/js/fam.js +2 -1
  26. data/assets/themes/j1/adapter/js/j1.js +154 -153
  27. data/assets/themes/j1/adapter/js/navigator.js +157 -200
  28. data/assets/themes/j1/adapter/js/themer.1.js +326 -0
  29. data/assets/themes/j1/adapter/js/themer.js +41 -57
  30. data/assets/themes/j1/adapter/js/toccer.js +4 -45
  31. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.css +2 -2
  32. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css +1 -1
  33. data/assets/themes/j1/core/js/template.js +3 -9
  34. data/assets/themes/j1/core/js/template.js.map +1 -1
  35. data/assets/themes/j1/core/js/template.min.js +3 -9
  36. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  37. data/assets/themes/j1/modules/cookieConsent/LICENSE +21 -0
  38. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +301 -0
  39. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +301 -0
  40. data/assets/themes/j1/modules/fam/css/{uno → theme/uno}/fam.css +0 -0
  41. data/assets/themes/j1/modules/fam/css/theme/uno/fam.min.css +15 -0
  42. data/assets/themes/j1/modules/fam/js/fam.js +1 -6
  43. data/assets/themes/j1/modules/iframeResizer/examples/frame.absolute.html +4 -2
  44. data/assets/themes/j1/modules/iframeResizer/examples/frame.content.html +4 -3
  45. data/assets/themes/j1/modules/iframeResizer/examples/frame.hover.html +4 -2
  46. data/assets/themes/j1/modules/iframeResizer/examples/frame.nested.html +4 -2
  47. data/assets/themes/j1/modules/iframeResizer/examples/frame.textarea.html +4 -2
  48. data/assets/themes/j1/modules/iframeResizer/examples/frame.tolerance.html +4 -2
  49. data/assets/themes/j1/modules/iframeResizer/examples/index.html +2 -0
  50. data/assets/themes/j1/modules/iframeResizer/examples/two.html +4 -2
  51. data/assets/themes/j1/modules/mmenuLight/css/{mmenu.css → mmenu-light.css} +0 -0
  52. data/assets/themes/j1/modules/mmenuLight/css/{mmenu.min.css → mmenu-light.min.css} +0 -0
  53. data/assets/themes/j1/modules/mmenuLight/css/theme/{uno.css → uno/mmenu.css} +0 -0
  54. data/assets/themes/j1/modules/mmenuLight/css/theme/{uno.min.css → uno/mmenu.min.css} +0 -0
  55. data/assets/themes/j1/modules/rtable/css/theme/{uno.css → uno/rtable.css} +0 -0
  56. data/assets/themes/j1/modules/rtable/css/theme/{uno.min.css → uno/rtable.min.css} +0 -0
  57. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +34 -49
  58. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +410 -2
  59. data/assets/themes/j1/modules/util/js/domready.js +146 -0
  60. data/assets/themes/j1/modules/util/js/gtag-opt-in.js +1 -0
  61. data/lib/j1/version.rb +3 -3
  62. data/lib/j1_app/j1_auth_manager/auth_manager.rb +2 -3
  63. data/lib/starter_web/Gemfile +1 -1
  64. data/lib/starter_web/_config.yml +19 -10
  65. data/lib/starter_web/_data/_defaults/resources.yml +11 -8
  66. data/lib/starter_web/_data/j1_config.yml +21 -18
  67. data/lib/starter_web/_data/modules/{cookiebar.yml → cookieconsent.yml} +5 -4
  68. data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +136 -0
  69. data/lib/starter_web/_data/modules/defaults/themer.yml +2 -1
  70. data/lib/starter_web/_data/pages/builder.yml +7 -7
  71. data/lib/starter_web/_data/private.default.yml +119 -0
  72. data/lib/starter_web/_data/private.yml +6 -6
  73. data/lib/starter_web/_data/resources.yml +15 -14
  74. data/lib/starter_web/_includes/attributes.asciidoc +10 -1
  75. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  76. data/lib/starter_web/assets/images/modules/attics/{cookies-1920x1200-bw.jpg → cookies-1920x1200.jpg} +0 -0
  77. data/lib/starter_web/assets/images/modules/attics/lianhao-1920x1280.jpg +0 -0
  78. data/lib/starter_web/collections/posts/public/featured/_posts/2020-01-01-about-cookies.adoc +2 -2
  79. data/lib/starter_web/dot.gitignore +1 -1
  80. data/lib/starter_web/index.html +3 -3
  81. data/lib/starter_web/package.json +2 -2
  82. data/lib/starter_web/pages/public/blog/navigator/archive.html +5 -3
  83. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +3 -2
  84. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +6 -4
  85. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +23 -5
  86. data/lib/starter_web/pages/public/cookieConsent.adoc +93 -0
  87. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +2 -1
  88. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +111 -213
  89. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  90. data/lib/starter_web/utilsrv/package.json +1 -1
  91. metadata +24 -76
  92. data/_includes/themes/j1/modules/navigator/generator.org.html +0 -232
  93. data/assets/data/cookiebar.html +0 -288
  94. data/assets/data/footer.new.1.html +0 -256
  95. data/assets/data/footer.new.2.html +0 -256
  96. data/assets/data/footer.org.html +0 -249
  97. data/assets/error_pages/HTTP520.html +0 -68
  98. data/assets/error_pages/HTTP521.html +0 -68
  99. data/assets/error_pages/HTTP533.html +0 -68
  100. data/assets/themes/j1/adapter/js/cookiebar.js +0 -212
  101. data/assets/themes/j1/adapter/js/j1.new.js +0 -1878
  102. data/assets/themes/j1/adapter/js/j1.org.js +0 -1874
  103. data/assets/themes/j1/modules/_lightGallery/css/core/lg-fb-comment-box.css +0 -58
  104. data/assets/themes/j1/modules/_lightGallery/css/core/lg-fb-comment-box.min.css +0 -5
  105. data/assets/themes/j1/modules/_lightGallery/css/core/lg-transitions.css +0 -778
  106. data/assets/themes/j1/modules/_lightGallery/css/core/lg-transitions.min.css +0 -5
  107. data/assets/themes/j1/modules/_lightGallery/css/core/lightgallery.css +0 -981
  108. data/assets/themes/j1/modules/_lightGallery/css/core/lightgallery.min.css +0 -5
  109. data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.eot +0 -0
  110. data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.svg +0 -47
  111. data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.ttf +0 -0
  112. data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.woff +0 -0
  113. data/assets/themes/j1/modules/_lightGallery/css/img/loading.gif +0 -0
  114. data/assets/themes/j1/modules/_lightGallery/css/img/video-play.png +0 -0
  115. data/assets/themes/j1/modules/_lightGallery/css/img/vimeo-play.png +0 -0
  116. data/assets/themes/j1/modules/_lightGallery/css/img/youtube-play.png +0 -0
  117. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/animation-w.png +0 -0
  118. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/customize-w.png +0 -0
  119. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/dynamic-w.png +0 -0
  120. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/facebook-icon.svg +0 -10
  121. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/googleplus-icon.svg +0 -30
  122. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/html5-w.png +0 -0
  123. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/linked-in.png +0 -0
  124. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/module-w.png +0 -0
  125. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/play-button.png +0 -0
  126. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/responsive-w.png +0 -0
  127. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/thumb-w.png +0 -0
  128. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/touch-w.png +0 -0
  129. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/twitter-icon.svg +0 -15
  130. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/twitter.png +0 -0
  131. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/video1-w.png +0 -0
  132. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/zoom-w.png +0 -0
  133. data/assets/themes/j1/modules/_lightGallery/css/themes/icons/zoom.png +0 -0
  134. data/assets/themes/j1/modules/_lightGallery/css/themes/uno.css +0 -262
  135. data/assets/themes/j1/modules/_lightGallery/css/themes/uno.min.css +0 -15
  136. data/assets/themes/j1/modules/_lightGallery/js/core/lightgallery.js +0 -1362
  137. data/assets/themes/j1/modules/_lightGallery/js/core/lightgallery.min.js +0 -4
  138. data/assets/themes/j1/modules/_lightGallery/js/modules/j1/j1-video.js +0 -402
  139. data/assets/themes/j1/modules/_lightGallery/js/modules/j1/j1-video.min.js +0 -8
  140. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-autoplay.js +0 -206
  141. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-autoplay.min.js +0 -5
  142. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-fullscreen.js +0 -126
  143. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-fullscreen.min.js +0 -5
  144. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-hash.js +0 -101
  145. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-hash.min.js +0 -5
  146. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-pager.js +0 -105
  147. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-pager.min.js +0 -5
  148. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-share.js +0 -107
  149. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-share.min.js +0 -5
  150. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-thumbnail.js +0 -478
  151. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-thumbnail.min.js +0 -5
  152. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-video.js +0 -342
  153. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-video.min.js +0 -5
  154. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-zoom.js +0 -527
  155. data/assets/themes/j1/modules/_lightGallery/js/modules/lg-zoom.min.js +0 -5
  156. data/lib/starter_web/_data/modules/defaults/cookiebar.yml +0 -133
@@ -1,5 +0,0 @@
1
- /*! lg-thumbnail - v1.1.0 - 2017-08-08
2
- * http://sachinchoolur.github.io/lightGallery
3
- * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
4
-
5
- !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){!function(){"use strict";var b={thumbnail:!0,animateThumb:!0,currentPagerPosition:"middle",thumbWidth:100,thumbHeight:"80px",thumbContHeight:100,thumbMargin:5,exThumbImage:!1,showThumbByDefault:!0,toogleThumb:!0,pullCaptionUp:!0,enableThumbDrag:!0,enableThumbSwipe:!0,swipeThreshold:50,loadYoutubeThumbnail:!0,youtubeThumbSize:1,loadVimeoThumbnail:!0,vimeoThumbSize:"thumbnail_small",loadDailymotionThumbnail:!0},c=function(c){return this.core=a(c).data("lightGallery"),this.core.s=a.extend({},b,this.core.s),this.$el=a(c),this.$thumbOuter=null,this.thumbOuterWidth=0,this.thumbTotalWidth=this.core.$items.length*(this.core.s.thumbWidth+this.core.s.thumbMargin),this.thumbIndex=this.core.index,this.core.s.animateThumb&&(this.core.s.thumbHeight="100%"),this.left=0,this.init(),this};c.prototype.init=function(){var a=this;this.core.s.thumbnail&&this.core.$items.length>1&&(this.core.s.showThumbByDefault&&setTimeout(function(){a.core.$outer.addClass("lg-thumb-open")},700),this.core.s.pullCaptionUp&&this.core.$outer.addClass("lg-pull-caption-up"),this.build(),this.core.s.animateThumb&&this.core.doCss()?(this.core.s.enableThumbDrag&&this.enableThumbDrag(),this.core.s.enableThumbSwipe&&this.enableThumbSwipe(),this.thumbClickable=!1):this.thumbClickable=!0,this.toogle(),this.thumbkeyPress())},c.prototype.build=function(){function b(a,b,c){var g,h=d.core.isVideo(a,c)||{},i="";h.youtube||h.vimeo||h.dailymotion?h.youtube?g=d.core.s.loadYoutubeThumbnail?"//img.youtube.com/vi/"+h.youtube[1]+"/"+d.core.s.youtubeThumbSize+".jpg":b:h.vimeo?d.core.s.loadVimeoThumbnail?(g="//i.vimeocdn.com/video/error_"+f+".jpg",i=h.vimeo[1]):g=b:h.dailymotion&&(g=d.core.s.loadDailymotionThumbnail?"//www.dailymotion.com/thumbnail/video/"+h.dailymotion[1]:b):g=b,e+='<div data-vimeo-id="'+i+'" class="lg-thumb-item" style="width:'+d.core.s.thumbWidth+"px; height: "+d.core.s.thumbHeight+"; margin-right: "+d.core.s.thumbMargin+'px"><img src="'+g+'" /></div>',i=""}var c,d=this,e="",f="",g='<div class="lg-thumb-outer"><div class="lg-thumb lg-group"></div></div>';switch(this.core.s.vimeoThumbSize){case"thumbnail_large":f="640";break;case"thumbnail_medium":f="200x150";break;case"thumbnail_small":f="100x75"}if(d.core.$outer.addClass("lg-has-thumb"),d.core.$outer.find(".lg").append(g),d.$thumbOuter=d.core.$outer.find(".lg-thumb-outer"),d.thumbOuterWidth=d.$thumbOuter.width(),d.core.s.animateThumb&&d.core.$outer.find(".lg-thumb").css({width:d.thumbTotalWidth+"px",position:"relative"}),this.core.s.animateThumb&&d.$thumbOuter.css("height",d.core.s.thumbContHeight+"px"),d.core.s.dynamic)for(var h=0;h<d.core.s.dynamicEl.length;h++)b(d.core.s.dynamicEl[h].src,d.core.s.dynamicEl[h].thumb,h);else d.core.$items.each(function(c){d.core.s.exThumbImage?b(a(this).attr("href")||a(this).attr("data-src"),a(this).attr(d.core.s.exThumbImage),c):b(a(this).attr("href")||a(this).attr("data-src"),a(this).find("img").attr("src"),c)});d.core.$outer.find(".lg-thumb").html(e),c=d.core.$outer.find(".lg-thumb-item"),c.each(function(){var b=a(this),c=b.attr("data-vimeo-id");c&&a.getJSON("//www.vimeo.com/api/v2/video/"+c+".json?callback=?",{format:"json"},function(a){b.find("img").attr("src",a[0][d.core.s.vimeoThumbSize])})}),c.eq(d.core.index).addClass("active"),d.core.$el.on("onBeforeSlide.lg.tm",function(){c.removeClass("active"),c.eq(d.core.index).addClass("active")}),c.on("click.lg touchend.lg",function(){var b=a(this);setTimeout(function(){(d.thumbClickable&&!d.core.lgBusy||!d.core.doCss())&&(d.core.index=b.index(),d.core.slide(d.core.index,!1,!0,!1))},50)}),d.core.$el.on("onBeforeSlide.lg.tm",function(){d.animateThumb(d.core.index)}),a(window).on("resize.lg.thumb orientationchange.lg.thumb",function(){setTimeout(function(){d.animateThumb(d.core.index),d.thumbOuterWidth=d.$thumbOuter.width()},200)})},c.prototype.setTranslate=function(a){this.core.$outer.find(".lg-thumb").css({transform:"translate3d(-"+a+"px, 0px, 0px)"})},c.prototype.animateThumb=function(a){var b=this.core.$outer.find(".lg-thumb");if(this.core.s.animateThumb){var c;switch(this.core.s.currentPagerPosition){case"left":c=0;break;case"middle":c=this.thumbOuterWidth/2-this.core.s.thumbWidth/2;break;case"right":c=this.thumbOuterWidth-this.core.s.thumbWidth}this.left=(this.core.s.thumbWidth+this.core.s.thumbMargin)*a-1-c,this.left>this.thumbTotalWidth-this.thumbOuterWidth&&(this.left=this.thumbTotalWidth-this.thumbOuterWidth),this.left<0&&(this.left=0),this.core.lGalleryOn?(b.hasClass("on")||this.core.$outer.find(".lg-thumb").css("transition-duration",this.core.s.speed+"ms"),this.core.doCss()||b.animate({left:-this.left+"px"},this.core.s.speed)):this.core.doCss()||b.css("left",-this.left+"px"),this.setTranslate(this.left)}},c.prototype.enableThumbDrag=function(){var b=this,c=0,d=0,e=!1,f=!1,g=0;b.$thumbOuter.addClass("lg-grab"),b.core.$outer.find(".lg-thumb").on("mousedown.lg.thumb",function(a){b.thumbTotalWidth>b.thumbOuterWidth&&(a.preventDefault(),c=a.pageX,e=!0,b.core.$outer.scrollLeft+=1,b.core.$outer.scrollLeft-=1,b.thumbClickable=!1,b.$thumbOuter.removeClass("lg-grab").addClass("lg-grabbing"))}),a(window).on("mousemove.lg.thumb",function(a){e&&(g=b.left,f=!0,d=a.pageX,b.$thumbOuter.addClass("lg-dragging"),g-=d-c,g>b.thumbTotalWidth-b.thumbOuterWidth&&(g=b.thumbTotalWidth-b.thumbOuterWidth),g<0&&(g=0),b.setTranslate(g))}),a(window).on("mouseup.lg.thumb",function(){f?(f=!1,b.$thumbOuter.removeClass("lg-dragging"),b.left=g,Math.abs(d-c)<b.core.s.swipeThreshold&&(b.thumbClickable=!0)):b.thumbClickable=!0,e&&(e=!1,b.$thumbOuter.removeClass("lg-grabbing").addClass("lg-grab"))})},c.prototype.enableThumbSwipe=function(){var a=this,b=0,c=0,d=!1,e=0;a.core.$outer.find(".lg-thumb").on("touchstart.lg",function(c){a.thumbTotalWidth>a.thumbOuterWidth&&(c.preventDefault(),b=c.originalEvent.targetTouches[0].pageX,a.thumbClickable=!1)}),a.core.$outer.find(".lg-thumb").on("touchmove.lg",function(f){a.thumbTotalWidth>a.thumbOuterWidth&&(f.preventDefault(),c=f.originalEvent.targetTouches[0].pageX,d=!0,a.$thumbOuter.addClass("lg-dragging"),e=a.left,e-=c-b,e>a.thumbTotalWidth-a.thumbOuterWidth&&(e=a.thumbTotalWidth-a.thumbOuterWidth),e<0&&(e=0),a.setTranslate(e))}),a.core.$outer.find(".lg-thumb").on("touchend.lg",function(){a.thumbTotalWidth>a.thumbOuterWidth&&d?(d=!1,a.$thumbOuter.removeClass("lg-dragging"),Math.abs(c-b)<a.core.s.swipeThreshold&&(a.thumbClickable=!0),a.left=e):a.thumbClickable=!0})},c.prototype.toogle=function(){var a=this;a.core.s.toogleThumb&&(a.core.$outer.addClass("lg-can-toggle"),a.$thumbOuter.append('<span class="lg-toogle-thumb lg-icon"></span>'),a.core.$outer.find(".lg-toogle-thumb").on("click.lg",function(){a.core.$outer.toggleClass("lg-thumb-open")}))},c.prototype.thumbkeyPress=function(){var b=this;a(window).on("keydown.lg.thumb",function(a){38===a.keyCode?(a.preventDefault(),b.core.$outer.addClass("lg-thumb-open")):40===a.keyCode&&(a.preventDefault(),b.core.$outer.removeClass("lg-thumb-open"))})},c.prototype.destroy=function(){this.core.s.thumbnail&&this.core.$items.length>1&&(a(window).off("resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb"),this.$thumbOuter.remove(),this.core.$outer.removeClass("lg-has-thumb"))},a.fn.lightGallery.modules.Thumbnail=c}()});
@@ -1,342 +0,0 @@
1
- /*! lg-video - v1.2.2 - 2018-05-01
2
- * http://sachinchoolur.github.io/lightGallery
3
- * Copyright (c) 2018 Sachin N; Licensed GPLv3 */
4
-
5
- (function (root, factory) {
6
- if (typeof define === 'function' && define.amd) {
7
- // AMD. Register as an anonymous module unless amdModuleId is set
8
- define(['jquery'], function (a0) {
9
- return (factory(a0));
10
- });
11
- } else if (typeof module === 'object' && module.exports) {
12
- // Node. Does not work with strict CommonJS, but
13
- // only CommonJS-like environments that support module.exports,
14
- // like Node.
15
- module.exports = factory(require('jquery'));
16
- } else {
17
- factory(root["jQuery"]);
18
- }
19
- }(this, function ($) {
20
-
21
- (function() {
22
-
23
- 'use strict';
24
-
25
- var defaults = {
26
- videoMaxWidth: '855px',
27
-
28
- autoplayFirstVideo: true,
29
-
30
- youtubePlayerParams: false,
31
- vimeoPlayerParams: false,
32
- dailymotionPlayerParams: false,
33
- vkPlayerParams: false,
34
-
35
- videojs: false,
36
- videojsOptions: {}
37
- };
38
-
39
- var Video = function(element) {
40
-
41
- this.core = $(element).data('lightGallery');
42
-
43
- this.$el = $(element);
44
- this.core.s = $.extend({}, defaults, this.core.s);
45
- this.videoLoaded = false;
46
-
47
- this.init();
48
-
49
- return this;
50
- };
51
-
52
- Video.prototype.init = function() {
53
- var _this = this;
54
-
55
- // Event triggered when video url found without poster
56
- _this.core.$el.on('hasVideo.lg.tm', onHasVideo.bind(this));
57
-
58
- // Set max width for video
59
- _this.core.$el.on('onAferAppendSlide.lg.tm', onAferAppendSlide.bind(this));
60
-
61
- if (_this.core.doCss() && (_this.core.$items.length > 1) && (_this.core.s.enableSwipe || _this.core.s.enableDrag)) {
62
- _this.core.$el.on('onSlideClick.lg.tm', function() {
63
- var $el = _this.core.$slide.eq(_this.core.index);
64
- _this.loadVideoOnclick($el);
65
- });
66
- } else {
67
-
68
- // For IE 9 and bellow
69
- _this.core.$slide.on('click.lg', function() {
70
- _this.loadVideoOnclick($(this));
71
- });
72
- }
73
-
74
- _this.core.$el.on('onBeforeSlide.lg.tm', onBeforeSlide.bind(this));
75
-
76
- _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex) {
77
- _this.core.$slide.eq(prevIndex).removeClass('lg-video-playing');
78
- });
79
-
80
- if (_this.core.s.autoplayFirstVideo) {
81
- _this.core.$el.on('onAferAppendSlide.lg.tm', function (e, index) {
82
- if (!_this.core.lGalleryOn) {
83
- var $el = _this.core.$slide.eq(index);
84
- setTimeout(function () {
85
- _this.loadVideoOnclick($el);
86
- }, 100);
87
- }
88
- });
89
- }
90
- };
91
-
92
- Video.prototype.loadVideo = function(src, addClass, noPoster, index, html) {
93
- var video = '';
94
- var autoplay = 1;
95
- var a = '';
96
- var isVideo = this.core.isVideo(src, index) || {};
97
-
98
- // Enable autoplay based on setting for first video if poster doesn't exist
99
- if (noPoster) {
100
- if (this.videoLoaded) {
101
- autoplay = 0;
102
- } else {
103
- autoplay = this.core.s.autoplayFirstVideo ? 1 : 0;
104
- }
105
- }
106
-
107
- if (isVideo.youtube) {
108
-
109
- a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1';
110
- if (this.core.s.youtubePlayerParams) {
111
- a = a + '&' + $.param(this.core.s.youtubePlayerParams);
112
- }
113
-
114
- video = '<iframe class="lg-video-object lg-youtube ' + addClass + '" width="560" height="315" src="//www.youtube.com/embed/' + isVideo.youtube[1] + a + '" frameborder="0" allowfullscreen></iframe>';
115
-
116
- } else if (isVideo.vimeo) {
117
-
118
- a = '?autoplay=' + autoplay + '&api=1';
119
- if (this.core.s.vimeoPlayerParams) {
120
- a = a + '&' + $.param(this.core.s.vimeoPlayerParams);
121
- }
122
-
123
- video = '<iframe class="lg-video-object lg-vimeo ' + addClass + '" width="560" height="315" src="//player.vimeo.com/video/' + isVideo.vimeo[1] + a + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
124
-
125
- } else if (isVideo.dailymotion) {
126
-
127
- a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage';
128
- if (this.core.s.dailymotionPlayerParams) {
129
- a = a + '&' + $.param(this.core.s.dailymotionPlayerParams);
130
- }
131
-
132
- video = '<iframe class="lg-video-object lg-dailymotion ' + addClass + '" width="560" height="315" src="//www.dailymotion.com/embed/video/' + isVideo.dailymotion[1] + a + '" frameborder="0" allowfullscreen></iframe>';
133
-
134
- } else if (isVideo.html5) {
135
- var fL = html.substring(0, 1);
136
- if (fL === '.' || fL === '#') {
137
- html = $(html).html();
138
- }
139
-
140
- video = html;
141
-
142
- } else if (isVideo.vk) {
143
-
144
- a = '&autoplay=' + autoplay;
145
- if (this.core.s.vkPlayerParams) {
146
- a = a + '&' + $.param(this.core.s.vkPlayerParams);
147
- }
148
-
149
- video = '<iframe class="lg-video-object lg-vk ' + addClass + '" width="560" height="315" src="//vk.com/video_ext.php?' + isVideo.vk[1] + a + '" frameborder="0" allowfullscreen></iframe>';
150
-
151
- }
152
-
153
- return video;
154
- };
155
-
156
- Video.prototype.loadVideoOnclick = function($el){
157
-
158
- var _this = this;
159
- // check slide has poster
160
- if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) {
161
-
162
- // check already video element present
163
- if (!$el.hasClass('lg-has-video')) {
164
-
165
- $el.addClass('lg-video-playing lg-has-video');
166
-
167
- var _src;
168
- var _html;
169
- var _loadVideo = function(_src, _html) {
170
-
171
- $el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html));
172
-
173
- if (_html) {
174
- if (_this.core.s.videojs) {
175
- try {
176
- videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() {
177
- this.play();
178
- });
179
- } catch (e) {
180
- console.error('Make sure you have included videojs');
181
- }
182
- } else {
183
- _this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play();
184
- }
185
- }
186
-
187
- };
188
-
189
- if (_this.core.s.dynamic) {
190
-
191
- _src = _this.core.s.dynamicEl[_this.core.index].src;
192
- _html = _this.core.s.dynamicEl[_this.core.index].html;
193
-
194
- _loadVideo(_src, _html);
195
-
196
- } else {
197
-
198
- _src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src');
199
- _html = _this.core.$items.eq(_this.core.index).attr('data-html');
200
-
201
- _loadVideo(_src, _html);
202
-
203
- }
204
-
205
- var $tempImg = $el.find('.lg-object');
206
- $el.find('.lg-video').append($tempImg);
207
-
208
- // @todo loading icon for html5 videos also
209
- // for showing the loading indicator while loading video
210
- if (!$el.find('.lg-video-object').hasClass('lg-html5')) {
211
- $el.removeClass('lg-complete');
212
- $el.find('.lg-video-object').on('load.lg error.lg', function() {
213
- $el.addClass('lg-complete');
214
- });
215
- }
216
-
217
- } else {
218
-
219
- var youtubePlayer = $el.find('.lg-youtube').get(0);
220
- var vimeoPlayer = $el.find('.lg-vimeo').get(0);
221
- var dailymotionPlayer = $el.find('.lg-dailymotion').get(0);
222
- var html5Player = $el.find('.lg-html5').get(0);
223
- if (youtubePlayer) {
224
- youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
225
- } else if (vimeoPlayer) {
226
- try {
227
- $f(vimeoPlayer).api('play');
228
- } catch (e) {
229
- console.error('Make sure you have included froogaloop2 js');
230
- }
231
- } else if (dailymotionPlayer) {
232
- dailymotionPlayer.contentWindow.postMessage('play', '*');
233
-
234
- } else if (html5Player) {
235
- if (_this.core.s.videojs) {
236
- try {
237
- videojs(html5Player).play();
238
- } catch (e) {
239
- console.error('Make sure you have included videojs');
240
- }
241
- } else {
242
- html5Player.play();
243
- }
244
- }
245
-
246
- $el.addClass('lg-video-playing');
247
-
248
- }
249
- }
250
- };
251
-
252
- Video.prototype.destroy = function() {
253
- this.videoLoaded = false;
254
- };
255
-
256
- function onHasVideo(event, index, src, html) {
257
- /*jshint validthis:true */
258
- var _this = this;
259
- _this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html));
260
- if (html) {
261
- if (_this.core.s.videojs) {
262
- try {
263
- videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() {
264
- if (!_this.videoLoaded && _this.core.s.autoplayFirstVideo) {
265
- this.play();
266
- }
267
- });
268
- } catch (e) {
269
- console.error('Make sure you have included videojs');
270
- }
271
- } else {
272
- if(!_this.videoLoaded && _this.core.s.autoplayFirstVideo) {
273
- _this.core.$slide.eq(index).find('.lg-html5').get(0).play();
274
- }
275
- }
276
- }
277
- }
278
-
279
- function onAferAppendSlide(event, index) {
280
- /*jshint validthis:true */
281
- var $videoCont = this.core.$slide.eq(index).find('.lg-video-cont');
282
- if (!$videoCont.hasClass('lg-has-iframe')) {
283
- $videoCont.css('max-width', this.core.s.videoMaxWidth);
284
- this.videoLoaded = true;
285
- }
286
- }
287
-
288
- function onBeforeSlide(event, prevIndex, index) {
289
- /*jshint validthis:true */
290
- var _this = this;
291
-
292
- var $videoSlide = _this.core.$slide.eq(prevIndex);
293
- var youtubePlayer = $videoSlide.find('.lg-youtube').get(0);
294
- var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0);
295
- var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0);
296
- var vkPlayer = $videoSlide.find('.lg-vk').get(0);
297
- var html5Player = $videoSlide.find('.lg-html5').get(0);
298
- if (youtubePlayer) {
299
- youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
300
- } else if (vimeoPlayer) {
301
- try {
302
- $f(vimeoPlayer).api('pause');
303
- } catch (e) {
304
- console.error('Make sure you have included froogaloop2 js');
305
- }
306
- } else if (dailymotionPlayer) {
307
- dailymotionPlayer.contentWindow.postMessage('pause', '*');
308
-
309
- } else if (html5Player) {
310
- if (_this.core.s.videojs) {
311
- try {
312
- videojs(html5Player).pause();
313
- } catch (e) {
314
- console.error('Make sure you have included videojs');
315
- }
316
- } else {
317
- html5Player.pause();
318
- }
319
- } if (vkPlayer) {
320
- $(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay'));
321
- }
322
-
323
- var _src;
324
- if (_this.core.s.dynamic) {
325
- _src = _this.core.s.dynamicEl[index].src;
326
- } else {
327
- _src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src');
328
-
329
- }
330
-
331
- var _isVideo = _this.core.isVideo(_src, index) || {};
332
- if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) {
333
- _this.core.$outer.addClass('lg-hide-download');
334
- }
335
-
336
- }
337
-
338
- $.fn.lightGallery.modules.video = Video;
339
-
340
- })();
341
-
342
- }));
@@ -1,5 +0,0 @@
1
- /*! lg-video - v1.2.2 - 2018-05-01
2
- * http://sachinchoolur.github.io/lightGallery
3
- * Copyright (c) 2018 Sachin N; Licensed GPLv3 */
4
-
5
- !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(){"use strict";function b(a,b,c,d){var e=this;if(e.core.$slide.eq(b).find(".lg-video").append(e.loadVideo(c,"lg-object",!0,b,d)),d)if(e.core.s.videojs)try{videojs(e.core.$slide.eq(b).find(".lg-html5").get(0),e.core.s.videojsOptions,function(){!e.videoLoaded&&e.core.s.autoplayFirstVideo&&this.play()})}catch(a){console.error("Make sure you have included videojs")}else!e.videoLoaded&&e.core.s.autoplayFirstVideo&&e.core.$slide.eq(b).find(".lg-html5").get(0).play()}function c(a,b){var c=this.core.$slide.eq(b).find(".lg-video-cont");c.hasClass("lg-has-iframe")||(c.css("max-width",this.core.s.videoMaxWidth),this.videoLoaded=!0)}function d(b,c,d){var e=this,f=e.core.$slide.eq(c),g=f.find(".lg-youtube").get(0),h=f.find(".lg-vimeo").get(0),i=f.find(".lg-dailymotion").get(0),j=f.find(".lg-vk").get(0),k=f.find(".lg-html5").get(0);if(g)g.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*");else if(h)try{$f(h).api("pause")}catch(a){console.error("Make sure you have included froogaloop2 js")}else if(i)i.contentWindow.postMessage("pause","*");else if(k)if(e.core.s.videojs)try{videojs(k).pause()}catch(a){console.error("Make sure you have included videojs")}else k.pause();j&&a(j).attr("src",a(j).attr("src").replace("&autoplay","&noplay"));var l;l=e.core.s.dynamic?e.core.s.dynamicEl[d].src:e.core.$items.eq(d).attr("href")||e.core.$items.eq(d).attr("data-src");var m=e.core.isVideo(l,d)||{};(m.youtube||m.vimeo||m.dailymotion||m.vk)&&e.core.$outer.addClass("lg-hide-download")}var e={videoMaxWidth:"855px",autoplayFirstVideo:!0,youtubePlayerParams:!1,vimeoPlayerParams:!1,dailymotionPlayerParams:!1,vkPlayerParams:!1,videojs:!1,videojsOptions:{}},f=function(b){return this.core=a(b).data("lightGallery"),this.$el=a(b),this.core.s=a.extend({},e,this.core.s),this.videoLoaded=!1,this.init(),this};f.prototype.init=function(){var e=this;e.core.$el.on("hasVideo.lg.tm",b.bind(this)),e.core.$el.on("onAferAppendSlide.lg.tm",c.bind(this)),e.core.doCss()&&e.core.$items.length>1&&(e.core.s.enableSwipe||e.core.s.enableDrag)?e.core.$el.on("onSlideClick.lg.tm",function(){var a=e.core.$slide.eq(e.core.index);e.loadVideoOnclick(a)}):e.core.$slide.on("click.lg",function(){e.loadVideoOnclick(a(this))}),e.core.$el.on("onBeforeSlide.lg.tm",d.bind(this)),e.core.$el.on("onAfterSlide.lg.tm",function(a,b){e.core.$slide.eq(b).removeClass("lg-video-playing")}),e.core.s.autoplayFirstVideo&&e.core.$el.on("onAferAppendSlide.lg.tm",function(a,b){if(!e.core.lGalleryOn){var c=e.core.$slide.eq(b);setTimeout(function(){e.loadVideoOnclick(c)},100)}})},f.prototype.loadVideo=function(b,c,d,e,f){var g="",h=1,i="",j=this.core.isVideo(b,e)||{};if(d&&(h=this.videoLoaded?0:this.core.s.autoplayFirstVideo?1:0),j.youtube)i="?wmode=opaque&autoplay="+h+"&enablejsapi=1",this.core.s.youtubePlayerParams&&(i=i+"&"+a.param(this.core.s.youtubePlayerParams)),g='<iframe class="lg-video-object lg-youtube '+c+'" width="560" height="315" src="//www.youtube.com/embed/'+j.youtube[1]+i+'" frameborder="0" allowfullscreen></iframe>';else if(j.vimeo)i="?autoplay="+h+"&api=1",this.core.s.vimeoPlayerParams&&(i=i+"&"+a.param(this.core.s.vimeoPlayerParams)),g='<iframe class="lg-video-object lg-vimeo '+c+'" width="560" height="315" src="//player.vimeo.com/video/'+j.vimeo[1]+i+'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';else if(j.dailymotion)i="?wmode=opaque&autoplay="+h+"&api=postMessage",this.core.s.dailymotionPlayerParams&&(i=i+"&"+a.param(this.core.s.dailymotionPlayerParams)),g='<iframe class="lg-video-object lg-dailymotion '+c+'" width="560" height="315" src="//www.dailymotion.com/embed/video/'+j.dailymotion[1]+i+'" frameborder="0" allowfullscreen></iframe>';else if(j.html5){var k=f.substring(0,1);"."!==k&&"#"!==k||(f=a(f).html()),g=f}else j.vk&&(i="&autoplay="+h,this.core.s.vkPlayerParams&&(i=i+"&"+a.param(this.core.s.vkPlayerParams)),g='<iframe class="lg-video-object lg-vk '+c+'" width="560" height="315" src="//vk.com/video_ext.php?'+j.vk[1]+i+'" frameborder="0" allowfullscreen></iframe>');return g},f.prototype.loadVideoOnclick=function(a){var b=this;if(a.find(".lg-object").hasClass("lg-has-poster")&&a.find(".lg-object").is(":visible"))if(a.hasClass("lg-has-video")){var c=a.find(".lg-youtube").get(0),d=a.find(".lg-vimeo").get(0),e=a.find(".lg-dailymotion").get(0),f=a.find(".lg-html5").get(0);if(c)c.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*");else if(d)try{$f(d).api("play")}catch(a){console.error("Make sure you have included froogaloop2 js")}else if(e)e.contentWindow.postMessage("play","*");else if(f)if(b.core.s.videojs)try{videojs(f).play()}catch(a){console.error("Make sure you have included videojs")}else f.play();a.addClass("lg-video-playing")}else{a.addClass("lg-video-playing lg-has-video");var g,h,i=function(c,d){if(a.find(".lg-video").append(b.loadVideo(c,"",!1,b.core.index,d)),d)if(b.core.s.videojs)try{videojs(b.core.$slide.eq(b.core.index).find(".lg-html5").get(0),b.core.s.videojsOptions,function(){this.play()})}catch(a){console.error("Make sure you have included videojs")}else b.core.$slide.eq(b.core.index).find(".lg-html5").get(0).play()};b.core.s.dynamic?(g=b.core.s.dynamicEl[b.core.index].src,h=b.core.s.dynamicEl[b.core.index].html,i(g,h)):(g=b.core.$items.eq(b.core.index).attr("href")||b.core.$items.eq(b.core.index).attr("data-src"),h=b.core.$items.eq(b.core.index).attr("data-html"),i(g,h));var j=a.find(".lg-object");a.find(".lg-video").append(j),a.find(".lg-video-object").hasClass("lg-html5")||(a.removeClass("lg-complete"),a.find(".lg-video-object").on("load.lg error.lg",function(){a.addClass("lg-complete")}))}},f.prototype.destroy=function(){this.videoLoaded=!1},a.fn.lightGallery.modules.video=f}()});
@@ -1,527 +0,0 @@
1
- /*! lg-zoom - v1.1.0 - 2017-08-08
2
- * http://sachinchoolur.github.io/lightGallery
3
- * Copyright (c) 2017 Sachin N; Licensed GPLv3 */
4
-
5
- (function (root, factory) {
6
- if (typeof define === 'function' && define.amd) {
7
- // AMD. Register as an anonymous module unless amdModuleId is set
8
- define(['jquery'], function (a0) {
9
- return (factory(a0));
10
- });
11
- } else if (typeof exports === 'object') {
12
- // Node. Does not work with strict CommonJS, but
13
- // only CommonJS-like environments that support module.exports,
14
- // like Node.
15
- module.exports = factory(require('jquery'));
16
- } else {
17
- factory(jQuery);
18
- }
19
- }(this, function ($) {
20
-
21
- (function() {
22
-
23
- 'use strict';
24
-
25
- var getUseLeft = function() {
26
- var useLeft = false;
27
- var isChrome = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
28
- if (isChrome && parseInt(isChrome[2], 10) < 54) {
29
- useLeft = true;
30
- }
31
-
32
- return useLeft;
33
- };
34
-
35
- var defaults = {
36
- scale: 1,
37
- zoom: true,
38
- actualSize: true,
39
- enableZoomAfter: 300,
40
- useLeftForZoom: getUseLeft()
41
- };
42
-
43
- var Zoom = function(element) {
44
-
45
- this.core = $(element).data('lightGallery');
46
-
47
- this.core.s = $.extend({}, defaults, this.core.s);
48
-
49
- if (this.core.s.zoom && this.core.doCss()) {
50
- this.init();
51
-
52
- // Store the zoomable timeout value just to clear it while closing
53
- this.zoomabletimeout = false;
54
-
55
- // Set the initial value center
56
- this.pageX = $(window).width() / 2;
57
- this.pageY = ($(window).height() / 2) + $(window).scrollTop();
58
- }
59
-
60
- return this;
61
- };
62
-
63
- Zoom.prototype.init = function() {
64
-
65
- var _this = this;
66
- var zoomIcons = '<span id="lg-zoom-in" class="lg-icon"></span><span id="lg-zoom-out" class="lg-icon"></span>';
67
-
68
- if (_this.core.s.actualSize) {
69
- zoomIcons += '<span id="lg-actual-size" class="lg-icon"></span>';
70
- }
71
-
72
- if (_this.core.s.useLeftForZoom) {
73
- _this.core.$outer.addClass('lg-use-left-for-zoom');
74
- } else {
75
- _this.core.$outer.addClass('lg-use-transition-for-zoom');
76
- }
77
-
78
- this.core.$outer.find('.lg-toolbar').append(zoomIcons);
79
-
80
- // Add zoomable class
81
- _this.core.$el.on('onSlideItemLoad.lg.tm.zoom', function(event, index, delay) {
82
-
83
- // delay will be 0 except first time
84
- var _speed = _this.core.s.enableZoomAfter + delay;
85
-
86
- // set _speed value 0 if gallery opened from direct url and if it is first slide
87
- if ($('body').hasClass('lg-from-hash') && delay) {
88
-
89
- // will execute only once
90
- _speed = 0;
91
- } else {
92
-
93
- // Remove lg-from-hash to enable starting animation.
94
- $('body').removeClass('lg-from-hash');
95
- }
96
-
97
- _this.zoomabletimeout = setTimeout(function() {
98
- _this.core.$slide.eq(index).addClass('lg-zoomable');
99
- }, _speed + 30);
100
- });
101
-
102
- var scale = 1;
103
- /**
104
- * @desc Image zoom
105
- * Translate the wrap and scale the image to get better user experience
106
- *
107
- * @param {String} scaleVal - Zoom decrement/increment value
108
- */
109
- var zoom = function(scaleVal) {
110
-
111
- var $image = _this.core.$outer.find('.lg-current .lg-image');
112
- var _x;
113
- var _y;
114
-
115
- // Find offset manually to avoid issue after zoom
116
- var offsetX = ($(window).width() - $image.prop('offsetWidth')) / 2;
117
- var offsetY = (($(window).height() - $image.prop('offsetHeight')) / 2) + $(window).scrollTop();
118
-
119
- _x = _this.pageX - offsetX;
120
- _y = _this.pageY - offsetY;
121
-
122
- var x = (scaleVal - 1) * (_x);
123
- var y = (scaleVal - 1) * (_y);
124
-
125
- $image.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal);
126
-
127
- if (_this.core.s.useLeftForZoom) {
128
- $image.parent().css({
129
- left: -x + 'px',
130
- top: -y + 'px'
131
- }).attr('data-x', x).attr('data-y', y);
132
- } else {
133
- $image.parent().css('transform', 'translate3d(-' + x + 'px, -' + y + 'px, 0)').attr('data-x', x).attr('data-y', y);
134
- }
135
- };
136
-
137
- var callScale = function() {
138
- if (scale > 1) {
139
- _this.core.$outer.addClass('lg-zoomed');
140
- } else {
141
- _this.resetZoom();
142
- }
143
-
144
- if (scale < 1) {
145
- scale = 1;
146
- }
147
-
148
- zoom(scale);
149
- };
150
-
151
- var actualSize = function(event, $image, index, fromIcon) {
152
- var w = $image.prop('offsetWidth');
153
- var nw;
154
- if (_this.core.s.dynamic) {
155
- nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w;
156
- } else {
157
- nw = _this.core.$items.eq(index).attr('data-width') || $image[0].naturalWidth || w;
158
- }
159
-
160
- var _scale;
161
-
162
- if (_this.core.$outer.hasClass('lg-zoomed')) {
163
- scale = 1;
164
- } else {
165
- if (nw > w) {
166
- _scale = nw / w;
167
- scale = _scale || 2;
168
- }
169
- }
170
-
171
- if (fromIcon) {
172
- _this.pageX = $(window).width() / 2;
173
- _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
174
- } else {
175
- _this.pageX = event.pageX || event.originalEvent.targetTouches[0].pageX;
176
- _this.pageY = event.pageY || event.originalEvent.targetTouches[0].pageY;
177
- }
178
-
179
- callScale();
180
- setTimeout(function() {
181
- _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
182
- }, 10);
183
- };
184
-
185
- var tapped = false;
186
-
187
- // event triggered after appending slide content
188
- _this.core.$el.on('onAferAppendSlide.lg.tm.zoom', function(event, index) {
189
-
190
- // Get the current element
191
- var $image = _this.core.$slide.eq(index).find('.lg-image');
192
-
193
- $image.on('dblclick', function(event) {
194
- actualSize(event, $image, index);
195
- });
196
-
197
- $image.on('touchstart', function(event) {
198
- if (!tapped) {
199
- tapped = setTimeout(function() {
200
- tapped = null;
201
- }, 300);
202
- } else {
203
- clearTimeout(tapped);
204
- tapped = null;
205
- actualSize(event, $image, index);
206
- }
207
-
208
- event.preventDefault();
209
- });
210
-
211
- });
212
-
213
- // Update zoom on resize and orientationchange
214
- $(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom', function() {
215
- _this.pageX = $(window).width() / 2;
216
- _this.pageY = ($(window).height() / 2) + $(window).scrollTop();
217
- zoom(scale);
218
- });
219
-
220
- $('#lg-zoom-out').on('click.lg', function() {
221
- if (_this.core.$outer.find('.lg-current .lg-image').length) {
222
- scale -= _this.core.s.scale;
223
- callScale();
224
- }
225
- });
226
-
227
- $('#lg-zoom-in').on('click.lg', function() {
228
- if (_this.core.$outer.find('.lg-current .lg-image').length) {
229
- scale += _this.core.s.scale;
230
- callScale();
231
- }
232
- });
233
-
234
- $('#lg-actual-size').on('click.lg', function(event) {
235
- actualSize(event, _this.core.$slide.eq(_this.core.index).find('.lg-image'), _this.core.index, true);
236
- });
237
-
238
- // Reset zoom on slide change
239
- _this.core.$el.on('onBeforeSlide.lg.tm', function() {
240
- scale = 1;
241
- _this.resetZoom();
242
- });
243
-
244
- // Drag option after zoom
245
- _this.zoomDrag();
246
-
247
- _this.zoomSwipe();
248
-
249
- };
250
-
251
- // Reset zoom effect
252
- Zoom.prototype.resetZoom = function() {
253
- this.core.$outer.removeClass('lg-zoomed');
254
- this.core.$slide.find('.lg-img-wrap').removeAttr('style data-x data-y');
255
- this.core.$slide.find('.lg-image').removeAttr('style data-scale');
256
-
257
- // Reset pagx pagy values to center
258
- this.pageX = $(window).width() / 2;
259
- this.pageY = ($(window).height() / 2) + $(window).scrollTop();
260
- };
261
-
262
- Zoom.prototype.zoomSwipe = function() {
263
- var _this = this;
264
- var startCoords = {};
265
- var endCoords = {};
266
- var isMoved = false;
267
-
268
- // Allow x direction drag
269
- var allowX = false;
270
-
271
- // Allow Y direction drag
272
- var allowY = false;
273
-
274
- _this.core.$slide.on('touchstart.lg', function(e) {
275
-
276
- if (_this.core.$outer.hasClass('lg-zoomed')) {
277
- var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
278
-
279
- allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
280
- allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
281
- if ((allowX || allowY)) {
282
- e.preventDefault();
283
- startCoords = {
284
- x: e.originalEvent.targetTouches[0].pageX,
285
- y: e.originalEvent.targetTouches[0].pageY
286
- };
287
- }
288
- }
289
-
290
- });
291
-
292
- _this.core.$slide.on('touchmove.lg', function(e) {
293
-
294
- if (_this.core.$outer.hasClass('lg-zoomed')) {
295
-
296
- var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
297
- var distanceX;
298
- var distanceY;
299
-
300
- e.preventDefault();
301
- isMoved = true;
302
-
303
- endCoords = {
304
- x: e.originalEvent.targetTouches[0].pageX,
305
- y: e.originalEvent.targetTouches[0].pageY
306
- };
307
-
308
- // reset opacity and transition duration
309
- _this.core.$outer.addClass('lg-zoom-dragging');
310
-
311
- if (allowY) {
312
- distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
313
- } else {
314
- distanceY = -Math.abs(_$el.attr('data-y'));
315
- }
316
-
317
- if (allowX) {
318
- distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
319
- } else {
320
- distanceX = -Math.abs(_$el.attr('data-x'));
321
- }
322
-
323
- if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
324
-
325
- if (_this.core.s.useLeftForZoom) {
326
- _$el.css({
327
- left: distanceX + 'px',
328
- top: distanceY + 'px'
329
- });
330
- } else {
331
- _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
332
- }
333
- }
334
-
335
- }
336
-
337
- });
338
-
339
- _this.core.$slide.on('touchend.lg', function() {
340
- if (_this.core.$outer.hasClass('lg-zoomed')) {
341
- if (isMoved) {
342
- isMoved = false;
343
- _this.core.$outer.removeClass('lg-zoom-dragging');
344
- _this.touchendZoom(startCoords, endCoords, allowX, allowY);
345
-
346
- }
347
- }
348
- });
349
-
350
- };
351
-
352
- Zoom.prototype.zoomDrag = function() {
353
-
354
- var _this = this;
355
- var startCoords = {};
356
- var endCoords = {};
357
- var isDraging = false;
358
- var isMoved = false;
359
-
360
- // Allow x direction drag
361
- var allowX = false;
362
-
363
- // Allow Y direction drag
364
- var allowY = false;
365
-
366
- _this.core.$slide.on('mousedown.lg.zoom', function(e) {
367
-
368
- // execute only on .lg-object
369
- var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
370
-
371
- allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height();
372
- allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width();
373
-
374
- if (_this.core.$outer.hasClass('lg-zoomed')) {
375
- if ($(e.target).hasClass('lg-object') && (allowX || allowY)) {
376
- e.preventDefault();
377
- startCoords = {
378
- x: e.pageX,
379
- y: e.pageY
380
- };
381
-
382
- isDraging = true;
383
-
384
- // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
385
- _this.core.$outer.scrollLeft += 1;
386
- _this.core.$outer.scrollLeft -= 1;
387
-
388
- _this.core.$outer.removeClass('lg-grab').addClass('lg-grabbing');
389
- }
390
- }
391
- });
392
-
393
- $(window).on('mousemove.lg.zoom', function(e) {
394
- if (isDraging) {
395
- var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
396
- var distanceX;
397
- var distanceY;
398
-
399
- isMoved = true;
400
- endCoords = {
401
- x: e.pageX,
402
- y: e.pageY
403
- };
404
-
405
- // reset opacity and transition duration
406
- _this.core.$outer.addClass('lg-zoom-dragging');
407
-
408
- if (allowY) {
409
- distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
410
- } else {
411
- distanceY = -Math.abs(_$el.attr('data-y'));
412
- }
413
-
414
- if (allowX) {
415
- distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
416
- } else {
417
- distanceX = -Math.abs(_$el.attr('data-x'));
418
- }
419
-
420
- if (_this.core.s.useLeftForZoom) {
421
- _$el.css({
422
- left: distanceX + 'px',
423
- top: distanceY + 'px'
424
- });
425
- } else {
426
- _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
427
- }
428
- }
429
- });
430
-
431
- $(window).on('mouseup.lg.zoom', function(e) {
432
-
433
- if (isDraging) {
434
- isDraging = false;
435
- _this.core.$outer.removeClass('lg-zoom-dragging');
436
-
437
- // Fix for chrome mouse move on click
438
- if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) {
439
- endCoords = {
440
- x: e.pageX,
441
- y: e.pageY
442
- };
443
- _this.touchendZoom(startCoords, endCoords, allowX, allowY);
444
-
445
- }
446
-
447
- isMoved = false;
448
- }
449
-
450
- _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab');
451
-
452
- });
453
- };
454
-
455
- Zoom.prototype.touchendZoom = function(startCoords, endCoords, allowX, allowY) {
456
-
457
- var _this = this;
458
- var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap');
459
- var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object');
460
- var distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x);
461
- var distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y);
462
- var minY = (_this.core.$outer.find('.lg').height() - $image.prop('offsetHeight')) / 2;
463
- var maxY = Math.abs(($image.prop('offsetHeight') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').height() + minY);
464
- var minX = (_this.core.$outer.find('.lg').width() - $image.prop('offsetWidth')) / 2;
465
- var maxX = Math.abs(($image.prop('offsetWidth') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').width() + minX);
466
-
467
- if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) {
468
- if (allowY) {
469
- if (distanceY <= -maxY) {
470
- distanceY = -maxY;
471
- } else if (distanceY >= -minY) {
472
- distanceY = -minY;
473
- }
474
- }
475
-
476
- if (allowX) {
477
- if (distanceX <= -maxX) {
478
- distanceX = -maxX;
479
- } else if (distanceX >= -minX) {
480
- distanceX = -minX;
481
- }
482
- }
483
-
484
- if (allowY) {
485
- _$el.attr('data-y', Math.abs(distanceY));
486
- } else {
487
- distanceY = -Math.abs(_$el.attr('data-y'));
488
- }
489
-
490
- if (allowX) {
491
- _$el.attr('data-x', Math.abs(distanceX));
492
- } else {
493
- distanceX = -Math.abs(_$el.attr('data-x'));
494
- }
495
-
496
- if (_this.core.s.useLeftForZoom) {
497
- _$el.css({
498
- left: distanceX + 'px',
499
- top: distanceY + 'px'
500
- });
501
- } else {
502
- _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
503
- }
504
-
505
- }
506
- };
507
-
508
- Zoom.prototype.destroy = function() {
509
-
510
- var _this = this;
511
-
512
- // Unbind all events added by lightGallery zoom plugin
513
- _this.core.$el.off('.lg.zoom');
514
- $(window).off('.lg.zoom');
515
- _this.core.$slide.off('.lg.zoom');
516
- _this.core.$el.off('.lg.tm.zoom');
517
- _this.resetZoom();
518
- clearTimeout(_this.zoomabletimeout);
519
- _this.zoomabletimeout = false;
520
- };
521
-
522
- $.fn.lightGallery.modules.zoom = Zoom;
523
-
524
- })();
525
-
526
-
527
- }));