// ==UserScript== // @name Direct GMail Link // @namespace http://codelenny.com/ // @version 0.0000000000 // @description Direct link to Gmail // @author Ryan Leonard (http://ryanleonard.us) // @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js // @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js // @require https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.18.10/URI.js // @grant GM_registerMenuCommand // @grant GM_setClipboard // @grant GM_notification // @match https://gmail.com/* // @match https://mail.google.com/* // @updateURL https://raw.githubusercontent.com/CodeLenny/direct-gmail/master/direct-gmail.meta.js // @downloadURL https://raw.githubusercontent.com/CodeLenny/direct-gmail/master/direct-gmail.user.js // ==/UserScript== function getUser() { let globals = GLOBALS || window.opener.GLOBALS || []; return GLOBALS[10]; } function getURL() { return URI(window.location.toString().replace(/\/u\/[0-9]+\/?/, "")) .addSearch("authuser", getUser()) .addSearch("ibxr", 0) .toString(); } function copyURL() { GM_setClipboard(getURL(), "text"); GM_notification({ title: "URL Copied", text: "GMail URL copied to clipboard", timeout: 750, }); } GM_registerMenuCommand("Get Direct Link to GMail", copyURL);