-
-
Save jpcaparas/e8257fca97e2fad44a43c34668810244 to your computer and use it in GitHub Desktop.
| // ==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); | |
| })(); |
thanks !
In case it helps others (or my future self... yeah, I've run into this numerous times):
If you get an error such as:
Uncaught (in promise) ReferenceError: GM_getResourceText is not defined
You very probably have a stray:
// @grant none
Somewhere in the top header of your greasemonkey / tampermonkey script.
In case it helps others (or my future self... yeah, I've run into this numerous times):
If you get an error such as:
Uncaught (in promise) ReferenceError: GM_getResourceText is not definedYou very probably have a stray:
// @grant noneSomewhere in the top header of your greasemonkey / tampermonkey script.
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 :( )
let e = document.createElement('script');
e.type = 'module';
e.innerText = ev.responseText;
document.head.appendChild(e);