Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' into global

  • Loading branch information...
commit 8f8cb58aa9744551ac71402775c21d557522fff7 2 parents 2f1720b + 94b86a1
Dav Glass davglass authored
4 build/scrollview-paginator/scrollview-paginator-coverage.js
@@ -26,7 +26,7 @@ _yuitest_coverage["build/scrollview-paginator/scrollview-paginator.js"] = {
26 26 path: "build/scrollview-paginator/scrollview-paginator.js",
27 27 code: []
28 28 };
29   -_yuitest_coverage["build/scrollview-paginator/scrollview-paginator.js"].code=["YUI.add('scrollview-paginator', function (Y, NAME) {","","/**"," * Provides a plugin that adds pagination support to ScrollView instances"," *"," * @module scrollview-paginator"," */","var getClassName = Y.ClassNameManager.getClassName,"," SCROLLVIEW = 'scrollview',"," CLASS_HIDDEN = getClassName(SCROLLVIEW, 'hidden'),"," CLASS_PAGED = getClassName(SCROLLVIEW, 'paged'),"," UI = (Y.ScrollView) ? Y.ScrollView.UI_SRC : 'ui',"," INDEX = 'index',"," SCROLL_X = 'scrollX',"," SCROLL_Y = 'scrollY',"," TOTAL = 'total',"," HOST = 'host',"," BOUNDING_BOX = 'boundingBox',"," CONTENT_BOX = 'contentBox',"," SELECTOR = 'selector',"," FLICK = 'flick',"," DRAG = 'drag',"," AXIS = 'axis',"," DIM_X = 'x',"," DIM_Y = 'y';","","/**"," * Scrollview plugin that adds support for paging"," *"," * @class ScrollViewPaginator"," * @namespace Plugin"," * @extends Plugin.Base"," * @constructor"," */","function PaginatorPlugin() {"," PaginatorPlugin.superclass.constructor.apply(this, arguments);","}","","Y.extend(PaginatorPlugin, Y.Plugin.Base, {",""," /**"," * Designated initializer"," *"," * @method initializer"," * @param {config} Configuration object for the plugin"," */"," initializer: function (config) {"," var paginator = this,"," host = paginator.get(HOST);",""," // Initialize & default"," paginator._pageDims = [];"," paginator._pageBuffer = 1;"," paginator._optimizeMemory = false;",""," // Cache some values"," paginator._host = host;"," paginator._bb = host._bb;"," paginator._cb = host._cb;"," paginator._cIndex = paginator.get(INDEX);"," paginator._cAxis = paginator.get(AXIS);",""," // Apply configs"," if (config._optimizeMemory) {"," paginator._optimizeMemory = config._optimizeMemory;"," }",""," if (config._pageBuffer) {"," paginator._pageBuffer = config._pageBuffer;"," }",""," // Attach event bindings"," paginator._bindAttrs();"," },",""," /**"," * "," *"," * @method _bindAttrs"," * @private"," */"," _bindAttrs: function () {"," var paginator = this;",""," // Event listeners"," paginator.after({"," 'indexChange': paginator._afterIndexChange,"," 'axisChange': paginator._afterAxisChange"," });",""," // Host method listeners"," paginator.beforeHostMethod('scrollTo', paginator._beforeHostScrollTo);"," paginator.beforeHostMethod('_mousewheel', paginator._beforeHostMousewheel);"," paginator.beforeHostMethod('_flick', paginator._beforeHostFlick);"," paginator.afterHostMethod('_onGestureMoveEnd', paginator._afterHostGestureMoveEnd);"," paginator.afterHostMethod('_uiDimensionsChange', paginator._afterHostUIDimensionsChange);"," paginator.afterHostMethod('syncUI', paginator._afterHostSyncUI);"," "," // Host event listeners"," paginator.afterHostEvent('render', paginator._afterHostRender);"," paginator.afterHostEvent('scrollEnd', paginator._afterHostScrollEnded);"," },",""," /**"," * After host render"," *"," * @method _afterHostRender"," * @param {Event.Facade}"," * @protected"," */"," _afterHostRender: function (e) {"," var paginator = this,"," bb = paginator._bb,"," host = paginator._host,"," index = paginator._cIndex,"," paginatorAxis = paginator._cAxis,"," pageNodes = paginator._getPageNodes(),"," size = pageNodes.size(),"," maxScrollX = paginator._pageDims[index].maxScrollX,"," maxScrollY = paginator._pageDims[index].maxScrollY;",""," if (paginatorAxis[DIM_Y]) {"," host._maxScrollX = maxScrollX;"," }"," else if (paginatorAxis[DIM_X]) {"," host._maxScrollY = maxScrollY;"," }",""," // Set the page count"," paginator.set(TOTAL, size);",""," // Jump to the index"," if (index !== 0) {"," paginator.scrollToIndex(index, 0);"," }",""," // Add the paginator class"," bb.addClass(CLASS_PAGED);",""," // Trigger the optimization process"," paginator._optimize();"," },",""," /**"," * After host syncUI"," *"," * @method _afterHostSyncUI"," * @param {Event.Facade}"," * @protected"," */"," _afterHostSyncUI: function (e) {"," var paginator = this,"," host = paginator._host,"," hostFlick = host.get(FLICK),"," pageNodes = paginator._getPageNodes(),"," size = pageNodes.size(),"," paginatorAxis;",""," // Set the page count"," paginator.set(TOTAL, size);",""," // If paginator's 'axis' property is to be automatically determined, inherit host's property"," if (paginator._cAxis === undefined) {"," paginator._set(AXIS, host.get(AXIS));"," }"," },",""," /**"," * After host _uiDimensionsChange"," *"," * @method _afterHostUIDimensionsChange"," * @param {Event.Facade}"," * @protected"," */"," _afterHostUIDimensionsChange: function (e) {",""," var paginator = this,"," host = paginator._host,"," dims = host._getScrollDims(),"," widgetWidth = dims.offsetWidth,"," widgetHeight = dims.offsetHeight,"," pageNodes = paginator._getPageNodes();"," "," // Inefficient. Should not reinitialize every page every syncUI"," pageNodes.each(function (node, i) {"," var scrollWidth = node.get('scrollWidth'),"," scrollHeight = node.get('scrollHeight'),"," maxScrollX = Math.max(0, scrollWidth - widgetWidth), // Math.max to ensure we don't set it to a negative value"," maxScrollY = Math.max(0, scrollHeight - widgetHeight);",""," // Don't initialize any page _pageDims that already have been."," if (!paginator._pageDims[i]) {",""," paginator._pageDims[i] = {",""," // Current scrollX & scrollY positions (default to 0)"," scrollX: 0,"," scrollY: 0,",""," // Minimum scrollable values"," _minScrollX: 0,"," _minScrollY: 0,",""," // Maximum scrollable values"," maxScrollX: maxScrollX,"," maxScrollY: maxScrollY"," };",""," } else {"," paginator._pageDims[i].maxScrollX = maxScrollX;"," paginator._pageDims[i].maxScrollY = maxScrollY;"," }",""," });"," },",""," /**"," * Executed before host.scrollTo"," *"," * @method _beforeHostScrollTo"," * @param x {Number} The x-position to scroll to. (null for no movement)"," * @param y {Number} The y-position to scroll to. (null for no movement)"," * @param {Number} [duration] Duration, in ms, of the scroll animation (default is 0)"," * @param {String} [easing] An easing equation if duration is set"," * @param {String} [node] The node to move"," * @protected"," */"," _beforeHostScrollTo: function (x, y, duration, easing, node) {"," var paginator = this,"," host = paginator._host,"," gesture = host._gesture,"," index = paginator._cIndex,"," paginatorAxis = paginator._cAxis,"," pageNodes = this._getPageNodes(),"," gestureAxis;",""," if (gesture) {"," gestureAxis = gesture.axis;",""," // Null the opposite axis so it won't be modified by host.scrollTo"," if (gestureAxis === DIM_Y) {"," x = null;"," } else {"," y = null;"," }",""," // If they are scrolling against the specified axis, pull out the page's node to have its own offset"," if (paginatorAxis[gestureAxis] === false) {"," node = pageNodes.item(index);"," }",""," }",""," // Return the modified argument list"," return new Y.Do.AlterArgs(\"new args\", [x, y, duration, easing, node]);"," },",""," /**"," * Executed after host._gestureMoveEnd"," * Determines if the gesture should page prev or next (if at all)"," *"," * @method _afterHostGestureMoveEnd"," * @param {Event.Facade}"," * @protected"," */"," _afterHostGestureMoveEnd: function (e) {"," var paginator = this,"," host = paginator._host,"," gesture = host._gesture,"," paginatorAxis = paginator._cAxis,"," gestureAxis = gesture && gesture.axis;",""," if (paginatorAxis[gestureAxis]) {"," if (gesture[(gestureAxis === DIM_X ? 'deltaX' : 'deltaY')] > 0) {"," paginator[host.rtl ? 'prev' : 'next']();"," } else {"," paginator[host.rtl ? 'next' : 'prev']();"," }"," }"," },",""," /**"," * Executed before host._mousewheel"," * Prevents mousewheel events in some conditions"," *"," * @method _beforeHostMousewheel"," * @param {Event.Facade}"," * @protected"," */"," _beforeHostMousewheel: function (e) {"," var paginator = this,"," host = paginator._host,"," bb = host._bb,"," isForward = e.wheelDelta < 0, // down (negative) is forward. @TODO Should revisit."," paginatorAxis = paginator._cAxis;",""," // Set the axis for this event."," // @TODO: This is hacky, it's not a gesture. Find a better way"," host._gesture = {"," axis: DIM_Y"," };",""," // Only if the mousewheel event occurred on a DOM node inside the BB"," if (bb.contains(e.target) && paginatorAxis[DIM_Y]) {",""," if (isForward) {"," paginator.next();"," } else {"," paginator.prev();"," }",""," // prevent browser default behavior on mousewheel"," e.preventDefault();",""," // Block host._mousewheel from running"," return new Y.Do.Prevent();"," }"," },",""," /**"," * Executed before host._flick"," * Prevents flick events in some conditions"," *"," * @method _beforeHostFlick"," * @param {Event.Facade}"," * @protected"," */"," _beforeHostFlick: function (e) {"," var paginator = this,"," paginatorAxis = paginator.get(AXIS),"," flickAxis = e.flick.axis || false;",""," // Prevent flicks on the paginated axis"," if (paginatorAxis[flickAxis]) {"," return new Y.Do.Prevent();"," }"," },",""," /**"," * Executes after host's 'scrollEnd' event"," * Runs cleanup operations"," *"," * @method _afterHostScrollEnded"," * @param {Event.Facade}"," * @protected"," */"," _afterHostScrollEnded: function (e) {"," var paginator = this,"," host = paginator._host,"," index = paginator._cIndex,"," scrollX = host.get(SCROLL_X),"," scrollY = host.get(SCROLL_Y),"," paginatorAxis = paginator._cAxis;",""," if (paginatorAxis[DIM_Y]) {"," paginator._pageDims[index].scrollX = scrollX;"," } else {"," paginator._pageDims[index].scrollY = scrollY;"," }",""," paginator._optimize();"," },",""," /**"," * index attr change handler"," *"," * @method _afterIndexChange"," * @param {Event.Facade}"," * @protected"," */"," _afterIndexChange: function (e) {"," var paginator = this,"," host = paginator._host,"," index = e.newVal,"," pageDims = paginator._pageDims[index],"," hostAxis = host._cAxis,"," paginatorAxis = paginator._cAxis;",""," // Cache the new index value"," paginator._cIndex = index;",""," // For dual-axis instances, we need to hack some host properties to the"," // current page's max height/width and current stored offset"," if (hostAxis[DIM_X] && hostAxis[DIM_Y]) {"," if (paginatorAxis[DIM_Y]) {"," host._maxScrollX = pageDims.maxScrollX;"," host.set(SCROLL_X, pageDims.scrollX, { src: UI });"," }"," else if (paginatorAxis[DIM_X]) {"," host._maxScrollY = pageDims.maxScrollY;"," host.set(SCROLL_Y, pageDims.scrollY, { src: UI });"," }"," }",""," if (e.src !== UI) {"," paginator.scrollToIndex(index);"," }"," },",""," /**"," * Optimization: Hides the pages not near the viewport"," *"," * @method _optimize"," * @protected"," */"," _optimize: function () {",""," if (!this._optimizeMemory) {"," return false;"," }",""," var paginator = this,"," currentIndex = paginator._cIndex,"," pageNodes = paginator._getStage(currentIndex);",""," // Show the pages in/near the viewport & hide the rest"," paginator._showNodes(pageNodes.visible);"," paginator._hideNodes(pageNodes.hidden);"," },",""," /**"," * Optimization: Determines which nodes should be visible, and which should be hidden."," *"," * @method _getStage"," * @param index {Number} The page index # intended to be in focus."," * @returns {object}"," * @protected"," */"," _getStage: function (index) {"," var _pageBuffer = this._pageBuffer,"," pageCount = this.get(TOTAL),"," pageNodes = this._getPageNodes(),"," start = Math.max(0, index - _pageBuffer),"," end = Math.min(pageCount, index + 1 + _pageBuffer); // noninclusive",""," return {"," visible: pageNodes.splice(start, end - start),"," hidden: pageNodes"," };"," },",""," /**"," * A utility method to show node(s)"," *"," * @method _showNodes"," * @param nodeList {Object} The list of nodes to show"," * @protected"," */"," _showNodes: function (nodeList) {"," if (nodeList) {"," nodeList.removeClass(CLASS_HIDDEN).setStyle('visibility', '');"," }"," },",""," /**"," * A utility method to hide node(s)"," *"," * @method _hideNodes"," * @param nodeList {Object} The list of nodes to hide"," * @protected"," */"," _hideNodes: function (nodeList) {"," if (nodeList) {"," nodeList.addClass(CLASS_HIDDEN).setStyle('visibility', 'hidden');"," }"," },",""," /**"," * Gets a nodeList for the \"pages\""," *"," * @method _getPageNodes"," * @protected"," * @returns {nodeList}"," */"," _getPageNodes: function () {"," var paginator = this,"," host = paginator._host,"," cb = host._cb,"," pageSelector = paginator.get(SELECTOR),"," pageNodes = pageSelector ? cb.all(pageSelector) : cb.get('children');",""," return pageNodes;"," },",""," /**"," * Scroll to the next page, with animation"," *"," * @method next"," */"," next: function () {"," var paginator = this,"," index = paginator._cIndex,"," target = index + 1,"," total = this.get(TOTAL);",""," if (target >= total) {"," return;"," }",""," // Update the index"," paginator.set(INDEX, target);"," },",""," /**"," * Scroll to the previous page, with animation"," *"," * @method prev"," */"," prev: function () {"," var paginator = this,"," index = paginator._cIndex,"," target = index - 1;",""," if (target < 0) {"," return;"," }",""," // Update the index"," paginator.set(INDEX, target);"," },"," "," /** "," * Deprecated for 3.7.0."," * @deprecated"," */"," scrollTo: function () {"," return this.scrollToIndex.apply(this, arguments);"," },",""," /**"," * Scroll to a given page in the scrollview"," *"," * @method scrollToIndex"," * @param index {Number} The index of the page to scroll to"," * @param {Number} [duration] The number of ms the animation should last"," * @param {String} [easing] The timing function to use in the animation"," */"," scrollToIndex: function (index, duration, easing) {"," var paginator = this,"," host = paginator._host,"," pageNode = paginator._getPageNodes().item(index),"," scrollAxis = (paginator._cAxis[DIM_X] ? SCROLL_X : SCROLL_Y),"," scrollOffset = pageNode.get(scrollAxis === SCROLL_X ? 'offsetLeft' : 'offsetTop');",""," duration = (duration !== undefined) ? duration : PaginatorPlugin.TRANSITION.duration;"," easing = (easing !== undefined) ? duration : PaginatorPlugin.TRANSITION.easing;",""," // Set the index ATTR to the specified index value"," paginator.set(INDEX, index);",""," // Makes sure the viewport nodes are visible"," paginator._showNodes(pageNode);",""," // Scroll to the offset"," host.set(scrollAxis, scrollOffset, {"," duration: duration,"," easing: easing"," });"," },",""," /**"," * Setter for 'axis' attribute"," *"," * @method _axisSetter"," * @param val {Mixed} A string ('x', 'y', 'xy') to specify which axis/axes to allow scrolling on"," * @param name {String} The attribute name"," * @return {Object} An object to specify scrollability on the x & y axes"," * "," * @protected"," */"," _axisSetter: function (val, name) {",""," // Turn a string into an axis object"," if (Y.Lang.isString(val)) {"," return {"," x: val.match(/x/i) ? true : false,"," y: val.match(/y/i) ? true : false"," };"," }"," },"," ",""," /**"," * After listener for the axis attribute"," *"," * @method _afterAxisChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterAxisChange: function (e) {"," this._cAxis = e.newVal;"," }",""," // End prototype properties","","}, {"," "," // Static properties",""," /**"," * The identity of the plugin"," *"," * @property NAME"," * @type String"," * @default 'pluginScrollViewPaginator'"," * @readOnly"," * @protected"," * @static"," */"," NAME: 'pluginScrollViewPaginator',",""," /**"," * The namespace on which the plugin will reside"," *"," * @property NS"," * @type String"," * @default 'pages'"," * @static"," */"," NS: 'pages',",""," /**"," * The default attribute configuration for the plugin"," *"," * @property ATTRS"," * @type {Object}"," * @static"," */"," ATTRS: {",""," /**"," * Specifies ability to scroll on x, y, or x and y axis/axes. "," * If unspecified, it inherits from the host instance."," *"," * @attribute axis"," * @type String"," */"," axis: {"," setter: '_axisSetter',"," writeOnce: 'initOnly'"," },",""," /**"," * CSS selector for a page inside the scrollview. The scrollview"," * will snap to the closest page."," *"," * @attribute selector"," * @type {String}"," * @default null"," */"," selector: {"," value: null"," },",""," /**"," * The active page number for a paged scrollview"," *"," * @attribute index"," * @type {Number}"," * @default 0"," */"," index: {"," value: 0,"," validator: function (val) {"," // TODO: Remove this?"," // return val >= 0 && val < this.get(TOTAL);"," return true;"," }"," },",""," /**"," * The total number of pages"," *"," * @attribute total"," * @type {Number}"," * @default 0"," */"," total: {"," value: 0"," }"," },"," "," /**"," * The default snap to current duration and easing values used on scroll end."," *"," * @property SNAP_TO_CURRENT"," * @static"," */"," TRANSITION: {"," duration: 300,"," easing: 'ease-out'"," }",""," // End static properties","","});","","Y.namespace('Plugin').ScrollViewPaginator = PaginatorPlugin;","","}, '@VERSION@', {\"requires\": [\"plugin\", \"classnamemanager\"]});"];
  29 +_yuitest_coverage["build/scrollview-paginator/scrollview-paginator.js"].code=["YUI.add('scrollview-paginator', function (Y, NAME) {","","/**"," * Provides a plugin that adds pagination support to ScrollView instances"," *"," * @module scrollview-paginator"," */","var getClassName = Y.ClassNameManager.getClassName,"," SCROLLVIEW = 'scrollview',"," CLASS_HIDDEN = getClassName(SCROLLVIEW, 'hidden'),"," CLASS_PAGED = getClassName(SCROLLVIEW, 'paged'),"," UI = (Y.ScrollView) ? Y.ScrollView.UI_SRC : 'ui',"," INDEX = 'index',"," SCROLL_X = 'scrollX',"," SCROLL_Y = 'scrollY',"," TOTAL = 'total',"," HOST = 'host',"," BOUNDING_BOX = 'boundingBox',"," CONTENT_BOX = 'contentBox',"," SELECTOR = 'selector',"," FLICK = 'flick',"," DRAG = 'drag',"," AXIS = 'axis',"," DIM_X = 'x',"," DIM_Y = 'y';","","/**"," * Scrollview plugin that adds support for paging"," *"," * @class ScrollViewPaginator"," * @namespace Plugin"," * @extends Plugin.Base"," * @constructor"," */","function PaginatorPlugin() {"," PaginatorPlugin.superclass.constructor.apply(this, arguments);","}","","Y.extend(PaginatorPlugin, Y.Plugin.Base, {",""," /**"," * Designated initializer"," *"," * @method initializer"," * @param {config} Configuration object for the plugin"," */"," initializer: function (config) {"," var paginator = this,"," host = paginator.get(HOST);",""," // Initialize & default"," paginator._pageDims = [];"," paginator._pageBuffer = 1;"," paginator._optimizeMemory = false;",""," // Cache some values"," paginator._host = host;"," paginator._bb = host._bb;"," paginator._cb = host._cb;"," paginator._cIndex = paginator.get(INDEX);"," paginator._cAxis = paginator.get(AXIS);",""," // Apply configs"," if (config._optimizeMemory) {"," paginator._optimizeMemory = config._optimizeMemory;"," }",""," if (config._pageBuffer) {"," paginator._pageBuffer = config._pageBuffer;"," }",""," // Attach event bindings"," paginator._bindAttrs();"," },",""," /**"," * "," *"," * @method _bindAttrs"," * @private"," */"," _bindAttrs: function () {"," var paginator = this;",""," // Event listeners"," paginator.after({"," 'indexChange': paginator._afterIndexChange,"," 'axisChange': paginator._afterAxisChange"," });",""," // Host method listeners"," paginator.beforeHostMethod('scrollTo', paginator._beforeHostScrollTo);"," paginator.beforeHostMethod('_mousewheel', paginator._beforeHostMousewheel);"," paginator.beforeHostMethod('_flick', paginator._beforeHostFlick);"," paginator.afterHostMethod('_onGestureMoveEnd', paginator._afterHostGestureMoveEnd);"," paginator.afterHostMethod('_uiDimensionsChange', paginator._afterHostUIDimensionsChange);"," paginator.afterHostMethod('syncUI', paginator._afterHostSyncUI);"," "," // Host event listeners"," paginator.afterHostEvent('render', paginator._afterHostRender);"," paginator.afterHostEvent('scrollEnd', paginator._afterHostScrollEnded);"," },",""," /**"," * After host render"," *"," * @method _afterHostRender"," * @param {Event.Facade}"," * @protected"," */"," _afterHostRender: function (e) {"," var paginator = this,"," bb = paginator._bb,"," host = paginator._host,"," index = paginator._cIndex,"," paginatorAxis = paginator._cAxis,"," pageNodes = paginator._getPageNodes(),"," size = pageNodes.size(),"," maxScrollX = paginator._pageDims[index].maxScrollX,"," maxScrollY = paginator._pageDims[index].maxScrollY;",""," if (paginatorAxis[DIM_Y]) {"," host._maxScrollX = maxScrollX;"," }"," else if (paginatorAxis[DIM_X]) {"," host._maxScrollY = maxScrollY;"," }",""," // Set the page count"," paginator.set(TOTAL, size);",""," // Jump to the index"," if (index !== 0) {"," paginator.scrollToIndex(index, 0);"," }",""," // Add the paginator class"," bb.addClass(CLASS_PAGED);",""," // Trigger the optimization process"," paginator._optimize();"," },",""," /**"," * After host syncUI"," *"," * @method _afterHostSyncUI"," * @param {Event.Facade}"," * @protected"," */"," _afterHostSyncUI: function (e) {"," var paginator = this,"," host = paginator._host,"," hostFlick = host.get(FLICK),"," pageNodes = paginator._getPageNodes(),"," size = pageNodes.size(),"," paginatorAxis;",""," // Set the page count"," paginator.set(TOTAL, size);",""," // If paginator's 'axis' property is to be automatically determined, inherit host's property"," if (paginator._cAxis === undefined) {"," paginator._set(AXIS, host.get(AXIS));"," }"," },",""," /**"," * After host _uiDimensionsChange"," *"," * @method _afterHostUIDimensionsChange"," * @param {Event.Facade}"," * @protected"," */"," _afterHostUIDimensionsChange: function (e) {",""," var paginator = this,"," host = paginator._host,"," dims = host._getScrollDims(),"," widgetWidth = dims.offsetWidth,"," widgetHeight = dims.offsetHeight,"," pageNodes = paginator._getPageNodes();"," "," // Inefficient. Should not reinitialize every page every syncUI"," pageNodes.each(function (node, i) {"," var scrollWidth = node.get('scrollWidth'),"," scrollHeight = node.get('scrollHeight'),"," maxScrollX = Math.max(0, scrollWidth - widgetWidth), // Math.max to ensure we don't set it to a negative value"," maxScrollY = Math.max(0, scrollHeight - widgetHeight);",""," // Don't initialize any page _pageDims that already have been."," if (!paginator._pageDims[i]) {",""," paginator._pageDims[i] = {",""," // Current scrollX & scrollY positions (default to 0)"," scrollX: 0,"," scrollY: 0,",""," // Minimum scrollable values"," _minScrollX: 0,"," _minScrollY: 0,",""," // Maximum scrollable values"," maxScrollX: maxScrollX,"," maxScrollY: maxScrollY"," };",""," } else {"," paginator._pageDims[i].maxScrollX = maxScrollX;"," paginator._pageDims[i].maxScrollY = maxScrollY;"," }",""," });"," },",""," /**"," * Executed before host.scrollTo"," *"," * @method _beforeHostScrollTo"," * @param x {Number} The x-position to scroll to. (null for no movement)"," * @param y {Number} The y-position to scroll to. (null for no movement)"," * @param {Number} [duration] Duration, in ms, of the scroll animation (default is 0)"," * @param {String} [easing] An easing equation if duration is set"," * @param {String} [node] The node to move"," * @protected"," */"," _beforeHostScrollTo: function (x, y, duration, easing, node) {"," var paginator = this,"," host = paginator._host,"," gesture = host._gesture,"," index = paginator._cIndex,"," paginatorAxis = paginator._cAxis,"," pageNodes = this._getPageNodes(),"," gestureAxis;",""," if (gesture) {"," gestureAxis = gesture.axis;",""," // Null the opposite axis so it won't be modified by host.scrollTo"," if (gestureAxis === DIM_Y) {"," x = null;"," } else {"," y = null;"," }",""," // If they are scrolling against the specified axis, pull out the page's node to have its own offset"," if (paginatorAxis[gestureAxis] === false) {"," node = pageNodes.item(index);"," }",""," }",""," // Return the modified argument list"," return new Y.Do.AlterArgs(\"new args\", [x, y, duration, easing, node]);"," },",""," /**"," * Executed after host._gestureMoveEnd"," * Determines if the gesture should page prev or next (if at all)"," *"," * @method _afterHostGestureMoveEnd"," * @param {Event.Facade}"," * @protected"," */"," _afterHostGestureMoveEnd: function (e) {"," var paginator = this,"," host = paginator._host,"," gesture = host._gesture,"," paginatorAxis = paginator._cAxis,"," gestureAxis = gesture && gesture.axis;",""," if (paginatorAxis[gestureAxis]) {"," if (gesture[(gestureAxis === DIM_X ? 'deltaX' : 'deltaY')] > 0) {"," paginator[host.rtl ? 'prev' : 'next']();"," } else {"," paginator[host.rtl ? 'next' : 'prev']();"," }"," }"," },",""," /**"," * Executed before host._mousewheel"," * Prevents mousewheel events in some conditions"," *"," * @method _beforeHostMousewheel"," * @param {Event.Facade}"," * @protected"," */"," _beforeHostMousewheel: function (e) {"," var paginator = this,"," host = paginator._host,"," bb = host._bb,"," isForward = e.wheelDelta < 0, // down (negative) is forward. @TODO Should revisit."," paginatorAxis = paginator._cAxis;",""," // Set the axis for this event."," // @TODO: This is hacky, it's not a gesture. Find a better way"," host._gesture = {"," axis: DIM_Y"," };",""," // Only if the mousewheel event occurred on a DOM node inside the BB"," if (bb.contains(e.target) && paginatorAxis[DIM_Y]) {",""," if (isForward) {"," paginator.next();"," } else {"," paginator.prev();"," }",""," // prevent browser default behavior on mousewheel"," e.preventDefault();",""," // Block host._mousewheel from running"," return new Y.Do.Prevent();"," }"," },",""," /**"," * Executed before host._flick"," * Prevents flick events in some conditions"," *"," * @method _beforeHostFlick"," * @param {Event.Facade}"," * @protected"," */"," _beforeHostFlick: function (e) {"," var paginator = this,"," paginatorAxis = paginator.get(AXIS),"," flickAxis = e.flick.axis || false;",""," // Prevent flicks on the paginated axis"," if (paginatorAxis[flickAxis]) {"," return new Y.Do.Prevent();"," }"," },",""," /**"," * Executes after host's 'scrollEnd' event"," * Runs cleanup operations"," *"," * @method _afterHostScrollEnded"," * @param {Event.Facade}"," * @protected"," */"," _afterHostScrollEnded: function (e) {"," var paginator = this,"," host = paginator._host,"," index = paginator._cIndex,"," scrollX = host.get(SCROLL_X),"," scrollY = host.get(SCROLL_Y),"," paginatorAxis = paginator._cAxis;",""," if (paginatorAxis[DIM_Y]) {"," paginator._pageDims[index].scrollX = scrollX;"," } else {"," paginator._pageDims[index].scrollY = scrollY;"," }",""," paginator._optimize();"," },",""," /**"," * index attr change handler"," *"," * @method _afterIndexChange"," * @param {Event.Facade}"," * @protected"," */"," _afterIndexChange: function (e) {"," var paginator = this,"," host = paginator._host,"," index = e.newVal,"," pageDims = paginator._pageDims[index],"," hostAxis = host._cAxis,"," paginatorAxis = paginator._cAxis;",""," // Cache the new index value"," paginator._cIndex = index;",""," // For dual-axis instances, we need to hack some host properties to the"," // current page's max height/width and current stored offset"," if (hostAxis[DIM_X] && hostAxis[DIM_Y]) {"," if (paginatorAxis[DIM_Y]) {"," host._maxScrollX = pageDims.maxScrollX;"," host.set(SCROLL_X, pageDims.scrollX, { src: UI });"," }"," else if (paginatorAxis[DIM_X]) {"," host._maxScrollY = pageDims.maxScrollY;"," host.set(SCROLL_Y, pageDims.scrollY, { src: UI });"," }"," }",""," if (e.src !== UI) {"," paginator.scrollToIndex(index);"," }"," },",""," /**"," * Optimization: Hides the pages not near the viewport"," *"," * @method _optimize"," * @protected"," */"," _optimize: function () {",""," if (!this._optimizeMemory) {"," return false;"," }",""," var paginator = this,"," currentIndex = paginator._cIndex,"," pageNodes = paginator._getStage(currentIndex);",""," // Show the pages in/near the viewport & hide the rest"," paginator._showNodes(pageNodes.visible);"," paginator._hideNodes(pageNodes.hidden);"," },",""," /**"," * Optimization: Determines which nodes should be visible, and which should be hidden."," *"," * @method _getStage"," * @param index {Number} The page index # intended to be in focus."," * @returns {object}"," * @protected"," */"," _getStage: function (index) {"," var _pageBuffer = this._pageBuffer,"," pageCount = this.get(TOTAL),"," pageNodes = this._getPageNodes(),"," start = Math.max(0, index - _pageBuffer),"," end = Math.min(pageCount, index + 1 + _pageBuffer); // noninclusive",""," return {"," visible: pageNodes.splice(start, end - start),"," hidden: pageNodes"," };"," },",""," /**"," * A utility method to show node(s)"," *"," * @method _showNodes"," * @param nodeList {Object} The list of nodes to show"," * @protected"," */"," _showNodes: function (nodeList) {"," if (nodeList) {"," nodeList.removeClass(CLASS_HIDDEN).setStyle('visibility', '');"," }"," },",""," /**"," * A utility method to hide node(s)"," *"," * @method _hideNodes"," * @param nodeList {Object} The list of nodes to hide"," * @protected"," */"," _hideNodes: function (nodeList) {"," if (nodeList) {"," nodeList.addClass(CLASS_HIDDEN).setStyle('visibility', 'hidden');"," }"," },",""," /**"," * Gets a nodeList for the \"pages\""," *"," * @method _getPageNodes"," * @protected"," * @returns {nodeList}"," */"," _getPageNodes: function () {"," var paginator = this,"," host = paginator._host,"," cb = host._cb,"," pageSelector = paginator.get(SELECTOR),"," pageNodes = pageSelector ? cb.all(pageSelector) : cb.get('children');",""," return pageNodes;"," },",""," /**"," * Scroll to the next page, with animation"," *"," * @method next"," */"," next: function () {"," var paginator = this,"," index = paginator._cIndex,"," target = index + 1,"," total = this.get(TOTAL);",""," if (target >= total) {"," return;"," }",""," // Update the index"," paginator.set(INDEX, target);"," },",""," /**"," * Scroll to the previous page, with animation"," *"," * @method prev"," */"," prev: function () {"," var paginator = this,"," index = paginator._cIndex,"," target = index - 1;",""," if (target < 0) {"," return;"," }",""," // Update the index"," paginator.set(INDEX, target);"," },"," "," /** "," * Deprecated for 3.7.0."," * @deprecated"," */"," scrollTo: function () {"," return this.scrollToIndex.apply(this, arguments);"," },",""," /**"," * Scroll to a given page in the scrollview"," *"," * @method scrollToIndex"," * @param index {Number} The index of the page to scroll to"," * @param {Number} [duration] The number of ms the animation should last"," * @param {String} [easing] The timing function to use in the animation"," */"," scrollToIndex: function (index, duration, easing) {"," var paginator = this,"," host = paginator._host,"," pageNode = paginator._getPageNodes().item(index),"," scrollAxis = (paginator._cAxis[DIM_X] ? SCROLL_X : SCROLL_Y),"," scrollOffset = pageNode.get(scrollAxis === SCROLL_X ? 'offsetLeft' : 'offsetTop');",""," duration = (duration !== undefined) ? duration : PaginatorPlugin.TRANSITION.duration;"," easing = (easing !== undefined) ? easing : PaginatorPlugin.TRANSITION.easing;",""," // Set the index ATTR to the specified index value"," paginator.set(INDEX, index);",""," // Makes sure the viewport nodes are visible"," paginator._showNodes(pageNode);",""," // Scroll to the offset"," host.set(scrollAxis, scrollOffset, {"," duration: duration,"," easing: easing"," });"," },",""," /**"," * Setter for 'axis' attribute"," *"," * @method _axisSetter"," * @param val {Mixed} A string ('x', 'y', 'xy') to specify which axis/axes to allow scrolling on"," * @param name {String} The attribute name"," * @return {Object} An object to specify scrollability on the x & y axes"," * "," * @protected"," */"," _axisSetter: function (val, name) {",""," // Turn a string into an axis object"," if (Y.Lang.isString(val)) {"," return {"," x: val.match(/x/i) ? true : false,"," y: val.match(/y/i) ? true : false"," };"," }"," },"," ",""," /**"," * After listener for the axis attribute"," *"," * @method _afterAxisChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterAxisChange: function (e) {"," this._cAxis = e.newVal;"," }",""," // End prototype properties","","}, {"," "," // Static properties",""," /**"," * The identity of the plugin"," *"," * @property NAME"," * @type String"," * @default 'pluginScrollViewPaginator'"," * @readOnly"," * @protected"," * @static"," */"," NAME: 'pluginScrollViewPaginator',",""," /**"," * The namespace on which the plugin will reside"," *"," * @property NS"," * @type String"," * @default 'pages'"," * @static"," */"," NS: 'pages',",""," /**"," * The default attribute configuration for the plugin"," *"," * @property ATTRS"," * @type {Object}"," * @static"," */"," ATTRS: {",""," /**"," * Specifies ability to scroll on x, y, or x and y axis/axes. "," * If unspecified, it inherits from the host instance."," *"," * @attribute axis"," * @type String"," */"," axis: {"," setter: '_axisSetter',"," writeOnce: 'initOnly'"," },",""," /**"," * CSS selector for a page inside the scrollview. The scrollview"," * will snap to the closest page."," *"," * @attribute selector"," * @type {String}"," * @default null"," */"," selector: {"," value: null"," },",""," /**"," * The active page number for a paged scrollview"," *"," * @attribute index"," * @type {Number}"," * @default 0"," */"," index: {"," value: 0,"," validator: function (val) {"," // TODO: Remove this?"," // return val >= 0 && val < this.get(TOTAL);"," return true;"," }"," },",""," /**"," * The total number of pages"," *"," * @attribute total"," * @type {Number}"," * @default 0"," */"," total: {"," value: 0"," }"," },"," "," /**"," * The default snap to current duration and easing values used on scroll end."," *"," * @property SNAP_TO_CURRENT"," * @static"," */"," TRANSITION: {"," duration: 300,"," easing: 'ease-out'"," }",""," // End static properties","","});","","Y.namespace('Plugin').ScrollViewPaginator = PaginatorPlugin;","","}, '@VERSION@', {\"requires\": [\"plugin\", \"classnamemanager\"]});"];
