From 17c1c16fcf6faecd13d8774b516c5c97fdc6a755 Mon Sep 17 00:00:00 2001 From: Derk Bell Date: Mon, 30 Mar 2015 12:20:11 +0200 Subject: [PATCH] add reference to scroller to ptr/ptl callbacks --- src/plugins/pull-to-load-more.js | 10 +++++----- src/plugins/pull-to-refresh.js | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/plugins/pull-to-load-more.js b/src/plugins/pull-to-load-more.js index 3c1f98c..d1e638f 100644 --- a/src/plugins/pull-to-load-more.js +++ b/src/plugins/pull-to-load-more.js @@ -38,7 +38,7 @@ labelSubtitle : '', labelError : 'Error on pull to load more' }, - + PULL_TO_SNAP_TIME = 200, ERROR_TIMEOUT = 1000, CLASS_UPDATE_STATE = 'update', @@ -48,7 +48,7 @@ CLASS_LABEL = 'label', CLASS_SUBTITLE = 'sub', CLASS_PTL = 'pullToLoadMore'; - + function PullToLoadMore() {} PullToLoadMore.prototype = { @@ -76,7 +76,7 @@ } this.opts.pullToLoadMoreConfig = ptlConfig; }, - + triggerPTL: function () { //set waiting state if (!this._ptlLoading) { @@ -242,7 +242,7 @@ }; if (ptrDataProvider) { - ptrDataProvider(callback); + ptrDataProvider(callback, self); } else { w.setTimeout(function (){ self._ptlExecTriggerCallback('no fnc'); @@ -317,4 +317,4 @@ PLUGINS.PullToLoadMore = PullToLoadMore; -}(window)); \ No newline at end of file +}(window)); diff --git a/src/plugins/pull-to-refresh.js b/src/plugins/pull-to-refresh.js index cce924e..85119eb 100644 --- a/src/plugins/pull-to-refresh.js +++ b/src/plugins/pull-to-refresh.js @@ -16,7 +16,7 @@ (function (w) { 'use strict'; w || (w = window); - + // NAMESPACES var SCROLLER = w.__S || (w.__S = {}), RAF = w.requestAnimationFrame, @@ -49,7 +49,7 @@ CLASS_LABEL = 'label', CLASS_SUBTITLE = 'sub', CLASS_PTR = 'pullToRefresh'; - + function PullToRefresh() {} PullToRefresh.DEFAULTS = CONFIG_DEFAULTS; @@ -147,7 +147,7 @@ this._iosTouching = false; this._end(e); }.bind(this)); - + }, //TODO: FIX clicking for PTR _appendPullToRefresh: function () { @@ -246,10 +246,10 @@ return this._needsPullToRefresh(y); } - if (isPTRNative) { + if (isPTRNative) { if (y > -this._ptrSize) { this.ptrDOM.style[STYLES.transform] = 'translate3d(0,' + (50 + y) + 'px,0)'; - } + } } }, _onScrollEndPTR: function (e) { @@ -291,7 +291,7 @@ }; if (ptrDataProvider) { - ptrDataProvider(callback); + ptrDataProvider(callback, self); } else { w.setTimeout(function (){ self._ptrExecTriggerCallback('handler not defined'); @@ -316,7 +316,7 @@ self._resetPosition(self._ptrSnapTime); }); } - + }, /* * ================================== @@ -366,4 +366,4 @@ PLUGINS.PullToRefresh = PullToRefresh; -}(window)); \ No newline at end of file +}(window));