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.

127 lines
5.0 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. /**
  16. * @class Ext.Element
  17. */
  18. Ext.Element.addMethods({
  19. <div id="method-Ext.Element-scrollTo"></div>/**
  20. * Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().
  21. * @param {String} side Either "left" for scrollLeft values or "top" for scrollTop values.
  22. * @param {Number} value The new scroll value
  23. * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
  24. * @return {Element} this
  25. */
  26. scrollTo : function(side, value, animate) {
  27. //check if we're scrolling top or left
  28. var top = /top/i.test(side),
  29. me = this,
  30. dom = me.dom,
  31. prop;
  32. if (!animate || !me.anim) {
  33. // just setting the value, so grab the direction
  34. prop = 'scroll' + (top ? 'Top' : 'Left');
  35. dom[prop] = value;
  36. }
  37. else {
  38. // if scrolling top, we need to grab scrollLeft, if left, scrollTop
  39. prop = 'scroll' + (top ? 'Left' : 'Top');
  40. me.anim({scroll: {to: top ? [dom[prop], value] : [value, dom[prop]]}}, me.preanim(arguments, 2), 'scroll');
  41. }
  42. return me;
  43. },
  44. <div id="method-Ext.Element-scrollIntoView"></div>/**
  45. * Scrolls this element into view within the passed container.
  46. * @param {Mixed} container (optional) The container element to scroll (defaults to document.body). Should be a
  47. * string (id), dom node, or Ext.Element.
  48. * @param {Boolean} hscroll (optional) False to disable horizontal scroll (defaults to true)
  49. * @return {Ext.Element} this
  50. */
  51. scrollIntoView : function(container, hscroll) {
  52. var c = Ext.getDom(container) || Ext.getBody().dom,
  53. el = this.dom,
  54. o = this.getOffsetsTo(c),
  55. l = o[0] + c.scrollLeft,
  56. t = o[1] + c.scrollTop,
  57. b = t + el.offsetHeight,
  58. r = l + el.offsetWidth,
  59. ch = c.clientHeight,
  60. ct = parseInt(c.scrollTop, 10),
  61. cl = parseInt(c.scrollLeft, 10),
  62. cb = ct + ch,
  63. cr = cl + c.clientWidth;
  64. if (el.offsetHeight > ch || t < ct) {
  65. c.scrollTop = t;
  66. }
  67. else if (b > cb) {
  68. c.scrollTop = b-ch;
  69. }
  70. // corrects IE, other browsers will ignore
  71. c.scrollTop = c.scrollTop;
  72. if (hscroll !== false) {
  73. if (el.offsetWidth > c.clientWidth || l < cl) {
  74. c.scrollLeft = l;
  75. }
  76. else if (r > cr) {
  77. c.scrollLeft = r - c.clientWidth;
  78. }
  79. c.scrollLeft = c.scrollLeft;
  80. }
  81. return this;
  82. },
  83. // private
  84. scrollChildIntoView : function(child, hscroll) {
  85. Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
  86. },
  87. <div id="method-Ext.Element-scroll"></div>/**
  88. * Scrolls this element the specified direction. Does bounds checking to make sure the scroll is
  89. * within this element's scrollable range.
  90. * @param {String} direction Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").
  91. * @param {Number} distance How far to scroll the element in pixels
  92. * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
  93. * @return {Boolean} Returns true if a scroll was triggered or false if the element
  94. * was scrolled as far as it could go.
  95. */
  96. scroll : function(direction, distance, animate) {
  97. if (!this.isScrollable()) {
  98. return false;
  99. }
  100. var el = this.dom,
  101. l = el.scrollLeft, t = el.scrollTop,
  102. w = el.scrollWidth, h = el.scrollHeight,
  103. cw = el.clientWidth, ch = el.clientHeight,
  104. scrolled = false, v,
  105. hash = {
  106. l: Math.min(l + distance, w-cw),
  107. r: v = Math.max(l - distance, 0),
  108. t: Math.max(t - distance, 0),
  109. b: Math.min(t + distance, h-ch)
  110. };
  111. hash.d = hash.b;
  112. hash.u = hash.t;
  113. direction = direction.substr(0, 1);
  114. if ((v = hash[direction]) > -1) {
  115. scrolled = true;
  116. this.scrollTo(direction == 'l' || direction == 'r' ? 'left' : 'top', v, this.preanim(arguments, 2));
  117. }
  118. return scrolled;
  119. }
  120. });</pre>
  121. </body>
  122. </html>