This repository was archived by the owner on May 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangular-slideshow.min.js
More file actions
1 lines (1 loc) · 3.69 KB
/
angular-slideshow.min.js
File metadata and controls
1 lines (1 loc) · 3.69 KB
1
"use strict";angular.module("iln-slideshow",[]).factory("$IlnSlideshow",["$rootScope",function(e){function i(e){S=e}function n(e){g=e}function t(e,i){return u=e,m=u.length-1,i()}function l(e){return u[e]}function o(){return u}function d(){return S}function r(){return g}function a(){S!==m&&(g=S+1,c(g)),S===m&&(g=0,c(g))}function s(){S!==f&&(g=S-1,c(g)),S===f&&(g=m,c(g))}function c(i){e.$broadcast("IlnSlideshowGoToSlide",i)}var u=[],S=0,g=0,m=0,f=0,p={setSlideData:t,getSlideshowData:o,getSlideData:l,setCurrentSlide:i,setNextSlide:n,getCurrentSlide:d,getNextSlide:r,callNextSlide:a,callPreviousSlide:s,goToSlide:c};return p}]).controller("IlnSlideshowCtrl",["$scope","$compile","$timeout","$rootScope","$IlnSlideshow",function(e,i,n,t,l){var o=!1,d=!0;e.animateSlideCss="",e.init=function(){l.setSlideData(e.SLIDES_JSON().slides,function(){l.goToSlide(0)})},e.nextSlide=function(){l.callNextSlide()},e.previousSlide=function(){l.callPreviousSlide()},e.animateOutCurrentSlide=function(){e.animateSlideCss="iln-slide-animate-out",n(function(){e.animateSlideCss="",e.removeSlide()},1e3)},e.removeSlide=function(){angular.element(document.getElementById("iln-slide-wrap-"+String(l.getCurrentSlide()))).remove(),n(function(){e.animateInNextSlide(l.getNextSlide())},10)},e.animateInNextSlide=function(d){l.setCurrentSlide(d),angular.element(document.getElementById("iln-slide-container")).append(i('<iln-slideshow-slide id="iln-slide-wrap-'+String(l.getCurrentSlide())+'" template-url="'+l.getSlideData(l.getCurrentSlide()).template+'"></iln-slideshow-slide>')(e)),n(function(){o=!1,e.animateSlideCss="iln-slide-animate-in",t.$broadcast("IlnSlideshowTransitionComplete",l.getCurrentSlide())},10)},e.$on("IlnSlideshowGoToSlide",function(i,n){o||(o=!0,d?(d=!1,e.animateInNextSlide(n)):e.animateOutCurrentSlide())}),e.init()}]).controller("IlnSlideshowPaginationCtrl",["$scope","$rootScope","$IlnSlideshow",function(e,i,n){e.slide_data=[],e.current_slide=0,e.init=function(){e.slide_data=n.getSlideshowData()},e.goToSlide=function(i){e.current_slide!==i&&(e.current_slide=i,n.setNextSlide(i),n.goToSlide(i))},e.isActive=function(i){return i<=e.current_slide?"active":""},e.$on("IlnSlideshowTransitionComplete",function(i,n){e.current_slide=n}),e.init()}]).controller("IlnSlideshowSlideCtrl",["$scope",function(e){e.$on("$destroy",function(){console.log("removed")})}]).directive("ilnSlideshow",function(){return{restrict:"E",controller:"IlnSlideshowCtrl",template:'<section id="iln-slideshow"><div id="iln-slide-container" ng-class="animateSlideCss"></div><button id="iln-slide-next" class="nav-arrow" ng-click="nextSlide()"></button><button id="iln-slide-previous" class="nav-arrow" ng-click="previousSlide()"></button><nav id="iln-pagination"><iln-slideshow-pagination></iln-slideshow-pagination></nav></section>',scope:{SLIDES_JSON:"&slideJson"}}}).directive("ilnSlideshowPagination",function(){return{restrict:"E",controller:"IlnSlideshowPaginationCtrl",template:'<ul><li ng-repeat="slide in slide_data" ng-click="goToSlide( $index )" ng-class="isActive( $index )"></li></ul>'}}).directive("ilnSlideshowSlide",function(){return{restrict:"E",controller:"IlnSlideshowSlideCtrl",templateUrl:function(e,i){return i.templateUrl||"slides/slide.html"}}}).directive("ilnImagePreloader",function(){return{restrict:"E",link:function(e,i,n){function t(e){angular.element(document.getElementsByTagName("iln-image-preloader")).append('<div id="iln-img-preload-holder" style="display:none;"></div>');for(var i=0;i<e.length;i++)angular.element(document.getElementById("iln-img-preload-holder")).append('<img src="'+e[i]+'" width="1" height="1"></img>'),i===e.length-1&&angular.element(document.getElementsByTagName("iln-image-preloader")).remove()}e.$watch(n.images,function(e){t(e.images)})}}});