Greasy Fork is available in English.
Now you can easily and quickly know who DeFriended you on MAL!
Vous pourriez également aimer MALFunction - "Fix" ERRORS on MAL + Text AutoSaver.
// ==UserScript==// @name Who Defriended ME!? - MAL// @namespace MALDeFriendStalker// @version 10// @description Now you can easily and quickly know who DeFriended you on MAL!// @author hacker09// @include https://myanimelist.net/profile/*/friends// @include https://myanimelist.net/myfriends.php?go=remove&id=*// @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://myanimelist.net&size=64// @grant GM_deleteValue// @grant GM_listValues// @grant GM_getValue// @grant GM_setValue// @run-at document-end// ==/UserScript==(function() {'use strict';if (location.href.match('https://myanimelist.net/profile/' + document.querySelector("a.header-profile-link").innerText + '/friends')) //Make the script work only on the script user friend list{ //Starts the if conditionvar nextpagenum = 0; //Creates a new variableconst increaseby = 1; //Creates a new variablevar PastFriends = []; //Creates a new global arrayvar ActualFriendsArray = []; //Creates a new global arrayconst WhoDeFriendedMEBTN = document.createElement("a"); //Creates a button elementWhoDeFriendedMEBTN.innerHTML = "Check Who DeFriended ME!"; //Adds a text to the buttonWhoDeFriendedMEBTN.setAttribute("id", "WhoDeFriendedMEBTN"); //Set an id to the buttonWhoDeFriendedMEBTN.setAttribute("style", "cursor: pointer;margin-left: 15px;font-size: 10px;"); //Set the button css styledocument.querySelector("a.header-right.mt4.mr0").parentElement.appendChild(WhoDeFriendedMEBTN); //Add the button to the pagedocument.querySelector("#WhoDeFriendedMEBTN").addEventListener("click", GetNewAndActualFriendsAndShowWhoDeFriendedME, false); //Add a click advent listener to the buttonfor (var i = GM_listValues().length; i--;) { //For every single MAL friend saved on tampermonkeyPastFriends.push(GM_listValues()[i]); //Add all Past MAL Friends saved on tampermonkey to an array} //Finishes the for conditionasync function GetNewAndActualFriendsAndShowWhoDeFriendedME() { //Creates an async functionwhile (true) { //While the fetched page constains 100 friendsnextpagenum += increaseby; //Increase the page numbervar JsonResponse = await (await fetch('https://api.jikan.moe/v4/users/' + document.querySelector("a.header-profile-link").innerText + '/friends?page=' + nextpagenum)).json(); //Fetches the friend list and the next pages and converts the fetched pages to jsonfor (var i = JsonResponse.data.length; i--;) { //For every single MAL friendGM_setValue(JsonResponse.data[i].user.username, 'Actual MAL Friend'); //Get and save the actual mal friend and store the usernameActualFriendsArray.push(JsonResponse.data[i].user.username); //Add all Actual MAL Friends to an array} //Finishes the for loopif (JsonResponse.data.length !== 100) { //If the fetched page doesn't have 100 friends on itvar WhoDefriendedME = PastFriends.filter(d => !ActualFriendsArray.includes(d)); //Creates a variable to get the Past Friend User Names that tampermonkey had and check which Past Friends User Names are currently Missingif (WhoDefriendedME.length > 0) //If someone defriended you{ //Starts the if conditionalert('You was DeFriended by:\n' + WhoDefriendedME); //Shows who DeFriended you!for (var j = WhoDefriendedME.length; j--;) { //For every single MAL friend that defriended you and is saved on tampermonkeyGM_deleteValue(WhoDefriendedME[j]); //Remove the defriended user name of the script storage} //Finishes the for loop} //Finishes the if conditionelse //If nobody defriended you{ //Starts the else conditionalert('Your current Friends list was updated and saved!\n Nobody Has DeFriended you!'); //Shows a message} //Finishes the else conditionreturn;} //Finishes the if conditionawait new Promise(resolve => setTimeout(resolve, 600)); //Timeout to start the next fetch request} //Finishes the while condition} //Finishes the async function} //Finishes the if conditionelse //If the user is defriending a friend on https://myanimelist.net/myfriends.php?go=remove&id={ //Starts the else conditiondocument.querySelector("input.inputButton").onclick = function() { //Detects the mouse click on the 'Remove Friend' buttonGM_deleteValue(document.querySelector("td.dialog-text > strong").innerText); //Remove the defriended user name of the script storage}; //Finishes the onclick advent listener} //Finishes the else condition})();