A hacky script adryd325 wrote to put a cat on her site.
The default image is oneko.gif
in the Assets directory.
I made changes to fit my workflow better and work with my website and some paths need probably some adjustments. The main changes are:
- Slight refactoring.
- Removing unneeded code.
- Added scaling to any Zoom level incl. speed.
og-demo: https://adryd.com
This script is meant to be simple so that it can easily be extended upon.
The script is heavily adjusted in the way it must be loaded to fit my setup. Here is how to call it (It is very jank):
// Path to OnekoJS-File:
var onekoJsFile = '/Assets/SubScripts/OnekoJS/OnekoJS.js'
// This can load a Script file into the current page. Works with a callback. The return needs to be executed on, to launch the function in the script. See loadOneko for an example:
function loadScript(url, callback) {
const script = document.createElement('script');
script.src = url;
script.onload = callback;
document.head.appendChild(script);
}
// Loads Oneko without being a Module or imported. This works with using a onload callback call to execute a method on. This is very VERY janky (This can be also be viewed as an example on how to use "loadScript"):
function runOneko() {
loadScript(onekoJsFile, function() {
// Call function after loading:
window.oneko();
});
}
implemented in a few different places
- Userscript: https://openuserjs.org/scripts/sjehuda/Oneko_WebMate
- Vencord: https://vencord.dev/plugins/oneko
- Spicetify: https://github.com/kyrie25/spicetify-oneko
feature forks
- Pet the cat: https://github.com/tylxr59/oneko.js/tree/main
- Move the cat using scroll wheel: https://github.com/rozbrajaczpoziomow/fork-oneko.js/tree/main