{"version":3,"sources":["libs/ngSmoothScroll/angular-smooth-scroll.js"],"names":["module","angular","smoothScroll","element","options","duration","offset","easing","callbackBefore","callbackAfter","container","document","getElementById","containerId","containerPresent","undefined","getScrollLocation","scrollTop","window","pageYOffset","documentElement","getEasingPattern","type","time","getEndLocation","location","offsetParent","offsetTop","Math","max","setTimeout","currentLocation","startLocation","endLocation","timeLapsed","distance","percentage","position","scrollHeight","internalHeight","stopAnimation","clientHeight","body","scrollheight","innerHeight","clearInterval","runAnimation","animateScroll","scrollTo","setInterval","factory","directive","restrict","scope","link","$scope","$elem","$attrs","scrollIf","exprHandler","targetElement","on","e","preventDefault"],"mappings":";;AAAA;;;;;;;;;;;;;;;AAgBC,aAAY;AACT;;AAEA,MAAIA,MAAM,GAAGC,OAAO,CAACD,MAAR,CAAe,cAAf,EAA+B,EAA/B,CAAb;AAGA;;;;;;;AAMA,MAAIE,YAAY,GAAG,SAAfA,YAAe,CAAUC,OAAV,EAAmBC,OAAnB,EAA4B;AAC3CA,IAAAA,OAAO,GAAGA,OAAO,IAAI,EAArB,CAD2C,CAG3C;;AACA,QAAIC,QAAQ,GAAGD,OAAO,CAACC,QAAR,IAAoB,GAAnC;AAAA,QACLC,MAAM,GAAGF,OAAO,CAACE,MAAR,IAAkB,CADtB;AAAA,QAELC,MAAM,GAAGH,OAAO,CAACG,MAAR,IAAkB,gBAFtB;AAAA,QAGLC,cAAc,GAAGJ,OAAO,CAACI,cAAR,IAA0B,YAAY,CAAG,CAHrD;AAAA,QAILC,aAAa,GAAGL,OAAO,CAACK,aAAR,IAAyB,YAAY,CAAG,CAJnD;AAAA,QAKLC,SAAS,GAAGC,QAAQ,CAACC,cAAT,CAAwBR,OAAO,CAACS,WAAhC,KAAgD,IALvD;AAAA,QAMLC,gBAAgB,GAAIJ,SAAS,IAAIK,SAAb,IAA0BL,SAAS,IAAI,IANtD;AAQA;;;;;AAGA,QAAIM,iBAAiB,GAAG,SAApBA,iBAAoB,GAAY;AAChC,UAAIF,g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B,CAAhB;AACA,cAAI,CAACY,aAAL,EAAoB;;AAEpB,cAAIpD,cAAc,GAAG,SAAjBA,cAAiB,CAAUL,OAAV,EAAmB;AACpC,gBAAIsD,MAAM,CAACjD,cAAX,EAA2B;AACvB,kBAAImD,WAAW,GAAGJ,MAAM,CAAC/C,cAAP,CAAsB;AAAEL,gBAAAA,OAAO,EAAEA;AAAX,eAAtB,CAAlB;;AACA,kBAAI,OAAOwD,WAAP,KAAuB,UAA3B,EAAuC;AACnCA,gBAAAA,WAAW,CAACxD,OAAD,CAAX;AACH;AACJ;AACJ,WAPD;;AASA,cAAIM,aAAa,GAAG,SAAhBA,aAAgB,CAAUN,OAAV,EAAmB;AACnC,gBAAIsD,MAAM,CAAChD,aAAX,EAA0B;AACtB,kBAAIkD,WAAW,GAAGJ,MAAM,CAAC9C,aAAP,CAAqB;AAAEN,gBAAAA,OAAO,EAAEA;AAAX,eAArB,CAAlB;;AACA,kBAAI,OAAOwD,WAAP,KAAuB,UAA3B,EAAuC;AACnCA,gBAAAA,WAAW,CAACxD,OAAD,CAAX;AACH;AACJ;AACJ,WAPD;;AASAD,UAAAA,YAAY,CAAC0D,aAAD,EAAgB;AACxBvD,YAAAA,QAAQ,EAAEoD,MAAM,CAACpD,QADO;AAExBC,YAAAA,MAAM,EAAEmD,MAAM,CAACnD,MAFS;AAGxBC,YAAAA,MAAM,EAAEkD,MAAM,CAAClD,MAHS;AAIxBC,YAAAA,cAAc,EAAEA,cAJQ;AAKxBC,YAAAA,aAAa,EAAEA,aALS;AAMxBI,YAAAA,WAAW,EAAE4C,MAAM,CAAC5C;AANI,WAAhB,CAAZ;AASA,iBAAO,KAAP;AACH,SAlCD;AAmCH;AA5CE,KAAP;AA8CH,GA/C4B,CAA7B;AAiDH,CA9PA,GAAD","sourcesContent":["/*!\r\n *\t Angular Smooth Scroll (ngSmoothScroll)\r\n *\t Animates scrolling to elements, by David Oliveros.\r\n *\r\n * Callback hooks contributed by Ben Armston https://github.com/benarmston\r\n *\t Easing support contributed by Willem Liu. https://github.com/willemliu\r\n *\t Easing functions forked from Gaƫtan Renaudeau. https://gist.github.com/gre/1650294\r\n *\t Infinite loop bugs in iOS and Chrome (when zoomed) by Alex Guzman. https://github.com/alexguzman\r\n *\t Support for scrolling in custom containers by Joseph Matthias Goh. https://github.com/zephinzer\r\n *\t Influenced by Chris Ferdinandi\r\n *\t https://github.com/cferdinandi\r\n *\r\n *\t Version: 2.0.0\r\n * \t License: MIT\r\n */\r\n\r\n(function () {\r\n 'use strict';\r\n\r\n var module = angular.module('smoothScroll', []);\r\n\r\n\r\n /**\r\n\t * Smooth scrolls the window/div to the provided element.\r\n\t *\r\n\t * 20150713 EDIT - zephinzer\r\n\t * \tAdded new option - containerId to account for scrolling within a DIV\r\n\t */\r\n var smoothScroll = function (element, options) {\r\n options = options || {};\r\n\r\n // Options\r\n var duration = options.duration || 800,\r\n\t\t\toffset = options.offset || 0,\r\n\t\t\teasing = options.easing || 'easeInOutQuart',\r\n\t\t\tcallbackBefore = options.callbackBefore || function () { },\r\n\t\t\tcallbackAfter = options.callbackAfter || function () { },\r\n\t\t\tcontainer = document.getElementById(options.containerId) || null,\r\n\t\t\tcontainerPresent = (container != undefined && container != null);\r\n\r\n /**\r\n\t\t * Retrieve current location\r\n\t\t */\r\n var getScrollLocation = function () {\r\n if (containerPresent) {\r\n return container.scrollTop;\r\n } else {\r\n if (window.pageYOffset) {\r\n return window.pageYOffset;\r\n } else {\r\n return document.documentElement.scrollTop;\r\n }\r\n }\r\n };\r\n\r\n /**\r\n\t\t * Calculate easing pattern.\r\n\t\t *\r\n\t\t * 20150713 edit - zephinzer\r\n\t\t * - changed if-else to switch\r\n\t\t * @see http://archive.oreilly.com/pub/a/server-administration/excerpts/even-faster-websites/writing-efficient-javascript.html\r\n\t\t */\r\n var getEasingPattern = function (type, time) {\r\n switch (type) {\r\n case 'easeInQuad': return time * time; // accelerating from zero velocity\r\n case 'easeOutQuad': return time * (2 - time); // decelerating to zero velocity\r\n case 'easeInOutQuad': return time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration\r\n case 'easeInCubic': return time * time * time; // accelerating from zero velocity\r\n case 'easeOutCubic': return (--time) * time * time + 1; // decelerating to zero velocity\r\n case 'easeInOutCubic': return time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration\r\n case 'easeInQuart': return time * time * time * time; // accelerating from zero velocity\r\n case 'easeOutQuart': return 1 - (--time) * time * time * time; // decelerating to zero velocity\r\n case 'easeInOutQuart': return time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration\r\n case 'easeInQuint': return time * time * time * time * time; // accelerating from zero velocity\r\n case 'easeOutQuint': return 1 + (--time) * time * time * time * time; // decelerating to zero velocity\r\n case 'easeInOutQuint': return time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration\r\n default: return time;\r\n }\r\n };\r\n\r\n /**\r\n\t\t * Calculate how far to scroll\r\n\t\t */\r\n var getEndLocation = function (element) {\r\n var location = 0;\r\n if (element.offsetParent) {\r\n do {\r\n location += element.offsetTop;\r\n element = element.offsetParent;\r\n } while (element);\r\n }\r\n location = Math.max(location - offset, 0);\r\n return location;\r\n };\r\n\r\n // Initialize the whole thing\r\n setTimeout(function () {\r\n var currentLocation = null,\r\n\t\t\t\tstartLocation = getScrollLocation(),\r\n\t\t\t\tendLocation = getEndLocation(element),\r\n\t\t\t\ttimeLapsed = 0,\r\n\t\t\t\tdistance = endLocation - startLocation,\r\n\t\t\t\tpercentage,\r\n\t\t\t\tposition,\r\n\t\t\t\tscrollHeight,\r\n\t\t\t\tinternalHeight;\r\n\r\n /**\r\n\t\t\t * Stop the scrolling animation when the anchor is reached (or at the top/bottom of the page)\r\n\t\t\t */\r\n var stopAnimation = function () {\r\n currentLocation = getScrollLocation();\r\n if (containerPresent) {\r\n scrollHeight = container.scrollHeight;\r\n internalHeight = container.clientHeight + currentLocation;\r\n } else {\r\n scrollHeight = document.body.scrollheight;\r\n internalHeight = window.innerHeight + currentLocation;\r\n }\r\n\r\n if (\r\n\t\t\t\t\t( // condition 1\r\n\t\t\t\t\t\tposition == endLocation\r\n\t\t\t\t\t) ||\r\n\t\t\t\t\t( // condition 2\r\n\t\t\t\t\t\tcurrentLocation == endLocation\r\n\t\t\t\t\t) ||\r\n\t\t\t\t\t( // condition 3\r\n\t\t\t\t\t\tinternalHeight >= scrollHeight\r\n\t\t\t\t\t)\r\n\t\t\t\t) { // stop\r\n clearInterval(runAnimation);\r\n callbackAfter(element);\r\n }\r\n };\r\n\r\n /**\r\n\t\t\t * Scroll the page by an increment, and check if it's time to stop\r\n\t\t\t */\r\n var animateScroll = function () {\r\n timeLapsed += 16;\r\n percentage = (timeLapsed / duration);\r\n percentage = (percentage > 1) ? 1 : percentage;\r\n position = startLocation + (distance * getEasingPattern(easing, percentage));\r\n if (containerPresent) {\r\n container.scrollTop = position;\r\n } else {\r\n window.scrollTo(0, position);\r\n }\r\n stopAnimation();\r\n };\r\n\r\n callbackBefore(element);\r\n var runAnimation = setInterval(animateScroll, 16);\r\n }, 0);\r\n };\r\n\r\n\r\n // Expose the library in a factory\r\n //\r\n module.factory('smoothScroll', function () {\r\n return smoothScroll;\r\n });\r\n\r\n\r\n /**\r\n\t * Scrolls the window to this element, optionally validating an expression\r\n\t *\r\n\t * 20150713 EDIT - zephinzer\r\n\t * \tAdded containerId to attributes for smooth scrolling within a DIV\r\n\t */\r\n module.directive('smoothScroll', ['smoothScroll', function (smoothScroll) {\r\n return {\r\n restrict: 'A',\r\n scope: {\r\n callbackBefore: '&',\r\n callbackAfter: '&',\r\n },\r\n link: function ($scope, $elem, $attrs) {\r\n if (typeof $attrs.scrollIf === 'undefined' || $attrs.scrollIf === 'true') {\r\n setTimeout(function () {\r\n\r\n var callbackBefore = function (element) {\r\n if ($attrs.callbackBefore) {\r\n var exprHandler = $scope.callbackBefore({ element: element });\r\n if (typeof exprHandler === 'function') {\r\n exprHandler(element);\r\n }\r\n }\r\n };\r\n\r\n var callbackAfter = function (element) {\r\n if ($attrs.callbackAfter) {\r\n var exprHandler = $scope.callbackAfter({ element: element });\r\n if (typeof exprHandler === 'function') {\r\n exprHandler(element);\r\n }\r\n }\r\n };\r\n\r\n smoothScroll($elem[0], {\r\n duration: $attrs.duration,\r\n offset: $attrs.offset,\r\n easing: $attrs.easing,\r\n callbackBefore: callbackBefore,\r\n callbackAfter: callbackAfter,\r\n containerId: $attrs.containerId\r\n });\r\n }, 0);\r\n }\r\n }\r\n };\r\n }]);\r\n\r\n\r\n /**\r\n\t * Scrolls to a specified element ID when this element is clicked\r\n\t *\r\n\t * 20150713 EDIT - zephinzer\r\n\t * \tAdded containerId to attributes for smooth scrolling within a DIV\r\n\t */\r\n module.directive('scrollTo', ['smoothScroll', function (smoothScroll) {\r\n return {\r\n restrict: 'A',\r\n scope: {\r\n callbackBefore: '&',\r\n callbackAfter: '&',\r\n },\r\n link: function ($scope, $elem, $attrs) {\r\n var targetElement;\r\n\r\n $elem.on('click', function (e) {\r\n e.preventDefault();\r\n\r\n targetElement = document.getElementById($attrs.scrollTo);\r\n if (!targetElement) return;\r\n\r\n var callbackBefore = function (element) {\r\n if ($attrs.callbackBefore) {\r\n var exprHandler = $scope.callbackBefore({ element: element });\r\n if (typeof exprHandler === 'function') {\r\n exprHandler(element);\r\n }\r\n }\r\n };\r\n\r\n var callbackAfter = function (element) {\r\n if ($attrs.callbackAfter) {\r\n var exprHandler = $scope.callbackAfter({ element: element });\r\n if (typeof exprHandler === 'function') {\r\n exprHandler(element);\r\n }\r\n }\r\n };\r\n\r\n smoothScroll(targetElement, {\r\n duration: $attrs.duration,\r\n offset: $attrs.offset,\r\n easing: $attrs.easing,\r\n callbackBefore: callbackBefore,\r\n callbackAfter: callbackAfter,\r\n containerId: $attrs.containerId\r\n });\r\n\r\n return false;\r\n });\r\n }\r\n };\r\n }]);\r\n\r\n}());"],"file":"../../../libs/ngSmoothScroll/angular-smooth-scroll.js"}