hega notepad

Simple notepad for Hidden Empire - Galaxy Adventures. Toggle by clicking the second separator in the right menu (above the "interactive radar" or profile pic).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         hega notepad
// @name:de      hega notizen
// @namespace    http://tampermonkey.net/
// @version      0.2.2
// @description  Simple notepad for Hidden Empire - Galaxy Adventures. Toggle by clicking the second separator in the right menu (above the "interactive radar" or profile pic).
// @description:de Einfaches Notizfeld für Hidden Empire - Galaxy Adventures. An-/Ausschalten über klick auf den zweiten Separator im rechten Menü (über dem "interaktiven Radar" oder Profilbild).
// @author       holycrumb
// @license      MIT
// @match        https://scarif.hiddenempire.de/game.php
// @icon         https://www.google.com/s2/favicons?sz=64&domain=hiddenempire.de
// @grant        none
// ==/UserScript==
'use strict';
let ogNode;

window.addEventListener("load", function(){
    console.log("notepad load called");

    document.querySelectorAll(".mright .sidebar-nohover")[1].onclick = toggleNotepad;

    if (localData.getStatus()){
        localData.setStatus(0);
        toggleNotepad();
    }
});

const localData = {
    getStatus: () => {
        let status = parseInt(localStorage.getItem("localNoteStatus"), 10);
        if (isNaN(status)){
            localStorage.setItem("localNoteStatus", status = 0);
            console.log("localNoteStatus created: " + status);
        }
        return status;
    },
    setStatus: (status) => {
        localStorage.setItem("localNoteStatus", status);
    },
    getNote: () => {
        let note = localStorage.getItem("localNote");
        if (note == null){
            note = "Your notes here!";
            localStorage.setItem("localNote", note);
        }
        return note;
    },
    setNote: (note) => {
        localStorage.setItem("localNote", note);
    }
}

function toggleNotepad(){
    if (!localData.getStatus()){
        ogNode = $(".txt_c.heMenuInfo").children();

        let notepad = $('<textarea id="notepad" style="width: 95%" rows="10" cols="16" spellcheck="false"></textarea>');
        $(".txt_c.heMenuInfo").children().replaceWith(notepad);

        notepad.val(localData.getNote());
        notepad.on("input", () => {
            localData.setNote(notepad.val());
        });
        localData.setStatus(1);
    }
    else{
        $(".txt_c.heMenuInfo").children().replaceWith(ogNode);
        localData.setStatus(0);
    }
}