i don’t know mutch about javascript but i found this greasemonekey script that i’m trying to edit.
var rating = document.links;
for (i = 0; i < rating.length; i++) {
if (rating[i].href.indexOf("/shows/") != -1){
GM_xmlhttpRequest({
method: 'get',
url: rating[i].href,
onload: function (i) {return function(result) {
rate = result.responseText.match(/<span class="rating">(.*)<\/span>/);
result = rate[1].substring(0,3);
rat = document.createElement("div");
rat.className = 'rate';
rat.innerHTML = result;
rating[i].parentNode.insertBefore(rat, rating[i].nextSibling);
}}(i)
});
}
}
So it search all the links on the page and if the link contains /shows/ it search for the value:
<span class="rating"><\span>
if its found it shows the result in the div i created. so far so good!
But some of those links doenst have <span class="rating"><\span>
On those links i like it to say “not found” But i can’t figured it out how to 🙁
1 Answer