Skip to content

Commit

Permalink
编译到mui v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hbcui1984 committed Aug 10, 2015
1 parent 2dfbe62 commit f78aaa8
Show file tree
Hide file tree
Showing 19 changed files with 241 additions and 105 deletions.
15 changes: 11 additions & 4 deletions dist/css/mui.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* =====================================================
* Mui v2.1.0 (https://github.com/dcloudio/mui)
* Mui v2.2.0 (https://github.com/dcloudio/mui)
* =====================================================
*/

Expand Down Expand Up @@ -2395,14 +2395,22 @@ input[type='submit']:enabled:active, input[type='submit'].mui-active:enabled,
margin-top: 15px;
}

.mui-table-view-cell.mui-collapse .mui-table-view:after
.mui-table-view-cell.mui-collapse .mui-table-view:before, .mui-table-view-cell.mui-collapse .mui-table-view:after
{
left: 15px;
height: 0;
}
.mui-table-view-cell.mui-collapse .mui-table-view .mui-table-view-cell:last-child:after
{
height: 0;
}
.mui-table-view-cell.mui-collapse > .mui-navigate-right:after, .mui-table-view-cell.mui-collapse > .mui-push-right:after
{
content: '\e581';
}
.mui-table-view-cell.mui-collapse.mui-active
{
margin-top: -1px;
}
.mui-table-view-cell.mui-collapse.mui-active .mui-table-view, .mui-table-view-cell.mui-collapse.mui-active .mui-collapse-content
{
display: block;
Expand All @@ -2425,7 +2433,6 @@ input[type='submit']:enabled:active, input[type='submit'].mui-active:enabled,
-o-transition: height .35s ease;
transition: height .35s ease;

border: 1px solid #ddd;
background: white;
}
.mui-table-view-cell.mui-collapse .mui-collapse-content > .mui-input-group, .mui-table-view-cell.mui-collapse .mui-collapse-content > .mui-slider
Expand Down
4 changes: 2 additions & 2 deletions dist/css/mui.min.css

Large diffs are not rendered by default.

73 changes: 55 additions & 18 deletions dist/js/mui.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* =====================================================
* Mui v2.1.0 (https://github.com/dcloudio/mui)
* Mui v2.2.0 (https://github.com/dcloudio/mui)
* =====================================================
*/
/**
Expand Down Expand Up @@ -918,6 +918,22 @@ var mui = (function(document, undefined) {
}, true);
};
};
var findDelegateFn = function(element, event) {
var delegateCallbacks = delegateFns[mid(element)];
var result = false;
if (delegateCallbacks) {
result = [];
if (event) {
var filterFn = function(fn) {
return fn.type === event;
}
return delegateCallbacks.filter(filterFn);
} else {
result = delegateCallbacks;
}
}
return result;
};
var preventDefaultException = /^(INPUT|TEXTAREA|BUTTON|SELECT)$/;
/**
* mui delegate events
Expand All @@ -940,8 +956,16 @@ var mui = (function(document, undefined) {
var delegateCallbacks = delegateCallbackObjs[selector] || (delegateCallbackObjs[selector] = []);
delegateCallbacks.push(callback);
if (isAddEventListener) {
delegateFns[mid(element)] = delegateFn(element, event, selector, callback);
element.addEventListener(event, delegateFns[mid(element)]);
var delegateFnArray = delegateFns[mid(element)];
if (!delegateFnArray) {
delegateFnArray = [];
}
var delegateCallback = delegateFn(element, event, selector, callback);
delegateFnArray.push(delegateCallback);
delegateCallback.i = delegateFnArray.length - 1;
delegateCallback.type = event;
delegateFns[mid(element)] = delegateFnArray;
element.addEventListener(event, delegateCallback);
if (event === 'tap') { //TODO 需要找个更好的解决方案
element.addEventListener('click', function(e) {
if (e.target) {
Expand All @@ -965,11 +989,13 @@ var mui = (function(document, undefined) {
$.fn.off = function(event, selector, callback) {
return this.each(function() {
var _mid = mid(this);
if (!callback) {
if (delegates[_mid] && delegates[_mid][event]) {
delete delegates[_mid][event][selector];
}
} else {
if (!event) { //mui(selector).off();
delegates[_mid] && delete delegates[_mid];
} else if (!selector) { //mui(selector).off(event);
delegates[_mid] && delete delegates[_mid][event];
} else if (!callback) { //mui(selector).off(event,selector);
delegates[_mid] && delegates[_mid][event] && delete delegates[_mid][event][selector];
} else { //mui(selector).off(event,selector,callback);
var delegateCallbacks = delegates[_mid] && delegates[_mid][event] && delegates[_mid][event][selector];
$.each(delegateCallbacks, function(index, delegateCallback) {
if (mid(delegateCallback) === mid(callback)) {
Expand All @@ -978,12 +1004,23 @@ var mui = (function(document, undefined) {
}
}, true);
}
//如果off掉了所有当前element的指定的event事件,则remove掉当前element的delegate回调
if (delegates[_mid] && $.isEmptyObject(delegates[_mid][event])) {
this.removeEventListener(event, delegateFns[_mid]);
delete delegateFns[_mid];
if (delegates[_mid]) {
//如果off掉了所有当前element的指定的event事件,则remove掉当前element的delegate回调
if ((!delegates[_mid][event] || $.isEmptyObject(delegates[_mid][event]))) {
findDelegateFn(this, event).forEach(function(fn) {
this.removeEventListener(fn.type, fn);
delete delegateFns[_mid][fn.i];
}.bind(this));
}
} else {
//如果delegates[_mid]已不存在,删除所有
findDelegateFn(this).forEach(function(fn) {
this.removeEventListener(fn.type, fn);
delete delegateFns[_mid][fn.i];
}.bind(this));
}
})
});

};
})(mui);
/**
Expand Down Expand Up @@ -4073,7 +4110,7 @@ var mui = (function(document, undefined) {
this.pulldownLoading(undefined, time || 0);
return true;
} else {
this.topPocket.classList.remove(CLASS_VISIBILITY);
!this.loading && this.topPocket.classList.remove(CLASS_VISIBILITY);
}
}
return this._super(time);
Expand Down Expand Up @@ -4123,7 +4160,7 @@ var mui = (function(document, undefined) {
},
endPullupToRefresh: function(finished) {
var self = this;
if (self.bottomPocket && self.loading && !this.pulldown) {
if (self.bottomPocket) { // && self.loading && !this.pulldown
self.loading = false;
if (finished) {
this.finished = true;
Expand All @@ -4133,9 +4170,9 @@ var mui = (function(document, undefined) {
self.wrapper.removeEventListener('scrollbottom', self);
} else {
self._setCaption(self.options.up.contentdown);
setTimeout(function() {
self.loading || self.bottomPocket.classList.remove(CLASS_VISIBILITY);
}, 350);
// setTimeout(function() {
self.loading || self.bottomPocket.classList.remove(CLASS_VISIBILITY);
// }, 300);
}
}
},
Expand Down
10 changes: 5 additions & 5 deletions dist/js/mui.min.js

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions examples/hello-mui/css/mui.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* =====================================================
* Mui v2.1.0 (https://github.com/dcloudio/mui)
* Mui v2.2.0 (https://github.com/dcloudio/mui)
* =====================================================
*/

Expand Down Expand Up @@ -2395,14 +2395,22 @@ input[type='submit']:enabled:active, input[type='submit'].mui-active:enabled,
margin-top: 15px;
}

.mui-table-view-cell.mui-collapse .mui-table-view:after
.mui-table-view-cell.mui-collapse .mui-table-view:before, .mui-table-view-cell.mui-collapse .mui-table-view:after
{
left: 15px;
height: 0;
}
.mui-table-view-cell.mui-collapse .mui-table-view .mui-table-view-cell:last-child:after
{
height: 0;
}
.mui-table-view-cell.mui-collapse > .mui-navigate-right:after, .mui-table-view-cell.mui-collapse > .mui-push-right:after
{
content: '\e581';
}
.mui-table-view-cell.mui-collapse.mui-active
{
margin-top: -1px;
}
.mui-table-view-cell.mui-collapse.mui-active .mui-table-view, .mui-table-view-cell.mui-collapse.mui-active .mui-collapse-content
{
display: block;
Expand All @@ -2425,7 +2433,6 @@ input[type='submit']:enabled:active, input[type='submit'].mui-active:enabled,
-o-transition: height .35s ease;
transition: height .35s ease;

border: 1px solid #ddd;
background: white;
}
.mui-table-view-cell.mui-collapse .mui-collapse-content > .mui-input-group, .mui-table-view-cell.mui-collapse .mui-collapse-content > .mui-slider
Expand Down
4 changes: 2 additions & 2 deletions examples/hello-mui/css/mui.min.css

Large diffs are not rendered by default.

34 changes: 20 additions & 14 deletions examples/hello-mui/examples/grid-pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!--标准mui.css-->
<link rel="stylesheet" href="../css/mui.min.css">
<!--App自定义的css-->
<link rel="stylesheet" type="text/css" href="../css/app.css"/>
<link rel="stylesheet" type="text/css" href="../css/app.css" />
<style>
.mui-slider-indicator {
bottom: 0;
Expand All @@ -21,6 +21,7 @@
}
</style>
</head>

<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
Expand Down Expand Up @@ -211,7 +212,7 @@ <h1 class="mui-title">左右拖动分页9宫</h1>
</li>
</ul>
</div>

</div>
<div class="mui-slider-indicator">
<div class="mui-indicator mui-active"></div>
Expand All @@ -234,27 +235,32 @@ <h1 class="mui-title">左右拖动分页9宫</h1>
//克隆最后一个节点
var last = items[items.length - 1].cloneNode(true);
last.classList.add('mui-slider-item-duplicate');

//处理是否循环逻辑,若支持循环,需支持两点:
//1、在.mui-slider-group节点上增加.mui-slider-loop类
//2、重复增加2个循环节点,图片顺序变为:N、1、2...N、1
var sliderApi = mui(slider).slider();

function toggleLoop(loop) {
if (loop) {
group.classList.add('mui-slider-loop');
group.insertBefore(last, group.firstChild);
group.appendChild(first);
} else {
group.classList.remove('mui-slider-loop');
group.removeChild(first);
group.removeChild(last);
if (loop) {
group.classList.add('mui-slider-loop');
group.insertBefore(last, group.firstChild);
group.appendChild(first);
sliderApi.refresh();
sliderApi.gotoItem(0);
} else {
group.classList.remove('mui-slider-loop');
group.removeChild(first);
group.removeChild(last);
sliderApi.refresh();
sliderApi.gotoItem(0);
}
}
}

//按下“循环”按钮的处理逻辑;
//按下“循环”按钮的处理逻辑;
document.getElementById('Gallery_Toggle').addEventListener('toggle', function(e) {
var loop = e.detail.isActive;
toggleLoop(loop);
});
});
</script>

</html>
2 changes: 1 addition & 1 deletion examples/hello-mui/examples/imageviewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link rel="stylesheet" href="../css/mui.min.css">
<!--App自定义的css-->
<style type="text/css">
.mui-fullscreen {
.mui-preview-image.mui-fullscreen {
position: fixed;
z-index: 20;
background-color: #000;
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-mui/examples/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ <h4>新手指南</h4>
</p>
<p>更多详细介绍,请到<a href="http://dcloudio.github.io/mui">mui官网</a>查看;</p>
<h4>版本介绍</h4>
<p>当前版本为2.1.0,可到<a href="https://github.com/dcloudio/mui">Github</a>上获取最新版本。</p>
<p>当前版本为2.2.0,可到<a href="https://github.com/dcloudio/mui">Github</a>上获取最新版本。</p>
<h4>License</h4>
<p>
mui遵循MIT License,源码已提交至Github,<a href="https://github.com/dcloudio/mui">点击查看</a>;
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-mui/examples/setting.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ <h1 class="mui-center mui-title">设置</h1>
</ul>
<ul class="mui-table-view mui-table-view-chevron">
<li class="mui-table-view-cell">
<a href="#about" class="mui-navigate-right">关于MUI <i class="mui-pull-right update">V2.1.0</i></a>
<a href="#about" class="mui-navigate-right">关于MUI <i class="mui-pull-right update">V2.2.0</i></a>
</li>
</ul>
<ul class="mui-table-view">
Expand Down
Loading

0 comments on commit f78aaa8

Please sign in to comment.