Geoguessr PPS

Calculates your PPS on Geoguessr

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name           Geoguessr PPS
// @description    Calculates your PPS on Geoguessr
// @author         Octahedron
// @version        1.0.1
// @icon           http://tampermonkey.net/favicon.ico
// @match          https://geoguessr.com/results/*
// @include        https://www.geoguessr.com/results/*
// @grant          none
// @run-at         document-idle
// @require        https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.js
// @namespace https://greasyfork.org/users/824280
// ==/UserScript==

(function() {
    'use strict';

    setTimeout(function() {
        let scoreBoxes = document.getElementsByClassName("results-highscore__guess-cell-score");
        let timeBoxes = document.getElementsByClassName("results-highscore__guess-cell-details");
        let numPlayers = scoreBoxes.length / 6;
        for(let i = 5; i < scoreBoxes.length; i += 6) {
            let score = parseInt(scoreBoxes[i].innerText.replace(/,/g, ''));
            let time = parseInt(timeBoxes[i].innerText.substring(6).replace(/[^0-9]/g, ''));
            timeBoxes[i].innerText += `\n${(score/time).toFixed(2)} PPS`;
            console.log((score / time).toFixed(2));
        }
    }, 1500);

})();