Compare commits

...

35 Commits

Author SHA1 Message Date
1c62e14eac fuck twitter v1 2025-03-29 17:48:28 -05:00
2d6f757f77 added script 2024-01-24 18:44:34 -06:00
9b499a2109 querySelectorAll instead of querySelector 2023-04-09 22:56:33 -05:00
0903994c30 reduced elems 2023-04-09 22:52:50 -05:00
7b57162191 simplified types 2023-04-09 22:47:20 -05:00
7caaec956f simplified 2023-04-09 22:41:06 -05:00
888687f2f5 abstracted elems definitions 2023-04-09 22:39:27 -05:00
567dabf661 www.twitch.tv 2023-04-09 22:28:53 -05:00
3ae471de0f twitch clickable video 2023-04-09 22:21:14 -05:00
1e616dd256 added violentmonkey links 2022-09-05 21:07:50 -05:00
b16cd8b494 updated bsbuild 2022-08-24 12:02:21 -05:00
60b674e816 removed twitch click mute 2022-08-24 11:44:32 -05:00
884e0aa2a1 updated browser-scripts-build 2022-06-09 12:00:01 -05:00
c7195d5f2c updated browser-scripts-builder 2022-06-09 11:53:21 -05:00
7c8dc85fd5 updated meta 2022-06-09 11:53:18 -05:00
2f81cf532c updated name and description 2022-06-09 11:53:05 -05:00
2f7efcb401 removed todo 2022-06-09 11:12:05 -05:00
3239443a6c updated browser-scripts-builder 2022-06-09 11:10:33 -05:00
6082836470 updated browser-scripts-builder 2022-06-09 10:57:53 -05:00
61f4b5db57 added watch script 2022-06-09 10:29:57 -05:00
74aeff0f7c updated browser-scripts-builder 2022-06-09 10:28:41 -05:00
756ca5f66d updates 2022-06-08 11:59:31 -05:00
6c65d3c586 updated compiler 2022-06-08 11:26:02 -05:00
1105ac2860 updated types 2022-06-07 18:36:15 -05:00
19cb660126 removed test line 2022-06-07 08:34:21 -05:00
86b2918a6c updated prettierignore 2022-06-06 21:26:58 -05:00
6b0614e44d didnt meant to do that 2022-06-06 21:26:00 -05:00
c5627e318c updated builder 2022-06-06 21:25:09 -05:00
bfbc2cdbde stupid compiler 2022-06-06 18:10:32 -05:00
ffb2dd7062 ??? 2022-06-06 18:10:10 -05:00
66276486a0 added script 2022-06-06 18:09:30 -05:00
29b70f62e0 changed support url 2022-06-06 15:01:55 -05:00
cf4043ee2a renamed function 2022-06-06 14:48:58 -05:00
7e7f8bc892 removed old code 2022-06-06 14:48:33 -05:00
91d01ef900 added greasemonkey types 2022-06-06 14:48:22 -05:00
24 changed files with 2748 additions and 1356 deletions

3
.gitignore vendored
View File

@@ -1 +1,2 @@
node_modules
node_modules
error.log

View File

