36rain页面适配插件

脚本持续更新中...

当前为 2024-08-17 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         36rain页面适配插件
// @namespace    http://36rain.com
// @version      1.1
// @description  脚本持续更新中...
// @match        http://36rain.com/*
// @match        http://www.36rain.com/*
// @run-at       document-start
// @license      MIT
// @grant        GM_info
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_deleteValue
// @grant        GM_xmlhttpRequest
// @grant        GM_registerMenuCommand
// @grant        GM_openInTab
// @grant        GM_notification
// @grant        GM_addStyle
// @grant        GM_log
// @grant        GM_getResourceText
// @grant        GM_getResourceURL
// @grant        GM_listValues
// @grant        GM_addValueChangeListener
// @grant        GM_removeValueChangeListener
// @grant        GM_setClipboard
// @grant        GM_getTab
// @grant        GM_saveTab
// @grant        GM_getTabs
// @grant        GM_download
// @grant        GM_getResourceURL
// @grant        GM_getResourceText
// ==/UserScript==



/*
    Author: 无名布女 
    Greasyfork: Put your Greasyfork profile page URL here.
*/


(function() {
    'use strict';

    const customCSS = `
    	body, html {
      	    font-size: 24px !important;
      	    line-height: 150% !important;
    	}
        .user-infoWrap2, .user-infoWrap2 * {
          line-height: 150% !important;
          Font-size: 16px !important;
        }
    	.tr3 * {
            line-height: 150% !important;
        }
        .f10 * {
            font-size: 24px !important;
        }
        .f14 * {
            font-size: 36px !important;
            letter-spacing: normal !important;
            line-height: 200% !important;
        }
        .f14 h6, .f14 h6 * {
            font-size: inherit !important;
        }
        .f14 blockquote, .f14 blockquote * {
            font-size: 36px !important;
            width: 100% !important;
            letter-spacing: normal !important;
            line-height: 200% !important;
        }
    `;

    function applyStyles() {
        var elements = document.querySelectorAll('.f14 *:not(h6):not(h6 *), .middle, .big, small');
        elements.forEach(function(el) {
            el.style.setProperty('font-size', '36px', 'important');
            el.style.setProperty('letter-spacing', 'normal', 'important');
            el.style.setProperty('line-height', '200%', 'important');
        });
        // Apply styles to user-infoWrap2 elements
        var userInfoElements = document.querySelectorAll('.user-infoWrap2, .user-infoWrap2 *');
        userInfoElements.forEach(function(el) {
            el.style.setProperty('font-size', '16px', 'important');
	    el.style.setProperty('line-height', '150%', 'important');
        });
    }

    // Create and append style element
    var style = document.createElement('style');
    style.textContent = customCSS;
    document.head.appendChild(style);

    // Apply styles immediately
    applyStyles();

    // Apply styles to dynamically loaded content
    var observer = new MutationObserver(function(mutations) {
        applyStyles();
    });
    observer.observe(document.body, { childList: true, subtree: true });

    // Force a repaint
    document.body.style.display='none';
    document.body.offsetHeight;
    document.body.style.display='';
})();