Infinite Craft Autosave - Deprecated

Autosave script for Infinite Craft on neal.fun. Edit: Neal has added autosave for both elements and discoveries, if you have crafted a new item after then and the thing saved you do not need to use this script anymore. However, to save discoveries made before the change, you need to download the current version (2727) and reload the page once.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Infinite Craft Autosave - Deprecated
// @namespace    http://ow0.me/infinite
// @version      2727
// @description  Autosave script for Infinite Craft on neal.fun. Edit: Neal has added autosave for both elements and discoveries, if you have crafted a new item after then and the thing saved you do not need to use this script anymore. However, to save discoveries made before the change, you need to download the current version (2727) and reload the page once.
// @author       Ina'
// @match        https://neal.fun/*
// @icon         https://ow0.me/infinite/icon48.png
// @icon64       https://ow0.me/infinite/icon64.png
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        unsafeWindow
// @require      https://neal.fun/_nuxt/992eef7.js
// @require      https://neal.fun/_nuxt/dcc1889.js
// @run-at       document-idle
// @license      GPLv3
// ==/UserScript==

// note - the icon may be moved to n-o.one

var yuri = () => {
    'use strict';
    console.log('establishing yuri');
    var that = unsafeWindow.$nuxt.$children[2].$children[0].$children[0];
    // load
    var savedElements = GM_getValue("elements", null);
    if (savedElements !== null) {
        that.elements = savedElements;
    }
    var savedDiscoveries = GM_getValue("discoveries", null);
    if (savedDiscoveries !== null) {
        that.discoveries = savedDiscoveries;
    }
    that.elements.forEach((x) => {
        if (that.discoveries.includes(x.text)) {
            x.discovered = true;
        }
    });
    // save
    var nealsave = that.saveItems;
    
    that.saveItems = () => {
        nealsave();
        GM_setValue('elements', that.elements);
        GM_setValue('discoveries', that.discoveries);
        console.log('yuri saved');
    };
    
    that.saveItems();
    console.log('yuri established');
}

window.addEventListener("load", yuri);