The english Tafseer
// Wait for game to load const waitForGame = setInterval(() => if (typeof window.first !== 'undefined' , 500);
// Initial scan for already discovered elements document.querySelectorAll('.element').forEach(el => const name = el.textContent?.trim(); if (name) discovered.add(name); );
// ==UserScript== // @name Infinite Craft Enhanced // @namespace http://tampermonkey.net/ // @version 1.0 // @description Recipe book, auto-learn, and quick craft for Infinite Craft // @author You // @match https://neal.fun/infinite-craft/ // @icon https://www.google.com/s2/favicons?sz=64&domain=neal.fun // @grant none // ==/UserScript== infinite craft userscript
// Auto-learn: repeatedly combine the newest discovered with everything async function autoLearn() autoLearnBtn.disabled = true; autoLearnBtn.textContent = '⏳ Learning...';
// Attach click handlers to rows document.querySelectorAll('.ic-recipe-row').forEach(row => row.addEventListener('click', (e) => const left = row.getAttribute('data-left'); const right = row.getAttribute('data-right'); if (left && right) autoCraft(left, right); e.stopPropagation(); ); ); // Wait for game to load const waitForGame
autoLearnBtn.addEventListener('click', autoLearn);
let html = '<table style="width:100%; border-collapse: collapse;">'; for (let [result, [left, right]] of recipes.entries()) html += ` <tr class="ic-recipe-row" data-left="$escapeHtml(left)" data-right="$escapeHtml(right)" style="border-bottom:1px solid #333; cursor:pointer;"> <td style="padding:6px 4px;">$escapeHtml(left)</td> <td style="padding:6px 4px;">+</td> <td style="padding:6px 4px;">$escapeHtml(right)</td> <td style="padding:6px 4px; color:#4caf50;">→ $escapeHtml(result)</td> </tr> `; html += '</table>'; recipeListDiv.innerHTML = html; if (typeof window.first !== 'undefined'
const recipeListDiv = document.getElementById('ic-recipe-list'); const recipesPanel = document.getElementById('ic-recipes-panel'); const toggleBtn = document.getElementById('ic-toggle-recipes'); const autoLearnBtn = document.getElementById('ic-auto-learn'); const clearPanelBtn = document.getElementById('ic-clear-panel');