Improved Layout for BusMiles Summary Section

Make summary section cleaner and more readable

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Improved Layout for BusMiles Summary Section
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Make summary section cleaner and more readable
// @match        *://busmiles.uk/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const enhanceLayout = () => {
        const container = document.querySelector('div.container.pr-0.pl-0[style*="width:40vmax"]');
        if (!container || container.dataset.modified) return;
        container.dataset.modified = true;

        // Expand and style container
        container.style.width = '90vw';
        container.style.maxWidth = 'none';
        container.style.margin = '2rem auto';
        container.style.padding = '1rem';
        container.style.backgroundColor = '#f9f9f9';
        container.style.borderRadius = '12px';
        container.style.boxShadow = '0 4px 12px rgba(0, 0, 0, 0.1)';

        // Style tables
        const tables = container.querySelectorAll('table#tablelast11, table#tablelast10');
        tables.forEach(table => {
            table.style.fontSize = '1.8vmin';
            table.style.width = '100%';
            table.style.borderCollapse = 'collapse';
            table.style.marginBottom = '1.5rem';
        });

        // Style table headers and cells
        const headers = container.querySelectorAll('th');
        headers.forEach(th => {
            th.style.padding = '0.5rem';
            th.style.textAlign = 'left';
            th.style.backgroundColor = '#e0e0e0';
        });

        const cells = container.querySelectorAll('td');
        cells.forEach(td => {
            td.style.padding = '0.5rem';
            td.style.borderBottom = '1px solid #ccc';
        });

        // Style buttons
        const buttons = container.querySelectorAll('button');
        buttons.forEach(button => {
            button.style.fontSize = '1.6vmin';
            button.style.padding = '0.4rem 0.8rem';
            button.style.borderRadius = '6px';
            button.classList.remove('btn-lg');
        });

        // Style labels
        const labels = container.querySelectorAll('label');
        labels.forEach(label => {
            label.style.display = 'block';
            label.style.marginTop = '1rem';
            label.style.marginBottom = '0.5rem';
            label.style.fontWeight = '600';
            label.style.fontSize = '1.8vmin';
        });

    };

    // Run once and also watch for page changes
    enhanceLayout();
    const observer = new MutationObserver(enhanceLayout);
    observer.observe(document.body, { childList: true, subtree: true });
})();