Perplexity Prompt Text Ensmallifier

Reduces size of prompt text and puts it in a box

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Perplexity Prompt Text Ensmallifier
// @namespace    Violentmonkey Scripts
// @match        *://www.perplexity.ai/*
// @grant        none
// @version      2.1
// @license MIT
// @description  Reduces size of prompt text and puts it in a box
// ==/UserScript==

(function() {
    'use strict';

    function detectPerplexityTheme() {
        const bgColor = getComputedStyle(document.body).backgroundColor;
        return bgColor.includes("0.96") || bgColor.includes("0.963") ? 'light' : 'dark';
    }

    function stylePromptHeading() {
        const elements = document.querySelectorAll('h1[class*="group/query"], div[class*="group/query"]');
        const theme = detectPerplexityTheme();

        elements.forEach(el => {
            if (!el.classList.contains('custom-styled')) {
                el.style.padding = '10px';
                el.style.margin = '10px 0';
                el.style.borderRadius = '8px';
                el.style.display = 'block';
                el.style.color = 'inherit';
                el.style.fontSize = '0.875rem'; // 14px
                el.style.fontWeight = '400';
                el.style.lineHeight = '1.1'; // Tighter spacing
                el.style.overflowWrap = 'break-word';

                if (theme === 'dark') {
                    el.style.border = '1.6px solid rgba(255, 255, 255, 0.3)';
                    el.style.background = 'rgba(255, 255, 255, 0.07)';
                } else {
                    el.style.border = '1.6px solid rgba(0, 0, 0, 0.2)'; // Darker gray border
                    el.style.background = 'rgba(0, 0, 0, 0.08)'; // **Stronger gray background**
                }

                el.classList.add('custom-styled');
            }
        });
    }

    // Run once on page load
    stylePromptHeading();

    // Detect Perplexity theme changes (only works on reload)
    const observer = new MutationObserver(() => stylePromptHeading());
    observer.observe(document.body, { childList: true, subtree: true });
})();