This repository has been archived by the owner on Jul 8, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to priority inbox. Update for latest API
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// ==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== | ||
|
||
var api = new USO.Gmail() | ||
|
||
api.on('view:cv', function () { | ||
this.active_view.addEventListener('DOMNodeInserted', onNodeInsert, false) | ||
}) | ||
|
||
var onNodeInsert = function onNodeInsert () { | ||
if (api.view !== 'cv') { | ||
return this.removeEventListener('DOMNodeInserted', onNodeInsert, false) | ||
} | ||
|
||
var alert = this.ownerDocument.evaluate | ||
( ".//div[contains(., 'Your message has been sent.') " | ||
+ "and @aria-atomic='true' and @aria-live='polite']" | ||
, this | ||
, null | ||
, XPathResult.FIRST_ORDERED_NODE_TYPE | ||
, null | ||
) | ||
.singleNodeValue | ||
|
||
if (alert) { | ||
top.location.hash = '#mbox' | ||
} | ||
} |