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.

155 lines
4.2 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. Ext.ux.Spotlight = function(config){
  16. Ext.apply(this, config);
  17. }
  18. Ext.ux.Spotlight.prototype = {
  19. active : false,
  20. animate : true,
  21. duration: .25,
  22. easing:'easeNone',
  23. // private
  24. animated : false,
  25. createElements : function(){
  26. var bd = Ext.getBody();
  27. this.right = bd.createChild({cls:'x-spotlight'});
  28. this.left = bd.createChild({cls:'x-spotlight'});
  29. this.top = bd.createChild({cls:'x-spotlight'});
  30. this.bottom = bd.createChild({cls:'x-spotlight'});
  31. this.all = new Ext.CompositeElement([this.right, this.left, this.top, this.bottom]);
  32. },
  33. show : function(el, callback, scope){
  34. if(this.animated){
  35. this.show.defer(50, this, [el, callback, scope]);
  36. return;
  37. }
  38. this.el = Ext.get(el);
  39. if(!this.right){
  40. this.createElements();
  41. }
  42. if(!this.active){
  43. this.all.setDisplayed('');
  44. this.applyBounds(true, false);
  45. this.active = true;
  46. Ext.EventManager.onWindowResize(this.syncSize, this);
  47. this.applyBounds(false, this.animate, false, callback, scope);
  48. }else{
  49. this.applyBounds(false, false, false, callback, scope); // all these booleans look hideous
  50. }
  51. },
  52. hide : function(callback, scope){
  53. if(this.animated){
  54. this.hide.defer(50, this, [callback, scope]);
  55. return;
  56. }
  57. Ext.EventManager.removeResizeListener(this.syncSize, this);
  58. this.applyBounds(true, this.animate, true, callback, scope);
  59. },
  60. doHide : function(){
  61. this.active = false;
  62. this.all.setDisplayed(false);
  63. },
  64. syncSize : function(){
  65. this.applyBounds(false, false);
  66. },
  67. applyBounds : function(basePts, anim, doHide, callback, scope){
  68. var rg = this.el.getRegion();
  69. var dw = Ext.lib.Dom.getViewWidth(true);
  70. var dh = Ext.lib.Dom.getViewHeight(true);
  71. var c = 0, cb = false;
  72. if(anim){
  73. cb = {
  74. callback: function(){
  75. c++;
  76. if(c == 4){
  77. this.animated = false;
  78. if(doHide){
  79. this.doHide();
  80. }
  81. Ext.callback(callback, scope, [this]);
  82. }
  83. },
  84. scope: this,
  85. duration: this.duration,
  86. easing: this.easing
  87. };
  88. this.animated = true;
  89. }
  90. this.right.setBounds(
  91. rg.right,
  92. basePts ? dh : rg.top,
  93. dw - rg.right,
  94. basePts ? 0 : (dh - rg.top),
  95. cb);
  96. this.left.setBounds(
  97. 0,
  98. 0,
  99. rg.left,
  100. basePts ? 0 : rg.bottom,
  101. cb);
  102. this.top.setBounds(
  103. basePts ? dw : rg.left,
  104. 0,
  105. basePts ? 0 : dw - rg.left,
  106. rg.top,
  107. cb);
  108. this.bottom.setBounds(
  109. 0,
  110. rg.bottom,
  111. basePts ? 0 : rg.right,
  112. dh - rg.bottom,
  113. cb);
  114. if(!anim){
  115. if(doHide){
  116. this.doHide();
  117. }
  118. if(callback){
  119. Ext.callback(callback, scope, [this]);
  120. }
  121. }
  122. },
  123. destroy : function(){
  124. this.doHide();
  125. Ext.destroy(
  126. this.right,
  127. this.left,
  128. this.top,
  129. this.bottom);
  130. delete this.el;
  131. delete this.all;
  132. }
  133. };
  134. //backwards compat
  135. Ext.Spotlight = Ext.ux.Spotlight;</pre>
  136. </body>
  137. </html>