36rain Forum Font Size Adjuster

Adjust font size & layout for 36rain forum

Od 17.08.2024.. Pogledajte najnovija verzija.

// ==UserScript==
// @name         36rain Forum Font Size Adjuster
// @namespace    http://36rain.com
// @version      1.0
// @description  Adjust font size & layout for 36rain forum
// @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='';
})();