30 30 _yuitest_coverage["build/scrollview-paginator/scrollview-paginator.js"].lines = {"1":0,"8":0,"35":0,"36":0,"39":0,"48":0,"52":0,"53":0,"54":0,"57":0,"58":0,"59":0,"60":0,"61":0,"64":0,"65":0,"68":0,"69":0,"73":0,"83":0,"86":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"100":0,"101":0,"112":0,"122":0,"123":0,"125":0,"126":0,"130":0,"133":0,"134":0,"138":0,"141":0,"152":0,"160":0,"163":0,"164":0,"177":0,"185":0,"186":0,"192":0,"194":0,"210":0,"211":0,"229":0,"237":0,"238":0,"241":0,"242":0,"244":0,"248":0,"249":0,"255":0,"267":0,"273":0,"274":0,"275":0,"277":0,"291":0,"299":0,"304":0,"306":0,"307":0,"309":0,"313":0,"316":0,"329":0,"334":0,"335":0,"348":0,"355":0,"356":0,"358":0,"361":0,"372":0,"380":0,"384":0,"385":0,"386":0,"387":0,"389":0,"390":0,"391":0,"395":0,"396":0,"408":0,"409":0,"412":0,"417":0,"418":0,"430":0,"436":0,"450":0,"451":0,"463":0,"464":0,"476":0,"482":0,"491":0,"496":0,"497":0,"501":0,"510":0,"514":0,"515":0,"519":0,"527":0,"539":0,"545":0,"546":0,"549":0,"552":0,"555":0,"574":0,"575":0,"591":0,"667":0,"698":0};
31 31 _yuitest_coverage["build/scrollview-paginator/scrollview-paginator.js"].functions = {"PaginatorPlugin:35":0,"initializer:47":0,"_bindAttrs:82":0,"_afterHostRender:111":0,"_afterHostSyncUI:151":0,"(anonymous 2):185":0,"_afterHostUIDimensionsChange:175":0,"_beforeHostScrollTo:228":0,"_afterHostGestureMoveEnd:266":0,"_beforeHostMousewheel:290":0,"_beforeHostFlick:328":0,"_afterHostScrollEnded:347":0,"_afterIndexChange:371":0,"_optimize:406":0,"_getStage:429":0,"_showNodes:449":0,"_hideNodes:462":0,"_getPageNodes:475":0,"next:490":0,"prev:509":0,"scrollTo:526":0,"scrollToIndex:538":0,"_axisSetter:571":0,"_afterAxisChange:590":0,"validator:664":0,"(anonymous 1):1":0};
32 32 _yuitest_coverage["build/scrollview-paginator/scrollview-paginator.js"].coveredLines = 124;
@@ -715,7 +715,7 @@ var paginator = this,
715 715 _yuitest_coverline("build/scrollview-paginator/scrollview-paginator.js", 545);
716 716 duration = (duration !== undefined) ? duration : PaginatorPlugin.TRANSITION.duration;
717 717 _yuitest_coverline("build/scrollview-paginator/scrollview-paginator.js", 546);
718   -easing = (easing !== undefined) ? duration : PaginatorPlugin.TRANSITION.easing;
  718 +easing = (easing !== undefined) ? easing : PaginatorPlugin.TRANSITION.easing;
