resize-o-don

resizeable columns in mastodon

ของเมื่อวันที่ 03-11-2022 ดู เวอร์ชันล่าสุด

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         resize-o-don
// @license      DWTFYW
// @namespace    http://pureandapplied.com.au/resizodon
// @version      0.2.2
// @description  resizeable columns in mastodon
// @author       You
// @match        https://*.social/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=aus.social
// @grant        none
// ==/UserScript==


(function() {
    function makeResizable () {
        let cols =[];
        for (let a = 0; a < arguments.length; a++){
                    let divs = document.getElementsByClassName(arguments[a]);
            for (let d = 0; d < divs.length; d++){
                cols.push(divs[d]);
            }
        }

        for(let i=0; i< cols.length - 1; i++){
            console.log(cols[i]);
            cols[i].style.resize = "horizontal";
            cols[i].style.flexShrink = 0;
            resizeObserver.observe(cols[i]);
            //cols[i].style.width = '350px';
        }
        cols[cols.length -1].resize = "horizontal";
        cols[cols.length -1].style.flex = "1 1 auto";
    };
    const resizeObserver = new ResizeObserver((entries) => {
        for (const entry of entries) {
            if (entry.contentBoxSize) {
                setupResizing();
            }
        }
    })
    function setupResizing(){
        makeResizable('drawer', 'column');
    };
    setupResizing();
})();