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.

212 lines
6.9 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. <div id="cls-Ext.Shadow"></div>/**
  16. * @class Ext.Shadow
  17. * Simple class that can provide a shadow effect for any element. Note that the element MUST be absolutely positioned,
  18. * and the shadow does not provide any shimming. This should be used only in simple cases -- for more advanced
  19. * functionality that can also provide the same shadow effect, see the {@link Ext.Layer} class.
  20. * @constructor
  21. * Create a new Shadow
  22. * @param {Object} config The config object
  23. */
  24. Ext.Shadow = function(config) {
  25. Ext.apply(this, config);
  26. if (typeof this.mode != "string") {
  27. this.mode = this.defaultMode;
  28. }
  29. var o = this.offset,
  30. a = {
  31. h: 0
  32. },
  33. rad = Math.floor(this.offset / 2);
  34. switch (this.mode.toLowerCase()) {
  35. // all this hideous nonsense calculates the various offsets for shadows
  36. case "drop":
  37. a.w = 0;
  38. a.l = a.t = o;
  39. a.t -= 1;
  40. if (Ext.isIE) {
  41. a.l -= this.offset + rad;
  42. a.t -= this.offset + rad;
  43. a.w -= rad;
  44. a.h -= rad;
  45. a.t += 1;
  46. }
  47. break;
  48. case "sides":
  49. a.w = (o * 2);
  50. a.l = -o;
  51. a.t = o - 1;
  52. if (Ext.isIE) {
  53. a.l -= (this.offset - rad);
  54. a.t -= this.offset + rad;
  55. a.l += 1;
  56. a.w -= (this.offset - rad) * 2;
  57. a.w -= rad + 1;
  58. a.h -= 1;
  59. }
  60. break;
  61. case "frame":
  62. a.w = a.h = (o * 2);
  63. a.l = a.t = -o;
  64. a.t += 1;
  65. a.h -= 2;
  66. if (Ext.isIE) {
  67. a.l -= (this.offset - rad);
  68. a.t -= (this.offset - rad);
  69. a.l += 1;
  70. a.w -= (this.offset + rad + 1);
  71. a.h -= (this.offset + rad);
  72. a.h += 1;
  73. }
  74. break;
  75. };
  76. this.adjusts = a;
  77. };
  78. Ext.Shadow.prototype = {
  79. <div id="cfg-Ext.Shadow-mode"></div>/**
  80. * @cfg {String} mode
  81. * The shadow display mode. Supports the following options:<div class="mdetail-params"><ul>
  82. * <li><b><tt>sides</tt></b> : Shadow displays on both sides and bottom only</li>
  83. * <li><b><tt>frame</tt></b> : Shadow displays equally on all four sides</li>
  84. * <li><b><tt>drop</tt></b> : Traditional bottom-right drop shadow</li>
  85. * </ul></div>
  86. */
  87. <div id="cfg-Ext.Shadow-offset"></div>/**
  88. * @cfg {String} offset
  89. * The number of pixels to offset the shadow from the element (defaults to <tt>4</tt>)
  90. */
  91. offset: 4,
  92. // private
  93. defaultMode: "drop",
  94. <div id="method-Ext.Shadow-show"></div>/**
  95. * Displays the shadow under the target element
  96. * @param {Mixed} targetEl The id or element under which the shadow should display
  97. */
  98. show: function(target) {
  99. target = Ext.get(target);
  100. if (!this.el) {
  101. this.el = Ext.Shadow.Pool.pull();
  102. if (this.el.dom.nextSibling != target.dom) {
  103. this.el.insertBefore(target);
  104. }
  105. }
  106. this.el.setStyle("z-index", this.zIndex || parseInt(target.getStyle("z-index"), 10) - 1);
  107. if (Ext.isIE) {
  108. this.el.dom.style.filter = "progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius=" + (this.offset) + ")";
  109. }
  110. this.realign(
  111. target.getLeft(true),
  112. target.getTop(true),
  113. target.getWidth(),
  114. target.getHeight()
  115. );
  116. this.el.dom.style.display = "block";
  117. },
  118. <div id="method-Ext.Shadow-isVisible"></div>/**
  119. * Returns true if the shadow is visible, else false
  120. */
  121. isVisible: function() {
  122. return this.el ? true: false;
  123. },
  124. <div id="method-Ext.Shadow-realign"></div>/**
  125. * Direct alignment when values are already available. Show must be called at least once before
  126. * calling this method to ensure it is initialized.
  127. * @param {Number} left The target element left position
  128. * @param {Number} top The target element top position
  129. * @param {Number} width The target element width
  130. * @param {Number} height The target element height
  131. */
  132. realign: function(l, t, w, h) {
  133. if (!this.el) {
  134. return;
  135. }
  136. var a = this.adjusts,
  137. d = this.el.dom,
  138. s = d.style,
  139. iea = 0,
  140. sw = (w + a.w),
  141. sh = (h + a.h),
  142. sws = sw + "px",
  143. shs = sh + "px",
  144. cn,
  145. sww;
  146. s.left = (l + a.l) + "px";
  147. s.top = (t + a.t) + "px";
  148. if (s.width != sws || s.height != shs) {
  149. s.width = sws;
  150. s.height = shs;
  151. if (!Ext.isIE) {
  152. cn = d.childNodes;
  153. sww = Math.max(0, (sw - 12)) + "px";
  154. cn[0].childNodes[1].style.width = sww;
  155. cn[1].childNodes[1].style.width = sww;
  156. cn[2].childNodes[1].style.width = sww;
  157. cn[1].style.height = Math.max(0, (sh - 12)) + "px";
  158. }
  159. }
  160. },
  161. <div id="method-Ext.Shadow-hide"></div>/**
  162. * Hides this shadow
  163. */
  164. hide: function() {
  165. if (this.el) {
  166. this.el.dom.style.display = "none";
  167. Ext.Shadow.Pool.push(this.el);
  168. delete this.el;
  169. }
  170. },
  171. <div id="method-Ext.Shadow-setZIndex"></div>/**
  172. * Adjust the z-index of this shadow
  173. * @param {Number} zindex The new z-index
  174. */
  175. setZIndex: function(z) {
  176. this.zIndex = z;
  177. if (this.el) {
  178. this.el.setStyle("z-index", z);
  179. }
  180. }
  181. };
  182. // Private utility class that manages the internal Shadow cache
  183. Ext.Shadow.Pool = function() {
  184. var p = [],
  185. markup = Ext.isIE ?
  186. '<div class="x-ie-shadow"></div>':
  187. '<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>';
  188. return {
  189. pull: function() {
  190. var sh = p.shift();
  191. if (!sh) {
  192. sh = Ext.get(Ext.DomHelper.insertHtml("beforeBegin", document.body.firstChild, markup));
  193. sh.autoBoxAdjust = false;
  194. }
  195. return sh;
  196. },
  197. push: function(sh) {
  198. p.push(sh);
  199. }
  200. };
  201. }();</pre>
  202. </body>
  203. </html>