Compare commits
No commits in common. "6fe13acb3c0863ba611cf8a61e39d53768dca052" and "e07b4fc248397186e27226488dce12d6008821fc" have entirely different histories.
6fe13acb3c
...
e07b4fc248
6 changed files with 6 additions and 129 deletions
10
README.md
10
README.md
|
@ -21,12 +21,4 @@ Because no one wants porn on their monthly statement.
|
||||||
- [src/coomer.su.json](src/coomer.su.json) (contents of https://coomer.su/api/v1/creators.txt)
|
- [src/coomer.su.json](src/coomer.su.json) (contents of https://coomer.su/api/v1/creators.txt)
|
||||||
- [src/coomer.su-modded.json](src/coomer.su-modded.json) (minimal variant)
|
- [src/coomer.su-modded.json](src/coomer.su-modded.json) (minimal variant)
|
||||||
- [src/kemono.su.json](src/kemono.su.json) (contents of https://kemono.su/api/v1/creators.txt)
|
- [src/kemono.su.json](src/kemono.su.json) (contents of https://kemono.su/api/v1/creators.txt)
|
||||||
- [src/kemono.su-modded.json](src/kemono.su-modded.json) (minimal variant)
|
- [src/kemono.su-modded.json](src/kemono.su-modded.json) (minimal variant)
|
||||||
|
|
||||||
## [youtube/music/warning-proceed.user.js](build/youtube/music/warning-proceed.user.js) <small>[(.min.js)](build/youtube/music/warning-proceed.min.user.js)</small>
|
|
||||||
|
|
||||||
When listening to music in bed as I read, this prompt could occur at times. Causing me to have to get up to resume whatever mix I was listening to.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
This script simply scans and clicks the proceed button.
|
|
25
build.js
25
build.js
|
@ -131,23 +131,11 @@ async function downloadFiles() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function buildScript(scriptPath) {
|
async function buildScript(scriptPath) {
|
||||||
const srcDir = path.dirname(scriptPath);
|
|
||||||
const scriptName = path.basename(scriptPath, ".user.js");
|
const scriptName = path.basename(scriptPath, ".user.js");
|
||||||
const metaPath = path.join(srcDir, scriptName + `.meta.js`);
|
const metaPath = path.join(srcDir, `${scriptName}.meta.js`);
|
||||||
let outdDir = [outDir, srcDir.replace(/^src(\\|\/)?/, "")];
|
const outPath = path.join(outDir, `${scriptName}.user.js`);
|
||||||
const outPath = path.join(...outdDir, `${scriptName}.user.js`);
|
const tempPath = path.join(outDir, `${scriptName}.user.temp.js`);
|
||||||
const tempPath = path.join(...outdDir, `${scriptName}.user.temp.js`);
|
const minifiedPath = path.join(outDir, `${scriptName}.min.user.js`);
|
||||||
const minifiedPath = path.join(...outdDir, `${scriptName}.min.user.js`);
|
|
||||||
console.log({
|
|
||||||
srcDir,
|
|
||||||
outdDir,
|
|
||||||
scriptPath,
|
|
||||||
scriptName,
|
|
||||||
metaPath,
|
|
||||||
outPath,
|
|
||||||
tempPath,
|
|
||||||
minifiedPath,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!fs.existsSync(metaPath)) {
|
if (!fs.existsSync(metaPath)) {
|
||||||
console.error(`Meta file not found: ${metaPath}`);
|
console.error(`Meta file not found: ${metaPath}`);
|
||||||
|
@ -195,11 +183,8 @@ async function buildScript(scriptPath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildAll() {
|
function buildAll() {
|
||||||
const files = fs.readdirSync(srcDir, {
|
const files = fs.readdirSync(srcDir);
|
||||||
recursive: true,
|
|
||||||
});
|
|
||||||
files.forEach((file) => {
|
files.forEach((file) => {
|
||||||
console.log(file);
|
|
||||||
if (file.endsWith(".user.js")) {
|
if (file.endsWith(".user.js")) {
|
||||||
buildScript(path.join(srcDir, file));
|
buildScript(path.join(srcDir, file));
|
||||||
}
|
}
|
||||||
|
|
BIN
image-1.png
BIN
image-1.png
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
74
meta.js
74
meta.js
|
@ -1,74 +0,0 @@
|
||||||
// This is a copy of https://github.com/pd4d10/userscript-meta/blob/master/index.js
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
function isUndefined(val) {
|
|
||||||
return typeof val === "undefined";
|
|
||||||
}
|
|
||||||
|
|
||||||
function isObject(val) {
|
|
||||||
return typeof val === "object" && val !== null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse metadata to an object
|
|
||||||
function parse(meta) {
|
|
||||||
if (typeof meta !== "string") {
|
|
||||||
throw new Error("`Parse`'s first argument should be a string");
|
|
||||||
}
|
|
||||||
|
|
||||||
return meta
|
|
||||||
.split(/[\r\n]/)
|
|
||||||
.filter(function (line) {
|
|
||||||
// remove blank line
|
|
||||||
return (
|
|
||||||
/\S+/.test(line) &&
|
|
||||||
line.indexOf("==UserScript==") === -1 &&
|
|
||||||
line.indexOf("==/UserScript==") === -1
|
|
||||||
);
|
|
||||||
})
|
|
||||||
.reduce(function (obj, line) {
|
|
||||||
var arr = line.trim().replace(/^\/\//, "").trim().split(/\s+/);
|
|
||||||
var key = arr[0].slice(1);
|
|
||||||
var value = arr.slice(1).join(" ");
|
|
||||||
|
|
||||||
if (isUndefined(obj[key])) {
|
|
||||||
obj[key] = value;
|
|
||||||
} else if (Array.isArray(obj[key])) {
|
|
||||||
obj[key].push(value);
|
|
||||||
} else {
|
|
||||||
obj[key] = [obj[key], value];
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}, {});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLine(key, value) {
|
|
||||||
// For field which has multiple values, like `match`
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
return value
|
|
||||||
.map(function (value) {
|
|
||||||
return getLine(key, value);
|
|
||||||
})
|
|
||||||
.join("");
|
|
||||||
}
|
|
||||||
|
|
||||||
return "// @" + key + " " + value + "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stringify metadata from an object
|
|
||||||
function stringify(obj) {
|
|
||||||
if (!isObject(obj)) {
|
|
||||||
throw new Error("`Stringify`'s first argument should be an object");
|
|
||||||
}
|
|
||||||
|
|
||||||
var meta = Object.keys(obj)
|
|
||||||
.map(function (key) {
|
|
||||||
return getLine(key, obj[key]);
|
|
||||||
})
|
|
||||||
.join("");
|
|
||||||
|
|
||||||
return "// ==UserScript==\n" + meta + "// ==/UserScript==\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.parse = parse;
|
|
||||||
exports.stringify = stringify;
|
|
|
@ -1,8 +0,0 @@
|
||||||
// ==UserScript==
|
|
||||||
// @name music.youtube.com
|
|
||||||
// @description This skips the warning "The following content may contain suicide or self-harm topics." on music.youtube.com
|
|
||||||
// @namespace Bowud Scripts
|
|
||||||
// @match https://music.youtube.com/watch*
|
|
||||||
// @downloadURL {{FILE_URL}}
|
|
||||||
// @version {{UNIXDATE}}
|
|
||||||
// ==/UserScript==
|
|
|
@ -1,18 +0,0 @@
|
||||||
setInterval(function () {
|
|
||||||
let errorScreenEl = document.querySelector("#error-screen");
|
|
||||||
console.log({ errorScreenEl: errorScreenEl });
|
|
||||||
let reasonEl = errorScreenEl.querySelector("#reason");
|
|
||||||
console.log({ reasonEl: reasonEl });
|
|
||||||
if (
|
|
||||||
reasonEl.textContent ===
|
|
||||||
"The following content may contain suicide or self-harm topics."
|
|
||||||
) {
|
|
||||||
let buttonEl = errorScreenEl.querySelector(
|
|
||||||
'button[aria-label="I understand and wish to proceed"]'
|
|
||||||
);
|
|
||||||
console.log({ buttonEl: buttonEl });
|
|
||||||
if (buttonEl) {
|
|
||||||
buttonEl.click();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 100);
|
|
Loading…
Reference in a new issue