Add files via upload

This commit is contained in:
gaotianliuyun authored and GitHub committed 2022-10-09 18:41:57 +08:00
1 parent 5335efb9d7
commit 6118be68d8
6 files changed
+6499

No files matched your search

+1
View File
@@ -0,0 +1 @@
var e,t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n={xml:!1,decodeEntities:!0},r={_useHtmlParser2:!0,xmlMode:!0};function i(e){return(null==e?void 0:e.xml)?"boolean"==typeof e.xml?r:t(t({},r),e.xml):null!=e?e:void 0}!function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"}(e||(e={}));const s=e.Root,a=e.Text,o=e.Directive,c=e.Comment,l=e.Script,h=e.Style,u=e.Tag,p=e.CDATA,f=e.Doctype;class d{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return v(this,e)}}class E extends d{constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}}class m extends E{constructor(){super(...arguments),this.type=e.Text}get nodeType(){return 3}}class T extends E{constructor(){super(...arguments),this.type=e.Comment}get nodeType(){return 8}}class _ extends E{constructor(t,n){super(n),this.name=t,this.type=e.Directive}get nodeType(){return 1}}class A extends d{constructor(e){super(),this.children=e}get firstChild(){var e;return null!==(e=this.children[0])&&void 0!==e?e:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}}class g extends A{constructor(){super(...arguments),this.type=e.CDATA}get nodeType(){return 4}}class N extends A{constructor(){super(...arguments),this.type=e.Root}get nodeType(){return 9}}class C extends A{constructor(t,n,r=[],i=("script"===t?e.Script:"style"===t?e.Style:e.Tag)){super(r),this.name=t,this.attribs=n,this.type=i}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map((e=>{var t,n;return{name:e,value:this.attribs[e],namespace:null===(t=this["x-attribsNamespace"])||void 0===t?void 0:t[e],prefix:null===(n=this["x-attribsPrefix"])||void 0===n?void 0:n[e]}}))}}function I(t){return(n=t).type===e.Tag||n.type===e.Script||n.type===e.Style;var n}function S(t){return t.type===e.CDATA}function b(t){return t.type===e.Text}function O(t){return t.type===e.Comment}function y(t){return t.type===e.Directive}function L(t){return t.type===e.Root}function k(e){return Object.prototype.hasOwnProperty.call(e,"children")}function v(e,t=!1){let n;if(b(e))n=new m(e.data);else if(O(e))n=new T(e.data);else if(I(e)){const r=t?D(e.children):[],i=new C(e.name,{...e.attribs},r);r.forEach((e=>e.parent=i)),null!=e.namespace&&(i.namespace=e.namespace),e["x-attribsNamespace"]&&(i["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(i["x-attribsPrefix"]={...e["x-attribsPrefix"]}),n=i}else if(S(e)){const r=t?D(e.children):[],i=new g(r);r.forEach((e=>e.parent=i)),n=i}else if(L(e)){const r=t?D(e.children):[],i=new N(r);r.forEach((e=>e.parent=i)),e["x-mode"]&&(i["x-mode"]=e["x-mode"]),n=i}else{if(!y(e))throw new Error(`Not implemented yet: ${e.type}`);{const t=new _(e.name,e.data);null!=e["x-name"]&&(t["x-name"]=e["x-name"],t["x-publicId"]=e["x-publicId"],t["x-systemId"]=e["x-systemId"]),n=t}}return n.startIndex=e.startIndex,n.endIndex=e.endIndex,null!=e.sourceCodeLocation&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function D(e){const t=e.map((e=>v(e,!0)));for(let e=1;e<t.length;e++)t[e].prev=t[e-1],t[e-1].next=t[e];return t}const R={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};class M{constructor(e,t,n){this.dom=[],this.root=new N(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,"function"==typeof t&&(n=t,t=R),"object"==typeof e&&(t=e,e=void 0),this.callback=null!=e?e:null,this.options=null!=t?t:R,this.elementCB=null!=n?n:null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new N(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;const e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(t,n){const r=this.options.xmlMode?e.Tag:void 0,i=new C(t,n,void 0,r);this.addNode(i),this.tagStack.push(i)}ontext(t){const{lastNode:n}=this;if(n&&n.type===e.Text)n.data+=t,this.options.withEndIndices&&(n.endIndex=this.parser.endIndex);else{const e=new m(t);this.addNode(e),this.lastNode=e}}oncomment(t){if(this.lastNode&&this.lastNode.type===e.Comment)return void(this.lastNode.data+=t);const n=new T(t);this.addNode(n),this.lastNode=n}oncommentend(){this.lastNodLine truncated
+6191
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},v="en",D={};D[v]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return v;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(v=i),i||!r&&v},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t)}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return O},m.isValid=function(){return!(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var v=this.$locale().weekStart||0,D=(y<v?y+7:y)-v;return $(r?m-D:m+(6-D),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:Line truncated
+5
View File
@@ -0,0 +1,5 @@
// Underscore.js 1.13.4
// https://underscorejs.org
// (c) 2009-2022 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
var VERSION="1.13.4",root="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},ArrayProto=Array.prototype,ObjProto=Object.prototype,SymbolProto="undefined"!=typeof Symbol?Symbol.prototype:null,push=ArrayProto.push,slice=ArrayProto.slice,toString=ObjProto.toString,hasOwnProperty=ObjProto.hasOwnProperty,supportsArrayBuffer="undefined"!=typeof ArrayBuffer,supportsDataView="undefined"!=typeof DataView,nativeIsArray=Array.isArray,nativeKeys=Object.keys,nativeCreate=Object.create,nativeIsView=supportsArrayBuffer&&ArrayBuffer.isView,_isNaN=isNaN,_isFinite=isFinite,hasEnumBug=!{toString:null}.propertyIsEnumerable("toString"),nonEnumerableProps=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],MAX_ARRAY_INDEX=Math.pow(2,53)-1;function restArguments(e,t){return t=null==t?e.length-1:+t,function(){for(var n=Math.max(arguments.length-t,0),r=Array(n),i=0;i<n;i++)r[i]=arguments[i+t];switch(t){case 0:return e.call(this,r);case 1:return e.call(this,arguments[0],r);case 2:return e.call(this,arguments[0],arguments[1],r)}var a=Array(t+1);for(i=0;i<t;i++)a[i]=arguments[i];return a[t]=r,e.apply(this,a)}}function isObject(e){var t=typeof e;return"function"===t||"object"===t&&!!e}function isNull(e){return null===e}function isUndefined(e){return void 0===e}function isBoolean(e){return!0===e||!1===e||"[object Boolean]"===toString.call(e)}function isElement(e){return!(!e||1!==e.nodeType)}function tagTester(e){var t="[object "+e+"]";return function(e){return toString.call(e)===t}}var isString=tagTester("String"),isNumber=tagTester("Number"),isDate=tagTester("Date"),isRegExp=tagTester("RegExp"),isError=tagTester("Error"),isSymbol=tagTester("Symbol"),isArrayBuffer=tagTester("ArrayBuffer"),isFunction=tagTester("Function"),nodelist=root.document&&root.document.childNodes;"function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof nodelist&&(isFunction=function(e){return"function"==typeof e||!1});var isFunction$1=isFunction,hasObjectTag=tagTester("Object"),hasStringTagBug=supportsDataView&&hasObjectTag(new DataView(new ArrayBuffer(8))),isIE11="undefined"!=typeof Map&&hasObjectTag(new Map),isDataView=tagTester("DataView");function ie10IsDataView(e){return null!=e&&isFunction$1(e.getInt8)&&isArrayBuffer(e.buffer)}var isDataView$1=hasStringTagBug?ie10IsDataView:isDataView,isArray=nativeIsArray||tagTester("Array");function has$1(e,t){return null!=e&&hasOwnProperty.call(e,t)}var isArguments=tagTester("Arguments");!function(){isArguments(arguments)||(isArguments=function(e){return has$1(e,"callee")})}();var isArguments$1=isArguments;function isFinite$1(e){return!isSymbol(e)&&_isFinite(e)&&!isNaN(parseFloat(e))}function isNaN$1(e){return isNumber(e)&&_isNaN(e)}function constant(e){return function(){return e}}function createSizePropertyCheck(e){return function(t){var n=e(t);return"number"==typeof n&&n>=0&&n<=MAX_ARRAY_INDEX}}function shallowProperty(e){return function(t){return null==t?void 0:t[e]}}var getByteLength=shallowProperty("byteLength"),isBufferLike=createSizePropertyCheck(getByteLength),typedArrayPattern=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function isTypedArray(e){return nativeIsView?nativeIsView(e)&&!isDataView$1(e):isBufferLike(e)&&typedArrayPattern.test(toString.call(e))}var isTypedArray$1=supportsArrayBuffer?isTypedArray:constant(!1),getLength=shallowProperty("length");function emulatedSet(e){for(var t={},n=e.length,r=0;r<n;++r)t[e[r]]=!0;return{contains:function(e){return!0===t[e]},push:function(n){return t[n]=!0,e.push(n)}}}function collectNonEnumProps(e,t){t=emulatedSet(t);var n=nonEnumerableProps.length,r=e.constructor,i=isFunction$1(r)&&r.prototype||ObjProto,a="constructor";for(has$1(e,a)&&!t.contains(a)&&t.push(a);n--;)(a=nonEnumerableProps[n])in e&&e[a]!==i[a]&&!t.contains(a)&&t.push(a)}function keys(e){if(!isObject(e))return[];if(nativeKeys)return nativeKeys(e);var t=[];for(var n in e)has$1(e,n)&&t.push(n);return hasEnumBug&&collectNonEnumProps(e,t),t}function isEmpty(e){if(null==e)return!0;var t=getLength(e);return"number"==typeof t&&(isArray(e)||isString(e)||isArguments$1(e))?0===t:0===getLength(keys(e))}function isMatch(e,t){var n=keys(t),r=n.length;if(null==e)return!r;for(var i=Object(e),a=0;a<r;a++){var u=n[a];if(t[u]!==i[u]||!(u in i))return!1}return!0}function _$1(e){return e instanceof _$1?e:this instanceof _$1?void(this._wrapped=e):new _$1(e)}function toBufferView(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,getByteLength(e))}_$1.VERSION=VERSION,_$1.prototype.value=function(){return this._wrapped},_$1.prototype.valueOf=_$1.prototype.toJSON=_$1.prototype.value,_$1.prototype.toString=function(){return String(this._wrapped)};var tagDataView="[object DataView]";function eq(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var i=typeof e;return("function"===i||"object"===i||"object"==typeof t)&&deeLine truncated
+1
View File
@@ -0,0 +1 @@
(function(global){var re={starts_with_slashes:/^\/+/,ends_with_slashes:/\/+$/,pluses:/\+/g,query_separator:/[&;]/,uri_parser:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*)(?::([^:@]*))?)?@)?(\[[0-9a-fA-F:.]+\]|[^:\/?#]*)(?::(\d+|(?=:)))?(:)?)((((?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/};if(!Array.prototype.forEach){Array.prototype.forEach=function(callback,thisArg){var T,k;if(this==null){throw new TypeError(' this is null or not defined');}var O=Object(this);var len=O.length>>>0;if(typeof callback!=="function"){throw new TypeError(callback+' is not a function');}if(arguments.length>1){T=thisArg}k=0;while(k<len){var kValue;if(k in O){kValue=O[k];callback.call(T,kValue,k,O)}k++}}}function decode(s){if(s){s=s.toString().replace(re.pluses,'%20');s=decodeURIComponent(s)}return s}function parseUri(str){var parser=re.uri_parser;var parserKeys=["source","protocol","authority","userInfo","user","password","host","port","isColonUri","relative","path","directory","file","query","anchor"];var m=parser.exec(str||'');var parts={};parserKeys.forEach(function(key,i){parts[key]=m[i]||''});return parts}function parseQuery(str){var i,ps,p,n,k,v,l;var pairs=[];if(typeof(str)==='undefined'||str===null||str===''){return pairs}if(str.indexOf('?')===0){str=str.substring(1)}ps=str.toString().split(re.query_separator);for(i=0,l=ps.length;i<l;i++){p=ps[i];n=p.indexOf('=');if(n!==0){k=decode(p.substring(0,n));v=decode(p.substring(n+1));pairs.push(n===-1?[p,null]:[k,v])}}return pairs}function Uri(str){this.uriParts=parseUri(str);this.queryPairs=parseQuery(this.uriParts.query);this.hasAuthorityPrefixUserPref=null}['protocol','userInfo','host','port','path','anchor'].forEach(function(key){Uri.prototype[key]=function(val){if(typeof val!=='undefined'){this.uriParts[key]=val}return this.uriParts[key]}});Uri.prototype.hasAuthorityPrefix=function(val){if(typeof val!=='undefined'){this.hasAuthorityPrefixUserPref=val}if(this.hasAuthorityPrefixUserPref===null){return(this.uriParts.source.indexOf('//')!==-1)}else{return this.hasAuthorityPrefixUserPref}};Uri.prototype.isColonUri=function(val){if(typeof val!=='undefined'){this.uriParts.isColonUri=!!val}else{return!!this.uriParts.isColonUri}};Uri.prototype.query=function(val){var s='',i,param,l;if(typeof val!=='undefined'){this.queryPairs=parseQuery(val)}for(i=0,l=this.queryPairs.length;i<l;i++){param=this.queryPairs[i];if(s.length>0){s+='&'}if(param[1]===null){s+=param[0]}else{s+=param[0];s+='=';if(typeof param[1]!=='undefined'){s+=encodeURIComponent(param[1])}}}return s.length>0?'?'+s:s};Uri.prototype.getQueryParamValue=function(key){var param,i,l;for(i=0,l=this.queryPairs.length;i<l;i++){param=this.queryPairs[i];if(key===param[0]){return param[1]}}};Uri.prototype.getQueryParamValues=function(key){var arr=[],i,param,l;for(i=0,l=this.queryPairs.length;i<l;i++){param=this.queryPairs[i];if(key===param[0]){arr.push(param[1])}}return arr};Uri.prototype.deleteQueryParam=function(key,val){var arr=[],i,param,keyMatchesFilter,valMatchesFilter,l;for(i=0,l=this.queryPairs.length;i<l;i++){param=this.queryPairs[i];keyMatchesFilter=decode(param[0])===decode(key);valMatchesFilter=param[1]===val;if((arguments.length===1&&!keyMatchesFilter)||(arguments.length===2&&(!keyMatchesFilter||!valMatchesFilter))){arr.push(param)}}this.queryPairs=arr;return this};Uri.prototype.addQueryParam=function(key,val,index){if(arguments.length===3&&index!==-1){index=Math.min(index,this.queryPairs.length);this.queryPairs.splice(index,0,[key,val])}else if(arguments.length>0){this.queryPairs.push([key,val])}return this};Uri.prototype.hasQueryParam=function(key){var i,len=this.queryPairs.length;for(i=0;i<len;i++){if(this.queryPairs[i][0]==key)return true}return false};Uri.prototype.replaceQueryParam=function(key,newVal,oldVal){var index=-1,len=this.queryPairs.length,i,param;if(arguments.length===3){for(i=0;i<len;i++){param=this.queryPairs[i];if(decode(param[0])===decode(key)&&decodeURIComponent(param[1])===decode(oldVal)){index=i;break}}if(index>=0){this.deleteQueryParam(key,decode(oldVal)).addQueryParam(key,newVal,index)}}else{for(i=0;i<len;i++){param=this.queryPairs[i];if(decode(param[0])===decode(key)){index=i;break}}this.deleteQueryParam(key);this.addQueryParam(key,newVal,index)}return this};['protocol','hasAuthorityPrefix','isColonUri','userInfo','host','port','path','query','anchor'].forEach(function(key){var method='set'+key.charAt(0).toUpperCase()+key.slice(1);Uri.prototype[method]=function(val){this[key](val);return this}});Uri.prototype.scheme=function(){var s='';if(this.protocol()){s+=this.protocol();if(this.protocol().indexOf(':')!==this.protocol().length-1){s+=':'}s+='//'}else{if(this.hasAuthorityPrefix()&&this.host()){s+='//'}}return s};Uri.prototype.origin=function(){var s=this.scheme();if(this.userInfo()&&this.host()){s+=this.userInfo();if(this.userInfo().indexOf('@')!==this.userInfo().length-1){s+='@'}}if(this.host()){s+=this.host();if(this.port()||(this.pathLine truncated
+300
View File
@@ -0,0 +1,300 @@
import './uri.min.js'
import cheerio from './cheerio.min.js';
import './crypto-js.js'
import './dayjs.min.js'
import _ from './underscore-esm-min.js'
var charStr = 'abacdefghjklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789';
export function randIndex(min, max, i) {
let index = Math.floor(Math.random() * (max - min + 1) + min),
numStart = charStr.length - 10;
if (i == 0 && index >= numStart) {
index = randIndex(min, max, i);
}
return index;
}
export function randomStr(len) {
let min = 0, max = charStr.length - 1, _str = '';
len = len || 15;
for (var i = 0, index; i < len; i++) {
index = randIndex(min, max, i);
_str += charStr[index];
}
return _str;
}
if (typeof Object.assign != 'function') {
Object.assign = function () {
var target = arguments[0];
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
}
if (!String.prototype.includes) {
String.prototype.includes = function (search, start) {
if (typeof start !== 'number') {
start = 0;
}
if (start + search.length > this.length) {
return false;
} else {
return this.indexOf(search, start) !== -1;
}
};
}
if (!Array.prototype.includes) {
Object.defineProperty(Array.prototype, 'includes', {
value: function (searchElement, fromIndex) {
if (this == null) {//this是空或者未定义,抛出错误
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);//将this转变成对象
var len = o.length >>> 0;//无符号右移0位,获取对象length属性,如果未定义就会变成0
if (len === 0) {//length为0直接返回false未找到目标值
return false;
}
var n = fromIndex | 0;//查找起始索引
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);//计算正确起始索引,因为有可能是负值
while (k < len) {//从起始索引处开始循环
if (o[k] === searchElement) {//如果某一位置与寻找目标相等,返回true,找到了
return true;
}
k++;
}
return false;//未找到,返回false
}
});
}
if (typeof String.prototype.startsWith != 'function') {
String.prototype.startsWith = function (prefix) {
return this.slice(0, prefix.length) === prefix;
};
}
if (typeof String.prototype.endsWith != 'function') {
String.prototype.endsWith = function (suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
}
Object.prototype.myValues = function (obj) {
if (obj == null) {
throw new TypeError("Cannot convert undefined or null to object");
}
var res = []
for (var k in obj) {
if (obj.hasOwnProperty(k)) {//需判断是否是本身的属性
res.push(obj[k]);
}
}
return res;
}
if (typeof Object.prototype.values != 'function') {
Object.prototype.values = function (obj) {
if (obj == null) {
throw new TypeError("Cannot convert undefined or null to object");
}
var res = []
for (var k in obj) {
if (obj.hasOwnProperty(k)) {//需判断是否是本身的属性
res.push(obj[k]);
}
}
return res;
}
}
if (typeof Array.prototype.join != 'function') {
Array.prototype.join = function (emoji) {
// emoji = emoji||',';
emoji = emoji || '';
let self = this;
let str = "";
let i = 0;
if (!Array.isArray(self)) { throw String(self) + 'is not Array' }
if (self.length === 0) { return '' }
if (self.length === 1) { return String(self[0]) }
i = 1;
str = this[0];
for (; i < self.length; i++) {
str += String(emoji) + String(self[i]);
}
return str;
};
}
String.prototype.rstrip = function (chars) {
let regex = new RegExp(chars + "$");
return this.replace(regex, "");
};
Array.prototype.append = Array.prototype.push;
String.prototype.strip = String.prototype.trim;
export function 是否正版(vipUrl) {
let flag = new RegExp('qq\.com|iqiyi\.com|youku\.com|mgtv\.com|bilibili\.com|sohu\.com|ixigua\.com|pptv\.com|miguvideo\.com|le\.com|1905\.com|fun\.tv');
return flag.test(vipUrl);
}
export function urlDeal(vipUrl) {
if (!vipUrl) {
return ''
}
if (!是否正版(vipUrl)) {
return vipUrl
}
if (!/miguvideo/.test(vipUrl)) {
vipUrl = vipUrl.split('#')[0].split('?')[0];
}
return vipUrl
}
export function urlencode(str) {
str = (str + '').toString();
return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').
replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
}
export function base64Encode(text) {
return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(text));
}
export function base64Decode(text) {
return CryptoJS.enc.Utf8.stringify(CryptoJS.enc.Base64.parse(text));
}
export function urljoin(base, url) {
base = base || '';
url = url || '';
let baseU = new Uri(base.trim().rstrip('/'));
url = url.trim().rstrip('/');
let u = undefined;
if (url.startsWith('http://') || url.startsWith('https://')) {
u = new Uri(url);
} else if (url.startsWith('://')) {
u = new Uri(baseU.protocol() + url);
} else if (url.startsWith('//')) {
u = new Uri(baseU.protocol() + ':' + url);
} else {
u = new Uri(baseU.protocol() + '://' + baseU.host() + (baseU.port() ? ':' + baseU.port() : '') + '/' + url);
}
if ((!u.path() || u.path().trim().length === 0) && baseU.path())
u.path(baseU.path());
if (!u.query() && baseU.query())
u.query(baseU.query());
return u.toString();
}
export function md5(src) {
return CryptoJS.MD5(src).toString();
}
const DOM_CHECK_ATTR = /(url|src|href|data-original|data-src)$/;
const SELECT_REGEX = /:eq|:lt|:gt|#/g;
const SELECT_REGEX_A = /:eq|:lt|:gt/g;
export function pdfh(html, parse, base_url) {
if (!parse || !parse.trim()) {
return ''
}
let eleFind = typeof html === 'object';
let option = undefined;
if (eleFind && parse.startsWith('body&&')) {
parse = parse.substr(6);
if (parse.indexOf('&&') < 0) {
option = parse.trim();
parse = '*=*';
}
}
if (parse.indexOf('&&') > -1) {
let sp = parse.split('&&');
option = sp[sp.length - 1];
sp.splice(sp.length - 1);
if (sp.length > 1) {
for (let i in sp) {
if (!SELECT_REGEX.test(sp[i])) {
sp[i] = sp[i] + ':eq(0)';
}
}
} else {
if (!SELECT_REGEX.test(sp[0])) {
sp[0] = sp[0] + ':eq(0)';
}
}
parse = sp.join(' ');
}
let result = '';
const $ = eleFind ? html.rr : cheerio.load(html);
let ret = eleFind ? (parse === '*=*' ? html.ele : $(html.ele).find(parse)) : $(parse);
if (option) {
if (option === 'Text') {
result = $(ret).text();
}
else if (option === 'Html') {
result = $(ret).html();
}
else {
result = $(ret).attr(option);
}
if (result && base_url && DOM_CHECK_ATTR.test(option)) {
if (/http/.test(result)) {
result = result.substr(result.indexOf('http'));
} else {
result = urljoin(base_url, result)
}
}
} else {
result = $(ret).toString();
}
return result;
}
export function pdfa(html, parse) {
if (!parse || !parse.trim()) {
return [];
}
let eleFind = typeof html === 'object';
if (parse.indexOf('&&') > -1) {
let sp = parse.split('&&');
for (let i in sp) {
if (!SELECT_REGEX_A.test(sp[i]) && i < sp.length - 1) {
sp[i] = sp[i] + ':eq(0)';
}
}
parse = sp.join(' ');
}
const $ = eleFind ? html.rr : cheerio.load(html);
let ret = eleFind ? $(html.ele).find(parse) : $(parse);
let result = [];
if (ret) {
ret.each(function (idx, ele) {
result.push({ rr: $, ele: ele });
});
}
return result;
}
globalThis.randIndex = randIndex;
globalThis.randomStr = randomStr;
globalThis.urljoin = urljoin;
globalThis.joinUrl = urljoin;
globalThis.urljoin2 = urljoin;
globalThis.是否正版 = 是否正版;
globalThis.urlDeal = urlDeal;
globalThis.urlencode = urlencode;
globalThis.encodeUrl = urlencode;
globalThis.base64Encode = base64Encode;
globalThis.base64Decode = base64Decode;
globalThis.pdfa = pdfa;
globalThis.pdfh = pdfh;
globalThis.md5 = md5;