// ==UserScript==
// @name New script - furaffinity.net
// @namespace FAJAX
// @match https://www.furaffinity.net/view/*
// @grant none
// @version 1.0
// @author -
// @description 21/09/2023, 02:36:49
// ==/UserScript==
function ajaxify_fav_button() {
let elements = document.getElementsByClassName("fav");
for (e of elements) {
let link = e.children[0];
let favURL = link.href;
console.log(favURL);
link.onclick = function () {
let f = async function () {
let result = await fetch(favURL);
console.log(result);
link.innerHTML = (link.innerHTML == "+ Fav") ? "β Faved" : "β Unfaved";
link.onclick = function () {};
}
f();
}
link.style.cursor = "pointer";
link.removeAttribute("href");
}
}
ajaxify_fav_button();
console.log("fajax");
this only works the first time you click the button on a page load, but you don't typically unfav right after a fav so im not concerned about it. also excuse i suck at js. and technically its the fetch api. oh and why the fuck don't they just do this by default???
