Add mpphc.user.js
This commit is contained in:
parent
1fb266fd71
commit
d6a568a0d6
52
mpphc.user.js
Normal file
52
mpphc.user.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
// ==UserScript==
|
||||
// @name MPPHC
|
||||
// @version 0.0.poc
|
||||
// @description Mute's Project Pandora Hacks Collection (proof of concept)
|
||||
// @author codename.mute@proton.me
|
||||
// @namespace https://code.fleshless.org/mute/
|
||||
// @match https://project-pandora.com/*
|
||||
// @match https://www.project-pandora.com/*
|
||||
// @sandbox DOM
|
||||
// @grant GM_xmlhttpRequest
|
||||
// @connect fonts.gstatic.com
|
||||
// ==/UserScript==
|
||||
(function() {
|
||||
"use strict";
|
||||
if (window.MPPHC) throw new Error("MPPHC found, aborting loading")
|
||||
window.MPPHC = {}
|
||||
const FONT = weight => ({weight, style: "normal", display: "swap", unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD"})
|
||||
const CSS = _ => `
|
||||
.chatArea {
|
||||
font-family: 'Laila', serif;
|
||||
font-size: 14px;
|
||||
}
|
||||
div.chatArea > textarea {
|
||||
color: #fff;
|
||||
background-color: #333;
|
||||
font-family: 'Saira', sans-serif;
|
||||
font-size: 22px;
|
||||
height: 4.75em;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
div.chatArea > textarea:focus {
|
||||
background-color: #000;
|
||||
}
|
||||
`
|
||||
const css = document.createElement("style")
|
||||
css.textContent = CSS()
|
||||
document.head.appendChild(css)
|
||||
|
||||
async function webfont(name, url, props) {
|
||||
const r = await GM.xmlHttpRequest({url, method: "GET", responseType: "blob", anonymous: true})
|
||||
if (r.status !== 200) throw new Error('Font load failed')
|
||||
const buf = await r.response.arrayBuffer()
|
||||
const font = new FontFace(name, buf, props)
|
||||
await font.load()
|
||||
document.fonts.add(font)
|
||||
}
|
||||
|
||||
webfont('Laila', "https://fonts.gstatic.com/s/laila/v15/LYjBdG_8nE8jDLypozNHjV8.woff2", FONT(500))
|
||||
webfont('Saira', "https://fonts.gstatic.com/s/sairasemicondensed/v13/U9MD6c-2-nnJkHxyCjRcnMHcWVWV1cWRRX8MaOY.woff2", FONT(400))
|
||||
|
||||
})()
|
Loading…
Reference in New Issue
Block a user