mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2025-03-04 17:49:59 +01:00
add tampermonkey script for custom CSS
This commit is contained in:
parent
3ba429cd21
commit
19c76c0457
9 changed files with 53 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
|||
# plugins
|
||||
|
||||
This directory contains a set of plugins for various software.
|
||||
|
||||
## list
|
||||
|
||||
- `mpv-sbskip`: a MPV plugin written in Zig to skip SponsorBlock segments marked by yt-dlp.
|
||||
- `tampermonkey-mzte-css`: a Tampermonkey userscript, which injects some minimal CSS into every page, which removes rounded corners (fuck rounded corners!) and improves fonts.
|
||||
|
|
1
plugins/tampermonkey-mzte-css/.gitignore
vendored
Normal file
1
plugins/tampermonkey-mzte-css/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
script.js
|
8
plugins/tampermonkey-mzte-css/assets/header.txt
Normal file
8
plugins/tampermonkey-mzte-css/assets/header.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
// ==UserScript==
|
||||
// @name MZTE CSS
|
||||
// @version 0.1.0
|
||||
// @description Injects some CSS into every page
|
||||
// @author LordMZTE
|
||||
// @include *
|
||||
// @run-at document-start
|
||||
// ==/UserScript==
|
4
plugins/tampermonkey-mzte-css/assets/style.css
Normal file
4
plugins/tampermonkey-mzte-css/assets/style.css
Normal file
|
@ -0,0 +1,4 @@
|
|||
:root * {
|
||||
border-radius: 0 !important;
|
||||
font-family: "Iosevka Nerd Font", monospace !important;
|
||||
}
|
5
plugins/tampermonkey-mzte-css/build.hxml
Normal file
5
plugins/tampermonkey-mzte-css/build.hxml
Normal file
|
@ -0,0 +1,5 @@
|
|||
-cp src
|
||||
-main Main
|
||||
--macro Macro.init()
|
||||
|
||||
-js script.js
|
17
plugins/tampermonkey-mzte-css/src/Macro.hx
Normal file
17
plugins/tampermonkey-mzte-css/src/Macro.hx
Normal file
|
@ -0,0 +1,17 @@
|
|||
#if macro
|
||||
import haxe.macro.Compiler;
|
||||
import haxe.macro.Context;
|
||||
import sys.io.File;
|
||||
#end
|
||||
|
||||
macro function init() {
|
||||
var oldHeader = Context.definedValue("source-header");
|
||||
var header = Std.string(File.read("assets/header.txt").readAll());
|
||||
Compiler.define("source-header", '$header\n//$oldHeader');
|
||||
return macro {};
|
||||
}
|
||||
|
||||
macro function fileContent(path:String):haxe.macro.Expr.ExprOf<String> {
|
||||
return macro $v{Std.string(File.read(path).readAll())};
|
||||
}
|
||||
|
7
plugins/tampermonkey-mzte-css/src/Main.hx
Normal file
7
plugins/tampermonkey-mzte-css/src/Main.hx
Normal file
|
@ -0,0 +1,7 @@
|
|||
import js.Browser;
|
||||
|
||||
function main() {
|
||||
var elem = Browser.document.createStyleElement();
|
||||
elem.innerHTML = Macro.fileContent("assets/style.css");
|
||||
Browser.document.addEventListener("DOMContentLoaded", () -> Browser.document.body.appendChild(elem));
|
||||
}
|
|
@ -3,4 +3,5 @@
|
|||
(provide run)
|
||||
|
||||
(define (run)
|
||||
(install-zig "plugins/mpv-sbskip"))
|
||||
(install-zig "plugins/mpv-sbskip")
|
||||
(build-haxe "plugins/tampermonkey-mzte-css"))
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
generate-cgopt-json
|
||||
install-zig
|
||||
install-rust
|
||||
install-roswell)
|
||||
install-roswell
|
||||
build-haxe)
|
||||
|
||||
;; Whether to log calls or not
|
||||
(define log-calls (make-parameter #t))
|
||||
|
@ -53,6 +54,11 @@
|
|||
"--out-dir"
|
||||
(build-path (output-bin-path) "bin")))))
|
||||
|
||||
(define-logging build-haxe
|
||||
(λ (path)
|
||||
(parameterize ([current-directory path] [log-calls #f])
|
||||
(cmd "haxe" "build.hxml"))))
|
||||
|
||||
(define-logging generate-cgopt-json
|
||||
(λ ()
|
||||
(unless (directory-exists? "cgout")
|
||||
|
|
Loading…
Add table
Reference in a new issue