Infinite Craft Autosave

Autosave script for Infinite Craft on neal.fun. Currently Neal has added autosave for elements but not discoveries; this script saves both.

目前為 2024-02-04 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Infinite Craft Autosave
// @namespace    http://ow0.me/infinite
// @version      4
// @description  Autosave script for Infinite Craft on neal.fun. Currently Neal has added autosave for elements but not discoveries; this script saves both.
// @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;
    }
    // save
    var nealsave = that.saveItems;
    that.saveItems = () => {
        nealsave();
        GM_setValue('elements', that.elements);
        GM_setValue('discoveries', that.discoveries);
        console.log('yuri saved');
    };
    console.log('yuri established');
}

window.addEventListener("load", yuri);