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>
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
15 Ext.ux.Spotlight = function(config){
16 Ext.apply(this, config);
18 Ext.ux.Spotlight.prototype = {
27 createElements : function(){
28 var bd = Ext.getBody();
30 this.right = bd.createChild({cls:'x-spotlight'});
31 this.left = bd.createChild({cls:'x-spotlight'});
32 this.top = bd.createChild({cls:'x-spotlight'});
33 this.bottom = bd.createChild({cls:'x-spotlight'});
35 this.all = new Ext.CompositeElement([this.right, this.left, this.top, this.bottom]);
38 show : function(el, callback, scope){
40 this.show.defer(50, this, [el, callback, scope]);
43 this.el = Ext.get(el);
45 this.createElements();
48 this.all.setDisplayed('');
49 this.applyBounds(true, false);
51 Ext.EventManager.onWindowResize(this.syncSize, this);
52 this.applyBounds(false, this.animate, false, callback, scope);
54 this.applyBounds(false, false, false, callback, scope); // all these booleans look hideous
58 hide : function(callback, scope){
60 this.hide.defer(50, this, [callback, scope]);
63 Ext.EventManager.removeResizeListener(this.syncSize, this);
64 this.applyBounds(true, this.animate, true, callback, scope);
69 this.all.setDisplayed(false);
72 syncSize : function(){
73 this.applyBounds(false, false);
76 applyBounds : function(basePts, anim, doHide, callback, scope){
78 var rg = this.el.getRegion();
80 var dw = Ext.lib.Dom.getViewWidth(true);
81 var dh = Ext.lib.Dom.getViewHeight(true);
83 var c = 0, cb = false;
89 this.animated = false;
93 Ext.callback(callback, scope, [this]);
97 duration: this.duration,
100 this.animated = true;
103 this.right.setBounds(
105 basePts ? dh : rg.top,
107 basePts ? 0 : (dh - rg.top),
114 basePts ? 0 : rg.bottom,
118 basePts ? dw : rg.left,
120 basePts ? 0 : dw - rg.left,
124 this.bottom.setBounds(
127 basePts ? 0 : rg.right,
136 Ext.callback(callback, scope, [this]);
141 destroy : function(){
154 Ext.Spotlight = Ext.ux.Spotlight;</pre>