// 是不是数字 function isNumber(n) { return (isNaN(n) || isNaN(parseFloat(n, 10))) ? false : true; } // 分转元 10000 -> 10.00 function f2y(n) { if (isNaN(n) || isNaN(parseFloat(n, 10))) { ... Read More
posted @ 2016-06-28 21:26 koala_熊 Views(138) Comments(0) Diggs(0) Edit
/** * 简易路由 */ var Router = { // 路由初始 init: function () { this.routes = {}; this.useRouter(); }, // 路由配置 route: function (path, cb) { this.routes[path] ... Read More
posted @ 2016-06-23 16:07 koala_熊 Views(320) Comments(0) Diggs(0) Edit
// 模拟原生JS中的bind, 将函数指针以值的形式传递,该函数必须在特定环境中执行 function bind(fn, context) { var args = Array.prototype.slice.call(arguments, 2); return function () { var innerArgs = Array.prototype.slic... Read More
posted @ 2016-06-23 15:11 koala_熊 Views(170) Comments(0) Diggs(0) Edit
// 模仿 Object.assign()function JSON_merge() { var json = {}, args = arguments, copy = function(f, s) { if (!Object.keys(s).length || f === null) return; for... Read More
posted @ 2016-06-22 23:14 koala_熊 Views(185) Comments(0) Diggs(0) Edit
// 1:1克隆 (只考虑 f,s 为同一类型) function deepCopy(s) { if (!Object.keys(s).length || s === null) return; var copy = function (f, s) { for (var i in s) { if (typeof s[i] === 'obje... Read More
posted @ 2016-06-20 23:04 koala_熊 Views(754) Comments(0) Diggs(0) Edit
新增 'insert into xxx set ?' 删除 'delete from xxx where ?' 修改 'update xxx set ? where ?' 查询 'select * from xxx where ?' Read More
posted @ 2016-06-08 23:02 koala_熊 Views(112) Comments(0) Diggs(0) Edit
配置镜像 npm config set registry http://registry.npm.taobao.org 淘宝镜像 --registry=https://registry.npm.taobao.org Read More
posted @ 2016-06-08 23:00 koala_熊 Views(92) Comments(0) Diggs(0) Edit
/** * moyuQuery的大部分API方法名和jQuery保持一致,可以结合jQuery的文档来阅读本库 * www.moyu-edu.com * */ //立即函数自执行 //把window传进来,可以不用每次访问都去全局作用域,提高代码执行速度 //因为在有的低版本IE中undefined的值有可能改写,所以传进来,但是调用的时候实参没有这个,所以保证是正确的undefin... Read More
posted @ 2016-06-07 16:23 koala_熊 Views(139) Comments(0) Diggs(0) Edit
/** * MobileDetect.system ios || android */ var MobileDetect = { init: function() { this.system = this.info(); }, info: function() { return function() { ... Read More
posted @ 2016-06-07 16:11 koala_熊 Views(668) Comments(0) Diggs(0) Edit
1. clientWidth, clientHeight 1. 增加边框、外边距,DOM实际大小不受影响 2. 增加滚动条,会减少DOM实际大小,原因不把滚动条的大小算在内 3. 增加内间距,会影响DOM实际大小 4. 在没有内边距和滚动条的情况下,没有设置CSS大小,那么IE浏览器会理解为0 2. Read More
posted @ 2016-06-07 15:57 koala_熊 Views(149) Comments(0) Diggs(0) Edit