Infinite Craft Helper - Made by ChatGPT

Adds helpful features to Infinite Craft.

目前為 2024-12-23 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Infinite Craft Helper - Made by ChatGPT
// @namespace    https://chat.openai.com/
// @version      2.1
// @description  Adds helpful features to Infinite Craft.
// @author       ChatGPT
// @match        https://neal.fun/infinite-craft/
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Add "Made by ChatGPT" attribution to the page
    const chatGPTAttribution = document.createElement('div');
    chatGPTAttribution.innerText = "Made by ChatGPT";
    chatGPTAttribution.style.position = 'fixed';
    chatGPTAttribution.style.bottom = '10px';
    chatGPTAttribution.style.left = '10px';
    chatGPTAttribution.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
    chatGPTAttribution.style.color = 'white';
    chatGPTAttribution.style.padding = '5px 10px';
    chatGPTAttribution.style.borderRadius = '5px';
    chatGPTAttribution.style.fontFamily = 'Arial, sans-serif';
    chatGPTAttribution.style.fontSize = '12px';
    chatGPTAttribution.style.zIndex = '1000';
    document.body.appendChild(chatGPTAttribution);

    // Feature: Quick access to random element
    const randomButton = document.createElement('button');
    randomButton.innerText = 'Random Element';
    randomButton.style.position = 'fixed';
    randomButton.style.bottom = '50px';
    randomButton.style.left = '10px';
    randomButton.style.backgroundColor = '#007BFF';
    randomButton.style.color = 'white';
    randomButton.style.border = 'none';
    randomButton.style.padding = '10px';
    randomButton.style.borderRadius = '5px';
    randomButton.style.cursor = 'pointer';
    randomButton.style.fontFamily = 'Arial, sans-serif';
    randomButton.style.fontSize = '14px';
    randomButton.style.zIndex = '1000';
    randomButton.addEventListener('click', () => {
        const elements = Array.from(document.querySelectorAll('.element'));
        if (elements.length > 0) {
            const randomElement = elements[Math.floor(Math.random() * elements.length)];
            randomElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
            randomElement.classList.add('highlight');
            setTimeout(() => randomElement.classList.remove('highlight'), 1000);
        } else {
            alert('No elements found!');
        }
    });
    document.body.appendChild(randomButton);

    // Feature: Element lookup with input
    const lookupDiv = document.createElement('div');
    lookupDiv.style.position = 'fixed';
    lookupDiv.style.bottom = '90px';
    lookupDiv.style.left = '10px';
    lookupDiv.style.backgroundColor = '#6C757D';
    lookupDiv.style.color = 'white';
    lookupDiv.style.padding = '10px';
    lookupDiv.style.borderRadius = '5px';
    lookupDiv.style.fontFamily = 'Arial, sans-serif';
    lookupDiv.style.zIndex = '1000';

    const inputField = document.createElement('input');
    inputField.type = 'text';
    inputField.placeholder = 'Enter element name';
    inputField.style.marginRight = '10px';
    inputField.style.padding = '5px';
    inputField.style.border = 'none';
    inputField.style.borderRadius = '3px';

    const lookupButton = document.createElement('button');
    lookupButton.innerText = 'Lookup';
    lookupButton.style.backgroundColor = '#28A745';
    lookupButton.style.color = 'white';
    lookupButton.style.border = 'none';
    lookupButton.style.padding = '5px 10px';
    lookupButton.style.borderRadius = '3px';
    lookupButton.style.cursor = 'pointer';

    lookupButton.addEventListener('click', () => {
        const elementName = inputField.value.trim();
        if (elementName) {
            const url = `https://infinibrowser.wiki/item/${encodeURIComponent(elementName)}`;
            fetch(url, { method: 'HEAD' })
                .then(response => {
                    if (response.ok) {
                        window.open(url, '_blank');
                    } else {
                        alert('Element not in infinibrowser!');
                    }
                })
                .catch(() => {
                    alert('Element not in infinibrowser!');
                });
        } else {
            alert('Please enter an element name.');
        }
    });

    lookupDiv.appendChild(inputField);
    lookupDiv.appendChild(lookupButton);
    document.body.appendChild(lookupDiv);

    // Highlight style for random element
    const highlightStyle = document.createElement('style');
    highlightStyle.innerText = `
        .highlight {
            outline: 3px solid #FF0000;
            transition: outline 0.5s ease-out;
        }
    `;
    document.head.appendChild(highlightStyle);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址