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.

164 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.DomHelper
  17. */
  18. Ext.apply(Ext.DomHelper,
  19. function(){
  20. var pub,
  21. afterbegin = 'afterbegin',
  22. afterend = 'afterend',
  23. beforebegin = 'beforebegin',
  24. beforeend = 'beforeend',
  25. confRe = /tag|children|cn|html$/i;
  26. // private
  27. function doInsert(el, o, returnElement, pos, sibling, append){
  28. el = Ext.getDom(el);
  29. var newNode;
  30. if (pub.useDom) {
  31. newNode = createDom(o, null);
  32. if (append) {
  33. el.appendChild(newNode);
  34. } else {
  35. (sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el);
  36. }
  37. } else {
  38. newNode = Ext.DomHelper.insertHtml(pos, el, Ext.DomHelper.createHtml(o));
  39. }
  40. return returnElement ? Ext.get(newNode, true) : newNode;
  41. }
  42. // build as dom
  43. /** @ignore */
  44. function createDom(o, parentNode){
  45. var el,
  46. doc = document,
  47. useSet,
  48. attr,
  49. val,
  50. cn;
  51. if (Ext.isArray(o)) { // Allow Arrays of siblings to be inserted
  52. el = doc.createDocumentFragment(); // in one shot using a DocumentFragment
  53. for (var i = 0, l = o.length; i < l; i++) {
  54. createDom(o[i], el);
  55. }
  56. } else if (typeof o == 'string') { // Allow a string as a child spec.
  57. el = doc.createTextNode(o);
  58. } else {
  59. el = doc.createElement( o.tag || 'div' );
  60. useSet = !!el.setAttribute; // In IE some elements don't have setAttribute
  61. for (var attr in o) {
  62. if(!confRe.test(attr)){
  63. val = o[attr];
  64. if(attr == 'cls'){
  65. el.className = val;
  66. }else{
  67. if(useSet){
  68. el.setAttribute(attr, val);
  69. }else{
  70. el[attr] = val;
  71. }
  72. }
  73. }
  74. }
  75. Ext.DomHelper.applyStyles(el, o.style);
  76. if ((cn = o.children || o.cn)) {
  77. createDom(cn, el);
  78. } else if (o.html) {
  79. el.innerHTML = o.html;
  80. }
  81. }
  82. if(parentNode){
  83. parentNode.appendChild(el);
  84. }
  85. return el;
  86. }
  87. pub = {
  88. <div id="method-Ext.DomHelper-createTemplate"></div>/**
  89. * Creates a new Ext.Template from the DOM object spec.
  90. * @param {Object} o The DOM object spec (and children)
  91. * @return {Ext.Template} The new template
  92. */
  93. createTemplate : function(o){
  94. var html = Ext.DomHelper.createHtml(o);
  95. return new Ext.Template(html);
  96. },
  97. <div id="prop-Ext.DomHelper-useDom"></div>/** True to force the use of DOM instead of html fragments @type Boolean */
  98. useDom : false,
  99. <div id="method-Ext.DomHelper-insertBefore"></div>/**
  100. * Creates new DOM element(s) and inserts them before el.
  101. * @param {Mixed} el The context element
  102. * @param {Object/String} o The DOM object spec (and children) or raw HTML blob
  103. * @param {Boolean} returnElement (optional) true to return a Ext.Element
  104. * @return {HTMLElement/Ext.Element} The new node
  105. * @hide (repeat)
  106. */
  107. insertBefore : function(el, o, returnElement){
  108. return doInsert(el, o, returnElement, beforebegin);
  109. },
  110. <div id="method-Ext.DomHelper-insertAfter"></div>/**
  111. * Creates new DOM element(s) and inserts them after el.
  112. * @param {Mixed} el The context element
  113. * @param {Object} o The DOM object spec (and children)
  114. * @param {Boolean} returnElement (optional) true to return a Ext.Element
  115. * @return {HTMLElement/Ext.Element} The new node
  116. * @hide (repeat)
  117. */
  118. insertAfter : function(el, o, returnElement){
  119. return doInsert(el, o, returnElement, afterend, 'nextSibling');
  120. },
  121. <div id="method-Ext.DomHelper-insertFirst"></div>/**
  122. * Creates new DOM element(s) and inserts them as the first child of el.
  123. * @param {Mixed} el The context element
  124. * @param {Object/String} o The DOM object spec (and children) or raw HTML blob
  125. * @param {Boolean} returnElement (optional) true to return a Ext.Element
  126. * @return {HTMLElement/Ext.Element} The new node
  127. * @hide (repeat)
  128. */
  129. insertFirst : function(el, o, returnElement){
  130. return doInsert(el, o, returnElement, afterbegin, 'firstChild');
  131. },
  132. <div id="method-Ext.DomHelper-append"></div>/**
  133. * Creates new DOM element(s) and appends them to el.
  134. * @param {Mixed} el The context element
  135. * @param {Object/String} o The DOM object spec (and children) or raw HTML blob
  136. * @param {Boolean} returnElement (optional) true to return a Ext.Element
  137. * @return {HTMLElement/Ext.Element} The new node
  138. * @hide (repeat)
  139. */
  140. append: function(el, o, returnElement){
  141. return doInsert(el, o, returnElement, beforeend, '', true);
  142. },
  143. <div id="method-Ext.DomHelper-createDom"></div>/**
  144. * Creates new DOM element(s) without inserting them to the document.
  145. * @param {Object/String} o The DOM object spec (and children) or raw HTML blob
  146. * @return {HTMLElement} The new uninserted node
  147. */
  148. createDom: createDom
  149. };
  150. return pub;
  151. }());
  152. </pre>
  153. </body>
  154. </html>