Docassemble Docs Improved Titles

Generate a better URL based page title for Docassemble docs

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

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

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!)

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.

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

// ==UserScript==
// @name         Docassemble Docs Improved Titles
// @namespace    https://github.com/jpagh/
// @version      1.1
// @description  Generate a better URL based page title for Docassemble docs
// @author       Jack Adamson
// @license      MIT
// @match        https://docassemble.org/docs/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=docassemble.org
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function capitalizeFirst(str) {
        return str.charAt(0).toUpperCase() + str.slice(1);
    }

    function getTitleFromUrl() {
        const pathParts = window.location.pathname.split('/');
        const filename = pathParts[pathParts.length - 1].replace('.html', '');
        const baseTitle = capitalizeFirst(filename);
        if (location.hash) {
            const decodedHash = decodeURIComponent(location.hash);
            return `${baseTitle} ${decodedHash}`;
        }
        return baseTitle;
    }

    function updateTitle() {
        document.title = getTitleFromUrl();
    }

    window.addEventListener('hashchange', updateTitle);
    updateTitle();
})();