New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-jk-carousel

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-jk-carousel - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

src/app/carousel.exports.js

1

build/scripts/gulp.scripts.js

@@ -25,2 +25,3 @@ (function() {

files.push('src/app/**/*.exports.js');
files.push('src/app/**/*.module.js');

@@ -27,0 +28,0 @@ files.push('src/app/**/*.js');

@@ -0,1 +1,7 @@

/* commonjs package manager support (eg componentjs) */
if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){
module.exports = 'jkAngularCarousel';
}
(function() {

@@ -2,0 +8,0 @@ 'use strict';

2

dist/jk-carousel.min.js

@@ -1,1 +0,1 @@

!function(){"use strict";angular.module("jkAngularCarousel",["jkAngularCarousel.templates"])}(),function(){"use strict";function CarouselController($timeout,$attrs,$interval,$window){var that=this;that.currentIndex=0,that.currentMarginLeftValue=0,that.radioButtonIndex=0,that.transitionsTime=500,that.transitionsEnabled=!0,$attrs.$observe("data",function(){that.onDataChange()}),that.registerElement=function(element){that.element=element,that.elementParent=that.element.parent(),that.slidesContainer=angular.element(that.element.find("div")[0]),$window.addEventListener("resize",function(){that.updateSlidesContainerWidth()})},that.onDataChange=function(){that.data&&0!==that.data.length&&(that.executeCloneData(),$timeout(function(){that.updateSlidesContainerWidth(),that.restartFromFirstItem()}))},that.updateSlidesContainerWidth=function(){that.scaleContent(),that.currentWidth=that.element.prop("offsetWidth"),that.currentHeight=that.element.prop("offsetHeight"),that.resizeSlides();var newSlidesContainerWidth=that.currentWidth*that.cloneData.length;that.slidesContainer.css("width",newSlidesContainerWidth+"px"),that.scaleMarginLeft(newSlidesContainerWidth),that.currentSlidesContainerWidth=newSlidesContainerWidth},that.scaleContent=function(){that.maxWidth=that.maxWidth?parseInt(that.maxWidth):0,0===that.maxWidth&&(that.maxWidth=that.element.prop("offsetWidth")),that.maxHeight=that.maxHeight?parseInt(that.maxHeight):0,0===that.maxHeight&&(that.maxHeight=that.element.prop("offsetHeight"));var currentElementParentWidth=that.elementParent.prop("offsetWidth");if(currentElementParentWidth<that.maxWidth){var newHeight=that.maxHeight*currentElementParentWidth/that.maxWidth;that.element.css("width",currentElementParentWidth+"px"),that.element.css("height",newHeight+"px")}else currentElementParentWidth>=that.maxWidth&&(that.element.css("width",that.maxWidth+"px"),that.element.css("height",that.maxHeight+"px"))},that.resizeSlides=function(){for(var slides=that.element[0].querySelectorAll(".slide"),index=0;index<slides.length;index++){var slide=angular.element(slides[index]);slide.css("width",that.currentWidth+"px"),slide.css("height",that.currentHeight+"px")}},that.scaleMarginLeft=function(newSlidesContainerWidth){that.currentSlidesContainerWidth&&that.currentSlidesContainerWidth!==newSlidesContainerWidth&&(that.currentMarginLeftValue=that.currentMarginLeftValue*newSlidesContainerWidth,that.currentMarginLeftValue=that.currentMarginLeftValue/that.currentSlidesContainerWidth,that.disableTransitions(),that.applyMarginLeft(),that.enableTransitions())},that.restartFromFirstItem=function(){that.currentWidth&&(that.disableTransitions(),that.currentMarginLeftValue=-1*that.currentWidth,that.applyMarginLeft(),that.currentIndex=0,that.radioButtonIndex=that.currentIndex,that.enableTransitions())},that.executeCloneData=function(){for(var cloneArray=[],index=0;index<that.data.length;index++){var item=that.data[index];cloneArray.push(item)}that.cloneFirstItem(cloneArray),that.cloneLastItem(cloneArray),that.cloneData=cloneArray},that.cloneFirstItem=function(cloneArray){var firstItem=cloneArray[0],firstItemClone=angular.copy(firstItem);cloneArray.push(firstItemClone)},that.cloneLastItem=function(cloneArray){var lastItem=cloneArray[that.data.length-1],lastItemClone=angular.copy(lastItem);cloneArray.unshift(lastItemClone)},that.validateAutoSlide=function(){"string"==typeof that.autoSlide&&(that.autoSlide="true"===that.autoSlide?!0:!1),that.autoSlide?that.startAutoSlide():that.stopAutoSlide()},that.validateAutoSlideStopOnAction=function(){"string"==typeof that.autoSlideStopOnAction&&(that.autoSlideStopOnAction="true"===that.autoSlideStopOnAction?!0:!1)},that.restartAutoSlide=function(){that.autoSlide&&(that.transitionsEnabled?$timeout(function(){that.stopAutoSlide(),that.startAutoSlide()},that.transitionsTime):(that.stopAutoSlide(),that.startAutoSlide()))},that.startAutoSlide=function(){angular.isDefined(that.autoSlideInterval)||(that.autoSlideInterval=$interval(function(){that.navigateRight(!0)},that.autoSlideTime))},that.stopAutoSlide=function(){angular.isDefined(that.autoSlideInterval)&&($interval.cancel(that.autoSlideInterval),that.autoSlideInterval=void 0)},that.onNavigateLeft=function(){that.navigateLeft(),that.restartAutoSlide()},that.navigateLeft=function(){that.isDataInvalidOrTooSmall()||(that.currentIndex--,that.radioButtonIndex=that.currentIndex,that.currentMarginLeftValue+=that.currentWidth,that.applyMarginLeft(),that.autoSlideStopOnAction?that.stopAutoSlide():that.restartAutoSlide(),-1===that.currentIndex&&that.restartFromLastItem())},that.restartFromLastItem=function(){$timeout(function(){that.disableTransitions(),that.currentMarginLeftValue=that.currentWidth*that.data.length*-1,that.applyMarginLeft(),that.currentIndex=that.data.length-1,that.radioButtonIndex=that.currentIndex,that.enableTransitions()},that.transitionsTime)},that.onNavigateRight=function(){that.navigateRight(),that.restartAutoSlide()},that.navigateRight=function(autoSlide){that.isDataInvalidOrTooSmall()||(that.currentIndex++,that.radioButtonIndex=that.currentIndex,that.currentMarginLeftValue-=that.currentWidth,that.applyMarginLeft(),!autoSlide&&that.autoSlideStopOnAction?that.stopAutoSlide():that.restartAutoSlide(),that.currentIndex===that.data.length&&$timeout(function(){that.restartFromFirstItem()},that.transitionsTime))},that.applyMarginLeft=function(){that.slidesContainer.css("margin-left",that.currentMarginLeftValue+"px")},that.disableTransitions=function(){that.slidesContainer.css("transition","none"),that.transitionsEnabled=!1},that.enableTransitions=function(){$timeout(function(){that.slidesContainer.css("transition","margin 0.5s ease-in-out"),that.transitionsEnabled=!0},200)},that.onRadioButtonClick=function(){var multiplier;that.radioButtonIndex>that.currentIndex?(multiplier=that.radioButtonIndex-that.currentIndex,that.currentMarginLeftValue-=that.currentWidth*multiplier):(multiplier=that.currentIndex-that.radioButtonIndex,that.currentMarginLeftValue+=that.currentWidth*multiplier),that.currentIndex=that.radioButtonIndex,that.applyMarginLeft(),that.autoSlideStopOnAction?that.stopAutoSlide():that.restartAutoSlide()},that.isDataInvalidOrTooSmall=function(){return!that.data||that.data.length<=1?!0:!1}}angular.module("jkAngularCarousel").controller("JKCarouselController",["$timeout","$attrs","$interval","$window",CarouselController])}(),function(){"use strict";function CarouselDirective(){function link(scope,element,attrs,ctrl){void 0===attrs.autoSlide&&(ctrl.autoSlide=!1),void 0===attrs.autoSlideTime&&(ctrl.autoSlideTime=5e3),void 0===attrs.autoSlideStopOnAction&&(ctrl.autoSlideStopOnAction=!1),ctrl.registerElement(element),scope.$on("$destroy",function(){ctrl.stopAutoSlide()}),scope.$watch("ctrl.autoSlide",function(){ctrl.validateAutoSlide()}),scope.$watch("ctrl.autoSlideTime",function(){ctrl.restartAutoSlide()}),scope.$watch("ctrl.autoSlideStopOnAction",function(){ctrl.validateAutoSlideStopOnAction()}),scope.$watch("ctrl.data",function(){ctrl.onDataChange()})}return{restrict:"E",replace:!0,templateUrl:"carousel-directive.html",scope:{},controller:"JKCarouselController",controllerAs:"ctrl",bindToController:{data:"=",itemTemplateUrl:"=",maxWidth:"@?",maxHeight:"@?",autoSlide:"@?",autoSlideTime:"@?",autoSlideStopOnAction:"@?"},link:link}}angular.module("jkAngularCarousel").directive("jkCarousel",[CarouselDirective])}(),function(){angular.module("jkAngularCarousel.templates",[]).run(["$templateCache",function($templateCache){$templateCache.put("carousel-directive.html",'<div class="jk-carousel" >\n\n <div class="slides-container" layout="row"\n md-swipe-left="ctrl.navigateRight()"\n md-swipe-right="ctrl.navigateLeft()"\n >\n <div\n ng-repeat="slideItem in ctrl.cloneData"\n class="slide"\n >\n <div ng-include="ctrl.itemTemplateUrl" ></div>\n </div>\n </div>\n\n <md-button class="md-icon-button left-arrow-button" ng-click="ctrl.navigateLeft()" >\n <md-icon >chevron_left</md-icon>\n </md-button>\n\n <md-button class="md-icon-button right-arrow-button" ng-click="ctrl.navigateRight()" >\n <md-icon >chevron_right</md-icon>\n </md-button>\n\n <md-radio-group\n class="radio-buttons-container"\n layout="row"\n ng-model="ctrl.radioButtonIndex"\n layout-align="center center"\n ng-change="ctrl.onRadioButtonClick()" >\n <md-radio-button\n ng-repeat="item in ctrl.data"\n ng-value="$index"\n aria-label="$index" >\n </md-radio-button>\n </md-radio-group>\n\n</div>\n')}])}();
"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="jkAngularCarousel"),function(){"use strict";angular.module("jkAngularCarousel",["jkAngularCarousel.templates"])}(),function(){"use strict";function CarouselController($timeout,$attrs,$interval,$window){var that=this;that.currentIndex=0,that.currentMarginLeftValue=0,that.radioButtonIndex=0,that.transitionsTime=500,that.transitionsEnabled=!0,$attrs.$observe("data",function(){that.onDataChange()}),that.registerElement=function(element){that.element=element,that.elementParent=that.element.parent(),that.slidesContainer=angular.element(that.element.find("div")[0]),$window.addEventListener("resize",function(){that.updateSlidesContainerWidth()})},that.onDataChange=function(){that.data&&0!==that.data.length&&(that.executeCloneData(),$timeout(function(){that.updateSlidesContainerWidth(),that.restartFromFirstItem()}))},that.updateSlidesContainerWidth=function(){that.scaleContent(),that.currentWidth=that.element.prop("offsetWidth"),that.currentHeight=that.element.prop("offsetHeight"),that.resizeSlides();var newSlidesContainerWidth=that.currentWidth*that.cloneData.length;that.slidesContainer.css("width",newSlidesContainerWidth+"px"),that.scaleMarginLeft(newSlidesContainerWidth),that.currentSlidesContainerWidth=newSlidesContainerWidth},that.scaleContent=function(){that.maxWidth=that.maxWidth?parseInt(that.maxWidth):0,0===that.maxWidth&&(that.maxWidth=that.element.prop("offsetWidth")),that.maxHeight=that.maxHeight?parseInt(that.maxHeight):0,0===that.maxHeight&&(that.maxHeight=that.element.prop("offsetHeight"));var currentElementParentWidth=that.elementParent.prop("offsetWidth");if(currentElementParentWidth<that.maxWidth){var newHeight=that.maxHeight*currentElementParentWidth/that.maxWidth;that.element.css("width",currentElementParentWidth+"px"),that.element.css("height",newHeight+"px")}else currentElementParentWidth>=that.maxWidth&&(that.element.css("width",that.maxWidth+"px"),that.element.css("height",that.maxHeight+"px"))},that.resizeSlides=function(){for(var slides=that.element[0].querySelectorAll(".slide"),index=0;index<slides.length;index++){var slide=angular.element(slides[index]);slide.css("width",that.currentWidth+"px"),slide.css("height",that.currentHeight+"px")}},that.scaleMarginLeft=function(newSlidesContainerWidth){that.currentSlidesContainerWidth&&that.currentSlidesContainerWidth!==newSlidesContainerWidth&&(that.currentMarginLeftValue=that.currentMarginLeftValue*newSlidesContainerWidth,that.currentMarginLeftValue=that.currentMarginLeftValue/that.currentSlidesContainerWidth,that.disableTransitions(),that.applyMarginLeft(),that.enableTransitions())},that.restartFromFirstItem=function(){that.currentWidth&&(that.disableTransitions(),that.currentMarginLeftValue=-1*that.currentWidth,that.applyMarginLeft(),that.currentIndex=0,that.radioButtonIndex=that.currentIndex,that.enableTransitions())},that.executeCloneData=function(){for(var cloneArray=[],index=0;index<that.data.length;index++){var item=that.data[index];cloneArray.push(item)}that.cloneFirstItem(cloneArray),that.cloneLastItem(cloneArray),that.cloneData=cloneArray},that.cloneFirstItem=function(cloneArray){var firstItem=cloneArray[0],firstItemClone=angular.copy(firstItem);cloneArray.push(firstItemClone)},that.cloneLastItem=function(cloneArray){var lastItem=cloneArray[that.data.length-1],lastItemClone=angular.copy(lastItem);cloneArray.unshift(lastItemClone)},that.validateAutoSlide=function(){"string"==typeof that.autoSlide&&(that.autoSlide="true"===that.autoSlide?!0:!1),that.autoSlide?that.startAutoSlide():that.stopAutoSlide()},that.validateAutoSlideStopOnAction=function(){"string"==typeof that.autoSlideStopOnAction&&(that.autoSlideStopOnAction="true"===that.autoSlideStopOnAction?!0:!1)},that.restartAutoSlide=function(){that.autoSlide&&(that.transitionsEnabled?$timeout(function(){that.stopAutoSlide(),that.startAutoSlide()},that.transitionsTime):(that.stopAutoSlide(),that.startAutoSlide()))},that.startAutoSlide=function(){angular.isDefined(that.autoSlideInterval)||(that.autoSlideInterval=$interval(function(){that.navigateRight(!0)},that.autoSlideTime))},that.stopAutoSlide=function(){angular.isDefined(that.autoSlideInterval)&&($interval.cancel(that.autoSlideInterval),that.autoSlideInterval=void 0)},that.onNavigateLeft=function(){that.navigateLeft(),that.restartAutoSlide()},that.navigateLeft=function(){that.isDataInvalidOrTooSmall()||(that.currentIndex--,that.radioButtonIndex=that.currentIndex,that.currentMarginLeftValue+=that.currentWidth,that.applyMarginLeft(),that.autoSlideStopOnAction?that.stopAutoSlide():that.restartAutoSlide(),-1===that.currentIndex&&that.restartFromLastItem())},that.restartFromLastItem=function(){$timeout(function(){that.disableTransitions(),that.currentMarginLeftValue=that.currentWidth*that.data.length*-1,that.applyMarginLeft(),that.currentIndex=that.data.length-1,that.radioButtonIndex=that.currentIndex,that.enableTransitions()},that.transitionsTime)},that.onNavigateRight=function(){that.navigateRight(),that.restartAutoSlide()},that.navigateRight=function(autoSlide){that.isDataInvalidOrTooSmall()||(that.currentIndex++,that.radioButtonIndex=that.currentIndex,that.currentMarginLeftValue-=that.currentWidth,that.applyMarginLeft(),!autoSlide&&that.autoSlideStopOnAction?that.stopAutoSlide():that.restartAutoSlide(),that.currentIndex===that.data.length&&$timeout(function(){that.restartFromFirstItem()},that.transitionsTime))},that.applyMarginLeft=function(){that.slidesContainer.css("margin-left",that.currentMarginLeftValue+"px")},that.disableTransitions=function(){that.slidesContainer.css("transition","none"),that.transitionsEnabled=!1},that.enableTransitions=function(){$timeout(function(){that.slidesContainer.css("transition","margin 0.5s ease-in-out"),that.transitionsEnabled=!0},200)},that.onRadioButtonClick=function(){var multiplier;that.radioButtonIndex>that.currentIndex?(multiplier=that.radioButtonIndex-that.currentIndex,that.currentMarginLeftValue-=that.currentWidth*multiplier):(multiplier=that.currentIndex-that.radioButtonIndex,that.currentMarginLeftValue+=that.currentWidth*multiplier),that.currentIndex=that.radioButtonIndex,that.applyMarginLeft(),that.autoSlideStopOnAction?that.stopAutoSlide():that.restartAutoSlide()},that.isDataInvalidOrTooSmall=function(){return!that.data||that.data.length<=1?!0:!1}}angular.module("jkAngularCarousel").controller("JKCarouselController",["$timeout","$attrs","$interval","$window",CarouselController])}(),function(){"use strict";function CarouselDirective(){function link(scope,element,attrs,ctrl){void 0===attrs.autoSlide&&(ctrl.autoSlide=!1),void 0===attrs.autoSlideTime&&(ctrl.autoSlideTime=5e3),void 0===attrs.autoSlideStopOnAction&&(ctrl.autoSlideStopOnAction=!1),ctrl.registerElement(element),scope.$on("$destroy",function(){ctrl.stopAutoSlide()}),scope.$watch("ctrl.autoSlide",function(){ctrl.validateAutoSlide()}),scope.$watch("ctrl.autoSlideTime",function(){ctrl.restartAutoSlide()}),scope.$watch("ctrl.autoSlideStopOnAction",function(){ctrl.validateAutoSlideStopOnAction()}),scope.$watch("ctrl.data",function(){ctrl.onDataChange()})}return{restrict:"E",replace:!0,templateUrl:"carousel-directive.html",scope:{},controller:"JKCarouselController",controllerAs:"ctrl",bindToController:{data:"=",itemTemplateUrl:"=",maxWidth:"@?",maxHeight:"@?",autoSlide:"@?",autoSlideTime:"@?",autoSlideStopOnAction:"@?"},link:link}}angular.module("jkAngularCarousel").directive("jkCarousel",[CarouselDirective])}(),function(){angular.module("jkAngularCarousel.templates",[]).run(["$templateCache",function($templateCache){$templateCache.put("carousel-directive.html",'<div class="jk-carousel" >\n\n <div class="slides-container" layout="row"\n md-swipe-left="ctrl.navigateRight()"\n md-swipe-right="ctrl.navigateLeft()"\n >\n <div\n ng-repeat="slideItem in ctrl.cloneData"\n class="slide"\n >\n <div ng-include="ctrl.itemTemplateUrl" ></div>\n </div>\n </div>\n\n <md-button class="md-icon-button left-arrow-button" ng-click="ctrl.navigateLeft()" >\n <md-icon >chevron_left</md-icon>\n </md-button>\n\n <md-button class="md-icon-button right-arrow-button" ng-click="ctrl.navigateRight()" >\n <md-icon >chevron_right</md-icon>\n </md-button>\n\n <md-radio-group\n class="radio-buttons-container"\n layout="row"\n ng-model="ctrl.radioButtonIndex"\n layout-align="center center"\n ng-change="ctrl.onRadioButtonClick()" >\n <md-radio-button\n ng-repeat="item in ctrl.data"\n ng-value="$index"\n aria-label="$index" >\n </md-radio-button>\n </md-radio-group>\n\n</div>\n')}])}();

@@ -5,3 +5,3 @@ {

"style": "./dist/jk-carousel.css",
"version": "0.1.8",
"version": "0.1.9",
"description": "Amazing carousel for angular material",

@@ -8,0 +8,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc