Mistral responsive + customizations

Mistral website is more suitable for wide screens.

Από την 06/02/2025. Δείτε την τελευταία έκδοση.

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

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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.

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

/* ==UserStyle==
@name           Mistral responsive + customizations
@version        1.0.13
@description    Mistral website is more suitable for wide screens.
@author         BreatFR (https://breat.fr)
@namespace      https://gitlab.com/breatfr
@homepageURL    https://gitlab.com/breatfr/mistral
@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    chatmode                "Chat mode"                             1
@var    checkbox    avatar                  "Custom avatar for us"                  0
@var    text        avatarurl               "Custom avatar URL"                     "URL between quotes"
@var    checkbox    cmmistralavatar         "Custom Mistral avatar"                 0
@var    text        cmmistralavatarurl      "Custom Mistral avatar URL"             "URL between quotes"
@var    text        cmmistralavatarsize     "Custom Mistral avatar size"            calc(100vh - 46px - 155px - 1rem)
@var    text        cmmistralavatarcorner   "Custom Mistral avatar corner"          50%
@var    text        fontsize                "Custom font size"                      1.2rem
@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") {
    /* Mistral Chat */
    /* Versions */
    :root {
        --themeversion: 'Theme v1.0.13 by BreatFR (https://breat.fr)';
        --install1: ' usercssjs.breat.fr \A';
        --install2: ' gitlab.com/breatfr/mistral \A \A';
        --support1: ' ko-fi.com/breatfr \A';
        --support2: ' paypal.me/breat';
    }

    @media (min-width: 900px) {
        main main::after {
            background: linear-gradient(88.55deg, rgb(253, 73, 2) 22.43%, rgb(254, 206, 0) 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: absolute;
            text-align: center;
            top: .5em;
            transform: translateX(-50%);
            width: 100%;
            white-space: wrap;
        }
    }
    
    [data-state="expanded"] [data-sidebar="sidebar"]::after,
    [data-mobile="true"][data-sidebar="sidebar"]::after {
        background: linear-gradient(88.55deg, rgb(253, 73, 2) 22.43%, rgb(254, 206, 0) 92.28%);
        background-clip: text;
        -webkit-background-clip: text;
        bottom: 4em;
        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;
    }
    
    body {
        max-height: 100vh;
        overflow: hidden;
    }
    
    /* 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 > div:nth-of-type(1) {
            background: transparent;
            color: transparent;
        }
        [class="group relative flex w-full gap-3"] > span > span {
            display: none;
        }
        [data-sidebar="header"] button:nth-of-type(1) > div > 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 cmmistralavatar {
        [class="flex h-full w-full flex-1 flex-col items-center justify-center gap-5"] > div:nth-of-type(3) {
            bottom: 0;
            max-width: 100%;
            position: absolute;
            top: auto !important;
        }
        
        [class="mb-40 flex flex-col items-stretch"] svg {
            aspect-ratio: 1 / 1;
            background: url(cmmistralavatarurl) no-repeat center center / cover;
            border-radius: cmmistralavatarcorner;
            height: 0;
            margin: 0 auto;
            padding-left: cmmistralavatarsize;
            padding-top: cmmistralavatarsize;
            width: 0;
        }
        [class="group flex w-full gap-3"] > span > svg {
            aspect-ratio: 1 / 1;
            background: url(cmmistralavatarurl) no-repeat center center / cover;
            border-radius: 50%;
            height: 0;
            padding-left: 32px;
            padding-top: 32px;
            width: 0;
        }
    }
    
    if chatmode {        
        body,
        [class="flex h-fit w-full flex-col gap-4"] {
            overflow-x: hidden;
        }
        [class="flex h-fit w-full flex-col gap-4"] > div {
            max-width: 80%;
        }
        code[style*="white-space: pre"],
        code[style*="white-space:pre"] {
            white-space: break-spaces !important;
        }
        
        [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 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"] > div > div:not(:only-child) {
            width: auto;
        }
    }
    
    if darkmode {
        .dark,
        .light {
            --background-primary: 240 7% 18%;
            --background-secondary: 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;
        }
    
        /* Mistral logo/avatar */
        [class="group flex w-full gap-3"] > span > svg {
            height: 32px;
            margin-bottom: 0;
            width: 32px;
        }
        
        ::selection,
        .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) !important;
        }
        
        [class="group relative flex w-full gap-3"] > div > div:nth-of-type(1) {
            background: rgba(50, 50, 50, 0.85);
            border-radius: 1.5rem;
            padding: .625rem 1.25rem .625rem 1.25rem !important;
        }
        
        code[node="[object Object]"] {
            background-color: rgba(203, 203, 203, 0.2) !important;
            border-radius: 12px !important;
            padding: .1em .5em!important;
        }
        
        /* Scroll down icon */
        svg.lucide-arrow-down path {
            stroke: rgb(255, 69, 0);
        }
        
        /* Links */
        .prose a {
            color: hsl(25, 88%, 51%);
        }
    }
    
    if widemode {
        .max-w-screen-md {
            max-width: 100%;
        }
        .max-h-\\[300px\\]:has(textarea) {
            max-height: 50vh !important;
        }
        .max-w-screen-md:has(textarea) {
            padding: 1em 1.75em;
        }
        
        /* Avatars */
        .h-7 {
            height: 32px;
        }
        .w-7 {
            width: 32px;
        }
        
        body:has(iframe[sandbox="allow-scripts allow-same-origin"]) {
            .cm-content {
                flex-shrink: 1;
            }
            .cm-line {
                white-space: wrap;
                width: 100% !important;
            }
        }
        
        /* Generated images */
        [class="group flex w-full gap-3"] > div:nth-of-type(2) p:has(img) {
            margin-left: auto;
            margin-right: auto;
        }
        
        /* Scroll down icon */
        button:has(svg.lucide-arrow-down) {
            height: 40px;
            width: 40px;
        }
        svg.lucide-arrow-down path {
            stroke: rgb(255, 69, 0);
        }
        
        /* Small space between date and edit button */
        [aria-label="Edit question"] {
            margin-left: 1em !important;
        }
        
        /* Search box */
        div[role="dialog"]:has(label) {
            max-height: 80%;
            max-width: 80%;
        }
        div[role="dialog"]:has(label) input:hover {
            box-shadow: none;
        }
    }
}

@-moz-document domain("console.mistral.ai") {
    /* Mistral Console */
    button[class*="flex w-full items-center gap-3 rounded px-3 py-2"] > div:nth-of-type(1),
    .user-initials {
        background: transparent !important;
        color: transparent;
    }
    button[class*="flex w-full items-center gap-3 rounded px-3 py-2"] > div:nth-of-type(1)::before,
    .user-initials::before {
        background: url(avatarurl) no-repeat center center / cover;
        border-radius: 50%;
        content: "";
        display: inline-block;
        height: 32px;
        width: 32px;
    }
}