Claude 3.6 renamer

Fix the name for Claude "3.5 Sonnet (New)". Make it "3.6 Sonnet" as it should have been released

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Claude 3.6 renamer
// @namespace    http://tampermonkey.net/
// @version      1.6
// @license      MIT
// @description  Fix the name for Claude "3.5 Sonnet (New)". Make it "3.6 Sonnet" as it should have been released
// @author       Gerry - https://x.com/gerry
// @match        *://claude.ai/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to replace the desired text on the page
    function replaceText() {
        // Define the target text and replacement HTML using a regular expression
        const targetRegex = /3\.5 Sonnet \(New\)/g;
        const replacementHtml = "3.6 Sonnet";

        // Get all elements that contain text nodes
        const elements = document.querySelectorAll("*:not(script):not(style)");

        elements.forEach(element => {
            element.childNodes.forEach(child => {
                if (child.nodeType === Node.TEXT_NODE && targetRegex.test(child.textContent)) {
                    const span = document.createElement('span');
                    span.innerHTML = child.textContent.replace(targetRegex, replacementHtml);
                    element.replaceChild(span, child);
                }
            });
        });
    }

    // Run the replacement function after the page has loaded
    window.addEventListener('load', replaceText);

    // Observe changes in the DOM to re-run the replacement if necessary
    const observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.type === 'childList' || mutation.type === 'characterData') {
                replaceText();
            }
        });
    });

    // Start observing the body for changes
    observer.observe(document.body, {
        childList: true,
        characterData: true,
        subtree: true
    });
})();