halo-theme-sakura/js/app.min.js

1 line
22 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _toConsumableArray(t){if(Array.isArray(t)){for(var e=0,o=Array(t.length);e<t.length;e++)o[e]=t[e];return o}return Array.from(t)}var LIlGGAttachContext={PJAX:function(){Poi.headFocus&&Poi.bgvideo&&LIlGGAttachContext.BGV().bgPause(),LIlGGAttachContext.CBG().changeSkinSecter(),lazyload(void 0,{rootMargin:"150px"});try{$("#to-load-aplayer").on("click",function(){reloadAplayer(),$("div").remove(".load-aplayer")}),$("div").hasClass("aplayer")&&reloadAplayer()}catch(t){}Poi.toc&&LIlGGAttachContext.TOC(),LIlGGAttachContext.CHS(),LIlGGAttachContext.PHO()},BGV:function(){var t,e=$("#video-btn"),o=$("#bgvideo"),i=$(".video-stu"),a=$("#video-add"),n=o[0],s=function(){e.addClass("video-pause").removeClass("video-play").show(),i.css({bottom:"-100px"}),$(".focusinfo").css({top:"-999px"}),$("#banner_wave_1").addClass("banner_wave_hide"),$("#banner_wave_2").addClass("banner_wave_hide"),n.play()},r=function(){void 0!=n.oncanplay&&$(".haslive").length>0&&(e.addClass("video-play").removeClass("video-pause"),i.css({bottom:"0px"}).html("已暂停 ..."),$(".focusinfo").css({top:"49.3%"}),$("#banner_wave_1").removeClass("banner_wave_hide"),$("#banner_wave_2").removeClass("banner_wave_hide"),n.pause())},l=function(){function e(e){i.html("正在载入视频 ...").css({bottom:"0px"});var a=new XMLHttpRequest;a.open("GET",e.url,!0),a.responseType="blob",a.onload=function(){if(200===this.status){var i=this.response;t=URL.createObjectURL(i),o.attr("src",t),o.attr("video-name",e.title)}},a.onerror=function(){console.log("视频加载失败!")},a.send()}if(t)return void o.attr("src",t);var a="https://api.lixingyong.com/api/:server?id=:id&r=:r";"undefined"!=typeof bg_video_api&&(a=bg_video_api);var n=o[0],s=n.dataset.url,r=n.dataset.id;if(s){e({title:n.dataset.name||n.dataset.title||"Video name",url:n.dataset.url})}else if(r){var l=n.dataset.api||a;l=l.replace(":server",n.dataset.server),l=l.replace(":id",r),l=l.replace(":r",Math.random());var c=new XMLHttpRequest;c.onreadystatechange=function(){if(4===c.readyState&&(200<=c.status&&300>c.status||304===c.status)){e(JSON.parse(c.responseText))}},c.open("get",l,!0),c.send()}};return void 0!=n&&void 0==n.oncanplay&&document.body.clientWidth>860&&function(){e.on("click",function(t){$(this).hasClass("loadvideo")?($(this).removeClass("loadvideo").hide(),l()):$(this).hasClass("video-pause")?(r(),e.removeClass("videolive")):(s(),e.addClass("videolive"))}),n.oncanplay=function(){s(),a.show(),e.addClass("videolive"),e.addClass("haslive")},n.onended=function(){o.attr("src",""),a.hide(),e.addClass("loadvideo").removeClass("video-pause"),e.removeClass("videolive"),e.removeClass("haslive"),$(".focusinfo").css({top:"49.3%"})},a.on("click",function(){l()})}(),{bgPause:r}},PLSA:function(){$("article.post-list-thumb:not(.post-list-show)").each(function(t,e){if(!(e.getBoundingClientRect().top<=$(window).height()))return!1;$(e).addClass("post-list-show")}),$(window).scroll(function(){var t=$(window).height(),e=$("article.post-list-thumb:not(.post-list-show):first");if(e.length>0){e[0].getBoundingClientRect().top<=t&&e.addClass("post-list-show")}})},TOC:function(){if(!(document.body.clientWidth<=1200)){$("div").hasClass("toc")&&($(".toc-container").css("height",$(".site-content").outerHeight()),$(".entry-content , .links").children("h1,h2,h3,h4,h5").each(function(t){var e="toc-head-"+t;$(this).attr("id",e)}),tocbot.init({tocSelector:".toc",contentSelector:[".entry-content",".links"],headingSelector:"h1, h2, h3, h4, h5",collapseDepth:Poi.tocDepth,hasInnerContainers:!1,headingsOffset:$("#page").find(".pattern-center").length>0?-500:-230,scrollEndCallback:function(t){if(0!=$(".is-active-link").length){if(0==$(window).scrollTop())return void $(".toc").animate({scrollTop:0});var e=$(".is-active-link").offset().top-$(window).scrollTop();e<100?$(".toc").animate({scrollTop:$(".toc").scrollTop()-(100-e+$(".is-active-link").height())}):e>$(window).height()-30&&$(".toc").animate({scrollTop:$(".toc").scrollTop()+(e-100)})}}}),function(){$(".toc").css("max-height",$(document).scrollTop()+($(window).height()-240)+"px"),$(window).scroll(function(){var t=$(document).scrollTop();0==t?$(".toc").css("max-height",$(document).scrollTop()+($(window).height()-240)+"px"):t>100?$(".toc").css("max-height",$(window).height()-134+"px"):$(".toc").css("max-height",$(document).scrollTop()+($(window).height()-240)+"px")})}())}},CHS:function(){var t={autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",contenteditable:"false",design:"by LIlGG"};$("pre").each(function(e,o){var i=$(this).children("code"),a=i[0].className,n=a.split(" "),s="",r=!0,l=!1,c=void 0;try{for(var h,d=n[Symbol.iterator]();!(r=(h=d.next()).done);r=!0){var u=h.value;if(u.indexOf("language-")>-1){s=u.substring(u.indexOf("-")+1,u.length);break}}}catch(t){l=!0,c=t}finally{try{!r&&d.return&&d.return()}finally{if(l)throw c}}var g=hljs.getLanguage(s.toLowerCase());if(void 0==g){var p=hljs.highlightAuto(i.text());i.removeClass("language-"+s),s=p.language,i.addClass("language-"+s)}else s=g.name;$(this).addClass("highlight-wrap"),$(this).attr(t),i.attr("data-rel",s.toUpperCase()).addClass(s.toLowerCase()),hljs.highlightBlock(i[0]),Poi.codeLine&&hljs.lineNumbersBlock(i[0])}),$("pre").on("dblclick",function(t){t.target===this&&($(this).toggleClass("code-block-fullscreen"),$("html").toggleClass("code-block-fullscreen-html-scroll"))}),$("pre code").each(function(t,e){$(e).attr({id:"hljs-"+t}),$(this).after('<a class="copy-code" href="javascript:" data-clipboard-target="#hljs-'+t+'" title="拷贝代码"><i class="fa fa-clipboard" aria-hidden="true"></i></a>'),new ClipboardJS(".copy-code")})},CBG:function(){var t={},e=function(e,i){var a=bgConfig[e];a&&(t.bgAttr=a,$("#night-mode-cover").css("visibility",a.isNightMode?"visible":"hidden"),$("body").removeAttr("style"),$("body").css("background-image",""==a.url?"none":"url("+a.url+")"),o(),!(!i||void 0===i||void 0==i)&&i(a.isNightMode))},o=function(){if(0!=Object.getOwnPropertyNames(t).length){var e=t.bgAttr;switch($(".blank").css("background-color","rgba(255,255,255,"+e.opacity<0?0:e.opacity>1?1:e.opacity+")"),e.isSkinSecter?($(".pattern-center").removeClass("pattern-center").addClass("pattern-center-sakura"),$(".headertop-bar").removeClass("headertop-bar").addClass("headertop-bar-sakura")):($(".pattern-center-sakura").removeClass("pattern-center-sakura").addClass("pattern-center"),$(".headertop-bar-sakura").removeClass("headertop-bar-sakura").addClass("headertop-bar")),e.isNight?$(".changeSkin-gear, .toc").css("background","rgba(255,255,255,0.8)"):$(".changeSkin-gear, .toc").css("background","none"),e.strategy){case"no-repeat":$("body").css("background-repeat","no-repeat");break;case"repeat":$("body").css("background-repeat","repeat");break;case"cover":$("body").css("background-size","cover")}}};return document.body.clientWidth>860&&(function(){var t=utils.getCookie("bgTagClass");if(t){Object.keys(bgConfig).includes(t)||(t="bg_0"),e(t)}}(),function(){$(".changeSkin-gear").off("click").on("click",function(){$(".skin-menu").toggleClass("show"),t.isNight?$(".changeSkin").css("background","rgba(255,255,255,0.8)"):$(".changeSkin").css("background","none")}),Object.keys(bgConfig).forEach(function(t){$(".skin-menu #"+t).on("click",function(){e(t,function(e){utils.setCookie("bgTagClass",t,30),$(".skin-menu").removeClass("show"),setTimeout(function(){$(".changeSkin-gear").css("visibility","visible")},300)})})}),$(".changeSkin-gear").css("visibility","visible")}()),{changeSkinSecter:o}},MGT:function(){var t=$(".m-cd-top");$(window).scroll(function(){$(this).scrollTop()>20?t.addClass("cd-is-visible"):t.removeClass("cd-is-visible")}),t.on("click",function(t){t.preventDefault(),$("body,html").animate({scrollTop:0},700)})},CPY:function(){document.body.addEventListener("copy",function(e){Poi.copyrightNotice&&window.getSelection().toString().length>30&&t(e),toast&&toast.create("复制成功!<br>Copied to clipboard successfully!",2e3)});var t=function(t){t.preventDefault();var e="# 商业转载请联系作者获得授权,非商业转载请注明出处。<br># For commercial use, please contact the author for authorization. For non-commercial use, please indicate the source.<br># 协议(License):署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)<br># 作者(Author)"+Poi.nickname+"<br># 链接(URL)"+window.location.href+"<br># 来源(Source)"+Poi.sitename+"<br><br>"+window.getSelection().toString().replace(/\r\n/g,"<br>"),o="# 商业转载请联系作者获得授权,非商业转载请注明出处。\n# For commercial use, please contact the author for authorization. For non-commercial use, please indicate the source.\n# 协议(License):署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)\n# 作者(Author)"+Poi.nickname+"\n# 链接(URL)"+window.location.href+"\n# 来源(Source)"+Poi.sitename+"\n\n"+window.getSelection().toString().replace(/\r\n/g,"\n");if(t.clipboardData)t.clipboardData.setData("text/html",e),t.clipboardData.setData("text/plain",o);else if(window.clipboardData)return window.clipboardData.setData("text",o)}},PHO:function(){if(0!=$(".photo-page").length){var t=$(".masonry-gallery.gallery");t.length>0&&("masonry"==Poi.photosStyle||"packery"==Poi.photosStyle?function(){var e="masonry"==Poi.photosStyle?{masonry:{gutter:isNaN(Poi.photosGutter)?10:Number(Poi.photosGutter)},itemSelector:".gallery-item"}:{layoutMode:"packery",packery:{columnWidth:100,gutter:isNaN(Poi.photosGutter)?10:Number(Poi.photosGutter)},itemSelector:".gallery-item"};t.each(function(){var o=$(this).find(".gallery-item"),i=$(this).isotope(e);i.imagesLoaded().progress(function(){i.isotope("layout")}),$("#gallery-filter li a").on("click",function(){$("#gallery-filter li a").removeClass("active"),$(this).addClass("active");var e=$(this).data("filter");return t.isotope({filter:e}),!1}),"masonry"==Poi.photosStyle&&$("#grid-changer li a").on("click",function(){$("#grid-changer li a").removeClass("active"),$(this).toggleClass("active");for(var e=2;e<9;e++)o.removeClass("col-"+e);o.toggleClass($(this).closest("li").attr("class")),t.isotope("layout")})})}():function(){t.justifiedGallery({margins:isNaN(Poi.photosGutter)?10:Number(Poi.photosGutter),rowHeight:200}),$("#gallery-filter li a").on("click",function(){$("#gallery-filter li a").removeClass("active"),$(this).addClass("active");var e=$(this).data("filter");return t.justifiedGallery({filter:e}),!1})}())}},SS:function(){var t=function(t){var e=new Date(t),o=e.getHours();return isNaN(o)?"kaiqitaiyangguangshezhi":5<=o&&o<12?"gengzaotubiao_tianqi-qingchen":12<=o&&o<18?"kaiqitaiyangguangshezhi":"yueliang"};return function(){$(".journal").length>0&&$(".journal").each(function(){var e=$(this).find(".journal-time>span").first();0==e.find("i").length&&e.prepend('<i class="iconfont icon-'+t(e.text())+'"></i> '),$(this).find(".journal-label img").each(function(){$(this).hasClass("journal-img")||$(this).addClass("journal-img").wrap('<a data-fancybox="gallery" href="'+$(this).attr("src")+'">')})})}}},IMG_Type={DEFAULT:{id:0,url:"https://cdn.lixingyong.com/2020/07/18/98fca04416944b282a558b98b2131879.png"}},imgError=function(t,e){t.src=e.url},getRandomColor=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t=isNaN(t)?0:Number(t),e=isNaN(e)?1:Number(e),t=t<0?0:t>1?1:t,e=e<t?1:e>1?1:e,"#"+function(t){return new Array(7-t.length).join("0")+t}((16777216*(Math.random()*(e-t)+t)<<0).toString(16))},pjaxFun=function(){$(document).pjax("a[target!=_top]","#page",{fragment:"#page",timeout:8e3}).on("pjax:send",function(){NProgress.start(),Siren.MNH()}).on("pjax:complete",function(){Siren.AH(),Siren.PE(),Siren.CE(),LIlGGAttachContext.PJAX(),NProgress.done(),$("#loading").fadeOut(500)}).on("submit",".search-form,.s-search",function(t){t.preventDefault(),$.pjax.submit(t,"#page",{fragment:"#page",timeout:8e3}),$(".js-search.is-visible").length>0&&($(".js-toggle-search").toggleClass("is-active"),$(".js-search").toggleClass("is-visible"))}),window.addEventListener("popstate",function(t){Siren.AH(),Siren.PE(),Siren.CE()},!1)},home=location.href,Siren={MN:function(){$(".iconflat").on("click",function(){$("body").toggleClass("navOpen"),$("#main-container,#mo-nav,.openNav").toggleClass("open")})},MNH:function(){$("body").hasClass("navOpen")&&($("body").toggleClass("navOpen"),$("#main-container,#mo-nav,.openNav").toggleClass("open"))},AH:function(){if("auto"==Poi.windowheight){if(window.outerWidth<=860)return $("#centerbg").css({height:300}),void $(".headertop").addClass("headertop-bar");if($(".headertop").removeClass("headertop-bar"),$("h1.main-title").length>0){var t=$(window).height();$("#centerbg").css({height:t}),$("#bgvideo").css({"min-height":t}),$(window).resize(function(){Siren.AH()})}}else $(".headertop").addClass("headertop-bar")},PE:function(){if($(".headertop").length>0&&($("h1.main-title").length>0?($(".blank").css({"padding-top":"0px"}),$(".headertop").css({height:"auto"}).show()):($(".blank").css({"padding-top":"5.2%"}),$(".headertop").css({height:"0px"}).hide())),$(".entry-content").children("table").length>0&&$(".entry-content").children("table").wrap("<div class='table-wrapper'></div>"),$(".entry-content").length>0&&$(".entry-content").find("img").length>0&&$(".entry-content").find("img").each(function(){$(this).hasClass("gallery-img")||$(this).addClass("gallery-img").wrap('<a data-fancybox="gallery" href="'+$(this).attr("src")+'"></a>')}),$("#tag-wordcloud").length>0&&0==$("#tag-wordcloud").children().length&&$("#tag-wordcloud").jQCloud(wordcloud,{autoResize:!0,delayedMode:!0}),$(".chip").length>0&&$(".chip").each(function(){$(this).css("background-color",getRandomColor(Poi.tagRandomColorMin,Poi.tagRandomColorMax))}),$("#category-echarts").length>0&&0==$("#category-echarts").children().length){var t=Object.values(categoryRadar),e=Object.keys(categoryRadar);if(e.length<3)return void $("#category-echarts").remove();var o=5*Math.ceil(Math.max.apply(Math,_toConsumableArray(t))/5),i=echarts.init(document.getElementById("category-echarts")),a={title:{text:"文章分类雷达图",left:"center",top:"25px",textStyle:{fontSize:22,fontWeight:"normal"}},tooltip:{trigger:"item",textStyle:{align:"left"}},radar:[{indicator:function(){for(var t=[],i=0;i<e.length;i++)t.push({text:e[i],max:o});return t}(),name:{textStyle:{color:"black"}},center:["50%","60%"],radius:"60%"}],series:[{type:"radar",itemStyle:{color:"rgb(123,234,185)"},lineStyle:{color:"rgb(123,234,185)"},areaStyle:{color:"rgb(123,234,185)"},data:[{value:t,name:"文章分类数量"}]}]};i.setOption(a)}$("#qrcode").length>0&&0==$("#qrcode").children().length&&new QRCode(document.getElementById("qrcode"),{text:$("#qrcode").data("url"),width:128,height:128,colorDark:"#000000",colorLight:"#ffffff"}),LIlGGAttachContext.SS()()},CE:function(){$(".archives").hide(),$(".archives:first").show(),$("#archives-temp h3").click(function(){return $(this).next().slideToggle("fast"),!1}),$(".js-toggle-search").on("click",function(){$(".js-toggle-search").toggleClass("is-active"),$(".js-search").toggleClass("is-visible")}),$(".search_close").on("click",function(){$(".js-search").hasClass("is-visible")&&($(".js-toggle-search").toggleClass("is-active"),$(".js-search").toggleClass("is-visible"))}),$("#show-nav").on("click",function(){$("#show-nav").hasClass("showNav")?($("#show-nav").removeClass("showNav").addClass("hideNav"),$(".site-top .lower nav").addClass("navbar")):($("#show-nav").removeClass("hideNav").addClass("showNav"),$(".site-top .lower nav").removeClass("navbar"))}),$("#loading").click(function(){$("#loading").fadeOut(500)})},NH:function(){var t=$(document).scrollTop();$(window).scroll(function(){var e=$(document).scrollTop(),o=document.documentElement.scrollHeight-document.documentElement.clientHeight,i=e/o;NProgress.set(i),0==e&&$(".site-header").removeClass("yya"),e>0&&$(".site-header").addClass("yya"),e>50&&($(".site-header").addClass("gizle"),e>t?$(".site-header").removeClass("sabit"):$(".site-header").addClass("sabit"),t=e)})},XLS:function(){$("body").on("click","#pagination a",function(){return $(this).addClass("loading").text(""),$.ajax({type:"GET",url:$(this).attr("href")+"#main",success:function(t){var e=$(t).find("#main .post"),o=$(t).find("#pagination a").attr("href");$("#main").append(e.fadeIn(500)),$("#pagination a").removeClass("loading").text("Previous"),lazyload(void 0,{rootMargin:"150px"}),LIlGGAttachContext.PLSA(),void 0!=o?$("#pagination a").attr("href",o):$("#pagination").html("<span>没有更多文章了</span>")}}),!1}),$("body").on("click","#journals-pagination a",function(){return $(this).addClass("loading").text(""),$.ajax({type:"GET",url:$(this).attr("href")+"#main",success:function(t){var e=$(t).find("#main .journal"),o=$(t).find("#journals-pagination a").attr("href");$("#main").append(e.fadeIn(500)),$("#journals-pagination a").removeClass("loading").text("加载更多..."),lazyload(void 0,{rootMargin:"150px"}),LIlGGAttachContext.SS()(),void 0!=o?$("#journals-pagination a").attr("href",o):$("#journals-pagination a").remove()}}),!1})},GT:function(){var t=$(".cd-top");$(window).scroll(function(){$(this).scrollTop()>100?(t.addClass("cd-is-visible"),$(".changeSkin-gear").css("bottom","0"),$(window).height()>950?$(".cd-top.cd-is-visible").css("top","0"):$(".cd-top.cd-is-visible").css("top",$(window).height()-950+"px")):($(".changeSkin-gear").css("bottom","-999px"),$(".cd-top.cd-is-visible").css("top","-900px"),t.removeClass("cd-is-visible cd-fade-out")),$(this).scrollTop()>1200&&t.addClass("cd-fade-out"),$(".skin-menu").removeClass("show")}),t.on("click",function(t){t.preventDefault(),$("body,html").animate({scrollTop:0},700)})}},toast=null;$(function(){Siren.AH(),Siren.PE(),Siren.NH(),Siren.GT(),Siren.XLS(),Siren.CE(),Siren.MN(),Poi.themeChange&&LIlGGAttachContext.CBG(),LIlGGAttachContext.PLSA(),Poi.headFocus&&Poi.bgvideo&&LIlGGAttachContext.BGV(),Poi.toc&&LIlGGAttachContext.TOC(),LIlGGAttachContext.CHS(),LIlGGAttachContext.MGT(),"packery"==Poi.photosStyle&&supplement(),LIlGGAttachContext.PHO(),Poi.copyMonitor&&LIlGGAttachContext.CPY(),lazyload(void 0,{rootMargin:"150px"}),Poi.pjax&&pjaxFun(),Poi.openToast&&window.outerWidth>860&&(toast=new Toast,toast.init({width:Poi.toastWidth,height:Poi.toastHeight,top:Poi.toastTop,background:Poi.toastBackground,color:Poi.toastColor,"font-size":Poi.toastFontSize})),$.fn.postLike=function(){if($(this).hasClass("done"))return!1;$(this).addClass("done");var t=$(this).data("id"),e=$(this).data("action"),o=$(this).children(".count"),i={action:"specs_zan",um_id:t,um_action:e};return $.post(Poi.ajaxurl,i,function(t){$(o).html(t)}),!1},$(document).on("click",".specsZan",function(){$(this).postLike()}),console.log("%c Github %c","background:#24272A; color:#ffffff","","https://github.com/LIlGG/halo-theme-Sakura")});var supplement=function(){var t=Isotope.LayoutMode.modes.packery,e=t.prototype._resetLayout;t.prototype._resetLayout=function(){e.call(this);var t=getSize(this.element.parentNode),o=this.columnWidth+this.gutter;this.fitWidth=Math.floor((t.innerWidth+this.gutter)/o)*o,this.packer.width=this.fitWidth,this.packer.height=Number.POSITIVE_INFINITY,this.packer.reset()},t.prototype._getContainerSize=function(){for(var t=0,e=0,o=this.packer.spaces.length;e<o;e++){var i=this.packer.spaces[e];0===i.y&&i.height===Number.POSITIVE_INFINITY&&(t+=i.width)}return{width:this.fitWidth-this.gutter,height:this.maxY-this.gutter}},t.prototype.needsResizeLayout=function(){return!0}},isWebkit=navigator.userAgent.toLowerCase().indexOf("webkit")>-1,isOpera=navigator.userAgent.toLowerCase().indexOf("opera")>-1,isIe=navigator.userAgent.toLowerCase().indexOf("msie")>-1;(isWebkit||isOpera||isIe)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1);var utils={setCookie:function(t,e,o){var i="";if(o){var a=new Date;a.setTime(a.getTime()+24*o*60*60*1e3),i="; expires="+a.toUTCString()}document.cookie=t+"v1.0.0="+(e||"")+i+"; path=/"},getCookie:function(t){for(var e=t+"v1.0.0=",o=document.cookie.split(";"),i=0;i<o.length;i++){for(var a=o[i];" "==a.charAt(0);)a=a.substring(1,a.length);if(0==a.indexOf(e))return a.substring(e.length,a.length)}return null},removeCookie:function(t){document.cookie=t+mashiro_option.cookie_version+"=; Max-Age=-99999999;"}},Toast=function t(){function e(){return document.documentElement.clientHeight}function o(t,e){for(var o in e)t[o]=e[o]}_classCallCheck(this,t),this._t=null,this._timeOut=null,this._settings={duration:2e3,width:260,height:60,top:"top",background:"#fe9600",color:"#fff","font-size":14},t.prototype.init=function(t){o(this._settings,t)},t.prototype.create=function(t,e){if(this._timeOut&&(clearTimeout(this._timeOut),document.body.removeChild(this._t),this._t=null),!t)return void console.error("提示文本不能为空");this._t=document.createElement("div"),this._t.className="t-toast",this._t.innerHTML='<p class="message"><span>'+t+"</span></p>",document.body.appendChild(this._t),this.setStyle();var o=this;this._timeOut=setTimeout(function(){document.body.removeChild(o._t),o._timeOut=null,o._t=null},e||this._settings.duration)},t.prototype.setStyle=function(){this._t.style.width=this._settings.width+"px",this._t.style.height=this._settings.height+"px",this._t.style.position="fixed",this._t.style["text-align"]="center",this._t.style["z-index"]="20200531",isNaN(Number(this._settings.top))?"centent"==this._settings.top?this._t.style.top=e()/2+"px":"top"==this._settings.top&&(this._t.style.top="0px"):this._t.style.top=this._settings.top+"px",this._t.style.left="50%",this._t.style["margin-left"]="-"+this._settings.width/2+"px",this._t.style.background=this._settings.background,this._t.style.color=this._settings.color,this._t.style["border-bottom-left-radius"]="4px",this._t.style["border-bottom-right-radius"]="4px",this._t.style["font-size"]=this._settings["font-size"]+"px",this._t.style.display="flex",this._t.style["justify-content"]="center",this._t.style["align-items"]="center"}};