Skip to content

Commit 827a0be

Browse files
committed
Merge pull request #2 from dcloudio/master
更新11-10
2 parents 6e5c5c4 + a31a274 commit 827a0be

29 files changed

Lines changed: 1416 additions & 540 deletions

Gruntfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ module.exports = function(grunt) {
4949
'js/mui.detect.5+.js',
5050
'js/mui.target.js',
5151
'js/mui.fixed.js',
52+
'js/mui.fixed.bind.js',
5253
'js/mui.fixed.classlist.js',
5354
'js/mui.fixed.animation.js',
5455
'js/mui.fixed.fastclick.js',
@@ -150,7 +151,7 @@ module.exports = function(grunt) {
150151
uglify: {
151152
options: {
152153
banner: '<%= banner %>',
153-
compress: true,
154+
compress: {},
154155
mangle: true,
155156
preserveComments: false
156157
},

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mui框架有效的解决了这些问题,这是一个可以方便开发出高
77

88
参考文档
99
------
10-
[mui官网](http://dcloudio.github.io/mui/)文档使用[Jekyll](http://jekyllrb.com) 构建,发布在GitHub Pages上,[立即查看](http://dcloudio.github.io/mui/)
10+
[mui官网](http://dev.dcloud.net.cn/mui/)文档使用[Jekyll](http://jekyllrb.com) 构建,[立即查看](http://dev.dcloud.net.cn/mui/)
1111

1212
快速体验
1313
--------

dist/css/mui.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* =====================================================
3-
* Mui v2.4.0 (https://github.com/dcloudio/mui)
3+
* Mui v2.6.0 (http://dev.dcloud.net.cn/mui)
44
* =====================================================
55
*/
66

@@ -4341,8 +4341,8 @@ select:focus
43414341
font-size: 14px;
43424342

43434343
width: 270px;
4344-
margin: 5px auto 5px auto;
4345-
padding: 5px 5px 5px 5px;
4344+
margin: 5px auto;
4345+
padding: 5px;
43464346

43474347
text-align: center;
43484348

dist/css/mui.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/mui.js

Lines changed: 66 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* =====================================================
3-
* Mui v2.4.0 (https://github.com/dcloudio/mui)
3+
* Mui v2.6.0 (http://dev.dcloud.net.cn/mui)
44
* =====================================================
55
*/
66
/**
@@ -190,25 +190,6 @@ var mui = (function(document, undefined) {
190190
}
191191
return this;
192192
};
193-
/**
194-
* map
195-
*/
196-
$.map = function(elements, callback) {
197-
var value, values = [],
198-
i, key;
199-
if (typeof elements.length === 'number') { //TODO 此处逻辑不严谨,可能会有Object:{a:'b',length:1}的情况未处理
200-
for (i = 0, len = elements.length; i < len; i++) {
201-
value = callback(elements[i], i);
202-
if (value != null) values.push(value);
203-
}
204-
} else {
205-
for (key in elements) {
206-
value = callback(elements[key], key);
207-
if (value != null) values.push(value);
208-
}
209-
}
210-
return values.length > 0 ? [].concat.apply([], values) : values;
211-
};
212193
/**
213194
* each
214195
* @param {type} elements
@@ -587,6 +568,32 @@ var mui = (function(document, undefined) {
587568
window.CustomEvent = CustomEvent;
588569
}
589570
})();
571+
/*
572+
A shim for non ES5 supporting browsers.
573+
Adds function bind to Function prototype, so that you can do partial application.
574+
Works even with the nasty thing, where the first word is the opposite of extranet, the second one is the profession of Columbus, and the version number is 9, flipped 180 degrees.
575+
*/
576+
577+
Function.prototype.bind = Function.prototype.bind || function(to) {
578+
// Make an array of our arguments, starting from second argument
579+
var partial = Array.prototype.splice.call(arguments, 1),
580+
// We'll need the original function.
581+
fn = this;
582+
var bound = function() {
583+
// Join the already applied arguments to the now called ones (after converting to an array again).
584+
var args = partial.concat(Array.prototype.splice.call(arguments, 0));
585+
// If not being called as a constructor
586+
if (!(this instanceof bound)) {
587+
// return the result of the function called bound to target and partially applied.
588+
return fn.apply(to, args);
589+
}
590+
// If being called as a constructor, apply the function bound to self.
591+
fn.apply(this, args);
592+
}
593+
// Attach the prototype of the function to our newly created function.
594+
bound.prototype = fn.prototype;
595+
return bound;
596+
};
590597
/**
591598
* mui fixed classList
592599
* @param {type} document
@@ -921,7 +928,7 @@ var mui = (function(document, undefined) {
921928
};
922929
var findDelegateFn = function(element, event) {
923930
var delegateCallbacks = delegateFns[mid(element)];
924-
var result = false;
931+
var result = [];
925932
if (delegateCallbacks) {
926933
result = [];
927934
if (event) {
@@ -2389,6 +2396,7 @@ var mui = (function(document, undefined) {
23892396
var action = $.targets.action;
23902397
if (action && action.classList.contains('mui-action-back')) {
23912398
$.back();
2399+
$.targets.action = false;
23922400
}
23932401
});
23942402
window.addEventListener('swiperight', function(e) {
@@ -2739,7 +2747,8 @@ var mui = (function(document, undefined) {
27392747
xhr.onreadystatechange = $.noop;
27402748
clearTimeout(abortTimeout);
27412749
var result, error = false;
2742-
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304 || (xhr.status === 0 && protocol === 'file:')) {
2750+
var isLocal = protocol === 'file:';
2751+
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304 || (xhr.status === 0 && isLocal && xhr.responseText)) {
27432752
dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type'));
27442753
result = xhr.responseText;
27452754
try {
@@ -2761,7 +2770,13 @@ var mui = (function(document, undefined) {
27612770
ajaxSuccess(result, xhr, settings);
27622771
}
27632772
} else {
2764-
ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings);
2773+
var status = xhr.status ? 'error' : 'abort';
2774+
var statusText = xhr.statusText || null;
2775+
if (isLocal) {
2776+
status = 'error';
2777+
statusText = '404';
2778+
}
2779+
ajaxError(statusText, status, xhr, settings);
27652780
}
27662781
}
27672782
};
@@ -3418,6 +3433,7 @@ var mui = (function(document, undefined) {
34183433
this._end(e);
34193434
break;
34203435
case 'webkitTransitionEnd':
3436+
this.transitionTimer && this.transitionTimer.cancel();
34213437
this._transitionEnd(e);
34223438
break;
34233439
case 'scrollend':
@@ -3666,6 +3682,12 @@ var mui = (function(document, undefined) {
36663682
this.indicators[i].transitionTime(time);
36673683
}
36683684
}
3685+
if (time) { //自定义timer,保证webkitTransitionEnd始终触发
3686+
this.transitionTimer && this.transitionTimer.cancel();
3687+
this.transitionTimer = $.later(function() {
3688+
$.trigger(this.scroller, 'webkitTransitionEnd');
3689+
}, time + 100, this);
3690+
}
36693691
},
36703692
_transitionTimingFunction: function(easing) {
36713693
this.scrollerStyle['webkitTransitionTimingFunction'] = easing;
@@ -3862,7 +3884,9 @@ var mui = (function(document, undefined) {
38623884
},
38633885
scrollTo: function(x, y, time, easing) {
38643886
var easing = easing || ease.circular;
3865-
this.isInTransition = time > 0 && (this.lastX != x || this.lastY != y);
3887+
// this.isInTransition = time > 0 && (this.lastX != x || this.lastY != y);
3888+
//暂不严格判断x,y,否则会导致部分版本上不正常触发轮播
3889+
this.isInTransition = time > 0;
38663890
if (this.isInTransition) {
38673891
this._clearRequestAnimationFrame();
38683892
this._transitionTimingFunction(easing.style);
@@ -4253,6 +4277,7 @@ var mui = (function(document, undefined) {
42534277
indicators: false,
42544278
bounceTime: 200,
42554279
startX: false,
4280+
slideTime: 0, //滑动动画时间
42564281
snap: SELECTOR_SLIDER_ITEM
42574282
}, options));
42584283
if (this.options.startX) {
@@ -4313,7 +4338,14 @@ var mui = (function(document, undefined) {
43134338
}
43144339
var detail = e.detail;
43154340
detail.slideNumber = detail.slideNumber || 0;
4316-
var items = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
4341+
var temps = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
4342+
var items = [];
4343+
for (var i = 0, len = temps.length; i < len; i++) {
4344+
var item = temps[i];
4345+
if (item.parentNode === self.scroller) {
4346+
items.push(item);
4347+
}
4348+
}
43174349
var _slideNumber = detail.slideNumber;
43184350
if (self.loop) {
43194351
_slideNumber += 1;
@@ -4356,7 +4388,7 @@ var mui = (function(document, undefined) {
43564388
},
43574389
_handleTabShow: function(e) {
43584390
var self = this;
4359-
self.gotoItem((e.detail.tabNumber || 0), self.options.bounceTime);
4391+
self.gotoItem((e.detail.tabNumber || 0), self.options.slideTime);
43604392
},
43614393
_handleIndicatorTap: function(event) {
43624394
var self = this;
@@ -7012,10 +7044,14 @@ var mui = (function(document, undefined) {
70127044
self.input.value = val.toString();
70137045
$.trigger(self.input, changeEventName, null);
70147046
});
7015-
// self.input.addEventListener(changeEventName, function(event) {
7016-
// self.checkValue();
7017-
// $.trigger(self, changeEventName, self.getValue());
7018-
// });
7047+
self.input.addEventListener(changeEventName, function(event) {
7048+
self.checkValue();
7049+
var val = parseInt(self.input.value);
7050+
//触发顶层容器
7051+
$.trigger(self.holder, changeEventName, {
7052+
value: val
7053+
});
7054+
});
70197055
},
70207056
/**
70217057
* 获取当前值

dist/js/mui.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)