bt-yjj-system-examination-web/static/laydate/laydate.js

2 lines
26 KiB
JavaScript
Raw Permalink Normal View History

2021-05-08 17:27:56 +08:00
/*! layDate v5.1.0 | 日期与时间组件 | The MIT License */
;!function(){"use strict";var e="lay",t=window.document,a=function(e){return new n(e)},n=function(e){for(var a=0,n="object"==typeof e?[e]:(this.selector=e,t.querySelectorAll(e||null));a<n.length;a++)this.push(n[a])};n.prototype=[],n.prototype.constructor=n,a.extend=function(){var e=1,t=arguments,a=function(e,t){e=e||(t.constructor===Array?[]:{});for(var n in t)e[n]=t[n]&&t[n].constructor===Object?a(e[n],t[n]):t[n];return e};for(t[0]="object"==typeof t[0]?t[0]:{};e<t.length;e++)"object"==typeof t[e]&&a(t[0],t[e]);return t[0]},a.v="1.0.0",a.ie=function(){var e=navigator.userAgent.toLowerCase();return!!(window.ActiveXObject||"ActiveXObject"in window)&&((e.match(/msie\s(\d+)/)||[])[1]||"11")}(),a.getPath=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,a=t.scripts,n=a.length-1,i=n;i>0;i--)if("interactive"===a[i].readyState){e=a[i].src;break}return e||a[n].src}();return e.substring(0,e.lastIndexOf("/")+1)},a.stope=function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},a.each=function(e,t){var a,n=this;if("function"!=typeof t)return n;if(e=e||[],e.constructor===Object){for(a in e)if(t.call(e[a],a,e[a]))break}else for(a=0;a<e.length&&!t.call(e[a],a,e[a]);a++);return n},a.digit=function(e,t,a){var n="";e=String(e),t=t||2;for(var i=e.length;i<t;i++)n+="0";return e<Math.pow(10,t)?n+(0|e):e},a.elem=function(e,n){var i=t.createElement(e);return a.each(n||{},function(e,t){i.setAttribute(e,t)}),i},a.getStyle=function(e,t){var a=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return a[a.getPropertyValue?"getPropertyValue":"getAttribute"](t)},a.link=function(e,n,i){var l=t.getElementsByTagName("head")[0],r=t.createElement("link");"string"==typeof n&&(i=n);var o=(i||e).replace(/\.|\//g,""),s="layuicss-"+o,y=0;r.rel="stylesheet",r.href=e,r.id=s,t.getElementById(s)||l.appendChild(r),"function"==typeof n&&!function c(){return++y>80?window.console&&console.error(o+".css: Invalid"):void(1989===parseInt(a.getStyle(t.getElementById(s),"width"))?n():setTimeout(c,100))}()},n.addStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),a.each(t,function(t,a){new RegExp("\\b"+a+"\\b").test(e)||(e=e+" "+a)}),e.replace(/^\s|\s$/,"")},n.removeStr=function(e,t){return e=e.replace(/\s+/," "),t=t.replace(/\s+/," ").split(" "),a.each(t,function(t,a){var n=new RegExp("\\b"+a+"\\b");n.test(e)&&(e=e.replace(n,""))}),e.replace(/\s+/," ").replace(/^\s|\s$/,"")},n.prototype.find=function(e){var t=this,n=0,i=[],l="object"==typeof e;return this.each(function(a,r){for(var o=l?[e]:r.querySelectorAll(e||null);n<o.length;n++)i.push(o[n]);t.shift()}),l||(t.selector=(t.selector?t.selector+" ":"")+e),a.each(i,function(e,a){t.push(a)}),t},n.prototype.each=function(e){return a.each.call(this,this,e)},n.prototype.addClass=function(e,t){return this.each(function(a,i){i.className=n[t?"removeStr":"addStr"](i.className,e)})},n.prototype.removeClass=function(e){return this.addClass(e,!0)},n.prototype.hasClass=function(e){var t=!1;return this.each(function(a,n){new RegExp("\\b"+e+"\\b").test(n.className)&&(t=!0)}),t},n.prototype.attr=function(e,t){var a=this;return void 0===t?function(){if(a.length>0)return a[0].getAttribute(e)}():a.each(function(a,n){n.setAttribute(e,t)})},n.prototype.removeAttr=function(e){return this.each(function(t,a){a.removeAttribute(e)})},n.prototype.html=function(e){return this.each(function(t,a){a.innerHTML=e})},n.prototype.val=function(e){return this.each(function(t,a){a.value=e})},n.prototype.append=function(e){return this.each(function(t,a){"object"==typeof e?a.appendChild(e):a.innerHTML=a.innerHTML+e})},n.prototype.remove=function(e){return this.each(function(t,a){e?a.removeChild(e):a.parentNode.removeChild(a)})},n.prototype.on=function(e,t){return this.each(function(a,n){n.attachEvent?n.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(n,e)}):n.addEventListener(e,t,!1)})},n.prototype.off=function(e,t){return this.each(function(a,n){n.detachEvent?n.detachEvent("on"+e,t):n.removeEventListener(e,t,!1)})},window.lay=a,window.layui&&layui.define&&l