您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds to games a quick reference of how many points you'll need to max out your remaining NP.
当前为
- // ==UserScript==
- // @name GC - Games Points til Max NP
- // @namespace https://greasyfork.org/en/users/1202961-13ulbasaur
- // @version 0.1
- // @description Adds to games a quick reference of how many points you'll need to max out your remaining NP.
- // @author You
- // @match https://www.grundos.cafe/games/html5/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe
- // @grant none
- // @license MIT
- // ==/UserScript==
- // Your code here...
- const gameInfo = document.querySelector('div.games-info div.bg-action')
- //Get the np per points info
- const npPerPoints = Number(gameInfo.querySelector('div:first-child span:first-child strong:nth-child(2)').textContent.replaceAll(/(?=NP).*/gi,'').replaceAll(',','').trim());
- //Get max NP
- const maxNP = Number(gameInfo.querySelector('div:nth-child(2) span:first-child strong:nth-child(2)').textContent.replaceAll(',','').trim());
- //Get the remaining NP to obtain
- const npRemaining = maxNP-Number(document.getElementById('np_earned').textContent.replaceAll('NP','').replaceAll(',','').trim());
- let pointsToEarn;
- if (npRemaining > 0) {
- //Points to get calculation:
- //Rounded up since I dont think any games have decimal point points.
- pointsToEarn = Math.ceil(npRemaining/npPerPoints)
- }
- else {
- pointsToEarn = 'All Done!'
- }
- gameInfo.querySelector('div:nth-child(2)').insertAdjacentHTML('beforebegin',`<span style='text-align:center'>Points to Max:<br><strong>${pointsToEarn}</strong></span>`)