Last active
December 16, 2024 23:54
-
-
Save jpcaparas/e8257fca97e2fad44a43c34668810244 to your computer and use it in GitHub Desktop.
Tampermonkey: Load an external script and CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name HackerNews | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://news.ycombinator.com/ | |
// @require https://bennettfeely.com/ztext/js/ztext.min.js | |
// @resource REMOTE_CSS http://127.0.0.1:8080/style.css | |
// @grant GM_xmlhttpRequest | |
// @grant GM_getResourceText | |
// @grant GM_addStyle | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Load remote JS | |
GM_xmlhttpRequest({ | |
method : "GET", | |
// from other domain than the @match one (.org / .com): | |
url : "https://bennettfeely.com/ztext/js/ztext.min.js", | |
onload : (ev) => | |
{ | |
let e = document.createElement('script'); | |
e.innerText = ev.responseText; | |
document.head.appendChild(e); | |
} | |
}); | |
// Load remote CSS | |
// @see https://github.com/Tampermonkey/tampermonkey/issues/835 | |
const myCss = GM_getResourceText("REMOTE_CSS"); | |
GM_addStyle(myCss); | |
// document.querySelector('.hnname').setAttribute('data-z', true) | |
// document.querySelector('.hnname').setAttribute('data-z-layers', 3); | |
setTimeout(function() { | |
var ztxt = new Ztextify(".hnname", { | |
depth: "30px", | |
layers: 8, | |
fade: true, | |
direction: "forwards", | |
event: "pointer", | |
eventRotation: "35deg" | |
}); | |
}, 3000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OMG THANKS im not even related to this repo or anything but i got this error and i idnt knw the souion lol, i was overthinking it, really thanks for saying that ( i had a stray grant none :( )