36rain页面适配插件

脚本持续更新中...

目前為 2024-08-17 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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='';
})();