angular-skrollr
Advanced tools
Comparing version 0.1.7 to 0.2.0
@@ -38,2 +38,8 @@ "use strict"; | ||
/** | ||
* Disable skrollr on mobile devices | ||
* @property {Boolean} disableMobile | ||
*/ | ||
this.disableMobile = false; | ||
/** | ||
* Methods returned on snSkrollr service | ||
@@ -67,2 +73,6 @@ * @property {Object} serviceMethods | ||
if (_this.disableMobile && _this.serviceMethods.isMobile.any()) { | ||
return; | ||
} | ||
var skrollrConfig = config ? config : _this.config, | ||
@@ -84,2 +94,30 @@ skrollrInit = function skrollrInit(){ | ||
}, | ||
/** | ||
* http://www.abeautifulsite.net/detecting-mobile-devices-with-javascript/ | ||
* @property {Object} isMobile | ||
*/ | ||
isMobile: { | ||
Android: function() { | ||
return $window.navigator.userAgent.match(/Android/i); | ||
}, | ||
iOS: function() { | ||
return $window.navigator.userAgent.match(/iPhone|iPad|iPod/i); | ||
}, | ||
BlackBerry: function() { | ||
return $window.navigator.userAgent.match(/BlackBerry/i); | ||
}, | ||
Opera: function() { | ||
return $window.navigator.userAgent.match(/Opera Mini/i); | ||
}, | ||
Windows: function() { | ||
return $window.navigator.userAgent.match(/IEMobile/i); | ||
}, | ||
any: function() { | ||
return ( _this.serviceMethods.isMobile.Android() || | ||
_this.serviceMethods.isMobile.iOS() || | ||
_this.serviceMethods.isMobile.BlackBerry() || | ||
_this.serviceMethods.isMobile.Opera() || | ||
_this.serviceMethods.isMobile.Windows() ); | ||
} | ||
}, | ||
@@ -86,0 +124,0 @@ /** |
@@ -0,1 +1,9 @@ | ||
## Changes in 0.2.0 | ||
* @edwardoparearyee: Feature: add mobile detection (#36) | ||
## Changes in 0.1.8 | ||
* @edwardoparearyee: Fix: CI (no PR) | ||
## Changes in 0.1.7 | ||
@@ -2,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*! angular-skrollr - v0.1.7 - 2016-05-31 */ | ||
/*! angular-skrollr - v0.2.0 - 2016-06-03 */ | ||
"use strict"; | ||
@@ -39,2 +39,8 @@ /** | ||
/** | ||
* Disable skrollr on mobile devices | ||
* @property {Boolean} disableMobile | ||
*/ | ||
this.disableMobile = false; | ||
/** | ||
* Methods returned on snSkrollr service | ||
@@ -68,2 +74,6 @@ * @property {Object} serviceMethods | ||
if (_this.disableMobile && _this.serviceMethods.isMobile.any()) { | ||
return; | ||
} | ||
var skrollrConfig = config ? config : _this.config, | ||
@@ -85,2 +95,30 @@ skrollrInit = function skrollrInit(){ | ||
}, | ||
/** | ||
* http://www.abeautifulsite.net/detecting-mobile-devices-with-javascript/ | ||
* @property {Object} isMobile | ||
*/ | ||
isMobile: { | ||
Android: function() { | ||
return $window.navigator.userAgent.match(/Android/i); | ||
}, | ||
iOS: function() { | ||
return $window.navigator.userAgent.match(/iPhone|iPad|iPod/i); | ||
}, | ||
BlackBerry: function() { | ||
return $window.navigator.userAgent.match(/BlackBerry/i); | ||
}, | ||
Opera: function() { | ||
return $window.navigator.userAgent.match(/Opera Mini/i); | ||
}, | ||
Windows: function() { | ||
return $window.navigator.userAgent.match(/IEMobile/i); | ||
}, | ||
any: function() { | ||
return ( _this.serviceMethods.isMobile.Android() || | ||
_this.serviceMethods.isMobile.iOS() || | ||
_this.serviceMethods.isMobile.BlackBerry() || | ||
_this.serviceMethods.isMobile.Opera() || | ||
_this.serviceMethods.isMobile.Windows() ); | ||
} | ||
}, | ||
@@ -87,0 +125,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
/*! angular-skrollr - v0.1.7 - 2016-05-31 */ | ||
!function(a){"use strict";angular.module("sn.skrollr",[]).provider("snSkrollr",function(){var a=this;this.config={},this.skrollrInstance={},this.hasBeenInitialised=!1,this.serviceMethods={},this.$get=["$window","$document","$rootScope",function(b,c,d){return a.serviceMethods={init:function(e){var f=e?e:a.config,g=function(){a.skrollrInstance=b.skrollr.init(f),a.hasBeenInitialised=!0,a.serviceMethods.refresh()};c.ready(function(){d.$$phase?g():d.$apply(g)})},refresh:function(b){a.hasBeenInitialised&&a.skrollrInstance.refresh(b)},destroy:function(){a.hasBeenInitialised&&(a.skrollrInstance.destroy(),a.hasBeenInitialised=!1)}},a.serviceMethods}]}).directive("snSkrollr",["$timeout","$window","snSkrollr",function(a,b,c){return{restrict:"AE",link:function(d,e){d.timer=a(function(){c.refresh(e)},100),d.onChange=function(){d.timer&&a.cancel(d.timer),d.timer=a(function(){c.refresh(e)},200)},angular.element(b).on("scroll",d.onChange),angular.element(b).on("resize",d.onChange)}}}])}(window); | ||
/*! angular-skrollr - v0.2.0 - 2016-06-03 */ | ||
!function(a){"use strict";angular.module("sn.skrollr",[]).provider("snSkrollr",function(){var a=this;this.config={},this.skrollrInstance={},this.hasBeenInitialised=!1,this.disableMobile=!1,this.serviceMethods={},this.$get=["$window","$document","$rootScope",function(b,c,d){return a.serviceMethods={init:function(e){if(!a.disableMobile||!a.serviceMethods.isMobile.any()){var f=e?e:a.config,g=function(){a.skrollrInstance=b.skrollr.init(f),a.hasBeenInitialised=!0,a.serviceMethods.refresh()};c.ready(function(){d.$$phase?g():d.$apply(g)})}},isMobile:{Android:function(){return b.navigator.userAgent.match(/Android/i)},iOS:function(){return b.navigator.userAgent.match(/iPhone|iPad|iPod/i)},BlackBerry:function(){return b.navigator.userAgent.match(/BlackBerry/i)},Opera:function(){return b.navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return b.navigator.userAgent.match(/IEMobile/i)},any:function(){return a.serviceMethods.isMobile.Android()||a.serviceMethods.isMobile.iOS()||a.serviceMethods.isMobile.BlackBerry()||a.serviceMethods.isMobile.Opera()||a.serviceMethods.isMobile.Windows()}},refresh:function(b){a.hasBeenInitialised&&a.skrollrInstance.refresh(b)},destroy:function(){a.hasBeenInitialised&&(a.skrollrInstance.destroy(),a.hasBeenInitialised=!1)}},a.serviceMethods}]}).directive("snSkrollr",["$timeout","$window","snSkrollr",function(a,b,c){return{restrict:"AE",link:function(d,e){d.timer=a(function(){c.refresh(e)},100),d.onChange=function(){d.timer&&a.cancel(d.timer),d.timer=a(function(){c.refresh(e)},200)},angular.element(b).on("scroll",d.onChange),angular.element(b).on("resize",d.onChange)}}}])}(window); |
{ | ||
"name": "angular-skrollr", | ||
"private": false, | ||
"version": "0.1.7", | ||
"version": "0.2.0", | ||
"description": "Angular Skrollr wraps the skrollr.js library to provide a mechanisim for configuring, initialising skrollr and calling skrollr.refresh() when the DOM is updated", | ||
@@ -6,0 +6,0 @@ "repository": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
48772
350
0