diff -r 000000000000 -r 40c8f766c9b8 src/cm/media/js/lib/yui/yui3.0.0/api/node-screen.js.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui3.0.0/api/node-screen.js.html Mon Nov 23 15:14:29 2009 +0100 @@ -0,0 +1,297 @@ + + +
+ +/**
+ * Extended Node interface for managing regions and screen positioning.
+ * Adds support for positioning elements and normalizes window size and scroll detection.
+ * @module node
+ * @submodule node-screen
+ */
+
+// these are all "safe" returns, no wrapping required
+Y.each([
+ /**
+ * Returns the inner width of the viewport (exludes scrollbar).
+ * @config winWidth
+ * @for Node
+ * @type {Int}
+ */
+ 'winWidth',
+
+ /**
+ * Returns the inner height of the viewport (exludes scrollbar).
+ * @config winHeight
+ * @type {Int}
+ */
+ 'winHeight',
+
+ /**
+ * Document width
+ * @config winHeight
+ * @type {Int}
+ */
+ 'docWidth',
+
+ /**
+ * Document height
+ * @config docHeight
+ * @type {Int}
+ */
+ 'docHeight',
+
+ /**
+ * Amount page has been scroll vertically
+ * @config docScrollX
+ * @type {Int}
+ */
+ 'docScrollX',
+
+ /**
+ * Amount page has been scroll horizontally
+ * @config docScrollY
+ * @type {Int}
+ */
+ 'docScrollY'
+ ],
+ function(name) {
+ Y.Node.ATTRS[name] = {
+ getter: function() {
+ var args = Array.prototype.slice.call(arguments);
+ args.unshift(Y.Node.getDOMNode(this));
+
+ return Y.DOM[name].apply(this, args);
+ }
+ };
+ }
+);
+
+Y.Node.ATTRS.scrollLeft = {
+ getter: function() {
+ var node = Y.Node.getDOMNode(this);
+ return ('scrollLeft' in node) ? node.scrollLeft : Y.DOM.docScrollX(node);
+ },
+
+ setter: function(val) {
+ var node = Y.Node.getDOMNode(this);
+ if (node) {
+ if ('scrollLeft' in node) {
+ node.scrollLeft = val;
+ } else if (node.document || node.nodeType === 9) {
+ Y.DOM._getWin(node).scrollTo(val, Y.DOM.docScrollY(node)); // scroll window if win or doc
+ }
+ } else {
+ Y.log('unable to set scrollLeft for ' + node, 'error', 'Node');
+ }
+ }
+};
+
+Y.Node.ATTRS.scrollTop = {
+ getter: function() {
+ var node = Y.Node.getDOMNode(this);
+ return ('scrollTop' in node) ? node.scrollTop : Y.DOM.docScrollY(node);
+ },
+
+ setter: function(val) {
+ var node = Y.Node.getDOMNode(this);
+ if (node) {
+ if ('scrollTop' in node) {
+ node.scrollTop = val;
+ } else if (node.document || node.nodeType === 9) {
+ Y.DOM._getWin(node).scrollTo(Y.DOM.docScrollX(node), val); // scroll window if win or doc
+ }
+ } else {
+ Y.log('unable to set scrollTop for ' + node, 'error', 'Node');
+ }
+ }
+};
+
+Y.Node.importMethod(Y.DOM, [
+/**
+ * Gets the current position of the node in page coordinates.
+ * @method getXY
+ * @for Node
+ * @return {Array} The XY position of the node
+*/
+ 'getXY',
+
+/**
+ * Set the position of the node in page coordinates, regardless of how the node is positioned.
+ * @method setXY
+ * @param {Array} xy Contains X & Y values for new position (coordinates are page-based)
+ * @chainable
+ */
+ 'setXY',
+
+/**
+ * Gets the current position of the node in page coordinates.
+ * @method getX
+ * @return {Int} The X position of the node
+*/
+ 'getX',
+
+/**
+ * Set the position of the node in page coordinates, regardless of how the node is positioned.
+ * @method setX
+ * @param {Int} x X value for new position (coordinates are page-based)
+ * @chainable
+ */
+ 'setX',
+
+/**
+ * Gets the current position of the node in page coordinates.
+ * @method getY
+ * @return {Int} The Y position of the node
+*/
+ 'getY',
+
+/**
+ * Set the position of the node in page coordinates, regardless of how the node is positioned.
+ * @method setY
+ * @param {Int} y Y value for new position (coordinates are page-based)
+ * @chainable
+ */
+ 'setY'
+]);
+