Web UI for ARGUS server
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.

230 lines
7.6 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. <div id="cls-Ext.QuickTip"></div>/**
  16. * @class Ext.QuickTip
  17. * @extends Ext.ToolTip
  18. * @xtype quicktip
  19. * A specialized tooltip class for tooltips that can be specified in markup and automatically managed by the global
  20. * {@link Ext.QuickTips} instance. See the QuickTips class header for additional usage details and examples.
  21. * @constructor
  22. * Create a new Tip
  23. * @param {Object} config The configuration options
  24. */
  25. Ext.QuickTip = Ext.extend(Ext.ToolTip, {
  26. <div id="cfg-Ext.QuickTip-target"></div>/**
  27. * @cfg {Mixed} target The target HTMLElement, Ext.Element or id to associate with this quicktip (defaults to the document).
  28. */
  29. <div id="cfg-Ext.QuickTip-interceptTitles"></div>/**
  30. * @cfg {Boolean} interceptTitles True to automatically use the element's DOM title value if available (defaults to false).
  31. */
  32. interceptTitles : false,
  33. // private
  34. tagConfig : {
  35. namespace : "ext",
  36. attribute : "qtip",
  37. width : "qwidth",
  38. target : "target",
  39. title : "qtitle",
  40. hide : "hide",
  41. cls : "qclass",
  42. align : "qalign",
  43. anchor : "anchor"
  44. },
  45. // private
  46. initComponent : function(){
  47. this.target = this.target || Ext.getDoc();
  48. this.targets = this.targets || {};
  49. Ext.QuickTip.superclass.initComponent.call(this);
  50. },
  51. <div id="method-Ext.QuickTip-register"></div>/**
  52. * Configures a new quick tip instance and assigns it to a target element. The following config values are
  53. * supported (for example usage, see the {@link Ext.QuickTips} class header):
  54. * <div class="mdetail-params"><ul>
  55. * <li>autoHide</li>
  56. * <li>cls</li>
  57. * <li>dismissDelay (overrides the singleton value)</li>
  58. * <li>target (required)</li>
  59. * <li>text (required)</li>
  60. * <li>title</li>
  61. * <li>width</li></ul></div>
  62. * @param {Object} config The config object
  63. */
  64. register : function(config){
  65. var cs = Ext.isArray(config) ? config : arguments;
  66. for(var i = 0, len = cs.length; i < len; i++){
  67. var c = cs[i];
  68. var target = c.target;
  69. if(target){
  70. if(Ext.isArray(target)){
  71. for(var j = 0, jlen = target.length; j < jlen; j++){
  72. this.targets[Ext.id(target[j])] = c;
  73. }
  74. } else{
  75. this.targets[Ext.id(target)] = c;
  76. }
  77. }
  78. }
  79. },
  80. <div id="method-Ext.QuickTip-unregister"></div>/**
  81. * Removes this quick tip from its element and destroys it.
  82. * @param {String/HTMLElement/Element} el The element from which the quick tip is to be removed.
  83. */
  84. unregister : function(el){
  85. delete this.targets[Ext.id(el)];
  86. },
  87. <div id="method-Ext.QuickTip-cancelShow"></div>/**
  88. * Hides a visible tip or cancels an impending show for a particular element.
  89. * @param {String/HTMLElement/Element} el The element that is the target of the tip.
  90. */
  91. cancelShow: function(el){
  92. var at = this.activeTarget;
  93. el = Ext.get(el).dom;
  94. if(this.isVisible()){
  95. if(at && at.el == el){
  96. this.hide();
  97. }
  98. }else if(at && at.el == el){
  99. this.clearTimer('show');
  100. }
  101. },
  102. getTipCfg: function(e) {
  103. var t = e.getTarget(),
  104. ttp,
  105. cfg;
  106. if(this.interceptTitles && t.title && Ext.isString(t.title)){
  107. ttp = t.title;
  108. t.qtip = ttp;
  109. t.removeAttribute("title");
  110. e.preventDefault();
  111. }else{
  112. cfg = this.tagConfig;
  113. ttp = t.qtip || Ext.fly(t).getAttribute(cfg.attribute, cfg.namespace);
  114. }
  115. return ttp;
  116. },
  117. // private
  118. onTargetOver : function(e){
  119. if(this.disabled){
  120. return;
  121. }
  122. this.targetXY = e.getXY();
  123. var t = e.getTarget();
  124. if(!t || t.nodeType !== 1 || t == document || t == document.body){
  125. return;
  126. }
  127. if(this.activeTarget && ((t == this.activeTarget.el) || Ext.fly(this.activeTarget.el).contains(t))){
  128. this.clearTimer('hide');
  129. this.show();
  130. return;
  131. }
  132. if(t && this.targets[t.id]){
  133. this.activeTarget = this.targets[t.id];
  134. this.activeTarget.el = t;
  135. this.anchor = this.activeTarget.anchor;
  136. if(this.anchor){
  137. this.anchorTarget = t;
  138. }
  139. this.delayShow();
  140. return;
  141. }
  142. var ttp, et = Ext.fly(t), cfg = this.tagConfig, ns = cfg.namespace;
  143. if(ttp = this.getTipCfg(e)){
  144. var autoHide = et.getAttribute(cfg.hide, ns);
  145. this.activeTarget = {
  146. el: t,
  147. text: ttp,
  148. width: et.getAttribute(cfg.width, ns),
  149. autoHide: autoHide != "user" && autoHide !== 'false',
  150. title: et.getAttribute(cfg.title, ns),
  151. cls: et.getAttribute(cfg.cls, ns),
  152. align: et.getAttribute(cfg.align, ns)
  153. };
  154. this.anchor = et.getAttribute(cfg.anchor, ns);
  155. if(this.anchor){
  156. this.anchorTarget = t;
  157. }
  158. this.delayShow();
  159. }
  160. },
  161. // private
  162. onTargetOut : function(e){
  163. // If moving within the current target, and it does not have a new tip, ignore the mouseout
  164. if (this.activeTarget && e.within(this.activeTarget.el) && !this.getTipCfg(e)) {
  165. return;
  166. }
  167. this.clearTimer('show');
  168. if(this.autoHide !== false){
  169. this.delayHide();
  170. }
  171. },
  172. // inherit docs
  173. showAt : function(xy){
  174. var t = this.activeTarget;
  175. if(t){
  176. if(!this.rendered){
  177. this.render(Ext.getBody());
  178. this.activeTarget = t;
  179. }
  180. if(t.width){
  181. this.setWidth(t.width);
  182. this.body.setWidth(this.adjustBodyWidth(t.width - this.getFrameWidth()));
  183. this.measureWidth = false;
  184. } else{
  185. this.measureWidth = true;
  186. }
  187. this.setTitle(t.title || '');
  188. this.body.update(t.text);
  189. this.autoHide = t.autoHide;
  190. this.dismissDelay = t.dismissDelay || this.dismissDelay;
  191. if(this.lastCls){
  192. this.el.removeClass(this.lastCls);
  193. delete this.lastCls;
  194. }
  195. if(t.cls){
  196. this.el.addClass(t.cls);
  197. this.lastCls = t.cls;
  198. }
  199. if(this.anchor){
  200. this.constrainPosition = false;
  201. }else if(t.align){ // TODO: this doesn't seem to work consistently
  202. xy = this.el.getAlignToXY(t.el, t.align);
  203. this.constrainPosition = false;
  204. }else{
  205. this.constrainPosition = true;
  206. }
  207. }
  208. Ext.QuickTip.superclass.showAt.call(this, xy);
  209. },
  210. // inherit docs
  211. hide: function(){
  212. delete this.activeTarget;
  213. Ext.QuickTip.superclass.hide.call(this);
  214. }
  215. });
  216. Ext.reg('quicktip', Ext.QuickTip);</pre>
  217. </body>
  218. </html>