BlogsMarks - Convert URL text to Link

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

  1. // ==UserScript==
  2. // @name BlogsMarks - Convert URL text to Link
  3. // @namespace https://blogmarks.net
  4. // @version 0.2
  5. // @description In Mark description, convert plain text URLs to links (URLs into HTML hyperlinks that are clickable)
  6. // @author Decembre
  7. // @icon https://icons.iconarchive.com/icons/sicons/basic-round-social/48/blogmarks-icon.png
  8. // @match https://blogmarks.net/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. var urlRegex = /(https?:\/\/[^\s]+)/g;
  15. var elements = document.querySelectorAll('.b .description');
  16.  
  17. elements.forEach(function(element) {
  18. element.innerHTML = element.innerHTML.replace(urlRegex, function(url) {
  19. return '<a href="' + url + '" target="_blank">' + url + '</a>';
  20. });
  21. });
  22. })();