MAL Restore Rating

Restore MAL's old rating display

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         MAL Restore Rating
// @namespace    https://greasyfork.org/en/users/957127-supertouch
// @version      0.1
// @description  Restore MAL's old rating display
// @author       SuperTouch
// @match        https://myanimelist.net/manga/*
// @match        https://myanimelist.net/anime/*
// @match        https://myanimelist.net/reviews*
// @icon         https://cdn.myanimelist.net/images/favicon.ico
// @run-at       document-end
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
  'use strict';
  function createRatingElement(rating) {
    let html = `<div class="floatRightHeader"><a href="javascript:void(0);">Overall Rating</a>: ${rating}</div>`
    let template = document.createElement('template');
    html = html.trim();
    template.innerHTML = html;
    return template.content.firstChild;
  }

  const reviews = document.querySelectorAll('.review-element');
  reviews.forEach((reviewEl) => {
    const tags = reviewEl.querySelector('.tags');
    const rating = reviewEl.querySelector('.rating > .num').textContent;
    const ratingElement = createRatingElement(rating);
    tags.appendChild(ratingElement);
  })
})();