您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds indication if you were the first to get a recipe in infinite craft
当前为
// ==UserScript== // @name IC Recipe Discoveries // @namespace http://tampermonkey.net/ // @version 1.5 // @license MIT // @description Adds indication if you were the first to get a recipe in infinite craft // @icon https://i.imgur.com/WlkWOkU.png // @author @activetutorial on discord // @match https://neal.fun/infinite-craft/ // @run-at document-end // @grant none // ==/UserScript== (function () { 'use strict'; function waitForNuxt() { if (window.$nuxt && window.$nuxt.$root && window.$nuxt.$root.$children[1] && window.$nuxt.$root.$children[1].$children[0]) { const ogGCR = window.$nuxt.$root.$children[1].$children[0].$children[0].getCraftResponse; window.$nuxt.$root.$children[1].$children[0].$children[0].getCraftResponse = async function () { const firstRecipe = await testRecipe(arguments[0].text, arguments[1].text); var thething = await ogGCR.apply(this, arguments); var recheck = false; if (thething.result == 'Nothing'){ recheck = await testRecipe(arguments[0].text, arguments[1].text); // Recheck for 'Nothing' edge case } thething.recipeNew = firstRecipe && !recheck; // true if it didn't exist before crafting, and is either not 'Nothing' or if it created the recipe to exist. thething.acctuallyNothing = !(recheck === false); return Promise.resolve(thething); }; } else { setTimeout(waitForNuxt, 100); } } // Start checking for $nuxt initialization waitForNuxt(); async function testRecipe(first, second) { // Tests if recipe exists try { [first, second] = [first, second].map((s) => s.toLowerCase().replace(/(^|\s)\S/g, (match) => match.toUpperCase()) // Make it Neal Case ); const response = await fetch( `https://neal.fun/api/infinite-craft/check?first=${first}&second=${second}&result=Nothing` ); if (response.status === 500) return true; // Response code 500 means the recipe doesn't exist return false; } catch { return undefined; } } })();