BlogsMarks Convert URL text to Link

In Mark description, convert plain text URLs to links (URLs into HTML hyperlinks that are clickable)

Verze ze dne 22. 04. 2025. Zobrazit nejnovější verzi.

// ==UserScript==
// @name         BlogsMarks Convert URL text to Link
// @namespace    https://blogmarks.net
// @version      0.1
// @description  In Mark description, convert plain text URLs to links (URLs into HTML hyperlinks that are clickable)
// @author       Decembre
// @icon         https://icons.iconarchive.com/icons/sicons/basic-round-social/48/blogmarks-icon.png
// @match        https://blogmarks.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var urlRegex = /(https?:\/\/[^\s]+)/g;
    var elements = document.querySelectorAll('.b .description');

    elements.forEach(function(element) {
        element.innerHTML = element.innerHTML.replace(urlRegex, function(url) {
            return '<a href="' + url + '" target="_blank">' + url + '</a>';
        });
    });
})();