您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
resizable columns in mastodon
当前为
- // ==UserScript==
- // @name resize-o-don
- // @license DWTFYW
- // @namespace http://pureandapplied.com.au/resizodon
- // @version 0.3.2
- // @description resizable columns in mastodon
- // @author stib
- // @match https://*.social/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=aus.social
- // @grant none
- // @run-at document-idle
- // ==/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++){
- cols[i].style.resize = "horizontal";
- cols[i].style.flexShrink = 0;
- resizeObserver.observe(cols[i]);
- //cols[i].style.width = '350px';
- }
- if (cols.length){
- cols[cols.length -1].resize = "horizontal";
- cols[cols.length -1].style.flex = "1 1 auto";
- }
- //==== make all the font sizes the same =========
- // if you want highlighted posts to have
- // the default larger font size,
- // comment out the next two lines
- // by putting // at the front
- const s = document.getElementsByClassName("status__content__text");
- for (let i = 0; i < s.length; i++){ s[i].style.fontSize = "15px" }
- //===============================================
- };
- const resizeObserver = new ResizeObserver((entries) => {
- for (const entry of entries) {
- if (entry.contentBoxSize) {
- setupResizing();
- }
- }
- })
- function setupResizing(){
- makeResizable('drawer', 'column');
- };
- // Tampermonkey on Chrome seems to run scripts before the document is fully loaded.
- // So this fixes that. Using firefox would fix it better, peeps.
- // Convenience function to execute your callback only after document.readyState === 'complete'
- // modified version of code found here https://github.com/Tampermonkey/tampermonkey/issues/1279
- // Gives up after 1 minute.
- function runWhenReady(callback) {
- var numAttempts = 0;
- var tryNow = function() {
- if ( document.readyState === 'complete') {
- callback();
- } else {
- numAttempts++;
- if (numAttempts >= 34) {
- console.warn('Giving up after 34 attempts. document not complete');
- } else {
- setTimeout(tryNow, 250 * Math.pow(1.1, numAttempts));
- }
- }
- };
- tryNow();
- }
- runWhenReady(setupResizing);
- })();