您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a time estimation for the stock to be full
// ==UserScript== // @name World Contagion Stock Estimation // @namespace World Contagion // @include http://www.worldcontagion.com/contagion/* // @version 0.1 // @grant none // @description Adds a time estimation for the stock to be full // ==/UserScript== var elems = document.getElementsByClassName("help"); for(var i=0; i<3; i++) { var temp = elems[i].title; temp = temp.replace(/ /g,''); var x = temp.match(/\d+/g); elems[i].title += "<br />Stock plein dans " + getTimeBeforeFullStock(parseInt(x[1]),parseInt(x[4]),parseInt(x[5])); } function getTimeBeforeFullStock(hourlyProduction, actualStock, maxStock) { var prodPerMin = hourlyProduction/60; var minutes = 0; while(actualStock < maxStock) { actualStock += prodPerMin; minutes++; } if(minutes < 60) return minutes + " minutes"; else if(minutes < 1440) return Math.floor(minutes/60) + " heures " + minutes%60 + " minutes"; else return Math.floor(minutes/1440) + " jours " + Math.floor((minutes%1440)/60) + " heures " + minutes%60 + " minutes"; }