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.

430 lines
16 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. /**
  16. * @class Ext.Element
  17. */
  18. <div id="prop-Ext.Element-VISIBILITY"></div>/**
  19. * Visibility mode constant for use with {@link #setVisibilityMode}. Use visibility to hide element
  20. * @static
  21. * @type Number
  22. */
  23. Ext.Element.VISIBILITY = 1;
  24. <div id="prop-Ext.Element-DISPLAY"></div>/**
  25. * Visibility mode constant for use with {@link #setVisibilityMode}. Use display to hide element
  26. * @static
  27. * @type Number
  28. */
  29. Ext.Element.DISPLAY = 2;
  30. <div id="prop-Ext.Element-OFFSETS"></div>/**
  31. * Visibility mode constant for use with {@link #setVisibilityMode}. Use offsets (x and y positioning offscreen)
  32. * to hide element.
  33. * @static
  34. * @type Number
  35. */
  36. Ext.Element.OFFSETS = 3;
  37. Ext.Element.ASCLASS = 4;
  38. <div id="prop-Ext.Element-visibilityCls"></div>/**
  39. * Defaults to 'x-hide-nosize'
  40. * @static
  41. * @type String
  42. */
  43. Ext.Element.visibilityCls = 'x-hide-nosize';
  44. Ext.Element.addMethods(function(){
  45. var El = Ext.Element,
  46. OPACITY = "opacity",
  47. VISIBILITY = "visibility",
  48. DISPLAY = "display",
  49. HIDDEN = "hidden",
  50. OFFSETS = "offsets",
  51. ASCLASS = "asclass",
  52. NONE = "none",
  53. NOSIZE = 'nosize',
  54. ORIGINALDISPLAY = 'originalDisplay',
  55. VISMODE = 'visibilityMode',
  56. ISVISIBLE = 'isVisible',
  57. data = El.data,
  58. getDisplay = function(dom){
  59. var d = data(dom, ORIGINALDISPLAY);
  60. if(d === undefined){
  61. data(dom, ORIGINALDISPLAY, d = '');
  62. }
  63. return d;
  64. },
  65. getVisMode = function(dom){
  66. var m = data(dom, VISMODE);
  67. if(m === undefined){
  68. data(dom, VISMODE, m = 1);
  69. }
  70. return m;
  71. };
  72. return {
  73. <div id="prop-Ext.Element-originalDisplay"></div>/**
  74. * The element's default display mode (defaults to "")
  75. * @type String
  76. */
  77. originalDisplay : "",
  78. visibilityMode : 1,
  79. <div id="method-Ext.Element-setVisibilityMode"></div>/**
  80. * Sets the element's visibility mode. When setVisible() is called it
  81. * will use this to determine whether to set the visibility or the display property.
  82. * @param {Number} visMode Ext.Element.VISIBILITY or Ext.Element.DISPLAY
  83. * @return {Ext.Element} this
  84. */
  85. setVisibilityMode : function(visMode){
  86. data(this.dom, VISMODE, visMode);
  87. return this;
  88. },
  89. <div id="method-Ext.Element-animate"></div>/**
  90. * Perform custom animation on this element.
  91. * <div><ul class="mdetail-params">
  92. * <li><u>Animation Properties</u></li>
  93. *
  94. * <p>The Animation Control Object enables gradual transitions for any member of an
  95. * element's style object that takes a numeric value including but not limited to
  96. * these properties:</p><div><ul class="mdetail-params">
  97. * <li><tt>bottom, top, left, right</tt></li>
  98. * <li><tt>height, width</tt></li>
  99. * <li><tt>margin, padding</tt></li>
  100. * <li><tt>borderWidth</tt></li>
  101. * <li><tt>opacity</tt></li>
  102. * <li><tt>fontSize</tt></li>
  103. * <li><tt>lineHeight</tt></li>
  104. * </ul></div>
  105. *
  106. *
  107. * <li><u>Animation Property Attributes</u></li>
  108. *
  109. * <p>Each Animation Property is a config object with optional properties:</p>
  110. * <div><ul class="mdetail-params">
  111. * <li><tt>by</tt>* : relative change - start at current value, change by this value</li>
  112. * <li><tt>from</tt> : ignore current value, start from this value</li>
  113. * <li><tt>to</tt>* : start at current value, go to this value</li>
  114. * <li><tt>unit</tt> : any allowable unit specification</li>
  115. * <p>* do not specify both <tt>to</tt> and <tt>by</tt> for an animation property</p>
  116. * </ul></div>
  117. *
  118. * <li><u>Animation Types</u></li>
  119. *
  120. * <p>The supported animation types:</p><div><ul class="mdetail-params">
  121. * <li><tt>'run'</tt> : Default
  122. * <pre><code>
  123. var el = Ext.get('complexEl');
  124. el.animate(
  125. // animation control object
  126. {
  127. borderWidth: {to: 3, from: 0},
  128. opacity: {to: .3, from: 1},
  129. height: {to: 50, from: el.getHeight()},
  130. width: {to: 300, from: el.getWidth()},
  131. top : {by: - 100, unit: 'px'},
  132. },
  133. 0.35, // animation duration
  134. null, // callback
  135. 'easeOut', // easing method
  136. 'run' // animation type ('run','color','motion','scroll')
  137. );
  138. * </code></pre>
  139. * </li>
  140. * <li><tt>'color'</tt>
  141. * <p>Animates transition of background, text, or border colors.</p>
  142. * <pre><code>
  143. el.animate(
  144. // animation control object
  145. {
  146. color: { to: '#06e' },
  147. backgroundColor: { to: '#e06' }
  148. },
  149. 0.35, // animation duration
  150. null, // callback
  151. 'easeOut', // easing method
  152. 'color' // animation type ('run','color','motion','scroll')
  153. );
  154. * </code></pre>
  155. * </li>
  156. *
  157. * <li><tt>'motion'</tt>
  158. * <p>Animates the motion of an element to/from specific points using optional bezier
  159. * way points during transit.</p>
  160. * <pre><code>
  161. el.animate(
  162. // animation control object
  163. {
  164. borderWidth: {to: 3, from: 0},
  165. opacity: {to: .3, from: 1},
  166. height: {to: 50, from: el.getHeight()},
  167. width: {to: 300, from: el.getWidth()},
  168. top : {by: - 100, unit: 'px'},
  169. points: {
  170. to: [50, 100], // go to this point
  171. control: [ // optional bezier way points
  172. [ 600, 800],
  173. [-100, 200]
  174. ]
  175. }
  176. },
  177. 3000, // animation duration (milliseconds!)
  178. null, // callback
  179. 'easeOut', // easing method
  180. 'motion' // animation type ('run','color','motion','scroll')
  181. );
  182. * </code></pre>
  183. * </li>
  184. * <li><tt>'scroll'</tt>
  185. * <p>Animate horizontal or vertical scrolling of an overflowing page element.</p>
  186. * <pre><code>
  187. el.animate(
  188. // animation control object
  189. {
  190. scroll: {to: [400, 300]}
  191. },
  192. 0.35, // animation duration
  193. null, // callback
  194. 'easeOut', // easing method
  195. 'scroll' // animation type ('run','color','motion','scroll')
  196. );
  197. * </code></pre>
  198. * </li>
  199. * </ul></div>
  200. *
  201. * </ul></div>
  202. *
  203. * @param {Object} args The animation control args
  204. * @param {Float} duration (optional) How long the animation lasts in seconds (defaults to <tt>.35</tt>)
  205. * @param {Function} onComplete (optional) Function to call when animation completes
  206. * @param {String} easing (optional) {@link Ext.Fx#easing} method to use (defaults to <tt>'easeOut'</tt>)
  207. * @param {String} animType (optional) <tt>'run'</tt> is the default. Can also be <tt>'color'</tt>,
  208. * <tt>'motion'</tt>, or <tt>'scroll'</tt>
  209. * @return {Ext.Element} this
  210. */
  211. animate : function(args, duration, onComplete, easing, animType){
  212. this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);
  213. return this;
  214. },
  215. /*
  216. * @private Internal animation call
  217. */
  218. anim : function(args, opt, animType, defaultDur, defaultEase, cb){
  219. animType = animType || 'run';
  220. opt = opt || {};
  221. var me = this,
  222. anim = Ext.lib.Anim[animType](
  223. me.dom,
  224. args,
  225. (opt.duration || defaultDur) || .35,
  226. (opt.easing || defaultEase) || 'easeOut',
  227. function(){
  228. if(cb) cb.call(me);
  229. if(opt.callback) opt.callback.call(opt.scope || me, me, opt);
  230. },
  231. me
  232. );
  233. opt.anim = anim;
  234. return anim;
  235. },
  236. // private legacy anim prep
  237. preanim : function(a, i){
  238. return !a[i] ? false : (typeof a[i] == 'object' ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]});
  239. },
  240. <div id="method-Ext.Element-isVisible"></div>/**
  241. * Checks whether the element is currently visible using both visibility and display properties.
  242. * @return {Boolean} True if the element is currently visible, else false
  243. */
  244. isVisible : function() {
  245. var me = this,
  246. dom = me.dom,
  247. visible = data(dom, ISVISIBLE);
  248. if(typeof visible == 'boolean'){ //return the cached value if registered
  249. return visible;
  250. }
  251. //Determine the current state based on display states
  252. visible = !me.isStyle(VISIBILITY, HIDDEN) &&
  253. !me.isStyle(DISPLAY, NONE) &&
  254. !((getVisMode(dom) == El.ASCLASS) && me.hasClass(me.visibilityCls || El.visibilityCls));
  255. data(dom, ISVISIBLE, visible);
  256. return visible;
  257. },
  258. <div id="method-Ext.Element-setVisible"></div>/**
  259. * Sets the visibility of the element (see details). If the visibilityMode is set to Element.DISPLAY, it will use
  260. * the display property to hide the element, otherwise it uses visibility. The default is to hide and show using the visibility property.
  261. * @param {Boolean} visible Whether the element is visible
  262. * @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
  263. * @return {Ext.Element} this
  264. */
  265. setVisible : function(visible, animate){
  266. var me = this, isDisplay, isVisibility, isOffsets, isNosize,
  267. dom = me.dom,
  268. visMode = getVisMode(dom);
  269. // hideMode string override
  270. if (typeof animate == 'string'){
  271. switch (animate) {
  272. case DISPLAY:
  273. visMode = El.DISPLAY;
  274. break;
  275. case VISIBILITY:
  276. visMode = El.VISIBILITY;
  277. break;
  278. case OFFSETS:
  279. visMode = El.OFFSETS;
  280. break;
  281. case NOSIZE:
  282. case ASCLASS:
  283. visMode = El.ASCLASS;
  284. break;
  285. }
  286. me.setVisibilityMode(visMode);
  287. animate = false;
  288. }
  289. if (!animate || !me.anim) {
  290. if(visMode == El.ASCLASS ){
  291. me[visible?'removeClass':'addClass'](me.visibilityCls || El.visibilityCls);
  292. } else if (visMode == El.DISPLAY){
  293. return me.setDisplayed(visible);
  294. } else if (visMode == El.OFFSETS){
  295. if (!visible){
  296. me.hideModeStyles = {
  297. position: me.getStyle('position'),
  298. top: me.getStyle('top'),
  299. left: me.getStyle('left')
  300. };
  301. me.applyStyles({position: 'absolute', top: '-10000px', left: '-10000px'});
  302. } else {
  303. me.applyStyles(me.hideModeStyles || {position: '', top: '', left: ''});
  304. delete me.hideModeStyles;
  305. }
  306. }else{
  307. me.fixDisplay();
  308. dom.style.visibility = visible ? "visible" : HIDDEN;
  309. }
  310. }else{
  311. // closure for composites
  312. if(visible){
  313. me.setOpacity(.01);
  314. me.setVisible(true);
  315. }
  316. me.anim({opacity: { to: (visible?1:0) }},
  317. me.preanim(arguments, 1),
  318. null,
  319. .35,
  320. 'easeIn',
  321. function(){
  322. visible || me.setVisible(false).setOpacity(1);
  323. });
  324. }
  325. data(dom, ISVISIBLE, visible); //set logical visibility state
  326. return me;
  327. },
  328. /**
  329. * @private
  330. * Determine if the Element has a relevant height and width available based
  331. * upon current logical visibility state
  332. */
  333. hasMetrics : function(){
  334. var dom = this.dom;
  335. return this.isVisible() || (getVisMode(dom) == El.VISIBILITY);
  336. },
  337. <div id="method-Ext.Element-toggle"></div>/**
  338. * Toggles the element's visibility or display, depending on visibility mode.
  339. * @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
  340. * @return {Ext.Element} this
  341. */
  342. toggle : function(animate){
  343. var me = this;
  344. me.setVisible(!me.isVisible(), me.preanim(arguments, 0));
  345. return me;
  346. },
  347. <div id="method-Ext.Element-setDisplayed"></div>/**
  348. * Sets the CSS display property. Uses originalDisplay if the specified value is a boolean true.
  349. * @param {Mixed} value Boolean value to display the element using its default display, or a string to set the display directly.
  350. * @return {Ext.Element} this
  351. */
  352. setDisplayed : function(value) {
  353. if(typeof value == "boolean"){
  354. value = value ? getDisplay(this.dom) : NONE;
  355. }
  356. this.setStyle(DISPLAY, value);
  357. return this;
  358. },
  359. // private
  360. fixDisplay : function(){
  361. var me = this;
  362. if(me.isStyle(DISPLAY, NONE)){
  363. me.setStyle(VISIBILITY, HIDDEN);
  364. me.setStyle(DISPLAY, getDisplay(this.dom)); // first try reverting to default
  365. if(me.isStyle(DISPLAY, NONE)){ // if that fails, default to block
  366. me.setStyle(DISPLAY, "block");
  367. }
  368. }
  369. },
  370. <div id="method-Ext.Element-hide"></div>/**
  371. * Hide this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
  372. * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
  373. * @return {Ext.Element} this
  374. */
  375. hide : function(animate){
  376. // hideMode override
  377. if (typeof animate == 'string'){
  378. this.setVisible(false, animate);
  379. return this;
  380. }
  381. this.setVisible(false, this.preanim(arguments, 0));
  382. return this;
  383. },
  384. <div id="method-Ext.Element-show"></div>/**
  385. * Show this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
  386. * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
  387. * @return {Ext.Element} this
  388. */
  389. show : function(animate){
  390. // hideMode override
  391. if (typeof animate == 'string'){
  392. this.setVisible(true, animate);
  393. return this;
  394. }
  395. this.setVisible(true, this.preanim(arguments, 0));
  396. return this;
  397. }
  398. };
  399. }());</pre>
  400. </body>
  401. </html>