Skip to content

Commit

Permalink
publish build
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyFoxFN committed Jan 4, 2018
1 parent e3e3d25 commit e44ca0f
Show file tree
Hide file tree
Showing 22 changed files with 520 additions and 389 deletions.
8 changes: 4 additions & 4 deletions lib/better-scroll/better-scroll.min.js

Large diffs are not rendered by default.

99 changes: 59 additions & 40 deletions lib/better-scroll/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/*!
* better-normal-scroll v1.6.3
* (c) 2016-2017 ustbhuangyi
* better-normal-scroll v1.7.0
* (c) 2016-2018 ustbhuangyi
* Released under the MIT License.
*/
var slicedToArray = function () {
Expand Down Expand Up @@ -386,40 +386,36 @@ function tap(e, eventName) {
}

function click(e) {
var target = e.target;

if (!/(SELECT|INPUT|TEXTAREA)/i.test(target.tagName)) {
var eventSource = void 0;
if (e.type === 'mouseup' || e.type === 'mousecancel') {
eventSource = e;
} else if (e.type === 'touchend' || e.type === 'touchcancel') {
eventSource = e.changedTouches[0];
}
var posSrc = {};
if (eventSource) {
posSrc.screenX = eventSource.screenX || 0;
posSrc.screenY = eventSource.screenY || 0;
posSrc.clientX = eventSource.clientX || 0;
posSrc.clientY = eventSource.clientY || 0;
}
var ev = void 0;
var event = 'click';
var bubbles = true;
// cancelable set to false in case of the conflict with fastclick
var cancelable = false;
if (typeof MouseEvent !== 'undefined') {
ev = new MouseEvent(event, extend({
bubbles: bubbles,
cancelable: cancelable
}, posSrc));
} else {
ev = document.createEvent('Event');
ev.initEvent(event, bubbles, cancelable);
extend(ev, posSrc);
}
ev._constructed = true;
target.dispatchEvent(ev);
var eventSource = void 0;
if (e.type === 'mouseup' || e.type === 'mousecancel') {
eventSource = e;
} else if (e.type === 'touchend' || e.type === 'touchcancel') {
eventSource = e.changedTouches[0];
}
var posSrc = {};
if (eventSource) {
posSrc.screenX = eventSource.screenX || 0;
posSrc.screenY = eventSource.screenY || 0;
posSrc.clientX = eventSource.clientX || 0;
posSrc.clientY = eventSource.clientY || 0;
}
var ev = void 0;
var event = 'click';
var bubbles = true;
// cancelable set to false in case of the conflict with fastclick
var cancelable = false;
if (typeof MouseEvent !== 'undefined') {
ev = new MouseEvent(event, extend({
bubbles: bubbles,
cancelable: cancelable
}, posSrc));
} else {
ev = document.createEvent('Event');
ev.initEvent(event, bubbles, cancelable);
extend(ev, posSrc);
}
ev._constructed = true;
e.target.dispatchEvent(ev);
}

function prepend(el, target) {
Expand Down Expand Up @@ -471,6 +467,7 @@ var DEFAULT_OPTIONS = {
disableMouse: hasTouch,
disableTouch: !hasTouch,
observeDOM: true,
autoBlur: true,
/**
* for picker
* wheel: {
Expand All @@ -490,6 +487,13 @@ var DEFAULT_OPTIONS = {
* threshold: 0.1,
* stepX: 100,
* stepY: 100,
* speed: 400,
* easing: {
* style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
* fn: function (t) {
* return t * (2 - t)
* }
* }
* listenFlick: true
* }
*/
Expand Down Expand Up @@ -540,6 +544,10 @@ function initMixin(BScroll) {
this._initDOMObserver();
}

if (this.options.autoBlur) {
this._handleAutoBlur();
}

this.refresh();

if (!this.options.snap) {
Expand Down Expand Up @@ -648,6 +656,15 @@ function initMixin(BScroll) {
});
};

BScroll.prototype._handleAutoBlur = function () {
this.on('beforeScrollStart', function () {
var activeElement = document.activeElement;
if (activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA')) {
activeElement.blur();
}
});
};

BScroll.prototype._initDOMObserver = function () {
var _this = this;

Expand Down Expand Up @@ -1157,7 +1174,7 @@ function coreMixin(BScroll) {

this.directionX = 0;
this.directionY = 0;
easing = ease.bounce;
easing = this.options.snap.easing || ease.bounce;
}

if (newX !== this.x || newY !== this.y) {
Expand Down Expand Up @@ -1199,7 +1216,7 @@ function coreMixin(BScroll) {
tap(e, this.options.tap);
}

if (this.options.click) {
if (this.options.click && !preventDefaultException(e.target, this.options.preventDefaultException)) {
click(e);
}
return true;
Expand Down Expand Up @@ -1750,14 +1767,16 @@ function snapMixin(BScroll) {
BScroll.prototype._goToPage = function (x) {
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var time = arguments[2];
var easing = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ease.bounce;
var easing = arguments[3];

var snap = this.options.snap;

if (!snap || !this.pages) {
return;
}

easing = easing || snap.easing || ease.bounce;

if (x >= this.pages.length) {
x = this.pages.length - 1;
} else if (x < 0) {
Expand Down Expand Up @@ -2167,8 +2186,8 @@ function pullUpMixin(BScroll) {

function checkToEnd(pos) {
if (this.movingDirectionY === DIRECTION_UP && pos.y <= this.maxScrollY + threshold) {
this.trigger('pullingUp');
this.pullupWatching = false;
this.trigger('pullingUp');
this.off('scroll', checkToEnd);
}
}
Expand Down Expand Up @@ -2211,7 +2230,7 @@ scrollbarMixin(BScroll);
pullDownMixin(BScroll);
pullUpMixin(BScroll);

BScroll.Version = '1.6.3';
BScroll.Version = '1.7.0';

/* harmony default export */ __webpack_exports__["default"] = (BScroll);

Expand Down
Loading

0 comments on commit e44ca0f

Please sign in to comment.