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.

995 lines
42 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. /**
  16. * @class Ext.Element
  17. * <p>Encapsulates a DOM element, adding simple DOM manipulation facilities, normalizing for browser differences.</p>
  18. * <p>All instances of this class inherit the methods of {@link Ext.Fx} making visual effects easily available to all DOM elements.</p>
  19. * <p>Note that the events documented in this class are not Ext events, they encapsulate browser events. To
  20. * access the underlying browser event, see {@link Ext.EventObject#browserEvent}. Some older
  21. * browsers may not support the full range of events. Which events are supported is beyond the control of ExtJs.</p>
  22. * Usage:<br>
  23. <pre><code>
  24. // by id
  25. var el = Ext.get("my-div");
  26. // by DOM element reference
  27. var el = Ext.get(myDivElement);
  28. </code></pre>
  29. * <b>Animations</b><br />
  30. * <p>When an element is manipulated, by default there is no animation.</p>
  31. * <pre><code>
  32. var el = Ext.get("my-div");
  33. // no animation
  34. el.setWidth(100);
  35. * </code></pre>
  36. * <p>Many of the functions for manipulating an element have an optional "animate" parameter. This
  37. * parameter can be specified as boolean (<tt>true</tt>) for default animation effects.</p>
  38. * <pre><code>
  39. // default animation
  40. el.setWidth(100, true);
  41. * </code></pre>
  42. *
  43. * <p>To configure the effects, an object literal with animation options to use as the Element animation
  44. * configuration object can also be specified. Note that the supported Element animation configuration
  45. * options are a subset of the {@link Ext.Fx} animation options specific to Fx effects. The supported
  46. * Element animation configuration options are:</p>
  47. <pre>
  48. Option Default Description
  49. --------- -------- ---------------------------------------------
  50. {@link Ext.Fx#duration duration} .35 The duration of the animation in seconds
  51. {@link Ext.Fx#easing easing} easeOut The easing method
  52. {@link Ext.Fx#callback callback} none A function to execute when the anim completes
  53. {@link Ext.Fx#scope scope} this The scope (this) of the callback function
  54. </pre>
  55. *
  56. * <pre><code>
  57. // Element animation options object
  58. var opt = {
  59. {@link Ext.Fx#duration duration}: 1,
  60. {@link Ext.Fx#easing easing}: 'elasticIn',
  61. {@link Ext.Fx#callback callback}: this.foo,
  62. {@link Ext.Fx#scope scope}: this
  63. };
  64. // animation with some options set
  65. el.setWidth(100, opt);
  66. * </code></pre>
  67. * <p>The Element animation object being used for the animation will be set on the options
  68. * object as "anim", which allows you to stop or manipulate the animation. Here is an example:</p>
  69. * <pre><code>
  70. // using the "anim" property to get the Anim object
  71. if(opt.anim.isAnimated()){
  72. opt.anim.stop();
  73. }
  74. * </code></pre>
  75. * <p>Also see the <tt>{@link #animate}</tt> method for another animation technique.</p>
  76. * <p><b> Composite (Collections of) Elements</b></p>
  77. * <p>For working with collections of Elements, see {@link Ext.CompositeElement}</p>
  78. * @constructor Create a new Element directly.
  79. * @param {String/HTMLElement} element
  80. * @param {Boolean} forceNew (optional) By default the constructor checks to see if there is already an instance of this element in the cache and if there is it returns the same instance. This will skip that check (useful for extending this class).
  81. */
  82. (function(){
  83. var DOC = document;
  84. Ext.Element = function(element, forceNew){
  85. var dom = typeof element == "string" ?
  86. DOC.getElementById(element) : element,
  87. id;
  88. if(!dom) return null;
  89. id = dom.id;
  90. if(!forceNew && id && Ext.elCache[id]){ // element object already exists
  91. return Ext.elCache[id].el;
  92. }
  93. <div id="prop-Ext.Element-dom"></div>/**
  94. * The DOM element
  95. * @type HTMLElement
  96. */
  97. this.dom = dom;
  98. <div id="prop-Ext.Element-id"></div>/**
  99. * The DOM element ID
  100. * @type String
  101. */
  102. this.id = id || Ext.id(dom);
  103. };
  104. var DH = Ext.DomHelper,
  105. El = Ext.Element,
  106. EC = Ext.elCache;
  107. El.prototype = {
  108. <div id="method-Ext.Element-set"></div>/**
  109. * Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function)
  110. * @param {Object} o The object with the attributes
  111. * @param {Boolean} useSet (optional) false to override the default setAttribute to use expandos.
  112. * @return {Ext.Element} this
  113. */
  114. set : function(o, useSet){
  115. var el = this.dom,
  116. attr,
  117. val,
  118. useSet = (useSet !== false) && !!el.setAttribute;
  119. for (attr in o) {
  120. if (o.hasOwnProperty(attr)) {
  121. val = o[attr];
  122. if (attr == 'style') {
  123. DH.applyStyles(el, val);
  124. } else if (attr == 'cls') {
  125. el.className = val;
  126. } else if (useSet) {
  127. el.setAttribute(attr, val);
  128. } else {
  129. el[attr] = val;
  130. }
  131. }
  132. }
  133. return this;
  134. },
  135. // Mouse events
  136. <div id="event-Ext.Element-click"></div>/**
  137. * @event click
  138. * Fires when a mouse click is detected within the element.
  139. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  140. * @param {HtmlElement} t The target of the event.
  141. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  142. */
  143. <div id="event-Ext.Element-contextmenu"></div>/**
  144. * @event contextmenu
  145. * Fires when a right click is detected within the element.
  146. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  147. * @param {HtmlElement} t The target of the event.
  148. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  149. */
  150. <div id="event-Ext.Element-dblclick"></div>/**
  151. * @event dblclick
  152. * Fires when a mouse double click is detected within the element.
  153. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  154. * @param {HtmlElement} t The target of the event.
  155. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  156. */
  157. <div id="event-Ext.Element-mousedown"></div>/**
  158. * @event mousedown
  159. * Fires when a mousedown is detected within the element.
  160. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  161. * @param {HtmlElement} t The target of the event.
  162. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  163. */
  164. <div id="event-Ext.Element-mouseup"></div>/**
  165. * @event mouseup
  166. * Fires when a mouseup is detected within the element.
  167. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  168. * @param {HtmlElement} t The target of the event.
  169. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  170. */
  171. <div id="event-Ext.Element-mouseover"></div>/**
  172. * @event mouseover
  173. * Fires when a mouseover is detected within the element.
  174. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  175. * @param {HtmlElement} t The target of the event.
  176. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  177. */
  178. <div id="event-Ext.Element-mousemove"></div>/**
  179. * @event mousemove
  180. * Fires when a mousemove is detected with the element.
  181. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  182. * @param {HtmlElement} t The target of the event.
  183. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  184. */
  185. <div id="event-Ext.Element-mouseout"></div>/**
  186. * @event mouseout
  187. * Fires when a mouseout is detected with the element.
  188. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  189. * @param {HtmlElement} t The target of the event.
  190. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  191. */
  192. <div id="event-Ext.Element-mouseenter"></div>/**
  193. * @event mouseenter
  194. * Fires when the mouse enters the element.
  195. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  196. * @param {HtmlElement} t The target of the event.
  197. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  198. */
  199. <div id="event-Ext.Element-mouseleave"></div>/**
  200. * @event mouseleave
  201. * Fires when the mouse leaves the element.
  202. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  203. * @param {HtmlElement} t The target of the event.
  204. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  205. */
  206. // Keyboard events
  207. <div id="event-Ext.Element-keypress"></div>/**
  208. * @event keypress
  209. * Fires when a keypress is detected within the element.
  210. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  211. * @param {HtmlElement} t The target of the event.
  212. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  213. */
  214. <div id="event-Ext.Element-keydown"></div>/**
  215. * @event keydown
  216. * Fires when a keydown is detected within the element.
  217. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  218. * @param {HtmlElement} t The target of the event.
  219. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  220. */
  221. <div id="event-Ext.Element-keyup"></div>/**
  222. * @event keyup
  223. * Fires when a keyup is detected within the element.
  224. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  225. * @param {HtmlElement} t The target of the event.
  226. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  227. */
  228. // HTML frame/object events
  229. <div id="event-Ext.Element-load"></div>/**
  230. * @event load
  231. * Fires when the user agent finishes loading all content within the element. Only supported by window, frames, objects and images.
  232. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  233. * @param {HtmlElement} t The target of the event.
  234. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  235. */
  236. <div id="event-Ext.Element-unload"></div>/**
  237. * @event unload
  238. * Fires when the user agent removes all content from a window or frame. For elements, it fires when the target element or any of its content has been removed.
  239. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  240. * @param {HtmlElement} t The target of the event.
  241. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  242. */
  243. <div id="event-Ext.Element-abort"></div>/**
  244. * @event abort
  245. * Fires when an object/image is stopped from loading before completely loaded.
  246. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  247. * @param {HtmlElement} t The target of the event.
  248. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  249. */
  250. <div id="event-Ext.Element-error"></div>/**
  251. * @event error
  252. * Fires when an object/image/frame cannot be loaded properly.
  253. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  254. * @param {HtmlElement} t The target of the event.
  255. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  256. */
  257. <div id="event-Ext.Element-resize"></div>/**
  258. * @event resize
  259. * Fires when a document view is resized.
  260. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  261. * @param {HtmlElement} t The target of the event.
  262. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  263. */
  264. <div id="event-Ext.Element-scroll"></div>/**
  265. * @event scroll
  266. * Fires when a document view is scrolled.
  267. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  268. * @param {HtmlElement} t The target of the event.
  269. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  270. */
  271. // Form events
  272. <div id="event-Ext.Element-select"></div>/**
  273. * @event select
  274. * Fires when a user selects some text in a text field, including input and textarea.
  275. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  276. * @param {HtmlElement} t The target of the event.
  277. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  278. */
  279. <div id="event-Ext.Element-change"></div>/**
  280. * @event change
  281. * Fires when a control loses the input focus and its value has been modified since gaining focus.
  282. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  283. * @param {HtmlElement} t The target of the event.
  284. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  285. */
  286. <div id="event-Ext.Element-submit"></div>/**
  287. * @event submit
  288. * Fires when a form is submitted.
  289. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  290. * @param {HtmlElement} t The target of the event.
  291. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  292. */
  293. <div id="event-Ext.Element-reset"></div>/**
  294. * @event reset
  295. * Fires when a form is reset.
  296. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  297. * @param {HtmlElement} t The target of the event.
  298. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  299. */
  300. <div id="event-Ext.Element-focus"></div>/**
  301. * @event focus
  302. * Fires when an element receives focus either via the pointing device or by tab navigation.
  303. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  304. * @param {HtmlElement} t The target of the event.
  305. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  306. */
  307. <div id="event-Ext.Element-blur"></div>/**
  308. * @event blur
  309. * Fires when an element loses focus either via the pointing device or by tabbing navigation.
  310. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  311. * @param {HtmlElement} t The target of the event.
  312. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  313. */
  314. // User Interface events
  315. <div id="event-Ext.Element-DOMFocusIn"></div>/**
  316. * @event DOMFocusIn
  317. * Where supported. Similar to HTML focus event, but can be applied to any focusable element.
  318. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  319. * @param {HtmlElement} t The target of the event.
  320. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  321. */
  322. <div id="event-Ext.Element-DOMFocusOut"></div>/**
  323. * @event DOMFocusOut
  324. * Where supported. Similar to HTML blur event, but can be applied to any focusable element.
  325. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  326. * @param {HtmlElement} t The target of the event.
  327. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  328. */
  329. <div id="event-Ext.Element-DOMActivate"></div>/**
  330. * @event DOMActivate
  331. * Where supported. Fires when an element is activated, for instance, through a mouse click or a keypress.
  332. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  333. * @param {HtmlElement} t The target of the event.
  334. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  335. */
  336. // DOM Mutation events
  337. <div id="event-Ext.Element-DOMSubtreeModified"></div>/**
  338. * @event DOMSubtreeModified
  339. * Where supported. Fires when the subtree is modified.
  340. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  341. * @param {HtmlElement} t The target of the event.
  342. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  343. */
  344. <div id="event-Ext.Element-DOMNodeInserted"></div>/**
  345. * @event DOMNodeInserted
  346. * Where supported. Fires when a node has been added as a child of another node.
  347. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  348. * @param {HtmlElement} t The target of the event.
  349. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  350. */
  351. <div id="event-Ext.Element-DOMNodeRemoved"></div>/**
  352. * @event DOMNodeRemoved
  353. * Where supported. Fires when a descendant node of the element is removed.
  354. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  355. * @param {HtmlElement} t The target of the event.
  356. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  357. */
  358. <div id="event-Ext.Element-DOMNodeRemovedFromDocument"></div>/**
  359. * @event DOMNodeRemovedFromDocument
  360. * Where supported. Fires when a node is being removed from a document.
  361. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  362. * @param {HtmlElement} t The target of the event.
  363. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  364. */
  365. <div id="event-Ext.Element-DOMNodeInsertedIntoDocument"></div>/**
  366. * @event DOMNodeInsertedIntoDocument
  367. * Where supported. Fires when a node is being inserted into a document.
  368. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  369. * @param {HtmlElement} t The target of the event.
  370. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  371. */
  372. <div id="event-Ext.Element-DOMAttrModified"></div>/**
  373. * @event DOMAttrModified
  374. * Where supported. Fires when an attribute has been modified.
  375. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  376. * @param {HtmlElement} t The target of the event.
  377. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  378. */
  379. <div id="event-Ext.Element-DOMCharacterDataModified"></div>/**
  380. * @event DOMCharacterDataModified
  381. * Where supported. Fires when the character data has been modified.
  382. * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
  383. * @param {HtmlElement} t The target of the event.
  384. * @param {Object} o The options configuration passed to the {@link #addListener} call.
  385. */
  386. <div id="prop-Ext.Element-defaultUnit"></div>/**
  387. * The default unit to append to CSS values where a unit isn't provided (defaults to px).
  388. * @type String
  389. */
  390. defaultUnit : "px",
  391. <div id="method-Ext.Element-is"></div>/**
  392. * Returns true if this element matches the passed simple selector (e.g. div.some-class or span:first-child)
  393. * @param {String} selector The simple selector to test
  394. * @return {Boolean} True if this element matches the selector, else false
  395. */
  396. is : function(simpleSelector){
  397. return Ext.DomQuery.is(this.dom, simpleSelector);
  398. },
  399. <div id="method-Ext.Element-focus"></div>/**
  400. * Tries to focus the element. Any exceptions are caught and ignored.
  401. * @param {Number} defer (optional) Milliseconds to defer the focus
  402. * @return {Ext.Element} this
  403. */
  404. focus : function(defer, /* private */ dom) {
  405. var me = this,
  406. dom = dom || me.dom;
  407. try{
  408. if(Number(defer)){
  409. me.focus.defer(defer, null, [null, dom]);
  410. }else{
  411. dom.focus();
  412. }
  413. }catch(e){}
  414. return me;
  415. },
  416. <div id="method-Ext.Element-blur"></div>/**
  417. * Tries to blur the element. Any exceptions are caught and ignored.
  418. * @return {Ext.Element} this
  419. */
  420. blur : function() {
  421. try{
  422. this.dom.blur();
  423. }catch(e){}
  424. return this;
  425. },
  426. <div id="method-Ext.Element-getValue"></div>/**
  427. * Returns the value of the "value" attribute
  428. * @param {Boolean} asNumber true to parse the value as a number
  429. * @return {String/Number}
  430. */
  431. getValue : function(asNumber){
  432. var val = this.dom.value;
  433. return asNumber ? parseInt(val, 10) : val;
  434. },
  435. <div id="method-Ext.Element-addListener"></div>/**
  436. * Appends an event handler to this element. The shorthand version {@link #on} is equivalent.
  437. * @param {String} eventName The name of event to handle.
  438. * @param {Function} fn The handler function the event invokes. This function is passed
  439. * the following parameters:<ul>
  440. * <li><b>evt</b> : EventObject<div class="sub-desc">The {@link Ext.EventObject EventObject} describing the event.</div></li>
  441. * <li><b>el</b> : HtmlElement<div class="sub-desc">The DOM element which was the target of the event.
  442. * Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>
  443. * <li><b>o</b> : Object<div class="sub-desc">The options object from the addListener call.</div></li>
  444. * </ul>
  445. * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
  446. * <b>If omitted, defaults to this Element.</b>.
  447. * @param {Object} options (optional) An object containing handler configuration properties.
  448. * This may contain any of the following properties:<ul>
  449. * <li><b>scope</b> Object : <div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the handler function is executed.
  450. * <b>If omitted, defaults to this Element.</b></div></li>
  451. * <li><b>delegate</b> String: <div class="sub-desc">A simple selector to filter the target or look for a descendant of the target. See below for additional details.</div></li>
  452. * <li><b>stopEvent</b> Boolean: <div class="sub-desc">True to stop the event. That is stop propagation, and prevent the default action.</div></li>
  453. * <li><b>preventDefault</b> Boolean: <div class="sub-desc">True to prevent the default action</div></li>
  454. * <li><b>stopPropagation</b> Boolean: <div class="sub-desc">True to prevent event propagation</div></li>
  455. * <li><b>normalized</b> Boolean: <div class="sub-desc">False to pass a browser event to the handler function instead of an Ext.EventObject</div></li>
  456. * <li><b>target</b> Ext.Element: <div class="sub-desc">Only call the handler if the event was fired on the target Element, <i>not</i> if the event was bubbled up from a child node.</div></li>
  457. * <li><b>delay</b> Number: <div class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</div></li>
  458. * <li><b>single</b> Boolean: <div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
  459. * <li><b>buffer</b> Number: <div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed
  460. * by the specified number of milliseconds. If the event fires again within that time, the original
  461. * handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
  462. * </ul><br>
  463. * <p>
  464. * <b>Combining Options</b><br>
  465. * In the following examples, the shorthand form {@link #on} is used rather than the more verbose
  466. * addListener. The two are equivalent. Using the options argument, it is possible to combine different
  467. * types of listeners:<br>
  468. * <br>
  469. * A delayed, one-time listener that auto stops the event and adds a custom argument (forumId) to the
  470. * options object. The options object is available as the third parameter in the handler function.<div style="margin: 5px 20px 20px;">
  471. * Code:<pre><code>
  472. el.on('click', this.onClick, this, {
  473. single: true,
  474. delay: 100,
  475. stopEvent : true,
  476. forumId: 4
  477. });</code></pre></p>
  478. * <p>
  479. * <b>Attaching multiple handlers in 1 call</b><br>
  480. * The method also allows for a single argument to be passed which is a config object containing properties
  481. * which specify multiple handlers.</p>
  482. * <p>
  483. * Code:<pre><code>
  484. el.on({
  485. 'click' : {
  486. fn: this.onClick,
  487. scope: this,
  488. delay: 100
  489. },
  490. 'mouseover' : {
  491. fn: this.onMouseOver,
  492. scope: this
  493. },
  494. 'mouseout' : {
  495. fn: this.onMouseOut,
  496. scope: this
  497. }
  498. });</code></pre>
  499. * <p>
  500. * Or a shorthand syntax:<br>
  501. * Code:<pre><code></p>
  502. el.on({
  503. 'click' : this.onClick,
  504. 'mouseover' : this.onMouseOver,
  505. 'mouseout' : this.onMouseOut,
  506. scope: this
  507. });
  508. * </code></pre></p>
  509. * <p><b>delegate</b></p>
  510. * <p>This is a configuration option that you can pass along when registering a handler for
  511. * an event to assist with event delegation. Event delegation is a technique that is used to
  512. * reduce memory consumption and prevent exposure to memory-leaks. By registering an event
  513. * for a container element as opposed to each element within a container. By setting this
  514. * configuration option to a simple selector, the target element will be filtered to look for
  515. * a descendant of the target.
  516. * For example:<pre><code>
  517. // using this markup:
  518. &lt;div id='elId'>
  519. &lt;p id='p1'>paragraph one&lt;/p>
  520. &lt;p id='p2' class='clickable'>paragraph two&lt;/p>
  521. &lt;p id='p3'>paragraph three&lt;/p>
  522. &lt;/div>
  523. // utilize event delegation to registering just one handler on the container element:
  524. el = Ext.get('elId');
  525. el.on(
  526. 'click',
  527. function(e,t) {
  528. // handle click
  529. console.info(t.id); // 'p2'
  530. },
  531. this,
  532. {
  533. // filter the target element to be a descendant with the class 'clickable'
  534. delegate: '.clickable'
  535. }
  536. );
  537. * </code></pre></p>
  538. * @return {Ext.Element} this
  539. */
  540. addListener : function(eventName, fn, scope, options){
  541. Ext.EventManager.on(this.dom, eventName, fn, scope || this, options);
  542. return this;
  543. },
  544. <div id="method-Ext.Element-removeListener"></div>/**
  545. * Removes an event handler from this element. The shorthand version {@link #un} is equivalent.
  546. * <b>Note</b>: if a <i>scope</i> was explicitly specified when {@link #addListener adding} the
  547. * listener, the same scope must be specified here.
  548. * Example:
  549. * <pre><code>
  550. el.removeListener('click', this.handlerFn);
  551. // or
  552. el.un('click', this.handlerFn);
  553. </code></pre>
  554. * @param {String} eventName The name of the event from which to remove the handler.
  555. * @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
  556. * @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,
  557. * then this must refer to the same object.
  558. * @return {Ext.Element} this
  559. */
  560. removeListener : function(eventName, fn, scope){
  561. Ext.EventManager.removeListener(this.dom, eventName, fn, scope || this);
  562. return this;
  563. },
  564. <div id="method-Ext.Element-removeAllListeners"></div>/**
  565. * Removes all previous added listeners from this element
  566. * @return {Ext.Element} this
  567. */
  568. removeAllListeners : function(){
  569. Ext.EventManager.removeAll(this.dom);
  570. return this;
  571. },
  572. <div id="method-Ext.Element-purgeAllListeners"></div>/**
  573. * Recursively removes all previous added listeners from this element and its children
  574. * @return {Ext.Element} this
  575. */
  576. purgeAllListeners : function() {
  577. Ext.EventManager.purgeElement(this, true);
  578. return this;
  579. },
  580. /**
  581. * @private Test if size has a unit, otherwise appends the default
  582. */
  583. addUnits : function(size){
  584. if(size === "" || size == "auto" || size === undefined){
  585. size = size || '';
  586. } else if(!isNaN(size) || !unitPattern.test(size)){
  587. size = size + (this.defaultUnit || 'px');
  588. }
  589. return size;
  590. },
  591. <div id="method-Ext.Element-load"></div>/**
  592. * <p>Updates the <a href="http://developer.mozilla.org/en/DOM/element.innerHTML">innerHTML</a> of this Element
  593. * from a specified URL. Note that this is subject to the <a href="http://en.wikipedia.org/wiki/Same_origin_policy">Same Origin Policy</a></p>
  594. * <p>Updating innerHTML of an element will <b>not</b> execute embedded <tt>&lt;script></tt> elements. This is a browser restriction.</p>
  595. * @param {Mixed} options. Either a sring containing the URL from which to load the HTML, or an {@link Ext.Ajax#request} options object specifying
  596. * exactly how to request the HTML.
  597. * @return {Ext.Element} this
  598. */
  599. load : function(url, params, cb){
  600. Ext.Ajax.request(Ext.apply({
  601. params: params,
  602. url: url.url || url,
  603. callback: cb,
  604. el: this.dom,
  605. indicatorText: url.indicatorText || ''
  606. }, Ext.isObject(url) ? url : {}));
  607. return this;
  608. },
  609. <div id="method-Ext.Element-isBorderBox"></div>/**
  610. * Tests various css rules/browsers to determine if this element uses a border box
  611. * @return {Boolean}
  612. */
  613. isBorderBox : function(){
  614. return Ext.isBorderBox || Ext.isForcedBorderBox || noBoxAdjust[(this.dom.tagName || "").toLowerCase()];
  615. },
  616. <div id="method-Ext.Element-remove"></div>/**
  617. * <p>Removes this element's dom reference. Note that event and cache removal is handled at {@link Ext#removeNode}</p>
  618. */
  619. remove : function(){
  620. var me = this,
  621. dom = me.dom;
  622. if (dom) {
  623. delete me.dom;
  624. Ext.removeNode(dom);
  625. }
  626. },
  627. <div id="method-Ext.Element-hover"></div>/**
  628. * Sets up event handlers to call the passed functions when the mouse is moved into and out of the Element.
  629. * @param {Function} overFn The function to call when the mouse enters the Element.
  630. * @param {Function} outFn The function to call when the mouse leaves the Element.
  631. * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the functions are executed. Defaults to the Element's DOM element.
  632. * @param {Object} options (optional) Options for the listener. See {@link Ext.util.Observable#addListener the <tt>options</tt> parameter}.
  633. * @return {Ext.Element} this
  634. */
  635. hover : function(overFn, outFn, scope, options){
  636. var me = this;
  637. me.on('mouseenter', overFn, scope || me.dom, options);
  638. me.on('mouseleave', outFn, scope || me.dom, options);
  639. return me;
  640. },
  641. <div id="method-Ext.Element-contains"></div>/**
  642. * Returns true if this element is an ancestor of the passed element
  643. * @param {HTMLElement/String} el The element to check
  644. * @return {Boolean} True if this element is an ancestor of el, else false
  645. */
  646. contains : function(el){
  647. return !el ? false : Ext.lib.Dom.isAncestor(this.dom, el.dom ? el.dom : el);
  648. },
  649. <div id="method-Ext.Element-getAttributeNS"></div>/**
  650. * Returns the value of a namespaced attribute from the element's underlying DOM node.
  651. * @param {String} namespace The namespace in which to look for the attribute
  652. * @param {String} name The attribute name
  653. * @return {String} The attribute value
  654. * @deprecated
  655. */
  656. getAttributeNS : function(ns, name){
  657. return this.getAttribute(name, ns);
  658. },
  659. <div id="method-Ext.Element-getAttribute"></div>/**
  660. * Returns the value of an attribute from the element's underlying DOM node.
  661. * @param {String} name The attribute name
  662. * @param {String} namespace (optional) The namespace in which to look for the attribute
  663. * @return {String} The attribute value
  664. */
  665. getAttribute : Ext.isIE ? function(name, ns){
  666. var d = this.dom,
  667. type = typeof d[ns + ":" + name];
  668. if(['undefined', 'unknown'].indexOf(type) == -1){
  669. return d[ns + ":" + name];
  670. }
  671. return d[name];
  672. } : function(name, ns){
  673. var d = this.dom;
  674. return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name) || d.getAttribute(name) || d[name];
  675. },
  676. <div id="method-Ext.Element-update"></div>/**
  677. * Update the innerHTML of this element
  678. * @param {String} html The new HTML
  679. * @return {Ext.Element} this
  680. */
  681. update : function(html) {
  682. if (this.dom) {
  683. this.dom.innerHTML = html;
  684. }
  685. return this;
  686. }
  687. };
  688. var ep = El.prototype;
  689. El.addMethods = function(o){
  690. Ext.apply(ep, o);
  691. };
  692. <div id="method-Ext.Element-on"></div>/**
  693. * Appends an event handler (shorthand for {@link #addListener}).
  694. * @param {String} eventName The name of event to handle.
  695. * @param {Function} fn The handler function the event invokes.
  696. * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the handler function is executed.
  697. * @param {Object} options (optional) An object containing standard {@link #addListener} options
  698. * @member Ext.Element
  699. * @method on
  700. */
  701. ep.on = ep.addListener;
  702. <div id="method-Ext.Element-un"></div>/**
  703. * Removes an event handler from this element (see {@link #removeListener} for additional notes).
  704. * @param {String} eventName The name of the event from which to remove the handler.
  705. * @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
  706. * @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,
  707. * then this must refer to the same object.
  708. * @return {Ext.Element} this
  709. * @member Ext.Element
  710. * @method un
  711. */
  712. ep.un = ep.removeListener;
  713. <div id="prop-Ext.Element-autoBoxAdjust"></div>/**
  714. * true to automatically adjust width and height settings for box-model issues (default to true)
  715. */
  716. ep.autoBoxAdjust = true;
  717. // private
  718. var unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,
  719. docEl;
  720. /**
  721. * @private
  722. */
  723. <div id="method-Ext.Element-get"></div>/**
  724. * Retrieves Ext.Element objects.
  725. * <p><b>This method does not retrieve {@link Ext.Component Component}s.</b> This method
  726. * retrieves Ext.Element objects which encapsulate DOM elements. To retrieve a Component by
  727. * its ID, use {@link Ext.ComponentMgr#get}.</p>
  728. * <p>Uses simple caching to consistently return the same object. Automatically fixes if an
  729. * object was recreated with the same id via AJAX or DOM.</p>
  730. * @param {Mixed} el The id of the node, a DOM Node or an existing Element.
  731. * @return {Element} The Element object (or null if no matching element was found)
  732. * @static
  733. * @member Ext.Element
  734. * @method get
  735. */
  736. El.get = function(el){
  737. var ex,
  738. elm,
  739. id;
  740. if(!el){ return null; }
  741. if (typeof el == "string") { // element id
  742. if (!(elm = DOC.getElementById(el))) {
  743. return null;
  744. }
  745. if (EC[el] && EC[el].el) {
  746. ex = EC[el].el;
  747. ex.dom = elm;
  748. } else {
  749. ex = El.addToCache(new El(elm));
  750. }
  751. return ex;
  752. } else if (el.tagName) { // dom element
  753. if(!(id = el.id)){
  754. id = Ext.id(el);
  755. }
  756. if (EC[id] && EC[id].el) {
  757. ex = EC[id].el;
  758. ex.dom = el;
  759. } else {
  760. ex = El.addToCache(new El(el));
  761. }
  762. return ex;
  763. } else if (el instanceof El) {
  764. if(el != docEl){
  765. // refresh dom element in case no longer valid,
  766. // catch case where it hasn't been appended
  767. // If an el instance is passed, don't pass to getElementById without some kind of id
  768. if (Ext.isIE && (el.id == undefined || el.id == '')) {
  769. el.dom = el.dom;
  770. } else {
  771. el.dom = DOC.getElementById(el.id) || el.dom;
  772. }
  773. }
  774. return el;
  775. } else if(el.isComposite) {
  776. return el;
  777. } else if(Ext.isArray(el)) {
  778. return El.select(el);
  779. } else if(el == DOC) {
  780. // create a bogus element object representing the document object
  781. if(!docEl){
  782. var f = function(){};
  783. f.prototype = El.prototype;
  784. docEl = new f();
  785. docEl.dom = DOC;
  786. }
  787. return docEl;
  788. }
  789. return null;
  790. };
  791. El.addToCache = function(el, id){
  792. id = id || el.id;
  793. EC[id] = {
  794. el: el,
  795. data: {},
  796. events: {}
  797. };
  798. return el;
  799. };
  800. // private method for getting and setting element data
  801. El.data = function(el, key, value){
  802. el = El.get(el);
  803. if (!el) {
  804. return null;
  805. }
  806. var c = EC[el.id].data;
  807. if(arguments.length == 2){
  808. return c[key];
  809. }else{
  810. return (c[key] = value);
  811. }
  812. };
  813. // private
  814. // Garbage collection - uncache elements/purge listeners on orphaned elements
  815. // so we don't hold a reference and cause the browser to retain them
  816. function garbageCollect(){
  817. if(!Ext.enableGarbageCollector){
  818. clearInterval(El.collectorThreadId);
  819. } else {
  820. var eid,
  821. el,
  822. d,
  823. o;
  824. for(eid in EC){
  825. o = EC[eid];
  826. if(o.skipGC){
  827. continue;
  828. }
  829. el = o.el;
  830. d = el.dom;
  831. // -------------------------------------------------------
  832. // Determining what is garbage:
  833. // -------------------------------------------------------
  834. // !d
  835. // dom node is null, definitely garbage
  836. // -------------------------------------------------------
  837. // !d.parentNode
  838. // no parentNode == direct orphan, definitely garbage
  839. // -------------------------------------------------------
  840. // !d.offsetParent && !document.getElementById(eid)
  841. // display none elements have no offsetParent so we will
  842. // also try to look it up by it's id. However, check
  843. // offsetParent first so we don't do unneeded lookups.
  844. // This enables collection of elements that are not orphans
  845. // directly, but somewhere up the line they have an orphan
  846. // parent.
  847. // -------------------------------------------------------
  848. if(!d || !d.parentNode || (!d.offsetParent && !DOC.getElementById(eid))){
  849. if(Ext.enableListenerCollection){
  850. Ext.EventManager.removeAll(d);
  851. }
  852. delete EC[eid];
  853. }
  854. }
  855. // Cleanup IE Object leaks
  856. if (Ext.isIE) {
  857. var t = {};
  858. for (eid in EC) {
  859. t[eid] = EC[eid];
  860. }
  861. EC = Ext.elCache = t;
  862. }
  863. }
  864. }
  865. El.collectorThreadId = setInterval(garbageCollect, 30000);
  866. var flyFn = function(){};
  867. flyFn.prototype = El.prototype;
  868. // dom is optional
  869. El.Flyweight = function(dom){
  870. this.dom = dom;
  871. };
  872. El.Flyweight.prototype = new flyFn();
  873. El.Flyweight.prototype.isFlyweight = true;
  874. El._flyweights = {};
  875. <div id="method-Ext.Element-fly"></div>/**
  876. * <p>Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -
  877. * the dom node can be overwritten by other code. Shorthand of {@link Ext.Element#fly}</p>
  878. * <p>Use this to make one-time references to DOM elements which are not going to be accessed again either by
  879. * application code, or by Ext's classes. If accessing an element which will be processed regularly, then {@link Ext#get}
  880. * will be more appropriate to take advantage of the caching provided by the Ext.Element class.</p>
  881. * @param {String/HTMLElement} el The dom node or id
  882. * @param {String} named (optional) Allows for creation of named reusable flyweights to prevent conflicts
  883. * (e.g. internally Ext uses "_global")
  884. * @return {Element} The shared Element object (or null if no matching element was found)
  885. * @member Ext.Element
  886. * @method fly
  887. */
  888. El.fly = function(el, named){
  889. var ret = null;
  890. named = named || '_global';
  891. if (el = Ext.getDom(el)) {
  892. (El._flyweights[named] = El._flyweights[named] || new El.Flyweight()).dom = el;
  893. ret = El._flyweights[named];
  894. }
  895. return ret;
  896. };
  897. <div id="method-Ext-get"></div>/**
  898. * Retrieves Ext.Element objects.
  899. * <p><b>This method does not retrieve {@link Ext.Component Component}s.</b> This method
  900. * retrieves Ext.Element objects which encapsulate DOM elements. To retrieve a Component by
  901. * its ID, use {@link Ext.ComponentMgr#get}.</p>
  902. * <p>Uses simple caching to consistently return the same object. Automatically fixes if an
  903. * object was recreated with the same id via AJAX or DOM.</p>
  904. * Shorthand of {@link Ext.Element#get}
  905. * @param {Mixed} el The id of the node, a DOM Node or an existing Element.
  906. * @return {Element} The Element object (or null if no matching element was found)
  907. * @member Ext
  908. * @method get
  909. */
  910. Ext.get = El.get;
  911. <div id="method-Ext-fly"></div>/**
  912. * <p>Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -
  913. * the dom node can be overwritten by other code. Shorthand of {@link Ext.Element#fly}</p>
  914. * <p>Use this to make one-time references to DOM elements which are not going to be accessed again either by
  915. * application code, or by Ext's classes. If accessing an element which will be processed regularly, then {@link Ext#get}
  916. * will be more appropriate to take advantage of the caching provided by the Ext.Element class.</p>
  917. * @param {String/HTMLElement} el The dom node or id
  918. * @param {String} named (optional) Allows for creation of named reusable flyweights to prevent conflicts
  919. * (e.g. internally Ext uses "_global")
  920. * @return {Element} The shared Element object (or null if no matching element was found)
  921. * @member Ext
  922. * @method fly
  923. */
  924. Ext.fly = El.fly;
  925. // speedy lookup for elements never to box adjust
  926. var noBoxAdjust = Ext.isStrict ? {
  927. select:1
  928. } : {
  929. input:1, select:1, textarea:1
  930. };
  931. if(Ext.isIE || Ext.isGecko){
  932. noBoxAdjust['button'] = 1;
  933. }
  934. })();
  935. </pre>
  936. </body>
  937. </html>