RYM discography average rating

Shows the average album rating of artists, weighted according to number of ratings.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name       RYM discography average rating
// @version    1.2
// @description:en  Shows the average album rating of artists, weighted according to number of ratings.
// @description Shows the average album rating of artists, weighted according to number of ratings.
// @match      https://rateyourmusic.com/artist/*
// @namespace https://greasyfork.org/users/194849
// ==/UserScript==

var $ = unsafeWindow.jQuery;
var ratingsSum = 0;
var avg = 0;
var ratings = $('#disco_type_s').find('.disco_avg_rating');
var numberofRatingsList = $('#disco_type_s').find('.disco_ratings');
//console.log(ratings[i].innerHTML);

for(var i = 0; i < numberofRatingsList.length;i++){

    if(!ratings[i].innerHTML.includes("data") && ratings[i].innerHTML.includes(".")){
        console.log(ratings[i] + "counts");
    ratingsSum+=parseFloat(numberofRatingsList[i].innerHTML.replace(",", ""));
    }
}


for(i = 0; i < ratings.length;i++){

    if(!ratings[i].innerHTML.includes("data") && ratings[i].innerHTML.includes(".")){
   avg += parseFloat(ratings[i].innerHTML.replace(",", "")) * parseFloat(numberofRatingsList[i].innerHTML.replace(",", "")) / ratingsSum;
    }
}
console.log(avg);


var avgElements = $('.hide-for-small-inline');

avgElements[0].innerHTML = "avg(" + avg.toFixed(2) +")";