数据隐私 - 隐藏您的历史记录

当鼠标没有悬停在侧边栏上时,模糊侧边栏的字体,从而向经过的同事隐藏信息

  1. // ==UserScript==
  2. // @name Data Privacy - hide your history from others
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description Blurs the font of the sidebar when the mouse is not hovering over it thus hiding information from collegues that are passing by
  6. // @author Dmytro G. (https://github.com/gerasy)
  7. // @match ://.openai.com/*
  8.  
  9. // @name:zh-CN 数据隐私 - 隐藏您的历史记录
  10. // @name:zh-SG 数据隐私 - 隐藏您的历史记录
  11. // @name:zh-TW 資料隱私 - 隱藏您的歷史記錄
  12. // @name:zh-HK 資料隱私 - 隱藏您的歷史記錄
  13. // @name:ja データプライバシー - 他人からの履歴の表示を隠す
  14. // @name:ko 데이터 개인정보 - 다른 사람에게 히스토리 숨기기
  15. // @name:ru Конфиденциальность данных - скройте свою историю от других
  16. // @name:de Datenschutz - Verbergen Sie Ihre Verlauf vor anderen
  17. // @name:es Privacidad de datos - oculta tu historial a los demás
  18. // @name:fr Confidentialité des données - masquer votre historique aux autres
  19. // @name:it Protezione dei dati - nascondi la tua cronologia agli altri
  20.  
  21.  
  22. // @description:zh-CN 当鼠标没有悬停在侧边栏上时,模糊侧边栏的字体,从而向经过的同事隐藏信息
  23. // @description:zh-SG 当鼠标没有悬停在侧边栏上时,模糊侧边栏的字体,从而向经过的同事隐藏信息
  24. // @description:zh-TW 當滑鼠未懸停在側邊欄時,將側邊欄字體模糊,以向經過的同事隱藏資訊
  25. // @description:zh-HK 當滑鼠未懸停在側邊欄時,將側邊欄字體模糊,以向經過的同事隱藏資訊
  26. // @description:ja マウスがサイドバーにカーソルを合わせていない場合、サイドバーのフォントをぼかすことで、通りすがりの同僚から情報を隠す
  27. // @description:ko 마우스가 사이드바에 호버하지 않으면 사이드바의 글꼴을 흐릿하게하여 동료들이 지나갈 때 정보를 숨깁니다.
  28. // @description:ru Размывает шрифт боковой панели, когда указатель мыши не наведен на нее, скрывая информацию от коллег, проходящих мимо
  29. // @description:de Macht die Schrift der Seitenleiste unscharf, wenn die Maus nicht darüber schwebt, und verbirgt so Informationen vor vorbeigehenden Kollegen
  30. // @description:es Desenfoca la fuente de la barra lateral cuando el mouse no está sobre ella, ocultando así información a los colegas que pasan
  31. // @description:fr Floute la police de la barre latérale lorsque la souris ne la survole pas, cachant ainsi les informations aux collègues qui passent
  32. // @description:it Sfoca il carattere della barra laterale quando il mouse non è sopra di esso, nascondendo così le informazioni ai colleghi che passano
  33.  
  34. // @author Dmytro G. (https://github.com/gerasy)
  35.  
  36. // @namespace http://tampermonkey.net/
  37. // @namespace:zh-CN http://tampermonkey.net/
  38. // @namespace:zh-SG http://tampermonkey.net/
  39. // @namespace:zh-TW http://tampermonkey.net/
  40. // @namespace:zh-HK http://tampermonkey.net/
  41. // @namespace:ja http://tampermonkey.net/
  42. // @namespace:ko http://tampermonkey.net/
  43. // @namespace:ru http://tampermonkey.net/
  44. // @namespace:de http://tampermonkey.net/
  45. // @namespace:es http://tampermonkey.net/
  46. // @namespace:fr http://tampermonkey.net/
  47. // @namespace:it http://tampermonkey.net/
  48.  
  49. // @license MIT
  50.  
  51. // @compatible chrome
  52. // @compatible firefox
  53. // @compatible opera
  54. // @compatible safari
  55. // @compatible edge
  56. // @compatible brave
  57. // @compatible vivaldi
  58. // @compatible uc
  59. // ==/UserScript==
  60.  
  61. (function() {
  62. 'use strict';
  63.  
  64. // Add CSS to the head of the document
  65. const style = document.createElement('style');
  66. style.innerHTML = `
  67. .blur-effect {
  68. filter: blur(3px);
  69. transition: filter 700ms ease-in-out 300ms;
  70. }
  71.  
  72. .blur-effect:hover {
  73. filter: none;
  74. transition: filter 700ms ease-in-out;
  75. }
  76. `;
  77. document.head.appendChild(style);
  78.  
  79. // Function to apply the blur effect
  80. function applyBlur(sidebar) {
  81. if (sidebar) {
  82. sidebar.classList.add('blur-effect');
  83. }
  84. }
  85.  
  86. // Function to remove the blur effect
  87. function removeBlur(sidebar) {
  88. if (sidebar) {
  89. sidebar.classList.remove('blur-effect');
  90. }
  91. }
  92.  
  93. // Function to add event listeners to toggle the blur effect
  94. function addListeners(sidebar) {
  95. if (sidebar) {
  96. // Apply the blur effect by default
  97. applyBlur(sidebar);
  98.  
  99. // Add event listeners to toggle the blur effect
  100. sidebar.addEventListener('mouseover', () => removeBlur(sidebar));
  101. sidebar.addEventListener('mouseout', () => applyBlur(sidebar));
  102. }
  103. }
  104.  
  105. // Get the sidebar element
  106. const sidebarXPath = '/html/body/div[1]/div[2]/div[1]/div/div/nav/div';
  107. const sidebar = document.evaluate(sidebarXPath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  108.  
  109. // Apply listeners to the current sidebar
  110. addListeners(sidebar);
  111.  
  112. // Observe changes in the DOM to handle dynamic content
  113. const observer = new MutationObserver((mutations) => {
  114. for (const mutation of mutations) {
  115. if (mutation.type === 'childList') {
  116. const newSidebar = document.evaluate(sidebarXPath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  117. addListeners(newSidebar);
  118. }
  119. }
  120. });
  121.  
  122. observer.observe(document.body, { childList: true, subtree: true });
  123. })();