您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows the time left to get the ressources for the building
// ==UserScript== // @name DS time left for ressources // @version 0.6 // @description Shows the time left to get the ressources for the building // @author Me // @include https://de*.die-staemme.de/game.php?village=*&screen=main // @include https://de*.die-staemme.de/game.php?village=*&screen=snob // @require http://code.jquery.com/jquery-3.3.1.min.js // @namespace https://greasyfork.dpdns.org/users/264735 // @run-at document-idle // ==/UserScript== (function() { 'use strict'; var woodIs = $('#wood')[0].textContent; var stoneIs = $('#stone')[0].textContent; var ironIs = $('#iron')[0].textContent; var woodProduction = $('#wood').attr("title").split(" ")[2]; var stoneProduction = $('#stone').attr("title").split(" ")[2]; var ironProduction = $('#iron').attr("title").split(" ")[2]; $('.warn').each(function (){ var timeLeft = 0; if (this.classList.contains('cost_wood') || this.id == 'next_snob_cost_wood' || this.id == 'coin_cost_wood') { timeLeft = (this.textContent.replace('.', '') - woodIs) / woodProduction; } else if (this.classList.contains('cost_stone') || this.id == 'next_snob_cost_stone' || this.id == 'coin_cost_stone') { timeLeft = (this.textContent.replace('.', '') - stoneIs) / stoneProduction; } else if (this.classList.contains('cost_iron') || this.id == 'next_snob_cost_iron' || this.id == 'coin_cost_iron') { timeLeft = (this.textContent.replace('.', '') - ironIs) / ironProduction; } else { return; } var hours = Math.floor(timeLeft); var minutes = Math.round((timeLeft - hours) * 60); console.log(hours + ":" + minutes); this.append(" (" + hours + ":" + (("0" + minutes).slice(-2)) + ")"); }); })();