ChatGPT ToDo List

A small, modern TO DO list for dang ChatGPT

  1. // ==UserScript==
  2. // @name ChatGPT ToDo List
  3. // @namespace https://your.namespace.com
  4. // @version 0.7
  5. // @description A small, modern TO DO list for dang ChatGPT
  6. // @author Emree.el on instagram :)
  7. // @match https://chatgpt.com/*
  8. // @grant GM_setValue
  9. // @grant GM_getValue
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Adds a funny little checkbox to the top right corner
  17. const checkbox = document.createElement('input');
  18. checkbox.type = 'checkbox';
  19. checkbox.style.position = 'fixed';
  20. checkbox.style.top = '10px';
  21. checkbox.style.right = '10px';
  22. document.body.appendChild(checkbox);
  23.  
  24. // Function to show/hide the panel based on checkbox state
  25. function togglePanel() {
  26. const panel = document.getElementById('custom-panel');
  27. if (checkbox.checked) {
  28. panel.style.display = 'block';
  29. } else {
  30. panel.style.display = 'none';
  31. }
  32. }
  33.  
  34. checkbox.addEventListener('change', togglePanel);
  35.  
  36. // Create the panel... lol
  37. const panel = document.createElement('div');
  38. panel.id = 'custom-panel';
  39. panel.style.position = 'fixed';
  40. panel.style.top = '50px';
  41. panel.style.right = '10px';
  42. panel.style.width = '200px';
  43. panel.style.height = '300px';
  44. panel.style.overflowY = 'auto'; // Changed from overflowX to overflowY
  45. panel.style.display = 'none';
  46. panel.style.border = '1px solid #171717'; // Set border color
  47. panel.style.background = '#171717'; // Set background color
  48. document.body.appendChild(panel);
  49.  
  50. // Retrieve stored text from storage
  51. function retrieveStoredTexts() {
  52. const storedTexts = JSON.parse(GM_getValue('storedTexts', '[]'));
  53. const uniqueTexts = new Set(storedTexts);
  54. uniqueTexts.forEach(text => {
  55. const newText = document.createElement('div');
  56. newText.textContent = text;
  57. panel.prepend(newText);
  58. const deleteButton = document.createElement('button'); // Moved delete button creation here
  59. deleteButton.textContent = 'Delete';
  60. deleteButton.style.marginLeft = '5px';
  61. deleteButton.style.color = 'red'; // Set delete button text color to red
  62. deleteButton.addEventListener('click', function() {
  63. newText.remove();
  64. storedTexts.splice(storedTexts.indexOf(text), 1); // Remove text from stored texts
  65. GM_setValue('storedTexts', JSON.stringify(storedTexts)); // Update stored texts
  66. });
  67. newText.appendChild(deleteButton);
  68. });
  69. }
  70.  
  71. // Call the function to retrieve stored text
  72. retrieveStoredTexts();
  73.  
  74. // Create text input
  75. const textInput = document.createElement('input');
  76. textInput.type = 'text';
  77. textInput.placeholder = 'Enter text';
  78. textInput.style.background = '#212121'; // Set textbox color
  79. panel.appendChild(textInput);
  80.  
  81. // Function to add entered text to the panel
  82. function addText() {
  83. const text = textInput.value.trim();
  84. if (text !== '') {
  85. const newText = document.createElement('div');
  86. newText.textContent = text;
  87. panel.prepend(newText);
  88. const deleteButton = document.createElement('button'); // Moved delete button creation here
  89. deleteButton.textContent = 'Delete';
  90. deleteButton.style.marginLeft = '5px';
  91. deleteButton.style.color = 'red'; // Set delete button text color to red
  92. deleteButton.addEventListener('click', function() {
  93. newText.remove();
  94. storedTexts.splice(storedTexts.indexOf(text), 1); // Remove text from stored texts
  95. GM_setValue('storedTexts', JSON.stringify(storedTexts)); // Update stored texts
  96. });
  97. newText.appendChild(deleteButton);
  98. textInput.value = '';
  99. storeText(text); // Store text
  100. }
  101. }
  102.  
  103. // Function to store entered text in storage
  104. function storeText(text) {
  105. let storedTexts = JSON.parse(GM_getValue('storedTexts', '[]'));
  106. storedTexts.push(text); // Store text
  107. GM_setValue('storedTexts', JSON.stringify(storedTexts.filter(Boolean))); // Update stored texts, filter out empty strings
  108. }
  109.  
  110. // Add event listener to the text input to add text
  111. textInput.addEventListener('keydown', function(event) {
  112. if (event.keyCode === 13) {
  113. addText();
  114. }
  115. });
  116.  
  117. })();