Compare commits
7 commits
e07b4fc248
...
6fe13acb3c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6fe13acb3c | ||
![]() |
1e079b9c18 | ||
![]() |
d11dfea568 | ||
![]() |
5055253cd3 | ||
![]() |
3cab1d9b59 | ||
![]() |
e6204dade4 | ||
![]() |
fe681b6017 |
6 changed files with 129 additions and 6 deletions
10
README.md
10
README.md
|
@ -21,4 +21,12 @@ 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-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-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,11 +131,23 @@ async function downloadFiles() {
|
|||
}
|
||||
|
||||
async function buildScript(scriptPath) {
|
||||
const srcDir = path.dirname(scriptPath);
|
||||
const scriptName = path.basename(scriptPath, ".user.js");
|
||||
const metaPath = path.join(srcDir, `${scriptName}.meta.js`);
|
||||
const outPath = path.join(outDir, `${scriptName}.user.js`);
|
||||
const tempPath = path.join(outDir, `${scriptName}.user.temp.js`);
|
||||
const minifiedPath = path.join(outDir, `${scriptName}.min.user.js`);
|
||||
const metaPath = path.join(srcDir, scriptName + `.meta.js`);
|
||||
let outdDir = [outDir, srcDir.replace(/^src(\\|\/)?/, "")];
|
||||
const outPath = path.join(...outdDir, `${scriptName}.user.js`);
|
||||
const tempPath = path.join(...outdDir, `${scriptName}.user.temp.js`);
|
||||
const minifiedPath = path.join(...outdDir, `${scriptName}.min.user.js`);
|
||||
console.log({
|
||||
srcDir,
|
||||
outdDir,
|
||||
scriptPath,
|
||||
scriptName,
|
||||
metaPath,
|
||||
outPath,
|
||||
tempPath,
|
||||
minifiedPath,
|
||||
});
|
||||
|
||||
if (!fs.existsSync(metaPath)) {
|
||||
console.error(`Meta file not found: ${metaPath}`);
|
||||
|
@ -183,8 +195,11 @@ async function buildScript(scriptPath) {
|
|||
}
|
||||
|
||||
function buildAll() {
|
||||
const files = fs.readdirSync(srcDir);
|
||||
const files = fs.readdirSync(srcDir, {
|
||||
recursive: true,
|
||||
});
|
||||
files.forEach((file) => {
|
||||
console.log(file);
|
||||
if (file.endsWith(".user.js")) {
|
||||
buildScript(path.join(srcDir, file));
|
||||
}
|
||||
|
|
BIN
image-1.png
Normal file
BIN
image-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
74
meta.js
Normal file
74
meta.js
Normal file
|
@ -0,0 +1,74 @@
|
|||
// 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;
|
8
src/youtube/music/warning-proceed.meta.js
Normal file
8
src/youtube/music/warning-proceed.meta.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
// ==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==
|
18
src/youtube/music/warning-proceed.user.js
Normal file
18
src/youtube/music/warning-proceed.user.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
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