Web Interface For Lite Argus Control modules
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.

171 lines
6.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * VERSION: 0.6.2
  3. * DATE: 2018-02-15
  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 _getText = function(e) {
  17. var type = e.nodeType,
  18. result = "";
  19. if (type === 1 || type === 9 || type === 11) {
  20. if (typeof(e.textContent) === "string") {
  21. return e.textContent;
  22. } else {
  23. for ( e = e.firstChild; e; e = e.nextSibling ) {
  24. result += _getText(e);
  25. }
  26. }
  27. } else if (type === 3 || type === 4) {
  28. return e.nodeValue;
  29. }
  30. return result;
  31. },
  32. _emoji = "[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2694-\u2697]|\uD83E[\uDD10-\uDD5D]|[\uD800-\uDBFF][\uDC00-\uDFFF]",
  33. _emojiExp = new RegExp(_emoji),
  34. _emojiAndCharsExp = new RegExp(_emoji + "|.", "g"),
  35. _emojiSafeSplit = function(text, delimiter) {
  36. return ((delimiter === "" || !delimiter) && _emojiExp.test(text)) ? text.match(_emojiAndCharsExp) : text.split(delimiter || "");
  37. },
  38. /* //previous emoji-related splitting. New method above is faster and more concise.
  39. _emojiStart = 0xD800,
  40. _emojiEnd = 0xDBFF,
  41. _emojiLowStart = 0xDC00,
  42. _emojiRegionStart = 0x1F1E6,
  43. _emojiRegionEnd = 0x1F1FF,
  44. _emojiModStart = 0x1f3fb,
  45. _emojiModEnd = 0x1f3ff,
  46. _emojiPairCode = function(s) {
  47. return ((s.charCodeAt(0) - _emojiStart) << 10) + (s.charCodeAt(1) - _emojiLowStart) + 0x10000;
  48. },
  49. _emojiSafeSplit = function(text, delimiter) { //like calling String.split(delimiter) except that it keeps emoji characters together.
  50. if (delimiter !== "") {
  51. return text.split(delimiter);
  52. }
  53. var l = text.length,
  54. a = [],
  55. character, i, emojiPair1, emojiPair2, j;
  56. for (i = 0; i < l; i++) {
  57. character = text.charAt(i);
  58. if ((character.charCodeAt(0) >= _emojiStart && character.charCodeAt(0) <= _emojiEnd) || (text.charCodeAt(i+1) >= 0xFE00 && text.charCodeAt(i+1) <= 0xFE0F)) { //special emoji characters use 2 or 4 unicode characters that we must keep together.
  59. emojiPair1 = _emojiPairCode(text.substr(i, 2));
  60. emojiPair2 = _emojiPairCode(text.substr(i + 2, 2));
  61. j = ((emojiPair1 >= _emojiRegionStart && emojiPair1 <= _emojiRegionEnd && emojiPair2 >= _emojiRegionStart && emojiPair2 <= _emojiRegionEnd) || (emojiPair2 >= _emojiModStart && emojiPair2 <= _emojiModEnd)) ? 4 : 2;
  62. a.push(text.substr(i, j));
  63. i += j - 1;
  64. } else {
  65. a.push(character);
  66. }
  67. }
  68. return a;
  69. },
  70. */
  71. TextPlugin = _gsScope._gsDefine.plugin({
  72. propName: "text",
  73. API: 2,
  74. version:"0.6.2",
  75. //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
  76. init: function(target, value, tween, index) {
  77. var i = target.nodeName.toUpperCase(),
  78. shrt;
  79. if (typeof(value) === "function") {
  80. value = value(index, target);
  81. }
  82. this._svg = (target.getBBox && (i === "TEXT" || i === "TSPAN"));
  83. if (!("innerHTML" in target) && !this._svg) {
  84. return false;
  85. }
  86. this._target = target;
  87. if (typeof(value) !== "object") {
  88. value = {value:value};
  89. }
  90. if (value.value === undefined) {
  91. this._text = this._original = [""];
  92. return true;
  93. }
  94. this._delimiter = value.delimiter || "";
  95. this._original = _emojiSafeSplit(_getText(target).replace(/\s+/g, " "), this._delimiter);
  96. this._text = _emojiSafeSplit(value.value.replace(/\s+/g, " "), this._delimiter);
  97. this._runBackwards = (tween.vars.runBackwards === true);
  98. if (this._runBackwards) {
  99. i = this._original;
  100. this._original = this._text;
  101. this._text = i;
  102. }
  103. if (typeof(value.newClass) === "string") {
  104. this._newClass = value.newClass;
  105. this._hasClass = true;
  106. }
  107. if (typeof(value.oldClass) === "string") {
  108. this._oldClass = value.oldClass;
  109. this._hasClass = true;
  110. }
  111. i = this._original.length - this._text.length;
  112. shrt = (i < 0) ? this._original : this._text;
  113. this._fillChar = value.fillChar || (value.padSpace ? "&nbsp;" : "");
  114. if (i < 0) {
  115. i = -i;
  116. }
  117. while (--i > -1) {
  118. shrt.push(this._fillChar);
  119. }
  120. return true;
  121. },
  122. //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.)
  123. set: function(ratio) {
  124. if (ratio > 1) {
  125. ratio = 1;
  126. } else if (ratio < 0) {
  127. ratio = 0;
  128. }
  129. if (this._runBackwards) {
  130. ratio = 1 - ratio;
  131. }
  132. var l = this._text.length,
  133. i = (ratio * l + 0.5) | 0,
  134. applyNew, applyOld, str;
  135. if (this._hasClass) {
  136. applyNew = (this._newClass && i !== 0);
  137. applyOld = (this._oldClass && i !== l);
  138. str = (applyNew ? "<span class='" + this._newClass + "'>" : "") + this._text.slice(0, i).join(this._delimiter) + (applyNew ? "</span>" : "") + (applyOld ? "<span class='" + this._oldClass + "'>" : "") + this._delimiter + this._original.slice(i).join(this._delimiter) + (applyOld ? "</span>" : "");
  139. } else {
  140. str = this._text.slice(0, i).join(this._delimiter) + this._delimiter + this._original.slice(i).join(this._delimiter);
  141. }
  142. if (this._svg) { //SVG text elements don't have an "innerHTML" in Microsoft browsers.
  143. this._target.textContent = str;
  144. } else {
  145. this._target.innerHTML = (this._fillChar === "&nbsp;" && str.indexOf(" ") !== -1) ? str.split(" ").join("&nbsp;&nbsp;") : str;
  146. }
  147. }
  148. }),
  149. p = TextPlugin.prototype;
  150. p._newClass = p._oldClass = p._delimiter = "";
  151. }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
  152. //export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date)
  153. (function(name) {
  154. "use strict";
  155. var getGlobal = function() {
  156. return (_gsScope.GreenSockGlobals || _gsScope)[name];
  157. };
  158. if (typeof(module) !== "undefined" && module.exports) { //node
  159. require("../TweenLite.js");
  160. module.exports = getGlobal();
  161. } else if (typeof(define) === "function" && define.amd) { //AMD
  162. define(["TweenLite"], getGlobal);
  163. }
  164. }("TextPlugin"));