Mistral Chat responsive + customizations

Mistral Chat website is more suitable for wide screens.

Version au 02/01/2025. Voir la dernière version.

Vous devrez installer une extension telle que Tampermonkey, Greasemonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Userscripts pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension de gestionnaire de script utilisateur pour installer ce script.

(J'ai déjà un gestionnaire de scripts utilisateur, laissez-moi l'installer !)

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

(J'ai déjà un gestionnaire de style utilisateur, laissez-moi l'installer!)

/* ==UserStyle==
@name           Mistral Chat responsive + customizations
@version        1.0.2
@description    Mistral Chat website is more suitable for wide screens.
@author         BreatFR (https://breat.fr)
@namespace      https://gitlab.com/breatfr
@homepageURL    https://gitlab.com/breatfr/mistral-chat
@supportURL     https://discord.gg/Q8KSHzdBxs
@license        AGPL-3.0-or-later; https://www.gnu.org/licenses/agpl-3.0.txt
@preprocessor   stylus

@var    checkbox    darkmode    "Better dark mode"                      1
@var    checkbox    avatar      "Custom avatar"                         1
@var    text        avatarurl   "Custom avatar URL"                     "URL between quotes"
@var    text        fontsize    "Custom font size"                      1.2rem
@var    checkbox    hidelinks   "Hide install and support links mode"   0
@var    checkbox    widemode    "Wide mode"                             1
==/UserStyle== */

/* === Credits ===
Website         https://breat.fr
facebook        https://www.facebook.com/breatfroff
mastodon        https://mastodon.social/@breat_fr
telegram        https://t.me/breatfr
vk              https://vk.com/breatfroff
X (twitter)     https://x.com/breatfroff
=== Credits === */

@-moz-document domain("chat.mistral.ai") {
    /* Theme */
    /* Versions */
    :root {
        --themeversion: 'Theme v1.0.2 by BreatFR (https://breat.fr)';
        --install1: ' usercssjs.breat.fr \A';
        --install2: ' gitlab.com/breatfr/cici \A \A';
        --support1: ' ko-fi.com/breatfr \A';
        --support2: ' paypal.me/breat';
    }

    @media (min-width: 900px) {
        [data-sidebar="trigger"]::after {
            background: linear-gradient(88.55deg, rgb(139, 109, 255) 22.43%, rgb(254, 132, 132) 92.28%);
            background-clip: text;
            -webkit-background-clip: text;
            color: transparent;
            content: var(--themeversion);
            display: block;
            font-family: ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
            font-size: 1.2rem;
            left: 50%;
            line-height: 1.5;
            max-width: max-content;
            pointer-events: none;
            position: fixed;
            text-align: center;
            top: .75em;
            transform: translateX(-25%);
            width: 100%;
            white-space: wrap;
        }
    }
    
    [data-state="expanded"] [data-sidebar="sidebar"]::after {
        background: linear-gradient(88.55deg, rgb(139, 109, 255) 22.43%, rgb(254, 132, 132) 92.28%);
        background-clip: text;
        -webkit-background-clip: text;
        bottom: 1em;
        color: transparent;
        content: 'Install: \A' url("https://gitlab.com/breatfr/kindroid/-/raw/main/images/icon_breat.fr.png") var(--install1) url("https://gitlab.com/breatfr/kindroid/-/raw/main/images/icon_gitlab.png") var(--install2) 'Support me: \A' url("https://gitlab.com/breatfr/kindroid/-/raw/main/images/icon_ko-fi.png") var(--support1) url("https://gitlab.com/breatfr/kindroid/-/raw/main/images/icon_paypal.png") var(--support2);
        display: block;
        font-family: ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
        font-size: 1.2rem;
        left: 0;
        line-height: 1.5;
        max-width: 256px;
        pointer-events: none;
        position: fixed;
        text-align: center;
        width: 100%;
        white-space: pre-line;
    }

    if hidelinks {
        [data-state="expanded"] [data-sidebar="sidebar"]::after {
            display: none;
        }
    }
    
    /* Custom font size */
    .prose,
    code,
    textarea,
    .max-w-screen-md:has(textarea) button {
        font-size: fontsize !important;
        line-height: 1.5 !important;
    }
    textarea.py-2 {
        min-height: max-content !important;
    }
    
    if avatar {
        [data-sidebar="header"] button:nth-of-type(1) > div:nth-of-type(1) {
            background: transparent;
            color: transparent;
        }
        [class="group relative flex w-full gap-3"] > span > span {
            display: none;
        }
        [data-sidebar="menu-button"] > div:nth-of-type(1):before,
        [class="group relative flex w-full gap-3"] > span:before {
            background: url(avatarurl) no-repeat center center / cover;
            border-radius: 50%;
            content: "";
            display: inline-block;
            height: 32px;
            width: 32px;
        }
    }
    
    if chatmode {
        [class="group relative flex w-full gap-3"] > span {
            order: 2;
        }
        [class="group relative flex w-full gap-3"] > div {
            order: 1;
        }
        [class="group relative flex w-full gap-3"] {
            align-self: flex-end !important;
            justify-content: flex-end !important;
            max-width: 80% !important;
        }
        [class="group relative flex w-full gap-3"] * {
            justify-content: flex-end !important;
            margin-left: auto !important;
        }
        [class="group flex w-full gap-3"] > div {
            max-width: 80%;
        }
        
        [class="group flex w-full gap-3"] {
            border-bottom: 1px solid rgba(255, 149, 0, 0.4);
            border-top: 1px solid rgba(255, 149, 0, 0.4);
            margin-bottom: 28px;
            padding-top: 28px;
        }
        [class="group flex w-full gap-3"]:last-child {
            border-bottom: 0;
            border-top: 1px solid rgba(255, 149, 0, 0.4);
        }
    }
    
    if darkmode {
        .dark,
        .light {
            --background: 240 5.9% 10%;
            --secondary-200: 240 5.9% 10%;
            --sidebar-background: 0 0% 5%;
        }
        
        .shadow-lg:not([data-radix-popper-content-wrapper] > div) {
            box-shadow: rgba(255, 149, 0, 0.4) -2px -2px 2px 2px,
                        rgba(255, 149, 0, 0.4) -2px 2px 2px 2px,
                        rgba(255, 69, 0, 0.4) 2px -2px 2px 2px,
                        rgba(255, 69, 0, 0.4) 2px 2px 2px 2px;
        }
        
        .data-\\[state\\=open\\]\\:hover\\:bg-sidebar-accent:hover[data-state=open],
        .dark\\:hover\\:bg-secondary-200:hover:is(.dark *),
        .hover\\:bg-secondary-200:hover,
        .hover\\:text-sidebar-accent-foreground:hover {
            background-color: rgba(255, 149, 0, 0.2);
        }
    }
    
    if widemode {
        .max-w-screen-md {
            max-width: 100%;
        }
        .max-w-screen-md:has(textarea) {
            max-width: 100%;
            padding: 20px;
        }
        
        /* Avatars */
        .h-7 {
            height: 32px;
        }
        .w-7 {
            width: 32px;
        }
    }
}