@@ -1 +1,3 @@
dist/*
dist/*
pnpm-lock.yaml
readme.md

13
dist/fuck-twitter.user.js vendored Normal file
View File

@@ -0,0 +1,13 @@
// ==UserScript==
// @name redir x.com and twitter.com -> bsky.app
// @namespace zomo.dev
// @match https://x.com/*
// @match https://twitter.com/*
// @version 1.0
// @description fuck twitter
// @runat document-start
// @downloadURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/fuck-twitter.user.js
// @supportURL https://git.zomo.dev/zomo/browser-scripts/issues
// @homepageURL https://git.zomo.dev/zomo/browser-scripts
// ==/UserScript==
location.href = 'https://bsky.app/'

View File

@@ -0,0 +1,21 @@
// ==UserScript==
// @name Hunger Games BrantSteele WebP Support
// @namespace zomo.dev
// @match https://brantsteele.net/hungergames/edit.php
// @version 1.0
// @description fix the form validator to allow webp images
// @runat document-end
// @downloadURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/hungergames-brantsteele-webp.user.js
// @supportURL https://git.zomo.dev/zomo/browser-scripts/issues
// @homepageURL https://git.zomo.dev/zomo/browser-scripts
// ==/UserScript==
validateForm = Function(
validateForm
.toString()
.replace(/^function validateForm\(\)(.|\n)*?\{/, '')
.replace(/\}$/, '')
.replaceAll(
'var regexp = /(https?:\\/\\/.*\\.(?:png|jpg|gif|bmp|jpeg))$/i',
'var regexp = /(https?:\\/\\/.*\\.(?:png|jpg|gif|bmp|jpeg|webp))$/i'
)
)

View File

@@ -4,60 +4,60 @@
// @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/
// @downloadURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/optifine-download-links.user.js
// @supportURL https://git.zomo.dev/zomo/browser-scripts/issues
// @homepageURL https://git.zomo.dev/zomo/browser-scripts
// ==/UserScript==
// scripts/optifine-download-links/main.ts
var onhover = false;
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), 1e3);
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)
}
}
}
}
}
});
});
})
})

22
dist/twitch-clickable-video.user.js vendored Normal file
View File

@@ -0,0 +1,22 @@
// ==UserScript==
// @name Twitch Clickable Video
// @namespace zomo.dev
// @match https://www.twitch.tv/*
// @version 1.1
// @description hold Control key to be able to right click the video element
// @downloadURL https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/twitch-clickable-video.user.js
// @supportURL https://git.zomo.dev/zomo/browser-scripts/issues
// @homepageURL https://git.zomo.dev/zomo/browser-scripts
// ==/UserScript==
var Elems = `
.video-player__overlay,
.click-handler
`
var getElems = () => Array.from(document.querySelectorAll(Elems))
var elemsSet = () =>
getElems().forEach(elem => (elem.style.pointerEvents = 'none'))
var elemsClear = () =>
getElems().forEach(elem => (elem.style.pointerEvents = ''))
addEventListener('keydown', e => e.key === 'Control' && elemsSet())
addEventListener('keyup', e => e.key === 'Control' && elemsClear())
addEventListener('click', e => (e.ctrlKey ? elemsSet() : elemsClear()))

View File

@@ -1,152 +0,0 @@
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)
}
})

1587
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"prettier": "prettier --write .",
"build": "npm run prettier && node esbuild.mjs"
"build": "npm run prettier && bsbuild -pr -u https://git.zomo.dev/zomo/browser-scripts -b main",
"watch": "bsbuild -pr -w -u https://git.zomo.dev/zomo/browser-scripts -b main"
},
"repository": {
"type": "git",
@@ -13,10 +14,11 @@
},
"author": "",
"license": "ISC",
"dependencies": {
"esbuild": "^0.14.42",
"eslint": "^8.17.0",
"prettier": "^2.6.2",
"typescript": "^4.7.3"
"devDependencies": {
"@types/greasemonkey": "^4.0.4",
"browser-scripts-builder": "git+ssh://git@git.zomo.dev:zomo/browser-scripts-builder.git",
"eslint": "^8.38.0",
"prettier": "^2.8.7",
"typescript": "^5.0.4"
}
}

1970
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1,20 @@
# browser-scripts
Requires Violentmonkey (or Tampermonkey etc): [Chrome](https://chrome.google.com/webstore/detail/violentmonkey/jinjaccalgkegednnccohejagnlnfdag) / [Firefox](https://addons.mozilla.org/en-US/firefox/addon/violentmonkey/)
<!-- START INSTALL LINKS -->
## Installs
- [redir x.com and twitter.com -> bsky.app](https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/fuck-twitter.user.js)
- zomo.dev 1.0
- fuck twitter
- [Hunger Games BrantSteele WebP Support](https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/hungergames-brantsteele-webp.user.js)
- zomo.dev 1.0
- fix the form validator to allow webp images
- [OptiFine Download Links](https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/optifine-download-links.user.js)
- zomo.dev 1.0
- automatically grab optifine links through the ads
- [Twitch Clickable Video](https://git.zomo.dev/zomo/browser-scripts/raw/branch/main/dist/twitch-clickable-video.user.js)
- zomo.dev 1.1
- hold Control key to be able to right click the video element
<!-- END INSTALL LINKS -->

View File

@@ -0,0 +1 @@
location.href = 'https://bsky.app/'

View File

@@ -0,0 +1,9 @@
{
"$schema": "https://git.zomo.dev/zomo/browser-scripts-builder/raw/branch/main/meta.schema.json",
"name": "redir x.com and twitter.com -> bsky.app",
"description": "fuck twitter",
"namespace": "zomo.dev",
"match": ["https://x.com/*", "https://twitter.com/*"],
"version": "1.0",
"runat": "document-start"
}

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "es2021",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"types": [
"../../node_modules/@types/greasemonkey",
"../../node_modules/browser-scripts-builder"
]
}
}

View File

@@ -0,0 +1,12 @@
declare var validateForm: Function
validateForm = Function(
validateForm
.toString()
.replace(/^function validateForm\(\)(.|\n)*?\{/, '')
.replace(/\}$/, '')
.replaceAll(
'var regexp = /(https?:\\/\\/.*\\.(?:png|jpg|gif|bmp|jpeg))$/i',
'var regexp = /(https?:\\/\\/.*\\.(?:png|jpg|gif|bmp|jpeg|webp))$/i'
)
)

View File

@@ -0,0 +1,9 @@
{
"$schema": "https://git.zomo.dev/zomo/browser-scripts-builder/raw/branch/main/meta.schema.json",
"name": "Hunger Games BrantSteele WebP Support",
"namespace": "zomo.dev",
"match": "https://brantsteele.net/hungergames/edit.php",
"version": "1.0",
"description": "fix the form validator to allow webp images",
"runat": "document-end"
}

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "es2021",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"types": [
"../../node_modules/@types/greasemonkey",
"../../node_modules/browser-scripts-builder"
]
}
}

2
scripts/index.d.ts vendored
View File

@@ -1,2 +0,0 @@
declare const UserScriptProjectName: string
declare const UserScriptFileUrl: string

View File

@@ -1,86 +0,0 @@
{
"$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"]
}

View File

@@ -1,5 +1,5 @@
{
"$schema": "../meta.schema.json",
"$schema": "https://git.zomo.dev/zomo/browser-scripts-builder/raw/branch/main/meta.schema.json",
"name": "OptiFine Download Links",
"namespace": "zomo.dev",
"match": "https://optifine.net/*",

View File

@@ -8,6 +8,10 @@
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true
"noUnusedParameters": true,
"types": [
"../../node_modules/@types/greasemonkey",
"../../node_modules/browser-scripts-builder"
]
}
}

View File

@@ -0,0 +1,15 @@
const Elems = `
.video-player__overlay,
.click-handler
`
const getElems = () => Array.from(document.querySelectorAll<HTMLElement>(Elems))
const elemsSet = () =>
getElems().forEach(elem => (elem.style.pointerEvents = 'none'))
const elemsClear = () =>
getElems().forEach(elem => (elem.style.pointerEvents = ''))
addEventListener('keydown', e => e.key === 'Control' && elemsSet())
addEventListener('keyup', e => e.key === 'Control' && elemsClear())
addEventListener('click', e => (e.ctrlKey ? elemsSet() : elemsClear()))

View File

@@ -0,0 +1,8 @@
{
"$schema": "https://git.zomo.dev/zomo/browser-scripts-builder/raw/branch/main/meta.schema.json",
"name": "Twitch Clickable Video",
"namespace": "zomo.dev",
"match": "https://www.twitch.tv/*",
"version": "1.1",
"description": "hold Control key to be able to right click the video element"
}

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"types": [
"../../node_modules/@types/greasemonkey",
"../../node_modules/browser-scripts-builder"
]
}
}