~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/build/node-screen/node-screen.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.4.1 (build 4118)
3
 
Copyright 2011 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add('node-screen', function(Y) {
8
 
 
9
 
/**
10
 
 * Extended Node interface for managing regions and screen positioning.
11
 
 * Adds support for positioning elements and normalizes window size and scroll detection. 
12
 
 * @module node
13
 
 * @submodule node-screen
14
 
 */
15
 
 
16
 
// these are all "safe" returns, no wrapping required
17
 
Y.each([
18
 
    /**
19
 
     * Returns the inner width of the viewport (exludes scrollbar). 
20
 
     * @config winWidth
21
 
     * @for Node
22
 
     * @type {Int}
23
 
     */
24
 
    'winWidth',
25
 
 
26
 
    /**
27
 
     * Returns the inner height of the viewport (exludes scrollbar). 
28
 
     * @config winHeight
29
 
     * @type {Int}
30
 
     */
31
 
    'winHeight',
32
 
 
33
 
    /**
34
 
     * Document width 
35
 
     * @config winHeight
36
 
     * @type {Int}
37
 
     */
38
 
    'docWidth',
39
 
 
40
 
    /**
41
 
     * Document height 
42
 
     * @config docHeight
43
 
     * @type {Int}
44
 
     */
45
 
    'docHeight',
46
 
 
47
 
    /**
48
 
     * Pixel distance the page has been scrolled horizontally 
49
 
     * @config docScrollX
50
 
     * @type {Int}
51
 
     */
52
 
    'docScrollX',
53
 
 
54
 
    /**
55
 
     * Pixel distance the page has been scrolled vertically 
56
 
     * @config docScrollY
57
 
     * @type {Int}
58
 
     */
59
 
    'docScrollY'
60
 
    ],
61
 
    function(name) {
62
 
        Y.Node.ATTRS[name] = {
63
 
            getter: function() {
64
 
                var args = Array.prototype.slice.call(arguments);
65
 
                args.unshift(Y.Node.getDOMNode(this));
66
 
 
67
 
                return Y.DOM[name].apply(this, args);
68
 
            }
69
 
        };
70
 
    }
71
 
);
72
 
 
73
 
Y.Node.ATTRS.scrollLeft = {
74
 
    getter: function() {
75
 
        var node = Y.Node.getDOMNode(this);
76
 
        return ('scrollLeft' in node) ? node.scrollLeft : Y.DOM.docScrollX(node);
77
 
    },
78
 
 
79
 
    setter: function(val) {
80
 
        var node = Y.Node.getDOMNode(this);
81
 
        if (node) {
82
 
            if ('scrollLeft' in node) {
83
 
                node.scrollLeft = val;
84
 
            } else if (node.document || node.nodeType === 9) {
85
 
                Y.DOM._getWin(node).scrollTo(val, Y.DOM.docScrollY(node)); // scroll window if win or doc
86
 
            }
87
 
        } else {
88
 
        }
89
 
    }
90
 
};
91
 
 
92
 
Y.Node.ATTRS.scrollTop = {
93
 
    getter: function() {
94
 
        var node = Y.Node.getDOMNode(this);
95
 
        return ('scrollTop' in node) ? node.scrollTop : Y.DOM.docScrollY(node);
96
 
    },
97
 
 
98
 
    setter: function(val) {
99
 
        var node = Y.Node.getDOMNode(this);
100
 
        if (node) {
101
 
            if ('scrollTop' in node) {
102
 
                node.scrollTop = val;
103
 
            } else if (node.document || node.nodeType === 9) {
104
 
                Y.DOM._getWin(node).scrollTo(Y.DOM.docScrollX(node), val); // scroll window if win or doc
105
 
            }
106
 
        } else {
107
 
        }
108
 
    }
109
 
};
110
 
 
111
 
Y.Node.importMethod(Y.DOM, [
112
 
/**
113
 
 * Gets the current position of the node in page coordinates. 
114
 
 * @method getXY
115
 
 * @for Node
116
 
 * @return {Array} The XY position of the node
117
 
*/
118
 
    'getXY',
119
 
 
120
 
/**
121
 
 * Set the position of the node in page coordinates, regardless of how the node is positioned.
122
 
 * @method setXY
123
 
 * @param {Array} xy Contains X & Y values for new position (coordinates are page-based)
124
 
 * @chainable
125
 
 */
126
 
    'setXY',
127
 
 
128
 
/**
129
 
 * Gets the current position of the node in page coordinates. 
130
 
 * @method getX
131
 
 * @return {Int} The X position of the node
132
 
*/
133
 
    'getX',
134
 
 
135
 
/**
136
 
 * Set the position of the node in page coordinates, regardless of how the node is positioned.
137
 
 * @method setX
138
 
 * @param {Int} x X value for new position (coordinates are page-based)
139
 
 * @chainable
140
 
 */
141
 
    'setX',
142
 
 
143
 
/**
144
 
 * Gets the current position of the node in page coordinates. 
145
 
 * @method getY
146
 
 * @return {Int} The Y position of the node
147
 
*/
148
 
    'getY',
149
 
 
150
 
/**
151
 
 * Set the position of the node in page coordinates, regardless of how the node is positioned.
152
 
 * @method setY
153
 
 * @param {Int} y Y value for new position (coordinates are page-based)
154
 
 * @chainable
155
 
 */
156
 
    'setY',
157
 
 
158
 
/**
159
 
 * Swaps the XY position of this node with another node. 
160
 
 * @method swapXY
161
 
 * @param {Node | HTMLElement} otherNode The node to swap with.
162
 
 * @chainable
163
 
 */
164
 
    'swapXY'
165
 
]);
166
 
 
167
 
/**
168
 
 * @module node
169
 
 * @submodule node-screen
170
 
 */
171
 
 
172
 
/**
173
 
 * Returns a region object for the node
174
 
 * @config region
175
 
 * @for Node
176
 
 * @type Node
177
 
 */
178
 
Y.Node.ATTRS.region = {
179
 
    getter: function() {
180
 
        var node = this.getDOMNode(),
181
 
            region;
182
 
 
183
 
        if (node && !node.tagName) {
184
 
            if (node.nodeType === 9) { // document
185
 
                node = node.documentElement;
186
 
            }
187
 
        }
188
 
        if (Y.DOM.isWindow(node)) {
189
 
            region = Y.DOM.viewportRegion(node);
190
 
        } else {
191
 
            region = Y.DOM.region(node);
192
 
        }
193
 
        return region;
194
 
    }
195
 
};
196
 
 
197
 
/**
198
 
 * Returns a region object for the node's viewport
199
 
 * @config viewportRegion
200
 
 * @type Node
201
 
 */
202
 
Y.Node.ATTRS.viewportRegion = {
203
 
    getter: function() {
204
 
        return Y.DOM.viewportRegion(Y.Node.getDOMNode(this));
205
 
    }
206
 
};
207
 
 
208
 
Y.Node.importMethod(Y.DOM, 'inViewportRegion');
209
 
 
210
 
// these need special treatment to extract 2nd node arg
211
 
/**
212
 
 * Compares the intersection of the node with another node or region
213
 
 * @method intersect
214
 
 * @for Node
215
 
 * @param {Node|Object} node2 The node or region to compare with.
216
 
 * @param {Object} altRegion An alternate region to use (rather than this node's).
217
 
 * @return {Object} An object representing the intersection of the regions.
218
 
 */
219
 
Y.Node.prototype.intersect = function(node2, altRegion) {
220
 
    var node1 = Y.Node.getDOMNode(this);
221
 
    if (Y.instanceOf(node2, Y.Node)) { // might be a region object
222
 
        node2 = Y.Node.getDOMNode(node2);
223
 
    }
224
 
    return Y.DOM.intersect(node1, node2, altRegion);
225
 
};
226
 
 
227
 
/**
228
 
 * Determines whether or not the node is within the giving region.
229
 
 * @method inRegion
230
 
 * @param {Node|Object} node2 The node or region to compare with.
231
 
 * @param {Boolean} all Whether or not all of the node must be in the region.
232
 
 * @param {Object} altRegion An alternate region to use (rather than this node's).
233
 
 * @return {Object} An object representing the intersection of the regions.
234
 
 */
235
 
Y.Node.prototype.inRegion = function(node2, all, altRegion) {
236
 
    var node1 = Y.Node.getDOMNode(this);
237
 
    if (Y.instanceOf(node2, Y.Node)) { // might be a region object
238
 
        node2 = Y.Node.getDOMNode(node2);
239
 
    }
240
 
    return Y.DOM.inRegion(node1, node2, all, altRegion);
241
 
};
242
 
 
243
 
 
244
 
}, '3.4.1' ,{requires:['node-base', 'dom-screen']});