Skip to content

Commit

Permalink
编译至mui v2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hbcui1984 committed Oct 18, 2015
1 parent 9813ac6 commit 9cc25ab
Show file tree
Hide file tree
Showing 14 changed files with 137 additions and 94 deletions.
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module.exports = function(grunt) {
'js/mui.detect.5+.js',
'js/mui.target.js',
'js/mui.fixed.js',
'js/mui.fixed.bind.js',
'js/mui.fixed.classlist.js',
'js/mui.fixed.animation.js',
'js/mui.fixed.fastclick.js',
Expand Down Expand Up @@ -150,7 +151,7 @@ module.exports = function(grunt) {
uglify: {
options: {
banner: '<%= banner %>',
compress: true,
compress: {},
mangle: true,
preserveComments: false
},
Expand Down
2 changes: 1 addition & 1 deletion dist/css/mui.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* =====================================================
* Mui v2.4.0 (https://github.com/dcloudio/mui)
* Mui v2.5.0 (http://dev.dcloud.net.cn/mui)
* =====================================================
*/

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

Large diffs are not rendered by default.

66 changes: 40 additions & 26 deletions dist/js/mui.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* =====================================================
* Mui v2.4.0 (https://github.com/dcloudio/mui)
* Mui v2.5.0 (http://dev.dcloud.net.cn/mui)
* =====================================================
*/
/**
Expand Down Expand Up @@ -190,25 +190,6 @@ var mui = (function(document, undefined) {
}
return this;
};
/**
* map
*/
$.map = function(elements, callback) {
var value, values = [],
i, key;
if (typeof elements.length === 'number') { //TODO 此处逻辑不严谨,可能会有Object:{a:'b',length:1}的情况未处理
for (i = 0, len = elements.length; i < len; i++) {
value = callback(elements[i], i);
if (value != null) values.push(value);
}
} else {
for (key in elements) {
value = callback(elements[key], key);
if (value != null) values.push(value);
}
}
return values.length > 0 ? [].concat.apply([], values) : values;
};
/**
* each
* @param {type} elements
Expand Down Expand Up @@ -587,6 +568,32 @@ var mui = (function(document, undefined) {
window.CustomEvent = CustomEvent;
}
})();
/*
A shim for non ES5 supporting browsers.
Adds function bind to Function prototype, so that you can do partial application.
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.
*/

Function.prototype.bind = Function.prototype.bind || function(to) {
// Make an array of our arguments, starting from second argument
var partial = Array.prototype.splice.call(arguments, 1),
// We'll need the original function.
fn = this;
var bound = function() {
// Join the already applied arguments to the now called ones (after converting to an array again).
var args = partial.concat(Array.prototype.splice.call(arguments, 0));
// If not being called as a constructor
if (!(this instanceof bound)) {
// return the result of the function called bound to target and partially applied.
return fn.apply(to, args);
}
// If being called as a constructor, apply the function bound to self.
fn.apply(this, args);
}
// Attach the prototype of the function to our newly created function.
bound.prototype = fn.prototype;
return bound;
};
/**
* mui fixed classList
* @param {type} document
Expand Down Expand Up @@ -4253,6 +4260,7 @@ var mui = (function(document, undefined) {
indicators: false,
bounceTime: 200,
startX: false,
slideTime: 0, //滑动动画时间
snap: SELECTOR_SLIDER_ITEM
}, options));
if (this.options.startX) {
Expand Down Expand Up @@ -4313,7 +4321,14 @@ var mui = (function(document, undefined) {
}
var detail = e.detail;
detail.slideNumber = detail.slideNumber || 0;
var items = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
var temps = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
var items = [];
for (var i = 0, len = temps.length; i < len; i++) {
var item = temps[i];
if (item.parentNode === self.scroller) {
items.push(item);
}
}
var _slideNumber = detail.slideNumber;
if (self.loop) {
_slideNumber += 1;
Expand Down Expand Up @@ -4356,7 +4371,7 @@ var mui = (function(document, undefined) {
},
_handleTabShow: function(e) {
var self = this;
self.gotoItem((e.detail.tabNumber || 0), self.options.bounceTime);
self.gotoItem((e.detail.tabNumber || 0), self.options.slideTime);
},
_handleIndicatorTap: function(event) {
var self = this;
Expand Down Expand Up @@ -7012,10 +7027,9 @@ var mui = (function(document, undefined) {
self.input.value = val.toString();
$.trigger(self.input, changeEventName, null);
});
// self.input.addEventListener(changeEventName, function(event) {
// self.checkValue();
// $.trigger(self, changeEventName, self.getValue());
// });
self.input.addEventListener(changeEventName, function(event) {
self.checkValue();
});
},
/**
* 获取当前值
Expand Down
10 changes: 5 additions & 5 deletions dist/js/mui.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/hello-mui/css/mui.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* =====================================================
* Mui v2.4.0 (https://github.com/dcloudio/mui)
* Mui v2.5.0 (http://dev.dcloud.net.cn/mui)
* =====================================================
*/

Expand Down
2 changes: 1 addition & 1 deletion examples/hello-mui/css/mui.min.css

Large diffs are not rendered by default.

66 changes: 40 additions & 26 deletions examples/hello-mui/js/mui.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* =====================================================
* Mui v2.4.0 (https://github.com/dcloudio/mui)
* Mui v2.5.0 (http://dev.dcloud.net.cn/mui)
* =====================================================
*/
/**
Expand Down Expand Up @@ -190,25 +190,6 @@ var mui = (function(document, undefined) {
}
return this;
};
/**
* map
*/
$.map = function(elements, callback) {
var value, values = [],
i, key;
if (typeof elements.length === 'number') { //TODO 此处逻辑不严谨,可能会有Object:{a:'b',length:1}的情况未处理
for (i = 0, len = elements.length; i < len; i++) {
value = callback(elements[i], i);
if (value != null) values.push(value);
}
} else {
for (key in elements) {
value = callback(elements[key], key);
if (value != null) values.push(value);
}
}
return values.length > 0 ? [].concat.apply([], values) : values;
};
/**
* each
* @param {type} elements
Expand Down Expand Up @@ -587,6 +568,32 @@ var mui = (function(document, undefined) {
window.CustomEvent = CustomEvent;
}
})();
/*
A shim for non ES5 supporting browsers.
Adds function bind to Function prototype, so that you can do partial application.
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.
*/

Function.prototype.bind = Function.prototype.bind || function(to) {
// Make an array of our arguments, starting from second argument
var partial = Array.prototype.splice.call(arguments, 1),
// We'll need the original function.
fn = this;
var bound = function() {
// Join the already applied arguments to the now called ones (after converting to an array again).
var args = partial.concat(Array.prototype.splice.call(arguments, 0));
// If not being called as a constructor
if (!(this instanceof bound)) {
// return the result of the function called bound to target and partially applied.
return fn.apply(to, args);
}
// If being called as a constructor, apply the function bound to self.
fn.apply(this, args);
}
// Attach the prototype of the function to our newly created function.
bound.prototype = fn.prototype;
return bound;
};
/**
* mui fixed classList
* @param {type} document
Expand Down Expand Up @@ -4253,6 +4260,7 @@ var mui = (function(document, undefined) {
indicators: false,
bounceTime: 200,
startX: false,
slideTime: 0, //滑动动画时间
snap: SELECTOR_SLIDER_ITEM
}, options));
if (this.options.startX) {
Expand Down Expand Up @@ -4313,7 +4321,14 @@ var mui = (function(document, undefined) {
}
var detail = e.detail;
detail.slideNumber = detail.slideNumber || 0;
var items = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
var temps = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
var items = [];
for (var i = 0, len = temps.length; i < len; i++) {
var item = temps[i];
if (item.parentNode === self.scroller) {
items.push(item);
}
}
var _slideNumber = detail.slideNumber;
if (self.loop) {
_slideNumber += 1;
Expand Down Expand Up @@ -4356,7 +4371,7 @@ var mui = (function(document, undefined) {
},
_handleTabShow: function(e) {
var self = this;
self.gotoItem((e.detail.tabNumber || 0), self.options.bounceTime);
self.gotoItem((e.detail.tabNumber || 0), self.options.slideTime);
},
_handleIndicatorTap: function(event) {
var self = this;
Expand Down Expand Up @@ -7012,10 +7027,9 @@ var mui = (function(document, undefined) {
self.input.value = val.toString();
$.trigger(self.input, changeEventName, null);
});
// self.input.addEventListener(changeEventName, function(event) {
// self.checkValue();
// $.trigger(self, changeEventName, self.getValue());
// });
self.input.addEventListener(changeEventName, function(event) {
self.checkValue();
});
},
/**
* 获取当前值
Expand Down
10 changes: 5 additions & 5 deletions examples/hello-mui/js/mui.min.js

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions js/mui.class.scroll.slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
indicators: false,
bounceTime: 200,
startX: false,
slideTime: 0, //滑动动画时间
snap: SELECTOR_SLIDER_ITEM
}, options));
if (this.options.startX) {
Expand Down Expand Up @@ -88,7 +89,14 @@
}
var detail = e.detail;
detail.slideNumber = detail.slideNumber || 0;
var items = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
var temps = self.scroller.querySelectorAll(SELECTOR_SLIDER_ITEM);
var items = [];
for (var i = 0, len = temps.length; i < len; i++) {
var item = temps[i];
if (item.parentNode === self.scroller) {
items.push(item);
}
}
var _slideNumber = detail.slideNumber;
if (self.loop) {
_slideNumber += 1;
Expand Down Expand Up @@ -131,7 +139,7 @@
},
_handleTabShow: function(e) {
var self = this;
self.gotoItem((e.detail.tabNumber || 0), self.options.bounceTime);
self.gotoItem((e.detail.tabNumber || 0), self.options.slideTime);
},
_handleIndicatorTap: function(event) {
var self = this;
Expand Down
26 changes: 26 additions & 0 deletions js/mui.fixed.bind.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
A shim for non ES5 supporting browsers.
Adds function bind to Function prototype, so that you can do partial application.
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.
*/

Function.prototype.bind = Function.prototype.bind || function(to) {
// Make an array of our arguments, starting from second argument
var partial = Array.prototype.splice.call(arguments, 1),
// We'll need the original function.
fn = this;
var bound = function() {
// Join the already applied arguments to the now called ones (after converting to an array again).
var args = partial.concat(Array.prototype.splice.call(arguments, 0));
// If not being called as a constructor
if (!(this instanceof bound)) {
// return the result of the function called bound to target and partially applied.
return fn.apply(to, args);
}
// If being called as a constructor, apply the function bound to self.
fn.apply(this, args);
}
// Attach the prototype of the function to our newly created function.
bound.prototype = fn.prototype;
return bound;
};
19 changes: 0 additions & 19 deletions js/mui.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,25 +185,6 @@ var mui = (function(document, undefined) {
}
return this;
};
/**
* map
*/
$.map = function(elements, callback) {
var value, values = [],
i, key;
if (typeof elements.length === 'number') { //TODO 此处逻辑不严谨,可能会有Object:{a:'b',length:1}的情况未处理
for (i = 0, len = elements.length; i < len; i++) {
value = callback(elements[i], i);
if (value != null) values.push(value);
}
} else {
for (key in elements) {
value = callback(elements[key], key);
if (value != null) values.push(value);
}
}
return values.length > 0 ? [].concat.apply([], values) : values;
};
/**
* each
* @param {type} elements
Expand Down
7 changes: 3 additions & 4 deletions js/mui.number.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@
self.input.value = val.toString();
$.trigger(self.input, changeEventName, null);
});
// self.input.addEventListener(changeEventName, function(event) {
// self.checkValue();
// $.trigger(self, changeEventName, self.getValue());
// });
self.input.addEventListener(changeEventName, function(event) {
self.checkValue();
});
},
/**
* 获取当前值
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mui",
"description": "Build mobile apps with simple HTML, CSS, and JS components.",
"version": "2.4.0",
"version": "2.5.0",
"keywords": [
"css",
"fonts",
Expand All @@ -10,7 +10,7 @@
"mobile",
"prototype"
],
"homepage": "https://github.com/dcloudio/mui",
"homepage": "http://dev.dcloud.net.cn/mui",
"author": "DCloud",
"style": "dist/css/mui.css",
"sass": "sass/mui.scss",
Expand Down

0 comments on commit 9cc25ab

Please sign in to comment.