DeepSeek AI Chat Manager

Adds a movable button to delete all chats and display the count of deleted chats. Works for both mobile and PC users.

  1. // ==UserScript==
  2. // @name DeepSeek AI Chat Manager
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description Adds a movable button to delete all chats and display the count of deleted chats. Works for both mobile and PC users.
  6. // @author Zensnx
  7. // @match *://*chat.deepseek.com/*
  8. // @license MIT
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Create the movable button container
  16. const buttonContainer = document.createElement('div');
  17. buttonContainer.style.position = 'fixed';
  18. buttonContainer.style.top = '20px';
  19. buttonContainer.style.right = '20px';
  20. buttonContainer.style.zIndex = '1000';
  21. buttonContainer.style.padding = '10px';
  22. buttonContainer.style.backgroundColor = '#f1f1f1';
  23. buttonContainer.style.border = '1px solid #ccc';
  24. buttonContainer.style.borderRadius = '5px';
  25. buttonContainer.style.boxShadow = '0 2px 5px rgba(0,0,0,0.2)';
  26. buttonContainer.style.cursor = 'move';
  27.  
  28. // Create the "Open" button
  29. const openButton = document.createElement('button');
  30. openButton.innerText = 'Open';
  31. openButton.style.marginRight = '10px';
  32. openButton.style.padding = '5px 10px';
  33. openButton.style.backgroundColor = '#4CAF50';
  34. openButton.style.color = 'white';
  35. openButton.style.border = 'none';
  36. openButton.style.borderRadius = '3px';
  37. openButton.style.cursor = 'pointer';
  38.  
  39. // Create the "Delete All Chats" button
  40. const deleteButton = document.createElement('button');
  41. deleteButton.innerText = 'Delete All Chats';
  42. deleteButton.style.padding = '5px 10px';
  43. deleteButton.style.backgroundColor = '#f44336';
  44. deleteButton.style.color = 'white';
  45. deleteButton.style.border = 'none';
  46. deleteButton.style.borderRadius = '3px';
  47. deleteButton.style.cursor = 'pointer';
  48.  
  49. // Create a counter display
  50. const counterDisplay = document.createElement('div');
  51. counterDisplay.style.marginTop = '10px';
  52. counterDisplay.style.fontSize = '14px';
  53. counterDisplay.style.color = '#333';
  54.  
  55. // Append elements to the container
  56. buttonContainer.appendChild(openButton);
  57. buttonContainer.appendChild(deleteButton);
  58. buttonContainer.appendChild(counterDisplay);
  59.  
  60. // Add the container to the body
  61. document.body.appendChild(buttonContainer);
  62.  
  63. // Make the container movable (for both mobile and PC)
  64. let isDragging = false;
  65. let offsetX, offsetY;
  66.  
  67. // PC: Mouse events
  68. buttonContainer.addEventListener('mousedown', (e) => {
  69. isDragging = true;
  70. offsetX = e.clientX - buttonContainer.getBoundingClientRect().left;
  71. offsetY = e.clientY - buttonContainer.getBoundingClientRect().top;
  72. });
  73.  
  74. document.addEventListener('mousemove', (e) => {
  75. if (isDragging) {
  76. buttonContainer.style.left = `${e.clientX - offsetX}px`;
  77. buttonContainer.style.top = `${e.clientY - offsetY}px`;
  78. }
  79. });
  80.  
  81. document.addEventListener('mouseup', () => {
  82. isDragging = false;
  83. });
  84.  
  85. // Mobile: Touch events
  86. buttonContainer.addEventListener('touchstart', (e) => {
  87. isDragging = true;
  88. const touch = e.touches[0];
  89. offsetX = touch.clientX - buttonContainer.getBoundingClientRect().left;
  90. offsetY = touch.clientY - buttonContainer.getBoundingClientRect().top;
  91. });
  92.  
  93. document.addEventListener('touchmove', (e) => {
  94. if (isDragging) {
  95. const touch = e.touches[0];
  96. buttonContainer.style.left = `${touch.clientX - offsetX}px`;
  97. buttonContainer.style.top = `${touch.clientY - offsetY}px`;
  98. }
  99. });
  100.  
  101. document.addEventListener('touchend', () => {
  102. isDragging = false;
  103. });
  104.  
  105. // Function to delete all chats
  106. deleteButton.addEventListener('click', () => {
  107. const chatElements = document.querySelectorAll('.chat-item'); // Adjust the selector based on the actual chat element class
  108. const chatCount = chatElements.length;
  109.  
  110. chatElements.forEach(chat => chat.remove());
  111.  
  112. counterDisplay.innerText = `${chatCount} chats deleted!`;
  113. });
  114.  
  115. // Open button functionality (you can customize this)
  116. openButton.addEventListener('click', () => {
  117. alert('Open button clicked!');
  118. });
  119. })();