Skip to content

Commit

Permalink
Merge pull request #1 from dcloudio/master
Browse files Browse the repository at this point in the history
更新至v2.9.0
  • Loading branch information
iwx committed Mar 18, 2016
2 parents 1d7ab67 + cf02c2c commit b9e1971
Show file tree
Hide file tree
Showing 33 changed files with 677 additions and 13,122 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mui框架有效的解决了这些问题,这是一个可以方便开发出高
[在线下载](http://www.dcloud.io/hellomui)或扫描如下二维码下载Hello MUI,可在手机上体验MUI的控件UI及能力展示;

<a href="http://www.dcloud.io/hellomui" target="_blank">
<img src="http://dcloud.io/img/qrcode-m.png" width="85" />
<img src="http://www.dcloud.io/images/code-m.png" width="100" />
</a>


Expand Down
2 changes: 1 addition & 1 deletion dist/css/mui.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* =====================================================
* Mui v2.8.0 (http://dev.dcloud.net.cn/mui)
* Mui v2.9.0 (http://dev.dcloud.net.cn/mui)
* =====================================================
*/

Expand Down
2 changes: 1 addition & 1 deletion dist/css/mui.min.css

Large diffs are not rendered by default.

79 changes: 59 additions & 20 deletions dist/js/mui.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* =====================================================
* Mui v2.8.0 (http://dev.dcloud.net.cn/mui)
* Mui v2.9.0 (http://dev.dcloud.net.cn/mui)
* =====================================================
*/
/**
Expand All @@ -20,7 +20,11 @@ var mui = (function(document, undefined) {
if (!selector)
return wrap();
if (typeof selector === 'object')
return wrap([selector], null);
if ($.isArrayLike(selector)) {
return wrap($.slice.call(selector), null);
} else {
return wrap([selector], null);
}
if (typeof selector === 'function')
return $.ready(selector);
if (typeof selector === 'string') {
Expand Down Expand Up @@ -129,6 +133,19 @@ var mui = (function(document, undefined) {
function(object) {
return object instanceof Array;
};
/**
* mui isArrayLike
* @param {Object} obj
*/
$.isArrayLike = function(obj) {
var length = !!obj && "length" in obj && obj.length;
var type = $.type(obj);
if (type === "function" || $.isWindow(obj)) {
return false;
}
return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && (length - 1) in obj;
};
/**
* mui isWindow(需考虑obj为undefined的情况)
*/
Expand Down Expand Up @@ -3298,6 +3315,7 @@ Function.prototype.bind = Function.prototype.bind || function(to) {
$.PullRefresh = PullRefresh;
})(mui, document);
(function($, window, document, undefined) {
var CLASS_SCROLL = 'mui-scroll';
var CLASS_SCROLLBAR = 'mui-scrollbar';
var CLASS_INDICATOR = 'mui-scrollbar-indicator';
var CLASS_SCROLLBAR_VERTICAL = CLASS_SCROLLBAR + '-vertical';
Expand Down Expand Up @@ -4021,7 +4039,18 @@ Function.prototype.bind = Function.prototype.bind || function(to) {

return true;
},
_reInit: function() {
var groups = this.wrapper.querySelectorAll('.' + CLASS_SCROLL);
for (var i = 0, len = groups.length; i < len; i++) {
if (groups[i].parentNode === this.wrapper) {
this.scroller = groups[i];
break;
}
}
this.scrollerStyle = this.scroller && this.scroller.style;
},
refresh: function() {
this._reInit();
this.reLayout();
$.trigger(this.scroller, 'refresh', this);
this.resetPosition();
Expand Down Expand Up @@ -4429,13 +4458,7 @@ Function.prototype.bind = Function.prototype.bind || function(to) {
}
},
_init: function() {
var groups = this.wrapper.querySelectorAll('.' + CLASS_SLIDER_GROUP);
for (var i = 0, len = groups.length; i < len; i++) {
if (groups[i].parentNode === this.wrapper) {
this.scroller = groups[i];
break;
}
}
this._reInit();
if (this.scroller) {
this.scrollerStyle = this.scroller.style;
this.progressBar = this.wrapper.querySelector(SELECTOR_SLIDER_PROGRESS_BAR);
Expand Down Expand Up @@ -4736,6 +4759,20 @@ Function.prototype.bind = Function.prototype.bind || function(to) {
getSlideNumber: function() {
return this.slideNumber || 0;
},
_reInit: function() {
var groups = this.wrapper.querySelectorAll('.' + CLASS_SLIDER_GROUP);
for (var i = 0, len = groups.length; i < len; i++) {
if (groups[i].parentNode === this.wrapper) {
this.scroller = groups[i];
break;
}
}
this.scrollerStyle = this.scroller && this.scroller.style;
if (this.progressBar) {
this.progressBarWidth = this.progressBar.offsetWidth;
this.progressBarStyle = this.progressBar.style;
}
},
refresh: function(options) {
if (options) {
$.extend(this.options, options);
Expand Down Expand Up @@ -4930,8 +4967,6 @@ Function.prototype.bind = Function.prototype.bind || function(to) {
}
});
}.bind(this));
var callback = $.options.pullRefresh.down.callback;
callback && callback.call(this);
},
// _pulldownLoading: function() { //该方法是子页面调用的
// var self = this;
Expand Down Expand Up @@ -7044,9 +7079,11 @@ Function.prototype.bind = Function.prototype.bind || function(to) {
} else {
if (typeof title === 'function') {
callback = title;
type = btnValue;
title = null;
btnValue = null;
} else if (typeof btnValue === 'function') {
type = callback;
callback = btnValue;
btnValue = null;
}
Expand All @@ -7062,9 +7099,11 @@ Function.prototype.bind = Function.prototype.bind || function(to) {
} else {
if (typeof title === 'function') {
callback = title;
type = btnArray;
title = null;
btnArray = null;
} else if (typeof btnArray === 'function') {
type = callback;
callback = btnArray;
btnArray = null;
}
Expand All @@ -7080,14 +7119,17 @@ Function.prototype.bind = Function.prototype.bind || function(to) {
} else {
if (typeof placeholder === 'function') {
callback = placeholder;
type = title;
placeholder = null;
title = null;
btnArray = null;
} else if (typeof title === 'function') {
callback = title;
type = btnArray;
title = null;
btnArray = null;
} else if (typeof btnArray === 'function') {
type = callback;
callback = btnArray;
btnArray = null;
}
Expand Down Expand Up @@ -7239,16 +7281,13 @@ Function.prototype.bind = Function.prototype.bind || function(to) {

if (this.sliderActionClass) {
var tooltip = this.sliderAction;
//TODO resize
var offsetLeft = element.offsetLeft;
var width = element.offsetWidth - 28;
var tooltipWidth = tooltip.offsetWidth;
var distince = Math.abs(element.max - element.min);

var timer = null;
var showTip = function() {
var showTip = function() { //每次重新计算是因为控件可能被隐藏,初始化时计算是不正确的
tooltip.classList.remove(CLASS_HIDDEN);
tooltipWidth = tooltipWidth || tooltip.offsetWidth;
var offsetLeft = element.offsetLeft;
var width = element.offsetWidth - 28;
var tooltipWidth = tooltip.offsetWidth;
var distince = Math.abs(element.max - element.min);
var scaleWidth = (width / distince) * Math.abs(element.value - element.min);
tooltip.style.left = (14 + offsetLeft + scaleWidth - tooltipWidth / 2) + 'px';
tooltip.innerText = element.value;
Expand Down Expand Up @@ -7358,7 +7397,7 @@ Function.prototype.bind = Function.prototype.bind || function(to) {
if (classList.contains('mui-input-clear')) {
actions.push('clear');
}
if (classList.contains('mui-input-speech')) {
if (!($.os.android && $.os.stream) && classList.contains('mui-input-speech')) {
actions.push('speech');
}
if (classList.contains('mui-input-password')) {
Expand Down
10 changes: 5 additions & 5 deletions dist/js/mui.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit b9e1971

Please sign in to comment.