From 942ac89cf1d9db16a9d72afea9033b605ee0b100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Thu, 16 Feb 2017 10:52:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8F=92=E4=BB=B6=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/admin/app.js | 18 +- public/static/admin/plugs.js | 37 +- public/static/plugs/jquery/base64.min.js | 2 + public/static/plugs/jquery/json2.min.js | 1 + public/static/plugs/json/json2.js | 512 ----------------------- 5 files changed, 34 insertions(+), 536 deletions(-) create mode 100644 public/static/plugs/jquery/base64.min.js create mode 100644 public/static/plugs/jquery/json2.min.js delete mode 100644 public/static/plugs/json/json2.js diff --git a/public/static/admin/app.js b/public/static/admin/app.js index 184b3fff1..902b2671f 100644 --- a/public/static/admin/app.js +++ b/public/static/admin/app.js @@ -6,24 +6,26 @@ require.config({ waitSeconds: 0, map: {'*': {css: '//cdn.bootcss.com/require-css/0.1.8/css.min.js'}}, paths: { + // 开源插件 CDN 'pace': ['//cdn.bootcss.com/pace/1.0.2/pace.min', '../plugs/jquery/pace.min'], 'echarts': ['//cdn.bootcss.com/echarts/3.2.3/echarts.min'], - 'base64': ['//cdn.bootcss.com/Base64/1.0.0/base64.min'], - 'json': ['//cdn.bootcss.com/json2/20150503/json2.min'], 'socket': ['//cdn.bootcss.com/web-socket-js/1.0.0/web_socket.min'], + 'zeroclipboard': ['//cdn.bootcss.com/zeroclipboard/2.3.0/ZeroClipboard.min'], + 'json': ['//cdn.bootcss.com/json2/20160511/json2.min', '../plugs/jquery/json2.min'], + 'base64': ['//cdn.bootcss.com/Base64/1.0.0/base64.min', '../plugs/jquery/base64.min'], 'jquery': ['//cdn.bootcss.com/jquery/1.12.4/jquery.min', '../plugs/jquery/jquery.min'], 'jquery.icheck': ['//cdn.bootcss.com/iCheck/1.0.2/icheck.min'], 'jquery.cookies': ['//cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie', '../plugs/jquery/jquery.cookie'], 'bootstrap': ['//cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min', '../plugs/bootstrap/js/bootstrap.min'], 'bootstrap.multiselect': ['//cdn.bootcss.com/bootstrap-multiselect/0.9.13/js/bootstrap-multiselect.min', '../plugs/multiselect/bootstrap-multiselect'], - 'pcasunzips': ['../plugs/jquery/pcasunzips'], + // 自定义插件 + 'admin.plugs': ['plugs'], + 'admin.listen': ['listen'], 'layui': ['../plugs/layui/layui'], + 'ueditor': ['../plugs/ueditor/ueditor'], + 'pcasunzips': ['../plugs/jquery/pcasunzips'], 'laydate': ['../plugs/layui/laydate/laydate'], 'template': ['../plugs/template/template'], - 'ueditor': ['../plugs/ueditor/ueditor'], - 'zeroclipboard': ['//cdn.bootcss.com/zeroclipboard/2.2.0/ZeroClipboard.min'], - 'admin.plugs': ['plugs'], - 'admin.listen': ['listen'] }, shim: { 'laydate': {deps: ['jquery']}, @@ -36,7 +38,7 @@ require.config({ 'admin.plugs': {deps: ['jquery', 'layui']}, 'admin.listen': {deps: ['jquery', 'jquery.cookies', 'admin.plugs']}, }, - deps: ['css!//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css'], + deps: ['css!//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css'], urlArgs: "t=" + (new Date()).getTime() }); diff --git a/public/static/admin/plugs.js b/public/static/admin/plugs.js index 131ffd3c6..f1f549854 100644 --- a/public/static/admin/plugs.js +++ b/public/static/admin/plugs.js @@ -1,6 +1,6 @@ /* global layer, Pace */ -define(['zeroclipboard', 'jquery', 'layui'], function (ZeroClipboard) { +define(['zeroclipboard', 'jquery'], function (ZeroClipboard) { /*! * jQuery placeholder, fix for IE6,7,8,9 @@ -269,14 +269,13 @@ define(['zeroclipboard', 'jquery', 'layui'], function (ZeroClipboard) { /** * 加载HTML到目标位置 - * @param url - * @param data - * @param target - * @param callback - * @param loading - * @param tips + * @param url 目标URL地址 + * @param data URL参数 + * @param callback 回调函数 + * @param loading 是否显示加载 + * @param tips 提示消息 */ - _form.prototype.open = function (url, data, target, callback, loading, tips) { + _form.prototype.open = function (url, data, callback, loading, tips) { data && (typeof (data) === 'object') && (data = $.param(data)); data && (url += (url.indexOf('?') === -1 ? '?' : '&') + data); this.load(url, data, 'GET', function (res) { @@ -702,10 +701,10 @@ define(['zeroclipboard', 'jquery', 'layui'], function (ZeroClipboard) { /** * 注册对象到Jq - * @param {type} form - * @param {type} callback - * @param {type} options - * @returns {undefined} + * @param form + * @param callback + * @param options + * @return {$|Function|Zepto} */ $.validate = function (form, callback, options) { return (new validate()).check(form, callback, options); @@ -713,15 +712,17 @@ define(['zeroclipboard', 'jquery', 'layui'], function (ZeroClipboard) { /** * 注册对象到JqFn - * @param {type} callback - * @param {type} options - * @returns {jquery.validate_L1.$|Function|Zepto|$} + * @param callback + * @param options + * @return {$|Function|Zepto} */ - $.fn.validate = function (callback, options) { return (new validate()).check(this, callback, options); }; + /** + * 自动监听规则内表单 + */ $.validate.listen = function () { $('form[data-auto]').map(function () { if ($(this).attr('data-listen') === 'true') { @@ -737,6 +738,10 @@ define(['zeroclipboard', 'jquery', 'layui'], function (ZeroClipboard) { }); }); }; + + /** + * 表单监听初始化 + */ if ($.form && typeof $.form.load === 'function') { $.validate.listen.call(this); } diff --git a/public/static/plugs/jquery/base64.min.js b/public/static/plugs/jquery/base64.min.js new file mode 100644 index 000000000..4dd520df0 --- /dev/null +++ b/public/static/plugs/jquery/base64.min.js @@ -0,0 +1,2 @@ +!function(){function t(t){this.message=t}var r="undefined"!=typeof exports?exports:self,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=new Error,t.prototype.name="InvalidCharacterError",r.btoa||(r.btoa=function(r){for(var o,n,a=String(r),i=0,c=e,d="";a.charAt(0|i)||(c="=",i%1);d+=c.charAt(63&o>>8-i%1*8)){if(n=a.charCodeAt(i+=.75),n>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return d}),r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,"");if(o.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,a,i=0,c=0,d="";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)?d+=String.fromCharCode(255&n>>(-2*i&6)):0)a=e.indexOf(a);return d})}(); +//# sourceMappingURL=base64.min.js.map \ No newline at end of file diff --git a/public/static/plugs/jquery/json2.min.js b/public/static/plugs/jquery/json2.min.js new file mode 100644 index 000000000..e81512c4f --- /dev/null +++ b/public/static/plugs/jquery/json2.min.js @@ -0,0 +1 @@ +"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(t){return t<10?"0"+t:t}function this_value(){return this.valueOf()}function quote(t){return rx_escapable.lastIndex=0,rx_escapable.test(t)?'"'+t.replace(rx_escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var r,n,o,u,f,a=gap,i=e[t];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(t)),"function"==typeof rep&&(i=rep.call(e,t,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,f=[],"[object Array]"===Object.prototype.toString.apply(i)){for(u=i.length,r=0;r