代码拉取完成,页面将自动刷新
同步操作将从 gdh1995/Vimium C 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/// <reference no-default-lib="true"/>
/// <reference lib="es6" />
(function (): void {
type primitiveObject = boolean | number | string;
type primitive = primitiveObject | null | undefined;
type ObjectCoercible = primitiveObject | {
toString (): primitive;
} | {
valueOf (): primitive;
};
type anyNotSymbol = ObjectCoercible | null | undefined;
interface StandardString {
endsWith? (this: string, searchString: string, pos?: number | undefined): boolean;
endsWith? (this: ObjectCoercible, searchString?: anyNotSymbol, pos?: anyNotSymbol): boolean;
includes? (this: string, searchString: string, pos?: number | undefined): boolean;
includes? (this: ObjectCoercible, searchString?: anyNotSymbol, pos?: anyNotSymbol): boolean;
startsWith? (this: string, searchString: string, pos?: number | undefined): boolean;
startsWith? (this: ObjectCoercible, searchString?: anyNotSymbol, pos?: anyNotSymbol): boolean;
}
const symMatch = typeof Symbol === "function" && typeof Symbol.match === "symbol" &&
(Symbol.match as symbol | string as "Symbol(Symbol.match)"),
// eslint-disable-next-line id-denylist
StrCls = String as StringConstructor & { readonly prototype: StandardString }, TECls = TypeError,
StrProto = StrCls.prototype,
toStr = Object.prototype.toString;
"".startsWith || (
StrProto.startsWith = function startsWith(this: ObjectCoercible, searchString: anyNotSymbol): boolean {
const err = check(this, searchString), a = this != null && err !== 1 ? StrCls(this) : "";
if (err !== 0) {
if (err === 1 || err === 2) { return !((err < 2 ? this : searchString) + ""); }
throw new TECls(err.replace("${func}", "startsWith"));
}
let b = StrCls(searchString), args = arguments, c = args.length > 1 ? +args[1] : 0;
c = c > 0 ? c | 0 : 0;
c > a.length && (c = a.length);
return a.lastIndexOf(b, c) === c;
});
"".endsWith || (
StrProto.endsWith = function endsWith(this: ObjectCoercible, searchString: anyNotSymbol): boolean {
const err = check(this, searchString), a = this != null && err !== 1 ? StrCls(this) : "";
if (err !== 0) {
if (err === 1 || err === 2) { return !((err < 2 ? this : searchString) + ""); }
throw new TECls(err.replace("${func}", "endsWith"));
}
let b = StrCls(searchString), args = arguments, u: undefined, c: number
, p: primitive | object = args.length > 1 ? args[1] : u, l = a.length;
c = (p === u ? l : (c = +<number | string> p) > 0 ? c | 0 : 0) - b.length;
c > l && (c = l);
return c >= 0 && a.indexOf(b, c) === c;
});
"".includes || (
StrProto.includes = function includes(this: ObjectCoercible, searchString: anyNotSymbol): boolean {
const err = check(this, searchString), a = this != null && err !== 1 ? StrCls(this) : "";
if (err !== 0) {
if (err === 1 || err === 2) { return !((err < 2 ? this : searchString) + ""); }
throw new TECls(err.replace("${func}", "includes"));
}
let b = StrCls(searchString), args = arguments, c = args.length > 1 ? +args[1] : 0;
c = c > 0 ? c | 0 : 0;
c > a.length && (c = a.length);
// eslint-disable-next-line @typescript-eslint/prefer-includes
return a.indexOf(b, c) >= 0;
});
function check(a: primitive | object, b: primitive | object): 0 | string | 1 | 2 {
/** note: should never call `valueOf` or `toString` on a / b */
if (a == null) { return "String.prototype.${func} called on null or undefined"; }
if (!b) { return 0; }
let t: 0 | 1 | 2 = typeof a === "symbol" ? 1 : typeof b === "symbol" ? 2 : 0;
if (t) { return t; }
interface PossibleTypeOfB {
[key: string]: ((this: string, re: RegExp) => boolean) | primitive;
}
let f: PossibleTypeOfB[string], u: undefined
, i = symMatch && (f = (b as PossibleTypeOfB)[symMatch]) !== u ? f
: toStr.call(b) === "[object RegExp]";
return i ? "First argument to String.prototype.${func} must not be a regular expression" : 0;
}
})();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。