Custom Fixed Font in Gmail

Custom fixed-font in Gmail messages

Versione datata 25/02/2017. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name           Custom Fixed Font in Gmail
// @namespace      https://mail.google.com
// @include        https://mail.google.com/*
// @icon           https://mail.google.com/favicon.ico
// @run-at         document-start
// @description    Custom fixed-font in Gmail messages
// @version        1.2
// @license        CC0; https://creativecommons.org/publicdomain/zero/1.0/
// @homepageURL    https://github.com/lidel/userscripts
// @grant          none
// ==/UserScript==

var fontName = 'Droid Sans Mono';
var fontSubset = 'latin';

// dragons below this line
var fontCss = 'font-family: \'' + fontName + '\', monospace !important;';
// plain-text messages
var css = '.ii, .Ak {' + fontCss + '}';
// editor
css += '.editable {' + fontCss + '}';
// load
var heads = document.getElementsByTagName('head');
if (heads.length > 0) {
  var link = document.createElement('link');
  link.rel = 'stylesheet';
  link.href = '//fonts.googleapis.com/css?family=' + fontName.replace(/\ /g, '+') + '&subset=' + fontSubset;
  heads[0].appendChild(link);
  var node = document.createElement('style');
  node.type = 'text/css';
  node.appendChild(document.createTextNode(css));
  heads[0].appendChild(node);
}