PageSourceSearch

https://notnul.com/ScriptResource.axd?d=MOUUZAHHFnmmiQ4BM9r_BKuanG…iOVOtL5dZAszMYXtiwP-ypw0wTtg_EM1&t=51e37521

js notnul.com collected 2026-09-24 20:11:37 UTC 13,673 bytes, 383 lines download raw bytes

1// Name:        AlwaysVisibleControl.AlwaysVisibleControlBehavior.debug.js
2// Assembly:    AjaxControlToolkit
3// Version:     4.1.7.1213
4// FileVersion: 4.1.7.1213
5// (c) 2010 CodePlex Foundation
6
7
8
9/// <reference name="MicrosoftAjax.debug.js" />
10/// <reference name="MicrosoftAjaxTimer.debug.js" />
11/// <reference name="MicrosoftAjaxWebForms.debug.js" />
12/// <reference path="../ExtenderBase/BaseScripts.js" />
13/// <reference path="../Compat/Timer/Timer.js" />
14/// <reference path="../Common/Common.js" />
15/// <reference path="../Animation/Animations.js" />
16
17(function() {
18var scriptName = "ExtendedAlwaysVisible";
19
20function execute() {
21
22
23Type.registerNamespace('Sys.Extended.UI');
24
25Sys.Extended.UI.HorizontalSide = function() {
26    /// <summary>
27    /// The HorizontalSide enumeration describes the horizontal side
28    /// of the window used to anchor the element
29    /// </summary>
30    /// <field name="Left" type="Number" integer="true" />
31    /// <field name="Center" type="Number" integer="true" />
32    /// <field name="Right" type="Number" integer="true" />
33    throw Error.invalidOperation();
34}
35Sys.Extended.UI.HorizontalSide.prototype = {
36    Left : 0,
37    Center : 1,
38    Right : 2
39}
40Sys.Extended.UI.HorizontalSide.registerEnum("Sys.Extended.UI.HorizontalSide", false);
41
42
43Sys.Extended.UI.VerticalSide = function() {
44    /// <summary>
45    /// The VerticalSide enumeration describes the vertical side
46    /// of the window used to anchor the element
47    /// </summary>
48    /// <field name="Top" type="Number" integer="true" />
49    /// <field name="Middle" type="Number" integer="true" />
50    /// <field name="Bottom" type="Number" integer="true" />
51    throw Error.invalidOperation();
52}
53Sys.Extended.UI.VerticalSide.prototype = {
54    Top : 0,
55    Middle : 1,
56    Bottom : 2
57}
58Sys.Extended.UI.VerticalSide.registerEnum("Sys.Extended.UI.VerticalSide", false);
59
60
61Sys.Extended.UI.AlwaysVisibleControlBehavior = function(element) {
62    /// <summary>
63    /// The AlwaysVisibleControl behavior is used to fix a particular control a specified distance
64    /// from the top/left corner at all times regardless of how the users scrolls or sizes the window.
65    /// </summary>
66    /// <param name="element" type="Sys.UI.DomElement" domElement="true">
67    /// The DOM element the behavior is associated with
68    /// </param>
69    Sys.Extended.UI.AlwaysVisibleControlBehavior.initializeBase(this, [element]);
70    
71    this._horizontalOffset = 0;
72    
73    this._horizontalSide = Sys.Extended.UI.HorizontalSide.Left;
74    
75    this._verticalOffset = 0;
76    
77    this._verticalSide = Sys.Extended.UI.VerticalSide.Top;
78    
79    this._scrollEffectDuration = .1;
80    
81    this._repositionHandler = null;
82    
83    this._animate = false;
84    
85    this._animation = null;
86}
87Sys.Extended.UI.AlwaysVisibleControlBehavior.prototype = {
88    initialize : function() {
89        /// <summary>
90        /// Initialize the behavior
91        /// </summary>
92        /// <returns />
93        Sys.Extended.UI.AlwaysVisibleControlBehavior.callBaseMethod(this, 'initialize');
94        
95        var element = this.get_element();
96        if (!element) throw Error.invalidOperation(Sys.Extended.UI.Resources.AlwaysVisible_ElementRequired);
97        
98        this._repositionHandler = Function.createDelegate(this, this._reposition);
99        
100        if (Sys.Browser.agent == Sys.Browser.InternetExplorer && Sys.Browser.version < 7) {
101            this._animate = true;
102        }
103        if (this._animate) {
104            this._animation = new Sys.Extended.UI.Animation.MoveAnimation(
105                element, this._scrollEffectDuration, 25, 0, 0, false, 'px');
106
107            element.style.position = 'absolute';
108        } else {
109            element.style.position = 'fixed';
110        }
111        
112        $addHandler(window, 'resize', this._repositionHandler);
113        
114        if (this._animate) {
115            $addHandler(window, 'scroll', this._repositionHandler);
116        }
117        
118        this._reposition();
119    },
120    
121    dispose : function() {
122        /// <summary>
123        /// Dispose the behavior
124        /// </summary>
125        /// <returns />
126    
127        if (this._repositionHandler) {
128            if (this._animate) {
129                $removeHandler(window, 'scroll', this._repositionHandler);
130            }
131            $removeHandler(window, 'resize', this._repositionHandler);
132            this._repositionHandler = null;
133        }
134        
135        if (this._animation) {
136            this._animation.dispose();
137            this._animation = null;
138        }
139        
140        Sys.Extended.UI.AlwaysVisibleControlBehavior.callBaseMethod(this, 'dispose');
141    },
142
143    _reposition : function(eventObject) {
144        /// <summary>
145        /// Handler to reposition the element and place it where it actually belongs
146        /// whenever the browser is scrolled or resized
147        /// </summary>
148        /// <param name="eventObject" type="Sys.UI.DomEvent">
149        /// Event info
150        /// </param>
151        /// <returns />
152
153        var element = this.get_element();
154        if (!element) return;
155        
156        this.raiseRepositioning(Sys.EventArgs.Empty);
157        
158        var x = 0;
159        var y = 0;
160        
161        if (this._animate) {
162            if (document.documentElement && document.documentElement.scrollTop) {
163                x = document.documentElement.scrollLeft;
164                y = document.documentElement.scrollTop;
165            } else {
166                x = document.body.scrollLeft;
167                y = document.body.scrollTop;
168            }
169        }
170        
171        var clientBounds = $common.getClientBounds();
172        var width = clientBounds.width;
173        var height = clientBounds.height;
174        
175        switch (this._horizontalSide) {
176            case Sys.Extended.UI.HorizontalSide.Center :
177                x = Math.max(0, Math.floor(x + width / 2.0 - element.offsetWidth / 2.0 - this._horizontalOffset));
178                break;
179            case Sys.Extended.UI.HorizontalSide.Right :
180                x = Math.max(0, x + width - element.offsetWidth - this._horizontalOffset);
181                break;
182            case Sys.Extended.UI.HorizontalSide.Left :
183            default :
184                x += this._horizontalOffset;
185                break;
186        }            
187           
188        switch (this._verticalSide) {
189            case Sys.Extended.UI.VerticalSide.Middle :
190                y = Math.max(0, Math.floor(y + height / 2.0 - element.offsetHeight / 2.0 - this._verticalOffset));
191                break;
192            case Sys.Extended.UI.VerticalSide.Bottom :
193                y = Math.max(0, y + height - element.offsetHeight - this._verticalOffset);
194                break;
195            case Sys.Extended.UI.VerticalSide.Top :
196            default :
197                y += this._verticalOffset;
198                break;
199        }
200        
201        if (this._animate && this._animation) {
202            this._animation.stop();
203            this._animation.set_horizontal(x);
204            this._animation.set_vertical(y);
205            this._animation.play();
206        } else {
207            element.style.left = x + 'px';
208            element.style.top = y + 'px';
209        }
210        
211        this.raiseRepositioned(Sys.EventArgs.Empty);
212    },
213    
214    get_HorizontalOffset : function() {
215        /// <value type="Number" integer="true">
216        /// Distance to the horizontal edge of the browser in pixels from the same side of the target control. The default is 0 pixels.
217        /// </value>
218        return this._horizontalOffset;
219    },
220    set_HorizontalOffset : function(value) {
221        if (this._horizontalOffset != value) {
222            this._horizontalOffset = value;
223            this._reposition();
224            this.raisePropertyChanged('HorizontalOffset');
225        }
226    },
227    
228    get_HorizontalSide : function() {
229        /// <value type="Sys.Extended.UI.HorizontalSide" integer="true">
230        /// Horizontal side of the browser to anchor the control against.  The default is the Left side.
231        /// </value>
232        return this._horizontalSide;
233    },
234    set_HorizontalSide : function(value) {
235        if (this._horizontalSide != value) {
236            this._horizontalSide = value;
237            this._reposition();
238            this.raisePropertyChanged('HorizontalSide');
239        }
240    },
241    
242    get_VerticalOffset : function() {
243        /// <value type="Number" integer="true">
244        /// Distance to the vertical edge of the browser in pixels from the same side of the target control. The default is 0 pixels.
245        /// </value>
246        return this._verticalOffset;
247    },
248    set_VerticalOffset : function(value) {
249        if (this._verticalOffset != value) {
250            this._verticalOffset = value;
251            this._reposition();
252            this.raisePropertyChanged('VerticalOffset');
253        }
254    },
255    
256    get_VerticalSide : function() {
257        /// <value type="Sys.Extended.UI.VerticalSide" integer="true">
258        /// Vertical side of the browser to anchor the control against.  The default is the Top side.
259        /// </value>
260        return this._verticalSide;
261    },
262    set_VerticalSide : function(value) {
263        if (this._verticalSide != value) {
264            this._verticalSide = value;
265            this._reposition();
266            this.raisePropertyChanged('VerticalSide');
267        }
268    },
269    
270    get_ScrollEffectDuration : function() {
271        /// <value type="Number">
272        /// Length in seconds for the scrolling effect to last when the target control is repositioned. The default is .1 seconds.
273        /// </value>
274        return this._scrollEffectDuration;
275    },
276    set_ScrollEffectDuration : function(value) {
277        if (this._scrollEffectDuration != value) {
278            this._scrollEffectDuration = value;
279            if (this._animation) {
280                this._animation.set_duration(value); 
281            }
282            this.raisePropertyChanged('ScrollEffectDuration');
283        }
284    },
285    
286    get_useAnimation : function() {
287        /// <value type="Boolean">
288        /// Whether or not to animate the element into position. (note:
289        /// this value should always be true in IE6).
290        /// </value>
291        return this._animate;
292    },
293    set_useAnimation : function(value) {
294        value |= (Sys.Browser.agent == Sys.Browser.InternetExplorer && Sys.Browser.version < 7);
295        if (this._animate != value) {
296            this._animate = value;
297            this.raisePropertyChanged('useAnimation');
298        }
299    },
300    
301    add_repositioning : function(handler) {
302        /// <summary>
303        /// Add an event handler for the repositioning event
304        /// </summary>
305        /// <param name="handler" type="Function" mayBeNull="false">
306        /// Event handler
307        /// </param>
308        /// <returns />
309        this.get_events().addHandler('repositioning', handler);
310    },
311    remove_repositioning : function(handler) {
312        /// <summary>
313        /// Remove an event handler from the repositioning event
314        /// </summary>
315        /// <param name="handler" type="Function" mayBeNull="false">
316        /// Event handler
317        /// </param>
318        /// <returns />
319        this.get_events().removeHandler('repositioning', handler);
320    },
321    raiseRepositioning : function(eventArgs) {
322        /// <summary>
323        /// Raise the repositioning event
324        /// </summary>
325        /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false">
326        /// Event arguments for the repositioning event
327        /// </param>
328        /// <returns />
329        
330        var handler = this.get_events().getHandler('repositioning');
331        if (handler) {
332            handler(this, eventArgs);
333        }
334    },
335    
336    add_repositioned : function(handler) {
337        /// <summary>
338        /// Add an event handler for the repositioned event
339        /// </summary>
340        /// <param name="handler" type="Function" mayBeNull="false">
341        /// Event handler
342        /// </param>
343        /// <returns />
344        this.get_events().addHandler('repositioned', handler);
345    },
346    remove_repositioned : function(handler) {
347        /// <summary>
348        /// Remove an event handler from the repositioned event
349        /// </summary>
350        /// <param name="handler" type="Function" mayBeNull="false">
351        /// Event handler
352        /// </param>
353        /// <returns />
354        this.get_events().removeHandler('repositioned', handler);
355    },
356    raiseRepositioned : function(eventArgs) {
357        /// <summary>
358        /// Raise the repositioned event
359        /// </summary>
360        /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false">
361        /// Event arguments for the repositioned event
362        /// </param>
363        /// <returns />
364        
365        var handler = this.get_events().getHandler('repositioned');
366        if (handler) {
367            handler(this, eventArgs);
368        }
369    }
370}
371Sys.Extended.UI.AlwaysVisibleControlBehavior.registerClass('Sys.Extended.UI.AlwaysVisibleControlBehavior', Sys.Extended.UI.BehaviorBase);
372Sys.registerComponent(Sys.Extended.UI.AlwaysVisibleControlBehavior, { name: "alwaysVisible" });
373
374} // execute
375
376if (window.Sys && Sys.loader) {
377    Sys.loader.registerScript(scriptName, ["ExtendedAnimations", "ExtendedBase"], execute);
378}
379else {
380    execute();
381}
382
383})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.