diff --git a/.versions b/.versions new file mode 100644 index 0000000..932cac5 --- /dev/null +++ b/.versions @@ -0,0 +1,5 @@ +aaronroberson:angular-swiper@0.3.0-1 +angular:angular@1.3.15_1 +meteor@1.1.10 +swiper:swiper@3.0.8 +underscore@1.0.4 diff --git a/dist/angular-swiper.js b/dist/angular-swiper.js index e0abf4c..9d086c4 100644 --- a/dist/angular-swiper.js +++ b/dist/angular-swiper.js @@ -1 +1 @@ -!function(e,i,t){"use strict";function n(){for(var e=[],i="0123456789abcdef",t=0;36>t;t++)e[t]=i.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=i.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";var n=e.join("");return n}function r(){return{restrict:"E",transclude:!0,scope:{onReady:"&",slidesPerView:"=",slidesPerColumn:"=",spaceBetween:"=",parallax:"=",parallaxTransition:"@",paginationIsActive:"=",paginationClickable:"=",showNavButtons:"=",loop:"=",autoplay:"=",initialSlide:"=",containerCls:"@",paginationCls:"@",slideCls:"@",direction:"@",swiper:"=",overrideParameters:"="},controller:["$scope","$element","$timeout",function(e,t,r){var a=n();e.swiper_uuid=a;var s={slidesPerView:e.slidesPerView||1,slidesPerColumn:e.slidesPerColumn||1,spaceBetween:e.spaceBetween||0,direction:e.direction||"horizontal",loop:e.loop||!1,initialSlide:e.initialSlide||0,showNavButtons:!1};i.isUndefined(e.autoplay)||"number"!=typeof e.autoplay||(s=i.extend({},s,{autoplay:e.autoplay})),e.paginationIsActive===!0&&(s=i.extend({},s,{paginationClickable:e.paginationClickable||!0,pagination:"#paginator-"+e.swiper_uuid})),e.showNavButtons===!0&&(s.nextButton="#nextButton-"+e.swiper_uuid,s.prevButton="#prevButton-"+e.swiper_uuid),e.overrideParameters&&(s=i.extend({},s,e.overrideParameters));e.containerCls||"";r(function(){var n=null;i.isObject(e.swiper)?(e.swiper=new Swiper(t[0].firstChild,s),n=e.swiper):n=new Swiper(t[0].firstChild,s),i.isUndefined(e.onReady)||e.onReady({swiper:n})})}],link:function(e,t,n){var r=e.swiper_uuid,a="paginator-"+r,s="prevButton-"+r,o="nextButton-"+r,l=t[0];i.element(l.querySelector(".swiper-pagination")).attr("id",a),i.element(l.querySelector(".swiper-button-next")).attr("id",o),i.element(l.querySelector(".swiper-button-prev")).attr("id",s)},template:'
'}}function a(){return{restrict:"E",require:"^ksSwiperContainer",transclude:!0,template:'
',replace:!0}}i.module("ksSwiper",[]).directive("ksSwiperContainer",r).directive("ksSwiperSlide",a)}(window,angular,void 0); \ No newline at end of file +!function(e,i,r){"use strict";function t(){for(var e=[],i="0123456789abcdef",r=0;36>r;r++)e[r]=i.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=i.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";var t=e.join("");return t}function a(){return{restrict:"E",transclude:!0,scope:{onReady:"&",slidesPerView:"=",slidesPerColumn:"=",spaceBetween:"=",parallax:"=",parallaxTransition:"@",paginationIsActive:"=",paginationClickable:"=",showNavButtons:"=",showScrollBar:"=",loop:"=",autoplay:"=",initialSlide:"=",containerCls:"@",wrapperCls:"@",paginationCls:"@",slideCls:"@",direction:"@",swiper:"=",overrideParameters:"="},controller:["$scope","$element","$timeout",function(e,r,a){var n=t();e.swiper_uuid=n;var s={slidesPerView:e.slidesPerView||1,slidesPerColumn:e.slidesPerColumn||1,spaceBetween:e.spaceBetween||0,direction:e.direction||"horizontal",loop:e.loop||!1,initialSlide:e.initialSlide||0,showNavButtons:!1};i.isUndefined(e.autoplay)||"number"!=typeof e.autoplay||(s=i.extend({},s,{autoplay:e.autoplay})),e.paginationIsActive===!0&&(s=i.extend({},s,{paginationClickable:e.paginationClickable||!0,pagination:"#paginator-"+e.swiper_uuid})),e.showNavButtons===!0&&(s.nextButton="#nextButton-"+e.swiper_uuid,s.prevButton="#prevButton-"+e.swiper_uuid),e.showScrollBar===!0&&(s.scrollbar="#scrollBar-"+e.swiper_uuid),e.overrideParameters&&(s=i.extend({},s,e.overrideParameters)),a(function(){var t=null;i.isObject(e.swiper)?(e.swiper=new Swiper(r[0].firstChild,s),t=e.swiper):t=new Swiper(r[0].firstChild,s),i.isUndefined(e.onReady)||e.onReady({swiper:t})})}],link:function(e,r){var t=e.swiper_uuid,a="paginator-"+t,n="prevButton-"+t,s="nextButton-"+t,o="scrollBar-"+t,l=r[0];i.element(l.querySelector(".swiper-pagination")).attr("id",a),i.element(l.querySelector(".swiper-button-next")).attr("id",s),i.element(l.querySelector(".swiper-button-prev")).attr("id",n),i.element(r[0].querySelector(".swiper-scrollbar")).attr("id",o)},template:'
'}}function n(){return{restrict:"E",require:"^ksSwiperContainer",transclude:!0,template:'
',replace:!0}}i.module("ksSwiper",[]).directive("ksSwiperContainer",a).directive("ksSwiperSlide",n)}(window,angular,void 0); \ No newline at end of file diff --git a/package.js b/package.js new file mode 100644 index 0000000..9cd4d18 --- /dev/null +++ b/package.js @@ -0,0 +1,24 @@ +var packageName = 'aaronroberson:angular-swiper'; +var where = 'client'; +var version = '0.3.1'; +var summary = 'Angular directive for iDangero.us Swiper re-packaged for Meteor.'; +var gitLink = 'https://github.com/aaronroberson/angular-swiper'; +var documentationFile = 'README.md'; + +// Meta-data +Package.describe({ + name: packageName, + version: version, + summary: summary, + git: gitLink, + documentation: documentationFile +}); + +Package.onUse(function(api) { + api.versionsFrom(['METEOR@0.9.0', 'METEOR@1.0']); + + api.use('angular:angular@1.3.0', where); + api.use('swiper:swiper@3.0.5', where); + + api.addFiles('dist/angular-swiper.js', where); +}); diff --git a/package.json b/package.json index 6ac2811..a5ec8ba 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "angular-swiper", "version": "0.3.0", "description": "Angular directive for nolimits4web/swiper", - "main": "index.js", + "main": "dist/angular-swiper.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, diff --git a/src/angular-swiper.js b/src/angular-swiper.js index c62540e..e57492e 100644 --- a/src/angular-swiper.js +++ b/src/angular-swiper.js @@ -36,10 +36,12 @@ paginationIsActive: '=', paginationClickable: '=', showNavButtons: '=', + showScrollBar: '=', loop: '=', autoplay: '=', initialSlide: '=', containerCls: '@', + wrapperCls: '@', paginationCls: '@', slideCls: '@', direction: '@', @@ -47,7 +49,6 @@ overrideParameters: '=' }, controller: function($scope, $element, $timeout) { - var self = this; var uuid = createUUID(); $scope.swiper_uuid = uuid; @@ -81,12 +82,14 @@ params.prevButton = '#prevButton-' + $scope.swiper_uuid; } + if ($scope.showScrollBar === true) { + params.scrollbar = '#scrollBar-' + $scope.swiper_uuid; + } + if ($scope.overrideParameters) { params = angular.extend({}, params, $scope.overrideParameters); } - var containerCls = $scope.containerCls || ''; - $timeout(function() { var swiper = null; @@ -106,13 +109,14 @@ }); }, - link: function(scope, element, attrs) { + link: function(scope, element) { var uuid = scope.swiper_uuid; var paginatorId = "paginator-" + uuid; var prevButtonId = "prevButton-" + uuid; var nextButtonId = "nextButton-" + uuid; + var scrollBarId = 'scrollBar-' + uuid; var containerElement = element[0]; @@ -124,14 +128,18 @@ angular.element(containerElement.querySelector('.swiper-button-prev')) .attr('id', prevButtonId); + + angular.element(element[0].querySelector('.swiper-scrollbar')) + .attr('id', scrollBarId); }, template: '
' + '
' + - '
' + + '
' + '
' + '
' + '
' + + '
' + '
' }; }