Gmail - Hover to show the URL behind a link

Make the href in each link more visible when a mouse hovers over so the user doesn't accidentally click on an unexpected (and potentially spam) link

  1. // ==UserScript==
  2. // @name Gmail - Hover to show the URL behind a link
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Make the href in each link more visible when a mouse hovers over so the user doesn't accidentally click on an unexpected (and potentially spam) link
  6. // @author You
  7. // @match https://mail.google.com/mail/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=gmail.com
  9. // @grant none
  10. // @license MIT
  11. // @require http://code.jquery.com/jquery-3.5.1.min.js
  12. // ==/UserScript==
  13. /* globals jQuery, $, waitForKeyElements */
  14.  
  15.  
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. $(document).ready(function () {
  21. function isMailOpen() {
  22. const replyButton = $('div[aria-label="Reply"][data-tooltip="Reply"][role="button"]');
  23. if(replyButton.length > 0){
  24. var aTagList = $('div.AO a'); // weird way to identify the mail body but ok...
  25. $.each(aTagList, function(index, aTag){
  26. const originalTitle = $(this).attr('title');
  27. const currentTitle = $(this).prop('title');
  28. if(!originalTitle && !currentTitle) {
  29. const href = $(this).attr('href');
  30. $(this).prop('title', href);
  31. }
  32.  
  33. });
  34. }
  35. }
  36.  
  37. // check every 3 seconds
  38. setInterval(isMailOpen, 3000);
  39. });
  40. })();