Skip to content

Instantly share code, notes, and snippets.

@cr08
Forked from dampatnight/userscript.js
Last active December 18, 2022 19:14
Show Gist options
  • Save cr08/92ef1cee68c5c8a11133b185605d3b07 to your computer and use it in GitHub Desktop.
Save cr08/92ef1cee68c5c8a11133b185605d3b07 to your computer and use it in GitHub Desktop.
Userscript to change column width of the Mastodon UI
// ==UserScript==
// @name Column width
// @namespace http://tampermonkey.net/
// @version 0.1
// @description https://github.com/tootsuite/mastodon/issues/8632
// @author dampatnight
// @match https://neurodifferent.me*
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
function getWidth() {
return Math.max(
document.body.scrollWidth,
document.documentElement.scrollWidth,
document.body.offsetWidth,
document.documentElement.offsetWidth,
document.documentElement.clientWidth
);
}
GM_addStyle ( `
@media screen and (min-width: 631px) {
:not(#mastodon-timeline) > .column {
flex: 1 0 25%;
}
}
@media screen and (min-width: 631px) {
:not(#mastodon-timeline) > .media-gallery {
height: ${0.33 * getWidth()}px;
}
}
` );
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment