Skip to content

Commit

Permalink
编译为mui v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hbcui1984 committed Feb 13, 2015
1 parent 9316e55 commit e46bc67
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 138 deletions.
65 changes: 59 additions & 6 deletions dist/css/mui.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* =====================================================
* Mui v1.1.1 (https://github.com/dcloudio/mui)
* Mui v1.2.0 (https://github.com/dcloudio/mui)
* =====================================================
*/

Expand Down Expand Up @@ -863,6 +863,10 @@ button,
background-clip: padding-box;
border: 1px solid #ccc;
border-radius: 3px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
-webkit-transition: all;
transition: all;
-webkit-transition-timing-function: linear;
Expand Down Expand Up @@ -1276,6 +1280,19 @@ input[type="submit"]:active, input[type="submit"].mui-active,
margin: 6px 0;
}

.mui-bar .mui-input-row .mui-btn {
padding: 12px 10px;
}

.mui-bar .mui-search:before {
margin-top: -10px;
}

.mui-bar .mui-input-row .mui-input-clear ~ .mui-icon-clear, .mui-input-row .mui-input-speech ~ .mui-icon-speech {
top: 0;
right: 17%;
}

.mui-bar .mui-segmented-control {
top: 7px;
width: auto;
Expand Down Expand Up @@ -1483,7 +1500,10 @@ input[type="submit"]:active, input[type="submit"].mui-active,
position: relative;
padding: 11px 15px;
overflow: hidden;
background-color: inherit;

-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-touch-callout: none;
}
.mui-table-view-cell:after {
Expand Down Expand Up @@ -1530,12 +1550,18 @@ input[type="submit"]:active, input[type="submit"].mui-active,
}

.mui-table-view-cell.mui-transitioning > .mui-slider-handle, .mui-table-view-cell.mui-transitioning > .mui-slider-left .mui-btn, .mui-table-view-cell.mui-transitioning > .mui-slider-right .mui-btn {
-webkit-transition: 300ms;
transition: 300ms;
-webkit-transition: -webkit-transform 300ms ease;
transition: transform 300ms ease;
}
.mui-table-view-cell > .mui-slider-handle {
background-color: #fff;
}
.mui-table-view-cell > .mui-slider-handle, .mui-table-view-cell > .mui-slider-left .mui-btn, .mui-table-view-cell > .mui-slider-right .mui-btn {
-webkit-transition: 0ms;
transition: 0ms;
-webkit-transition: -webkit-transform 0ms ease;
transition: transform 0ms ease;

-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.mui-table-view-cell > .mui-slider-left, .mui-table-view-cell > .mui-slider-right {
position: absolute;
Expand All @@ -1544,6 +1570,9 @@ input[type="submit"]:active, input[type="submit"].mui-active,
display: -webkit-flex;
display: flex;
height: 100%;

-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.mui-table-view-cell > .mui-slider-left > .mui-btn, .mui-table-view-cell > .mui-slider-right > .mui-btn {
position: relative;
Expand Down Expand Up @@ -1574,11 +1603,15 @@ input[type="submit"]:active, input[type="submit"].mui-active,
}
.mui-table-view-cell > .mui-slider-right {
right: 0;
-webkit-transition: -webkit-transform 0ms ease;
transition: transform 0ms ease;
-webkit-transform: translateX(100%);
transform: translateX(100%);
}
.mui-table-view-cell > .mui-slider-left {
left: 0;
-webkit-transition: -webkit-transform 0ms ease;
transition: transform 0ms ease;
-webkit-transform: translateX(-100%);
transform: translateX(-100%);
}
Expand Down Expand Up @@ -1919,6 +1952,10 @@ input[type="color"] {
outline: none;
}

input[type=number]::-webkit-outer-spin-button {
margin: 0;
}

input[type="search"] {
height: 34px;
-webkit-box-sizing: border-box;
Expand Down Expand Up @@ -2020,7 +2057,7 @@ select:focus {
}

.mui-input-row:last-child,
.mui-input-row label + input {
.mui-input-row label + input, .mui-input-row .mui-btn + input {
background-image: none;
}

Expand Down Expand Up @@ -2055,6 +2092,22 @@ select:focus {
border: 0;
}

.mui-input-row .mui-btn {
float: right;
width: 15%;
padding: 10px 15px;
font-family: "Helvetica Neue", Helvetica, sans-serif;
line-height: 1.1;
}

.mui-input-row .mui-btn ~ input, .mui-input-row .mui-btn ~ select, .mui-input-row .mui-btn ~ textarea {
float: left;
width: 85%;
padding-left: 0;
margin-bottom: 0;
border: 0;
}

.mui-button-row {
position: relative;
padding-top: 5px;
Expand Down
4 changes: 2 additions & 2 deletions dist/css/mui.min.css

Large diffs are not rendered by default.

60 changes: 41 additions & 19 deletions dist/js/mui.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* =====================================================
* Mui v1.1.1 (https://github.com/dcloudio/mui)
* Mui v1.2.0 (https://github.com/dcloudio/mui)
* =====================================================
*/
/**
Expand Down Expand Up @@ -177,7 +177,8 @@ var mui = (function(document, undefined) {
* map
*/
$.map = function(elements, callback) {
var value, values = [],i, key;
var value, values = [],
i, key;
if (typeof elements.length === 'number') {
for (i = 0, len = elements.length; i < len; i++) {
value = callback(elements[i], i);
Expand Down Expand Up @@ -948,10 +949,21 @@ var mui = (function(document, undefined) {
});
};
var preventDefault = function(e) {
if (e.target && e.target.tagName !== 'INPUT') {
var tagName = e.target && e.target.tagName;
if (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && tagName !== 'SELECT') {
e.preventDefault();
}
};
//增加原生滚动识别
$.isScrolling = false;
var scrollingTimeout = null;
window.addEventListener('scroll', function() {
$.isScrolling = true;
scrollingTimeout && clearTimeout(scrollingTimeout);
scrollingTimeout = setTimeout(function() {
$.isScrolling = false;
}, 250);
});
})(mui, window);
/**
* mui gesture flick[left|right|up|down]
Expand Down Expand Up @@ -1784,10 +1796,10 @@ var mui = (function(document, undefined) {
if (!window.plus) {
return false;
}
var wobj = $.currentWebview;
var wobj = plus.webview.currentWebview();
var parent = wobj.parent();
if (parent) {
parent.evalJS('mui.back();');
parent.evalJS('mui&&mui.back();');
}else{
wobj.canBack(function(e) {
//by chb 暂时注释,在碰到类似popover之类的锚点的时候,需多次点击才能返回;
Expand Down Expand Up @@ -1890,7 +1902,7 @@ var mui = (function(document, undefined) {
downOptions.down = $.extend({}, pullRefreshOptions.down);
downOptions.down.callback = '_CALLBACK';
//父页面初始化pulldown
parent.evalJS("mui(document.querySelector('.mui-content')).pullRefresh('" + JSON.stringify(downOptions) + "')");
parent.evalJS("mui&&mui(document.querySelector('.mui-content')).pullRefresh('" + JSON.stringify(downOptions) + "')");
}
}
});
Expand Down Expand Up @@ -2676,8 +2688,9 @@ var mui = (function(document, undefined) {
if (this.options.scrollX) {
this.wrapper.addEventListener('swiperight', this);
}
if (this.wrapper.classList.contains('mui-segmented-control')) { //靠,这个bug排查了一下午
mui(this.wrapper).on('click', 'a', $.preventDefault);
var segmentedControl = this.wrapper.querySelector('.mui-segmented-control');
if (segmentedControl) { //靠,这个bug排查了一下午,阻止hash跳转,一旦hash跳转会导致可拖拽选项卡的tab不见
mui(segmentedControl).on('click', 'a', $.preventDefault);
}
},
handleEvent: function(e) {
Expand Down Expand Up @@ -3059,23 +3072,29 @@ var mui = (function(document, undefined) {
duration: duration
};
},
_getTranslateStr: function(x, y) {
if (this.options.hardwareAccelerated) {
return 'translate3d(' + x + 'px,' + y + 'px,0px) ' + this.translateZ;
}
return 'translate(' + x + 'px,' + y + 'px) ';
},
//API
setStopped: function(stopped) {
this.stopped = !!stopped;
},
setTranslate: function(x, y) {
this.x = x;
this.y = y;
this.scrollerStyle['webkitTransform'] = 'translate3d(' + x + 'px,' + y + 'px,0px)' + this.translateZ;
this.scrollerStyle['webkitTransform'] = this._getTranslateStr(x, y);
if (this.parallaxElement && this.options.scrollY) { //目前仅支持竖向视差效果
var parallaxY = y * this.options.parallaxRatio;
var scale = 1 + parallaxY / ((this.parallaxHeight - parallaxY) / 2);
if (scale > 1) {
this.parallaxImgStyle['opacity'] = 1 - parallaxY / 100 * this.options.parallaxRatio;
this.parallaxStyle['webkitTransform'] = 'translate3d(0px,' + -parallaxY + 'px,0px) scale(' + scale + ',' + scale + ') ' + this.translateZ;
this.parallaxStyle['webkitTransform'] = this._getTranslateStr(0, -parallaxY) + ' scale(' + scale + ',' + scale + ')';
} else {
this.parallaxImgStyle['opacity'] = 1;
this.parallaxStyle['webkitTransform'] = 'translate3d(0px,-10px,0px) scale(1,1) ' + this.translateZ;
this.parallaxStyle['webkitTransform'] = this._getTranslateStr(0, -10) + ' scale(1,1)';
}
}
if (this.indicators) {
Expand Down Expand Up @@ -3276,7 +3295,7 @@ var mui = (function(document, undefined) {
this.x = x;
this.y = y;

this.indicatorStyle['webkitTransform'] = 'translate3d(' + x + 'px,' + y + 'px,0px)' + this.scroller.translateZ;
this.indicatorStyle['webkitTransform'] = this.scroller._getTranslateStr(x, y);

},
fade: function(val, hold) {
Expand Down Expand Up @@ -3761,7 +3780,7 @@ var mui = (function(document, undefined) {
this._super(x, y);
var progressBar = this.progressBar;
if (progressBar) {
this.progressBarStyle.webkitTransform = 'translate3d(' + (-x * (this.progressBarWidth / this.wrapperWidth)) + 'px,0,0)';
this.progressBarStyle.webkitTransform = this._getTranslateStr((-x * (this.progressBarWidth / this.wrapperWidth)), 0);
}
},
resetPosition: function(time) {
Expand Down Expand Up @@ -3885,7 +3904,7 @@ var mui = (function(document, undefined) {
break;
case "dragEndAfterChangeOffset": //正在刷新状态
//执行下拉刷新所在webview的回调函数
webview.evalJS("mui.options.pullRefresh.down.callback()");
webview.evalJS("mui&&mui.options.pullRefresh.down.callback()");
self._setCaption(downOptions.contentrefresh);
break;
default:
Expand Down Expand Up @@ -3964,7 +3983,7 @@ var mui = (function(document, undefined) {
},
endPulldownToRefresh: function() { //该方法是子页面调用的
var webview = plus.webview.currentWebview();
webview.parent().evalJS("mui(document.querySelector('.mui-content')).pullRefresh('" + JSON.stringify({
webview.parent().evalJS("mui&&mui(document.querySelector('.mui-content')).pullRefresh('" + JSON.stringify({
webviewId: webview.id
}) + "')._endPulldownToRefresh()");
},
Expand Down Expand Up @@ -4132,7 +4151,10 @@ var mui = (function(document, undefined) {
handleEvent: function(e) {
switch (e.type) {
case 'touchstart':
e.preventDefault();
var tagName = e.target && e.target.tagName;
if (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && tagName !== 'SELECT') {
e.preventDefault();
}
break;
case 'webkitTransitionEnd': //有个bug需要处理,需要考虑假设没有触发webkitTransitionEnd的情况
if (e.target === this.scroller) {
Expand Down Expand Up @@ -4164,10 +4186,10 @@ var mui = (function(document, undefined) {
if (this.scroller) {
this.startX = this.lastX;
this.isDragging = true;

$.gestures.touch.lockDirection = true; //锁定方向
$.gestures.touch.startDirection = detail.direction;

this.scroller.classList.remove(CLASS_TRANSITIONING);
this.offsetX = this.getTranslateX();
this._initOffCanvasVisible();
Expand Down Expand Up @@ -5932,4 +5954,4 @@ var mui = (function(document, undefined) {
$.ready(function() {
$('.mui-input-row input').input();
});
})(mui, window, document);
})(mui, window, document);
8 changes: 4 additions & 4 deletions dist/js/mui.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/hello-mui/css/mui.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit e46bc67

Please sign in to comment.