Greasy Fork 还支持 简体中文。

MyAnimeList(MAL) - Average Friends Score

Display next to the MAL score, the average score of your friends

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         MyAnimeList(MAL) - Average Friends Score
// @version      1.0.11
// @description  Display next to the MAL score, the average score of your friends
// @author       Cpt_mathix
// @match        https://myanimelist.net/anime/*
// @match        https://myanimelist.net/manga/*
// @match        https://myanimelist.net/anime.php?*
// @match        https://myanimelist.net/manga.php?*
// @exclude      /^https?:\/\/myanimelist\.net\/(anime|manga)\/[^0-9]+/
// @license      GPL-2.0-or-later
// @grant        none
// @namespace https://greasyfork.org/users/16080
// ==/UserScript==

(function($) {
    var url = document.querySelector("#horiznav_nav > ul > li > a").href.match(/(^https?:\/\/myanimelist\.net\/(anime|manga)\/\d+\/?[^\/?]*)/)[1];

    $.get(url + '/stats', function(data) {
    	var elements = $($.parseHTML(data)).find('table.table-recently-updated > tbody > tr:nth-child(n) > td:nth-child(2)').not('.borderClass.fw-b.ac');

    	var sum = 0;
    	var count = 0;
    	$(elements).each( function() {
    		var score = $(this).text();
    		if(!isNaN(score)) {
    			sum += parseInt(score);
    			count += 1;
    		}
    	});

    	var averageScore;
    	if (sum > 0) {
    		averageScore = (sum/count).toPrecision(3);
    	} else {
    		averageScore = '-';
    	}

        $('#content div > h2').each( function() {
            if ($(this).text().trim() === "Statistics") {
                var friendScoreAnchor = $(this).next();

                var newElement = document.createElement('div');
                $(newElement).html('<span class="dark_text">Friend Score:</span> ' + averageScore);
                $(newElement).addClass('spaceit_pad');

                $(newElement).insertAfter(friendScoreAnchor);
                $(friendScoreAnchor).addClass('spaceit_pad');
            }
        });
    });
})(jQuery);