Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

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