~andreserl/maas/packaging_precise_rebase

« back to all changes in this revision

Viewing changes to debian/extras/jslibs/yui/event-resize/event-resize.js

  • Committer: Andres Rodriguez
  • Date: 2013-03-20 18:12:30 UTC
  • mfrom: (145.2.22 precise.sru)
  • Revision ID: andreserl@ubuntu.com-20130320181230-6l5guc0nhlv2z4p7
Re-base againts latest quantal released branch towards SRU

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
YUI 3.5.1 (build 22)
 
3
Copyright 2012 Yahoo! Inc. All rights reserved.
 
4
Licensed under the BSD License.
 
5
http://yuilibrary.com/license/
 
6
*/
 
7
YUI.add('event-resize', function(Y) {
 
8
 
 
9
/**
 
10
 * Adds a window resize event that has its behavior normalized to fire at the
 
11
 * end of the resize rather than constantly during the resize.
 
12
 * @module event
 
13
 * @submodule event-resize
 
14
 */
 
15
 
 
16
 
 
17
/**
 
18
 * Old firefox fires the window resize event once when the resize action
 
19
 * finishes, other browsers fire the event periodically during the
 
20
 * resize.  This code uses timeout logic to simulate the Firefox 
 
21
 * behavior in other browsers.
 
22
 * @event windowresize
 
23
 * @for YUI
 
24
 */
 
25
Y.Event.define('windowresize', {
 
26
 
 
27
    on: (Y.UA.gecko && Y.UA.gecko < 1.91) ?
 
28
        function (node, sub, notifier) {
 
29
            sub._handle = Y.Event.attach('resize', function (e) {
 
30
                notifier.fire(e);
 
31
            });
 
32
        } :
 
33
        function (node, sub, notifier) {
 
34
            // interval bumped from 40 to 100ms as of 3.4.1
 
35
            var delay = Y.config.windowResizeDelay || 100;
 
36
 
 
37
            sub._handle = Y.Event.attach('resize', function (e) {
 
38
                if (sub._timer) {
 
39
                    sub._timer.cancel();
 
40
                }
 
41
 
 
42
                sub._timer = Y.later(delay, Y, function () {
 
43
                    notifier.fire(e);
 
44
                });
 
45
            });
 
46
        },
 
47
 
 
48
    detach: function (node, sub) {
 
49
        if (sub._timer) {
 
50
            sub._timer.cancel();
 
51
        }
 
52
        sub._handle.detach();
 
53
    }
 
54
    // delegate methods not defined because this only works for window
 
55
    // subscriptions, so...yeah.
 
56
});
 
57
 
 
58
 
 
59
}, '3.5.1' ,{requires:['event-synthetic']});