719 719
720 720 // Set the index ATTR to the specified index value
721 721 _yuitest_coverline("build/scrollview-paginator/scrollview-paginator.js", 549);
2  build/scrollview-paginator/scrollview-paginator-debug.js
@@ -543,7 +543,7 @@ Y.extend(PaginatorPlugin, Y.Plugin.Base, {
543 543 scrollOffset = pageNode.get(scrollAxis === SCROLL_X ? 'offsetLeft' : 'offsetTop');
544 544
545 545 duration = (duration !== undefined) ? duration : PaginatorPlugin.TRANSITION.duration;
546   - easing = (easing !== undefined) ? duration : PaginatorPlugin.TRANSITION.easing;
  546 + easing = (easing !== undefined) ? easing : PaginatorPlugin.TRANSITION.easing;
547 547
548 548 // Set the index ATTR to the specified index value
549 549 paginator.set(INDEX, index);
2  build/scrollview-paginator/scrollview-paginator-min.js
... ... @@ -1 +1 @@
1   -YUI.add("scrollview-paginator",function(e,t){function w(){w.superclass.constructor.apply(this,arguments)}var n=e.ClassNameManager.getClassName,r="scrollview",i=n(r,"hidden"),s=n(r,"paged"),o=e.ScrollView?e.ScrollView.UI_SRC:"ui",u="index",a="scrollX",f="scrollY",l="total",c="host",h="boundingBox",p="contentBox",d="selector",v="flick",m="drag",g="axis",y="x",b="y";e.extend(w,e.Plugin.Base,{initializer:function(e){var t=this,n=t.get(c);t._pageDims=[],t._pageBuffer=1,t._optimizeMemory=!1,t._host=n,t._bb=n._bb,t._cb=n._cb,t._cIndex=t.get(u),t._cAxis=t.get(g),e._optimizeMemory&&(t._optimizeMemory=e._optimizeMemory),e._pageBuffer&&(t._pageBuffer=e._pageBuffer),t._bindAttrs()},_bindAttrs:function(){var e=this;e.after({indexChange:e._afterIndexChange,axisChange:e._afterAxisChange}),e.beforeHostMethod("scrollTo",e._beforeHostScrollTo),e.beforeHostMethod("_mousewheel",e._beforeHostMousewheel),e.beforeHostMethod("_flick",e._beforeHostFlick),e.afterHostMethod("_onGestureMoveEnd",e._afterHostGestureMoveEnd),e.afterHostMethod("_uiDimensionsChange",e._afterHostUIDimensionsChange),e.afterHostMethod("syncUI",e._afterHostSyncUI),e.afterHostEvent("render",e._afterHostRender),e.afterHostEvent("scrollEnd",e._afterHostScrollEnded)},_afterHostRender:function(e){var t=this,n=t._bb,r=t._host,i=t._cIndex,o=t._cAxis,u=t._getPageNodes(),a=u.size(),f=t._pageDims[i].maxScrollX,c=t._pageDims[i].maxScrollY;o[b]?r._maxScrollX=f:o[y]&&(r._maxScrollY=c),t.set(l,a),i!==0&&t.scrollToIndex(i,0),n.addClass(s),t._optimize()},_afterHostSyncUI:function(e){var t=this,n=t._host,r=n.get(v),i=t._getPageNodes(),s=i.size(),o;t.set(l,s),t._cAxis===undefined&&t._set(g,n.get(g))},_afterHostUIDimensionsChange:function(e){var t=this,n=t._host,r=n._getScrollDims(),i=r.offsetWidth,s=r.offsetHeight,o=t._getPageNodes();o.each(function(e,n){var r=e.get("scrollWidth"),o=e.get("scrollHeight"),u=Math.max(0,r-i),a=Math.max(0,o-s);t._pageDims[n]?(t._pageDims[n].maxScrollX=u,t._pageDims[n].maxScrollY=a):t._pageDims[n]={scrollX:0,scrollY:0,_minScrollX:0,_minScrollY:0,maxScrollX:u,maxScrollY:a}})},_beforeHostScrollTo:function(t,n,r,i,s){var o=this,u=o._host,a=u._gesture,f=o._cIndex,l=o._cAxis,c=this._getPageNodes(),h;return a&&(h=a.axis,h===b?t=null:n=null,l[h]===!1&&(s=c.item(f))),new e.Do.AlterArgs("new args",[t,n,r,i,s])},_afterHostGestureMoveEnd:function(e){var t=this,n=t._host,r=n._gesture,i=t._cAxis,s=r&&r.axis;i[s]&&(r[s===y?"deltaX":"deltaY"]>0?t[n.rtl?"prev":"next"]():t[n.rtl?"next":"prev"]())},_beforeHostMousewheel:function(t){var n=this,r=n._host,i=r._bb,s=t.wheelDelta<0,o=n._cAxis;r._gesture={axis:b};if(i.contains(t.target)&&o[b])return s?n.next():n.prev(),t.preventDefault(),new e.Do.Prevent},_beforeHostFlick:function(t){var n=this,r=n.get(g),i=t.flick.axis||!1;if(r[i])return new e.Do.Prevent},_afterHostScrollEnded:function(e){var t=this,n=t._host,r=t._cIndex,i=n.get(a),s=n.get(f),o=t._cAxis;o[b]?t._pageDims[r].scrollX=i:t._pageDims[r].scrollY=s,t._optimize()},_afterIndexChange:function(e){var t=this,n=t._host,r=e.newVal,i=t._pageDims[r],s=n._cAxis,u=t._cAxis;t._cIndex=r,s[y]&&s[b]&&(u[b]?(n._maxScrollX=i.maxScrollX,n.set(a,i.scrollX,{src:o})):u[y]&&(n._maxScrollY=i.maxScrollY,n.set(f,i.scrollY,{src:o}))),e.src!==o&&t.scrollToIndex(r)},_optimize:function(){if(!this._optimizeMemory)return!1;var e=this,t=e._cIndex,n=e._getStage(t);e._showNodes(n.visible),e._hideNodes(n.hidden)},_getStage:function(e){var t=this._pageBuffer,n=this.get(l),r=this._getPageNodes(),i=Math.max(0,e-t),s=Math.min(n,e+1+t);return{visible:r.splice(i,s-i),hidden:r}},_showNodes:function(e){e&&e.removeClass(i).setStyle("visibility","")},_hideNodes:function(e){e&&e.addClass(i).setStyle("visibility","hidden")},_getPageNodes:function(){var e=this,t=e._host,n=t._cb,r=e.get(d),i=r?n.all(r):n.get("children");return i},next:function(){var e=this,t=e._cIndex,n=t+1,r=this.get(l);if(n>=r)return;e.set(u,n)},prev:function(){var e=this,t=e._cIndex,n=t-1;if(n<0)return;e.set(u,n)},scrollTo:function(){return this.scrollToIndex.apply(this,arguments)},scrollToIndex:function(e,t,n){var r=this,i=r._host,s=r._getPageNodes().item(e),o=r._cAxis[y]?a:f,l=s.get(o===a?"offsetLeft":"offsetTop");t=t!==undefined?t:w.TRANSITION.duration,n=n!==undefined?t:w.TRANSITION.easing,r.set(u,e),r._showNodes(s),i.set(o,l,{duration:t,easing:n})},_axisSetter:function(t,n){if(e.Lang.isString(t))return{x:t.match(/x/i)?!0:!1,y:t.match(/y/i)?!0:!1}},_afterAxisChange:function(e){this._cAxis=e.newVal}},{NAME:"pluginScrollViewPaginator",NS:"pages",ATTRS:{axis:{setter:"_axisSetter",writeOnce:"initOnly"},selector:{value:null},index:{value:0,validator:function(e){return!0}},total:{value:0}},TRANSITION:{duration:300,easing:"ease-out"}}),e.namespace("Plugin").ScrollViewPaginator=w},"@VERSION@",{requires:["plugin","classnamemanager"]});
  1 +YUI.add("scrollview-paginator",function(e,t){function w(){w.superclass.constructor.apply(this,arguments)}var n=e.ClassNameManager.getClassName,r="scrollview",i=n(r,"hidden"),s=n(r,"paged"),o=e.ScrollView?e.ScrollView.UI_SRC:"ui",u="index",a="scrollX",f="scrollY",l="total",c="host",h="boundingBox",p="contentBox",d="selector",v="flick",m="drag",g="axis",y="x",b="y";e.extend(w,e.Plugin.Base,{initializer:function(e){var t=this,n=t.get(c);t._pageDims=[],t._pageBuffer=1,t._optimizeMemory=!1,t._host=n,t._bb=n._bb,t._cb=n._cb,t._cIndex=t.get(u),t._cAxis=t.get(g),e._optimizeMemory&&(t._optimizeMemory=e._optimizeMemory),e._pageBuffer&&(t._pageBuffer=e._pageBuffer),t._bindAttrs()},_bindAttrs:function(){var e=this;e.after({indexChange:e._afterIndexChange,axisChange:e._afterAxisChange}),e.beforeHostMethod("scrollTo",e._beforeHostScrollTo),e.beforeHostMethod("_mousewheel",e._beforeHostMousewheel),e.beforeHostMethod("_flick",e._beforeHostFlick),e.afterHostMethod("_onGestureMoveEnd",e._afterHostGestureMoveEnd),e.afterHostMethod("_uiDimensionsChange",e._afterHostUIDimensionsChange),e.afterHostMethod("syncUI",e._afterHostSyncUI),e.afterHostEvent("render",e._afterHostRender),e.afterHostEvent("scrollEnd",e._afterHostScrollEnded)},_afterHostRender:function(e){var t=this,n=t._bb,r=t._host,i=t._cIndex,o=t._cAxis,u=t._getPageNodes(),a=u.size(),f=t._pageDims[i].maxScrollX,c=t._pageDims[i].maxScrollY;o[b]?r._maxScrollX=f:o[y]&&(r._maxScrollY=c),t.set(l,a),i!==0&&t.scrollToIndex(i,0),n.addClass(s),t._optimize()},_afterHostSyncUI:function(e){var t=this,n=t._host,r=n.get(v),i=t._getPageNodes(),s=i.size(),o;t.set(l,s),t._cAxis===undefined&&t._set(g,n.get(g))},_afterHostUIDimensionsChange:function(e){var t=this,n=t._host,r=n._getScrollDims(),i=r.offsetWidth,s=r.offsetHeight,o=t._getPageNodes();o.each(function(e,n){var r=e.get("scrollWidth"),o=e.get("scrollHeight"),u=Math.max(0,r-i),a=Math.max(0,o-s);t._pageDims[n]?(t._pageDims[n].maxScrollX=u,t._pageDims[n].maxScrollY=a):t._pageDims[n]={scrollX:0,scrollY:0,_minScrollX:0,_minScrollY:0,maxScrollX:u,maxScrollY:a}})},_beforeHostScrollTo:function(t,n,r,i,s){var o=this,u=o._host,a=u._gesture,f=o._cIndex,l=o._cAxis,c=this._getPageNodes(),h;return a&&(h=a.axis,h===b?t=null:n=null,l[h]===!1&&(s=c.item(f))),new e.Do.AlterArgs("new args",[t,n,r,i,s])},_afterHostGestureMoveEnd:function(e){var t=this,n=t._host,r=n._gesture,i=t._cAxis,s=r&&r.axis;i[s]&&(r[s===y?"deltaX":"deltaY"]>0?t[n.rtl?"prev":"next"]():t[n.rtl?"next":"prev"]())},_beforeHostMousewheel:function(t){var n=this,r=n._host,i=r._bb,s=t.wheelDelta<0,o=n._cAxis;r._gesture={axis:b};if(i.contains(t.target)&&o[b])return s?n.next():n.prev(),t.preventDefault(),new e.Do.Prevent},_beforeHostFlick:function(t){var n=this,r=n.get(g),i=t.flick.axis||!1;if(r[i])return new e.Do.Prevent},_afterHostScrollEnded:function(e){var t=this,n=t._host,r=t._cIndex,i=n.get(a),s=n.get(f),o=t._cAxis;o[b]?t._pageDims[r].scrollX=i:t._pageDims[r].scrollY=s,t._optimize()},_afterIndexChange:function(e){var t=this,n=t._host,r=e.newVal,i=t._pageDims[r],s=n._cAxis,u=t._cAxis;t._cIndex=r,s[y]&&s[b]&&(u[b]?(n._maxScrollX=i.maxScrollX,n.set(a,i.scrollX,{src:o})):u[y]&&(n._maxScrollY=i.maxScrollY,n.set(f,i.scrollY,{src:o}))),e.src!==o&&t.scrollToIndex(r)},_optimize:function(){if(!this._optimizeMemory)return!1;var e=this,t=e._cIndex,n=e._getStage(t);e._showNodes(n.visible),e._hideNodes(n.hidden)},_getStage:function(e){var t=this._pageBuffer,n=this.get(l),r=this._getPageNodes(),i=Math.max(0,e-t),s=Math.min(n,e+1+t);return{visible:r.splice(i,s-i),hidden:r}},_showNodes:function(e){e&&e.removeClass(i).setStyle("visibility","")},_hideNodes:function(e){e&&e.addClass(i).setStyle("visibility","hidden")},_getPageNodes:function(){var e=this,t=e._host,n=t._cb,r=e.get(d),i=r?n.all(r):n.get("children");return i},next:function(){var e=this,t=e._cIndex,n=t+1,r=this.get(l);if(n>=r)return;e.set(u,n)},prev:function(){var e=this,t=e._cIndex,n=t-1;if(n<0)return;e.set(u,n)},scrollTo:function(){return this.scrollToIndex.apply(this,arguments)},scrollToIndex:function(e,t,n){var r=this,i=r._host,s=r._getPageNodes().item(e),o=r._cAxis[y]?a:f,l=s.get(o===a?"offsetLeft":"offsetTop");t=t!==undefined?t:w.TRANSITION.duration,n=n!==undefined?n:w.TRANSITION.easing,r.set(u,e),r._showNodes(s),i.set(o,l,{duration:t,easing:n})},_axisSetter:function(t,n){if(e.Lang.isString(t))return{x:t.match(/x/i)?!0:!1,y:t.match(/y/i)?!0:!1}},_afterAxisChange:function(e){this._cAxis=e.newVal}},{NAME:"pluginScrollViewPaginator",NS:"pages",ATTRS:{axis:{setter:"_axisSetter",writeOnce:"initOnly"},selector:{value:null},index:{value:0,validator:function(e){return!0}},total:{value:0}},TRANSITION:{duration:300,easing:"ease-out"}}),e.namespace("Plugin").ScrollViewPaginator=w},"@VERSION@",{requires:["plugin","classnamemanager"]});
2  build/scrollview-paginator/scrollview-paginator.js
@@ -543,7 +543,7 @@ Y.extend(PaginatorPlugin, Y.Plugin.Base, {
543 543 scrollOffset = pageNode.get(scrollAxis === SCROLL_X ? 'offsetLeft' : 'offsetTop');
544 544
545 545 duration = (duration !== undefined) ? duration : PaginatorPlugin.TRANSITION.duration;
546   - easing = (easing !== undefined) ? duration : PaginatorPlugin.TRANSITION.easing;
  546 + easing = (easing !== undefined) ? easing : PaginatorPlugin.TRANSITION.easing;
547 547
548 548 // Set the index ATTR to the specified index value
549 549 paginator.set(INDEX, index);
2  src/scrollview/js/paginator-plugin.js
@@ -541,7 +541,7 @@ Y.extend(PaginatorPlugin, Y.Plugin.Base, {
541 541 scrollOffset = pageNode.get(scrollAxis === SCROLL_X ? 'offsetLeft' : 'offsetTop');
542 542
543 543 duration = (duration !== undefined) ? duration : PaginatorPlugin.TRANSITION.duration;
544   - easing = (easing !== undefined) ? duration : PaginatorPlugin.TRANSITION.easing;
  544 + easing = (easing !== undefined) ? easing : PaginatorPlugin.TRANSITION.easing;
545 545
546 546 // Set the index ATTR to the specified index value
547 547 paginator.set(INDEX, index);

0 comments on commit 8f8cb58

Please sign in to comment.
Something went wrong with that request. Please try again.