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.

154 lines
6.0 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. function() {
  20. var GETDOM = Ext.getDom,
  21. GET = Ext.get,
  22. DH = Ext.DomHelper;
  23. return {
  24. <div id="method-Ext.Element-appendChild"></div>/**
  25. * Appends the passed element(s) to this element
  26. * @param {String/HTMLElement/Array/Element/CompositeElement} el
  27. * @return {Ext.Element} this
  28. */
  29. appendChild: function(el){
  30. return GET(el).appendTo(this);
  31. },
  32. <div id="method-Ext.Element-appendTo"></div>/**
  33. * Appends this element to the passed element
  34. * @param {Mixed} el The new parent element
  35. * @return {Ext.Element} this
  36. */
  37. appendTo: function(el){
  38. GETDOM(el).appendChild(this.dom);
  39. return this;
  40. },
  41. <div id="method-Ext.Element-insertBefore"></div>/**
  42. * Inserts this element before the passed element in the DOM
  43. * @param {Mixed} el The element before which this element will be inserted
  44. * @return {Ext.Element} this
  45. */
  46. insertBefore: function(el){
  47. (el = GETDOM(el)).parentNode.insertBefore(this.dom, el);
  48. return this;
  49. },
  50. <div id="method-Ext.Element-insertAfter"></div>/**
  51. * Inserts this element after the passed element in the DOM
  52. * @param {Mixed} el The element to insert after
  53. * @return {Ext.Element} this
  54. */
  55. insertAfter: function(el){
  56. (el = GETDOM(el)).parentNode.insertBefore(this.dom, el.nextSibling);
  57. return this;
  58. },
  59. <div id="method-Ext.Element-insertFirst"></div>/**
  60. * Inserts (or creates) an element (or DomHelper config) as the first child of this element
  61. * @param {Mixed/Object} el The id or element to insert or a DomHelper config to create and insert
  62. * @return {Ext.Element} The new child
  63. */
  64. insertFirst: function(el, returnDom){
  65. el = el || {};
  66. if(el.nodeType || el.dom || typeof el == 'string'){ // element
  67. el = GETDOM(el);
  68. this.dom.insertBefore(el, this.dom.firstChild);
  69. return !returnDom ? GET(el) : el;
  70. }else{ // dh config
  71. return this.createChild(el, this.dom.firstChild, returnDom);
  72. }
  73. },
  74. <div id="method-Ext.Element-replace"></div>/**
  75. * Replaces the passed element with this element
  76. * @param {Mixed} el The element to replace
  77. * @return {Ext.Element} this
  78. */
  79. replace: function(el){
  80. el = GET(el);
  81. this.insertBefore(el);
  82. el.remove();
  83. return this;
  84. },
  85. <div id="method-Ext.Element-replaceWith"></div>/**
  86. * Replaces this element with the passed element
  87. * @param {Mixed/Object} el The new element or a DomHelper config of an element to create
  88. * @return {Ext.Element} this
  89. */
  90. replaceWith: function(el){
  91. var me = this;
  92. if(el.nodeType || el.dom || typeof el == 'string'){
  93. el = GETDOM(el);
  94. me.dom.parentNode.insertBefore(el, me.dom);
  95. }else{
  96. el = DH.insertBefore(me.dom, el);
  97. }
  98. delete Ext.elCache[me.id];
  99. Ext.removeNode(me.dom);
  100. me.id = Ext.id(me.dom = el);
  101. Ext.Element.addToCache(me.isFlyweight ? new Ext.Element(me.dom) : me);
  102. return me;
  103. },
  104. <div id="method-Ext.Element-createChild"></div>/**
  105. * Creates the passed DomHelper config and appends it to this element or optionally inserts it before the passed child element.
  106. * @param {Object} config DomHelper element config object. If no tag is specified (e.g., {tag:'input'}) then a div will be
  107. * automatically generated with the specified attributes.
  108. * @param {HTMLElement} insertBefore (optional) a child element of this element
  109. * @param {Boolean} returnDom (optional) true to return the dom node instead of creating an Element
  110. * @return {Ext.Element} The new child element
  111. */
  112. createChild: function(config, insertBefore, returnDom){
  113. config = config || {tag:'div'};
  114. return insertBefore ?
  115. DH.insertBefore(insertBefore, config, returnDom !== true) :
  116. DH[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true);
  117. },
  118. <div id="method-Ext.Element-wrap"></div>/**
  119. * Creates and wraps this element with another element
  120. * @param {Object} config (optional) DomHelper element config object for the wrapper element or null for an empty div
  121. * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element
  122. * @return {HTMLElement/Element} The newly created wrapper element
  123. */
  124. wrap: function(config, returnDom){
  125. var newEl = DH.insertBefore(this.dom, config || {tag: "div"}, !returnDom);
  126. newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);
  127. return newEl;
  128. },
  129. <div id="method-Ext.Element-insertHtml"></div>/**
  130. * Inserts an html fragment into this element
  131. * @param {String} where Where to insert the html in relation to this element - beforeBegin, afterBegin, beforeEnd, afterEnd.
  132. * @param {String} html The HTML fragment
  133. * @param {Boolean} returnEl (optional) True to return an Ext.Element (defaults to false)
  134. * @return {HTMLElement/Ext.Element} The inserted node (or nearest related if more than 1 inserted)
  135. */
  136. insertHtml : function(where, html, returnEl){
  137. var el = DH.insertHtml(where, this.dom, html);
  138. return returnEl ? Ext.get(el) : el;
  139. }
  140. };
  141. }());</pre>
  142. </body>
  143. </html>