2017-11-15 03:57:51 +00:00
|
|
|
;layui.define("jquery",function(t){"use strict";var e=layui.$,i={fixbar:function(t){var i,o,a="layui-fixbar",l="layui-fixbar-top",n=e(document),r=e("body");t=e.extend({showHeight:200},t),t.bar1=t.bar1===!0?"":t.bar1,t.bar2=t.bar2===!0?"":t.bar2,t.bgcolor=t.bgcolor?"background-color:"+t.bgcolor:"";var c=[t.bar1,t.bar2,""],u=e(['<ul class="'+a+'">',t.bar1?'<li class="layui-icon" lay-type="bar1" style="'+t.bgcolor+'">'+c[0]+"</li>":"",t.bar2?'<li class="layui-icon" lay-type="bar2" style="'+t.bgcolor+'">'+c[1]+"</li>":"",'<li class="layui-icon '+l+'" lay-type="top" style="'+t.bgcolor+'">'+c[2]+"</li>","</ul>"].join("")),s=u.find("."+l),g=function(){var e=n.scrollTop();e>=t.showHeight?i||(s.show(),i=1):i&&(s.hide(),i=0)};e("."+a)[0]||("object"==typeof t.css&&u.css(t.css),r.append(u),g(),u.find("li").on("click",function(){var i=e(this),o=i.attr("lay-type");"top"===o&&e("html,body").animate({scrollTop:0},200),t.click&&t.click.call(this,o)}),n.on("scroll",function(){clearTimeout(o),o=setTimeout(function(){g()},100)}))},countdown:function(t,e,i){var o=this,a="function"==typeof e,l=new Date(t).getTime(),n=new Date(!e||a?(new Date).getTime():e).getTime(),r=l-n,c=[Math.floor(r/864e5),Math.floor(r/36e5)%24,Math.floor(r/6e4)%60,Math.floor(r/1e3)%60];a&&(i=e);var u=setTimeout(function(){o.countdown(t,n+1e3,i)},1e3);return i&&i(r>0?c:[0,0,0,0],e,u),r<=0&&clearTimeout(u),u},timeAgo:function(t,e){var i=this,o=[[],[]],a=(new Date).getTime()-new Date(t).getTime();return a>6912e5?(a=new Date(t),o[0][0]=i.digit(a.getFullYear(),4),o[0][1]=i.digit(a.getMonth()+1),o[0][2]=i.digit(a.getDate()),e||(o[1][0]=i.digit(a.getHours()),o[1][1]=i.digit(a.getMinutes()),o[1][2]=i.digit(a.getSeconds())),o[0].join("-")+" "+o[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=12e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(t,e,i){var o="";t=String(t),e=e||2;for(var a=t.length;a<e;a++)o+="0";return t<Math.pow(10,e)?o+(0|t):t}};t("util",i)});
|