Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

195 lines
7.9 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * VERSION: 1.9.2
  3. * DATE: 2019-02-07
  4. * UPDATES AND DOCS AT: http://greensock.com
  5. *
  6. * @license Copyright (c) 2008-2019, GreenSock. All rights reserved.
  7. * This work is subject to the terms at http://greensock.com/standard-license or for
  8. * Club GreenSock members, the software agreement that was issued with your membership.
  9. *
  10. * @author: Jack Doyle, jack@greensock.com
  11. **/
  12. /* eslint-disable */
  13. var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node
  14. (_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() {
  15. "use strict";
  16. var _doc = (_gsScope.document || {}).documentElement,
  17. _window = _gsScope,
  18. _max = function(element, axis) {
  19. var dim = (axis === "x") ? "Width" : "Height",
  20. scroll = "scroll" + dim,
  21. client = "client" + dim,
  22. body = document.body;
  23. return (element === _window || element === _doc || element === body) ? Math.max(_doc[scroll], body[scroll]) - (_window["inner" + dim] || _doc[client] || body[client]) : element[scroll] - element["offset" + dim];
  24. },
  25. _unwrapElement = function(value) {
  26. if (typeof(value) === "string") {
  27. value = TweenLite.selector(value);
  28. }
  29. if (value.length && value !== _window && value[0] && value[0].style && !value.nodeType) {
  30. value = value[0];
  31. }
  32. return (value === _window || (value.nodeType && value.style)) ? value : null;
  33. },
  34. _buildGetter = function(e, axis) { //pass in an element and an axis ("x" or "y") and it'll return a getter function for the scroll position of that element (like scrollTop or scrollLeft, although if the element is the window, it'll use the pageXOffset/pageYOffset or the documentElement's scrollTop/scrollLeft or document.body's. Basically this streamlines things and makes a very fast getter across browsers.
  35. var p = "scroll" + ((axis === "x") ? "Left" : "Top");
  36. if (e === _window) {
  37. if (e.pageXOffset != null) {
  38. p = "page" + axis.toUpperCase() + "Offset";
  39. } else if (_doc[p] != null) {
  40. e = _doc;
  41. } else {
  42. e = document.body;
  43. }
  44. }
  45. return function() {
  46. return e[p];
  47. };
  48. },
  49. _getOffset = function(element, container) {
  50. var rect = _unwrapElement(element).getBoundingClientRect(),
  51. b = document.body,
  52. isRoot = (!container || container === _window || container === b),
  53. cRect = isRoot ? {top:_doc.clientTop - (window.pageYOffset || _doc.scrollTop || b.scrollTop || 0), left:_doc.clientLeft - (window.pageXOffset || _doc.scrollLeft || b.scrollLeft || 0)} : container.getBoundingClientRect(),
  54. offsets = {x: rect.left - cRect.left, y: rect.top - cRect.top};
  55. if (!isRoot && container) { //only add the current scroll position if it's not the window/body.
  56. offsets.x += _buildGetter(container, "x")();
  57. offsets.y += _buildGetter(container, "y")();
  58. }
  59. return offsets;
  60. /* PREVIOUS
  61. var rect = _unwrapElement(element).getBoundingClientRect(),
  62. isRoot = (!container || container === _window || container === document.body),
  63. cRect = (isRoot ? _doc : container).getBoundingClientRect(),
  64. offsets = {x: rect.left - cRect.left, y: rect.top - cRect.top};
  65. if (!isRoot && container) { //only add the current scroll position if it's not the window/body.
  66. offsets.x += _buildGetter(container, "x")();
  67. offsets.y += _buildGetter(container, "y")();
  68. }
  69. return offsets;
  70. */
  71. },
  72. _parseVal = function(value, target, axis, currentVal) {
  73. var type = typeof(value);
  74. return !isNaN(value) ? parseFloat(value) : (type === "string" && value.charAt(1) === "=") ? parseInt(value.charAt(0) + "1", 10) * parseFloat(value.substr(2)) + currentVal : (value === "max") ? _max(target, axis) : Math.min(_max(target, axis), _getOffset(value, target)[axis]);
  75. },
  76. ScrollToPlugin = _gsScope._gsDefine.plugin({
  77. propName: "scrollTo",
  78. API: 2,
  79. global: true,
  80. version:"1.9.2",
  81. //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
  82. init: function(target, value, tween) {
  83. this._wdw = (target === _window);
  84. this._target = target;
  85. this._tween = tween;
  86. if (typeof(value) !== "object") {
  87. value = {y:value}; //if we don't receive an object as the parameter, assume the user intends "y".
  88. if (typeof(value.y) === "string" && value.y !== "max" && value.y.charAt(1) !== "=") {
  89. value.x = value.y;
  90. }
  91. } else if (value.nodeType) {
  92. value = {y:value, x:value};
  93. }
  94. this.vars = value;
  95. this._autoKill = (value.autoKill !== false);
  96. this.getX = _buildGetter(target, "x");
  97. this.getY = _buildGetter(target, "y");
  98. this.x = this.xPrev = this.getX();
  99. this.y = this.yPrev = this.getY();
  100. if (value.x != null) {
  101. this._addTween(this, "x", this.x, _parseVal(value.x, target, "x", this.x) - (value.offsetX || 0), "scrollTo_x", true);
  102. this._overwriteProps.push("scrollTo_x");
  103. } else {
  104. this.skipX = true;
  105. }
  106. if (value.y != null) {
  107. this._addTween(this, "y", this.y, _parseVal(value.y, target, "y", this.y) - (value.offsetY || 0), "scrollTo_y", true);
  108. this._overwriteProps.push("scrollTo_y");
  109. } else {
  110. this.skipY = true;
  111. }
  112. return true;
  113. },
  114. //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
  115. set: function(v) {
  116. this._super.setRatio.call(this, v);
  117. var x = (this._wdw || !this.skipX) ? this.getX() : this.xPrev,
  118. y = (this._wdw || !this.skipY) ? this.getY() : this.yPrev,
  119. yDif = y - this.yPrev,
  120. xDif = x - this.xPrev,
  121. threshold = ScrollToPlugin.autoKillThreshold;
  122. if (this.x < 0) { //can't scroll to a position less than 0! Might happen if someone uses a Back.easeOut or Elastic.easeOut when scrolling back to the top of the page (for example)
  123. this.x = 0;
  124. }
  125. if (this.y < 0) {
  126. this.y = 0;
  127. }
  128. if (this._autoKill) {
  129. //note: iOS has a bug that throws off the scroll by several pixels, so we need to check if it's within 7 pixels of the previous one that we set instead of just looking for an exact match.
  130. if (!this.skipX && (xDif > threshold || xDif < -threshold) && x < _max(this._target, "x")) {
  131. this.skipX = true; //if the user scrolls separately, we should stop tweening!
  132. }
  133. if (!this.skipY && (yDif > threshold || yDif < -threshold) && y < _max(this._target, "y")) {
  134. this.skipY = true; //if the user scrolls separately, we should stop tweening!
  135. }
  136. if (this.skipX && this.skipY) {
  137. this._tween.kill();
  138. if (this.vars.onAutoKill) {
  139. this.vars.onAutoKill.apply(this.vars.onAutoKillScope || this._tween, this.vars.onAutoKillParams || []);
  140. }
  141. }
  142. }
  143. if (this._wdw) {
  144. _window.scrollTo((!this.skipX) ? this.x : x, (!this.skipY) ? this.y : y);
  145. } else {
  146. if (!this.skipY) {
  147. this._target.scrollTop = this.y;
  148. }
  149. if (!this.skipX) {
  150. this._target.scrollLeft = this.x;
  151. }
  152. }
  153. this.xPrev = this.x;
  154. this.yPrev = this.y;
  155. }
  156. }),
  157. p = ScrollToPlugin.prototype;
  158. ScrollToPlugin.max = _max;
  159. ScrollToPlugin.getOffset = _getOffset;
  160. ScrollToPlugin.buildGetter = _buildGetter;
  161. ScrollToPlugin.autoKillThreshold = 7;
  162. p._kill = function(lookup) {
  163. if (lookup.scrollTo_x) {
  164. this.skipX = true;
  165. }
  166. if (lookup.scrollTo_y) {
  167. this.skipY = true;
  168. }
  169. return this._super._kill.call(this, lookup);
  170. };
  171. }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
  172. //export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date)
  173. (function(name) {
  174. "use strict";
  175. var getGlobal = function() {
  176. return (_gsScope.GreenSockGlobals || _gsScope)[name];
  177. };
  178. if (typeof(module) !== "undefined" && module.exports) { //node
  179. require("../TweenLite.js");
  180. module.exports = getGlobal();
  181. } else if (typeof(define) === "function" && define.amd) { //AMD
  182. define(["TweenLite"], getGlobal);
  183. }
  184. }("ScrollToPlugin"));