-
Notifications
You must be signed in to change notification settings - Fork 70
/
ng-device-detector.min.js
1 lines (1 loc) · 1.11 KB
/
ng-device-detector.min.js
1
!function(e){"use strict";e.module("ng.deviceDetector",["reTree","uaDeviceDetector"]).service("detectUtils",["deviceDetector","uaDeviceDetector",function(e,t){var i=e;this.isMobile=function(){return"unknown"!==i.device},this.isAndroid=function(){return i.device===t.DEVICES.ANDROID||i.OS===t.OS.ANDROID},this.isIOS=function(){return i.os===t.OS.IOS||i.device===t.DEVICES.I_POD||i.device===t.DEVICES.IPHONE}}]).provider("deviceDetector",function(){var e=[];this.addCustom=function(t,i){e.push({name:t,re:i})},this.$get=["$window","uaDeviceDetector","reTree",function(e,t,i){var s=e.navigator.userAgent,r=t.parseUserAgent(s);return r.parseUserAgent=t.parseUserAgent,r}]}).directive("deviceDetector",["deviceDetector",function(e){function t(e){return"is-"+e.toLowerCase().replace(/[^0-9a-z]+/g,"-")}return{restrict:"A",link:function(i,s){s.addClass("os-"+e.os),s.addClass("browser-"+e.browser),s.addClass("device-"+e.device),s.toggleClass("is-mobile",e.isMobile()),s.toggleClass("is-tablet",e.isTablet()),s.toggleClass("is-desktop",e.isDesktop()),Object.keys(e.custom).forEach(function(i){s.toggleClass(t(i),e.custom[i])})}}}])}(angular);