1
0
mirror of https://github.com/StarGazer114/stargazer114.github.io.git synced 2025-01-09 06:48:17 +08:00
stargazer114.github.io/pluginsSrc/pangu/dist/browser/pangu.min.js

9 lines
12 KiB
JavaScript
Raw Normal View History

2025-01-05 20:41:38 +08:00
/*!
* pangu.js
* --------
* @version: 4.0.7
* @homepage: https://github.com/vinta/pangu.js
* @license: MIT
* @author: Vinta Chen <vinta.chen@gmail.com> (https://github.com/vinta)
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("pangu",[],t):"object"==typeof exports?exports.pangu=t():e.pangu=t()}(window,function(){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(a,i,function(t){return e[t]}.bind(null,i));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){var a,i,o;i=[],void 0===(o="function"==typeof(a=function(){"use strict";function t(e){return(t="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})(e)}function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function i(e,n){return!n||"object"!==t(n)&&"function"!=typeof n?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):n}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=i(this,o(t).call(this))).blockTags=/^(div|p|h1|h2|h3|h4|h5|h6)$/i,e.ignoredTags=/^(script|code|pre|textarea)$/i,e.presentationalTags=/^(b|code|del|em|i|s|strong)$/i,e.spaceLikeTags=/^(br|hr|i|img|pangu)$/i,e.spaceSensitiveTags=/^(a|del|pre|s|strike|u)$/i,e.isAutoSpacingPageExecuted=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}(t,e),n=t,(c=[{key:"isContentEditable",value:function(e){return e.isContentEditable||e.getAttribute&&"true"===e.getAttribute("g_editable")}},{key:"isSpecificTag",value:function(e,t){return e&&e.nodeName&&e.nodeName.search(t)>=0}},{key:"isInsideSpecificTag",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=e;if(n&&this.isSpecificTag(a,t))return!0;for(;a.parentNode;)if(a=a.parentNode,this.isSpecificTag(a,t))return!0;return!1}},{key:"canIgnoreNode",value:function(e){var t=e;if(t&&(this.isSpecificTag(t,this.ignoredTags)||this.isContentEditable(t)))return!0;for(;t.parentNode;)if((t=t.parentNode)&&(this.isSpecificTag(t,this.ignoredTags)||this.isContentEditable(t)))return!0;return!1}},{key:"isFirstTextChild",value:function(e,t){for(var n=e.childNodes,a=0;a<n.length;a++){var i=n[a];if(i.nodeType!==Node.COMMENT_NODE&&i.textContent)return i===t}return!1}},{key:"isLastTextChild",value:function(e,t){for(var n=e.childNodes,a=n.length-1;a>-1;a--){var i=n[a];if(i.nodeType!==Node.COMMENT_NODE&&i.textContent)return i===t}return!1}},{key:"spacingNodeByXPath",value:function(e,t){if(t instanceof Node&&!(t instanceof DocumentFragment))for(var n,a,i=document.evaluate(e,t,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),o=i.snapshotLength-1;o>-1;--o){if(n=i.snapshotItem(o),this.isSpecificTag(n.parentNode,this.presentationalTags)&&!this.isInsideSpecificTag