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