IdlePixel Notes Panel

Adds a panel for storing semi-persistant notes

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         IdlePixel Notes Panel
// @namespace    lbtechnology.info
// @version      1.2.1
// @description  Adds a panel for storing semi-persistant notes
// @author       Lux-Ferre
// @license      MIT
// @match        *://idle-pixel.com/login/play*
// @grant        none
// @require      https://greatest.deepsurf.us/scripts/441206-idlepixel/code/IdlePixel+.js?anticache=20220905
// @require		 https://greatest.deepsurf.us/scripts/491983-idlepixel-plugin-paneller/code/IdlePixel%2B%20Plugin%20Paneller.js?anticache=20240410
// ==/UserScript==

(function() {
    'use strict';

    class NotePanelPlugin extends IdlePixelPlusPlugin {
        constructor() {
            super("notespanel", {
                about: {
                    name: GM_info.script.name,
                    version: GM_info.script.version,
                    author: GM_info.script.author,
                    description: GM_info.script.description
                },
            });
            this.previous = "";
        }

    	createPanel(){
            IdlePixelPlus.addPanel("notes", "Notes", function() {
                let content = `<div>`
                content += `<br/>`
                content += `<form onsubmit='event.preventDefault(); IdlePixelPlus.plugins.notespanel.saveNotes()'>`
                content += `<textarea id="notes_box" maxlength="2000" style="width:100%;height:75%;background-color:rgb(25,25,25);color:rgb(255,255,255)"></textarea>`
                content += `<input type="submit" value="Save">`
                content += `</form>`
                content += `</div>`
                return content
            });
        }

    	onLogin(){
            this.createPanel()

			Paneller.registerPanel("notes", "Notes")
    	}

		onPanelChanged(panelBefore, panelAfter){
			if (panelAfter==="notes"){
				const notes = localStorage.getItem("IPNotes")
				$("#notes_box").val(notes)
			}
		}

    	saveNotes(){
            const currentNotes = $("#notes_box").val()
        	localStorage.setItem("IPNotes", currentNotes)
        }
    }

    const plugin = new NotePanelPlugin();
    IdlePixelPlus.registerPlugin(plugin);

})();