Daymap Timetable Redesign

Modern redesign of the Daymap timetable interface

目前為 2025-04-10 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Daymap Timetable Redesign
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Modern redesign of the Daymap timetable interface
// @author       You
// @match        https://lefevrehs.daymap.net/daymap/timetable/timetable.aspx
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // Add custom CSS
    GM_addStyle(`
        /* Main layout improvements */
        .main-layout {
            padding: 20px;
            max-width: 14000px;
            margin: 0 auto;
        }

        .grid {
            gap: 0px;
        }

        .card {
            border-radius: 10px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            border: none;
            overflow: hidden;

        }

        /* Timetable styling */
        .tt {
            border-collapse: separate;
            border-spacing: 0;
            width: 100%;
        }

        .tt th {
            background: #1888C9;
            color: white;
            padding: 10px;
            text-align: center;
            font-weight: 500;
        }

        .tt td {
            padding: 0;
            border: 1px solid #e9ecef;
        }

        .ttCell {
            padding: 8px;
            height: 80px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            transition: all 0.2s ease;
        }

        .ttCell:hover {
            filter: brightness(95%);
            transform: translateY(-2px);
        }

        .ttSubject {
            font-weight: 600;
            font-size: 0.9rem;
            margin-bottom: 5px;
        }

        .ttTeacher, .ttRoom {
            font-size: 0.8rem;
            color: white;
        }

        .Period {
            background: #f8f9fa;
            font-weight: 500;
            padding: 8px;
            white-space: nowrap;
        }

        /* Task list improvements */
        .feed {
            width: 100%;
            border-collapse: collapse;
        }

        .feed tr {
            border-bottom: 1px solid #e9ecef;
        }

        .feed td {
            padding: 12px;
        }

        .feed .cap {
            width: 120px;
            font-weight: 500;
            color: #2c3e50;
            vertical-align: top;
        }

        .feed .itm {
            cursor: pointer;
            transition: background 0.2s ease;
        }

        .feed .itm:hover {
            background: #f8f9fa;
        }

        .Caption {
            font-size: 0.8rem;
            color: #6c757d;
        }

        /* Message list improvements */
        .msgList {
            padding: 0;
        }

        daymap-list-item {
            padding: 12px 15px;
            border-bottom: 1px solid #e9ecef;
            display: block;
            transition: background 0.2s ease;
        }

        daymap-list-item:hover {
            background: #f8f9fa;
        }

        /* Button improvements */
        .btn {
            border-radius: 6px;
            padding: 8px 16px;
            transition: all 0.2s ease;
        }

        .btn:hover {
            transform: translateY(-1px);
        }

        /* Responsive adjustments */
        @media (max-width: 768px) {
            .grid > div {
                width: 100% !important;
            }

            .ttCell {
                height: auto;
                min-height: 60px;
            }
        }
    `);

    // Wait for page to load
    window.addEventListener('load', function() {
        // Add a loading indicator while we process
        const loadingIndicator = document.createElement('div');
        loadingIndicator.style.position = 'fixed';
        loadingIndicator.style.top = '0';
        loadingIndicator.style.left = '0';
        loadingIndicator.style.width = '100%';
        loadingIndicator.style.height = '3px';
        loadingIndicator.style.backgroundColor = '#1888C9';
        loadingIndicator.style.zIndex = '9999';
        document.body.appendChild(loadingIndicator);

        // Process timetable cells
        setTimeout(() => {
            const cells = document.querySelectorAll('.ttCell');
            cells.forEach(cell => {
                // Add hover effect
                cell.style.cursor = 'pointer';

                // Improve layout of cell content
                const subject = cell.querySelector('.ttSubject');
                if (subject) {
                    // Shorten long subject names
                    const text = subject.textContent.trim();
                    if (text.length > 25) {
                        subject.textContent = text.substring(0, 22) + '...';
                    }
                }
            });

            // Process task list
            const tasks = document.querySelectorAll('.feed .itm');
            tasks.forEach(task => {
                // Add hover effect
                task.style.transition = 'all 0.2s ease';

                // Color code based on status
                if (task.innerHTML.includes('Overdue')) {
                    task.style.borderLeft = '3px solid #e81123';
                } else if (task.innerHTML.includes('Uh did you submit on Turnitin or something?')) {
                    task.style.borderLeft = '3px solid #e81123';
                } else if (task.innerHTML.includes('Work has been received')) {
                    task.style.borderLeft = '3px solid #107c10';
                } else {
                    task.style.borderLeft = '3px solid #ffb900';
                }
            });

            // Remove loading indicator
            loadingIndicator.style.opacity = '0';
            setTimeout(() => loadingIndicator.remove(), 300);
        }, 500);
    });
})();