Skip to content

Commit 9cc25ab

Browse files
committed
编译至mui v2.5.0
1 parent 9813ac6 commit 9cc25ab

File tree

14 files changed

+137
-94
lines changed

14 files changed

+137
-94
lines changed

Gruntfile.js

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

dist/css/mui.css

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

dist/css/mui.min.css

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

dist/js/mui.js

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* =====================================================
3-
* Mui v2.4.0 (https://github.com/dcloudio/mui)
3+
* Mui v2.5.0 (http://dev.dcloud.net.cn/mui)
44
* =====================================================
55
*/
66
/**
@@ -190,25 +190,6 @@ var mui = (function(document, undefined) {
190190
}
191191
return this;
192192
};
193-
/**
194-
* map
195-
*/
196-
$.map = function(elements, callback) {
197-
var value, values = [],
198-
i, key;
199-
if (typeof elements.length === 'number') { //TODO 此处逻辑不严谨,可能会有Object:{a:'b',length:1}的情况未处理
200-
for (i = 0, len = elements.length; i < len; i++) {
201-
value = callback(elements[i], i);
202-
if (value != null) values.push(value);
203-
}
204-
} else {
205-
for (key in elements) {
206-
value = callback(elements[key], key);
207-
if (value != null) values.push(value);
208-
}
209-
}
210-
return values.length > 0 ? [].concat.apply([], values) : values;
211-
};
212193
/**
213194
* each
214195
* @param {type} elements
@@ -587,6 +568,32 @@ var mui = (function(document, undefined) {
587568
window.CustomEvent = CustomEvent;
588569
}
589570
})();
571+
/*
572+
A shim for non ES5 supporting browsers.
573+
Adds function bind to Function prototype, so that you can do partial application.
574+
Works even with the nasty thing, where the first word is the opposite of extranet, the second one is the profession of Columbus, and the version number is 9, flipped 180 degrees.
575+
*/
576+
577+
Function.prototype.bind = Function.prototype.bind || function(to) {
578+
// Make an array of our arguments, starting from second argument
579+
var partial = Array.prototype.splice.call(arguments, 1),
580+
// We'll need the original function.
581+
fn = this;
582+
var bound = function() {
583+
// Join the already applied arguments to the now called ones (after converting to an array again).
584+
var args = partial.concat(Array.prototype.splice.call(arguments, 0));
585+
// If not being called as a constructor
586+
if (!(this instanceof bound)) {
587+
// return the result of the function called bound to target and partially applied.
588+
return fn.apply(to, args);
589+
}
590+
// If being called as a constructor, apply the function bound to self.
591+
fn.apply(this, args);
592+
}
593+
// Attach the prototype of the function to our newly created function.
594+
bound.prototype = fn.prototype;
595+
return bound;
596+
};
590597
/**
591598
* mui fixed classList
592599
* @param {type} document
@@ -4253,6 +4260,7 @@ var mui = (function(document, undefined) {
42534260
indicators: false,
42544261
bounceTime: 200,
42554262
startX: false,
4263+
slideTime: 0, //滑动动画时间
42564264
snap: SELECTOR_SLIDER_ITEM
42574265
}, options));
42584266
if (this.options.startX) {
@@ -4313,7 +4321,14 @@ var mui = (function(document, undefined) {
43134321
}
43144322
var detail = e.detail;
43154323
detail.slideNumber = detail.slideNumber || 0;
4316-
var items = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
4324+
var temps = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
4325+
var items = [];
4326+
for (var i = 0, len = temps.length; i < len; i++) {
4327+
var item = temps[i];
4328+
if (item.parentNode === self.scroller) {
4329+
items.push(item);
4330+
}
4331+
}
43174332
var _slideNumber = detail.slideNumber;
43184333
if (self.loop) {
43194334
_slideNumber += 1;
@@ -4356,7 +4371,7 @@ var mui = (function(document, undefined) {
43564371
},
43574372
_handleTabShow: function(e) {
43584373
var self = this;
4359-
self.gotoItem((e.detail.tabNumber || 0), self.options.bounceTime);
4374+
self.gotoItem((e.detail.tabNumber || 0), self.options.slideTime);
43604375
},
43614376
_handleIndicatorTap: function(event) {
43624377
var self = this;
@@ -7012,10 +7027,9 @@ var mui = (function(document, undefined) {
70127027
self.input.value = val.toString();
70137028
$.trigger(self.input, changeEventName, null);
70147029
});
7015-
// self.input.addEventListener(changeEventName, function(event) {
7016-
// self.checkValue();
7017-
// $.trigger(self, changeEventName, self.getValue());
7018-
// });
7030+
self.input.addEventListener(changeEventName, function(event) {
7031+
self.checkValue();
7032+
});
70197033
},
70207034
/**
70217035
* 获取当前值

dist/js/mui.min.js

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

examples/hello-mui/css/mui.css

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

examples/hello-mui/css/mui.min.css

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

examples/hello-mui/js/mui.js

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* =====================================================
3-
* Mui v2.4.0 (https://github.com/dcloudio/mui)
3+
* Mui v2.5.0 (http://dev.dcloud.net.cn/mui)
44
* =====================================================
55
*/
66
/**
@@ -190,25 +190,6 @@ var mui = (function(document, undefined) {
190190
}
191191
return this;
192192
};
193-
/**
194-
* map
195-
*/
196-
$.map = function(elements, callback) {
197-
var value, values = [],
198-
i, key;
199-
if (typeof elements.length === 'number') { //TODO 此处逻辑不严谨,可能会有Object:{a:'b',length:1}的情况未处理
200-
for (i = 0, len = elements.length; i < len; i++) {
201-
value = callback(elements[i], i);
202-
if (value != null) values.push(value);
203-
}
204-
} else {
205-
for (key in elements) {
206-
value = callback(elements[key], key);
207-
if (value != null) values.push(value);
208-
}
209-
}
210-
return values.length > 0 ? [].concat.apply([], values) : values;
211-
};
212193
/**
213194
* each
214195
* @param {type} elements
@@ -587,6 +568,32 @@ var mui = (function(document, undefined) {
587568
window.CustomEvent = CustomEvent;
588569
}
589570
})();
571+
/*
572+
A shim for non ES5 supporting browsers.
573+
Adds function bind to Function prototype, so that you can do partial application.
574+
Works even with the nasty thing, where the first word is the opposite of extranet, the second one is the profession of Columbus, and the version number is 9, flipped 180 degrees.
575+
*/
576+
577+
Function.prototype.bind = Function.prototype.bind || function(to) {
578+
// Make an array of our arguments, starting from second argument
579+
var partial = Array.prototype.splice.call(arguments, 1),
580+
// We'll need the original function.
581+
fn = this;
582+
var bound = function() {
583+
// Join the already applied arguments to the now called ones (after converting to an array again).
584+
var args = partial.concat(Array.prototype.splice.call(arguments, 0));
585+
// If not being called as a constructor
586+
if (!(this instanceof bound)) {
587+
// return the result of the function called bound to target and partially applied.
588+
return fn.apply(to, args);
589+
}
590+
// If being called as a constructor, apply the function bound to self.
591+
fn.apply(this, args);
592+
}
593+
// Attach the prototype of the function to our newly created function.
594+
bound.prototype = fn.prototype;
595+
return bound;
596+
};
590597
/**
591598
* mui fixed classList
592599
* @param {type} document
@@ -4253,6 +4260,7 @@ var mui = (function(document, undefined) {
42534260
indicators: false,
42544261
bounceTime: 200,
42554262
startX: false,
4263+
slideTime: 0, //滑动动画时间
42564264
snap: SELECTOR_SLIDER_ITEM
42574265
}, options));
42584266
if (this.options.startX) {
@@ -4313,7 +4321,14 @@ var mui = (function(document, undefined) {
43134321
}
43144322
var detail = e.detail;
43154323
detail.slideNumber = detail.slideNumber || 0;
4316-
var items = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
4324+
var temps = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
4325+
var items = [];
4326+
for (var i = 0, len = temps.length; i < len; i++) {
4327+
var item = temps[i];
4328+
if (item.parentNode === self.scroller) {
4329+
items.push(item);
4330+
}
4331+
}
43174332
var _slideNumber = detail.slideNumber;
43184333
if (self.loop) {
43194334
_slideNumber += 1;
@@ -4356,7 +4371,7 @@ var mui = (function(document, undefined) {
43564371
},
43574372
_handleTabShow: function(e) {
43584373
var self = this;
4359-
self.gotoItem((e.detail.tabNumber || 0), self.options.bounceTime);
4374+
self.gotoItem((e.detail.tabNumber || 0), self.options.slideTime);
43604375
},
43614376
_handleIndicatorTap: function(event) {
43624377
var self = this;
@@ -7012,10 +7027,9 @@ var mui = (function(document, undefined) {
70127027
self.input.value = val.toString();
70137028
$.trigger(self.input, changeEventName, null);
70147029
});
7015-
// self.input.addEventListener(changeEventName, function(event) {
7016-
// self.checkValue();
7017-
// $.trigger(self, changeEventName, self.getValue());
7018-
// });
7030+
self.input.addEventListener(changeEventName, function(event) {
7031+
self.checkValue();
7032+
});
70197033
},
70207034
/**
70217035
* 获取当前值

examples/hello-mui/js/mui.min.js

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

js/mui.class.scroll.slider.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
indicators: false,
2929
bounceTime: 200,
3030
startX: false,
31+
slideTime: 0, //滑动动画时间
3132
snap: SELECTOR_SLIDER_ITEM
3233
}, options));
3334
if (this.options.startX) {
@@ -88,7 +89,14 @@
8889
}
8990
var detail = e.detail;
9091
detail.slideNumber = detail.slideNumber || 0;
91-
var items = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
92+
var temps = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
93+
var items = [];
94+
for (var i = 0, len = temps.length; i < len; i++) {
95+
var item = temps[i];
96+
if (item.parentNode === self.scroller) {
97+
items.push(item);
98+
}
99+
}
92100
var _slideNumber = detail.slideNumber;
93101
if (self.loop) {
94102
_slideNumber += 1;
@@ -131,7 +139,7 @@
131139
},
132140
_handleTabShow: function(e) {
133141
var self = this;
134-
self.gotoItem((e.detail.tabNumber || 0), self.options.bounceTime);
142+
self.gotoItem((e.detail.tabNumber || 0), self.options.slideTime);
135143
},
136144
_handleIndicatorTap: function(event) {
137145
var self = this;

0 commit comments

Comments
 (0)