// ==UserScript== // @name meow meow // @namespace http://skeletonplanet.com/ // @version 0.1 // @description meow // @author cat // @match https://twitter.com/* // @match https://mobile.twitter.com/* // @grant none // ==/UserScript== (function() { 'use strict'; var stopcrop = function() { // find every div with data-testid='tweetPhoto' var photos = document.querySelectorAll( "div[data-testid='tweetPhoto']" ); for(var elem of photos) { // stop twitter from messing up the margins elem.style = "margin: 0" var img = elem.querySelector('img') var height = img.naturalHeight var width = img.naturalWidth if(height !== 0) { elem.parentElement.parentElement.children[0].style = "padding-bottom:" + (100 * height / width) + "%" } } } setInterval(stopcrop, 200); })();