ChatGPT Privacy Blur

Blurs the font of the sidebar when the mouse is not hovering over it. So people won't read your history.

目前為 2023-04-18 提交的版本,檢視 最新版本

// ==UserScript==
// @name         ChatGPT Privacy Blur
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Blurs the font of the sidebar when the mouse is not hovering over it. So people won't read your history.
// @author       You
// @match        *://*.openai.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to apply the blur effect
    function applyBlur() {
        const sidebar = document.evaluate('//*[@id="__next"]/div[2]/div[1]/div/div/nav/div', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

        if (sidebar) {
            sidebar.style.filter = 'blur(3px)';
        }
    }

    // Function to remove the blur effect
    function removeBlur() {
        const sidebar = document.evaluate('//*[@id="__next"]/div[2]/div[1]/div/div/nav/div', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

        if (sidebar) {
            sidebar.style.filter = 'none';
        }
    }

    // Get the sidebar element
    const sidebar = document.evaluate('//*[@id="__next"]/div[2]/div[1]/div/div/nav/div', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

    if (sidebar) {
        // Apply the blur effect by default
        applyBlur();

        // Add event listeners to toggle the blur effect
        sidebar.addEventListener('mouseover', removeBlur);
        sidebar.addEventListener('mouseout', applyBlur);
    }
})();