-<html>\r
-<head>\r
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \r
- <title>The source code</title>\r
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js">/**\r
- * @class Ext.Element\r
- */\r
-Ext.Element.addMethods({\r
- <div id="method-Ext.Element-scrollTo"></div>/**\r
- * Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().\r
- * @param {String} side Either "left" for scrollLeft values or "top" for scrollTop values.\r
- * @param {Number} value The new scroll value\r
- * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
- * @return {Element} this\r
- */\r
- scrollTo : function(side, value, animate){\r
- var top = /top/i.test(side), //check if we're scrolling top or left\r
- me = this,\r
- dom = me.dom,\r
- prop;\r
- if (!animate || !me.anim) {\r
- prop = 'scroll' + (top ? 'Top' : 'Left'), // just setting the value, so grab the direction\r
- dom[prop] = value;\r
- }else{\r
- prop = 'scroll' + (top ? 'Left' : 'Top'), // if scrolling top, we need to grab scrollLeft, if left, scrollTop\r
- me.anim({scroll: {to: top ? [dom[prop], value] : [value, dom[prop]]}},\r
- me.preanim(arguments, 2), 'scroll');\r
- }\r
- return me;\r
- },\r
- \r
- <div id="method-Ext.Element-scrollIntoView"></div>/**\r
- * Scrolls this element into view within the passed container.\r
- * @param {Mixed} container (optional) The container element to scroll (defaults to document.body). Should be a\r
- * string (id), dom node, or Ext.Element.\r
- * @param {Boolean} hscroll (optional) False to disable horizontal scroll (defaults to true)\r
- * @return {Ext.Element} this\r
- */\r
- scrollIntoView : function(container, hscroll){\r
- var c = Ext.getDom(container) || Ext.getBody().dom,\r
- el = this.dom,\r
- o = this.getOffsetsTo(c),\r
- l = o[0] + c.scrollLeft,\r
- t = o[1] + c.scrollTop,\r
- b = t + el.offsetHeight,\r
- r = l + el.offsetWidth,\r
- ch = c.clientHeight,\r
- ct = parseInt(c.scrollTop, 10),\r
- cl = parseInt(c.scrollLeft, 10),\r
- cb = ct + ch,\r
- cr = cl + c.clientWidth;\r
-\r
- if (el.offsetHeight > ch || t < ct) {\r
- c.scrollTop = t;\r
- } else if (b > cb){\r
- c.scrollTop = b-ch;\r
- }\r
- c.scrollTop = c.scrollTop; // corrects IE, other browsers will ignore\r
-\r
- if(hscroll !== false){\r
- if(el.offsetWidth > c.clientWidth || l < cl){\r
- c.scrollLeft = l;\r
- }else if(r > cr){\r
- c.scrollLeft = r - c.clientWidth;\r
- }\r
- c.scrollLeft = c.scrollLeft;\r
- }\r
- return this;\r
- },\r
-\r
- // private\r
- scrollChildIntoView : function(child, hscroll){\r
- Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);\r
- },\r
- \r
- <div id="method-Ext.Element-scroll"></div>/**\r
- * Scrolls this element the specified direction. Does bounds checking to make sure the scroll is\r
- * within this element's scrollable range.\r
- * @param {String} direction Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").\r
- * @param {Number} distance How far to scroll the element in pixels\r
- * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
- * @return {Boolean} Returns true if a scroll was triggered or false if the element\r
- * was scrolled as far as it could go.\r
- */\r
- scroll : function(direction, distance, animate){\r
- if(!this.isScrollable()){\r
- return;\r
- }\r
- var el = this.dom,\r
- l = el.scrollLeft, t = el.scrollTop,\r
- w = el.scrollWidth, h = el.scrollHeight,\r
- cw = el.clientWidth, ch = el.clientHeight,\r
- scrolled = false, v,\r
- hash = {\r
- l: Math.min(l + distance, w-cw),\r
- r: v = Math.max(l - distance, 0),\r
- t: Math.max(t - distance, 0),\r
- b: Math.min(t + distance, h-ch)\r
- };\r
- hash.d = hash.b;\r
- hash.u = hash.t;\r
- \r
- direction = direction.substr(0, 1);\r
- if((v = hash[direction]) > -1){\r
- scrolled = true;\r
- this.scrollTo(direction == 'l' || direction == 'r' ? 'left' : 'top', v, this.preanim(arguments, 2));\r
- }\r
- return scrolled;\r
- }\r
-});</pre> \r
-</body>\r
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>The source code</title>
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+</head>
+<body onload="prettyPrint();">
+ <pre class="prettyprint lang-js">/*!
+ * Ext JS Library 3.2.1
+ * Copyright(c) 2006-2010 Ext JS, Inc.
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+/**
+ * @class Ext.Element
+ */
+Ext.Element.addMethods({
+ <div id="method-Ext.Element-scrollTo"></div>/**
+ * Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().
+ * @param {String} side Either "left" for scrollLeft values or "top" for scrollTop values.
+ * @param {Number} value The new scroll value
+ * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+ * @return {Element} this
+ */
+ scrollTo : function(side, value, animate){
+ var top = /top/i.test(side), //check if we're scrolling top or left
+ me = this,
+ dom = me.dom,
+ prop;
+ if (!animate || !me.anim) {
+ prop = 'scroll' + (top ? 'Top' : 'Left'), // just setting the value, so grab the direction
+ dom[prop] = value;
+ }else{
+ prop = 'scroll' + (top ? 'Left' : 'Top'), // if scrolling top, we need to grab scrollLeft, if left, scrollTop
+ me.anim({scroll: {to: top ? [dom[prop], value] : [value, dom[prop]]}},
+ me.preanim(arguments, 2), 'scroll');
+ }
+ return me;
+ },
+
+ <div id="method-Ext.Element-scrollIntoView"></div>/**
+ * Scrolls this element into view within the passed container.
+ * @param {Mixed} container (optional) The container element to scroll (defaults to document.body). Should be a
+ * string (id), dom node, or Ext.Element.
+ * @param {Boolean} hscroll (optional) False to disable horizontal scroll (defaults to true)
+ * @return {Ext.Element} this
+ */
+ scrollIntoView : function(container, hscroll){
+ var c = Ext.getDom(container) || Ext.getBody().dom,
+ el = this.dom,
+ o = this.getOffsetsTo(c),
+ l = o[0] + c.scrollLeft,
+ t = o[1] + c.scrollTop,
+ b = t + el.offsetHeight,
+ r = l + el.offsetWidth,
+ ch = c.clientHeight,
+ ct = parseInt(c.scrollTop, 10),
+ cl = parseInt(c.scrollLeft, 10),
+ cb = ct + ch,
+ cr = cl + c.clientWidth;
+
+ if (el.offsetHeight > ch || t < ct) {
+ c.scrollTop = t;
+ } else if (b > cb){
+ c.scrollTop = b-ch;
+ }
+ c.scrollTop = c.scrollTop; // corrects IE, other browsers will ignore
+
+ if(hscroll !== false){
+ if(el.offsetWidth > c.clientWidth || l < cl){
+ c.scrollLeft = l;
+ }else if(r > cr){
+ c.scrollLeft = r - c.clientWidth;
+ }
+ c.scrollLeft = c.scrollLeft;
+ }
+ return this;
+ },
+
+ // private
+ scrollChildIntoView : function(child, hscroll){
+ Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
+ },
+
+ <div id="method-Ext.Element-scroll"></div>/**
+ * Scrolls this element the specified direction. Does bounds checking to make sure the scroll is
+ * within this element's scrollable range.
+ * @param {String} direction Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").
+ * @param {Number} distance How far to scroll the element in pixels
+ * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+ * @return {Boolean} Returns true if a scroll was triggered or false if the element
+ * was scrolled as far as it could go.
+ */
+ scroll : function(direction, distance, animate){
+ if(!this.isScrollable()){
+ return;
+ }
+ var el = this.dom,
+ l = el.scrollLeft, t = el.scrollTop,
+ w = el.scrollWidth, h = el.scrollHeight,
+ cw = el.clientWidth, ch = el.clientHeight,
+ scrolled = false, v,
+ hash = {
+ l: Math.min(l + distance, w-cw),
+ r: v = Math.max(l - distance, 0),
+ t: Math.max(t - distance, 0),
+ b: Math.min(t + distance, h-ch)
+ };
+ hash.d = hash.b;
+ hash.u = hash.t;
+
+ direction = direction.substr(0, 1);
+ if((v = hash[direction]) > -1){
+ scrolled = true;
+ this.scrollTo(direction == 'l' || direction == 'r' ? 'left' : 'top', v, this.preanim(arguments, 2));
+ }
+ return scrolled;
+ }
+});</pre>
+</body>
</html>
\ No newline at end of file