From 5dd17fe3c88d8543cbff634116d76f1fb1692faf Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sun, 17 Nov 2024 20:48:17 -0600 Subject: add mkconfig.py script to generate violentmonkey zip --- .gitignore | 1 + README.md | 36 +++++++++--------------------------- mkconfig.py | 25 +++++++++++++++++++++++++ settings.json | 8 ++++++++ 4 files changed, 43 insertions(+), 27 deletions(-) create mode 100644 .gitignore create mode 100644 mkconfig.py create mode 100644 settings.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4c4ffc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.zip diff --git a/README.md b/README.md index 1ed89e4..59d7325 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,13 @@ # Userscripts +These are my [Violentmoney](https://violentmonkey.github.io/) userscripts for various sites. +Violentmonkey is a modern free software replacement for Tampermonkey/Greasemonkey. -These are my userscripts for various sites. -I use [Violentmoney](https://violentmonkey.github.io/) as my userscript manager extension. -It is free software, unlike tamper/greese monkey. +# Install from URL +In Violentmonkey, click the `+` button => `Install from URL`, and paste the following: -# Install +`https://git.tjkeller.xyz/userscripts.git/plain/{path to userscript.js}` -Simply pull up Violentmonkey's config page, click the `+` button, `Install from URL`, and paste one of the following scripts: - -## Youtube - -### Disable Youtube Miniplayer -[https://git.tjkeller.xyz/userscripts.git/plain/youtube/disable-mini-player.js](https://git.tjkeller.xyz/userscripts.git/plain/youtube/disable-mini-player.js) - -### Piped Button -[https://git.tjkeller.xyz/userscripts.git/plain/youtube/piped-button.js](https://git.tjkeller.xyz/userscripts.git/plain/youtube/piped-button.js) - -### Remove youtube home and shorts -[https://git.tjkeller.xyz/userscripts.git/plain/youtube/remove-home-shorts.js](https://git.tjkeller.xyz/userscripts.git/plain/youtube/remove-home-shorts.js) - -## Miscellaneous - -### Piped - Fill Preferences -[https://git.tjkeller.xyz/userscripts.git/tree/misc/piped-preferences.js](https://git.tjkeller.xyz/userscripts.git/tree/misc/piped-preferences.js) - -### rateyourmusic.com dark reader compatibility -[https://git.tjkeller.xyz/userscripts.git/tree/misc/rateyourmusic.com-dark-reader-compatibility.js](https://git.tjkeller.xyz/userscripts.git/tree/misc/rateyourmusic.com-dark-reader-compatibility.js) - -### Fill out usps scheduled pickup -[https://git.tjkeller.xyz/userscripts.git/tree/misc/usps-fill-out-scheduled-pickup.js](https://git.tjkeller.xyz/userscripts.git/tree/misc/usps-fill-out-scheduled-pickup.js) +# Install from zip +A python script `mkconfig.py` is included to generate a `violentmonkey.zip` +file that can be imported in +`Violentmoney` => `Settings => `Backup and maintenance` diff --git a/mkconfig.py b/mkconfig.py new file mode 100644 index 0000000..47cc0ee --- /dev/null +++ b/mkconfig.py @@ -0,0 +1,25 @@ +import json +import os +import glob +import zipfile + +# handle settings +settings = {} +if os.path.isfile("settings.json"): + with open("settings.json", 'r') as f: + settings = json.load(f) + +# get all userscripts +paths = glob.glob(os.path.join('.', '**', '*.js'), recursive=True) +paths = [ path.removesuffix(".js") for path in paths ] + +# zipp +with zipfile.ZipFile("violentmonkey.zip", 'w', zipfile.ZIP_DEFLATED) as zipf: + for path in paths: + arcname = os.path.basename(path) + ".user.js" # basename and add .user.js suffix + path += ".js" + zipf.write(path, arcname=arcname) + zipf.writestr("violentmonkey", json.dumps({ + "scripts": { os.path.basename(path): {} for path in paths }, + "settings": settings, + })) diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..7fc6664 --- /dev/null +++ b/settings.json @@ -0,0 +1,8 @@ +{ + "editor": { + "indentWithTabs": true + }, + "valueEditor": { + "indentWithTabs": true + } +} -- cgit v1.2.3