URL Linkify

Replace URLs in text with clickable links

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         URL Linkify
// @namespace    http://tampermonkey/url-linkify
// @version      1.1
// @description  Replace URLs in text with clickable links
// @author       Hoopengo
// @match        https://www.google.com/sorry/index*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=google.com
// @license      Apache 2.0
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const urlRegex = /URL:\s*(\S+)/g; // regex to match "URL: ..." strings
    const textNodes = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);

    while (textNodes.nextNode()) {
        const textNode = textNodes.currentNode;

        if (textNode.nodeType === Node.TEXT_NODE && textNode.textContent.match(urlRegex)) {
            const urlMatches = textNode.textContent.match(urlRegex);

            for (let i = 0; i < urlMatches.length; i++) {
                const url = urlMatches[i].replace('URL:', '').trim();
                const link = document.createElement('a');
                link.href = url;
                link.textContent = url;

                // replace the URL text with the link element
                const replacementNode = textNode.splitText(textNode.textContent.indexOf(urlMatches[i]));
                replacementNode.replaceWith(link);
            }
        }
    }
})();