better build setup
This commit is contained in:
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@@ -0,0 +1 @@
|
||||
dist/*
|
||||
109
dist/optifine-download-links.user.js
vendored
109
dist/optifine-download-links.user.js
vendored
@@ -1,66 +1,63 @@
|
||||
"use strict";
|
||||
// ==UserScript==
|
||||
// @name OptiFine Download Links
|
||||
// @namespace zomo.dev
|
||||
// @match https://optifine.net/*
|
||||
// @grant none
|
||||
// @version 1.0
|
||||
// @author zomo
|
||||
// @description automatically grab optifine links through the ads
|
||||
// @downloadURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/optifine-download-links.zomo.js
|
||||
// @updateURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/optifine-download-links.zomo.js
|
||||
// @name OptiFine Download Links
|
||||
// @namespace zomo.dev
|
||||
// @match https://optifine.net/*
|
||||
// @version 1.0
|
||||
// @description automatically grab optifine links through the ads
|
||||
// @downloadURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/optifine-download-links.zomo.js
|
||||
// @supportURL https://git.zomo.dev/zomo/browser-scripts/
|
||||
// @homepageURL https://git.zomo.dev/zomo/browser-scripts/
|
||||
// ==/UserScript==
|
||||
const onhover = false; // when to load link, false will load immediately
|
||||
// scripts/optifine-download-links/main.ts
|
||||
var onhover = false;
|
||||
async function getDownload(href) {
|
||||
let resp = await fetch(href);
|
||||
let text = await resp.text();
|
||||
let match = text.match(/<a href=['"](downloadx.*?)['"]/i);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
return null;
|
||||
let resp = await fetch(href);
|
||||
let text = await resp.text();
|
||||
let match = text.match(/<a href=['"](downloadx.*?)['"]/i);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function attachFetchDownloadLink(a, depth = 0) {
|
||||
function run() {
|
||||
a.innerText = 'Loading';
|
||||
let url = new URL(a.href);
|
||||
if (url.pathname === '/adloadx') {
|
||||
getDownload(a.href).then(downloadUrl => {
|
||||
if (downloadUrl) {
|
||||
a.href = downloadUrl;
|
||||
a.innerText = 'Download';
|
||||
}
|
||||
else {
|
||||
a.innerText = 'Failed';
|
||||
if (onhover)
|
||||
attachFetchDownloadLink(a, ++depth);
|
||||
else
|
||||
setTimeout(() => attachFetchDownloadLink(a, ++depth), 1000);
|
||||
}
|
||||
});
|
||||
function run() {
|
||||
a.innerText = "Loading";
|
||||
let url = new URL(a.href);
|
||||
if (url.pathname === "/adloadx") {
|
||||
getDownload(a.href).then((downloadUrl) => {
|
||||
if (downloadUrl) {
|
||||
a.href = downloadUrl;
|
||||
a.innerText = "Download";
|
||||
} else {
|
||||
a.innerText = "Failed";
|
||||
if (onhover)
|
||||
attachFetchDownloadLink(a, ++depth);
|
||||
else
|
||||
setTimeout(() => attachFetchDownloadLink(a, ++depth), 1e3);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (depth > 5)
|
||||
return;
|
||||
if (onhover) {
|
||||
a.addEventListener('mouseover', run, { once: true });
|
||||
}
|
||||
else {
|
||||
run();
|
||||
}
|
||||
}
|
||||
if (depth > 5)
|
||||
return;
|
||||
if (onhover) {
|
||||
a.addEventListener("mouseover", run, { once: true });
|
||||
} else {
|
||||
run();
|
||||
}
|
||||
}
|
||||
addEventListener('load', () => {
|
||||
document.querySelectorAll('a').forEach(a => {
|
||||
let href = new URL(a.href);
|
||||
if (href.hostname === 'adfoc.us') {
|
||||
let params = href.searchParams;
|
||||
if (params.has('url')) {
|
||||
let url = params.get('url')?.replace('http://', 'https://');
|
||||
if (url) {
|
||||
a.href = url;
|
||||
attachFetchDownloadLink(a);
|
||||
}
|
||||
}
|
||||
addEventListener("load", () => {
|
||||
document.querySelectorAll("a").forEach((a) => {
|
||||
let href = new URL(a.href);
|
||||
if (href.hostname === "adfoc.us") {
|
||||
let params = href.searchParams;
|
||||
if (params.has("url")) {
|
||||
let url = params.get("url")?.replace("http://", "https://");
|
||||
if (url) {
|
||||
a.href = url;
|
||||
attachFetchDownloadLink(a);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
152
esbuild.mjs
Normal file
152
esbuild.mjs
Normal file
@@ -0,0 +1,152 @@
|
||||
import { build } from 'esbuild'
|
||||
// import commandLineArgs from 'command-line-args';
|
||||
|
||||
// const args = commandLineArgs([
|
||||
// { name: 'watch', alias: 'w', type: Boolean },
|
||||
// { name: 'bundle', alias: 'b', type: Boolean },
|
||||
// { name: 'minify', alias: 'm', type: Boolean },
|
||||
// { name: 'sourcemap', alias: 's', type: Boolean }
|
||||
// ]);
|
||||
|
||||
//build TS
|
||||
// build({
|
||||
// entryPoints: ['src/main.ts'],
|
||||
// outdir: 'dist',
|
||||
|
||||
// target: 'es2020',
|
||||
// platform: 'node',
|
||||
// format: 'cjs',
|
||||
|
||||
// watch: args.watch,
|
||||
// bundle: args.bundle,
|
||||
// minify: args.minify,
|
||||
// sourcemap: args.sourcemap
|
||||
// });
|
||||
|
||||
import {
|
||||
lstatSync,
|
||||
readdirSync,
|
||||
readFileSync,
|
||||
unlinkSync,
|
||||
writeFileSync,
|
||||
} from 'fs'
|
||||
|
||||
const BaseUrl = `https://git.zomo.dev/zomo/browser-scripts/`
|
||||
const FileUrl = name =>
|
||||
`https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/${name}.zomo.js`
|
||||
|
||||
function ValueNotEmpty(val) {
|
||||
return (
|
||||
val !== '' &&
|
||||
val !== false &&
|
||||
val !== [] &&
|
||||
val !== undefined &&
|
||||
val !== null
|
||||
)
|
||||
}
|
||||
function padr(str, len) {
|
||||
return str + ' '.repeat(len - str.length)
|
||||
}
|
||||
|
||||
function MetadataArgs(name) {
|
||||
var meta = {
|
||||
name: name,
|
||||
namespace: 'zomo.dev',
|
||||
match: '',
|
||||
excludematch: '',
|
||||
version: '0.0.0',
|
||||
description: '',
|
||||
icon: '',
|
||||
require: '',
|
||||
resource: '',
|
||||
runat: '',
|
||||
noframes: false,
|
||||
grant: '',
|
||||
injectinto: '',
|
||||
downloadURL: FileUrl(name),
|
||||
supportURL: BaseUrl,
|
||||
homepageURL: BaseUrl,
|
||||
unwrap: false,
|
||||
}
|
||||
|
||||
try {
|
||||
let args = JSON.parse(
|
||||
readFileSync(`scripts/${name}/meta.json`).toString()
|
||||
)
|
||||
for (let key in meta) {
|
||||
if (ValueNotEmpty(args[key])) {
|
||||
meta[key] = args[key]
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
console.log(
|
||||
`scripts/${name}/meta.json not found, using default metadata`
|
||||
)
|
||||
}
|
||||
|
||||
const keyConversion = {
|
||||
injectinto: 'inject-into',
|
||||
excludematch: 'exclude-match',
|
||||
}
|
||||
|
||||
return `// ==UserScript==
|
||||
${Object.keys(meta)
|
||||
.filter(key => ValueNotEmpty(meta[key]))
|
||||
.map(key => {
|
||||
let val = meta[key],
|
||||
key_str = padr(key in keyConversion ? keyConversion[key] : key, 12)
|
||||
if (typeof val === 'boolean') {
|
||||
if (val) return `// @${key_str}`
|
||||
} else if (typeof val === 'string') {
|
||||
return `// @${key_str} ${val}`
|
||||
} else if (Array.isArray(val)) {
|
||||
return val.map(v => `// @${key_str} ${v}`).join('\n')
|
||||
}
|
||||
return ''
|
||||
})
|
||||
.filter(l => l.length)
|
||||
.join('\n')}
|
||||
// ==/UserScript==
|
||||
`
|
||||
}
|
||||
|
||||
async function compileProject(name) {
|
||||
await build({
|
||||
entryPoints: [`scripts/${name}/main.ts`],
|
||||
outfile: `dist/${name}.user.js`,
|
||||
|
||||
target: 'esnext',
|
||||
platform: 'node',
|
||||
format: 'cjs',
|
||||
|
||||
watch: false,
|
||||
bundle: true,
|
||||
minify: false,
|
||||
sourcemap: false,
|
||||
|
||||
define: {
|
||||
UserScriptProjectName: `'${name}'`,
|
||||
UserScriptFileUrl: `'${FileUrl(name)}'`,
|
||||
},
|
||||
})
|
||||
|
||||
//add UserScript header
|
||||
let meta = MetadataArgs(name)
|
||||
let content = readFileSync(`dist/${name}.user.js`).toString()
|
||||
|
||||
writeFileSync(`dist/${name}.user.js`, meta + content)
|
||||
}
|
||||
|
||||
//delete compiled scripts
|
||||
readdirSync('dist').forEach(file => unlinkSync(`dist/${file}`))
|
||||
|
||||
//compile scripts
|
||||
readdirSync('scripts').forEach(name => {
|
||||
if (
|
||||
lstatSync(`scripts/${name}`).isDirectory() &&
|
||||
lstatSync(`scripts/${name}/main.ts`).isFile()
|
||||
) {
|
||||
compileProject(name)
|
||||
}
|
||||
})
|
||||
@@ -5,7 +5,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"prettier": "prettier --write .",
|
||||
"build": "npm run prettier && rm -rf dist && tsc"
|
||||
"build": "npm run prettier && node esbuild.mjs"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -14,6 +14,7 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.14.42",
|
||||
"eslint": "^8.17.0",
|
||||
"prettier": "^2.6.2",
|
||||
"typescript": "^4.7.3"
|
||||
|
||||
273
pnpm-lock.yaml
generated
273
pnpm-lock.yaml
generated
@@ -1,11 +1,13 @@
|
||||
lockfileVersion: 5.3
|
||||
|
||||
specifiers:
|
||||
esbuild: ^0.14.42
|
||||
eslint: ^8.17.0
|
||||
prettier: ^2.6.2
|
||||
typescript: ^4.7.3
|
||||
|
||||
dependencies:
|
||||
esbuild: 0.14.42
|
||||
eslint: 8.17.0
|
||||
prettier: 2.6.2
|
||||
typescript: 4.7.3
|
||||
@@ -210,6 +212,277 @@ packages:
|
||||
esutils: 2.0.3
|
||||
dev: false
|
||||
|
||||
/esbuild-android-64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-P4Y36VUtRhK/zivqGVMqhptSrFILAGlYp0Z8r9UQqHJ3iWztRCNWnlBzD9HRx0DbueXikzOiwyOri+ojAFfW6A==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [x64]
|
||||
os: [android]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-android-arm64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-0cOqCubq+RWScPqvtQdjXG3Czb3AWI2CaKw3HeXry2eoA2rrPr85HF7IpdU26UWdBXgPYtlTN1LUiuXbboROhg==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-darwin-64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-ipiBdCA3ZjYgRfRLdQwP82rTiv/YVMtW36hTvAN5ZKAIfxBOyPXY7Cejp3bMXWgzKD8B6O+zoMzh01GZsCuEIA==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-darwin-arm64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-bU2tHRqTPOaoH/4m0zYHbFWpiYDmaA0gt90/3BMEFaM0PqVK/a6MA2V/ypV5PO0v8QxN6gH5hBPY4YJ2lopXgA==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-freebsd-64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-75h1+22Ivy07+QvxHyhVqOdekupiTZVLN1PMwCDonAqyXd8TVNJfIRFrdL8QmSJrOJJ5h8H1I9ETyl2L8LQDaw==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-freebsd-arm64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-W6Jebeu5TTDQMJUJVarEzRU9LlKpNkPBbjqSu+GUPTHDCly5zZEQq9uHkmHHl7OKm+mQ2zFySN83nmfCeZCyNA==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [arm64]
|
||||
os: [freebsd]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-32/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-Ooy/Bj+mJ1z4jlWcK5Dl6SlPlCgQB9zg1UrTCeY8XagvuWZ4qGPyYEWGkT94HUsRi2hKsXvcs6ThTOjBaJSMfg==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [ia32]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-2L0HbzQfbTuemUWfVqNIjOfaTRt9zsvjnme6lnr7/MO9toz/MJ5tZhjqrG6uDWDxhsaHI2/nsDgrv8uEEN2eoA==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-arm/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-STq69yzCMhdRaWnh29UYrLSr/qaWMm/KqwaRF1pMEK7kDiagaXhSL1zQGXbYv94GuGY/zAwzK98+6idCMUOOCg==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-arm64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-c3Ug3e9JpVr8jAcfbhirtpBauLxzYPpycjWulD71CF6ZSY26tvzmXMJYooQ2YKqDY4e/fPu5K8bm7MiXMnyxuA==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-mips64le/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-QuvpHGbYlkyXWf2cGm51LBCHx6eUakjaSrRpUqhPwjh/uvNUYvLmz2LgPTTPwCqaKt0iwL+OGVL0tXA5aDbAbg==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [mips64el]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-ppc64le/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-8ohIVIWDbDT+i7lCx44YCyIRrOW1MYlks9fxTo0ME2LS/fxxdoJBwHWzaDYhjvf8kNpA+MInZvyOEAGoVDrMHg==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-riscv64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-DzDqK3TuoXktPyG1Lwx7vhaF49Onv3eR61KwQyxYo4y5UKTpL3NmuarHSIaSVlTFDDpcIajCDwz5/uwKLLgKiQ==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-linux-s390x/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-YFRhPCxl8nb//Wn6SiS5pmtplBi4z9yC2gLrYoYI/tvwuB1jldir9r7JwAGy1Ck4D7sE7wBN9GFtUUX/DLdcEQ==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-netbsd-64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-QYSD2k+oT9dqB/4eEM9c+7KyNYsIPgzYOSrmfNGDIyJrbT1d+CFVKvnKahDKNJLfOYj8N4MgyFaU9/Ytc6w5Vw==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [x64]
|
||||
os: [netbsd]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-openbsd-64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-M2meNVIKWsm2HMY7+TU9AxM7ZVwI9havdsw6m/6EzdXysyCFFSoaTQ/Jg03izjCsK17FsVRHqRe26Llj6x0MNA==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [x64]
|
||||
os: [openbsd]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-sunos-64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-uXV8TAZEw36DkgW8Ak3MpSJs1ofBb3Smkc/6pZ29sCAN1KzCAQzsje4sUwugf+FVicrHvlamCOlFZIXgct+iqQ==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [x64]
|
||||
os: [sunos]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-windows-32/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-4iw/8qWmRICWi9ZOnJJf9sYt6wmtp3hsN4TdI5NqgjfOkBVMxNdM9Vt3626G1Rda9ya2Q0hjQRD9W1o+m6Lz6g==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-windows-64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-j3cdK+Y3+a5H0wHKmLGTJcq0+/2mMBHPWkItR3vytp/aUGD/ua/t2BLdfBIzbNN9nLCRL9sywCRpOpFMx3CxzA==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild-windows-arm64/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-+lRAARnF+hf8J0mN27ujO+VbhPbDqJ8rCcJKye4y7YZLV6C4n3pTRThAb388k/zqF5uM0lS5O201u0OqoWSicw==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/esbuild/0.14.42:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-V0uPZotCEHokJdNqyozH6qsaQXqmZEOiZWrXnds/zaH/0SyrIayRXWRB98CENO73MIZ9T3HBIOsmds5twWtmgw==,
|
||||
}
|
||||
engines: { node: '>=12' }
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
optionalDependencies:
|
||||
esbuild-android-64: 0.14.42
|
||||
esbuild-android-arm64: 0.14.42
|
||||
esbuild-darwin-64: 0.14.42
|
||||
esbuild-darwin-arm64: 0.14.42
|
||||
esbuild-freebsd-64: 0.14.42
|
||||
esbuild-freebsd-arm64: 0.14.42
|
||||
esbuild-linux-32: 0.14.42
|
||||
esbuild-linux-64: 0.14.42
|
||||
esbuild-linux-arm: 0.14.42
|
||||
esbuild-linux-arm64: 0.14.42
|
||||
esbuild-linux-mips64le: 0.14.42
|
||||
esbuild-linux-ppc64le: 0.14.42
|
||||
esbuild-linux-riscv64: 0.14.42
|
||||
esbuild-linux-s390x: 0.14.42
|
||||
esbuild-netbsd-64: 0.14.42
|
||||
esbuild-openbsd-64: 0.14.42
|
||||
esbuild-sunos-64: 0.14.42
|
||||
esbuild-windows-32: 0.14.42
|
||||
esbuild-windows-64: 0.14.42
|
||||
esbuild-windows-arm64: 0.14.42
|
||||
dev: false
|
||||
|
||||
/escape-string-regexp/4.0.0:
|
||||
resolution:
|
||||
{
|
||||
|
||||
2
scripts/index.d.ts
vendored
Normal file
2
scripts/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const UserScriptProjectName: string
|
||||
declare const UserScriptFileUrl: string
|
||||
86
scripts/meta.schema.json
Normal file
86
scripts/meta.schema.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "UserScriptMeta",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "Script Name",
|
||||
"type": "string"
|
||||
},
|
||||
"namespace": {
|
||||
"description": "Author namespace",
|
||||
"type": "string"
|
||||
},
|
||||
"match": {
|
||||
"description": "",
|
||||
"type": ["string", "array"],
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
},
|
||||
"excludematch": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"icon": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"require": {
|
||||
"description": "",
|
||||
"type": ["string", "array"],
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
},
|
||||
"resource": {
|
||||
"description": "",
|
||||
"type": ["string", "array"],
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
},
|
||||
"runat": {
|
||||
"description": "",
|
||||
"type": "string",
|
||||
"enum": ["document-start", "document-end", "document-idle"]
|
||||
},
|
||||
"noframes": {
|
||||
"description": "",
|
||||
"type": "boolean"
|
||||
},
|
||||
"grant": {
|
||||
"description": "",
|
||||
"type": ["string", "array"],
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
},
|
||||
"injectinto": {
|
||||
"description": "",
|
||||
"type": "string",
|
||||
"enum": ["page", "content", "auto"]
|
||||
},
|
||||
"downloadURL": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"supportURL": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"homepageURL": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"unwrap": {
|
||||
"description": "",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": ["name", "namespace", "version"]
|
||||
}
|
||||
11
scripts/optifine-download-links/backup.ts
Normal file
11
scripts/optifine-download-links/backup.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
// ==UserScript==
|
||||
// @name OptiFine Download Links
|
||||
// @namespace zomo.dev
|
||||
// @match https://optifine.net/*
|
||||
// @grant none
|
||||
// @version 1.0
|
||||
// @author zomo
|
||||
// @description automatically grab optifine links through the ads
|
||||
// @downloadURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/optifine-download-links.zomo.js
|
||||
// @updateURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/optifine-download-links.zomo.js
|
||||
// ==/UserScript==
|
||||
@@ -1,15 +1,3 @@
|
||||
// ==UserScript==
|
||||
// @name OptiFine Download Links
|
||||
// @namespace zomo.dev
|
||||
// @match https://optifine.net/*
|
||||
// @grant none
|
||||
// @version 1.0
|
||||
// @author zomo
|
||||
// @description automatically grab optifine links through the ads
|
||||
// @downloadURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/optifine-download-links.zomo.js
|
||||
// @updateURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/optifine-download-links.zomo.js
|
||||
// ==/UserScript==
|
||||
|
||||
const onhover = false // when to load link, false will load immediately
|
||||
|
||||
async function getDownload(href: string): Promise<string | null> {
|
||||
8
scripts/optifine-download-links/meta.json
Normal file
8
scripts/optifine-download-links/meta.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"$schema": "../meta.schema.json",
|
||||
"name": "OptiFine Download Links",
|
||||
"namespace": "zomo.dev",
|
||||
"match": "https://optifine.net/*",
|
||||
"version": "1.0",
|
||||
"description": "automatically grab optifine links through the ads"
|
||||
}
|
||||
@@ -2,16 +2,12 @@
|
||||
"compilerOptions": {
|
||||
"target": "es2020",
|
||||
"module": "commonjs",
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noImplicitReturns": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"typeRoots": ["./src/types/"]
|
||||
},
|
||||
"include": ["src"]
|
||||
"noUnusedParameters": true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user