GMail Automatically Show Images

By Tim Smart Last update Sep 3, 2009 — Installed 739 times. Daily Installs: 0, 1, 0, 1, 3, 1, 4, 2, 5, 0, 2, 6, 6, 6, 3, 3, 7, 5, 4, 1, 3, 5, 7, 0, 6, 4, 2, 1, 0, 2, 4, 5

There are 3 previous versions of this script.

// ==UserScript==
// @name           GMail Automatically Show Images
// @namespace      http://userscripts.org/users/tim
// @include        http*mail.google.com*
// @require        http://updater.usotools.co.cc/51694.js
// @require        http://userscripts.org/scripts/source/56812.user.js
// ==/UserScript==

function clickElement( element ) {
	var clickEvent = document.createEvent("MouseEvents");
	clickEvent.initMouseEvent( "click", true, true, document.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null );
	element.dispatchEvent( clickEvent );
}

GMailAPI({
	onViewChange: function() {
		if ( this.viewType === 'cv' ) {
			var element = this.viewElement.ownerDocument.evaluate( './/span[contains(.,"Always display images from ")]', this.viewElement, null, 9, null );
			if ( element = element.singleNodeValue )
				clickElement( element );
		}
	}
});