I wanted to completely empty my anime list in MAL but noticed it had no such functionality but requires the user to manually delete each anime in his/her list. So I wrote this script to do that for me and wanted to share it with people incase anyone wanted to use it or to improve it. Note before writing this script I kinda had no experience in javascript so I assume this is pretty bad, but it does the job anyways.
How to use?
1. Navigate to MAL website then go to Anime -> View List -> Edit
2. Open up your browser's console (e.g. for chrome right click inspect element and just search for the console)
3. Copy paste this code to the console but make sure to change the variable "numberToDelete" to how many you want to delete from the list (Note this opens a tab for each anime to delete so do not put a huge number here instead just repeat the process multiple times with smaller numbers while refreshing after each repeat)
I'd appreciate input on this especially on how I could improve the code cause as I said I am a total noob in javascript.
Code
// Script to delete anime in bulk from MAL anime list
// By: Bazalia
var windows = [];
//Number of entries to delete from top to bottom the higher the number the more likely for bugs 20 - 40 at a time is good
var numberToDelete = 2;
//Timeout before tabs are automatically closed don't bother with this
var timeOutOnTabs = 4000;
if(numberToDelete > 50) {
numberToDelete = 50;
}
if(timeOutOnTabs < 2000) {
timeOutOnTabs = 2000;
}
// delete then close the tab (override confirm function to stop popup box)
function handleWindow(i) {
windows[i].onload = function () {
var realConfirm = windows[i].confirm;
windows[i].confirm = function(){
windows[i].confirm = realConfirm;
return true;
};
windows[i].checkValidSubmit(3);
setTimeout(function(){ windows[i].close(); }, timeOutOnTabs);
};
}
for( var i=1; i<numberToDelete + 1; i++ ) {
// Traverse table to first row under heading row and to the second cell which contains Edit link
var linkLocation = content.children.item(2).firstElementChild.children.item(i).children.item(1).firstElementChild;
// open tab to edit page
var link = document.URL.replace("?type=anime", '') + linkLocation.getAttribute('href');
windows[i] = window.open(link);
handleWindow(i);
}How to use?
1. Navigate to MAL website then go to Anime -> View List -> Edit
2. Open up your browser's console (e.g. for chrome right click inspect element and just search for the console)
3. Copy paste this code to the console but make sure to change the variable "numberToDelete" to how many you want to delete from the list (Note this opens a tab for each anime to delete so do not put a huge number here instead just repeat the process multiple times with smaller numbers while refreshing after each repeat)
I'd appreciate input on this especially on how I could improve the code cause as I said I am a total noob in javascript.
