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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Gmail - Hover to show the URL behind a link
// @namespace    http://tampermonkey.net/
// @version      0.2
// @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
// @author       You
// @match        https://mail.google.com/mail/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=gmail.com
// @grant        none
// @license      MIT
// @require http://code.jquery.com/jquery-3.5.1.min.js
// ==/UserScript==
/* globals jQuery, $, waitForKeyElements */



(function() {
    'use strict';

    $(document).ready(function () {
        function isMailOpen() {
            const replyButton = $('div[aria-label="Reply"][data-tooltip="Reply"][role="button"]');
            if(replyButton.length > 0){
                var aTagList = $('div.AO a'); // weird way to identify the mail body but ok...
                $.each(aTagList, function(index, aTag){
                   const originalTitle = $(this).attr('title');
                   const currentTitle = $(this).prop('title');
                   if(!originalTitle && !currentTitle) {
                       const href = $(this).attr('href');
                       $(this).prop('title', href);
                   }

               });
            }
        }

        // check every 3 seconds
        setInterval(isMailOpen, 3000);
    });
})();