您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Allows you to scale all ingredients to a set amount of a specific ingredient.
// ==UserScript== // @name DIY Soylent Scale to Ingredient // @version 0.0.1 // @namespace http://userscripts.psbarrett.com // @description Allows you to scale all ingredients to a set amount of a specific ingredient. // @include https://diy.soylent.com/recipes/* // @grant none // ==/UserScript== 'use strict' var amount_box_list = document.querySelectorAll('td.amount'); var unit_box_list = document.querySelectorAll('td.unit'); var name_box_list = document.querySelectorAll('td.name'); function click_handler_builder(amountb, unitsb, nameb) { return function() { var amount = amountb.getAttribute("data-amount"); var units = unitsb.textContent; var name = nameb.textContent; var new_amount = window.prompt( "How many <" + units + "> of <" + name + "> do you have?", amount) var scale_factor = Number(new_amount)/Number(amount); for (var box of amount_box_list) { var scaled_amount = Number(box.getAttribute("data-amount"))*scale_factor; box.textContent = Math.round(scaled_amount*100)/100; } } } for (var i in amount_box_list) { var amountb = amount_box_list[i]; var unitb = unit_box_list[i]; var nameb = name_box_list[i]; amountb.onclick = click_handler_builder(amountb, unitb, nameb); } console.log("Ingredient Scaling Enabled - Click to Scale");
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址