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.

175 lines
6.8 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-Element'>/**
  19. </span> * @class Ext.Element
  20. */
  21. Ext.Element.addMethods(
  22. function() {
  23. var VISIBILITY = &quot;visibility&quot;,
  24. DISPLAY = &quot;display&quot;,
  25. HIDDEN = &quot;hidden&quot;,
  26. NONE = &quot;none&quot;,
  27. XMASKED = &quot;x-masked&quot;,
  28. XMASKEDRELATIVE = &quot;x-masked-relative&quot;,
  29. data = Ext.Element.data;
  30. return {
  31. <span id='Ext-Element-method-isVisible'> /**
  32. </span> * Checks whether the element is currently visible using both visibility and display properties.
  33. * @param {Boolean} deep (optional) True to walk the dom and see if parent elements are hidden (defaults to false)
  34. * @return {Boolean} True if the element is currently visible, else false
  35. */
  36. isVisible : function(deep) {
  37. var vis = !this.isStyle(VISIBILITY, HIDDEN) &amp;&amp; !this.isStyle(DISPLAY, NONE),
  38. p = this.dom.parentNode;
  39. if (deep !== true || !vis) {
  40. return vis;
  41. }
  42. while (p &amp;&amp; !(/^body/i.test(p.tagName))) {
  43. if (!Ext.fly(p, '_isVisible').isVisible()) {
  44. return false;
  45. }
  46. p = p.parentNode;
  47. }
  48. return true;
  49. },
  50. <span id='Ext-Element-method-isDisplayed'> /**
  51. </span> * Returns true if display is not &quot;none&quot;
  52. * @return {Boolean}
  53. */
  54. isDisplayed : function() {
  55. return !this.isStyle(DISPLAY, NONE);
  56. },
  57. <span id='Ext-Element-method-enableDisplayMode'> /**
  58. </span> * Convenience method for setVisibilityMode(Element.DISPLAY)
  59. * @param {String} display (optional) What to set display to when visible
  60. * @return {Ext.Element} this
  61. */
  62. enableDisplayMode : function(display) {
  63. this.setVisibilityMode(Ext.Element.DISPLAY);
  64. if (!Ext.isEmpty(display)) {
  65. data(this.dom, 'originalDisplay', display);
  66. }
  67. return this;
  68. },
  69. <span id='Ext-Element-method-mask'> /**
  70. </span> * Puts a mask over this element to disable user interaction. Requires core.css.
  71. * This method can only be applied to elements which accept child nodes.
  72. * @param {String} msg (optional) A message to display in the mask
  73. * @param {String} msgCls (optional) A css class to apply to the msg element
  74. * @return {Element} The mask element
  75. */
  76. mask : function(msg, msgCls) {
  77. var me = this,
  78. dom = me.dom,
  79. dh = Ext.DomHelper,
  80. EXTELMASKMSG = &quot;ext-el-mask-msg&quot;,
  81. el,
  82. mask;
  83. if (!/^body/i.test(dom.tagName) &amp;&amp; me.getStyle('position') == 'static') {
  84. me.addClass(XMASKEDRELATIVE);
  85. }
  86. if (el = data(dom, 'maskMsg')) {
  87. el.remove();
  88. }
  89. if (el = data(dom, 'mask')) {
  90. el.remove();
  91. }
  92. mask = dh.append(dom, {cls : &quot;ext-el-mask&quot;}, true);
  93. data(dom, 'mask', mask);
  94. me.addClass(XMASKED);
  95. mask.setDisplayed(true);
  96. if (typeof msg == 'string') {
  97. var mm = dh.append(dom, {cls : EXTELMASKMSG, cn:{tag:'div'}}, true);
  98. data(dom, 'maskMsg', mm);
  99. mm.dom.className = msgCls ? EXTELMASKMSG + &quot; &quot; + msgCls : EXTELMASKMSG;
  100. mm.dom.firstChild.innerHTML = msg;
  101. mm.setDisplayed(true);
  102. mm.center(me);
  103. }
  104. // ie will not expand full height automatically
  105. if (Ext.isIE &amp;&amp; !(Ext.isIE7 &amp;&amp; Ext.isStrict) &amp;&amp; me.getStyle('height') == 'auto') {
  106. mask.setSize(undefined, me.getHeight());
  107. }
  108. return mask;
  109. },
  110. <span id='Ext-Element-method-unmask'> /**
  111. </span> * Removes a previously applied mask.
  112. */
  113. unmask : function() {
  114. var me = this,
  115. dom = me.dom,
  116. mask = data(dom, 'mask'),
  117. maskMsg = data(dom, 'maskMsg');
  118. if (mask) {
  119. if (maskMsg) {
  120. maskMsg.remove();
  121. data(dom, 'maskMsg', undefined);
  122. }
  123. mask.remove();
  124. data(dom, 'mask', undefined);
  125. me.removeClass([XMASKED, XMASKEDRELATIVE]);
  126. }
  127. },
  128. <span id='Ext-Element-method-isMasked'> /**
  129. </span> * Returns true if this element is masked
  130. * @return {Boolean}
  131. */
  132. isMasked : function() {
  133. var m = data(this.dom, 'mask');
  134. return m &amp;&amp; m.isVisible();
  135. },
  136. <span id='Ext-Element-method-createShim'> /**
  137. </span> * Creates an iframe shim for this element to keep selects and other windowed objects from
  138. * showing through.
  139. * @return {Ext.Element} The new shim element
  140. */
  141. createShim : function() {
  142. var el = document.createElement('iframe'),
  143. shim;
  144. el.frameBorder = '0';
  145. el.className = 'ext-shim';
  146. el.src = Ext.SSL_SECURE_URL;
  147. shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
  148. shim.autoBoxAdjust = false;
  149. return shim;
  150. }
  151. };
  152. }()
  153. );</pre>
  154. </body>
  155. </html>