peji-inspektor-crx/literyz-js/extensions.dist.js
2024-11-10 00:24:12 +00:00

6 lines
10 KiB
JavaScript

/*!
* Part of LiteRyzJS v0.1.0.424
* Copyright 2023-2024 Ray Lam (https://www.hiimray.co.uk)
*
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.LiteRyzJS=e():t.LiteRyzJS=e()}(this,(()=>(()=>{var t={814:()=>{Array.isEmpty=function(t){return"array"!=Object.getDataType(t)||t.length<=0},Array.toFlatten=function(t,e,r){for(let n=0;n<t.length;n++)r.push(t[n]),null!=typeof t[n][e]&&t[n][e].length>0&&Array.toFlatten(t[n][e],e,r)},Array.prototype.addRange=function(t){return null==t||t.forEach((t=>{this.push(t)})),this},Array.prototype.all=function(t,e){for(let r=0;r<this.length;r++)if(null==t){if(this[r]!=e)return!1}else if(void 0!==this[r][t]&&this[r][t]!=e)return!1;return!0},Array.prototype.any=function(t,e){for(let r=0;r<this.length;r++)if(null==t){if(this[r]==e)return!0}else if(void 0!==this[r][t]&&this[r][t]==e)return!0;return!1},Array.prototype.copy=function(){return JSON.parse(JSON.stringify(this))},Array.prototype.count=function(t,e){let r=0;for(let n=0;n<this.length;n++)null==t?this[n]==e&&r++:void 0!==this[n][t]&&this[n][t]==e&&r++;return r},Array.prototype.countMany=function(...t){let e=0;return t.forEach((t=>{e+=this.count(t.propName,t.value)})),e},Array.prototype.create=function(t,e){let r=[];for(let n=0;n<t;n++)r.push(e);return r},Array.prototype.distinct=function(){return this.filter(((t,e,r)=>e===r.findIndex((e=>JSON.stringify(e)===JSON.stringify(t)))))},Array.prototype.flatten=function(t){let e=[];return Array.toFlatten(this,t,e),e},Array.prototype.get=function(t){return t<0||t>=this.length?"":this[t]},Array.prototype.index=function(t,e){const r=this.indexes(t,e);return r.length<=0?null:r[0]},Array.prototype.indexes=function(t,e){let r=[];for(let n=0;n<this.length;n++)null==t?this[n]==e&&r.push(n):void 0!==this[n][t]&&this[n][t]==e&&r.push(n);return r},Array.prototype.insert=function(t,e){return t<0?this.splice(0,0,e):t>=this.length?this.push(e):this.splice(t,0,e),this},Array.prototype.joinIfNotNullOrWhitespace=function(t){let e="";for(let r=0;r<this.length;r++)String.isNullOrWhitespace(this[r])||(String.isNullOrWhitespace(e)||(e+=t),e+=this[r]);return e},Array.prototype.first=function(t,e){for(let r=0;r<this.length;r++)if(void 0!==this[r][t]&&this[r][t]==e)return this[r];return null},Array.prototype.forEachTree=function(t,e){for(let r=0;r<this.length;r++){if(!1===e(this[r]))return;if(!(this[r][t].length<=0)&&!1===this[r][t].forEachTree(t,e))return}},Array.prototype.orderBy=function(t){return this.sort((function(e,r){return e[t]<r[t]?-1:e[t]>r[t]?1:0})),this},Array.prototype.orderByDesc=function(t){return this.sort((function(e,r){return e[t]<r[t]?1:e[t]>r[t]?-1:0})),this},Array.prototype.remove=function(t){let e=[];for(let r=0;r<this.length;r++)this[r]==t&&e.push(r);for(let t=e.length-1;t>=0;t--)this.removeAt(e[t]);return this},Array.prototype.removeAt=function(t){return t<0||t>=this.length||this.splice(t,1),this},Array.prototype.removeRange=function(t){for(let e=0;e<t.length;e++)this.remove(t[e]);return this},Array.prototype.notSelect=function(t,e){let r=[];for(let n=0;n<this.length;n++)void 0!==this[n][t]&&this[n][t]!=e&&r.push(this[n]);return r},Array.prototype.select=function(t,e){let r=[];for(let n=0;n<this.length;n++)void 0!==this[n][t]&&this[n][t]==e&&r.push(this[n]);return r},Array.prototype.selectMany=function(...t){let e=this;return t.forEach((t=>{e=e.select(t.propName,t.value)})),e},Array.prototype.toList=function(t){let e=[];return this.forEach((r=>{null!=typeof r[t]&&e.push(r[t])})),e},Array.prototype.sortTree=function(t,e){this.orderBy(e);for(let r=0;r<this.length;r++)this[r][t].length<=0||this[r][t].orderBy(e)}},523:()=>{Boolean.isFalse=function(t){return!!String.isNullOrUndefined(t)||t.toString().containsCI("false","f","y","0","x")},Boolean.isTrue=function(t){return!String.isNullOrUndefined(t)&&t.toString().containsCI("true","t","n","1","o")},Boolean.ifTrue=function(t,e,r){return Boolean.isTrue(t)?e:r}},579:()=>{Date.addDays=function(t,e){let r=new Date(t);return r.addDays(e),r},Date.addMonths=function(t,e){let r=new Date(t);return r.addMonths(e),r},Date.addYears=function(t,e){let r=new Date(t);return r.addYears(e),r},Date.max=function(t,e){return null==t?e:null==e?t:new Date(t)<=new Date(e)?new Date(e):new Date(t)},Date.min=function(t,e){return null==t?e:null==e?t:new Date(t)<=new Date(e)?new Date(t):new Date(e)},Date.diffDays=function(t,e){return Math.ceil((new Date(e).getTime()-new Date(t).getTime())/864e5)},Date.today=function(){let t=new Date;return t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t},Date.prototype.addDays=function(t){this.setDate(this.getDate()+parseInt(t))},Date.prototype.addMonths=function(t){this.setMonth(this.getMonth()+parseInt(t))},Date.prototype.addYears=function(t){this.setFullYear(this.getFullYear()+parseInt(t))},Date.prototype.toCString=function(t){let e=t;return e=e.replace("fffffff",this.getMilliseconds().toString().padStart(7,"0")),e=e.replace("ffffff",this.getMilliseconds().toString().padStart(6,"0")),e=e.replace("fffff",this.getMilliseconds().toString().padStart(5,"0")),e=e.replace("yyyy",this.getFullYear().toString().padStart(4,"0")),e=e.replace("MMMM","{1}"),e=e.replace("dddd","{2}"),e=e.replace("ffff",this.getMilliseconds().toString().padStart(4,"0")),e=e.replace("yyy",this.getFullYear().toString().padStart(3,"0")),e=e.replace("MMM","{3}"),e=e.replace("ddd","{4}"),e=e.replace("fff",this.getMilliseconds().toString().padStart(3,"0")),e=e.replace("zzz",""),e=e.replace("yy",this.getFullYear().toString().slice(-2)),e=e.replace("MM",(this.getMonth()+1).toString().padStart(2,"0")),e=e.replace("dd",this.getDate().toString().padStart(2,"0")),e=e.replace("HH",this.getHours().toString().padStart(2,"0")),e=e.replace("hh",(this.getHours()>12?this.getHours()-12:this.getHours()).toString().padStart(2,"0")),e=e.replace("mm",this.getMinutes().toString().padStart(2,"0")),e=e.replace("ss",this.getSeconds().toString().padStart(2,"0")),e=e.replace("ff",this.getMilliseconds().toString().padStart(2,"0")),e=e.replace("tt","{5}"),e=e.replace("zz",""),e=e.replace("y",this.getFullYear().toString()),e=e.replace("M",(this.getMonth()+1).toString()),e=e.replace("d",this.getDate().toString()),e=e.replace("H",this.getHours().toString()),e=e.replace("h",(this.getHours()>12?this.getHours()-12:this.getHours()).toString()),e=e.replace("m",this.getMinutes().toString()),e=e.replace("s",this.getSeconds().toString()),e=e.replace("z",""),e=e.replace("t","{6}"),e=e.replace("Z",""),e=e.replace("{1}",this.toLocaleString("default",{month:"long"})),e=e.replace("{2}",this.toLocaleString("default",{weekday:"long"})),e=e.replace("{3}",this.toLocaleString("default",{month:"short"})),e=e.replace("{4}",this.toLocaleString("default",{weekday:"short"})),e=e.replace("{5}",this.getHours()>=12?"PM":"AM"),e=e.replace("{6}",this.getHours()>=12?"P":"A"),e}},874:()=>{Document.ready=async function(t){!async function(){"loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",(function(){t()}))}()},Document.getWidth=function(t){return null==t||void 0===t?0:t.offsetWidth||t.innerWidth||t.clientWidth},Document.getHeight=function(t){return null==t||void 0===t?0:t.offsetHeight||t.innerHeight||t.clientHeight},Document.appendHtml=function(t,e){const r=document.createElement(e);t.appendChild(r)},Document.addClass=function(t,e){t.classList.contains(e)||t.classList.add(e)},Document.removeClass=function(t,e){t.classList.contains(e)&&t.classList.remove(e)}},705:()=>{Math.randomN=function(t,e){return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t)+t)},Math.average=function(t){let e=0;return t.forEach((t=>{e+=parseFloat(t)})),e/t.length},Math.avg=function(...t){let e=0;return t.forEach((t=>{e+=parseFloat(t)})),e/t.length},Math.half=function(t){return t/2}},428:()=>{Object.isNullOrUndefined=function(t){return void 0===t||null==t},Object.getDataType=function(t){return String.isNullOrUndefined(t)?"null":"object"==typeof t?Array.isArray(t)?"array":"object":typeof t}},930:()=>{String.isNullOrUndefined=function(t){return void 0===t||null==t},String.isNullOrWhitespace=function(t){return!!String.isNullOrUndefined(t)||("string"==typeof t?t.trim().length<=0:t.toString().trim().length<=0)},String.joinIfNotNullOrWhitespace=function(t,...e){let r="";for(let n=0;n<e.length;n++)String.isNullOrWhitespace(e[n])||(String.isNullOrWhitespace(r)||(r+=t),r+=e[n]);return r},String.prototype.contains=function(...t){for(let e of t)if(this==e)return!0;return!1},String.prototype.containsCI=function(...t){for(let e of t)if(this.toLowerCase()==e.toLowerCase())return!0;return!1},String.prototype.encodeHtmlLinks=function(){return value.replace(/(http[s]{0,1}:\/\/[^\s]+)/g,"<a href='$1'>$1</a>")},String.prototype.toTitleCase=function(){let t=this;return t=t.replace(/([A-Z]{1})/g," $1"),t=t.trim(),t=t.charAt(0).toUpperCase()+t.substr(1),t},String.prototype.getFilename=function(){return this.substring(this.lastIndexOf("/")+1)}},323:()=>{Window.goToTop=function(){Window.scrollTo(0,0)},Window.fragment={get:function(){if(!window.location.hash)return null;const t=window.location.hash.indexOf("?");return t<0?window.location.hash.substring(1):window.location.hash.substring(1,t)},getQuery:function(){if(!window.location.hash)return null;let t=window.location.hash;const e=t.indexOf("?");if(e<0)return null;t=hasQueryString.substring(e+1);const r=new URLSearchParams(t),n={};for(const[t,e]of r.entries())n[t]=e;return n},clear:function(){location.hash="",history.replaceState("","",location.pathname)}}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r(814),r(523),r(579),r(874),r(705),r(428),r(930),r(323)})(),n})()));