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.

210 lines
7.3 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. */
  18. Ext.Element.addMethods({
  19. <div id="method-Ext.Element-swallowEvent"></div>/**
  20. * Stops the specified event(s) from bubbling and optionally prevents the default action
  21. * @param {String/Array} eventName an event / array of events to stop from bubbling
  22. * @param {Boolean} preventDefault (optional) true to prevent the default action too
  23. * @return {Ext.Element} this
  24. */
  25. swallowEvent : function(eventName, preventDefault) {
  26. var me = this;
  27. function fn(e) {
  28. e.stopPropagation();
  29. if (preventDefault) {
  30. e.preventDefault();
  31. }
  32. }
  33. if (Ext.isArray(eventName)) {
  34. Ext.each(eventName, function(e) {
  35. me.on(e, fn);
  36. });
  37. return me;
  38. }
  39. me.on(eventName, fn);
  40. return me;
  41. },
  42. <div id="method-Ext.Element-relayEvent"></div>/**
  43. * Create an event handler on this element such that when the event fires and is handled by this element,
  44. * it will be relayed to another object (i.e., fired again as if it originated from that object instead).
  45. * @param {String} eventName The type of event to relay
  46. * @param {Object} object Any object that extends {@link Ext.util.Observable} that will provide the context
  47. * for firing the relayed event
  48. */
  49. relayEvent : function(eventName, observable) {
  50. this.on(eventName, function(e) {
  51. observable.fireEvent(eventName, e);
  52. });
  53. },
  54. <div id="method-Ext.Element-clean"></div>/**
  55. * Removes worthless text nodes
  56. * @param {Boolean} forceReclean (optional) By default the element
  57. * keeps track if it has been cleaned already so
  58. * you can call this over and over. However, if you update the element and
  59. * need to force a reclean, you can pass true.
  60. */
  61. clean : function(forceReclean) {
  62. var me = this,
  63. dom = me.dom,
  64. n = dom.firstChild,
  65. ni = -1;
  66. if (Ext.Element.data(dom, 'isCleaned') && forceReclean !== true) {
  67. return me;
  68. }
  69. while (n) {
  70. var nx = n.nextSibling;
  71. if (n.nodeType == 3 && !(/\S/.test(n.nodeValue))) {
  72. dom.removeChild(n);
  73. } else {
  74. n.nodeIndex = ++ni;
  75. }
  76. n = nx;
  77. }
  78. Ext.Element.data(dom, 'isCleaned', true);
  79. return me;
  80. },
  81. <div id="method-Ext.Element-load"></div>/**
  82. * Direct access to the Updater {@link Ext.Updater#update} method. The method takes the same object
  83. * parameter as {@link Ext.Updater#update}
  84. * @return {Ext.Element} this
  85. */
  86. load : function() {
  87. var updateManager = this.getUpdater();
  88. updateManager.update.apply(updateManager, arguments);
  89. return this;
  90. },
  91. <div id="method-Ext.Element-getUpdater"></div>/**
  92. * Gets this element's {@link Ext.Updater Updater}
  93. * @return {Ext.Updater} The Updater
  94. */
  95. getUpdater : function() {
  96. return this.updateManager || (this.updateManager = new Ext.Updater(this));
  97. },
  98. <div id="method-Ext.Element-update"></div>/**
  99. * Update the innerHTML of this element, optionally searching for and processing scripts
  100. * @param {String} html The new HTML
  101. * @param {Boolean} loadScripts (optional) True to look for and process scripts (defaults to false)
  102. * @param {Function} callback (optional) For async script loading you can be notified when the update completes
  103. * @return {Ext.Element} this
  104. */
  105. update : function(html, loadScripts, callback) {
  106. if (!this.dom) {
  107. return this;
  108. }
  109. html = html || "";
  110. if (loadScripts !== true) {
  111. this.dom.innerHTML = html;
  112. if (typeof callback == 'function') {
  113. callback();
  114. }
  115. return this;
  116. }
  117. var id = Ext.id(),
  118. dom = this.dom;
  119. html += '<span id="' + id + '"></span>';
  120. Ext.lib.Event.onAvailable(id, function() {
  121. var DOC = document,
  122. hd = DOC.getElementsByTagName("head")[0],
  123. re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,
  124. srcRe = /\ssrc=([\'\"])(.*?)\1/i,
  125. typeRe = /\stype=([\'\"])(.*?)\1/i,
  126. match,
  127. attrs,
  128. srcMatch,
  129. typeMatch,
  130. el,
  131. s;
  132. while ((match = re.exec(html))) {
  133. attrs = match[1];
  134. srcMatch = attrs ? attrs.match(srcRe) : false;
  135. if (srcMatch && srcMatch[2]) {
  136. s = DOC.createElement("script");
  137. s.src = srcMatch[2];
  138. typeMatch = attrs.match(typeRe);
  139. if (typeMatch && typeMatch[2]) {
  140. s.type = typeMatch[2];
  141. }
  142. hd.appendChild(s);
  143. } else if (match[2] && match[2].length > 0) {
  144. if (window.execScript) {
  145. window.execScript(match[2]);
  146. } else {
  147. window.eval(match[2]);
  148. }
  149. }
  150. }
  151. el = DOC.getElementById(id);
  152. if (el) {
  153. Ext.removeNode(el);
  154. }
  155. if (typeof callback == 'function') {
  156. callback();
  157. }
  158. });
  159. dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
  160. return this;
  161. },
  162. // inherit docs, overridden so we can add removeAnchor
  163. removeAllListeners : function() {
  164. this.removeAnchor();
  165. Ext.EventManager.removeAll(this.dom);
  166. return this;
  167. },
  168. <div id="method-Ext.Element-createProxy"></div>/**
  169. * Creates a proxy element of this element
  170. * @param {String/Object} config The class name of the proxy element or a DomHelper config object
  171. * @param {String/HTMLElement} renderTo (optional) The element or element id to render the proxy to (defaults to document.body)
  172. * @param {Boolean} matchBox (optional) True to align and size the proxy to this element now (defaults to false)
  173. * @return {Ext.Element} The new proxy element
  174. */
  175. createProxy : function(config, renderTo, matchBox) {
  176. config = (typeof config == 'object') ? config : {tag : "div", cls: config};
  177. var me = this,
  178. proxy = renderTo ? Ext.DomHelper.append(renderTo, config, true) :
  179. Ext.DomHelper.insertBefore(me.dom, config, true);
  180. if (matchBox && me.setBox && me.getBox) { // check to make sure Element.position.js is loaded
  181. proxy.setBox(me.getBox());
  182. }
  183. return proxy;
  184. }
  185. });
  186. Ext.Element.prototype.getUpdateManager = Ext.Element.prototype.getUpdater;
  187. </pre>
  188. </body>
  189. </html>