diff --git a/.DS_Store b/.DS_Store
index b1f5930..a689b4b 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/OO/.DS_Store b/OO/.DS_Store
new file mode 100644
index 0000000..f895467
Binary files /dev/null and b/OO/.DS_Store differ
diff --git a/OO/createObject.html b/OO/createObject.html
new file mode 100644
index 0000000..5b528ee
--- /dev/null
+++ b/OO/createObject.html
@@ -0,0 +1,271 @@
+
+
+
+ 创建对象
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OO/inherit.html b/OO/inherit.html
new file mode 100644
index 0000000..8e093a6
--- /dev/null
+++ b/OO/inherit.html
@@ -0,0 +1,228 @@
+
+
+
+ 面向对象的继承
+
+
+
+
+
\ No newline at end of file
diff --git a/base/.DS_Store b/base/.DS_Store
new file mode 100644
index 0000000..33591a5
Binary files /dev/null and b/base/.DS_Store differ
diff --git a/base/README.md b/base/README.md
new file mode 100644
index 0000000..d064667
--- /dev/null
+++ b/base/README.md
@@ -0,0 +1,29 @@
+### Usage
+```
+//init
+
+or
+import Ajax from './server.js';
+
+//use
+Ajax({
+ data: data, //request data
+ url: url, //request url
+ dataType: 'jsonp', //jsonp or not
+ type: 'get', //request method, support 'get' and 'post'
+ headers: {
+ header1: 'aaa',
+ header2: 'bbb'
+ },
+ success: function(json) {
+ console.log(json);
+ },
+ fail: function(json) {
+ console.log(json);
+ },
+ done: function(json) {
+ console.log(json);
+ }
+});
+
+```
diff --git a/base/base.js b/base/base.js
new file mode 100644
index 0000000..f91bd48
--- /dev/null
+++ b/base/base.js
@@ -0,0 +1,108 @@
+;(function(window, document, undefined) {
+
+ function Base() {}
+
+ Base.prototype.server = function(Ajax) { //Server方法
+
+ var Server = Ajax;
+
+ return function(data, url, callback, type, dataType) {
+ Server({
+ data: data || {},
+ type: type || 'get',
+ url: url,
+ dataType: dataType || 'json',
+ done: (res) => {
+ callback && callback(res);
+ }
+ });
+ }
+ };
+
+ Base.prototype.queryParams = function() { //获取查询字符串参数
+ var search = location.search,
+ theRequest = {};
+ if (search.indexOf('?') < 0) {
+ return;
+ }
+ search = search.substr(1);
+ var paramArr = search.split('&'),
+ max = paramArr.length;
+ for (var i = 0; i < max; i ++) {
+ theRequest[paramArr[i].split('=')[0]] = unescape(paramArr[i].split('=')[1]);
+ }
+ return theRequest;
+ };
+
+ Base.prototype.htmlEncode = function(str) { //html字符转义
+ var temp = document.createElement('div');
+ div.appendChild(document.createTextNode(str));
+ return div.innerHTML;
+ };
+
+ Base.prototype.checkPlatforms = function() {
+ var u = navigator.userAgent, app = navigator.appVersion;
+ return {
+ trident: u.indexOf('Trident') > -1, //IE内核
+ presto: u.indexOf('Presto') > -1, //opera内核
+ webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
+ gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核
+ mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
+ ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
+ android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
+ iPhone: u.indexOf('iPhone') > -1 , //是否为iPhone或者QQHD浏览器
+ iPad: u.indexOf('iPad') > -1, //是否iPad
+ webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部
+ weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增)
+ qq: u.match(/\sQQ/i) == " qq" //是否QQ
+ };
+ };
+
+ Base.prototype.setCookie = function(name, value, days) {
+ let Days = days || 1,
+ exp = new Date();
+ exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
+ document.cookie = name + "=" + escape (value) + ";expires=" + exp.toGMTString();
+ };
+
+ Base.prototype.getCookie = function(name) {
+ var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); //正则匹配
+ if (arr = document.cookie.match(reg)) {
+ return unescape(arr[2]);
+ } else {
+ return null;
+ }
+ };
+
+ Base.prototype.delCookie = function(name) {
+ var exp = new Date();
+ exp.setTime(exp.getTime() - 1);
+ var cval = this.getCookie(name);
+ if (cval != null) {
+ document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
+ }
+ };
+
+ Base.prototype.dateFormat = function(date) {
+ function further(num) {
+ if (num < 10) num = `0${num}`;
+ return num;
+ }
+ const str = `${date.getFullYear()}-${further(date.getMonth() + 1)}-${further(date.getDate())} ${further(date.getHours())}:${further(date.getMinutes())}:${further(date.getSeconds())}`;
+ return str;
+ };
+
+ var basefn = new Base();
+
+ window.basefn = basefn;
+
+})(window, document);
+
+if (typeof module !== 'undefined') {
+ module.exports = window.basefn;
+} else if (typeof define === 'function' && define.amd) {
+ define([], function () {
+ 'use strict';
+ return window.basefn;
+ });
+}
diff --git a/base/server.js b/base/server.js
new file mode 100644
index 0000000..ad8dd12
--- /dev/null
+++ b/base/server.js
@@ -0,0 +1,114 @@
+;(function(window, document, undefined) {
+ function Ajax(opts) {
+
+ opts.type = opts.type || 'get';
+ opts.type = opts.type.toLowerCase();
+ opts.dataType = opts.dataType || 'json';
+ opts.dataType = opts.dataType.toLowerCase();
+
+ if (opts.dataType == 'jsonp') {
+ jsonpRequest(opts);
+ return;
+ }
+
+ var xhr = new XMLHttpRequest(),
+ params = null;
+
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ opts.done && opts.done(jsonParse(xhr.responseText), xhr.responseXML);
+ if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) {
+ opts.success && opts.success(jsonParse(xhr.responseText), xhr.responseXML);
+ } else {
+ opts.fail && opts.fail(jsonParse(xhr.responseText), xhr.responseXML);
+ }
+ }
+ }
+
+ if (opts.type == 'get') {
+ params = formatParams(opts.data);
+ var url = opts.url.indexOf('?') > -1 ? (opts.url + '&' + params) : (opts.url + '?' + params);
+ xhr.open('get', url, true);
+ opts.headers && setHeaders();
+ xhr.send(null);
+ } else if (opts.type == 'post') {
+ params = formatParams(opts.data);
+ xhr.open('post', opts.url, true);
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ opts.headers && setHeaders();
+ xhr.send(params);
+ }
+
+ function formatParams(data) {
+ var arr = [];
+ for (var key in data) {
+ arr.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
+ }
+ return arr.join('&');
+ }
+
+ function jsonpRequest(opts) {
+
+ if (!opts.url) {
+ console.error('url missing');
+ return;
+ }
+
+ opts.jsonpCallback = opts.jsonpCallback || 'callback';
+
+ var callbackName = 'jsonp_' + Math.ceil((Math.random() * 1E12));
+
+ opts.data[opts.jsonpCallback] = callbackName;
+
+ //创建script标签
+ var params = formatParams(opts.data),
+ oHead = document.querySelector('head'),
+ oScript = document.createElement('script');
+ oHead.appendChild(oScript);
+
+ //创建回调函数
+ window[callbackName] = function(json) {
+ oHead.removeChild(oScript);
+ window[callbackName] = null;
+ window.clearTimeout(oScript.timer);
+ opts.success && opts.success(json);
+ opts.done && opts.done(json);
+ };
+
+ //发起请求
+ oScript.src = opts.url + '?' + params;
+
+ if (opts.time) {
+ oScript.timer = window.setTimeout(function() {
+ oHead.removeChild(oScript);
+ window[callbackName] = null;
+ opts.fail && opts.fail({message: 'timeout'});
+ opts.done && opts.done({message: 'timeout'});
+ }, opts.time);
+ }
+ }
+
+ function setHeaders() {
+ for (var o in opts.headers) {
+ // console.log(o, opts.headers[o]);
+ xhr.setRequestHeader(o, opts.headers[o]);
+ }
+ }
+
+ function jsonParse(text) {
+ return JSON.parse(text);
+ }
+ }
+
+ window.Ajax = Ajax;
+
+})(window, document);
+
+if (typeof module !== 'undefined') {
+ module.exports = window.Ajax;
+} else if (typeof define === 'function' && define.amd) {
+ define([], function () {
+ 'use strict';
+ return window.Ajax;
+ });
+}
diff --git a/cutter/.DS_Store b/cutter/.DS_Store
index a24bea5..965ccbd 100644
Binary files a/cutter/.DS_Store and b/cutter/.DS_Store differ