Commit 4ed07d11 authored by hbcui1984's avatar hbcui1984

mui.openWindow方法增加crateNew参数说明

parent c12201a5
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/mui.min.css?v=2015-04-20 12:10:17 +0800"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/mui.min.css?v=2015-06-15 12:03:29 +0800">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/assets/css/docs.css?v=2015-04-20 12:10:17 +0800"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/assets/css/docs.css?v=2015-06-15 12:03:29 +0800">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://dcloudio.github.io/mui/assets/img/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://dcloudio.github.io/mui/assets/img/apple-touch-icon-114x114.png">
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
<p class="docs-footer-text">mui遵循 <a href="https://github.com/dcloudio/mui/blob/master/LICENSE">MIT License</a> <p class="docs-footer-text">mui遵循 <a href="https://github.com/dcloudio/mui/blob/master/LICENSE">MIT License</a>
</p> </p>
<ul class="docs-footer-links"> <ul class="docs-footer-links">
<li>最新版本 v1.5.0</li> <li>最新版本 v1.8.0</li>
<li>&middot;</li> <li>&middot;</li>
<li><a href="http://ask.dcloud.net.cn">问答社区</a></li> <li><a href="http://ask.dcloud.net.cn">问答社区</a></li>
<li>&middot;</li> <li>&middot;</li>
...@@ -147,8 +147,8 @@ ...@@ -147,8 +147,8 @@
</div> </div>
<script src="http://dcloudio.github.io/mui/dist/js/jquery-2.1.1.js"></script> <script src="http://dcloudio.github.io/mui/dist/js/jquery-2.1.1.js"></script>
<script src="http://dcloudio.github.io/mui/dist/js/bootstrap.min.js"></script> <script src="http://dcloudio.github.io/mui/dist/js/bootstrap.min.js"></script>
<script src="http://dcloudio.github.io/mui/dist/js/mui.min.js?v=2015-04-20 12:10:17 +0800"></script> <script src="http://dcloudio.github.io/mui/dist/js/mui.min.js?v=2015-06-15 12:03:29 +0800"></script>
<script src="http://dcloudio.github.io/mui/assets/js/docs.min.js?v=2015-04-20 12:10:17 +0800"></script> <script src="http://dcloudio.github.io/mui/assets/js/docs.min.js?v=2015-06-15 12:03:29 +0800"></script>
<script type="text/javascript"> <script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://"); var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Ffff299fda9ff2d5ac97d9e621f738e52' type='text/javascript'%3E%3C/script%3E")); document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Ffff299fda9ff2d5ac97d9e621f738e52' type='text/javascript'%3E%3C/script%3E"));
......
/*! /*!
* ===================================================== * =====================================================
* Mui v1.5.0 (https://github.com/dcloudio/mui) * Mui v1.8.0 (https://github.com/dcloudio/mui)
* ===================================================== * =====================================================
*/ */
...@@ -231,7 +231,7 @@ body { ...@@ -231,7 +231,7 @@ body {
font-size: 17px; font-size: 17px;
line-height: 21px; line-height: 21px;
color: #000; color: #000;
background-color: #fff; background-color: #efeff4;
} }
a { a {
...@@ -406,6 +406,10 @@ a:active { ...@@ -406,6 +406,10 @@ a:active {
border-radius: 6px; border-radius: 6px;
} }
.mui-subtitle {
font-size: 15px;
}
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
...@@ -755,51 +759,39 @@ p { ...@@ -755,51 +759,39 @@ p {
0% { 0% {
-webkit-transform: rotate(0deg); -webkit-transform: rotate(0deg);
} }
8.33333333% { 8.33333333% {
-webkit-transform: rotate(30deg); -webkit-transform: rotate(30deg);
} }
16.66666667% { 16.66666667% {
-webkit-transform: rotate(60deg); -webkit-transform: rotate(60deg);
} }
25% { 25% {
-webkit-transform: rotate(90deg); -webkit-transform: rotate(90deg);
} }
33.33333333% { 33.33333333% {
-webkit-transform: rotate(120deg); -webkit-transform: rotate(120deg);
} }
41.66666667% { 41.66666667% {
-webkit-transform: rotate(150deg); -webkit-transform: rotate(150deg);
} }
50% { 50% {
-webkit-transform: rotate(180deg); -webkit-transform: rotate(180deg);
} }
58.33333333% { 58.33333333% {
-webkit-transform: rotate(210deg); -webkit-transform: rotate(210deg);
} }
66.66666667% { 66.66666667% {
-webkit-transform: rotate(240deg); -webkit-transform: rotate(240deg);
} }
75% { 75% {
-webkit-transform: rotate(270deg); -webkit-transform: rotate(270deg);
} }
83.33333333% { 83.33333333% {
-webkit-transform: rotate(300deg); -webkit-transform: rotate(300deg);
} }
91.66666667% { 91.66666667% {
-webkit-transform: rotate(330deg); -webkit-transform: rotate(330deg);
} }
100% { 100% {
-webkit-transform: rotate(360deg); -webkit-transform: rotate(360deg);
} }
...@@ -808,51 +800,39 @@ p { ...@@ -808,51 +800,39 @@ p {
0% { 0% {
transform: rotate(0deg); transform: rotate(0deg);
} }
8.33333333% { 8.33333333% {
transform: rotate(30deg); transform: rotate(30deg);
} }
16.66666667% { 16.66666667% {
transform: rotate(60deg); transform: rotate(60deg);
} }
25% { 25% {
transform: rotate(90deg); transform: rotate(90deg);
} }
33.33333333% { 33.33333333% {
transform: rotate(120deg); transform: rotate(120deg);
} }
41.66666667% { 41.66666667% {
transform: rotate(150deg); transform: rotate(150deg);
} }
50% { 50% {
transform: rotate(180deg); transform: rotate(180deg);
} }
58.33333333% { 58.33333333% {
transform: rotate(210deg); transform: rotate(210deg);
} }
66.66666667% { 66.66666667% {
transform: rotate(240deg); transform: rotate(240deg);
} }
75% { 75% {
transform: rotate(270deg); transform: rotate(270deg);
} }
83.33333333% { 83.33333333% {
transform: rotate(300deg); transform: rotate(300deg);
} }
91.66666667% { 91.66666667% {
transform: rotate(330deg); transform: rotate(330deg);
} }
100% { 100% {
transform: rotate(360deg); transform: rotate(360deg);
} }
...@@ -1083,7 +1063,7 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled, ...@@ -1083,7 +1063,7 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled,
height: 44px; height: 44px;
padding-right: 10px; padding-right: 10px;
padding-left: 10px; padding-left: 10px;
background-color: rgba(247, 247, 247, .98); background-color: #f7f7f7;
border-bottom: 0; border-bottom: 0;
-webkit-box-shadow: 0 0 1px rgba(0, 0, 0, .85); -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, .85);
box-shadow: 0 0 1px rgba(0, 0, 0, .85); box-shadow: 0 0 1px rgba(0, 0, 0, .85);
...@@ -1095,6 +1075,7 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled, ...@@ -1095,6 +1075,7 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled,
.mui-bar .mui-title { .mui-bar .mui-title {
right: 40px; right: 40px;
left: 40px; left: 40px;
display: inline-block;
width: auto; width: auto;
margin: 0; margin: 0;
overflow: hidden; overflow: hidden;
...@@ -1205,10 +1186,14 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled, ...@@ -1205,10 +1186,14 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled,
background: none; background: none;
} }
.mui-focusin > .mui-bar { .mui-focusin > .mui-bar-nav, .mui-focusin > .mui-bar-header-secondary {
position: absolute; position: absolute;
} }
.mui-focusin > .mui-bar ~ .mui-content {
padding-bottom: 0;
}
.mui-bar .mui-btn { .mui-bar .mui-btn {
position: relative; position: relative;
top: 7px; top: 7px;
...@@ -1387,7 +1372,7 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled, ...@@ -1387,7 +1372,7 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled,
.mui-card { .mui-card {
margin: 0 15px; margin: 0 15px;
overflow: hidden; overflow: hidden;
background-color: white; background-color: #fff;
background-clip: padding-box; background-clip: padding-box;
border: 1px solid #ddd; border: 1px solid #ddd;
border-radius: 6px; border-radius: 6px;
...@@ -1458,6 +1443,16 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled, ...@@ -1458,6 +1443,16 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled,
transform: scaleY(.5); transform: scaleY(.5);
} }
.mui-table-view-icon .mui-table-view-cell .mui-navigate-right .mui-icon {
margin-top: -1px;
margin-right: 5px;
margin-left: -5px;
font-size: 20px;
}
.mui-table-view-icon .mui-table-view-cell:after {
left: 40px;
}
.mui-table-view-chevron .mui-table-view-cell { .mui-table-view-chevron .mui-table-view-cell {
padding-right: 65px; padding-right: 65px;
} }
...@@ -1465,6 +1460,23 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled, ...@@ -1465,6 +1460,23 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled,
margin-right: -65px; margin-right: -65px;
} }
.mui-table-view-radio .mui-table-view-cell {
padding-right: 65px;
}
.mui-table-view-radio .mui-table-view-cell > a:not(.mui-btn) {
margin-right: -65px;
}
.mui-table-view-radio .mui-table-view-cell .mui-navigate-right:after {
right: 9px;
font-size: 30px;
font-weight: 600;
color: #007aff;
content: '';
}
.mui-table-view-radio .mui-table-view-cell.mui-selected .mui-navigate-right:after {
content: '\e472';
}
.mui-table-view-inverted { .mui-table-view-inverted {
color: #fff; color: #fff;
background: #333; background: #333;
...@@ -1564,9 +1576,16 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled, ...@@ -1564,9 +1576,16 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled,
-webkit-transition: -webkit-transform 300ms ease; -webkit-transition: -webkit-transform 300ms ease;
transition: transform 300ms ease; transition: transform 300ms ease;
} }
.mui-table-view-cell.mui-active > .mui-slider-handle {
background-color: #eee;
}
.mui-table-view-cell > .mui-slider-handle { .mui-table-view-cell > .mui-slider-handle {
position: relative;
background-color: #fff; background-color: #fff;
} }
.mui-table-view-cell > .mui-slider-handle.mui-navigate-right:after, .mui-table-view-cell > .mui-slider-handle .mui-navigate-right:after {
right: 0;
}
.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 { .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: -webkit-transform 0ms ease; -webkit-transition: -webkit-transform 0ms ease;
transition: transform 0ms ease; transition: transform 0ms ease;
...@@ -1670,6 +1689,14 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled, ...@@ -1670,6 +1689,14 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled,
overflow: hidden; overflow: hidden;
} }
.mui-table-view .mui-media-large .mui-media-object {
max-width: 80px;
height: 80px;
line-height: 80px;
}
.mui-table-view .mui-media .mui-subtitle {
color: #000;
}
.mui-table-view .mui-media-object { .mui-table-view .mui-media-object {
max-width: 42px; max-width: 42px;
height: 42px; height: 42px;
...@@ -1774,6 +1801,9 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled, ...@@ -1774,6 +1801,9 @@ input[type="submit"]:enabled:active, input[type="submit"].mui-active:enabled,
margin-top: 15px; margin-top: 15px;
} }
.mui-table-view-cell.mui-collapse .mui-table-view:after {
left: 15px;
}
.mui-table-view-cell.mui-collapse > .mui-navigate-right:after, .mui-table-view-cell.mui-collapse > .mui-push-right:after { .mui-table-view-cell.mui-collapse > .mui-navigate-right:after, .mui-table-view-cell.mui-collapse > .mui-push-right:after {
content: '\e581'; content: '\e581';
} }
...@@ -1966,7 +1996,9 @@ input[type="color"] { ...@@ -1966,7 +1996,9 @@ input[type="color"] {
outline: none; outline: none;
} }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0; margin: 0;
} }
...@@ -2030,7 +2062,7 @@ select:focus { ...@@ -2030,7 +2062,7 @@ select:focus {
transform: scaleY(.5); transform: scaleY(.5);
} }
.mui-input-group input[type=text], .mui-input-group input,
.mui-input-group textarea { .mui-input-group textarea {
margin-bottom: 0; margin-bottom: 0;
background-color: transparent; background-color: transparent;
...@@ -2039,18 +2071,6 @@ select:focus { ...@@ -2039,18 +2071,6 @@ select:focus {
-webkit-box-shadow: none; -webkit-box-shadow: none;
box-shadow: none; box-shadow: none;
} }
.mui-input-group input[type=text]:after,
.mui-input-group textarea:after {
position: absolute;
right: 0;
bottom: 0;
left: 15px;
height: 1px;
content: '';
background-color: #c8c7cc;
-webkit-transform: scaleY(.5);
transform: scaleY(.5);
}
.mui-input-group input[type="search"] { .mui-input-group input[type="search"] {
background: none; background: none;
...@@ -2072,7 +2092,7 @@ select:focus { ...@@ -2072,7 +2092,7 @@ select:focus {
.mui-input-row:last-child, .mui-input-row:last-child,
.mui-input-row label + input, .mui-input-row .mui-btn + input { .mui-input-row label + input, .mui-input-row .mui-btn + input {
background-image: none; background: none;
} }
.mui-input-group .mui-input-row { .mui-input-group .mui-input-row {
...@@ -2180,6 +2200,7 @@ select:focus { ...@@ -2180,6 +2200,7 @@ select:focus {
display: inline-block; display: inline-block;
float: none; float: none;
width: 100%; width: 100%;
padding-right: 58px;
} }
.mui-radio.mui-left input[type="radio"], .mui-checkbox.mui-left input[type="checkbox"] { .mui-radio.mui-left input[type="radio"], .mui-checkbox.mui-left input[type="checkbox"] {
...@@ -2187,6 +2208,7 @@ select:focus { ...@@ -2187,6 +2208,7 @@ select:focus {
} }
.mui-radio.mui-left label, .mui-checkbox.mui-left label { .mui-radio.mui-left label, .mui-checkbox.mui-left label {
padding-right: 15px;
padding-left: 58px; padding-left: 58px;
} }
...@@ -2202,12 +2224,15 @@ select:focus { ...@@ -2202,12 +2224,15 @@ select:focus {
border: 0; border: 0;
outline: 0 !important; outline: 0 !important;
} }
.mui-radio input[type="radio"][disabled]:before, .mui-checkbox input[type="checkbox"][disabled]:before {
opacity: .3;
}
.mui-radio input[type="radio"]:before, .mui-checkbox input[type="checkbox"]:before { .mui-radio input[type="radio"]:before, .mui-checkbox input[type="checkbox"]:before {
font-family: Muiicons; font-family: Muiicons;
font-size: 28px; font-size: 28px;
font-weight: normal; font-weight: normal;
line-height: 1; line-height: 1;
color: rgba(170, 170, 170, .6); color: #aaa;
text-decoration: none; text-decoration: none;
background: none; background: none;
border-radius: 0; border-radius: 0;
...@@ -2218,6 +2243,10 @@ select:focus { ...@@ -2218,6 +2243,10 @@ select:focus {
color: #007aff; color: #007aff;
} }
.mui-radio.mui-disabled label, .mui-radio label.mui-disabled, .mui-checkbox.mui-disabled label, .mui-checkbox label.mui-disabled {
opacity: .4;
}
.mui-radio input[type="radio"]:before { .mui-radio input[type="radio"]:before {
content: "\e411"; content: "\e411";
} }
...@@ -2503,7 +2532,7 @@ select:focus { ...@@ -2503,7 +2532,7 @@ select:focus {
z-index: 999; z-index: 999;
display: none; display: none;
width: 280px; width: 280px;
background-color: rgba(247, 247, 247, .98); background-color: #f7f7f7;
border-radius: 7px; border-radius: 7px;
-webkit-box-shadow: 0 0 15px rgba(0, 0, 0, .1); -webkit-box-shadow: 0 0 15px rgba(0, 0, 0, .1);
box-shadow: 0 0 15px rgba(0, 0, 0, .1); box-shadow: 0 0 15px rgba(0, 0, 0, .1);
...@@ -2531,7 +2560,7 @@ select:focus { ...@@ -2531,7 +2560,7 @@ select:focus {
width: 26px; width: 26px;
height: 26px; height: 26px;
content: ' '; content: ' ';
background: rgba(247, 247, 247, .98); background: #f7f7f7;
border-radius: 3px; border-radius: 3px;
-webkit-transform: rotate(45deg); -webkit-transform: rotate(45deg);
transform: rotate(45deg); transform: rotate(45deg);
...@@ -2657,7 +2686,7 @@ select:focus { ...@@ -2657,7 +2686,7 @@ select:focus {
margin-bottom: 0; margin-bottom: 0;
overflow: auto; overflow: auto;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
background-color: rgba(247, 247, 247, .98); background-color: #f7f7f7;
background-image: none; background-image: none;
border-radius: 7px; border-radius: 7px;
} }
...@@ -2994,8 +3023,8 @@ select:focus { ...@@ -2994,8 +3023,8 @@ select:focus {
content: "Off"; content: "Off";
} }
.mui-switch.mui-dragging { .mui-switch.mui-dragging {
background-color: rgba(247, 247, 247, .98); background-color: #f7f7f7;
border-color: rgba(247, 247, 247, .98); border-color: #f7f7f7;
} }
.mui-switch.mui-dragging .mui-switch-handle { .mui-switch.mui-dragging .mui-switch-handle {
width: 38px; width: 38px;
...@@ -3009,8 +3038,8 @@ select:focus { ...@@ -3009,8 +3038,8 @@ select:focus {
border-color: #4cd964; border-color: #4cd964;
} }
.mui-switch.mui-active .mui-switch-handle { .mui-switch.mui-active .mui-switch-handle {
-webkit-transform: translate3d(43px, 0, 0); -webkit-transform: translate(43px, 0);
transform: translate3d(43px, 0, 0); transform: translate(43px, 0);
} }
.mui-switch.mui-active:before { .mui-switch.mui-active:before {
right: auto; right: auto;
...@@ -3029,8 +3058,8 @@ select:focus { ...@@ -3029,8 +3058,8 @@ select:focus {
display: none; display: none;
} }
.mui-switch-mini.mui-active .mui-switch-handle { .mui-switch-mini.mui-active .mui-switch-handle {
-webkit-transform: translate3d(16px, 0, 0); -webkit-transform: translate(16px, 0);
transform: translate3d(16px, 0, 0); transform: translate(16px, 0);
} }
.mui-switch-blue.mui-active { .mui-switch-blue.mui-active {
...@@ -3192,6 +3221,71 @@ select:focus { ...@@ -3192,6 +3221,71 @@ select:focus {
border-radius: 7px; border-radius: 7px;
} }
.mui-numbox {
position: relative;
display: inline-block;
width: 120px;
height: 35px;
padding: 0 40px 0 40px;
overflow: hidden;
vertical-align: top;
vertical-align: middle;
background-color: #efeff4;
border: solid 1px #bbb;
border-radius: 3px;
}
.mui-numbox [class*=mui-numbox-btn] {
position: absolute;
top: 0;
width: 40px;
height: 100%;
padding: 0;
overflow: hidden;
font-size: 18px;
font-weight: normal;
line-height: 100%;
color: #555;
background-color: #f9f9f9;
border: none;
border-radius: 0;
}
.mui-numbox [class*=mui-numbox-btn]:active {
background-color: #ccc;
}
.mui-numbox [class*=mui-numbox-btn][disabled] {
color: #c0c0c0;
}
.mui-numbox .mui-numbox-btn-plus {
right: 0;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.mui-numbox .mui-numbox-btn-minus {
left: 0;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
}
.mui-numbox .mui-numbox-input {
display: inline-block;
width: 100% !important;
height: 100%;
padding: 0 3px !important;
margin: 0;
overflow: hidden;
text-align: center;
text-overflow: ellipsis;
word-break: normal;
border: none !important;
border-right: solid 1px #ccc !important;
border-left: solid 1px #ccc !important;
border-radius: 0 !important;
}
.mui-input-row .mui-numbox {
float: right;
margin: 2px 8px;
}
@font-face { @font-face {
font-family: Muiicons; font-family: Muiicons;
font-style: normal; font-style: normal;
...@@ -3579,6 +3673,11 @@ select:focus { ...@@ -3579,6 +3673,11 @@ select:focus {
-webkit-transform: translateY(-50%); -webkit-transform: translateY(-50%);
transform: translateY(-50%); transform: translateY(-50%);
} }
.mui-fullscreen .mui-off-canvas-wrap .mui-slider-item > a {
top: auto;
-webkit-transform: none;
transform: none;
}
.mui-bar-tab ~ .mui-content .mui-slider.mui-fullscreen .mui-segmented-control ~ .mui-slider-group { .mui-bar-tab ~ .mui-content .mui-slider.mui-fullscreen .mui-segmented-control ~ .mui-slider-group {
bottom: 50px; bottom: 50px;
...@@ -3588,3 +3687,26 @@ select:focus { ...@@ -3588,3 +3687,26 @@ select:focus {
.mui-android.mui-android-4-0 textarea:focus { .mui-android.mui-android-4-0 textarea:focus {
-webkit-user-modify: inherit; -webkit-user-modify: inherit;
} }
.mui-ios .mui-table-view-cell {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.mui-plus-visible, .mui-wechat-visible {
display: none !important;
}
.mui-plus-hidden, .mui-wechat-hidden {
display: block !important;
}
.mui-plus .mui-plus-visible, .mui-wechat .mui-wechat-visible {
display: block !important;
}
.mui-plus .mui-plus-hidden, .mui-wechat .mui-wechat-hidden {
display: none !important;
}
/*# sourceMappingURL=mui.css.map */
This source diff could not be displayed because it is too large. You can view the blob instead.
/*! /*!
* ===================================================== * =====================================================
* Mui v1.5.0 (https://github.com/dcloudio/mui) * Mui v1.8.0 (https://github.com/dcloudio/mui)
* ===================================================== * =====================================================
*/ */
/** /**
...@@ -114,6 +114,10 @@ var mui = (function(document, undefined) { ...@@ -114,6 +114,10 @@ var mui = (function(document, undefined) {
* mui slice(array) * mui slice(array)
*/ */
$.slice = [].slice; $.slice = [].slice;
/**
* mui filter(array)
*/
$.filter = [].filter;
$.type = function(obj) { $.type = function(obj) {
return obj == null ? String(obj) : class2type[{}.toString.call(obj)] || "object"; return obj == null ? String(obj) : class2type[{}.toString.call(obj)] || "object";
...@@ -143,6 +147,18 @@ var mui = (function(document, undefined) { ...@@ -143,6 +147,18 @@ var mui = (function(document, undefined) {
$.isPlainObject = function(obj) { $.isPlainObject = function(obj) {
return $.isObject(obj) && !$.isWindow(obj) && Object.getPrototypeOf(obj) === Object.prototype; return $.isObject(obj) && !$.isWindow(obj) && Object.getPrototypeOf(obj) === Object.prototype;
}; };
/**
* mui isEmptyObject
* @param {Object} o
*/
$.isEmptyObject = function(o) {
for (var p in o) {
if (p !== undefined) {
return false;
}
}
return true;
};
/** /**
* mui isFunction * mui isFunction
*/ */
...@@ -199,7 +215,7 @@ var mui = (function(document, undefined) { ...@@ -199,7 +215,7 @@ var mui = (function(document, undefined) {
* @param {type} callback * @param {type} callback
* @returns {_L8.$} * @returns {_L8.$}
*/ */
$.each = function(elements, callback) { $.each = function(elements, callback, hasOwnProperty) {
if (!elements) { if (!elements) {
return this; return this;
} }
...@@ -209,8 +225,14 @@ var mui = (function(document, undefined) { ...@@ -209,8 +225,14 @@ var mui = (function(document, undefined) {
}); });
} else { } else {
for (var key in elements) { for (var key in elements) {
if (hasOwnProperty) {
if (elements.hasOwnProperty(key)) {
if (callback.call(elements[key], key, elements[key]) === false) return elements; if (callback.call(elements[key], key, elements[key]) === false) return elements;
} }
} else {
if (callback.call(elements[key], key, elements[key]) === false) return elements;
}
}
} }
return this; return this;
}; };
...@@ -317,6 +339,40 @@ var mui = (function(document, undefined) { ...@@ -317,6 +339,40 @@ var mui = (function(document, undefined) {
$[type] = handlers; $[type] = handlers;
return $[type]; return $[type];
}; };
/**
* setTimeout封装
* @param {Object} fn
* @param {Object} when
* @param {Object} context
* @param {Object} data
*/
$.later = function(fn, when, context, data) {
when = when || 0;
var m = fn;
var d = data;
var f;
var r;
if (typeof fn === 'string') {
m = context[fn];
}
f = function() {
m.apply(context, $.isArray(d) ? d : [d]);
};
r = setTimeout(f, when);
return {
id: r,
cancel: function() {
clearTimeout(r);
}
};
};
$.now = Date.now || function() {
return +new Date();
};
var class2type = {}; var class2type = {};
$.each(['Boolean', 'Number', 'String', 'Function', 'Array', 'Date', 'RegExp', 'Object', 'Error'], function(i, name) { $.each(['Boolean', 'Number', 'String', 'Function', 'Array', 'Date', 'RegExp', 'Object', 'Error'], function(i, name) {
class2type["[object " + name + "]"] = name.toLowerCase(); class2type["[object " + name + "]"] = name.toLowerCase();
...@@ -335,6 +391,16 @@ var mui = (function(document, undefined) { ...@@ -335,6 +391,16 @@ var mui = (function(document, undefined) {
return this; return this;
} }
}; };
/**
* 兼容 AMD 模块
**/
if (typeof define === 'function' && define.amd) {
define('mui', [], function() {
return $;
});
}
return $; return $;
})(document); })(document);
//window.mui = mui; //window.mui = mui;
...@@ -349,6 +415,15 @@ var mui = (function(document, undefined) { ...@@ -349,6 +415,15 @@ var mui = (function(document, undefined) {
this.os = {}; this.os = {};
var funcs = [ var funcs = [
function() { //wechat
var wechat = ua.match(/(MicroMessenger)\/([\d\.]+)/i);
if (wechat) { //wechat
this.os.wechat = {
version: wechat[2].replace(/_/g, '.')
};
}
return false;
},
function() { //android function() { //android
var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
if (android) { if (android) {
...@@ -385,17 +460,19 @@ var mui = (function(document, undefined) { ...@@ -385,17 +460,19 @@ var mui = (function(document, undefined) {
* @param {type} $ * @param {type} $
* @returns {undefined} * @returns {undefined}
*/ */
(function($) { (function($, document) {
function detect(ua) { function detect(ua) {
this.os = this.os || {}; this.os = this.os || {};
var plus = ua.match(/Html5Plus/i);//TODO 5\+Browser? var plus = ua.match(/Html5Plus/i); //TODO 5\+Browser?
if (plus) { if (plus) {
this.os.plus = true; this.os.plus = true;
$(function() {
document.body.classList.add('mui-plus');
});
} }
} }
detect.call($, navigator.userAgent); detect.call($, navigator.userAgent);
})(mui); })(mui, document);
/** /**
* mui target(action>popover>modal>tab>toggle) * mui target(action>popover>modal>tab>toggle)
*/ */
...@@ -582,7 +659,7 @@ var mui = (function(document, undefined) { ...@@ -582,7 +659,7 @@ var mui = (function(document, undefined) {
target = target.parentNode.querySelector('input'); target = target.parentNode.querySelector('input');
} }
} }
if (target.type === 'radio' || target.type === 'checkbox') { if (target && (target.type === 'radio' || target.type === 'checkbox')) {
if (!target.disabled) { //disabled if (!target.disabled) { //disabled
return target; return target;
} }
...@@ -610,6 +687,7 @@ var mui = (function(document, undefined) { ...@@ -610,6 +687,7 @@ var mui = (function(document, undefined) {
clickEvent.initMouseEvent('click', true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null); clickEvent.initMouseEvent('click', true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
clickEvent.forwardedTouchEvent = true; clickEvent.forwardedTouchEvent = true;
targetElement.dispatchEvent(clickEvent); targetElement.dispatchEvent(clickEvent);
event.detail && event.detail.gesture.preventDefault();
} }
}; };
window.addEventListener('tap', dispatchEvent); window.addEventListener('tap', dispatchEvent);
...@@ -655,7 +733,7 @@ var mui = (function(document, undefined) { ...@@ -655,7 +733,7 @@ var mui = (function(document, undefined) {
} }
} }
var target = e.target; var target = e.target;
if (target.tagName && target.tagName === 'INPUT' && target.type === 'text') { if (target.tagName && target.tagName === 'INPUT' && (target.type === 'text' || target.type === 'search' || target.type === 'number')) {
if (target.disabled || target.readOnly) { if (target.disabled || target.readOnly) {
return; return;
} }
...@@ -724,6 +802,175 @@ var mui = (function(document, undefined) { ...@@ -724,6 +802,175 @@ var mui = (function(document, undefined) {
}; };
})(mui); })(mui);
/**
* 仅提供简单的on,off(仅支持事件委托,不支持当前元素绑定,当前元素绑定请直接使用addEventListener,removeEventListener)
* @param {Object} $
*/
(function($) {
var _mid = 1;
var delegates = {};
//需要wrap的函数
var eventMethods = {
preventDefault: 'isDefaultPrevented',
stopImmediatePropagation: 'isImmediatePropagationStopped',
stopPropagation: 'isPropagationStopped'
};
//默认true返回函数
var returnTrue = function() {
return true
};
//默认false返回函数
var returnFalse = function() {
return false
};
//wrap浏览器事件
var compatible = function(event, target) {
if (!event.detail) {
event.detail = {
currentTarget: target
};
} else {
event.detail.currentTarget = target;
}
$.each(eventMethods, function(name, predicate) {
var sourceMethod = event[name];
event[name] = function() {
this[predicate] = returnTrue;
return sourceMethod && sourceMethod.apply(event, arguments)
}
event[predicate] = returnFalse;
}, true);
return event;
};
//简单的wrap对象_mid
var mid = function(obj) {
return obj && (obj._mid || (obj._mid = _mid++));
};
//事件委托对象绑定的事件回调列表
var delegateFns = {};
//返回事件委托的wrap事件回调
var delegateFn = function(element, event, selector, callback) {
return function(e) {
//same event
var callbackObjs = delegates[element._mid][event];
var handlerQueue = [];
var target = e.target;
var selectorAlls = {};
for (; target && target !== document; target = target.parentNode) {
if (target === element) {
break;
}
if (~['click', 'tap', 'doubletap', 'longtap', 'hold'].indexOf(event) && (target.disabled || target.classList.contains('mui-disabled'))) {
break;
}
var matches = {};
$.each(callbackObjs, function(selector, callbacks) { //same selector
selectorAlls[selector] || (selectorAlls[selector] = $.qsa(selector, element));
if (selectorAlls[selector] && ~(selectorAlls[selector]).indexOf(target)) {
if (!matches[selector]) {
matches[selector] = callbacks;
}
}
}, true);
if (!$.isEmptyObject(matches)) {
handlerQueue.push({
element: target,
handlers: matches
});
}
}
selectorAlls = null;
e = compatible(e); //compatible event
$.each(handlerQueue, function(index, handler) {
target = handler.element;
var tagName = target.tagName;
if (event === 'tap' && (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && tagName !== 'SELECT')) {
e.preventDefault();
e.detail && e.detail.gesture && e.detail.gesture.preventDefault();
}
$.each(handler.handlers, function(index, handler) {
$.each(handler, function(index, callback) {
if (callback.call(target, e) === false) {
e.preventDefault();
e.stopPropagation();
}
}, true);
}, true)
if (e.isPropagationStopped()) {
return false;
}
}, true);
};
};
var preventDefaultException = /^(INPUT|TEXTAREA|BUTTON|SELECT)$/;
/**
* mui delegate events
* @param {type} event
* @param {type} selector
* @param {type} callback
* @returns {undefined}
*/
$.fn.on = function(event, selector, callback) { //仅支持简单的事件委托,主要是tap事件使用,类似mouse,focus之类暂不封装支持
return this.each(function() {
var element = this;
mid(element);
mid(callback);
var isAddEventListener = false;
var delegateEvents = delegates[element._mid] || (delegates[element._mid] = {});
var delegateCallbackObjs = delegateEvents[event] || ((delegateEvents[event] = {}));
if ($.isEmptyObject(delegateCallbackObjs)) {
isAddEventListener = true;
}
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)]);
if (event === 'tap') { //TODO 需要找个更好的解决方案
element.addEventListener('click', function(e) {
if (e.target) {
var tagName = e.target.tagName;
if (!preventDefaultException.test(tagName)) {
if (tagName === 'A') {
var href = e.target.href;
if (!(href && ~href.indexOf('tel:'))) {
e.preventDefault();
}
} else {
e.preventDefault();
}
}
}
});
}
}
});
};
$.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 {
var delegateCallbacks = delegates[_mid] && delegates[_mid][event] && delegates[_mid][event][selector];
$.each(delegateCallbacks, function(index, delegateCallback) {
if (mid(delegateCallback) === mid(callback)) {
delegateCallbacks.splice(index, 1);
return false;
}
}, true);
}
//如果off掉了所有当前element的指定的event事件,则remove掉当前element的delegate回调
if (delegates[_mid] && $.isEmptyObject(delegates[_mid][event])) {
this.removeEventListener(event, delegateFns[_mid]);
delete delegateFns[_mid];
}
})
};
})(mui);
/** /**
* mui gestures * mui gestures
* @param {type} $ * @param {type} $
...@@ -819,7 +1066,7 @@ var mui = (function(document, undefined) { ...@@ -819,7 +1066,7 @@ var mui = (function(document, undefined) {
}; };
var detectTouchStart = function(event) { var detectTouchStart = function(event) {
$.gestures.stoped = false; $.gestures.stoped = false;
var now = Date.now(); var now = $.now();
var point = event.touches ? event.touches[0] : event; var point = event.touches ? event.touches[0] : event;
$.gestures.touch = { $.gestures.touch = {
target: event.target, target: event.target,
...@@ -854,20 +1101,22 @@ var mui = (function(document, undefined) { ...@@ -854,20 +1101,22 @@ var mui = (function(document, undefined) {
drag: false, drag: false,
swipe: false, swipe: false,
hold: false, hold: false,
holdStartTime: 0,
holdIdentifier: ($.gestures.touch && $.gestures.touch.holdIdentifier) ? $.gestures.touch.holdIdentifier : 0,
gesture: event gesture: event
}; };
detect(event, $.gestures.touch); detect(event, $.gestures.touch);
}; };
var detectTouchMove = function(event) { var detectTouchMove = function(event) {
if ($.gestures.stoped) { if ($.gestures.stoped || !$.gestures.touch) {
return; return;
} }
var touch = $.gestures.touch; var touch = $.gestures.touch;
if (event.target != touch.target) { if (event.target != touch.target) {
return; return;
} }
var now = Date.now(); var now = $.now();
var point = event.touches ? event.touches[0] : event; var point = event.touches ? event.touches[0] : event;
touch.touchTime = now - touch.startTime; touch.touchTime = now - touch.startTime;
touch.move = { touch.move = {
...@@ -890,14 +1139,14 @@ var mui = (function(document, undefined) { ...@@ -890,14 +1139,14 @@ var mui = (function(document, undefined) {
detect(event, touch); detect(event, touch);
}; };
var detectTouchEnd = function(event) { var detectTouchEnd = function(event) {
if ($.gestures.stoped) { if ($.gestures.stoped || !$.gestures.touch) {
return; return;
} }
var touch = $.gestures.touch; var touch = $.gestures.touch;
if (event.target != touch.target) { if (event.target != touch.target) {
return; return;
} }
var now = Date.now(); var now = $.now();
touch.touchTime = now - touch.startTime; touch.touchTime = now - touch.startTime;
touch.flickTime = now - touch.flickStartTime; touch.flickTime = now - touch.flickStartTime;
touch.flickDistanceX = touch.move.x - touch.flickStart.x; touch.flickDistanceX = touch.move.x - touch.flickStart.x;
...@@ -919,49 +1168,7 @@ var mui = (function(document, undefined) { ...@@ -919,49 +1168,7 @@ var mui = (function(document, undefined) {
} }
}, true); }, true);
/**
* mui delegate events
* @param {type} event
* @param {type} selector
* @param {type} callback
* @returns {undefined}
*/
$.fn.on = function(event, selector, callback) {
this.each(function() {
var element = this;
element.addEventListener(event, function(e) {
var delegates = $.qsa(selector, element);
var target = e.target;
if (delegates && delegates.length > 0) {
for (; target && target !== document; target = target.parentNode) {
if (target === element) {
break;
}
if (target && ~delegates.indexOf(target)) {
if (!e.detail) {
e.detail = {
currentTarget: target
};
} else {
e.detail.currentTarget = target;
}
callback.call(target, e);
}
}
}
});
////避免多次on的时候重复绑定
element.removeEventListener($.EVENT_CLICK, preventDefault);
//click event preventDefault
element.addEventListener($.EVENT_CLICK, preventDefault);
});
};
var preventDefault = function(e) {
var tagName = e.target && e.target.tagName;
if (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && tagName !== 'SELECT') {
e.preventDefault();
}
};
//增加原生滚动识别 //增加原生滚动识别
$.isScrolling = false; $.isScrolling = false;
var scrollingTimeout = null; var scrollingTimeout = null;
...@@ -1095,13 +1302,13 @@ var mui = (function(document, undefined) { ...@@ -1095,13 +1302,13 @@ var mui = (function(document, undefined) {
if ($.options.gestureConfig.doubletap && touch.lastTarget && (touch.lastTarget === event.target)) { //same target if ($.options.gestureConfig.doubletap && touch.lastTarget && (touch.lastTarget === event.target)) { //same target
if (touch.lastTapTime && (touch.startTime - touch.lastTapTime) < options.tapMaxInterval) { if (touch.lastTapTime && (touch.startTime - touch.lastTapTime) < options.tapMaxInterval) {
$.trigger(event.target, 'doubletap', touch); $.trigger(event.target, 'doubletap', touch);
touch.lastTapTime = Date.now(); touch.lastTapTime = $.now();
touch.lastTarget = event.target; touch.lastTarget = event.target;
return; return;
} }
} }
$.trigger(event.target, name, touch); $.trigger(event.target, name, touch);
touch.lastTapTime = Date.now(); touch.lastTapTime = $.now();
touch.lastTarget = event.target; touch.lastTarget = event.target;
} }
} }
...@@ -1175,19 +1382,30 @@ var mui = (function(document, undefined) { ...@@ -1175,19 +1382,30 @@ var mui = (function(document, undefined) {
var options = this.options; var options = this.options;
switch (event.type) { switch (event.type) {
case $.EVENT_START: case $.EVENT_START:
clearTimeout(timer); if ($.options.gestureConfig.hold && event.changedTouches.length && !touch.holdIdentifier) {
touch.holdIdentifier = event.changedTouches[0].identifier + 1; //确保identifier>0
timer && clearTimeout(timer);
timer = setTimeout(function() { timer = setTimeout(function() {
touch.hold = true; touch.hold = true;
touch.holdStartTime = $.now();
$.trigger(event.target, name, touch); $.trigger(event.target, name, touch);
}, options.holdTimeout); }, options.holdTimeout);
}
break; break;
case $.EVENT_MOVE: case $.EVENT_MOVE:
break; break;
case $.EVENT_END: case $.EVENT_END:
case $.EVENT_CANCEL: case $.EVENT_CANCEL:
clearTimeout(timer); if (event.changedTouches.length) {
if ($.options.gestureConfig.hold && touch.hold) { for (var i = 0, len = event.changedTouches.length; i < len; i++) {
if (event.changedTouches[i].identifier === (touch.holdIdentifier - 1)) {
timer && clearTimeout(timer) && (timer = null);
$.trigger(event.target, 'release', touch); $.trigger(event.target, 'release', touch);
touch.hold = false; //reset
touch.holdIdentifier = 0;
break;
}
}
} }
break; break;
} }
...@@ -1269,20 +1487,37 @@ var mui = (function(document, undefined) { ...@@ -1269,20 +1487,37 @@ var mui = (function(document, undefined) {
}; };
$(function() { $(function() {
var classList = document.body.classList; var classList = document.body.classList;
var os = ''; var os = [];
if ($.os.ios) { if ($.os.ios) {
os = 'ios'; os.push({
os: 'ios',
version: $.os.version
});
classList.add('mui-ios'); classList.add('mui-ios');
} else if ($.os.android) { } else if ($.os.android) {
os = 'android'; os.push({
os: 'android',
version: $.os.version
});
classList.add('mui-android'); classList.add('mui-android');
} }
if (os && $.os.version) { if ($.os.wechat) {
os.push({
os: 'wechat',
version: $.os.wechat.version
});
classList.add('mui-wechat');
}
if (os.length) {
$.each(os, function(index, osObj) {
var version = ''; var version = '';
var classArray = []; var classArray = [];
$.each($.os.version.split('.'), function(i, v) { if (osObj.version) {
$.each(osObj.version.split('.'), function(i, v) {
version = version + (version ? '-' : '') + v; version = version + (version ? '-' : '') + v;
classList.add($.className(os + '-' + version)); classList.add($.className(osObj.os + '-' + version));
});
}
}); });
} }
}); });
...@@ -1356,7 +1591,9 @@ var mui = (function(document, undefined) { ...@@ -1356,7 +1591,9 @@ var mui = (function(document, undefined) {
*/ */
$.plusReady = function(callback) { $.plusReady = function(callback) {
if (window.plus) { if (window.plus) {
setTimeout(function() { //解决callback与plusready事件的执行时机问题(典型案例:showWaiting,closeWaiting)
callback(); callback();
}, 0);
} else { } else {
document.addEventListener("plusready", function() { document.addEventListener("plusready", function() {
callback(); callback();
...@@ -1468,6 +1705,17 @@ var mui = (function(document, undefined) { ...@@ -1468,6 +1705,17 @@ var mui = (function(document, undefined) {
webviewCache.afterShowMethodName && webview.evalJS(webviewCache.afterShowMethodName + '(\'' + JSON.stringify(params) + '\')'); webviewCache.afterShowMethodName && webview.evalJS(webviewCache.afterShowMethodName + '(\'' + JSON.stringify(params) + '\')');
return webview; return webview;
} else { //新窗口 } else { //新窗口
if (options.createNew !== true) {
webview = plus.webview.getWebviewById(id);
if (webview) { //如果已存在
nShow = $.showOptions(options.show);
webview.show(nShow.aniShow, nShow.duration, function() {
triggerPreload(webview);
trigger(webview, 'pagebeforeshow', false);
});
return webview;
}
}
//显示waiting //显示waiting
var waitingConfig = $.waitingOptions(options.waiting); var waitingConfig = $.waitingOptions(options.waiting);
if (waitingConfig.autoShow) { if (waitingConfig.autoShow) {
...@@ -1478,6 +1726,7 @@ var mui = (function(document, undefined) { ...@@ -1478,6 +1726,7 @@ var mui = (function(document, undefined) {
id: id, id: id,
url: url url: url
}); });
webview = $.createWindow(options); webview = $.createWindow(options);
//显示 //显示
nShow = $.showOptions(options.show); nShow = $.showOptions(options.show);
...@@ -1635,10 +1884,14 @@ var mui = (function(document, undefined) { ...@@ -1635,10 +1884,14 @@ var mui = (function(document, undefined) {
if (!$.webviews[id]) { //保证执行一遍 if (!$.webviews[id]) { //保证执行一遍
//TODO 这里也有隐患,比如某个webview不是作为subpage创建的,而是作为target webview的话; //TODO 这里也有隐患,比如某个webview不是作为subpage创建的,而是作为target webview的话;
webview = plus.webview.create(options.url, id, options.styles, options.extras); webview = plus.webview.create(options.url, id, options.styles, options.extras);
//TODO 理论上,子webview也应该计算到预加载队列中,但这样就麻烦了,要退必须退整体,否则可能出现问题; //之前的实现方案:子窗口loaded之后再append到父窗口中;
webview.addEventListener('loaded', function() { //问题:部分子窗口loaded事件发生较晚,此时执行父窗口的children方法会返回空,导致父子通讯失败;
// 比如父页面执行完preload事件后,需触发子页面的preload事件,此时未append的话,就无法触发;
//修改方式:不再监控loaded事件,直接append
//by chb@20150521
// webview.addEventListener('loaded', function() {
plus.webview.currentWebview().append(webview); plus.webview.currentWebview().append(webview);
}); // });
$.webviews[id] = options; $.webviews[id] = options;
} }
return webview; return webview;
...@@ -1793,7 +2046,7 @@ var mui = (function(document, undefined) { ...@@ -1793,7 +2046,7 @@ var mui = (function(document, undefined) {
index: 5, index: 5,
handle: function() { handle: function() {
//popover //popover
if ($.targets._popover) { if ($.targets._popover && $.targets._popover.classList.contains('mui-active')) {
$($.targets._popover).popover('hide'); $($.targets._popover).popover('hide');
return true; return true;
} }
...@@ -1820,24 +2073,24 @@ var mui = (function(document, undefined) { ...@@ -1820,24 +2073,24 @@ var mui = (function(document, undefined) {
var parent = wobj.parent(); var parent = wobj.parent();
if (parent) { if (parent) {
parent.evalJS('mui&&mui.back();'); parent.evalJS('mui&&mui.back();');
}else{ } else {
wobj.canBack(function(e) { wobj.canBack(function(e) {
//by chb 暂时注释,在碰到类似popover之类的锚点的时候,需多次点击才能返回; //by chb 暂时注释,在碰到类似popover之类的锚点的时候,需多次点击才能返回;
if (e.canBack) { //webview history back if (e.canBack) { //webview history back
window.history.back(); window.history.back();
} else { //webview close or hide } else { //webview close or hide
var opener = wobj.opener(); //fixed by fxy 此处不应该用opener判断,因为用户有可能自己close掉当前窗口的opener。这样的话。opener就为空了,导致不能执行close
if (opener) { if (wobj.id === plus.runtime.appid) { //首页
//首页不存在opener的情况下,后退实际上应该是退出应用;
//这个交给项目具体实现,框架暂不处理;
//plus.runtime.quit();
} else { //其他页面,
if (wobj.preload) { if (wobj.preload) {
wobj.hide("auto"); wobj.hide("auto");
} else { } else {
//关闭页面时,需要将其打开的所有子页面全部关闭; //关闭页面时,需要将其打开的所有子页面全部关闭;
$.closeAll(wobj); $.closeAll(wobj);
} }
} else {
//首页不存在opener的情况下,后退实际上应该是退出应用;
//这个交给项目具体实现,框架暂不处理;
//plus.runtime.quit();
} }
} }
}); });
...@@ -1850,7 +2103,7 @@ var mui = (function(document, undefined) { ...@@ -1850,7 +2103,7 @@ var mui = (function(document, undefined) {
$.menu = function() { $.menu = function() {
var menu = document.querySelector('.mui-action-menu'); var menu = document.querySelector('.mui-action-menu');
if (menu) { if (menu) {
$.trigger(menu, 'touchstart');//临时处理menu无touchstart的话,找不到当前targets的问题 $.trigger(menu, 'touchstart'); //临时处理menu无touchstart的话,找不到当前targets的问题
$.trigger(menu, 'tap'); $.trigger(menu, 'tap');
} else { //执行父窗口的menu } else { //执行父窗口的menu
if (window.plus) { if (window.plus) {
...@@ -1862,17 +2115,33 @@ var mui = (function(document, undefined) { ...@@ -1862,17 +2115,33 @@ var mui = (function(document, undefined) {
} }
} }
}; };
var __back = function() {
$.back();
};
var __menu = function() {
$.menu();
};
//默认监听
$.plusReady(function() {
if ($.options.keyEventBind.backbutton) {
plus.key.addEventListener('backbutton', __back, false);
}
if ($.options.keyEventBind.menubutton) {
plus.key.addEventListener('menubutton', __menu, false);
}
});
//处理按键监听事件 //处理按键监听事件
$.registerInit({ $.registerInit({
name: 'keyEventBind', name: 'keyEventBind',
index: 1000, index: 1000,
handle: function() { handle: function() {
$.plusReady(function() { $.plusReady(function() {
if ($.options.keyEventBind.backbutton) { //如果不为true,则移除默认监听
plus.key.addEventListener('backbutton', $.back, false); if (!$.options.keyEventBind.backbutton) {
plus.key.removeEventListener('backbutton', __back);
} }
if ($.options.keyEventBind.menubutton) { if (!$.options.keyEventBind.menubutton) {
plus.key.addEventListener('menubutton', $.menu, false); plus.key.removeEventListener('menubutton', __menu);
} }
}); });
} }
...@@ -2065,7 +2334,7 @@ var mui = (function(document, undefined) { ...@@ -2065,7 +2334,7 @@ var mui = (function(document, undefined) {
var dataType = settings.dataType; var dataType = settings.dataType;
if (settings.cache === false || ((!options || options.cache !== true) && ('script' === dataType))) { if (settings.cache === false || ((!options || options.cache !== true) && ('script' === dataType))) {
settings.url = appendQuery(settings.url, '_=' + Date.now()); settings.url = appendQuery(settings.url, '_=' + $.now());
} }
var mime = settings.accepts[dataType]; var mime = settings.accepts[dataType];
var headers = {}; var headers = {};
...@@ -2073,7 +2342,7 @@ var mui = (function(document, undefined) { ...@@ -2073,7 +2342,7 @@ var mui = (function(document, undefined) {
headers[name.toLowerCase()] = [name, value]; headers[name.toLowerCase()] = [name, value];
}; };
var protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol; var protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol;
var xhr = settings.xhr(protocol); var xhr = settings.xhr(settings);
var nativeSetHeader = xhr.setRequestHeader; var nativeSetHeader = xhr.setRequestHeader;
var abortTimeout; var abortTimeout;
...@@ -2216,14 +2485,26 @@ var mui = (function(document, undefined) { ...@@ -2216,14 +2485,26 @@ var mui = (function(document, undefined) {
* 5+ ajax * 5+ ajax
*/ */
(function($) { (function($) {
var originAnchor = document.createElement('a');
originAnchor.href = window.location.href;
$.plusReady(function() { $.plusReady(function() {
$.ajaxSettings = $.extend($.ajaxSettings, { $.ajaxSettings = $.extend($.ajaxSettings, {
xhr: function(protocol) { xhr: function(settings) {
if (protocol === 'file:') { //本地文件使用标准XMLHttpRequest if (settings.crossDomain) { //强制使用plus跨域
return new window.XMLHttpRequest(); return new plus.net.XMLHttpRequest();
} }
//仅在webview的url为远程文件,且ajax请求的资源不同源下使用plus.net.XMLHttpRequest
if (originAnchor.protocol !== 'file:') {
var urlAnchor = document.createElement('a');
urlAnchor.href = settings.url;
urlAnchor.href = urlAnchor.href;
settings.crossDomain = (originAnchor.protocol + '//' + originAnchor.host) !== (urlAnchor.protocol + '//' + urlAnchor.host);
if (settings.crossDomain) {
return new plus.net.XMLHttpRequest(); return new plus.net.XMLHttpRequest();
} }
}
return new window.XMLHttpRequest();
}
}); });
}); });
})(mui); })(mui);
...@@ -2260,6 +2541,7 @@ var mui = (function(document, undefined) { ...@@ -2260,6 +2541,7 @@ var mui = (function(document, undefined) {
duration = duration || 1000; duration = duration || 1000;
var scroll = function(duration) { var scroll = function(duration) {
if (duration <= 0) { if (duration <= 0) {
window.scrollTo(0, scrollTop);
callback && callback(); callback && callback();
return; return;
} }
...@@ -2333,6 +2615,9 @@ var mui = (function(document, undefined) { ...@@ -2333,6 +2615,9 @@ var mui = (function(document, undefined) {
var CLASS_PULL = 'mui-pull'; var CLASS_PULL = 'mui-pull';
var CLASS_PULL_LOADING = 'mui-pull-loading'; var CLASS_PULL_LOADING = 'mui-pull-loading';
var CLASS_PULL_CAPTION = 'mui-pull-caption'; var CLASS_PULL_CAPTION = 'mui-pull-caption';
var CLASS_PULL_CAPTION_DOWN = 'mui-pull-caption-down';
var CLASS_PULL_CAPTION_REFRESH = 'mui-pull-caption-refresh';
var CLASS_PULL_CAPTION_NOMORE = 'mui-pull-caption-nomore';
var CLASS_ICON = 'mui-icon'; var CLASS_ICON = 'mui-icon';
var CLASS_SPINNER = 'mui-spinner'; var CLASS_SPINNER = 'mui-spinner';
...@@ -2362,6 +2647,7 @@ var mui = (function(document, undefined) { ...@@ -2362,6 +2647,7 @@ var mui = (function(document, undefined) {
}, },
up: { up: {
height: 50, height: 50,
auto: false,
contentdown: '上拉显示更多', contentdown: '上拉显示更多',
contentrefresh: '正在加载...', contentrefresh: '正在加载...',
contentnomore: '没有更多数据了', contentnomore: '没有更多数据了',
...@@ -2428,6 +2714,21 @@ var mui = (function(document, undefined) { ...@@ -2428,6 +2714,21 @@ var mui = (function(document, undefined) {
loading.className = CLASS_LOADING_DOWN; loading.className = CLASS_LOADING_DOWN;
} }
}, },
_setCaptionClass: function(isPulldown, caption, title) {
if (!isPulldown) {
switch (title) {
case this.options.up.contentdown:
caption.className = CLASS_PULL_CAPTION + ' ' + CLASS_PULL_CAPTION_DOWN;
break;
case this.options.up.contentrefresh:
caption.className = CLASS_PULL_CAPTION + ' ' + CLASS_PULL_CAPTION_REFRESH
break;
case this.options.up.contentnomore:
caption.className = CLASS_PULL_CAPTION + ' ' + CLASS_PULL_CAPTION_NOMORE;
break;
}
}
},
_setCaption: function(title, reset) { _setCaption: function(title, reset) {
if (this.loading) { if (this.loading) {
return; return;
...@@ -2437,13 +2738,15 @@ var mui = (function(document, undefined) { ...@@ -2437,13 +2738,15 @@ var mui = (function(document, undefined) {
var caption = this.pullCaption; var caption = this.pullCaption;
var loading = this.pullLoading; var loading = this.pullLoading;
var isPulldown = this.pulldown; var isPulldown = this.pulldown;
var self = this;
if (pocket) { if (pocket) {
if (reset) { if (reset) {
setTimeout(function() { setTimeout(function() {
caption.innerHTML = title; caption.innerHTML = self.lastTitle = title;
if (isPulldown) { if (isPulldown) {
loading.className = CLASS_LOADING_DOWN; loading.className = CLASS_LOADING_DOWN;
} else { } else {
self._setCaptionClass(false, caption, title);
loading.className = CLASS_LOADING; loading.className = CLASS_LOADING;
} }
loading.style.webkitAnimation = ""; loading.style.webkitAnimation = "";
...@@ -2472,6 +2775,7 @@ var mui = (function(document, undefined) { ...@@ -2472,6 +2775,7 @@ var mui = (function(document, undefined) {
} else { } else {
loading.className = CLASS_LOADING + ' ' + CLASS_HIDDEN; loading.className = CLASS_LOADING + ' ' + CLASS_HIDDEN;
} }
self._setCaptionClass(false, caption, title);
} }
this.lastTitle = title; this.lastTitle = title;
} }
...@@ -2747,6 +3051,7 @@ var mui = (function(document, undefined) { ...@@ -2747,6 +3051,7 @@ var mui = (function(document, undefined) {
break; break;
case 'scrollend': case 'scrollend':
this._scrollend(e); this._scrollend(e);
e.stopPropagation();
break; break;
case 'orientationchange': case 'orientationchange':
case 'resize': case 'resize':
...@@ -2761,7 +3066,7 @@ var mui = (function(document, undefined) { ...@@ -2761,7 +3066,7 @@ var mui = (function(document, undefined) {
_start: function(e) { _start: function(e) {
this.moved = this.needReset = false; this.moved = this.needReset = false;
this._transitionTime(); this._transitionTime();
if (this.isInTransition) { if (this.isInTransition && this.moved) {
this.needReset = true; this.needReset = true;
this.isInTransition = false; this.isInTransition = false;
var pos = $.parseTranslateMatrix($.getStyles(this.scroller, 'webkitTransform')); var pos = $.parseTranslateMatrix($.getStyles(this.scroller, 'webkitTransform'));
...@@ -3384,8 +3689,10 @@ var mui = (function(document, undefined) { ...@@ -3384,8 +3689,10 @@ var mui = (function(document, undefined) {
handleEvent: function(e) { handleEvent: function(e) {
this._super(e); this._super(e);
if (e.type === 'scrollbottom') { if (e.type === 'scrollbottom') {
if (e.target === this.scroller) {
this._scrollbottom(); this._scrollbottom();
} }
}
}, },
_scrollbottom: function() { _scrollbottom: function() {
if (!this.pulldown && !this.loading) { if (!this.pulldown && !this.loading) {
...@@ -3417,20 +3724,20 @@ var mui = (function(document, undefined) { ...@@ -3417,20 +3724,20 @@ var mui = (function(document, undefined) {
//API //API
resetPosition: function(time) { resetPosition: function(time) {
if (this.pulldown && this.y >= this.options.down.height) { if (this.pulldown && this.y >= this.options.down.height) {
this.pulldownLoading(0, time || 0); this.pulldownLoading(undefined, time || 0);
return true; return true;
} }
return this._super(time); return this._super(time);
}, },
pulldownLoading: function(x, time) { pulldownLoading: function(y, time) {
x = x || 0; typeof y === 'undefined' && (y = this.options.down.height); //默认高度
this.scrollTo(x, this.options.down.height, time, this.options.bounceEasing); this.scrollTo(0, y, time, this.options.bounceEasing);
if (this.loading) { if (this.loading) {
return; return;
} }
if (!this.pulldown) { // if (!this.pulldown) {
this._initPulldownRefresh(); this._initPulldownRefresh();
} // }
this._setCaption(this.options.down.contentrefresh); this._setCaption(this.options.down.contentrefresh);
this.loading = true; this.loading = true;
this.indicators.map(function(indicator) { this.indicators.map(function(indicator) {
...@@ -3470,6 +3777,7 @@ var mui = (function(document, undefined) { ...@@ -3470,6 +3777,7 @@ var mui = (function(document, undefined) {
if (self.bottomPocket && self.loading && !this.pulldown) { if (self.bottomPocket && self.loading && !this.pulldown) {
self.loading = false; self.loading = false;
if (finished) { if (finished) {
this.finished = true;
self._setCaption(self.options.up.contentnomore); self._setCaption(self.options.up.contentnomore);
// self.bottomPocket.classList.remove(CLASS_VISIBILITY); // self.bottomPocket.classList.remove(CLASS_VISIBILITY);
// self.bottomPocket.classList.add(CLASS_HIDDEN); // self.bottomPocket.classList.add(CLASS_HIDDEN);
...@@ -3483,13 +3791,12 @@ var mui = (function(document, undefined) { ...@@ -3483,13 +3791,12 @@ var mui = (function(document, undefined) {
} }
}, },
refresh: function(isReset) { refresh: function(isReset) {
if (isReset) { if (isReset && this.finished) {
// var classList = this.bottomPocket.classList; this._initPullupRefresh();
// if (classList.contains(CLASS_HIDDEN)) { this.bottomPocket.classList.remove(CLASS_HIDDEN);
// classList.remove(CLASS_HIDDEN); this._setCaption(this.options.up.contentdown);
// this._setCaption(self.options.up.contentdown);
this.wrapper.addEventListener('scrollbottom', this); this.wrapper.addEventListener('scrollbottom', this);
// } this.finished = false;
} }
this._super(); this._super();
}, },
...@@ -3497,23 +3804,27 @@ var mui = (function(document, undefined) { ...@@ -3497,23 +3804,27 @@ var mui = (function(document, undefined) {
$.fn.pullRefresh = function(options) { $.fn.pullRefresh = function(options) {
if (this.length === 1) { if (this.length === 1) {
var self = this[0]; var self = this[0];
var pullrefreshApi = null; var pullRefreshApi = null;
options = options || {};
var id = self.getAttribute('data-pullrefresh'); var id = self.getAttribute('data-pullrefresh');
if (!id) { if (!id) {
id = ++$.uuid; id = ++$.uuid;
$.data[id] = pullrefreshApi = new PullRefresh(self, options); $.data[id] = pullRefreshApi = new PullRefresh(self, options);
self.setAttribute('data-pullrefresh', id); self.setAttribute('data-pullrefresh', id);
} else { } else {
pullrefreshApi = $.data[id]; pullRefreshApi = $.data[id];
}
if (options.up && options.up.auto) { //如果设置了auto,则自动上拉一次
pullRefreshApi.pullupLoading();
} }
//暂不提供这种调用方式吧 //暂不提供这种调用方式吧
// if (typeof options === 'string') { // if (typeof options === 'string') {
// var methodValue = pullrefreshApi[options].apply(pullrefreshApi, $.slice.call(arguments, 1)); // var methodValue = pullRefreshApi[options].apply(pullRefreshApi, $.slice.call(arguments, 1));
// if (methodValue !== undefined) { // if (methodValue !== undefined) {
// return methodValue; // return methodValue;
// } // }
// } // }
return pullrefreshApi; return pullRefreshApi;
} }
}; };
})(mui, window, document); })(mui, window, document);
...@@ -3586,7 +3897,6 @@ var mui = (function(document, undefined) { ...@@ -3586,7 +3897,6 @@ var mui = (function(document, undefined) {
self.wrapper.addEventListener('scrollend', function() { self.wrapper.addEventListener('scrollend', function() {
self.isInTransition = false; self.isInTransition = false;
var page = self.currentPage; var page = self.currentPage;
var oldSlideNumber = self.slideNumber;
self.slideNumber = self._fixedSlideNumber(); self.slideNumber = self._fixedSlideNumber();
if (self.loop) { if (self.loop) {
if (self.slideNumber === 0) { if (self.slideNumber === 0) {
...@@ -3595,11 +3905,13 @@ var mui = (function(document, undefined) { ...@@ -3595,11 +3905,13 @@ var mui = (function(document, undefined) {
self.setTranslate(self.pages[self.itemLength - 2][0].x, 0); self.setTranslate(self.pages[self.itemLength - 2][0].x, 0);
} }
} }
if (oldSlideNumber != self.slideNumber) { if (self.lastSlideNumber != self.slideNumber) {
self.lastSlideNumber = self.slideNumber;
$.trigger(self.wrapper, 'slide', { $.trigger(self.wrapper, 'slide', {
slideNumber: self.slideNumber slideNumber: self.slideNumber
}); });
} }
self._initTimer();
}); });
self.wrapper.addEventListener('slide', function(e) { self.wrapper.addEventListener('slide', function(e) {
...@@ -3669,6 +3981,10 @@ var mui = (function(document, undefined) { ...@@ -3669,6 +3981,10 @@ var mui = (function(document, undefined) {
this._super(e); this._super(e);
var direction = e.detail.direction; var direction = e.detail.direction;
if (direction === 'left' || direction === 'right') { if (direction === 'left' || direction === 'right') {
//拖拽期间取消定时
var slidershowTimer = this.wrapper.getAttribute('data-slidershowTimer');
slidershowTimer && window.clearTimeout(slidershowTimer);
e.stopPropagation(); e.stopPropagation();
} }
}, },
...@@ -3760,8 +4076,10 @@ var mui = (function(document, undefined) { ...@@ -3760,8 +4076,10 @@ var mui = (function(document, undefined) {
} }
this.currentPage = currentPage[0]; this.currentPage = currentPage[0];
this.slideNumber = 0; this.slideNumber = 0;
this.lastSlideNumber = typeof this.lastSlideNumber === 'undefined' ? 0 : this.lastSlideNumber;
} else { } else {
this.slideNumber = this._fixedSlideNumber(); this.slideNumber = this._fixedSlideNumber();
this.lastSlideNumber = typeof this.lastSlideNumber === 'undefined' ? this.slideNumber : this.lastSlideNumber;
} }
this.options.startX = this.currentPage.x || 0; this.options.startX = this.currentPage.x || 0;
}, },
...@@ -3794,12 +4112,11 @@ var mui = (function(document, undefined) { ...@@ -3794,12 +4112,11 @@ var mui = (function(document, undefined) {
return this.pages[slideNumber][0]; return this.pages[slideNumber][0];
}, },
_gotoItem: function(slideNumber, time) { _gotoItem: function(slideNumber, time) {
this.currentPage = this._getPage(slideNumber); this.currentPage = this._getPage(slideNumber, true); //此处传true。可保证程序切换时,动画与人手操作一致(第一张,最后一张的切换动画)
this.scrollTo(this.currentPage.x, 0, time, this.options.bounceEasing); this.scrollTo(this.currentPage.x, 0, time, this.options.bounceEasing);
if (time === 0) { if (time === 0) {
$.trigger(this.wrapper, 'scrollend', this); $.trigger(this.wrapper, 'scrollend', this);
} }
this._initTimer();
}, },
//API //API
setTranslate: function(x, y) { setTranslate: function(x, y) {
...@@ -3821,7 +4138,7 @@ var mui = (function(document, undefined) { ...@@ -3821,7 +4138,7 @@ var mui = (function(document, undefined) {
return true; return true;
}, },
gotoItem: function(slideNumber, time) { gotoItem: function(slideNumber, time) {
this._gotoItem(slideNumber, time || this.options.bounceTime); this._gotoItem(slideNumber, typeof time === 'undefined' ? this.options.bounceTime : time);
}, },
nextItem: function() { nextItem: function() {
this._gotoItem(this.slideNumber + 1, this.options.bounceTime); this._gotoItem(this.slideNumber + 1, this.options.bounceTime);
...@@ -3849,7 +4166,7 @@ var mui = (function(document, undefined) { ...@@ -3849,7 +4166,7 @@ var mui = (function(document, undefined) {
if (!this.classList.contains(CLASS_SLIDER)) { if (!this.classList.contains(CLASS_SLIDER)) {
sliderElement = this.querySelector('.' + CLASS_SLIDER); sliderElement = this.querySelector('.' + CLASS_SLIDER);
} }
if (sliderElement) { if (sliderElement && sliderElement.querySelector(SELECTOR_SLIDER_ITEM)) {
var id = sliderElement.getAttribute('data-slider'); var id = sliderElement.getAttribute('data-slider');
if (!id) { if (!id) {
id = ++$.uuid; id = ++$.uuid;
...@@ -3892,6 +4209,11 @@ var mui = (function(document, undefined) { ...@@ -3892,6 +4209,11 @@ var mui = (function(document, undefined) {
var CLASS_HIDDEN = 'mui-hidden'; var CLASS_HIDDEN = 'mui-hidden';
var CLASS_BLOCK = 'mui-block'; var CLASS_BLOCK = 'mui-block';
var CLASS_PULL_CAPTION = 'mui-pull-caption';
var CLASS_PULL_CAPTION_DOWN = 'mui-pull-caption-down';
var CLASS_PULL_CAPTION_REFRESH = 'mui-pull-caption-refresh';
var CLASS_PULL_CAPTION_NOMORE = 'mui-pull-caption-nomore';
var PlusPullRefresh = $.Class.extend({ var PlusPullRefresh = $.Class.extend({
init: function(element, options) { init: function(element, options) {
this.element = element; this.element = element;
...@@ -4008,8 +4330,8 @@ var mui = (function(document, undefined) { ...@@ -4008,8 +4330,8 @@ var mui = (function(document, undefined) {
} }
}, },
pulldownLoading: function() { pulldownLoading: function() {
//TODO var callback = $.options.pullRefresh.down.callback;
throw new Error('暂不支持'); callback && callback.call(this);
}, },
endPulldownToRefresh: function() { //该方法是子页面调用的 endPulldownToRefresh: function() { //该方法是子页面调用的
var webview = plus.webview.currentWebview(); var webview = plus.webview.currentWebview();
...@@ -4041,6 +4363,7 @@ var mui = (function(document, undefined) { ...@@ -4041,6 +4363,7 @@ var mui = (function(document, undefined) {
self.pullLoading.classList.add(CLASS_VISIBILITY); self.pullLoading.classList.add(CLASS_VISIBILITY);
self.pullLoading.classList.remove(CLASS_HIDDEN); self.pullLoading.classList.remove(CLASS_HIDDEN);
self.pullCaption.innerHTML = ''; //修正5+里边第一次加载时,文字显示的bug(还会显示出来个“多”,猜测应该是渲染问题导致的) self.pullCaption.innerHTML = ''; //修正5+里边第一次加载时,文字显示的bug(还会显示出来个“多”,猜测应该是渲染问题导致的)
self.pullCaption.className = CLASS_PULL_CAPTION + ' ' + CLASS_PULL_CAPTION_REFRESH;
self.pullCaption.innerHTML = self.options.up.contentrefresh; self.pullCaption.innerHTML = self.options.up.contentrefresh;
callback = callback || self.options.up.callback; callback = callback || self.options.up.callback;
callback && callback.call(self); callback && callback.call(self);
...@@ -4053,12 +4376,15 @@ var mui = (function(document, undefined) { ...@@ -4053,12 +4376,15 @@ var mui = (function(document, undefined) {
self.pullLoading.classList.add(CLASS_HIDDEN); self.pullLoading.classList.add(CLASS_HIDDEN);
self.isLoading = false; self.isLoading = false;
if (finished) { if (finished) {
self.finished = true;
self.pullCaption.className = CLASS_PULL_CAPTION + ' ' + CLASS_PULL_CAPTION_NOMORE;
self.pullCaption.innerHTML = self.options.up.contentnomore; self.pullCaption.innerHTML = self.options.up.contentnomore;
// self.bottomPocket.classList.remove(CLASS_BLOCK); // self.bottomPocket.classList.remove(CLASS_BLOCK);
// self.bottomPocket.classList.add(CLASS_HIDDEN); // self.bottomPocket.classList.add(CLASS_HIDDEN);
// document.removeEventListener('plusscrollbottom', self); // document.removeEventListener('plusscrollbottom', self);
window.removeEventListener('dragup', self); window.removeEventListener('dragup', self);
} else { //初始化时隐藏,后续不再隐藏 } else { //初始化时隐藏,后续不再隐藏
self.pullCaption.className = CLASS_PULL_CAPTION + ' ' + CLASS_PULL_CAPTION_DOWN;
self.pullCaption.innerHTML = self.options.up.contentdown; self.pullCaption.innerHTML = self.options.up.contentdown;
// setTimeout(function() { // setTimeout(function() {
// self.loading || self.bottomPocket.classList.remove(CLASS_BLOCK); // self.loading || self.bottomPocket.classList.remove(CLASS_BLOCK);
...@@ -4070,13 +4396,13 @@ var mui = (function(document, undefined) { ...@@ -4070,13 +4396,13 @@ var mui = (function(document, undefined) {
$.scrollTo(x, y, time); $.scrollTo(x, y, time);
}, },
refresh: function(isReset) { refresh: function(isReset) {
if (isReset) { if (isReset && this.finished) {
// var classList = this.bottomPocket.classList; this._initPullupRefresh();
// if (classList.contains(CLASS_HIDDEN)) { this.bottomPocket.classList.remove(CLASS_HIDDEN);
// classList.remove(CLASS_HIDDEN); this.pullCaption.className = CLASS_PULL_CAPTION + ' ' + CLASS_PULL_CAPTION_DOWN;
// document.addEventListener('plusscrollbottom', this); this.pullCaption.innerHTML = this.options.up.contentdown;
window.addEventListener('dragup', this); window.addEventListener('dragup', this);
// } this.finished = false;
} }
} }
}, $.PullRefresh)); }, $.PullRefresh));
...@@ -4092,12 +4418,11 @@ var mui = (function(document, undefined) { ...@@ -4092,12 +4418,11 @@ var mui = (function(document, undefined) {
self = this[0]; self = this[0];
} }
//一个父需要支持多个子下拉刷新 //一个父需要支持多个子下拉刷新
options = options || { options = options || {}
webviewId: plus.webview.currentWebview().id || plus.webview.currentWebview().getURL()
}
if (typeof options === 'string') { if (typeof options === 'string') {
options = $.parseJSON(options); options = $.parseJSON(options);
} };
!options.webviewId && (options.webviewId = (plus.webview.currentWebview().id || plus.webview.currentWebview().getURL()));
var pullRefreshApi = null; var pullRefreshApi = null;
var attrWebviewId = options.webviewId && options.webviewId.replace(/\//g, "_"); //替换所有"/" var attrWebviewId = options.webviewId && options.webviewId.replace(/\//g, "_"); //替换所有"/"
var id = self.getAttribute('data-pullrefresh-plus-' + attrWebviewId); var id = self.getAttribute('data-pullrefresh-plus-' + attrWebviewId);
...@@ -4109,6 +4434,9 @@ var mui = (function(document, undefined) { ...@@ -4109,6 +4434,9 @@ var mui = (function(document, undefined) {
} else { } else {
pullRefreshApi = $.data[id]; pullRefreshApi = $.data[id];
} }
if (options.up && options.up.auto) { //如果设置了auto,则自动上拉一次
pullRefreshApi.pullupLoading();
}
return pullRefreshApi; return pullRefreshApi;
}; };
})(mui, document); })(mui, document);
...@@ -4149,29 +4477,39 @@ var mui = (function(document, undefined) { ...@@ -4149,29 +4477,39 @@ var mui = (function(document, undefined) {
this.initEvent(); this.initEvent();
} }
}, },
refresh: function() { refresh: function(offCanvas) {
this.classList.remove(CLASS_ACTIVE); // offCanvas && !offCanvas.classList.contains(CLASS_ACTIVE) && this.classList.remove(CLASS_ACTIVE);
this.slideIn = this.classList.contains(CLASS_SLIDE_IN); this.slideIn = this.classList.contains(CLASS_SLIDE_IN);
this.scroller = this.wrapper.querySelector(SELECTOR_INNER_WRAP); this.scroller = this.wrapper.querySelector(SELECTOR_INNER_WRAP);
this.scroller.classList.remove(CLASS_TRANSITIONING); // !offCanvas && this.scroller.classList.remove(CLASS_TRANSITIONING);
this.scroller.setAttribute('style', ''); // !offCanvas && this.scroller.setAttribute('style', '');
this.offCanvasLefts = this.wrapper.querySelectorAll('.' + CLASS_OFF_CANVAS_LEFT);
this.offCanvasRights = this.wrapper.querySelectorAll('.' + CLASS_OFF_CANVAS_RIGHT);
if (offCanvas) {
if (offCanvas.classList.contains(CLASS_OFF_CANVAS_LEFT)) {
this.offCanvasLeft = offCanvas;
} else if (offCanvas.classList.contains(CLASS_OFF_CANVAS_RIGHT)) {
this.offCanvasRight = offCanvas;
}
} else {
this.offCanvasRight = this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_RIGHT); this.offCanvasRight = this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_RIGHT);
this.offCanvasLeft = this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_LEFT); this.offCanvasLeft = this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_LEFT);
}
this.offCanvasRightWidth = this.offCanvasLeftWidth = 0; this.offCanvasRightWidth = this.offCanvasLeftWidth = 0;
this.offCanvasLeftSlideIn = this.offCanvasRightSlideIn = false; this.offCanvasLeftSlideIn = this.offCanvasRightSlideIn = false;
if (this.offCanvasRight) { if (this.offCanvasRight) {
this.offCanvasRightWidth = this.offCanvasRight.offsetWidth; this.offCanvasRightWidth = this.offCanvasRight.offsetWidth;
this.offCanvasRightSlideIn = this.slideIn && (this.offCanvasRight.parentNode === this.wrapper); this.offCanvasRightSlideIn = this.slideIn && (this.offCanvasRight.parentNode === this.wrapper);
this.offCanvasRight.classList.remove(CLASS_TRANSITIONING); // this.offCanvasRight.classList.remove(CLASS_TRANSITIONING);
this.offCanvasRight.classList.remove(CLASS_ACTIVE); // this.offCanvasRight.classList.remove(CLASS_ACTIVE);
this.offCanvasRight.setAttribute('style', ''); // this.offCanvasRight.setAttribute('style', '');
} }
if (this.offCanvasLeft) { if (this.offCanvasLeft) {
this.offCanvasLeftWidth = this.offCanvasLeft.offsetWidth; this.offCanvasLeftWidth = this.offCanvasLeft.offsetWidth;
this.offCanvasLeftSlideIn = this.slideIn && (this.offCanvasLeft.parentNode === this.wrapper); this.offCanvasLeftSlideIn = this.slideIn && (this.offCanvasLeft.parentNode === this.wrapper);
this.offCanvasLeft.classList.remove(CLASS_TRANSITIONING); // this.offCanvasLeft.classList.remove(CLASS_TRANSITIONING);
this.offCanvasLeft.classList.remove(CLASS_ACTIVE); // this.offCanvasLeft.classList.remove(CLASS_ACTIVE);
this.offCanvasLeft.setAttribute('style', ''); // this.offCanvasLeft.setAttribute('style', '');
} }
this.backdrop = this.scroller.querySelector('.' + CLASS_ACTION_BACKDEOP); this.backdrop = this.scroller.querySelector('.' + CLASS_ACTION_BACKDEOP);
...@@ -4392,7 +4730,13 @@ var mui = (function(document, undefined) { ...@@ -4392,7 +4730,13 @@ var mui = (function(document, undefined) {
this.rightShowing = false; this.rightShowing = false;
if (x > 0) { if (x > 0) {
if (this.offCanvasLeft) { if (this.offCanvasLeft) {
$.each(this.offCanvasLefts, function(index, offCanvas) {
if (offCanvas === this.offCanvasLeft) {
this.offCanvasLeft.style.zIndex = 0; this.offCanvasLeft.style.zIndex = 0;
} else {
offCanvas.style.zIndex = -1;
}
}.bind(this));
} }
if (this.offCanvasRight) { if (this.offCanvasRight) {
this.offCanvasRight.style.zIndex = -1; this.offCanvasRight.style.zIndex = -1;
...@@ -4402,7 +4746,13 @@ var mui = (function(document, undefined) { ...@@ -4402,7 +4746,13 @@ var mui = (function(document, undefined) {
this.rightShowing = true; this.rightShowing = true;
this.leftShowing = false; this.leftShowing = false;
if (this.offCanvasRight) { if (this.offCanvasRight) {
this.offCanvasRight.style.zIndex = 0; $.each(this.offCanvasRights, function(index, offCanvas) {
if (offCanvas === this.offCanvasRight) {
offCanvas.style.zIndex = 0;
} else {
offCanvas.style.zIndex = -1;
}
}.bind(this));
} }
if (this.offCanvasLeft) { if (this.offCanvasLeft) {
this.offCanvasLeft.style.zIndex = -1; this.offCanvasLeft.style.zIndex = -1;
...@@ -4458,11 +4808,11 @@ var mui = (function(document, undefined) { ...@@ -4458,11 +4808,11 @@ var mui = (function(document, undefined) {
} }
} else { } else {
if (direction === 'left') { if (direction === 'left') {
shown = this.offCanvasLeft && this.offCanvasLeft.classList.contains(CLASS_ACTIVE); shown = this.classList.contains(CLASS_ACTIVE) && this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_LEFT + '.' + CLASS_ACTIVE);
} else if (direction === 'right') { } else if (direction === 'right') {
shown = this.offCanvasRight && this.offCanvasRight.classList.contains(CLASS_ACTIVE); shown = this.classList.contains(CLASS_ACTIVE) && this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_RIGHT + '.' + CLASS_ACTIVE);
} else { } else {
shown = (this.offCanvasLeft && this.offCanvasLeft.classList.contains(CLASS_ACTIVE)) || (this.offCanvasRight && this.offCanvasRight.classList.contains(CLASS_ACTIVE)); shown = this.classList.contains(CLASS_ACTIVE) && (this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_LEFT + '.' + CLASS_ACTIVE) || this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_RIGHT + '.' + CLASS_ACTIVE));
} }
} }
return shown; return shown;
...@@ -4470,7 +4820,7 @@ var mui = (function(document, undefined) { ...@@ -4470,7 +4820,7 @@ var mui = (function(document, undefined) {
close: function() { close: function() {
this._initOffCanvasVisible(); this._initOffCanvasVisible();
if (this.slideIn) { if (this.slideIn) {
this.scroller = this.offCanvasRight && this.offCanvasRight.classList.contains(CLASS_ACTIVE) ? this.offCanvasRight : this.offCanvasLeft; this.scroller = this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_RIGHT + '.' + CLASS_ACTIVE) || this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_LEFT + '.' + CLASS_ACTIVE);
} }
if (this.scroller) { if (this.scroller) {
this.scroller.classList.add(CLASS_TRANSITIONING); this.scroller.classList.add(CLASS_TRANSITIONING);
...@@ -4480,7 +4830,7 @@ var mui = (function(document, undefined) { ...@@ -4480,7 +4830,7 @@ var mui = (function(document, undefined) {
show: function(direction) { show: function(direction) {
this._initOffCanvasVisible(); this._initOffCanvasVisible();
if (this.isShown(direction)) { if (this.isShown(direction)) {
return; return false;
} }
if (!direction) { if (!direction) {
direction = this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_RIGHT) ? 'right' : 'left'; direction = this.wrapper.querySelector('.' + CLASS_OFF_CANVAS_RIGHT) ? 'right' : 'left';
...@@ -4492,12 +4842,16 @@ var mui = (function(document, undefined) { ...@@ -4492,12 +4842,16 @@ var mui = (function(document, undefined) {
this.scroller.classList.add(CLASS_TRANSITIONING); this.scroller.classList.add(CLASS_TRANSITIONING);
this.openPercentage(direction === 'left' ? 100 : -100); this.openPercentage(direction === 'left' ? 100 : -100);
} }
return true;
}, },
toggle: function(direction) { toggle: function(directionOrOffCanvas) {
if (this.isShown(direction)) { var direction = directionOrOffCanvas;
if (directionOrOffCanvas && directionOrOffCanvas.classList) {
direction = directionOrOffCanvas.classList.contains(CLASS_OFF_CANVAS_LEFT) ? 'left' : 'right';
this.refresh(directionOrOffCanvas);
}
if (!this.show(direction)) {
this.close(); this.close();
} else {
this.show(direction);
} }
} }
}); });
...@@ -4523,7 +4877,6 @@ var mui = (function(document, undefined) { ...@@ -4523,7 +4877,6 @@ var mui = (function(document, undefined) {
var container = findOffCanvasContainer(offcanvas); var container = findOffCanvasContainer(offcanvas);
if (container) { if (container) {
$.targets._container = container; $.targets._container = container;
event.preventDefault(); //fixed hashchange
return offcanvas; return offcanvas;
} }
} }
...@@ -4548,7 +4901,8 @@ var mui = (function(document, undefined) { ...@@ -4548,7 +4901,8 @@ var mui = (function(document, undefined) {
var target = e.target; var target = e.target;
for (; target && target !== document; target = target.parentNode) { for (; target && target !== document; target = target.parentNode) {
if (target.tagName === 'A' && target.hash && target.hash === ('#' + $.targets.offcanvas.id)) { if (target.tagName === 'A' && target.hash && target.hash === ('#' + $.targets.offcanvas.id)) {
$($.targets._container).offCanvas().toggle($.targets.offcanvas.classList.contains(CLASS_OFF_CANVAS_LEFT) ? 'left' : 'right'); e.detail.gesture.preventDefault(); //fixed hashchange
$($.targets._container).offCanvas().toggle($.targets.offcanvas);
$.targets.offcanvas = $.targets._container = null; $.targets.offcanvas = $.targets._container = null;
break; break;
} }
...@@ -4594,7 +4948,9 @@ var mui = (function(document, undefined) { ...@@ -4594,7 +4948,9 @@ var mui = (function(document, undefined) {
var handle = function(event, target) { var handle = function(event, target) {
if (target.className && ~target.className.indexOf(CLASS_ACTION)) { if (target.className && ~target.className.indexOf(CLASS_ACTION)) {
if (target.classList.contains('mui-action-back')) {
event.preventDefault(); event.preventDefault();
}
return target; return target;
} }
return false; return false;
...@@ -4624,7 +4980,6 @@ var mui = (function(document, undefined) { ...@@ -4624,7 +4980,6 @@ var mui = (function(document, undefined) {
if (target.tagName === 'A' && target.hash) { if (target.tagName === 'A' && target.hash) {
var modal = document.getElementById(target.hash.replace('#', '')); var modal = document.getElementById(target.hash.replace('#', ''));
if (modal && modal.classList.contains(CLASS_MODAL)) { if (modal && modal.classList.contains(CLASS_MODAL)) {
event.preventDefault(); //fixed hashchange
return modal; return modal;
} }
} }
...@@ -4642,6 +4997,7 @@ var mui = (function(document, undefined) { ...@@ -4642,6 +4997,7 @@ var mui = (function(document, undefined) {
window.addEventListener('tap', function(event) { window.addEventListener('tap', function(event) {
if ($.targets.modal) { if ($.targets.modal) {
event.detail.gesture.preventDefault(); //fixed hashchange
$.targets.modal.classList.toggle('mui-active'); $.targets.modal.classList.toggle('mui-active');
} }
}); });
...@@ -4673,7 +5029,6 @@ var mui = (function(document, undefined) { ...@@ -4673,7 +5029,6 @@ var mui = (function(document, undefined) {
if (target.tagName === 'A' && target.hash) { if (target.tagName === 'A' && target.hash) {
$.targets._popover = document.getElementById(target.hash.replace('#', '')); $.targets._popover = document.getElementById(target.hash.replace('#', ''));
if ($.targets._popover && $.targets._popover.classList.contains(CLASS_POPOVER)) { if ($.targets._popover && $.targets._popover.classList.contains(CLASS_POPOVER)) {
event.preventDefault(); //fixed hashchange
return target; return target;
} else { } else {
$.targets._popover = null; $.targets._popover = null;
...@@ -4704,7 +5059,7 @@ var mui = (function(document, undefined) { ...@@ -4704,7 +5059,7 @@ var mui = (function(document, undefined) {
$.trigger(this, 'shown', this); $.trigger(this, 'shown', this);
} }
var onPopoverHidden = function(e) { var onPopoverHidden = function(e) {
setStyle(this,'none'); setStyle(this, 'none');
this.removeEventListener('webkitTransitionEnd', onPopoverHidden); this.removeEventListener('webkitTransitionEnd', onPopoverHidden);
this.removeEventListener('touchmove', $.preventDefault); this.removeEventListener('touchmove', $.preventDefault);
fixedPopoverScroll(false); fixedPopoverScroll(false);
...@@ -4748,6 +5103,7 @@ var mui = (function(document, undefined) { ...@@ -4748,6 +5103,7 @@ var mui = (function(document, undefined) {
} }
} }
if (toggle) { if (toggle) {
e.detail.gesture.preventDefault(); //fixed hashchange
togglePopover($.targets._popover, $.targets.popover); togglePopover($.targets._popover, $.targets.popover);
} }
...@@ -4896,8 +5252,9 @@ var mui = (function(document, undefined) { ...@@ -4896,8 +5252,9 @@ var mui = (function(document, undefined) {
if (mask._show) { if (mask._show) {
mask._show = false; mask._show = false;
element.setAttribute('style', 'opacity:0'); element.setAttribute('style', 'opacity:0');
setTimeout(function() { $.later(function() {
document.body.removeChild(element); var body = document.body;
element.parentNode === body && body.removeChild(element);
}, 350); }, 350);
} }
return mask; return mask;
...@@ -5138,10 +5495,10 @@ var mui = (function(document, undefined) { ...@@ -5138,10 +5495,10 @@ var mui = (function(document, undefined) {
var classList = this.classList; var classList = this.classList;
if (classList.contains(CLASS_ACTIVE)) { if (classList.contains(CLASS_ACTIVE)) {
classList.remove(CLASS_ACTIVE); classList.remove(CLASS_ACTIVE);
this.handle.style.webkitTransform = 'translate3d(0,0,0)'; this.handle.style.webkitTransform = 'translate(0,0)';
} else { } else {
classList.add(CLASS_ACTIVE); classList.add(CLASS_ACTIVE);
this.handle.style.webkitTransform = 'translate3d(' + this.handleX + 'px,0,0)'; this.handle.style.webkitTransform = 'translate(' + this.handleX + 'px,0)';
} }
$.trigger(this.element, 'toggle', { $.trigger(this.element, 'toggle', {
isActive: this.classList.contains(CLASS_ACTIVE) isActive: this.classList.contains(CLASS_ACTIVE)
...@@ -5157,10 +5514,10 @@ var mui = (function(document, undefined) { ...@@ -5157,10 +5514,10 @@ var mui = (function(document, undefined) {
} }
if (this.lastChanged !== isChanged) { if (this.lastChanged !== isChanged) {
if (isChanged) { if (isChanged) {
this.handle.style.webkitTransform = 'translate3d(' + (this.initialState ? 0 : this.handleX) + 'px,0,0)'; this.handle.style.webkitTransform = 'translate(' + (this.initialState ? 0 : this.handleX) + 'px,0)';
this.classList[this.initialState ? 'remove' : 'add'](CLASS_ACTIVE); this.classList[this.initialState ? 'remove' : 'add'](CLASS_ACTIVE);
} else { } else {
this.handle.style.webkitTransform = 'translate3d(' + (this.initialState ? this.handleX : 0) + 'px,0,0)'; this.handle.style.webkitTransform = 'translate(' + (this.initialState ? this.handleX : 0) + 'px,0)';
this.classList[this.initialState ? 'add' : 'remove'](CLASS_ACTIVE); this.classList[this.initialState ? 'add' : 'remove'](CLASS_ACTIVE);
} }
this.lastChanged = isChanged; this.lastChanged = isChanged;
...@@ -5168,7 +5525,7 @@ var mui = (function(document, undefined) { ...@@ -5168,7 +5525,7 @@ var mui = (function(document, undefined) {
}); });
$.fn.switch = function(options) { $.fn['switch'] = function(options) {
var switchApis = []; var switchApis = [];
this.each(function() { this.each(function() {
var switchApi = null; var switchApi = null;
...@@ -5185,7 +5542,7 @@ var mui = (function(document, undefined) { ...@@ -5185,7 +5542,7 @@ var mui = (function(document, undefined) {
return switchApis.length > 1 ? switchApis : switchApis[0]; return switchApis.length > 1 ? switchApis : switchApis[0];
}; };
$.ready(function() { $.ready(function() {
$('.' + CLASS_SWITCH).switch(); $('.' + CLASS_SWITCH)['switch']();
}); });
})(mui, window, 'toggle'); })(mui, window, 'toggle');
/** /**
...@@ -5200,6 +5557,7 @@ var mui = (function(document, undefined) { ...@@ -5200,6 +5557,7 @@ var mui = (function(document, undefined) {
var CLASS_ACTIVE = 'mui-active'; var CLASS_ACTIVE = 'mui-active';
var CLASS_SELECTED = 'mui-selected'; var CLASS_SELECTED = 'mui-selected';
var CLASS_GRID_VIEW = 'mui-grid-view'; var CLASS_GRID_VIEW = 'mui-grid-view';
var CLASS_RADIO_VIEW = 'mui-table-view-radio';
var CLASS_TABLE_VIEW_CELL = 'mui-table-view-cell'; var CLASS_TABLE_VIEW_CELL = 'mui-table-view-cell';
var CLASS_COLLAPSE_CONTENT = 'mui-collapse-content'; var CLASS_COLLAPSE_CONTENT = 'mui-collapse-content';
var CLASS_DISABLED = 'mui-disabled'; var CLASS_DISABLED = 'mui-disabled';
...@@ -5222,7 +5580,7 @@ var mui = (function(document, undefined) { ...@@ -5222,7 +5580,7 @@ var mui = (function(document, undefined) {
var isMoved = isOpened = openedActions = progress = false; var isMoved = isOpened = openedActions = progress = false;
var sliderHandle = sliderActionLeft = sliderActionRight = buttonsLeft = buttonsRight = sliderDirection = sliderRequestAnimationFrame = false; var sliderHandle = sliderActionLeft = sliderActionRight = buttonsLeft = buttonsRight = sliderDirection = sliderRequestAnimationFrame = false;
var translateX = lastTranslateX = sliderActionLeftWidth = sliderActionRightWidth = 0; var timer = translateX = lastTranslateX = sliderActionLeftWidth = sliderActionRightWidth = 0;
...@@ -5234,6 +5592,7 @@ var mui = (function(document, undefined) { ...@@ -5234,6 +5592,7 @@ var mui = (function(document, undefined) {
cell.classList.add(CLASS_ACTIVE); cell.classList.add(CLASS_ACTIVE);
} }
} else { } else {
timer && timer.cancel();
if (a) { if (a) {
a.classList.remove(CLASS_ACTIVE); a.classList.remove(CLASS_ACTIVE);
} else if (cell) { } else if (cell) {
...@@ -5309,7 +5668,7 @@ var mui = (function(document, undefined) { ...@@ -5309,7 +5668,7 @@ var mui = (function(document, undefined) {
cell = target; cell = target;
//TODO swipe to delete close //TODO swipe to delete close
var selected = cell.parentNode.querySelector(SELECTOR_SELECTED); var selected = cell.parentNode.querySelector(SELECTOR_SELECTED);
if (selected && selected !== cell) { if (!cell.parentNode.classList.contains(CLASS_RADIO_VIEW) && selected && selected !== cell) {
$.swipeoutClose(selected); $.swipeoutClose(selected);
cell = isDisabled = false; cell = isDisabled = false;
return; return;
...@@ -5320,12 +5679,20 @@ var mui = (function(document, undefined) { ...@@ -5320,12 +5679,20 @@ var mui = (function(document, undefined) {
a = link; a = link;
} }
} }
if (cell.querySelector(SELECTOR_SLIDER_HANDLE)) { var handle = cell.querySelector(SELECTOR_SLIDER_HANDLE);
if (handle) {
toggleEvents(cell); toggleEvents(cell);
event.stopPropagation(); event.stopPropagation();
} }
if (!isDisabled) { if (!isDisabled) {
if (!(cell.querySelector('input') || cell.querySelector(SELECTOR_BUTTON) || cell.querySelector('.' + CLASS_TOGGLE))) { if (handle) {
if (timer) {
timer.cancel();
}
timer = $.later(function() {
toggleActive(true);
}, 100);
} else if (!(cell.querySelector('input') || cell.querySelector(SELECTOR_BUTTON) || cell.querySelector('.' + CLASS_TOGGLE))) {
toggleActive(true); toggleActive(true);
} }
} }
...@@ -5610,12 +5977,14 @@ var mui = (function(document, undefined) { ...@@ -5610,12 +5977,14 @@ var mui = (function(document, undefined) {
if (classList.contains('mui-radio')) { if (classList.contains('mui-radio')) {
var input = cell.querySelector('input[type=radio]'); var input = cell.querySelector('input[type=radio]');
if (input) { if (input) {
input.click(); // input.click();
input.checked = !input.checked;
} }
} else if (classList.contains('mui-checkbox')) { } else if (classList.contains('mui-checkbox')) {
var input = cell.querySelector('input[type=checkbox]'); var input = cell.querySelector('input[type=checkbox]');
if (input) { if (input) {
input.click(); // input.click();
input.checked = !input.checked;
} }
} }
}; };
...@@ -5630,14 +5999,38 @@ var mui = (function(document, undefined) { ...@@ -5630,14 +5999,38 @@ var mui = (function(document, undefined) {
radioOrCheckboxClick(); radioOrCheckboxClick();
} }
}); });
var preventDefaultException = /^(INPUT|TEXTAREA|BUTTON|SELECT)$/;
window.addEventListener('tap', function(event) { window.addEventListener('tap', function(event) {
if (!cell) { if (!cell) {
return; return;
} }
var type = event.target && event.target.type;
if (type === 'radio' || type === 'checkbox') {
radioOrCheckboxClick();
return;
}
var isExpand = false; var isExpand = false;
var classList = cell.classList; var classList = cell.classList;
var ul = cell.parentNode;
if (ul && ul.classList.contains(CLASS_RADIO_VIEW)) {
if (classList.contains(CLASS_SELECTED)) {
return;
}
var selected = ul.querySelector('li' + SELECTOR_SELECTED);
if (selected) {
selected.classList.remove(CLASS_SELECTED);
}
classList.add(CLASS_SELECTED);
$.trigger(cell, 'selected', {
el: cell
});
return;
}
if (classList.contains('mui-collapse') && !cell.parentNode.classList.contains('mui-unfold')) { if (classList.contains('mui-collapse') && !cell.parentNode.classList.contains('mui-unfold')) {
if (!preventDefaultException.test(event.target.tagName)) {
event.detail.gesture.preventDefault(); event.detail.gesture.preventDefault();
}
if (!classList.contains(CLASS_ACTIVE)) { //展开时,需要收缩其他同类 if (!classList.contains(CLASS_ACTIVE)) { //展开时,需要收缩其他同类
var collapse = cell.parentNode.querySelector('.mui-collapse.mui-active'); var collapse = cell.parentNode.querySelector('.mui-collapse.mui-active');
if (collapse) { if (collapse) {
...@@ -5663,8 +6056,9 @@ var mui = (function(document, undefined) { ...@@ -5663,8 +6056,9 @@ var mui = (function(document, undefined) {
// $.scrollTo(cellHeight - height + scrollTop, 300); // $.scrollTo(cellHeight - height + scrollTop, 300);
// } // }
} }
} } else {
radioOrCheckboxClick(); radioOrCheckboxClick();
}
}); });
})(mui, window, document); })(mui, window, document);
(function($, window) { (function($, window) {
...@@ -5698,25 +6092,33 @@ var mui = (function(document, undefined) { ...@@ -5698,25 +6092,33 @@ var mui = (function(document, undefined) {
/** /**
* 确认消息框 * 确认消息框
*/ */
$.confirm = function(message,title,btnArray,callback) { $.confirm = function(message, title, btnArray, callback) {
if ($.os.plus) { if ($.os.plus) {
if(typeof message === undefined){ if (typeof message === undefined) {
return; return;
}else{ } else {
if(typeof title ==='function'){ if (typeof title === 'function') {
callback = title; callback = title;
title = null; title = null;
btnArray = null; btnArray = null;
}else if(typeof btnArray ==='function'){ } else if (typeof btnArray === 'function') {
callback = btnArray; callback = btnArray;
btnArray = null; btnArray = null;
} }
plus.nativeUI.confirm(message,callback,title,btnArray); plus.nativeUI.confirm(message, callback, title, btnArray);
} }
}else{ } else {
//TODO H5版本 //H5版本,0为确认,1为取消
window.confirm(message); if (window.confirm(message)) {
callback({
index: 0
});
} else {
callback({
index: 1
});
}
} }
}; };
...@@ -5725,31 +6127,42 @@ var mui = (function(document, undefined) { ...@@ -5725,31 +6127,42 @@ var mui = (function(document, undefined) {
/** /**
* 输入对话框 * 输入对话框
*/ */
$.prompt = function(text,defaultText,title,btnArray,callback) { $.prompt = function(text, defaultText, title, btnArray, callback) {
if ($.os.plus) { if ($.os.plus) {
if(typeof message === undefined){ if (typeof message === undefined) {
return; return;
}else{ } else {
if(typeof defaultText ==='function'){ if (typeof defaultText === 'function') {
callback = defaultText; callback = defaultText;
defaultText = null; defaultText = null;
title = null; title = null;
btnArray = null; btnArray = null;
}else if(typeof title === 'function'){ } else if (typeof title === 'function') {
callback = title; callback = title;
title = null; title = null;
btnArray = null; btnArray = null;
}else if(typeof btnArray ==='function'){ } else if (typeof btnArray === 'function') {
callback = btnArray; callback = btnArray;
btnArray = null; btnArray = null;
} }
plus.nativeUI.prompt(text,callback,title,defaultText,btnArray); plus.nativeUI.prompt(text, callback, title, defaultText, btnArray);
} }
}else{ } else {
//TODO H5版本 //H5版本(确认index为0,取消index为1)
window.prompt(text); var result = window.prompt(text);
if (result) {
callback({
index: 0,
value: result
});
} else {
callback({
index: 1,
value: ''
});
}
} }
}; };
...@@ -5814,7 +6227,7 @@ var mui = (function(document, undefined) { ...@@ -5814,7 +6227,7 @@ var mui = (function(document, undefined) {
this.sliderActionSelector = SELECTOR_TOOLTIP; this.sliderActionSelector = SELECTOR_TOOLTIP;
} else { //clear,speech,search } else { //clear,speech,search
if (~this.options.actions.indexOf('clear')) { if (~this.options.actions.indexOf('clear')) {
this.clearActionClass = CLASS_ICON + ' ' + CLASS_ICON_CLEAR + (element.value ? '' : (' ' + CLASS_HIDDEN)); this.clearActionClass = CLASS_ICON + ' ' + CLASS_ICON_CLEAR +' '+ CLASS_HIDDEN;
this.clearActionSelector = SELECTOR_ICON_CLOSE; this.clearActionSelector = SELECTOR_ICON_CLOSE;
} }
if (~this.options.actions.indexOf('speech')) { //only for 5+ if (~this.options.actions.indexOf('speech')) { //only for 5+
...@@ -5870,8 +6283,11 @@ var mui = (function(document, undefined) { ...@@ -5870,8 +6283,11 @@ var mui = (function(document, undefined) {
var action = document.createElement('span'); var action = document.createElement('span');
action.className = actionClass; action.className = actionClass;
if (actionClass === this.searchActionClass) { if (actionClass === this.searchActionClass) {
action.innerHTML = '<span class="' + CLASS_ICON + ' ' + CLASS_ICON_SEARCH + '"></span>' + this.element.getAttribute('placeholder'); action.innerHTML = '<span class="' + CLASS_ICON + ' ' + CLASS_ICON_SEARCH + '"></span><span>' + this.element.getAttribute('placeholder') + '</span>';
this.element.setAttribute('placeholder', ''); this.element.setAttribute('placeholder', '');
if (this.element.value.trim()) {
row.classList.add('mui-active');
}
} }
row.insertBefore(action, this.element.nextSibling); row.insertBefore(action, this.element.nextSibling);
} }
...@@ -5913,13 +6329,16 @@ var mui = (function(document, undefined) { ...@@ -5913,13 +6329,16 @@ var mui = (function(document, undefined) {
if (!action) { if (!action) {
return; return;
} }
$.each(['keyup', 'change', 'input', 'focus', 'blur', 'cut', 'paste'], function(index, type) { $.each(['keyup', 'change', 'input', 'focus', 'cut', 'paste'], function(index, type) {
(function(type) { (function(type) {
element.addEventListener(type, function() { element.addEventListener(type, function() {
action.classList[element.value.trim() ? 'remove' : 'add'](CLASS_HIDDEN); action.classList[element.value.trim() ? 'remove' : 'add'](CLASS_HIDDEN);
}); });
})(type); })(type);
}); });
element.addEventListener('blur', function() {
action.classList.add(CLASS_HIDDEN);
});
} }
if (this.searchActionClass) { if (this.searchActionClass) {
element.addEventListener('focus', function() { element.addEventListener('focus', function() {
...@@ -5933,6 +6352,14 @@ var mui = (function(document, undefined) { ...@@ -5933,6 +6352,14 @@ var mui = (function(document, undefined) {
} }
} }
}; };
Input.prototype.setPlaceholder = function(text) {
if (this.searchActionClass) {
var placeholder = this.element.parentNode.querySelector(SELECTOR_PLACEHOLDER);
placeholder && (placeholder.getElementsByTagName('span')[1].innerText = text);
} else {
this.element.setAttribute('placeholder', text);
}
};
Input.prototype.clearActionClick = function(event) { Input.prototype.clearActionClick = function(event) {
var self = this; var self = this;
self.element.value = ''; self.element.value = '';
...@@ -5943,6 +6370,7 @@ var mui = (function(document, undefined) { ...@@ -5943,6 +6370,7 @@ var mui = (function(document, undefined) {
Input.prototype.speechActionClick = function(event) { Input.prototype.speechActionClick = function(event) {
if (window.plus) { if (window.plus) {
var self = this; var self = this;
var oldValue = self.element.value;
self.element.value = ''; self.element.value = '';
document.body.classList.add(CLASS_FOCUSIN); document.body.classList.add(CLASS_FOCUSIN);
plus.speech.startRecognize({ plus.speech.startRecognize({
...@@ -5954,6 +6382,10 @@ var mui = (function(document, undefined) { ...@@ -5954,6 +6382,10 @@ var mui = (function(document, undefined) {
$.trigger(self.element, 'recognized', { $.trigger(self.element, 'recognized', {
value: self.element.value value: self.element.value
}); });
if (oldValue !== self.element.value) {
$.trigger(self.element, 'change');
$.trigger(self.element, 'input');
}
// document.body.classList.remove(CLASS_FOCUSIN); // document.body.classList.remove(CLASS_FOCUSIN);
}, function(e) { }, function(e) {
document.body.classList.remove(CLASS_FOCUSIN); document.body.classList.remove(CLASS_FOCUSIN);
...@@ -5964,7 +6396,9 @@ var mui = (function(document, undefined) { ...@@ -5964,7 +6396,9 @@ var mui = (function(document, undefined) {
event.preventDefault(); event.preventDefault();
}; };
$.fn.input = function(options) { $.fn.input = function(options) {
var inputApis = [];
this.each(function() { this.each(function() {
var inputApi = null;
var actions = []; var actions = [];
var row = findRow(this.parentNode); var row = findRow(this.parentNode);
if (this.type === 'range' && row.classList.contains('mui-input-range')) { if (this.type === 'range' && row.classList.contains('mui-input-range')) {
...@@ -5984,17 +6418,120 @@ var mui = (function(document, undefined) { ...@@ -5984,17 +6418,120 @@ var mui = (function(document, undefined) {
var id = this.getAttribute('data-input-' + actions[0]); var id = this.getAttribute('data-input-' + actions[0]);
if (!id) { if (!id) {
id = ++$.uuid; id = ++$.uuid;
$.data[id] = new Input(this, { inputApi = $.data[id] = new Input(this, {
actions: actions.join(',') actions: actions.join(',')
}); });
for (var i = 0, len = actions.length; i < len; i++) { for (var i = 0, len = actions.length; i < len; i++) {
this.setAttribute('data-input-' + actions[i], id); this.setAttribute('data-input-' + actions[i], id);
} }
} else {
inputApi = $.data[id];
} }
inputApis.push(inputApi);
}); });
return inputApis.length === 1 ? inputApis[0] : inputApis;
}; };
$.ready(function() { $.ready(function() {
$('.mui-input-row input').input(); $('.mui-input-row input').input();
}); });
})(mui, window, document); })(mui, window, document);
/**
* 数字输入框
* varstion 1.0.1
* by Houfeng
* Houfeng@DCloud.io
*/
(function($) {
var touchSupport = ('ontouchstart' in document);
var tapEventName = touchSupport ? 'tap' : 'click';
var changeEventName = 'change';
var holderClassName = 'mui-numbox';
var plusClassName = 'mui-numbox-btn-plus';
var minusClassName = 'mui-numbox-btn-minus';
var inputClassName = 'mui-numbox-input';
var Numbox = $.Numbox = $.Class.extend({
init: function(holder, options) {
var self = this;
if (!holder) {
throw "构造 numbox 时缺少容器元素";
}
self.holder = holder;
//避免重复初始化开始
if (self.holder.__numbox_inited) return;
self.holder.__numbox_inited = true;
//避免重复初始化结束
options = options || {};
options.step = parseInt(options.step || 1);
self.options = options;
self.input = $.qsa('.' + inputClassName, self.holder)[0];
self.plus = $.qsa('.' + plusClassName, self.holder)[0];
self.minus = $.qsa('.' + minusClassName, self.holder)[0];
self.checkValue();
self.initEvent();
},
initEvent: function() {
var self = this;
self.plus.addEventListener(tapEventName, function(event) {
var val = parseInt(self.input.value) + self.options.step;
self.input.value = val.toString();
$.trigger(self.input, changeEventName, null);
});
self.minus.addEventListener(tapEventName, function(event) {
var val = parseInt(self.input.value) - self.options.step;
self.input.value = val.toString();
$.trigger(self.input, changeEventName, null);
});
self.input.addEventListener(changeEventName, function(event) {
self.checkValue();
});
},
checkValue: function() {
var self = this;
var val = self.input.value;
if (val == null || val == '' || isNaN(val)) {
self.input.value = self.options.min || 0;
self.minus.disabled = self.options.min != null;
} else {
var val = parseInt(val);
if (self.options.max != null && !isNaN(self.options.max) && val >= parseInt(self.options.max)) {
val = self.options.max;
self.plus.disabled = true;
} else {
self.plus.disabled = false;
}
if (self.options.min != null && !isNaN(self.options.min) && val <= parseInt(self.options.min)) {
val = self.options.min;
self.minus.disabled = true;
} else {
self.minus.disabled = false;
}
self.input.value = val;
}
}
});
$.fn.numbox = function(options) {
//遍历选择的元素
this.each(function(i, element) {
if (options) {
new Numbox(element, options);
} else {
var optionsText = element.getAttribute('data-numbox-options');
var options = optionsText ? JSON.parse(optionsText) : {};
options.step = element.getAttribute('data-numbox-step') || options.step;
options.min = element.getAttribute('data-numbox-min') || options.min;
options.max = element.getAttribute('data-numbox-max') || options.max;
new Numbox(element, options);
}
});
return this;
}
//自动处理 class='mui-locker' 的 dom
$.ready(function() {
$('.' + holderClassName).numbox();
});
}(mui))
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/mui.min.css?v=2015-04-20 12:10:17 +0800"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/mui.min.css?v=2015-06-15 12:03:29 +0800">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/assets/css/docs.css?v=2015-04-20 12:10:17 +0800"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/assets/css/docs.css?v=2015-06-15 12:03:29 +0800">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://dcloudio.github.io/mui/assets/img/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://dcloudio.github.io/mui/assets/img/apple-touch-icon-114x114.png">
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
<p class="docs-footer-text">mui遵循 <a href="https://github.com/dcloudio/mui/blob/master/LICENSE">MIT License</a> <p class="docs-footer-text">mui遵循 <a href="https://github.com/dcloudio/mui/blob/master/LICENSE">MIT License</a>
</p> </p>
<ul class="docs-footer-links"> <ul class="docs-footer-links">
<li>最新版本 v1.5.0</li> <li>最新版本 v1.8.0</li>
<li>&middot;</li> <li>&middot;</li>
<li><a href="http://ask.dcloud.net.cn">问答社区</a></li> <li><a href="http://ask.dcloud.net.cn">问答社区</a></li>
<li>&middot;</li> <li>&middot;</li>
...@@ -170,8 +170,8 @@ ...@@ -170,8 +170,8 @@
</div> </div>
<script src="http://dcloudio.github.io/mui/dist/js/jquery-2.1.1.js"></script> <script src="http://dcloudio.github.io/mui/dist/js/jquery-2.1.1.js"></script>
<script src="http://dcloudio.github.io/mui/dist/js/bootstrap.min.js"></script> <script src="http://dcloudio.github.io/mui/dist/js/bootstrap.min.js"></script>
<script src="http://dcloudio.github.io/mui/dist/js/mui.min.js?v=2015-04-20 12:10:17 +0800"></script> <script src="http://dcloudio.github.io/mui/dist/js/mui.min.js?v=2015-06-15 12:03:29 +0800"></script>
<script src="http://dcloudio.github.io/mui/assets/js/docs.min.js?v=2015-04-20 12:10:17 +0800"></script> <script src="http://dcloudio.github.io/mui/assets/js/docs.min.js?v=2015-06-15 12:03:29 +0800"></script>
<script type="text/javascript"> <script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://"); var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Ffff299fda9ff2d5ac97d9e621f738e52' type='text/javascript'%3E%3C/script%3E")); document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Ffff299fda9ff2d5ac97d9e621f738e52' type='text/javascript'%3E%3C/script%3E"));
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/mui.min.css?v=2015-04-20 12:10:17 +0800"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/mui.min.css?v=2015-06-15 12:03:29 +0800">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/assets/css/docs.css?v=2015-04-20 12:10:17 +0800"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/assets/css/docs.css?v=2015-06-15 12:03:29 +0800">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://dcloudio.github.io/mui/assets/img/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://dcloudio.github.io/mui/assets/img/apple-touch-icon-114x114.png">
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
<p class="docs-footer-text">mui遵循 <a href="https://github.com/dcloudio/mui/blob/master/LICENSE">MIT License</a> <p class="docs-footer-text">mui遵循 <a href="https://github.com/dcloudio/mui/blob/master/LICENSE">MIT License</a>
</p> </p>
<ul class="docs-footer-links"> <ul class="docs-footer-links">
<li>最新版本 v1.5.0</li> <li>最新版本 v1.8.0</li>
<li>&middot;</li> <li>&middot;</li>
<li><a href="http://ask.dcloud.net.cn">问答社区</a></li> <li><a href="http://ask.dcloud.net.cn">问答社区</a></li>
<li>&middot;</li> <li>&middot;</li>
...@@ -121,8 +121,8 @@ ...@@ -121,8 +121,8 @@
</div> </div>
<script src="http://dcloudio.github.io/mui/dist/js/jquery-2.1.1.js"></script> <script src="http://dcloudio.github.io/mui/dist/js/jquery-2.1.1.js"></script>
<script src="http://dcloudio.github.io/mui/dist/js/bootstrap.min.js"></script> <script src="http://dcloudio.github.io/mui/dist/js/bootstrap.min.js"></script>
<script src="http://dcloudio.github.io/mui/dist/js/mui.min.js?v=2015-04-20 12:10:17 +0800"></script> <script src="http://dcloudio.github.io/mui/dist/js/mui.min.js?v=2015-06-15 12:03:29 +0800"></script>
<script src="http://dcloudio.github.io/mui/assets/js/docs.min.js?v=2015-04-20 12:10:17 +0800"></script> <script src="http://dcloudio.github.io/mui/assets/js/docs.min.js?v=2015-06-15 12:03:29 +0800"></script>
<script type="text/javascript"> <script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://"); var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Ffff299fda9ff2d5ac97d9e621f738e52' type='text/javascript'%3E%3C/script%3E")); document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Ffff299fda9ff2d5ac97d9e621f738e52' type='text/javascript'%3E%3C/script%3E"));
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/mui.min.css?v=2015-04-20 12:10:17 +0800"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/dist/css/mui.min.css?v=2015-06-15 12:03:29 +0800">
<link rel="stylesheet" href="http://dcloudio.github.io/mui/assets/css/docs.css?v=2015-04-20 12:10:17 +0800"> <link rel="stylesheet" href="http://dcloudio.github.io/mui/assets/css/docs.css?v=2015-06-15 12:03:29 +0800">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://dcloudio.github.io/mui/assets/img/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://dcloudio.github.io/mui/assets/img/apple-touch-icon-114x114.png">
...@@ -225,7 +225,8 @@ mui的解决思路是:单webview只承载单个页面的dom,减少dom层级 ...@@ -225,7 +225,8 @@ mui的解决思路是:单webview只承载单个页面的dom,减少dom层级
}, },
extras:{ extras:{
.....//自定义扩展参数,可以用来处理页面间传值 .....//自定义扩展参数,可以用来处理页面间传值
} },
crateNew:false,//是否重复创建同样id的webview,默认为false:不重复创建,直接显示
show:{ show:{
autoShow:true,//页面loaded事件发生后自动显示,默认为true autoShow:true,//页面loaded事件发生后自动显示,默认为true
aniShow:animationType,//页面显示动画,默认为”slide-in-right“; aniShow:animationType,//页面显示动画,默认为”slide-in-right“;
...@@ -697,7 +698,7 @@ mui的解决思路是:单webview只承载单个页面的dom,减少dom层级 ...@@ -697,7 +698,7 @@ mui的解决思路是:单webview只承载单个页面的dom,减少dom层级
<span class="c1">//业务逻辑代码,比如通过ajax从服务器获取新数据;</span> <span class="c1">//业务逻辑代码,比如通过ajax从服务器获取新数据;</span>
<span class="p">......</span> <span class="p">......</span>
<span class="c1">//注意,加载完新数据后,必须执行如下代码,注意:若为ajax请求,则需将如下代码放置在处理完ajax响应数据之后</span> <span class="c1">//注意,加载完新数据后,必须执行如下代码,注意:若为ajax请求,则需将如下代码放置在处理完ajax响应数据之后</span>
<span class="nx">mui</span><span class="p">(</span><span class="s1">&#39;#pullrefreshContainer&#39;</span><span class="p">).</span><span class="nx">pullRefresh</span><span class="p">().</span><span class="nx">endPulldownToRefresh</span><span class="p">();</span> <span class="nx">mui</span><span class="p">(</span><span class="s1">&#39;#refreshContainer&#39;</span><span class="p">).</span><span class="nx">pullRefresh</span><span class="p">().</span><span class="nx">endPulldownToRefresh</span><span class="p">();</span>
<span class="p">}</span></code></pre></div> <span class="p">}</span></code></pre></div>
</article> </article>
<!-- 上拉加载 --> <!-- 上拉加载 -->
...@@ -917,6 +918,14 @@ mui的解决思路是:单webview只承载单个页面的dom,减少dom层级 ...@@ -917,6 +918,14 @@ mui的解决思路是:单webview只承载单个页面的dom,减少dom层级
<span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">&quot;mui-slider-item mui-slider-item-duplicate&quot;</span><span class="nt">&gt;&lt;a</span> <span class="na">href=</span><span class="s">&quot;#&quot;</span><span class="nt">&gt;&lt;img</span> <span class="na">src=</span><span class="s">&quot;1.jpg&quot;</span> <span class="nt">/&gt;&lt;/a&gt;&lt;/div&gt;</span> <span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">&quot;mui-slider-item mui-slider-item-duplicate&quot;</span><span class="nt">&gt;&lt;a</span> <span class="na">href=</span><span class="s">&quot;#&quot;</span><span class="nt">&gt;&lt;img</span> <span class="na">src=</span><span class="s">&quot;1.jpg&quot;</span> <span class="nt">/&gt;&lt;/a&gt;&lt;/div&gt;</span>
<span class="nt">&lt;/div&gt;</span> <span class="nt">&lt;/div&gt;</span>
<span class="nt">&lt;/div&gt;</span></code></pre></div> <span class="nt">&lt;/div&gt;</span></code></pre></div>
<p class="component-description">
<strong>注意:</strong>mui框架会默认初始化当前页面的图片轮播组件;若轮播组件内容为js动态生成时(比如通过ajax动态获取的营销信息),则需要在动态DOM生成后,手动调用图片轮播的初始化方法;代码如下:
</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="c1">//获得slider插件对象</span>
<span class="kd">var</span> <span class="nx">gallery</span> <span class="o">=</span> <span class="nx">mui</span><span class="p">(</span><span class="s1">&#39;.mui-slider&#39;</span><span class="p">);</span>
<span class="nx">gallery</span><span class="p">.</span><span class="nx">slider</span><span class="p">({</span>
<span class="nx">interval</span><span class="o">:</span><span class="mi">5000</span><span class="c1">//自动轮播周期,若为0则不自动播放,默认为0;</span>
<span class="p">});</span></code></pre></div>
</article> </article>
<!-- 侧滑菜单 --> <!-- 侧滑菜单 -->
<article id="plugin-offcanvas" class="component mui-active"> <article id="plugin-offcanvas" class="component mui-active">
...@@ -1065,7 +1074,7 @@ mui的解决思路是:单webview只承载单个页面的dom,减少dom层级 ...@@ -1065,7 +1074,7 @@ mui的解决思路是:单webview只承载单个页面的dom,减少dom层级
<p class="docs-footer-text">mui遵循 <a href="https://github.com/dcloudio/mui/blob/master/LICENSE">MIT License</a> <p class="docs-footer-text">mui遵循 <a href="https://github.com/dcloudio/mui/blob/master/LICENSE">MIT License</a>
</p> </p>
<ul class="docs-footer-links"> <ul class="docs-footer-links">
<li>最新版本 v1.5.0</li> <li>最新版本 v1.8.0</li>
<li>&middot;</li> <li>&middot;</li>
<li><a href="http://ask.dcloud.net.cn">问答社区</a></li> <li><a href="http://ask.dcloud.net.cn">问答社区</a></li>
<li>&middot;</li> <li>&middot;</li>
...@@ -1079,8 +1088,8 @@ mui的解决思路是:单webview只承载单个页面的dom,减少dom层级 ...@@ -1079,8 +1088,8 @@ mui的解决思路是:单webview只承载单个页面的dom,减少dom层级
</div> </div>
<script src="http://dcloudio.github.io/mui/dist/js/jquery-2.1.1.js"></script> <script src="http://dcloudio.github.io/mui/dist/js/jquery-2.1.1.js"></script>
<script src="http://dcloudio.github.io/mui/dist/js/bootstrap.min.js"></script> <script src="http://dcloudio.github.io/mui/dist/js/bootstrap.min.js"></script>
<script src="http://dcloudio.github.io/mui/dist/js/mui.min.js?v=2015-04-20 12:10:17 +0800"></script> <script src="http://dcloudio.github.io/mui/dist/js/mui.min.js?v=2015-06-15 12:03:29 +0800"></script>
<script src="http://dcloudio.github.io/mui/assets/js/docs.min.js?v=2015-04-20 12:10:17 +0800"></script> <script src="http://dcloudio.github.io/mui/assets/js/docs.min.js?v=2015-06-15 12:03:29 +0800"></script>
<script type="text/javascript"> <script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://"); var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Ffff299fda9ff2d5ac97d9e621f738e52' type='text/javascript'%3E%3C/script%3E")); document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Ffff299fda9ff2d5ac97d9e621f738e52' type='text/javascript'%3E%3C/script%3E"));
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url> <url>
<loc>http://dcloudio.github.io/mui/</loc> <loc>http://dcloudio.github.io/mui/</loc>
<lastmod>2015-04-20T12:10:17+08:00</lastmod> <lastmod>2015-06-15T12:03:29+08:00</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
<priority>1.0</priority> <priority>1.0</priority>
</url> </url>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<url> <url>
<loc>http://dcloudio.github.io/mui/about/</loc> <loc>http://dcloudio.github.io/mui/about/</loc>
<lastmod>2015-04-20T12:10:17+08:00</lastmod> <lastmod>2015-06-15T12:03:29+08:00</lastmod>
<changefreq>weekly</changefreq> <changefreq>weekly</changefreq>
<priority>0.7</priority> <priority>0.7</priority>
</url> </url>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<url> <url>
<loc>http://dcloudio.github.io/mui/components/</loc> <loc>http://dcloudio.github.io/mui/components/</loc>
<lastmod>2015-04-20T12:10:17+08:00</lastmod> <lastmod>2015-06-15T12:03:29+08:00</lastmod>
<changefreq>weekly</changefreq> <changefreq>weekly</changefreq>
<priority>0.7</priority> <priority>0.7</priority>
</url> </url>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<url> <url>
<loc>http://dcloudio.github.io/mui/getting-started/</loc> <loc>http://dcloudio.github.io/mui/getting-started/</loc>
<lastmod>2015-04-20T12:10:17+08:00</lastmod> <lastmod>2015-06-15T12:03:29+08:00</lastmod>
<changefreq>weekly</changefreq> <changefreq>weekly</changefreq>
<priority>0.7</priority> <priority>0.7</priority>
</url> </url>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<url> <url>
<loc>http://dcloudio.github.io/mui/javascript/</loc> <loc>http://dcloudio.github.io/mui/javascript/</loc>
<lastmod>2015-04-20T12:10:17+08:00</lastmod> <lastmod>2015-06-15T12:03:29+08:00</lastmod>
<changefreq>weekly</changefreq> <changefreq>weekly</changefreq>
<priority>0.7</priority> <priority>0.7</priority>
</url> </url>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment