Skip to content

Instantly share code, notes, and snippets.

@willjobs
Last active October 2, 2017 04:14
Show Gist options
  • Save willjobs/cf0142ca324ccde835baec42f0226a7d to your computer and use it in GitHub Desktop.
Save willjobs/cf0142ca324ccde835baec42f0226a7d to your computer and use it in GitHub Desktop.
Tampermonkey/greasemonkey script to fix FastMail's email body width (which is set to 938px) to fit on the page
// ==UserScript==
// @name Fastmail - email body width
// @description Fix width of emails being wider than screen
// @author Will Jobs
// @id fastmail-emailwidth
// @include https://www.fastmail.com/mail/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/
(function() {
'use strict';
function fixWidth (jNode) {
jNode.width('inherit');
}
waitForKeyElements (".v-Message-body.v-Message-body--html", fixWidth);
})();
@willjobs
Copy link
Author

willjobs commented Oct 2, 2017

Uses the waitForKeyElements function (see docs here and here and example here) to detect AJAX updates (when you select a new folder or message) and re-style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment