@mlikiowa/nanaeo 1.0.1746695750670 → 1.0.1757751861391
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2022/08/04/NewBlog/index.html +1 -1
- package/2022/08/13/GaussWave/index.html +1 -1
- package/2023/12/30/2023end/index.html +1 -1
- package/about/index.html +1 -1
- package/archives/2022/08/index.html +1 -1
- package/archives/2022/index.html +1 -1
- package/archives/2023/12/index.html +1 -1
- package/archives/2023/index.html +1 -1
- package/archives/index.html +1 -1
- package/categories/DevLog/index.html +1 -1
- package/categories/SiteLog/index.html +1 -1
- package/categories/index.html +1 -1
- package/content.json +1 -1
- package/friends/index.html +1 -1
- package/index.html +1 -1
- package/js/app.js +1 -1
- package/js/plugins/aplayer.js +1 -1
- package/js/plugins/parallax.js +1 -1
- package/js/plugins/rightMenu.js +1 -1
- package/js/plugins/rightMenus.js +1 -1
- package/js/plugins/tags/contributors.js +1 -1
- package/js/plugins/tags/friends.js +1 -1
- package/js/plugins/tags/sites.js +1 -1
- package/js/search/hexo.js +1 -1
- package/maps/js/app.js.map +1 -1
- package/maps/js/plugins/aplayer.js.map +1 -1
- package/maps/js/plugins/parallax.js.map +1 -1
- package/maps/js/plugins/rightMenu.js.map +1 -1
- package/maps/js/plugins/rightMenus.js.map +1 -1
- package/maps/js/plugins/tags/contributors.js.map +1 -1
- package/maps/js/plugins/tags/friends.js.map +1 -1
- package/maps/js/plugins/tags/sites.js.map +1 -1
- package/maps/js/search/hexo.js.map +1 -1
- package/maps/volantis-sw.js.map +1 -1
- package/package.json +1 -1
- package/tags/DevLog/index.html +1 -1
- package/tags/Gauss/index.html +1 -1
- package/tags/Hexo/index.html +1 -1
- package/tags/HexoThemes/index.html +1 -1
- package/tags/SiteLog/index.html +1 -1
- package/tags/index.html +1 -1
- package/volantis-sw.js +1 -1
package/js/plugins/rightMenu.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(e,t,n,r){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r})}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(t,n,r,o){var i=n&&n.prototype instanceof m?n:m,l=Object.create(i.prototype);return c(l,"_invoke",function(t,n,r){var o=1;return function(i,l){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw l;return{value:e,done:!0}}for(r.method=i,r.arg=l;;){var a=r.delegate;if(a){var c=C(a,r);if(c){if(c===d)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(1===o)throw o=4,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=3;var u=s(t,n,r);if("normal"===u.type){if(o=r.done?4:2,u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=4,r.method="throw",r.arg=u.arg)}}}(t,r,new S(o||[])),!0),l}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d={};function m(){}function p(){}function f(){}var y={};c(y,i,(function(){return this}));var h=Object.getPrototypeOf,g=h&&h(h(D([])));g&&g!==n&&r.call(g,i)&&(y=g);var v=f.prototype=m.prototype=Object.create(y);function b(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function n(o,i,l,a){var c=s(e[o],e,i);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==_typeof(d)&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,a)}),(function(e){n("throw",e,l,a)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,a)}))}a(c.arg)}var o;c(this,"_invoke",(function(e,r){function i(){return new t((function(t,o){n(e,r,t,o)}))}return o=o?o.then(i,i):i()}),!0)}function C(t,n){var r=n.method,o=t.i[r];if(o===e)return n.delegate=null,"throw"===r&&t.i["return"]&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=s(o,t.i,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,d;var l=i.arg;return l?l.done?(n[t.r]=l.value,n.next=t.n,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function O(e){this.tryEntries.push(e)}function w(t){var n=t[4]||{};n.type="normal",n.arg=e,t[4]=n}function S(e){this.tryEntries=[[-1]],e.forEach(O,this),this.reset(!0)}function D(t){if(null!=t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,l=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return l.next=l}}throw new TypeError(_typeof(t)+" is not iterable")}return p.prototype=f,c(v,"constructor",f),c(f,"constructor",p),p.displayName=c(f,a,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,a,"GeneratorFunction")),e.prototype=Object.create(v),e},t.awrap=function(e){return{__await:e}},b(M.prototype),c(M.prototype,l,(function(){return this})),t.AsyncIterator=M,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var l=new M(u(e,n,r,o),i);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},b(v),c(v,a,"Generator"),c(v,i,(function(){return this})),c(v,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function o(){for(;n.length;)if((r=n.pop())in t)return o.value=r,o.done=!1,o;return o.done=!0,o}},t.values=D,S.prototype={constructor:S,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(w),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(e){l.type="throw",l.arg=t,n.next=e}for(var o=n.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i[4],a=this.prev,c=i[1],u=i[2];if(-1===i[0])return r("end"),!1;if(!c&&!u)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=a){if(a<c)return this.method="next",this.arg=e,r(c),!0;if(a<u)return r(u),!1}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r[0]>-1&&r[0]<=this.prev&&this.prev<r[2]){var o=r;break}}o&&("break"===e||"continue"===e)&&o[0]<=t&&t<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o[2],d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[2]===e)return this.complete(n[4],n[3]),w(n),d}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]===e){var r=n[4];if("throw"===r.type){var o=r.arg;w(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={i:D(t),r:n,n:r},"next"===this.method&&(this.arg=e),d}},t}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function asyncGeneratorStep(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function l(e){asyncGeneratorStep(i,r,o,l,a,"next",e)}function a(e){asyncGeneratorStep(i,r,o,l,a,"throw",e)}l(void 0)}))}}var RightMenu=function(){var e=volantis.GLOBAL_CONFIG.plugins.rightmenu,t=volantis.GLOBAL_CONFIG.plugins.message.enable&&volantis.GLOBAL_CONFIG.plugins.message.rightmenu.enable,n={},r=document.getElementById("rightmenu-wrapper"),o=document.getElementById("rightmenu-content"),i=document.getElementById("printHtml"),l=document.getElementById("menuMusic"),a=document.getElementById("readingModel"),c=document.getElementById("read_bkg"),u=document.querySelectorAll(".menuLoad-Content"),s=document.querySelector(".menu-Option"),d=document.querySelector('.menu-Option[data-fn-type="searchWord"]'),m=document.querySelector('.menu-Option[data-fn-type="copyText"]'),p=document.querySelector('.menu-Option[data-fn-type="copyPaste"]'),f=document.querySelector('.menu-Option[data-fn-type="copySelect"]'),y=document.querySelector('.menu-Option[data-fn-type="copyCut"]'),h=document.querySelector('.menu-Option[data-fn-type="copyHref"]'),g=document.querySelector('.menu-Option[data-fn-type="copySrc"]'),v=document.querySelector('.menu-Option[data-fn-type="copyImg"]'),b=document.querySelector('.menu-Option[data-fn-type="openTab"]'),M=document.querySelector("#menuMusic .backward"),C=document.querySelector("#menuMusic .toggle"),O=document.querySelector("#menuMusic .forward"),w=/^((https|http)?:\/\/)+[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/;return n.init=function(){DOMController.visible(l,!1),DOMController.visible(s,!1),c&&c.parentNode.removeChild(c);var e=document.createElement("div");e.className="common_read_bkg common_read_hide",e.id="read_bkg",window.document.body.appendChild(e)},n.initEvent=function(){window.document.oncontextmenu=function(e){return e.ctrlKey||document.body.offsetWidth<=500?(n.hideMenu(),!0):n.popMenu(e)},r.oncontextmenu=function(e){return e.stopPropagation(),e.preventDefault(),!1},window.removeEventListener("blur",n.hideMenu),window.addEventListener("blur",n.hideMenu),document.body.removeEventListener("click",n.hideMenu),document.body.addEventListener("click",n.hideMenu),O&&C&&O&&(M.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerBackward()},C.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerToggle()},O.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerForward()})},n.popMenu=function(e){var t=e.clientX,i=e.clientY,l=document.documentElement.clientWidth||document.body.clientWidth,a=document.documentElement.clientHeight||document.body.clientHeight;try{n.setMenuItem(e),DOMController.visible(r),r.focus(),r.style.zIndex="-2147483648";var c=o.offsetWidth,u=o.offsetHeight,s=t+c>l?t-c+10:t,d=i+u>a?i-u+10:i;d=i+u>a&&d<u&&i<u?d+(a-u-d-10):d,r.style.left=s+"px",r.style.top=d+"px",r.style.zIndex="2147483648",volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice&&n.showMessage()}catch(m){return r.blur(),console.error(m),!0}return!1},n.showMessage=function(){var n="true"===localStorage.getItem("NoticeRightMenu");t&&!n&&VolantisApp.message("右键菜单","唤醒原系统菜单请使用:<kbd>Ctrl</kbd> + <kbd>右键</kbd>",{icon:e.faicon+" fa-exclamation-square red",time:9e3},(function(){localStorage.setItem("NoticeRightMenu","true")}))},n.setMenuItem=function(r){var o=!1,c=r.target,s=window.getSelection().toString();if(DOMController.visible(b,!1),"input"===c.tagName.toLowerCase()||"textarea"===c.tagName.toLowerCase()){var M=c.value;M.length>0?(DOMController.visible(f),f.onclick=function(){r.preventDefault(),c.select()}):DOMController.visible(f,!1),s?(DOMController.visible(y),y.onclick=function(){var e=c.selectionStart,t=c.selectionEnd;n.copyString(s),c.value=M.substring(0,e)+M.substring(t,M.length),c.selectionStart=e,c.selectionEnd=e,c.focus()}):DOMController.visible(y,!1),n.readClipboard().then((function(e){e?(DOMController.visible(p),p.onclick=function(){n.insertAtCaret(c,e)}):DOMController.visible(p,!1)}))["catch"]((function(e){console.error(e),DOMController.visible(p,!1)}))}else DOMController.visible(f,!1),DOMController.visible(p,!1),DOMController.visible(y,!1);var C=c.href;C&&w.test(C)?(o=!0,DOMController.visible(h),DOMController.visible(b),h&&(h.onclick=function(){n.copyString(C)}),b.onclick=function(){window.open(C)}):DOMController.visible(h,!1);var O=c.currentSrc;O&&w.test(O)?(o=!0,DOMController.visible(g),DOMController.visible(b),g.onclick=function(){n.copyString(O)},b.onclick=function(){window.open(O)}):DOMController.visible(g,!1),O&&w.test(O)&&O.trimEnd().endsWith(".png")?(o=!0,DOMController.visible(v),v.onclick=function(){n.writeClipImg(r,(function(n){n&&t&&VolantisApp.message("系统提示","图片复制成功!",{icon:e.faicon+" fa-images"})}),(function(n){t&&VolantisApp.message("系统提示","复制失败:"+n,{icon:e.faicon+" fa-exclamation-square red"})}))}):DOMController.visible(v,!1),s?(o=!0,DOMController.visible(m),DOMController.visible(d),m.onclick=function(){n.copyString(s)},d&&(d.onclick=function(){OpenSearch(s)})):(DOMController.visible(m,!1),DOMController.visible(d,!1));var S=document.querySelector("#post.article")||null,D=window.location.pathname;S?(DOMController.visible(i),DOMController.visible(a),i&&(i.onclick=function(){if(window.location.pathname===D){t&&VolantisApp.question("",'是否打印当前页面?<br><em style="font-size: 80%">建议打印时勾选背景图形</em><br>',{},(function(){n.printHtml()}))}else n.hideMenu()}),a&&(a.onclick=function(){window.location.pathname,n.readingModel()})):(DOMController.visible(i,!1),DOMController.visible(a,!1)),volantis.GLOBAL_CONFIG.plugins.aplayer.enable&&"undefined"!=typeof RightMenuAplayer&&RightMenuAplayer.APlayer.player!==undefined?e.music_alwaysShow?DOMController.visible(l):"play"===RightMenuAplayer.APlayer.status||"undefined"===RightMenuAplayer.APlayer.status?(o=!0,DOMController.visible(l)):DOMController.visible(l,!1):DOMController.visible(l,!1),u.forEach((function(e){DOMController.visible(e,!o)})),volantis.GLOBAL_CONFIG.plugins.aplayer.enable&&e.layout.includes("music")&&RightMenuAplayer.checkAPlayer()},n.hideMenu=function(){DOMController.visible(r,!1)},n.copyString=function(n){VolantisApp.utilWriteClipText(n).then((function(){t&&VolantisApp.messageCopyright()}))["catch"]((function(n){t&&VolantisApp.message("系统提示",n,{icon:e.faicon+" fa-exclamation-square red"})}))},n.writeClipText=function(e){try{return navigator.clipboard.writeText(e).then((function(){return Promise.resolve()}))["catch"]((function(e){return Promise.reject(e)}))}catch(r){var t=document.createElement("input");t.setAttribute("readonly","readonly"),document.body.appendChild(t),t.setAttribute("value",e),t.select();try{var n=document.execCommand("copy");return document.body.removeChild(t),n&&"unsuccessful"!==n?Promise.resolve():Promise.reject("复制文本失败!")}catch(r){return document.body.removeChild(t),Promise.reject("当前浏览器不支持复制功能,请检查更新或更换其他浏览器操作!")}}},n.writeClipImg=function(){var t=_asyncToGenerator(_regeneratorRuntime().mark((function n(t,r,o){var i,l,a,c,u,s,d,m;return _regeneratorRuntime().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=e.customPicUrl.enable?t.target.currentSrc.replace(e.customPicUrl.old,e.customPicUrl["new"]):t.target.currentSrc,l=t.target.parentElement,n.prev=2,n.next=5,fetch(i);case 5:return a=n.sent,n.next=8,a.blob();case 8:return c=n.sent,n.next=11,navigator.clipboard.write([new ClipboardItem(_defineProperty({},c.type,c))]).then((function(){r(!0)}),(function(e){console.error("图片复制失败:",e),o(e)}));case 11:n.next=17;break;case 13:n.prev=13,n.t0=n["catch"](2),u=document;try{u.body.createTextRange?((s=document.body.createTextRange()).moveToElementText(l),s.select()):window.getSelection&&(d=window.getSelection(),(m=document.createRange()).selectNodeContents(l),d.removeAllRanges(),d.addRange(m)),document.execCommand("copy"),window.getSelection().removeAllRanges(),r(!1)}catch(p){console.error(p),o("不支持复制当前图片!")}case 17:case"end":return n.stop()}}),n,null,[[2,13]])})));return function(e,n,r){return t.apply(this,arguments)}}(),n.readClipboard=_asyncToGenerator(_regeneratorRuntime().mark((function S(){var e;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,navigator.permissions.query({name:"clipboard-read"});case 2:if("granted"!==(e=t.sent).state&&"prompt"!==e.state){t.next=5;break}return t.abrupt("return",navigator.clipboard.readText().then((function(e){return e}))["catch"]((function(e){return Promise.reject(e)})));case 5:return t.abrupt("return",Promise.reject(e));case 6:case"end":return t.stop()}}),S)}))),n.insertAtCaret=function(e,t){var n=e.selectionStart,r=e.selectionEnd;if(document.selection)e.focus(),document.selection.createRange().text=t,e.focus();else if(n||"0"==n){var o=e.scrollTop;e.value=e.value.substring(0,n)+t+e.value.substring(r,e.value.length),e.focus(),e.selectionStart=n+t.length,e.selectionEnd=n+t.length,e.scrollTop=o}else e.value+=t,e.focus()},n.printHtml=function(){volantis.isReadModel&&n.readingModel(),DOMController.setAttribute("details","open","true"),DOMController.remove(".cus-article-bkg"),DOMController.remove(".iziToast-overlay"),DOMController.remove(".iziToast-wrapper"),DOMController.remove(".prev-next"),DOMController.remove("footer"),DOMController.remove("#l_header"),DOMController.remove("#l_cover"),DOMController.remove("#l_side"),DOMController.remove("#comments"),DOMController.remove("#s-top"),DOMController.remove("#BKG"),DOMController.remove("#rightmenu-wrapper"),DOMController.remove(".nav-tabs"),DOMController.remove(".parallax-mirror"),DOMController.remove(".new-meta-item.share"),DOMController.remove("div.footer"),DOMController.setStyle("body","backgroundColor","unset"),DOMController.setStyle("#l_main","width","100%"),DOMController.setStyle("#post","boxShadow","none"),DOMController.setStyle("#post","background","none"),DOMController.setStyle("#post","padding","0"),DOMController.setStyle("h1","textAlign","center"),DOMController.setStyle("h1","fontWeight","600"),DOMController.setStyle("h1","fontSize","2rem"),DOMController.setStyle("h1","marginBottom","20px"),DOMController.setStyle(".tab-pane","display","block"),DOMController.setStyle(".tab-content","borderTop","none"),DOMController.setStyle(".highlight>table pre","whiteSpace","pre-wrap"),DOMController.setStyle(".highlight>table pre","wordBreak","break-all"),DOMController.setStyle(".fancybox img","height","auto"),DOMController.setStyle(".fancybox img","weight","auto"),setTimeout((function(){window.print(),document.body.innerHTML="",window.location.reload()}),50)},n.readingModel=function(){if("function"==typeof ScrollReveal&&ScrollReveal().clean("#comments"),DOMController.fadeToggle(document.querySelector("#l_header")),DOMController.fadeToggle(document.querySelector("footer")),DOMController.fadeToggle(document.querySelector("#s-top")),DOMController.fadeToggle(document.querySelector(".article-meta#bottom")),DOMController.fadeToggle(document.querySelector(".prev-next")),DOMController.fadeToggle(document.querySelector("#l_side")),DOMController.fadeToggle(document.querySelector("#comments")),DOMController.toggleClass(document.querySelector("#l_main"),"common_read"),DOMController.toggleClass(document.querySelector("#l_main"),"common_read_main"),DOMController.toggleClass(document.querySelector("#l_body"),"common_read"),DOMController.toggleClass(document.querySelector("#safearea"),"common_read"),DOMController.toggleClass(document.querySelector("#pjax-container"),"common_read"),DOMController.toggleClass(document.querySelector("#read_bkg"),"common_read_hide"),DOMController.toggleClass(document.querySelector("h1"),"common_read_h1"),DOMController.toggleClass(document.querySelector("#post"),"post_read"),DOMController.toggleClass(document.querySelector("#l_cover"),"read_cover"),DOMController.toggleClass(document.querySelector(".widget.toc-wrapper"),"post_read"),volantis.isReadModel=volantis.isReadModel===undefined||!volantis.isReadModel,volantis.isReadModel){var r={backgroundColor:"var(--color-read-post)",icon:e.faicon+" fa-book-reader",time:5e3};t&&VolantisApp.message("系统提示","阅读模式已开启,您可以点击屏幕空白处退出。",r),document.querySelector("#l_body").removeEventListener("click",n.readingModel),document.querySelector("#l_body").addEventListener("click",(function(e){DOMController.hasClass(e.target,"common_read")&&n.readingModel()}))}else document.querySelector("#l_body").removeEventListener("click",n.readingModel),document.querySelector("#post").removeEventListener("click",n.readingModel)},{init:function(){var e=arguments.length>0&&arguments[0]!==undefined&&arguments[0];n.init(),n.initEvent(),e&&t&&VolantisApp.message("系统提示","自定义右键注册成功。")},destroy:function(){var e=arguments.length>0&&arguments[0]!==undefined&&arguments[0];n.hideMenu(),window.document.oncontextmenu=function(){return!0},e&&t&&VolantisApp.message("系统提示","自定义右键注销成功。")},hideMenu:n.hideMenu,readingModel:n.readingModel}}();Object.freeze(RightMenu),volantis.requestAnimationFrame((function(){"loading"!==document.readyState?(RightMenu.init(),volantis.pjax.send((function(){RightMenu.hideMenu()}))):document.addEventListener("DOMContentLoaded",(function(){RightMenu.init(),volantis.pjax.send((function(){RightMenu.hideMenu()}))}))}));
|
1
|
+
"use strict";function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _regenerator(){var e,t,o="function"==typeof Symbol?Symbol:{},n=o.iterator||"@@iterator",r=o.toStringTag||"@@toStringTag";function l(o,n,r,l){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(o,n,r){var l,a,c,u=0,s=r||[],d=!1,m={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,o){return l=t,a=0,c=e,m.n=o,i}};function p(o,n){for(a=o,c=n,t=0;!d&&u&&!r&&t<s.length;t++){var r,l=s[t],p=m.p,f=l[2];o>3?(r=f===n)&&(c=l[(a=l[4])?5:(a=3,3)],l[4]=l[5]=e):l[0]<=p&&((r=o<2&&p<l[1])?(a=0,m.v=n,m.n=l[1]):p<f&&(r=o<3||l[0]>n||n>f)&&(l[4]=o,l[5]=n,m.n=f,a=0))}if(r||o>1)return i;throw d=!0,n}return function(r,s,f){if(u>1)throw TypeError("Generator is already running");for(d&&1===s&&p(s,f),a=s,c=f;(t=a<2?e:c)||!d;){l||(a?a<3?(a>1&&(m.n=-1),p(a,c)):m.n=c:m.v=c);try{if(u=2,l){if(a||(r="next"),t=l[r]){if(!(t=t.call(l,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=l["return"])&&t.call(l),a<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),a=1);l=e}else if((t=(d=m.n<0)?c:o.call(n,m))!==i)break}catch(t){l=e,a=1,c=t}finally{u=1}}return{value:t,done:d}}}(o,r,l),!0),u}var i={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),d=u.prototype=a.prototype=Object.create(s);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,_regeneratorDefine2(e,r,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=u,_regeneratorDefine2(d,"constructor",u),_regeneratorDefine2(u,"constructor",c),c.displayName="GeneratorFunction",_regeneratorDefine2(u,r,"GeneratorFunction"),_regeneratorDefine2(d),_regeneratorDefine2(d,r,"Generator"),_regeneratorDefine2(d,n,function(){return this}),_regeneratorDefine2(d,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:l,m}})()}function _regeneratorDefine2(e,t,o,n){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}_regeneratorDefine2=function(e,t,o,n){function l(t,o){_regeneratorDefine2(e,t,function(e){return this._invoke(t,o,e)})}t?r?r(e,t,{value:o,enumerable:!n,configurable:!n,writable:!n}):e[t]=o:(l("next",0),l("throw",1),l("return",2))},_regeneratorDefine2(e,t,o,n)}function _defineProperty(e,t,o){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var n=o.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function asyncGeneratorStep(e,t,o,n,r,l,i){try{var a=e[l](i),c=a.value}catch(e){return void o(e)}a.done?t(c):Promise.resolve(c).then(n,r)}function _asyncToGenerator(e){return function(){var t=this,o=arguments;return new Promise(function(n,r){var l=e.apply(t,o);function i(e){asyncGeneratorStep(l,n,r,i,a,"next",e)}function a(e){asyncGeneratorStep(l,n,r,i,a,"throw",e)}i(void 0)})}}var RightMenu=function(){var e=volantis.GLOBAL_CONFIG.plugins.rightmenu,t=volantis.GLOBAL_CONFIG.plugins.message.enable&&volantis.GLOBAL_CONFIG.plugins.message.rightmenu.enable,o={},n=document.getElementById("rightmenu-wrapper"),r=document.getElementById("rightmenu-content"),l=document.getElementById("printHtml"),i=document.getElementById("menuMusic"),a=document.getElementById("readingModel"),c=document.getElementById("read_bkg"),u=document.querySelectorAll(".menuLoad-Content"),s=document.querySelector(".menu-Option"),d=document.querySelector('.menu-Option[data-fn-type="searchWord"]'),m=document.querySelector('.menu-Option[data-fn-type="copyText"]'),p=document.querySelector('.menu-Option[data-fn-type="copyPaste"]'),f=document.querySelector('.menu-Option[data-fn-type="copySelect"]'),g=document.querySelector('.menu-Option[data-fn-type="copyCut"]'),y=document.querySelector('.menu-Option[data-fn-type="copyHref"]'),v=document.querySelector('.menu-Option[data-fn-type="copySrc"]'),b=document.querySelector('.menu-Option[data-fn-type="copyImg"]'),M=document.querySelector('.menu-Option[data-fn-type="openTab"]'),C=document.querySelector("#menuMusic .backward"),h=document.querySelector("#menuMusic .toggle"),O=document.querySelector("#menuMusic .forward"),D=/^((https|http)?:\/\/)+[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/;return o.init=function(){DOMController.visible(i,!1),DOMController.visible(s,!1),c&&c.parentNode.removeChild(c);var e=document.createElement("div");e.className="common_read_bkg common_read_hide",e.id="read_bkg",window.document.body.appendChild(e)},o.initEvent=function(){window.document.oncontextmenu=function(e){return e.ctrlKey||document.body.offsetWidth<=500?(o.hideMenu(),!0):o.popMenu(e)},n.oncontextmenu=function(e){return e.stopPropagation(),e.preventDefault(),!1},window.removeEventListener("blur",o.hideMenu),window.addEventListener("blur",o.hideMenu),document.body.removeEventListener("click",o.hideMenu),document.body.addEventListener("click",o.hideMenu),O&&h&&O&&(C.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerBackward()},h.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerToggle()},O.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerForward()})},o.popMenu=function(e){var t=e.clientX,l=e.clientY,i=document.documentElement.clientWidth||document.body.clientWidth,a=document.documentElement.clientHeight||document.body.clientHeight;try{o.setMenuItem(e),DOMController.visible(n),n.focus(),n.style.zIndex="-2147483648";var c=r.offsetWidth,u=r.offsetHeight,s=t+c>i?t-c+10:t,d=l+u>a?l-u+10:l;d=l+u>a&&d<u&&l<u?d+(a-u-d-10):d,n.style.left=s+"px",n.style.top=d+"px",n.style.zIndex="2147483648",volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice&&o.showMessage()}catch(m){return n.blur(),console.error(m),!0}return!1},o.showMessage=function(){var o="true"===localStorage.getItem("NoticeRightMenu");t&&!o&&VolantisApp.message("右键菜单","唤醒原系统菜单请使用:<kbd>Ctrl</kbd> + <kbd>右键</kbd>",{icon:e.faicon+" fa-exclamation-square red",time:9e3},function(){localStorage.setItem("NoticeRightMenu","true")})},o.setMenuItem=function(n){var r=!1,c=n.target,s=window.getSelection().toString();if(DOMController.visible(M,!1),"input"===c.tagName.toLowerCase()||"textarea"===c.tagName.toLowerCase()){var C=c.value;C.length>0?(DOMController.visible(f),f.onclick=function(){n.preventDefault(),c.select()}):DOMController.visible(f,!1),s?(DOMController.visible(g),g.onclick=function(){var e=c.selectionStart,t=c.selectionEnd;o.copyString(s),c.value=C.substring(0,e)+C.substring(t,C.length),c.selectionStart=e,c.selectionEnd=e,c.focus()}):DOMController.visible(g,!1),o.readClipboard().then(function(e){e?(DOMController.visible(p),p.onclick=function(){o.insertAtCaret(c,e)}):DOMController.visible(p,!1)})["catch"](function(e){console.error(e),DOMController.visible(p,!1)})}else DOMController.visible(f,!1),DOMController.visible(p,!1),DOMController.visible(g,!1);var h=c.href;h&&D.test(h)?(r=!0,DOMController.visible(y),DOMController.visible(M),y&&(y.onclick=function(){o.copyString(h)}),M.onclick=function(){window.open(h)}):DOMController.visible(y,!1);var O=c.currentSrc;O&&D.test(O)?(r=!0,DOMController.visible(v),DOMController.visible(M),v.onclick=function(){o.copyString(O)},M.onclick=function(){window.open(O)}):DOMController.visible(v,!1),O&&D.test(O)&&O.trimEnd().endsWith(".png")?(r=!0,DOMController.visible(b),b.onclick=function(){o.writeClipImg(n,function(o){o&&t&&VolantisApp.message("系统提示","图片复制成功!",{icon:e.faicon+" fa-images"})},function(o){t&&VolantisApp.message("系统提示","复制失败:"+o,{icon:e.faicon+" fa-exclamation-square red"})})}):DOMController.visible(b,!1),s?(r=!0,DOMController.visible(m),DOMController.visible(d),m.onclick=function(){o.copyString(s)},d&&(d.onclick=function(){OpenSearch(s)})):(DOMController.visible(m,!1),DOMController.visible(d,!1));var S=document.querySelector("#post.article")||null,_=window.location.pathname;S?(DOMController.visible(l),DOMController.visible(a),l&&(l.onclick=function(){if(window.location.pathname===_){t&&VolantisApp.question("",'是否打印当前页面?<br><em style="font-size: 80%">建议打印时勾选背景图形</em><br>',{},function(){o.printHtml()})}else o.hideMenu()}),a&&(a.onclick=function(){window.location.pathname,o.readingModel()})):(DOMController.visible(l,!1),DOMController.visible(a,!1)),volantis.GLOBAL_CONFIG.plugins.aplayer.enable&&"undefined"!=typeof RightMenuAplayer&&RightMenuAplayer.APlayer.player!==undefined?e.music_alwaysShow?DOMController.visible(i):"play"===RightMenuAplayer.APlayer.status||"undefined"===RightMenuAplayer.APlayer.status?(r=!0,DOMController.visible(i)):DOMController.visible(i,!1):DOMController.visible(i,!1),u.forEach(function(e){DOMController.visible(e,!r)}),volantis.GLOBAL_CONFIG.plugins.aplayer.enable&&e.layout.includes("music")&&RightMenuAplayer.checkAPlayer()},o.hideMenu=function(){DOMController.visible(n,!1)},o.copyString=function(o){VolantisApp.utilWriteClipText(o).then(function(){t&&VolantisApp.messageCopyright()})["catch"](function(o){t&&VolantisApp.message("系统提示",o,{icon:e.faicon+" fa-exclamation-square red"})})},o.writeClipText=function(e){try{return navigator.clipboard.writeText(e).then(function(){return Promise.resolve()})["catch"](function(e){return Promise.reject(e)})}catch(n){var t=document.createElement("input");t.setAttribute("readonly","readonly"),document.body.appendChild(t),t.setAttribute("value",e),t.select();try{var o=document.execCommand("copy");return document.body.removeChild(t),o&&"unsuccessful"!==o?Promise.resolve():Promise.reject("复制文本失败!")}catch(n){return document.body.removeChild(t),Promise.reject("当前浏览器不支持复制功能,请检查更新或更换其他浏览器操作!")}}},o.writeClipImg=function(){var t=_asyncToGenerator(_regenerator().m(function o(t,n,r){var l,i,a,c,u,s,d,m;return _regenerator().w(function(o){for(;;)switch(o.p=o.n){case 0:return l=e.customPicUrl.enable?t.target.currentSrc.replace(e.customPicUrl.old,e.customPicUrl["new"]):t.target.currentSrc,i=t.target.parentElement,o.p=1,o.n=2,fetch(l);case 2:return a=o.v,o.n=3,a.blob();case 3:return c=o.v,o.n=4,navigator.clipboard.write([new ClipboardItem(_defineProperty({},c.type,c))]).then(function(){n(!0)},function(e){console.error("图片复制失败:",e),r(e)});case 4:o.n=6;break;case 5:o.p=5,o.v,u=document;try{u.body.createTextRange?((s=document.body.createTextRange()).moveToElementText(i),s.select()):window.getSelection&&(d=window.getSelection(),(m=document.createRange()).selectNodeContents(i),d.removeAllRanges(),d.addRange(m)),document.execCommand("copy"),window.getSelection().removeAllRanges(),n(!1)}catch(p){console.error(p),r("不支持复制当前图片!")}case 6:return o.a(2)}},o,null,[[1,5]])}));return function(e,o,n){return t.apply(this,arguments)}}(),o.readClipboard=_asyncToGenerator(_regenerator().m(function S(){var e;return _regenerator().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,navigator.permissions.query({name:"clipboard-read"});case 1:if("granted"!==(e=t.v).state&&"prompt"!==e.state){t.n=2;break}return t.a(2,navigator.clipboard.readText().then(function(e){return e})["catch"](function(e){return Promise.reject(e)}));case 2:return t.a(2,Promise.reject(e))}},S)})),o.insertAtCaret=function(e,t){var o=e.selectionStart,n=e.selectionEnd;if(document.selection)e.focus(),document.selection.createRange().text=t,e.focus();else if(o||"0"==o){var r=e.scrollTop;e.value=e.value.substring(0,o)+t+e.value.substring(n,e.value.length),e.focus(),e.selectionStart=o+t.length,e.selectionEnd=o+t.length,e.scrollTop=r}else e.value+=t,e.focus()},o.printHtml=function(){volantis.isReadModel&&o.readingModel(),DOMController.setAttribute("details","open","true"),DOMController.remove(".cus-article-bkg"),DOMController.remove(".iziToast-overlay"),DOMController.remove(".iziToast-wrapper"),DOMController.remove(".prev-next"),DOMController.remove("footer"),DOMController.remove("#l_header"),DOMController.remove("#l_cover"),DOMController.remove("#l_side"),DOMController.remove("#comments"),DOMController.remove("#s-top"),DOMController.remove("#BKG"),DOMController.remove("#rightmenu-wrapper"),DOMController.remove(".nav-tabs"),DOMController.remove(".parallax-mirror"),DOMController.remove(".new-meta-item.share"),DOMController.remove("div.footer"),DOMController.setStyle("body","backgroundColor","unset"),DOMController.setStyle("#l_main","width","100%"),DOMController.setStyle("#post","boxShadow","none"),DOMController.setStyle("#post","background","none"),DOMController.setStyle("#post","padding","0"),DOMController.setStyle("h1","textAlign","center"),DOMController.setStyle("h1","fontWeight","600"),DOMController.setStyle("h1","fontSize","2rem"),DOMController.setStyle("h1","marginBottom","20px"),DOMController.setStyle(".tab-pane","display","block"),DOMController.setStyle(".tab-content","borderTop","none"),DOMController.setStyle(".highlight>table pre","whiteSpace","pre-wrap"),DOMController.setStyle(".highlight>table pre","wordBreak","break-all"),DOMController.setStyle(".fancybox img","height","auto"),DOMController.setStyle(".fancybox img","weight","auto"),setTimeout(function(){window.print(),document.body.innerHTML="",window.location.reload()},50)},o.readingModel=function(){if("function"==typeof ScrollReveal&&ScrollReveal().clean("#comments"),DOMController.fadeToggle(document.querySelector("#l_header")),DOMController.fadeToggle(document.querySelector("footer")),DOMController.fadeToggle(document.querySelector("#s-top")),DOMController.fadeToggle(document.querySelector(".article-meta#bottom")),DOMController.fadeToggle(document.querySelector(".prev-next")),DOMController.fadeToggle(document.querySelector("#l_side")),DOMController.fadeToggle(document.querySelector("#comments")),DOMController.toggleClass(document.querySelector("#l_main"),"common_read"),DOMController.toggleClass(document.querySelector("#l_main"),"common_read_main"),DOMController.toggleClass(document.querySelector("#l_body"),"common_read"),DOMController.toggleClass(document.querySelector("#safearea"),"common_read"),DOMController.toggleClass(document.querySelector("#pjax-container"),"common_read"),DOMController.toggleClass(document.querySelector("#read_bkg"),"common_read_hide"),DOMController.toggleClass(document.querySelector("h1"),"common_read_h1"),DOMController.toggleClass(document.querySelector("#post"),"post_read"),DOMController.toggleClass(document.querySelector("#l_cover"),"read_cover"),DOMController.toggleClass(document.querySelector(".widget.toc-wrapper"),"post_read"),volantis.isReadModel=volantis.isReadModel===undefined||!volantis.isReadModel,volantis.isReadModel){var n={backgroundColor:"var(--color-read-post)",icon:e.faicon+" fa-book-reader",time:5e3};t&&VolantisApp.message("系统提示","阅读模式已开启,您可以点击屏幕空白处退出。",n),document.querySelector("#l_body").removeEventListener("click",o.readingModel),document.querySelector("#l_body").addEventListener("click",function(e){DOMController.hasClass(e.target,"common_read")&&o.readingModel()})}else document.querySelector("#l_body").removeEventListener("click",o.readingModel),document.querySelector("#post").removeEventListener("click",o.readingModel)},{init:function(){var e=arguments.length>0&&arguments[0]!==undefined&&arguments[0];o.init(),o.initEvent(),e&&t&&VolantisApp.message("系统提示","自定义右键注册成功。")},destroy:function(){var e=arguments.length>0&&arguments[0]!==undefined&&arguments[0];o.hideMenu(),window.document.oncontextmenu=function(){return!0},e&&t&&VolantisApp.message("系统提示","自定义右键注销成功。")},hideMenu:o.hideMenu,readingModel:o.readingModel}}();Object.freeze(RightMenu),volantis.requestAnimationFrame(function(){"loading"!==document.readyState?(RightMenu.init(),volantis.pjax.send(function(){RightMenu.hideMenu()})):document.addEventListener("DOMContentLoaded",function(){RightMenu.init(),volantis.pjax.send(function(){RightMenu.hideMenu()})})});
|
2
2
|
//# sourceMappingURL=../../maps/js/plugins/rightMenu.js.map
|
package/js/plugins/rightMenus.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,n,r){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r})}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function c(t,n,r,o){var i=n&&n.prototype instanceof p?n:p,a=Object.create(i.prototype);return u(a,"_invoke",function(t,n,r){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=w(s,r);if(u){if(u===d)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(1===o)throw o=4,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=3;var c=l(t,n,r);if("normal"===c.type){if(o=r.done?4:2,c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=4,r.method="throw",r.arg=c.arg)}}}(t,r,new R(o||[])),!0),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var d={};function p(){}function m(){}function h(){}var g={};u(g,i,(function(){return this}));var f=Object.getPrototypeOf,y=f&&f(f(_([])));y&&y!==n&&r.call(y,i)&&(g=y);var v=h.prototype=p.prototype=Object.create(g);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function n(o,i,a,s){var u=l(e[o],e,i);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==_typeof(d)&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var o;u(this,"_invoke",(function(e,r){function i(){return new t((function(t,o){n(e,r,t,o)}))}return o=o?o.then(i,i):i()}),!0)}function w(t,n){var r=n.method,o=t.i[r];if(o===e)return n.delegate=null,"throw"===r&&t.i["return"]&&(n.method="return",n.arg=e,w(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=l(o,t.i,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,d;var a=i.arg;return a?a.done?(n[t.r]=a.value,n.next=t.n,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function x(e){this.tryEntries.push(e)}function k(t){var n=t[4]||{};n.type="normal",n.arg=e,t[4]=n}function R(e){this.tryEntries=[[-1]],e.forEach(x,this),this.reset(!0)}function _(t){if(null!=t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(_typeof(t)+" is not iterable")}return m.prototype=h,u(v,"constructor",h),u(h,"constructor",m),m.displayName=u(h,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},t.awrap=function(e){return{__await:e}},b(M.prototype),u(M.prototype,a,(function(){return this})),t.AsyncIterator=M,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new M(c(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(v),u(v,s,"Generator"),u(v,i,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function o(){for(;n.length;)if((r=n.pop())in t)return o.value=r,o.done=!1,o;return o.done=!0,o}},t.values=_,R.prototype={constructor:R,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(k),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0][4];if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(e){a.type="throw",a.arg=t,n.next=e}for(var o=n.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],s=this.prev,u=i[1],c=i[2];if(-1===i[0])return r("end"),!1;if(!u&&!c)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=s){if(s<u)return this.method="next",this.arg=e,r(u),!0;if(s<c)return r(c),!1}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r[0]>-1&&r[0]<=this.prev&&this.prev<r[2]){var o=r;break}}o&&("break"===e||"continue"===e)&&o[0]<=t&&t<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o[2],d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[2]===e)return this.complete(n[4],n[3]),k(n),d}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n[0]===e){var r=n[4];if("throw"===r.type){var o=r.arg;k(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={i:_(t),r:n,n:r},"next"===this.method&&(this.arg=e),d}},t}function asyncGeneratorStep(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){asyncGeneratorStep(i,r,o,a,s,"next",e)}function s(e){asyncGeneratorStep(i,r,o,a,s,"throw",e)}a(void 0)}))}}var RightMenus={defaultEvent:["copyText","copyLink","copyPaste","copyAll","copyCut","copyImg","printMode","readMode"],defaultGroup:["navigation","inputBox","seletctText","elementCheck","elementImage","articlePage"],messageRightMenu:volantis.GLOBAL_CONFIG.plugins.message.enable&&volantis.GLOBAL_CONFIG.plugins.message.rightmenu.enable,corsAnywhere:volantis.GLOBAL_CONFIG.plugins.rightmenus.options.corsAnywhere,urlRegx:/^((https|http)?:\/\/)+[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,imgRegx:/\.(jpe?g|png|webp|svg|gif|jifi)(-|_|!|\?|\/)?.*$/,initialMenu:function(){RightMenus.fun.init(),volantis.pjax.send((function(){RightMenus.fun.hideMenu(),volantis.isReadModel&&RightMenus.fun.readMode()}))},readClipboard:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function t(){var e,n;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,navigator.permissions.query({name:"clipboard-read"});case 2:n=t.sent,t.t0=n.state,t.next="granted"===t.t0||"prompt"===t.t0?6:10;break;case 6:return t.next=8,navigator.clipboard.readText();case 8:return e=t.sent,t.abrupt("break",12);case 10:return window.clipboardRead=!1,t.abrupt("break",12);case 12:return t.abrupt("return",e);case 13:case"end":return t.stop()}}),t)})));return function(){return e.apply(this,arguments)}}(),writeClipText:function(e){return navigator.clipboard.writeText(e).then((function(){return Promise.resolve()}))["catch"]((function(e){return Promise.reject(e)}))},writeClipImg:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function t(e,n,r){var o;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:(o=new Image).crossOrigin="Anonymous",o.addEventListener("load",(function(){var e=document.createElement("canvas"),t=e.getContext("2d");e.width=o.width,e.height=o.height,t.drawImage(o,0,0),e.toBlob((function(e){navigator.clipboard.write([new ClipboardItem({"image/png":e})]).then((function(e){n(e)}))["catch"]((function(e){r(e)}))}),"image/png")}),!1),o.src="".concat(e,"?(lll¬ω¬)");case 4:case"end":return t.stop()}}),t)})));return function(t,n,r){return e.apply(this,arguments)}}(),insertAtCaret:function(e,t){var n=e.selectionStart,r=e.selectionEnd;if(document.selection)e.focus(),document.selection.createRange().text=t,e.focus();else if(n||"0"==n){var o=e.scrollTop;e.value=e.value.substring(0,n)+t+e.value.substring(r,e.value.length),e.focus(),e.selectionStart=n+t.length,e.selectionEnd=n+t.length,e.scrollTop=o}else e.value+=t,e.focus()}};RightMenus.fun=function(){var e=volantis.GLOBAL_CONFIG.plugins.rightmenus,t={},n=document.getElementById("rightmenu-wrapper"),r=document.getElementById("rightmenu-content"),o=document.querySelectorAll("#rightmenu-content li.menuLoad-Content"),i=document.querySelectorAll("#rightmenu-content li, #rightmenu-content hr, #menuMusic"),a=document.getElementById("read_bkg"),s=document.getElementById("menuMusic"),u=document.querySelector("#menuMusic .backward"),c=document.querySelector("#menuMusic .toggle"),l=document.querySelector("#menuMusic .forward"),d={mouseEvent:null,isInputBox:!1,selectText:"",inputValue:"",isLink:!1,linkUrl:"",isMediaLink:!1,mediaLinkUrl:"",isImage:!1,isArticle:!1,pathName:"",isReadClipboard:!0,isShowMusic:!1,statusCheck:!1},p=Object.assign({},d);return t.initEvent=function(){t.elementAppend(),t.contextmenu(),t.menuEvent()},t.elementAppend=function(){a&&a.parentNode.removeChild(a);var e=document.createElement("div");e.className="common_read_bkg common_read_hide",e.id="read_bkg",window.document.body.appendChild(e)},t.menuPosition=function(e){try{var o=e.clientX,i=e.clientY,a=document.documentElement.clientWidth||document.body.clientWidth,s=document.documentElement.clientHeight||document.body.clientHeight;n.style.display="block",t.menuControl(e);var u=r.offsetWidth,c=r.offsetHeight,l=o+u>a?o-u+10:o,d=i+c>s?i-c+10:i;d=i+c>s&&d<c&&i<c?d+(s-c-d-10):d,n.style.left="".concat(l,"px"),n.style.top="".concat(d,"px"),volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice&&t.menuNotic()}catch(p){return console.error(p),t.hideMenu(),!0}return!1},t.menuControl=function(n){t.globalDataSet(n),s&&(s.style.display=d.isShowMusic?"block":"none"),o.forEach((function(t){t.style.display="none";var n=t.firstElementChild.nodeName,r=t.firstElementChild.getAttribute("data-group"),o=t.firstElementChild.getAttribute("data-event");if(d.statusCheck||d.isArticle)switch(r){case"inputBox":d.isInputBox&&(t.style.display="block","copyCut"!==o||d.selectText||(t.style.display="none"),"copyAll"!==o||d.inputValue||(t.style.display="none"),"copyPaste"!==o||d.isReadClipboard||(t.style.display="none"));break;case"seletctText":d.selectText&&(t.style.display="block");break;case"elementCheck":(d.isLink||d.isMediaLink)&&(t.style.display="block");break;case"elementImage":d.isImage&&(t.style.display="block");break;case"articlePage":d.isArticle&&(t.style.display="block");break;default:t.style.display="A"===n?d.isArticle&&!d.statusCheck&&e.options.articleShowLink?"block":"none":"block"}else("A"===n||RightMenus.defaultGroup.every((function(e){return r!==e})))&&(t.style.display="block")})),volantis.mouseEvent=n,volantis.rightmenu.method.handle.start();var r={item:null,hide:!0};i.forEach((function(e){if("HR"===e.nodeName){if(e.style.display="block",!r.item)return void(r.item=e);(r.hide||"hr"===r.item.nextElementSibling.nodeName)&&(r.item.style.display="none"),r.item=e,r.hide=!0}else"block"===e.style.display&&r.hide&&(r.hide=!1)})),r.item&&r.hide&&(r.item.style.display="none")},t.globalDataSet=function(t){var n;(d=Object.assign({},p)).mouseEvent=t,d.selectText=window.getSelection().toString(),"input"!==t.target.tagName.toLowerCase()&&"textarea"!==t.target.tagName.toLowerCase()||(d.isInputBox=!0,d.inputValue=t.target.value),d.isInputBox&&!1===window.clipboardRead&&(d.isReadClipboard=!1),t.target.href&&RightMenus.urlRegx.test(t.target.href)&&(d.isLink=!0,d.linkUrl=t.target.href),t.target.currentSrc&&RightMenus.urlRegx.test(t.target.currentSrc)&&(d.isMediaLink=!0,d.mediaLinkUrl=t.target.currentSrc),d.isMediaLink&&RightMenus.imgRegx.test(d.mediaLinkUrl)&&(d.isImage=!0),document.querySelector("#post.article")&&(d.isArticle=!0,d.pathName=window.location.pathname),null!==(n=volantis.GLOBAL_CONFIG.plugins.aplayer)&&void 0!==n&&n.enable&&"undefined"!=typeof RightMenuAplayer&&RightMenuAplayer.APlayer.player!==undefined&&(e.options.musicAlwaysShow||"play"===RightMenuAplayer.APlayer.status||"undefined"===RightMenuAplayer.APlayer.status)&&(d.isShowMusic=!0),(d.selectText||d.isInputBox||d.isLink||d.isMediaLink)&&(d.statusCheck=!0)},t.contextmenu=function(){window.document.oncontextmenu=function(e){return e.ctrlKey||document.body.offsetWidth<=500?(t.hideMenu(),!0):t.menuPosition(e)},n.oncontextmenu=function(e){return e.stopPropagation(),e.preventDefault(),!1},window.removeEventListener("blur",t.hideMenu),window.addEventListener("blur",t.hideMenu),document.body.removeEventListener("click",t.hideMenu),document.body.addEventListener("click",t.hideMenu)},t.menuEvent=function(){o.forEach((function(n){var r=n.firstElementChild.getAttribute("data-event"),o=n.firstElementChild.getAttribute("id"),i=n.firstElementChild.getAttribute("data-group");"A"!==n.firstElementChild.nodeName&&n.addEventListener("click",(function(){try{RightMenus.defaultEvent.every((function(e){return r!==e}))?"seletctText"===i?RightMenusFunction[o](d.selectText):"elementCheck"===i?RightMenusFunction[o](d.isLink?d.linkUrl:d.mediaLinkUrl):"elementImage"===i?RightMenusFunction[o](d.mediaLinkUrl):RightMenusFunction[o]():t[r]()}catch(n){"rightMenus"===volantis.GLOBAL_CONFIG.debug&&console.error({id:o,error:n,globalData:d,groupName:i,eventName:r}),RightMenus.messageRightMenu&&VolantisApp.message("错误提示",n,{icon:e.options.iconPrefix+" fa-exclamation-square red",time:"15000"})}}))})),l&&c&&l&&(u.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerBackward()},c.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerToggle()},l.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerForward()})},t.hideMenu=function(){n.style.display=null,n.style.left=null,n.style.top=null},t.menuNotic=function(){var t="true"===localStorage.getItem("NoticeRightMenu");RightMenus.messageRightMenu&&!t&&VolantisApp.message("右键菜单","唤醒原系统菜单请使用:<kbd>Ctrl</kbd> + <kbd>右键</kbd>",{icon:e.options.iconPrefix+" fa-exclamation-square red",displayMode:1,time:9e3},(function(){localStorage.setItem("NoticeRightMenu","true")}))},t.copyText=function(){VolantisApp.utilWriteClipText(d.selectText).then((function(){RightMenus.messageRightMenu&&VolantisApp.messageCopyright()}))["catch"]((function(t){RightMenus.messageRightMenu&&VolantisApp.message("系统提示",t,{icon:e.options.iconPrefix+" fa-exclamation-square red",displayMode:1,time:9e3})}))},t.copyLink=function(){VolantisApp.utilWriteClipText(d.linkUrl||d.mediaLinkUrl).then((function(){RightMenus.messageRightMenu&&VolantisApp.messageCopyright()}))["catch"]((function(t){RightMenus.messageRightMenu&&VolantisApp.message("系统提示",t,{icon:e.options.iconPrefix+" fa-exclamation-square red",displayMode:1,time:9e3})}))},t.copyAll=function(){d.mouseEvent.target.select()},t.copyPaste=_asyncToGenerator(_regeneratorRuntime().mark((function m(){var e;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,RightMenus.readClipboard();case 2:if(t.t0=t.sent,t.t0){t.next=5;break}t.t0="";case 5:e=t.t0,RightMenus.messageRightMenu&&!1===window.clipboardRead?VolantisApp.message("系统提示","未授予剪切板读取权限!"):RightMenus.messageRightMenu&&""===e?VolantisApp.message("系统提示","仅支持复制文本内容!"):RightMenus.insertAtCaret(d.mouseEvent.target,e);case 7:case"end":return t.stop()}}),m)}))),t.copyCut=function(){var e=d.mouseEvent.target.selectionStart,n=d.mouseEvent.target.selectionEnd,r=d.inputValue;t.copyText(d.selectText),d.mouseEvent.target.value=r.substring(0,e)+r.substring(n,r.length),d.mouseEvent.target.selectionStart=e,d.mouseEvent.target.selectionEnd=e,d.mouseEvent.target.focus()},t.copyImg=function(){volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice&&VolantisApp.message("系统提示","复制中,请等待。",{icon:e.options.iconPrefix+" fa-images"}),RightMenus.writeClipImg(d.mediaLinkUrl,(function(t){RightMenus.messageRightMenu&&(VolantisApp.hideMessage(),VolantisApp.message("系统提示","图片复制成功!",{icon:e.options.iconPrefix+" fa-images"}))}),(function(t){console.error(t),RightMenus.messageRightMenu&&(VolantisApp.hideMessage(),VolantisApp.message("系统提示","复制失败:"+t,{icon:e.options.iconPrefix+" fa-exclamation-square red",time:9e3}))}))},t.printMode=function(){if(window.location.pathname===d.pathName)if(RightMenus.messageRightMenu){VolantisApp.question("",'是否打印当前页面?<br><em style="font-size: 80%">建议打印时勾选背景图形</em><br>',{time:9e3},(function(){t.printHtml()}))}else t.printHtml()},t.printHtml=function(){volantis.isReadModel&&t.readMode(),DOMController.setAttribute("details","open","true"),DOMController.removeList([".cus-article-bkg",".iziToast-overlay",".iziToast-wrapper",".prev-next","footer","#l_header","#l_cover","#l_side","#comments","#s-top","#BKG","#rightmenu-wrapper",".nav-tabs",".parallax-mirror",".new-meta-item.share","div.footer"]),DOMController.setStyleList([["body","backgroundColor","unset"],["#l_main","width","100%"],["#post","boxShadow","none"],["#post","background","none"],["#post","padding","0"],["h1","textAlign","center"],["h1","fontWeight","600"],["h1","fontSize","2rem"],["h1","marginBottom","20px"],[".tab-pane","display","block"],[".tab-content","borderTop","none"],[".highlight>table pre","whiteSpace","pre-wrap"],[".highlight>table pre","wordBreak","break-all"],[".fancybox img","height","auto"],[".fancybox img","weight","auto"]]),setTimeout((function(){window.print(),document.body.innerHTML="",window.location.reload()}),50)},t.readMode=function(){"function"==typeof ScrollReveal&&ScrollReveal().clean("#comments"),DOMController.fadeToggleList([document.querySelector("#l_header"),document.querySelector("footer"),document.querySelector("#s-top"),document.querySelector(".article-meta#bottom"),document.querySelector(".prev-next"),document.querySelector("#l_side"),document.querySelector("#comments")]),DOMController.toggleClassList([[document.querySelector("#l_main"),"common_read"],[document.querySelector("#l_main"),"common_read_main"],[document.querySelector("#l_body"),"common_read"],[document.querySelector("#safearea"),"common_read"],[document.querySelector("#pjax-container"),"common_read"],[document.querySelector("#read_bkg"),"common_read_hide"],[document.querySelector("h1"),"common_read_h1"],[document.querySelector("#post"),"post_read"],[document.querySelector("#l_cover"),"read_cover"],[document.querySelector(".widget.toc-wrapper"),"post_read"]]),DOMController.setStyle(".copyright.license","margin","15px 0"),volantis.isReadModel=volantis.isReadModel===undefined||!volantis.isReadModel,volantis.isReadModel?(RightMenus.messageRightMenu&&VolantisApp.message("系统提示","阅读模式已开启,您可以点击屏幕空白处退出。",{backgroundColor:"var(--color-read-post)",icon:e.options.iconPrefix+" fa-book-reader",displayMode:1,time:5e3}),document.querySelector("#l_body").removeEventListener("click",t.readMode),document.querySelector("#l_body").addEventListener("click",(function(e){DOMController.hasClass(e.target,"common_read")&&t.readMode()}))):(document.querySelector("#l_body").removeEventListener("click",t.readMode),document.querySelector("#post").removeEventListener("click",t.readMode),DOMController.setStyle(".prev-next","display","flex"),DOMController.setStyle(".copyright.license","margin","15px -40px"))},{init:t.initEvent,hideMenu:t.hideMenu,readMode:t.readMode}}(),Object.freeze(RightMenus),volantis.requestAnimationFrame((function(){"loading"!==document.readyState?RightMenus.initialMenu():document.addEventListener("DOMContentLoaded",(function(){RightMenus.initialMenu()}))}));
|
1
|
+
"use strict";function _regenerator(){var e,t,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function r(n,o,i,r){var l=o&&o.prototype instanceof s?o:s,c=Object.create(l.prototype);return _regeneratorDefine2(c,"_invoke",function(n,o,i){var r,s,l,c=0,u=i||[],d=!1,m={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return r=t,s=0,l=e,m.n=n,a}};function g(n,o){for(s=n,l=o,t=0;!d&&c&&!i&&t<u.length;t++){var i,r=u[t],g=m.p,p=r[2];n>3?(i=p===o)&&(l=r[(s=r[4])?5:(s=3,3)],r[4]=r[5]=e):r[0]<=g&&((i=n<2&&g<r[1])?(s=0,m.v=o,m.n=r[1]):g<p&&(i=n<3||r[0]>o||o>p)&&(r[4]=n,r[5]=o,m.n=p,s=0))}if(i||n>1)return a;throw d=!0,o}return function(i,u,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&g(u,p),s=u,l=p;(t=s<2?e:l)||!d;){r||(s?s<3?(s>1&&(m.n=-1),g(s,l)):m.n=l:m.v=l);try{if(c=2,r){if(s||(i="next"),t=r[i]){if(!(t=t.call(r,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=r["return"])&&t.call(r),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);r=e}else if((t=(d=m.n<0)?l:n.call(o,m))!==a)break}catch(t){r=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,i,r),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][o]?t(t([][o]())):(_regeneratorDefine2(t={},o,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,_regeneratorDefine2(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,_regeneratorDefine2(d,"constructor",c),_regeneratorDefine2(c,"constructor",l),l.displayName="GeneratorFunction",_regeneratorDefine2(c,i,"GeneratorFunction"),_regeneratorDefine2(d),_regeneratorDefine2(d,i,"Generator"),_regeneratorDefine2(d,o,function(){return this}),_regeneratorDefine2(d,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:r,m}})()}function _regeneratorDefine2(e,t,n,o){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine2=function(e,t,n,o){function r(t,n){_regeneratorDefine2(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!o,configurable:!o,writable:!o}):e[t]=n:(r("next",0),r("throw",1),r("return",2))},_regeneratorDefine2(e,t,n,o)}function asyncGeneratorStep(e,t,n,o,i,r,a){try{var s=e[r](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(o,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var r=e.apply(t,n);function a(e){asyncGeneratorStep(r,o,i,a,s,"next",e)}function s(e){asyncGeneratorStep(r,o,i,a,s,"throw",e)}a(void 0)})}}var RightMenus={defaultEvent:["copyText","copyLink","copyPaste","copyAll","copyCut","copyImg","printMode","readMode"],defaultGroup:["navigation","inputBox","seletctText","elementCheck","elementImage","articlePage"],messageRightMenu:volantis.GLOBAL_CONFIG.plugins.message.enable&&volantis.GLOBAL_CONFIG.plugins.message.rightmenu.enable,corsAnywhere:volantis.GLOBAL_CONFIG.plugins.rightmenus.options.corsAnywhere,urlRegx:/^((https|http)?:\/\/)+[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,imgRegx:/\.(jpe?g|png|webp|svg|gif|jifi)(-|_|!|\?|\/)?.*$/,initialMenu:function(){RightMenus.fun.init(),volantis.pjax.send(function(){RightMenus.fun.hideMenu(),volantis.isReadModel&&RightMenus.fun.readMode()})},readClipboard:function(){var e=_asyncToGenerator(_regenerator().m(function t(){var e,n,o;return _regenerator().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,navigator.permissions.query({name:"clipboard-read"});case 1:n=t.v,o=n.state,t.n="granted"===o||"prompt"===o?2:4;break;case 2:return t.n=3,navigator.clipboard.readText();case 3:return e=t.v,t.a(3,5);case 4:return window.clipboardRead=!1,t.a(3,5);case 5:return t.a(2,e)}},t)}));return function(){return e.apply(this,arguments)}}(),writeClipText:function(e){return navigator.clipboard.writeText(e).then(function(){return Promise.resolve()})["catch"](function(e){return Promise.reject(e)})},writeClipImg:function(){var e=_asyncToGenerator(_regenerator().m(function t(e,n,o){var i;return _regenerator().w(function(t){for(;;)switch(t.n){case 0:(i=new Image).crossOrigin="Anonymous",i.addEventListener("load",function(){var e=document.createElement("canvas"),t=e.getContext("2d");e.width=i.width,e.height=i.height,t.drawImage(i,0,0),e.toBlob(function(e){navigator.clipboard.write([new ClipboardItem({"image/png":e})]).then(function(e){n(e)})["catch"](function(e){o(e)})},"image/png")},!1),i.src="".concat(e,"?(lll¬ω¬)");case 1:return t.a(2)}},t)}));return function(t,n,o){return e.apply(this,arguments)}}(),insertAtCaret:function(e,t){var n=e.selectionStart,o=e.selectionEnd;if(document.selection)e.focus(),document.selection.createRange().text=t,e.focus();else if(n||"0"==n){var i=e.scrollTop;e.value=e.value.substring(0,n)+t+e.value.substring(o,e.value.length),e.focus(),e.selectionStart=n+t.length,e.selectionEnd=n+t.length,e.scrollTop=i}else e.value+=t,e.focus()}};RightMenus.fun=function(){var e=volantis.GLOBAL_CONFIG.plugins.rightmenus,t={},n=document.getElementById("rightmenu-wrapper"),o=document.getElementById("rightmenu-content"),i=document.querySelectorAll("#rightmenu-content li.menuLoad-Content"),r=document.querySelectorAll("#rightmenu-content li, #rightmenu-content hr, #menuMusic"),a=document.getElementById("read_bkg"),s=document.getElementById("menuMusic"),l=document.querySelector("#menuMusic .backward"),c=document.querySelector("#menuMusic .toggle"),u=document.querySelector("#menuMusic .forward"),d={mouseEvent:null,isInputBox:!1,selectText:"",inputValue:"",isLink:!1,linkUrl:"",isMediaLink:!1,mediaLinkUrl:"",isImage:!1,isArticle:!1,pathName:"",isReadClipboard:!0,isShowMusic:!1,statusCheck:!1},m=Object.assign({},d);return t.initEvent=function(){t.elementAppend(),t.contextmenu(),t.menuEvent()},t.elementAppend=function(){a&&a.parentNode.removeChild(a);var e=document.createElement("div");e.className="common_read_bkg common_read_hide",e.id="read_bkg",window.document.body.appendChild(e)},t.menuPosition=function(e){try{var i=e.clientX,r=e.clientY,a=document.documentElement.clientWidth||document.body.clientWidth,s=document.documentElement.clientHeight||document.body.clientHeight;n.style.display="block",t.menuControl(e);var l=o.offsetWidth,c=o.offsetHeight,u=i+l>a?i-l+10:i,d=r+c>s?r-c+10:r;d=r+c>s&&d<c&&r<c?d+(s-c-d-10):d,n.style.left="".concat(u,"px"),n.style.top="".concat(d,"px"),volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice&&t.menuNotic()}catch(m){return console.error(m),t.hideMenu(),!0}return!1},t.menuControl=function(n){t.globalDataSet(n),s&&(s.style.display=d.isShowMusic?"block":"none"),i.forEach(function(t){t.style.display="none";var n=t.firstElementChild.nodeName,o=t.firstElementChild.getAttribute("data-group"),i=t.firstElementChild.getAttribute("data-event");if(d.statusCheck||d.isArticle)switch(o){case"inputBox":d.isInputBox&&(t.style.display="block","copyCut"!==i||d.selectText||(t.style.display="none"),"copyAll"!==i||d.inputValue||(t.style.display="none"),"copyPaste"!==i||d.isReadClipboard||(t.style.display="none"));break;case"seletctText":d.selectText&&(t.style.display="block");break;case"elementCheck":(d.isLink||d.isMediaLink)&&(t.style.display="block");break;case"elementImage":d.isImage&&(t.style.display="block");break;case"articlePage":d.isArticle&&(t.style.display="block");break;default:t.style.display="A"===n?d.isArticle&&!d.statusCheck&&e.options.articleShowLink?"block":"none":"block"}else("A"===n||RightMenus.defaultGroup.every(function(e){return o!==e}))&&(t.style.display="block")}),volantis.mouseEvent=n,volantis.rightmenu.method.handle.start();var o={item:null,hide:!0};r.forEach(function(e){if("HR"===e.nodeName){if(e.style.display="block",!o.item)return void(o.item=e);(o.hide||"hr"===o.item.nextElementSibling.nodeName)&&(o.item.style.display="none"),o.item=e,o.hide=!0}else"block"===e.style.display&&o.hide&&(o.hide=!1)}),o.item&&o.hide&&(o.item.style.display="none")},t.globalDataSet=function(t){var n;(d=Object.assign({},m)).mouseEvent=t,d.selectText=window.getSelection().toString(),"input"!==t.target.tagName.toLowerCase()&&"textarea"!==t.target.tagName.toLowerCase()||(d.isInputBox=!0,d.inputValue=t.target.value),d.isInputBox&&!1===window.clipboardRead&&(d.isReadClipboard=!1),t.target.href&&RightMenus.urlRegx.test(t.target.href)&&(d.isLink=!0,d.linkUrl=t.target.href),t.target.currentSrc&&RightMenus.urlRegx.test(t.target.currentSrc)&&(d.isMediaLink=!0,d.mediaLinkUrl=t.target.currentSrc),d.isMediaLink&&RightMenus.imgRegx.test(d.mediaLinkUrl)&&(d.isImage=!0),document.querySelector("#post.article")&&(d.isArticle=!0,d.pathName=window.location.pathname),null!==(n=volantis.GLOBAL_CONFIG.plugins.aplayer)&&void 0!==n&&n.enable&&"undefined"!=typeof RightMenuAplayer&&RightMenuAplayer.APlayer.player!==undefined&&(e.options.musicAlwaysShow||"play"===RightMenuAplayer.APlayer.status||"undefined"===RightMenuAplayer.APlayer.status)&&(d.isShowMusic=!0),(d.selectText||d.isInputBox||d.isLink||d.isMediaLink)&&(d.statusCheck=!0)},t.contextmenu=function(){window.document.oncontextmenu=function(e){return e.ctrlKey||document.body.offsetWidth<=500?(t.hideMenu(),!0):t.menuPosition(e)},n.oncontextmenu=function(e){return e.stopPropagation(),e.preventDefault(),!1},window.removeEventListener("blur",t.hideMenu),window.addEventListener("blur",t.hideMenu),document.body.removeEventListener("click",t.hideMenu),document.body.addEventListener("click",t.hideMenu)},t.menuEvent=function(){i.forEach(function(n){var o=n.firstElementChild.getAttribute("data-event"),i=n.firstElementChild.getAttribute("id"),r=n.firstElementChild.getAttribute("data-group");"A"!==n.firstElementChild.nodeName&&n.addEventListener("click",function(){try{RightMenus.defaultEvent.every(function(e){return o!==e})?"seletctText"===r?RightMenusFunction[i](d.selectText):"elementCheck"===r?RightMenusFunction[i](d.isLink?d.linkUrl:d.mediaLinkUrl):"elementImage"===r?RightMenusFunction[i](d.mediaLinkUrl):RightMenusFunction[i]():t[o]()}catch(n){"rightMenus"===volantis.GLOBAL_CONFIG.debug&&console.error({id:i,error:n,globalData:d,groupName:r,eventName:o}),RightMenus.messageRightMenu&&VolantisApp.message("错误提示",n,{icon:e.options.iconPrefix+" fa-exclamation-square red",time:"15000"})}})}),u&&c&&u&&(l.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerBackward()},c.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerToggle()},u.onclick=function(e){e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerForward()})},t.hideMenu=function(){n.style.display=null,n.style.left=null,n.style.top=null},t.menuNotic=function(){var t="true"===localStorage.getItem("NoticeRightMenu");RightMenus.messageRightMenu&&!t&&VolantisApp.message("右键菜单","唤醒原系统菜单请使用:<kbd>Ctrl</kbd> + <kbd>右键</kbd>",{icon:e.options.iconPrefix+" fa-exclamation-square red",displayMode:1,time:9e3},function(){localStorage.setItem("NoticeRightMenu","true")})},t.copyText=function(){VolantisApp.utilWriteClipText(d.selectText).then(function(){RightMenus.messageRightMenu&&VolantisApp.messageCopyright()})["catch"](function(t){RightMenus.messageRightMenu&&VolantisApp.message("系统提示",t,{icon:e.options.iconPrefix+" fa-exclamation-square red",displayMode:1,time:9e3})})},t.copyLink=function(){VolantisApp.utilWriteClipText(d.linkUrl||d.mediaLinkUrl).then(function(){RightMenus.messageRightMenu&&VolantisApp.messageCopyright()})["catch"](function(t){RightMenus.messageRightMenu&&VolantisApp.message("系统提示",t,{icon:e.options.iconPrefix+" fa-exclamation-square red",displayMode:1,time:9e3})})},t.copyAll=function(){d.mouseEvent.target.select()},t.copyPaste=_asyncToGenerator(_regenerator().m(function g(){var e,t;return _regenerator().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,RightMenus.readClipboard();case 1:if(t=n.v){n.n=2;break}t="";case 2:e=t,RightMenus.messageRightMenu&&!1===window.clipboardRead?VolantisApp.message("系统提示","未授予剪切板读取权限!"):RightMenus.messageRightMenu&&""===e?VolantisApp.message("系统提示","仅支持复制文本内容!"):RightMenus.insertAtCaret(d.mouseEvent.target,e);case 3:return n.a(2)}},g)})),t.copyCut=function(){var e=d.mouseEvent.target.selectionStart,n=d.mouseEvent.target.selectionEnd,o=d.inputValue;t.copyText(d.selectText),d.mouseEvent.target.value=o.substring(0,e)+o.substring(n,o.length),d.mouseEvent.target.selectionStart=e,d.mouseEvent.target.selectionEnd=e,d.mouseEvent.target.focus()},t.copyImg=function(){volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice&&VolantisApp.message("系统提示","复制中,请等待。",{icon:e.options.iconPrefix+" fa-images"}),RightMenus.writeClipImg(d.mediaLinkUrl,function(t){RightMenus.messageRightMenu&&(VolantisApp.hideMessage(),VolantisApp.message("系统提示","图片复制成功!",{icon:e.options.iconPrefix+" fa-images"}))},function(t){console.error(t),RightMenus.messageRightMenu&&(VolantisApp.hideMessage(),VolantisApp.message("系统提示","复制失败:"+t,{icon:e.options.iconPrefix+" fa-exclamation-square red",time:9e3}))})},t.printMode=function(){if(window.location.pathname===d.pathName)if(RightMenus.messageRightMenu){VolantisApp.question("",'是否打印当前页面?<br><em style="font-size: 80%">建议打印时勾选背景图形</em><br>',{time:9e3},function(){t.printHtml()})}else t.printHtml()},t.printHtml=function(){volantis.isReadModel&&t.readMode(),DOMController.setAttribute("details","open","true"),DOMController.removeList([".cus-article-bkg",".iziToast-overlay",".iziToast-wrapper",".prev-next","footer","#l_header","#l_cover","#l_side","#comments","#s-top","#BKG","#rightmenu-wrapper",".nav-tabs",".parallax-mirror",".new-meta-item.share","div.footer"]),DOMController.setStyleList([["body","backgroundColor","unset"],["#l_main","width","100%"],["#post","boxShadow","none"],["#post","background","none"],["#post","padding","0"],["h1","textAlign","center"],["h1","fontWeight","600"],["h1","fontSize","2rem"],["h1","marginBottom","20px"],[".tab-pane","display","block"],[".tab-content","borderTop","none"],[".highlight>table pre","whiteSpace","pre-wrap"],[".highlight>table pre","wordBreak","break-all"],[".fancybox img","height","auto"],[".fancybox img","weight","auto"]]),setTimeout(function(){window.print(),document.body.innerHTML="",window.location.reload()},50)},t.readMode=function(){"function"==typeof ScrollReveal&&ScrollReveal().clean("#comments"),DOMController.fadeToggleList([document.querySelector("#l_header"),document.querySelector("footer"),document.querySelector("#s-top"),document.querySelector(".article-meta#bottom"),document.querySelector(".prev-next"),document.querySelector("#l_side"),document.querySelector("#comments")]),DOMController.toggleClassList([[document.querySelector("#l_main"),"common_read"],[document.querySelector("#l_main"),"common_read_main"],[document.querySelector("#l_body"),"common_read"],[document.querySelector("#safearea"),"common_read"],[document.querySelector("#pjax-container"),"common_read"],[document.querySelector("#read_bkg"),"common_read_hide"],[document.querySelector("h1"),"common_read_h1"],[document.querySelector("#post"),"post_read"],[document.querySelector("#l_cover"),"read_cover"],[document.querySelector(".widget.toc-wrapper"),"post_read"]]),DOMController.setStyle(".copyright.license","margin","15px 0"),volantis.isReadModel=volantis.isReadModel===undefined||!volantis.isReadModel,volantis.isReadModel?(RightMenus.messageRightMenu&&VolantisApp.message("系统提示","阅读模式已开启,您可以点击屏幕空白处退出。",{backgroundColor:"var(--color-read-post)",icon:e.options.iconPrefix+" fa-book-reader",displayMode:1,time:5e3}),document.querySelector("#l_body").removeEventListener("click",t.readMode),document.querySelector("#l_body").addEventListener("click",function(e){DOMController.hasClass(e.target,"common_read")&&t.readMode()})):(document.querySelector("#l_body").removeEventListener("click",t.readMode),document.querySelector("#post").removeEventListener("click",t.readMode),DOMController.setStyle(".prev-next","display","flex"),DOMController.setStyle(".copyright.license","margin","15px -40px"))},{init:t.initEvent,hideMenu:t.hideMenu,readMode:t.readMode}}(),Object.freeze(RightMenus),volantis.requestAnimationFrame(function(){"loading"!==document.readyState?RightMenus.initialMenu():document.addEventListener("DOMContentLoaded",function(){RightMenus.initialMenu()})});
|
2
2
|
//# sourceMappingURL=../../maps/js/plugins/rightMenus.js.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var ContributorsJS={requestAPI:function(t,r,e){var n=5;!function a(){return new Promise(
|
1
|
+
"use strict";var ContributorsJS={requestAPI:function(t,r,e){var n=5;!function a(){return new Promise(function(o,i){var u=0,s=setTimeout(function(){0===u&&(u=2,s=null,i("请求超时"),0==n&&e())},5e3);fetch(t).then(function(t){if(2!==u&&(clearTimeout(s),o(t),s=null,u=1),t.ok)return t.json();throw new Error("Network response was not ok.")}).then(function(t){n=0,r(t)})["catch"](function(t){n>0?(n-=1,setTimeout(function(){a()},5e3)):e()})})}()},layout:function(t){var r=t.el;ContributorsJS.requestAPI(t.api,function(e){r.querySelector(".loading-wrap").remove();var n="";(e||[]).forEach(function(r,e){var a='<div class="user-card">';a+='<a class="card-link" target="_blank" rel="external noopener noreferrer"',a+=' href="'+r.html_url+'">',a+='<img alt="'+r.login+'" src="'+(r.avatar_url||t.avatar)+'" onerror="errorImgAvatar(this)">',a+='<div class="name"><span>'+r.login+"</span></div>",a+="</a>",n+=a+="</div>"}),r.querySelector(".group-body").innerHTML=n},function(){try{r.querySelector(".loading-wrap svg").remove(),r.querySelector(".loading-wrap p").innerText("加载失败,请稍后重试。")}catch(t){}})},start:function(){for(var t=document.getElementsByClassName("contributorsjs-wrap"),r=0;r<t.length;r++){var e=t[r],n=e.getAttribute("api");if(null!=n){var a=new Object;a.el=e,a.api=n,a["class"]=e.getAttribute("class"),a.avatar=volantis.GLOBAL_CONFIG["default"].avatar,ContributorsJS.layout(a)}}}};ContributorsJS.start(),document.addEventListener("pjax:complete",function(){ContributorsJS.start()});
|
2
2
|
//# sourceMappingURL=../../../maps/js/plugins/tags/contributors.js.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var FriendsJS={requestAPI:function(e,t,r){var n=5;!function a(){return new Promise(
|
1
|
+
"use strict";var FriendsJS={requestAPI:function(e,t,r){var n=5;!function a(){return new Promise(function(o,i){var s=0,c=setTimeout(function(){0===s&&(s=2,c=null,i("请求超时"),0==n&&r())},5e3);fetch(e).then(function(e){if(2!==s&&(clearTimeout(c),o(e),c=null,s=1),e.ok)return e.json();throw new Error("Network response was not ok.")}).then(function(e){n=0,t(e)})["catch"](function(e){n>0?(n-=1,setTimeout(function(){a()},5e3)):r()})})}()},layout:function(e){var t=e.el;FriendsJS.requestAPI(e.api,function(r){t.querySelector(".loading-wrap").remove();var n=r.content,a="";n.forEach(function(t,r){var n='<div class="user-card">';n+='<a class="card-link" target="_blank" rel="external noopener noreferrer"',n+=' href="'+t.url+'">',n+='<img alt="'+t.title+'" src="'+(t.avatar||e.avatar)+'" onerror="errorImgAvatar(this)">',n+='<div class="name"><span>'+t.title+"</span></div>",n+="</a>",a+=n+="</div>"}),t.querySelector(".group-body").innerHTML=a},function(){try{t.querySelector(".loading-wrap svg").remove(),t.querySelector(".loading-wrap p").innerText("加载失败,请稍后重试。")}catch(e){}})},start:function(){for(var e=document.getElementsByClassName("friendsjs-wrap"),t=0;t<e.length;t++){var r=e[t],n=r.getAttribute("api");if(null!=n){var a=new Object;a.el=r,a.api=n,a["class"]=r.getAttribute("class"),a.avatar=volantis.GLOBAL_CONFIG["default"].avatar,FriendsJS.layout(a)}}}};FriendsJS.start(),document.addEventListener("pjax:complete",function(){FriendsJS.start()});
|
2
2
|
//# sourceMappingURL=../../../maps/js/plugins/tags/friends.js.map
|
package/js/plugins/tags/sites.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var SitesJS={requestAPI:function(t,e,r){var n=5;!function a(){return new Promise(
|
1
|
+
"use strict";var SitesJS={requestAPI:function(t,e,r){var n=5;!function a(){return new Promise(function(o,i){var s=0,c=setTimeout(function(){0===s&&(s=2,c=null,i("请求超时"),0==n&&r())},5e3);fetch(t).then(function(t){if(2!==s&&(clearTimeout(c),o(t),c=null,s=1),t.ok)return t.json();throw new Error("Network response was not ok.")}).then(function(t){n=0,e(t)})["catch"](function(t){n>0?(n-=1,setTimeout(function(){a()},5e3)):r()})})}()},layout:function(t){var e=t.el;SitesJS.requestAPI(t.api,function(r){e.querySelector(".loading-wrap").remove();var n=r.content,a="";n.forEach(function(e,r){var n='<div class="site-card">';n+='<a class="card-link" target="_blank" rel="external noopener noreferrer" href="'+e.url+'">',n+='<img alt="'+e.title+'" src="'+(e.screenshot||"https://image.thum.io/get/width/1024/crop/768/"+e.url)+'" onerror="errorImgCover(this)"/>',n+='<div class="info">',n+='<img alt="'+e.title+'" src="'+(e.avatar||t.avatar)+'" onerror="errorImgAvatar(this)"/>',n+='<span class="title">'+e.title+"</span>",n+='<span class="desc">'+(e.description||e.url)+"</span>",n+="</div>",n+="</a>",a+=n+="</div>"}),e.querySelector(".group-body").innerHTML=a},function(){try{e.querySelector(".loading-wrap svg").remove(),e.querySelector(".loading-wrap p").innerText("加载失败,请稍后重试。")}catch(t){}})},start:function(t){for(var e=document.getElementsByClassName("sitesjs-wrap"),r=0;r<e.length;r++){var n=e[r],a=n.getAttribute("api");if(null!=a)(t=new Object)["class"]=n.getAttribute("class"),t.el=n,t.api=a,t.avatar=volantis.GLOBAL_CONFIG["default"].link,t.screenshot=volantis.GLOBAL_CONFIG["default"].cover,SitesJS.layout(t)}}};SitesJS.start(),document.addEventListener("pjax:complete",function(){SitesJS.start()});
|
2
2
|
//# sourceMappingURL=../../../maps/js/plugins/tags/sites.js.map
|
package/js/search/hexo.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function s(e,r,n,o){var a=r&&r.prototype instanceof f?r:f,i=Object.create(a.prototype);return c(i,"_invoke",function(e,r,n){var o=1;return function(a,i){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=x(u,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=l(e,r,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===h)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(e,n,new _(o||[])),!0),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h={};function f(){}function d(){}function p(){}var y={};c(y,a,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(O([])));m&&m!==r&&n.call(m,a)&&(y=m);var g=p.prototype=f.prototype=Object.create(y);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function r(o,a,i,u){var c=l(t[o],t,a);if("throw"!==c.type){var s=c.arg,h=s.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,i,u)}),(function(t){r("throw",t,i,u)})):e.resolve(h).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,u)}))}u(c.arg)}var o;c(this,"_invoke",(function(t,n){function a(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(a,a):a()}),!0)}function x(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i["return"]&&(r.method="return",r.arg=t,x(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var a=l(o,e.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,h;var i=a.arg;return i?i.done?(r[e.r]=i.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function S(t){this.tryEntries.push(t)}function E(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function _(t){this.tryEntries=[[-1]],t.forEach(S,this),this.reset(!0)}function O(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(_typeof(e)+" is not iterable")}return d.prototype=p,c(g,"constructor",p),c(p,"constructor",d),d.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t},e.awrap=function(t){return{__await:t}},b(w.prototype),c(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},b(g),c(g,u,"Generator"),c(g,a,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function o(){for(;r.length;)if((n=r.pop())in e)return o.value=n,o.done=!1,o;return o.done=!0,o}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){i.type="throw",i.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a[4],u=this.prev,c=a[1],s=a[2];if(-1===a[0])return n("end"),!1;if(!c&&!s)throw Error("try statement without catch or finally");if(null!=a[0]&&a[0]<=u){if(u<c)return this.method="next",this.arg=t,n(c),!0;if(u<s)return n(s),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var a=o?o[4]:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o[2],h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),h}},"catch":function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:O(e),r,n},"next"===this.method&&(this.arg=t),h}},e}function asyncGeneratorStep(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){asyncGeneratorStep(a,n,o,i,u,"next",t)}function u(t){asyncGeneratorStep(a,n,o,i,u,"throw",t)}i(void 0)}))}}var SearchService=function(){var t={queryText:null,data:null,template:'<div id="u-search">\n <div class="modal">\n <header class="modal-header" class="clearfix">\n <form id="u-search-modal-form" class="u-search-form" name="uSearchModalForm">\n <input type="text" id="u-search-modal-input" class="u-search-input" />\n <button type="submit" id="u-search-modal-btn-submit" class="u-search-btn-submit">\n <span class="fa-solid fa-search"></span>\n </button>\n </form>\n <a id="u-search-btn-close" class="btn-close"> <span class="fa-solid fa-times"></span> </a>\n </header>\n <main class="modal-body">\n <ul class="modal-results"></ul>\n </main>\n </div>\n <div id="modal-overlay" class="modal-overlay"></div>\n</div>\n',init:function(){var e=document.createElement("div");e.innerHTML+=t.template,document.body.append(e),document.querySelectorAll(".u-search-form").forEach((function(e){e.addEventListener("submit",t.onSubmit,!1)})),document.querySelector("#u-search-modal-input").addEventListener("input",t.onSubmit),document.querySelector("#u-search-btn-close").addEventListener("click",t.close,!1),document.querySelector("#modal-overlay").addEventListener("click",t.close,!1)},onSubmit:function(e){e.preventDefault();var r=e.target.querySelector(".u-search-input");t.queryText=r?r.value:e.target.value,t.queryText&&t.search()}};return t.search=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(document.querySelectorAll(".u-search-input").forEach((function(e){e.value=t.queryText})),document.querySelector("#u-search").style.display="block",t.data){e.next=6;break}return e.next=5,t.fetchData();case 5:t.data=e.sent;case 6:r="",r+=t.buildResultList(t.data.pages),r+=t.buildResultList(t.data.posts),document.querySelector("#u-search .modal-results").innerHTML=r,window.pjax&&pjax.refresh(document.querySelector("#u-search")),document.addEventListener("keydown",(function n(e){"Escape"===e.code&&(t.close(),document.removeEventListener("keydown",n))}));case 12:case"end":return e.stop()}}),e)}))),t.close=function(){document.querySelector("#u-search").style.display="none"},t.fetchData=function(){return fetch(SearchServiceDataPath).then((function(t){return t.text()})).then((function(t){return JSON.parse(t)}))},t.buildResultList=function(e){var r="";return e.forEach((function(e){e.text&&(e.text=e.text.replace(/12345\d*/g,"")),!e.title&&e.text&&(e.title=e.text.trim().slice(0,15)),t.contentSearch(e)&&(r+=t.buildResult(e.permalink,e.title,e.digest))})),r},t.contentSearch=function(e){var r=e.title.trim().toLowerCase(),n=e.text.trim().toLowerCase(),o=t.queryText.trim().toLowerCase().split(/[-\s]+/),a=!1,i=-1,u=-1,c=-1;return r&&n&&o.forEach((function(t,s){if(i=r.indexOf(t),u=n.indexOf(t),i<0&&u<0?a=!1:(a=!0,u<0&&(u=0),0===s&&(c=u)),a){n=e.text.trim();var l=0,h=0;if(c>=0){h=0===(l=Math.max(c-40,0))?Math.min(200,n.length):Math.min(c+120,n.length);var f=n.substring(l,h);o.forEach((function(t){var e=new RegExp(t,"gi");f=f.replace(e,"<b mark>"+t+"</b>")})),e.digest=f+"......"}else h=Math.min(200,n.length),e.digest=n.trim().substring(0,h)}})),a},t.buildResult=function(e,r,n){var o="";return o+="<li>",o+="<a class='result' href='"+t.getUrlRelativePath(e)+"?keyword="+t.queryText+"'>",o+="<span class='title'>"+r+"</span>",""!==n&&(o+="<span class='digest'>"+n+"</span>"),o+="</a>",o+="</li>"},t.getUrlRelativePath=function(t){var e=t.split("//"),r=e[1].indexOf("/"),n=e[1].substring(r);return-1!=n.indexOf("?")&&(n=n.split("?")[0]),n},{init:function(){t.init()},setQueryText:function(e){t.queryText=e},search:function(){t.search()}}}();Object.freeze(SearchService),SearchService.init(),document.addEventListener("pjax:success",SearchService.init),document.addEventListener("pjax:send",(function(){document.querySelector("#u-search").style.display="none"}));
|
1
|
+
"use strict";function _regenerator(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function o(r,n,a,o){var u=n&&n.prototype instanceof c?n:c,s=Object.create(u.prototype);return _regeneratorDefine2(s,"_invoke",function(r,n,a){var o,c,u,s=0,l=a||[],f=!1,d={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,r){return o=t,c=0,u=e,d.n=r,i}};function h(r,n){for(c=r,u=n,t=0;!f&&s&&!a&&t<l.length;t++){var a,o=l[t],h=d.p,m=o[2];r>3?(a=m===n)&&(u=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=h&&((a=r<2&&h<o[1])?(c=0,d.v=n,d.n=o[1]):h<m&&(a=r<3||o[0]>n||n>m)&&(o[4]=r,o[5]=n,d.n=m,c=0))}if(a||r>1)return i;throw f=!0,n}return function(a,l,m){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,m),c=l,u=m;(t=c<2?e:u)||!f;){o||(c?c<3?(c>1&&(d.n=-1),h(c,u)):d.n=u:d.v=u);try{if(s=2,o){if(c||(a="next"),t=o[a]){if(!(t=t.call(o,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=o["return"])&&t.call(o),c<2&&(u=TypeError("The iterator does not provide a '"+a+"' method"),c=1);o=e}else if((t=(f=d.n<0)?u:r.call(n,d))!==i)break}catch(t){o=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(r,a,o),!0),s}var i={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,_regeneratorDefine2(e,a,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,_regeneratorDefine2(f,"constructor",s),_regeneratorDefine2(s,"constructor",u),u.displayName="GeneratorFunction",_regeneratorDefine2(s,a,"GeneratorFunction"),_regeneratorDefine2(f),_regeneratorDefine2(f,a,"Generator"),_regeneratorDefine2(f,n,function(){return this}),_regeneratorDefine2(f,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:o,m:d}})()}function _regeneratorDefine2(e,t,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}_regeneratorDefine2=function(e,t,r,n){function o(t,r){_regeneratorDefine2(e,t,function(e){return this._invoke(t,r,e)})}t?a?a(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,t,r,n)}function asyncGeneratorStep(e,t,r,n,a,o,i){try{var c=e[o](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,a)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){asyncGeneratorStep(o,n,a,i,c,"next",e)}function c(e){asyncGeneratorStep(o,n,a,i,c,"throw",e)}i(void 0)})}}var SearchService=function(){var e={queryText:null,data:null,template:'<div id="u-search">\n <div class="modal">\n <header class="modal-header" class="clearfix">\n <form id="u-search-modal-form" class="u-search-form" name="uSearchModalForm">\n <input type="text" id="u-search-modal-input" class="u-search-input" />\n <button type="submit" id="u-search-modal-btn-submit" class="u-search-btn-submit">\n <span class="fa-solid fa-search"></span>\n </button>\n </form>\n <a id="u-search-btn-close" class="btn-close"> <span class="fa-solid fa-times"></span> </a>\n </header>\n <main class="modal-body">\n <ul class="modal-results"></ul>\n </main>\n </div>\n <div id="modal-overlay" class="modal-overlay"></div>\n</div>\n',init:function(){var t=document.createElement("div");t.innerHTML+=e.template,document.body.append(t),document.querySelectorAll(".u-search-form").forEach(function(t){t.addEventListener("submit",e.onSubmit,!1)}),document.querySelector("#u-search-modal-input").addEventListener("input",e.onSubmit),document.querySelector("#u-search-btn-close").addEventListener("click",e.close,!1),document.querySelector("#modal-overlay").addEventListener("click",e.close,!1)},onSubmit:function(t){t.preventDefault();var r=t.target.querySelector(".u-search-input");e.queryText=r?r.value:t.target.value,e.queryText&&e.search()}};return e.search=_asyncToGenerator(_regenerator().m(function t(){var r;return _regenerator().w(function(t){for(;;)switch(t.n){case 0:if(document.querySelectorAll(".u-search-input").forEach(function(t){t.value=e.queryText}),document.querySelector("#u-search").style.display="block",e.data){t.n=2;break}return t.n=1,e.fetchData();case 1:e.data=t.v;case 2:r="",r+=e.buildResultList(e.data.pages),r+=e.buildResultList(e.data.posts),document.querySelector("#u-search .modal-results").innerHTML=r,window.pjax&&pjax.refresh(document.querySelector("#u-search")),document.addEventListener("keydown",function n(t){"Escape"===t.code&&(e.close(),document.removeEventListener("keydown",n))});case 3:return t.a(2)}},t)})),e.close=function(){document.querySelector("#u-search").style.display="none"},e.fetchData=function(){return fetch(SearchServiceDataPath).then(function(e){return e.text()}).then(function(e){return JSON.parse(e)})},e.buildResultList=function(t){var r="";return t.forEach(function(t){t.text&&(t.text=t.text.replace(/12345\d*/g,"")),!t.title&&t.text&&(t.title=t.text.trim().slice(0,15)),e.contentSearch(t)&&(r+=e.buildResult(t.permalink,t.title,t.digest))}),r},e.contentSearch=function(t){var r=t.title.trim().toLowerCase(),n=t.text.trim().toLowerCase(),a=e.queryText.trim().toLowerCase().split(/[-\s]+/),o=!1,i=-1,c=-1,u=-1;return r&&n&&a.forEach(function(e,s){if(i=r.indexOf(e),c=n.indexOf(e),i<0&&c<0?o=!1:(o=!0,c<0&&(c=0),0===s&&(u=c)),o){n=t.text.trim();var l=0,f=0;if(u>=0){f=0===(l=Math.max(u-40,0))?Math.min(200,n.length):Math.min(u+120,n.length);var d=n.substring(l,f);a.forEach(function(e){var t=new RegExp(e,"gi");d=d.replace(t,"<b mark>"+e+"</b>")}),t.digest=d+"......"}else f=Math.min(200,n.length),t.digest=n.trim().substring(0,f)}}),o},e.buildResult=function(t,r,n){var a="";return a+="<li>",a+="<a class='result' href='"+e.getUrlRelativePath(t)+"?keyword="+e.queryText+"'>",a+="<span class='title'>"+r+"</span>",""!==n&&(a+="<span class='digest'>"+n+"</span>"),a+="</a>",a+="</li>"},e.getUrlRelativePath=function(e){var t=e.split("//"),r=t[1].indexOf("/"),n=t[1].substring(r);return-1!=n.indexOf("?")&&(n=n.split("?")[0]),n},{init:function(){e.init()},setQueryText:function(t){e.queryText=t},search:function(){e.search()}}}();Object.freeze(SearchService),SearchService.init(),document.addEventListener("pjax:success",SearchService.init),document.addEventListener("pjax:send",function(){document.querySelector("#u-search").style.display="none"});
|
2
2
|
//# sourceMappingURL=../../maps/js/search/hexo.js.map
|