sbbs/themes/hueman/source/libs/lightgallery/js/lg-thumbnail.min.js

7 lines
9.1 KiB
JavaScript
Raw Permalink Normal View History

2018-09-03 07:41:16 +00:00
/**!
* lg-thumbnail.js | 0.0.4 | August 9th 2016
* http://sachinchoolur.github.io/lg-thumbnail.js
* Copyright (c) 2016 Sachin N;
* @license Apache 2.0
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.LgThumbnail=t()}}(function(){var t,e,i;return function t(e,i,o){function u(s,l){if(!i[s]){if(!e[s]){var h="function"==typeof require&&require;if(!l&&h)return h(s,!0);if(r)return r(s,!0);var n=new Error("Cannot find module '"+s+"'");throw n.code="MODULE_NOT_FOUND",n}var a=i[s]={exports:{}};e[s][0].call(a.exports,function(t){var i=e[s][1][t];return u(i?i:t)},a,a.exports,t,e,i,o)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s<o.length;s++)u(o[s]);return u}({1:[function(e,i,o){!function(e,i){if("function"==typeof t&&t.amd)t([],i);else if("undefined"!=typeof o)i();else{var u={exports:{}};i(),e.lgThumbnail=u.exports}}(this,function(){"use strict";var t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},e={thumbnail:!0,animateThumb:!0,currentPagerPosition:"middle",thumbWidth:100,thumbContHeight:100,thumbMargin:5,exThumbImage:!1,showThumbByDefault:!0,toggleThumb:!0,pullCaptionUp:!0,enableThumbDrag:!0,enableThumbSwipe:!0,swipeThreshold:50,loadYoutubeThumbnail:!0,youtubeThumbSize:1,loadVimeoThumbnail:!0,vimeoThumbSize:"thumbnail_small",loadDailymotionThumbnail:!0},i=function i(o){return this.el=o,this.core=window.lgData[this.el.getAttribute("lg-uid")],this.core.s=t({},e,this.core.s),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.left=0,this.init(),this};i.prototype.init=function(){var t=this;this.core.s.thumbnail&&this.core.items.length>1&&(this.core.s.showThumbByDefault&&setTimeout(function(){utils.addClass(t.core.outer,"lg-thumb-open")},700),this.core.s.pullCaptionUp&&utils.addClass(this.core.outer,"lg-pull-caption-up"),this.build(),this.core.s.animateThumb?(this.core.s.enableThumbDrag&&!this.core.isTouch&&this.core.doCss()&&this.enableThumbDrag(),this.core.s.enableThumbSwipe&&this.core.isTouch&&this.core.doCss()&&this.enableThumbSwipe(),this.thumbClickable=!1):this.thumbClickable=!0,this.toggle(),this.thumbkeyPress())},i.prototype.build=function(){function t(t,u,r){var s=e.core.isVideo(t,r)||{},l,h="";s.youtube||s.vimeo||s.dailymotion?s.youtube?l=e.core.s.loadYoutubeThumbnail?"//img.youtube.com/vi/"+s.youtube[1]+"/"+e.core.s.youtubeThumbSize+".jpg":u:s.vimeo?e.core.s.loadVimeoThumbnail?(l="//i.vimeocdn.com/video/error_"+o+".jpg",h=s.vimeo[1]):l=u:s.dailymotion&&(l=e.core.s.loadDailymotionThumbnail?"//www.dailymotion.com/thumbnail/video/"+s.dailymotion[1]:u):l=u,i+='<div data-vimeo-id="'+h+'" class="lg-thumb-item" style="width:'+e.core.s.thumbWidth+"px; margin-right: "+e.core.s.thumbMargin+'px"><img src="'+l+'" /></div>',h=""}var e=this,i="",o="",u,r='<div class="lg-thumb-outer"><div class="lg-thumb group"></div></div>';switch(this.core.s.vimeoThumbSize){case"thumbnail_large":o="640";break;case"thumbnail_medium":o="200x150";break;case"thumbnail_small":o="100x75"}if(utils.addClass(e.core.outer,"lg-has-thumb"),e.core.outer.querySelector(".lg").insertAdjacentHTML("beforeend",r),e.thumbOuter=e.core.outer.querySelector(".lg-thumb-outer"),e.thumbOuterWidth=e.thumbOuter.offsetWidth,e.core.s.animateThumb&&(e.core.outer.querySelector(".lg-thumb").style.width=e.thumbTotalWidth+"px",e.core.outer.querySelector(".lg-thumb").style.position="relative"),this.core.s.animateThumb&&(e.thumbOuter.style.height=e.core.s.thumbContHeight+"px"),e.core.s.dynamic)for(var s=0;s<e.core.s.dynamicEl.length;s++)t(e.core.s.dynamicEl[s].src,e.core.s.dynamicEl[s].thumb,s);else for(var l=0;l<e.core.items.length;l++)e.core.s.exThumbImage?t(e.core.items[l].getAttribute("href")||e.core.items[l].getAttribute("data-src"),e.core.items[l].getAttribute(e.core.s.exThumbImage),l):t(e.core.items[l].getAttribute("href")||e.core.items[l].getAttribute("data-s