"use strict";function asyncGeneratorStep(e,n,t,o,i,r,c){try{var m=e[r](c),a=m.value}catch(e){return void t(e)}m.done?n(a):Promise.resolve(a).then(o,i)}function _asyncToGenerator(m){return function(){var e=this,c=arguments;return new Promise(function(n,t){var o=m.apply(e,c);function i(e){asyncGeneratorStep(o,n,t,i,r,"next",e)}function r(e){asyncGeneratorStep(o,n,t,i,r,"throw",e)}i(void 0)})}}var rm={};rm.stopdragimg=$("img"),rm.stopdragimg.on("dragstart",function(){return!1}),rm.showRightMenu=function(e){var n=1window.innerWidth&&(n-=rmWidth+10),t+rmHeight>window.innerHeight&&(t-=t+rmHeight-window.innerHeight),rm.showRightMenu(!0,t,n),$("#rightmenu-mask").attr("style","display: flex"),!1}},rm.downloadimging=!1,rm.writeClipImg=function(e){console.log("按下复制"),rm.hideRightMenu(),btf.snackbarShow("正在下载中,请稍后",!1,1e4),0==rm.downloadimging&&(rm.downloadimging=!0,setTimeout(function(){copyImage(e),btf.snackbarShow("复制成功!图片已添加盲水印,请遵守版权协议"),rm.downloadimging=!1},"10000"))},rm.switchDarkMode=function(){navFn.switchDarkMode(),rm.hideRightMenu(),heo.darkModeStatus()},rm.copyUrl=function(e){$("body").after("");var n=e,t=document.getElementById("copyVal");t.value=n,t.select(),t.setSelectionRange(0,t.value.length),document.execCommand("copy"),$("#copyVal").remove()},rm.rightmenuCopyText=function(e){navigator.clipboard&&navigator.clipboard.writeText(e),rm.hideRightMenu()},rm.copyPageUrl=function(){var e=window.location.href;rm.copyUrl(e),btf.snackbarShow("复制本页链接地址成功",!1,2e3),rm.hideRightMenu()},rm.sharePage=function(){window.location.href;rm.copyUrl(url),btf.snackbarShow("复制本页链接地址成功",!1,2e3),rm.hideRightMenu()};var selectTextNow="";function selceText(){var e=document.selection?document.selection.createRange().text:window.getSelection()+"";selectTextNow=e||""}function replaceAll(e,n,t){return e.split(n).join(t)}function addRightMenuClickEvent(){$("#menu-backward").on("click",function(){window.history.back(),rm.hideRightMenu()}),$("#menu-forward").on("click",function(){window.history.forward(),rm.hideRightMenu()}),$("#menu-refresh").on("click",function(){window.location.reload()}),$("#menu-top").on("click",function(){btf.scrollToDest(0,500),rm.hideRightMenu()}),$(".menu-link").on("click",rm.hideRightMenu),$("#menu-darkmode").on("click",rm.switchDarkMode),$("#menu-home").on("click",function(){window.location.href=window.location.origin}),$("#menu-randomPost").on("click",function(){toRandomPost()}),$("#menu-commentBarrage").on("click",heo.switchCommentBarrage),$("#rightmenu-mask").on("click",rm.hideRightMenu),$("#rightmenu-mask").contextmenu(function(){return rm.hideRightMenu(),!1}),$("#menu-translate").on("click",function(){rm.hideRightMenu(),translateInitialization()}),$("#menu-copy").on("click",rm.copyPageUrl),$("#menu-pastetext").on("click",rm.pasteText),$("#menu-copytext").on("click",function(){rm.rightmenuCopyText(selectTextNow),btf.snackbarShow("复制成功,复制和转载请标注本文地址")}),$("#menu-commenttext").on("click",function(){rm.rightMenuCommentText(selectTextNow)}),$("#menu-newwindow").on("click",function(){window.open(domhref),rm.hideRightMenu()}),$("#menu-copylink").on("click",rm.copyLink),$("#menu-downloadimg").on("click",function(){heo.downloadImage(domImgSrc,"zhheo")}),$("#menu-copyimg").on("click",function(){rm.writeClipImg(domImgSrc)}),$("#menu-searchBaidu").on("click",rm.searchBaidu),$("#menu-music-toggle").on("click",heo.musicToggle),$("#menu-music-back").on("click",heo.musicSkipBack),$("#menu-music-forward").on("click",heo.musicSkipForward),$("#menu-music-copyMusicName").on("click",function(){rm.rightmenuCopyText(heo.musicGetName())})}document.onmouseup=document.ondbclick=selceText,rm.readClipboard=function(){navigator.clipboard&&navigator.clipboard.readText().then(function(e){return rm.insertAtCaret(globalEvent.target,e)})},rm.insertAtCaret=function(e,n){var t,o=e.selectionStart,i=e.selectionEnd;document.selection?(e.focus(),document.selection.createRange().text=n,e.focus()):o||"0"==o?(t=e.scrollTop,e.value=e.value.substring(0,o)+n+e.value.substring(i,e.value.length),e.focus(),e.selectionStart=o+n.length,e.selectionEnd=o+n.length,e.scrollTop=t):(e.value+=n,e.focus())},rm.pasteText=function(){rm.readClipboard();rm.hideRightMenu()},rm.rightMenuCommentText=function(e){rm.hideRightMenu();var n=document.getElementsByClassName("el-textarea__inner")[0],t=document.createEvent("HTMLEvents");t.initEvent("input",!0,!0);var o=replaceAll(e,"\n","\n> ");n.value="> "+o+"\n\n",n.dispatchEvent(t);var i=document.querySelector("#post-comment").offsetTop;window.scrollTo(0,i-80),n.focus(),n.setSelectionRange(-1,-1),document.getElementById("comment-tips")&&document.getElementById("comment-tips").classList.add("show")},rm.searchBaidu=function(){btf.snackbarShow("即将跳转到百度搜索",!1,2e3),setTimeout(function(){window.open("https://www.baidu.com/s?wd="+selectTextNow)},"2000"),rm.hideRightMenu()},rm.copyLink=function(){rm.rightmenuCopyText(domhref),btf.snackbarShow("已复制链接地址")};