GMail Steam URL highlighter

Replace Steam URI's in GMail with actual links

Verze ze dne 21. 07. 2017. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         GMail Steam URL highlighter
// @namespace    http://tampermonkey.net/
// @require  https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.slim.min.js
// @require https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012
// @version      1.0
// @description  Replace Steam URI's in GMail with actual links
// @author       deiga
// @match        https://mail.google.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const steamUrlReplacer = function () {
        const elem = Array.from(document.querySelectorAll('.gs div')).filter(function(item) { return item.textContent.indexOf('steam://') > -1; })[0];
        if (elem) {
            var elemHtml = elem.innerHTML;
            if (elemHtml.indexOf('href="steam://') === -1) {
                elem.innerHTML = elemHtml.replace(/steam:\/\/.*$/m,'<a href="$&">$&</a>').replace('<wbr>','');
            }
        }
    };

    waitForKeyElements (".gs div:contains('steam://')", steamUrlReplacer);
})();