Greasy Fork

125论坛手机版优化

优化125论坛(bbs.125.la)在手机端的显示效果

目前为 2024-12-25 提交的版本。查看 最新版本

// ==UserScript==
// @name         125论坛手机版优化
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  优化125论坛(bbs.125.la)在手机端的显示效果
// @author       Your name
// @match        https://bbs.125.la/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 检查是否为移动端访问
    if(!/mobile/i.test(navigator.userAgent)) return;

    // 修改viewport
    let viewport = document.querySelector('meta[name="viewport"]');
    if(viewport) {
        viewport.content = 'width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes';
    }

    // 添加自定义样式
    const customCSS = `
        /* 基础字体大小调整 */
        body {
            font-size: 16px !important;
            line-height: 1.6 !important;
        }

        /* 帖子标题 */
        .thread_tit, h3 {
            font-size: 1.1em !important;
        }

        /* 列表项内容 */
        .sub_forum li {
            padding: 12px 8px !important;
        }

        /* 统计数字 */
        .f_count {
            font-size: 0.9em !important;
        }

        /* 底部导航栏 */
        .btFixed {
            font-size: 14px !important;
        }

        /* 优化链接点击区域 */
        a {
            padding: 8px !important;
        }

        /* 优化头部导航 */
        .header {
            padding: 10px 0 !important;
        }

        /* 调整内容区域间距 */
        .container {
            padding: 10px !important;
        }

        /* 优化图片显示 */
        img {
            max-width: 100% !important;
            height: auto !important;
        }
    `;

    // 插入自定义样式
    const styleElement = document.createElement('style');
    styleElement.textContent = customCSS;
    document.head.appendChild(styleElement);

})();