IdlePixel Notes Panel

Adds a panel for storing semi-persistant notes

  1. // ==UserScript==
  2. // @name IdlePixel Notes Panel
  3. // @namespace lbtechnology.info
  4. // @version 1.2.1
  5. // @description Adds a panel for storing semi-persistant notes
  6. // @author Lux-Ferre
  7. // @license MIT
  8. // @match *://idle-pixel.com/login/play*
  9. // @grant none
  10. // @require https://greatest.deepsurf.us/scripts/441206-idlepixel/code/IdlePixel+.js?anticache=20220905
  11. // @require https://greatest.deepsurf.us/scripts/491983-idlepixel-plugin-paneller/code/IdlePixel%2B%20Plugin%20Paneller.js?anticache=20240410
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. class NotePanelPlugin extends IdlePixelPlusPlugin {
  18. constructor() {
  19. super("notespanel", {
  20. about: {
  21. name: GM_info.script.name,
  22. version: GM_info.script.version,
  23. author: GM_info.script.author,
  24. description: GM_info.script.description
  25. },
  26. });
  27. this.previous = "";
  28. }
  29.  
  30. createPanel(){
  31. IdlePixelPlus.addPanel("notes", "Notes", function() {
  32. let content = `<div>`
  33. content += `<br/>`
  34. content += `<form onsubmit='event.preventDefault(); IdlePixelPlus.plugins.notespanel.saveNotes()'>`
  35. content += `<textarea id="notes_box" maxlength="2000" style="width:100%;height:75%;background-color:rgb(25,25,25);color:rgb(255,255,255)"></textarea>`
  36. content += `<input type="submit" value="Save">`
  37. content += `</form>`
  38. content += `</div>`
  39. return content
  40. });
  41. }
  42.  
  43. onLogin(){
  44. this.createPanel()
  45.  
  46. Paneller.registerPanel("notes", "Notes")
  47. }
  48.  
  49. onPanelChanged(panelBefore, panelAfter){
  50. if (panelAfter==="notes"){
  51. const notes = localStorage.getItem("IPNotes")
  52. $("#notes_box").val(notes)
  53. }
  54. }
  55.  
  56. saveNotes(){
  57. const currentNotes = $("#notes_box").val()
  58. localStorage.setItem("IPNotes", currentNotes)
  59. }
  60. }
  61.  
  62. const plugin = new NotePanelPlugin();
  63. IdlePixelPlus.registerPlugin(plugin);
  64.  
  65. })();