🏠 Home 

Metacritic Style Ratings for RateYourMusic

Converts album ratings on RateYourMusic to a Metacritic-style 0-100 scale


Install this script?
// ==UserScript==
// @name         Metacritic Style Ratings for RateYourMusic
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Converts album ratings on RateYourMusic to a Metacritic-style 0-100 scale
// @author       https://greasyfork.org/users/1320826-polachek
// @match        https://rateyourmusic.com/*
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==
(function() {
'use strict';
function convertRatingTo100Scale(rating) {
return Math.round(parseFloat(rating) * 20);
}
function getColorForRating(rating) {
if (rating <= 39) {
return 'red';
} else if (rating <= 60) {
return 'orange';
} else {
return 'green';
}
}
function processRatingElements() {
const selectors = [
'.avg_rating',
'.avg_rating_friends',
'.disco_avg_rating',
'.page_features_secondary_metadata_rating_final',
'.newreleases_stat.newreleases_avg_rating_stat',
'.component_discography_item_details_average',
'.page_charts_section_charts_item_details_average_num',
'.track_rating_avg'
];
selectors.forEach(selector => {
const ratingElements = document.querySelectorAll(selector);
ratingElements.forEach(el => {
const ratingText = el.textContent.trim();
const ratingValue = parseFloat(ratingText);
if (!isNaN(ratingValue)) {
const convertedRating = convertRatingTo100Scale(ratingValue);
const color = getColorForRating(convertedRating);
const colorSquare = document.createElement('div');
colorSquare.className = 'color-square';
colorSquare.style.backgroundColor = color;
colorSquare.textContent = `${convertedRating}`;
colorSquare.style.display = 'flex';
colorSquare.style.justifyContent = 'center';
colorSquare.style.alignItems = 'center';
if (selector === '.track_rating_avg') {
colorSquare.style.width = '20px';
colorSquare.style.height = '20px';
colorSquare.style.fontSize = '12px';
}
if (selector === '.disco_avg_rating') {
colorSquare.style.float = 'right';
colorSquare.style.marginTop = '7px';
colorSquare.style.marginLeft = '18px';
colorSquare.style.marginRight = '22px';
}
if (selector === '.newreleases_stat.newreleases_avg_rating_stat') {
colorSquare.style.marginRight = '24px';
}
if (selector === '.page_charts_section_charts_item_details_average_num') {
colorSquare.style.marginLeft = '13px';
colorSquare.style.marginRight = '13px';
}
if (selector === '.avg_rating' ||
selector === '.page_features_secondary_metadata_rating_final' ||
selector === '.page_charts_section_charts_item_details_average_num') {
colorSquare.style.width = '50px';
colorSquare.style.height = '50px';
colorSquare.style.fontSize = '25px';
}
el.parentNode.insertBefore(colorSquare, el.nextSibling);
el.style.display = 'none';
}
});
});
observer.disconnect();
}
GM_addStyle(`
.color-square {
width: 30px;
height: 30px;
padding: 2px 5px;
border-radius: 3px;
font-weight: bold;
font-size: 16px;
color: white;
display: flex;
justify-content: center;
align-items: center;
margin-right: 5px;
margin-bottom: 5px;
}
.color-square.red {
background-color: red;
}
.color-square.orange {
background-color: orange;
}
.color-square.green {
background-color: green;
}
.max_rating {
display:none;
}
`);
processRatingElements();
const observer = new MutationObserver(processRatingElements);
observer.observe(document.body, { childList: true, subtree: true });
})();