ChatGPT: Readability Styles for Engineers

Makes long, complicated, software-related chats much more readable.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         ChatGPT: Readability Styles for Engineers
// @namespace    zschuessler
// @version      1.0.3
// @description  Makes long, complicated, software-related chats much more readable.
// @author       [email protected]
// @license      Unlicense
// @match        https://chatgpt.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=chat.openai.com
// @grant        none
// ==/UserScript==

(function () {
    let domSelectors = {
        messageContainers: 'article.text-token-text-primary',
        messageCodeBlocks: 'article.w-full > div pre',
        messageParagraphs: 'article.w-full > div p, article.w-full > div ul p, article.w-full > div ol p, article.w-full > div ol ul li'
    }

    create_style_node_for_css(`
    :root {
      --user-chat-width: 80vw;
    }

    .w-full .mx-auto {
      width: 100vw;
      max-width: 100%;
      padding: 0;
    }

    article .prose {
      width: 80vw;
      max-width: 100%;
      margin: 0 auto;
    }

    article .prose > * {
      max-width: 750px;
    }

    article.w-full .prose > pre {
      width: 80vw;
      overflow: auto;
      max-width: 100%;
    }


    /***
    *Individual message divs:
    * - Now full width
    * - Reduces padding
    * - Forces scrollbar for extra-big code blocks
    */
    ${domSelectors.messageContainers} {
        min-width: 100%;
        padding: 2em 0 3.5em 0;
        overflow: hidden;
        border-bottom: 1px dashed #b2b2b2;
    }

    /**
     * Message paragraphs
     * Puts a max width on paragraphs while keeping the container full width
     * This achieves a more readable paragraph width but still allows full width code blocks
     *
    ${domSelectors.messageParagraphs} {
       max-width: 750px;
       margin: 0 0 15px 0;
    }*/

    /**
     * Message Code Blocks
     * Scales code blocks to be 100%, but never more than 80vw.
     * This makes code blocks infinitely more readable on all viewports.
     *
     ${domSelectors.messageCodeBlocks} {
        width: 80vw;
        overflow: auto;
        max-width: 100%;
      }*/

    /**
     * Force scrollbars
     * Necessary for large code blocks that need to avoid line wrapping
     /
     .w-full {
       overflow: hidden;
     }

   `);
})();

// Simple helper function to create the style tag
function create_style_node_for_css(cssStr) {
    let styleTag = document.createElement('style');
    styleTag.textContent = cssStr;

    let styleTagContainer = document.getElementsByTagName('head')[0]
        || document.body
        || document.documentElement;

    styleTagContainer.appendChild(styleTag);
}