Created
January 15, 2013 22:19
-
-
Save Naouak/4542666 to your computer and use it in GitHub Desktop.
A short script that will inject on any animelist on MyAnimeList scores that are scaled from 0 to 10. It means that if your lowest score is 5, it will become 0.
It also calculate some values that you may find interesting and put it in variables. To use it, just paste this in your chrome console when you are on an anime list.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var n = document.querySelectorAll(".animetitle"); | |
var arr = []; | |
var min = null; | |
var max = null; | |
var total = 0; | |
var count = 0; | |
var noteCount = {}; | |
for (var i = n.length - 1; i >= 0; i--) { | |
(function(n){ | |
var title = n.text; | |
var note = n.parentNode.parentNode.querySelector("td:nth-child(3)").innerHTML; | |
if(note == "-"){ | |
note = null; | |
} else { | |
note = parseInt(note); | |
} | |
arr.push({ | |
title: title, | |
note: note, | |
node: n.parentNode.parentNode.querySelector("td:nth-child(3)") | |
}) | |
})(n[i]) | |
}; | |
arr.forEach(function(n){ | |
if(n.note === null){ | |
return; | |
} | |
if(min === null || n.note <= min){ | |
min = n.note; | |
} | |
if(max === null || n.note >= max){ | |
max = n.note; | |
} | |
total+=n.note; | |
count+=1; | |
if(noteCount[n.note] === undefined){ | |
noteCount[n.note] = 0; | |
} | |
noteCount[n.note] += 1; | |
}); | |
console.log("Average: "+total/count); | |
var center = min + (max-min)/2; | |
var scale = 10/(max-min); | |
total = 0; | |
count = 0; | |
arr.forEach(function(n){ | |
if(n.note === null){ | |
return; | |
} | |
n.realNote = (n.note-center)*scale + 5; | |
total+=n.realNote; | |
count+=1; | |
n.node.innerHTML+=" / "+(Math.round(n.realNote*100)/100); | |
}); | |
console.log("Average: "+total/count); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment