GMail Inbox After Reply

By Tim Smart Last update 9 hours ago — Installed 805 times. Daily Installs: 0, 1, 0, 1, 0, 4, 3, 2, 1, 4, 1, 3, 0, 0, 25, 13, 5, 1, 10, 8, 8, 5, 5, 1, 4, 11, 3, 1, 4, 2, 7, 3

There are 10 previous versions of this script.

// ==UserScript==
// @name           GMail Inbox After Reply
// @namespace      http://userscripts.org/users/63868
// @include        http://mail.google.com*
// @include        https://mail.google.com*
// @require        http://updater.usotools.co.cc/38212.js
// @require        http://userscripts.org/scripts/source/56812.user.js
// ==/UserScript==

GMailAPI({
	onViewChange: function() {
		if ( this.viewType === 'cv' ) {
			var fn = this;
			this.viewElement.addEventListener( 'DOMNodeInserted', function() {
				if ( fn.viewType !== 'cv' )
					return this.removeEventListener( 'DOMNodeInserted', arguments.callee, false );

				if ( this.ownerDocument.evaluate( ".//table[contains(.,'Your message has') and @role='alert']",
						this, null, 9, null ).singleNodeValue )
					top.location.hash = '#inbox';
			}, false );
		}
	}
});