Last active
November 10, 2018 14:25
-
-
Save yoksel/9ac45c9ade5c3dddcef57cbed0a8618e to your computer and use it in GitHub Desktop.
Replace urls in plane text with clickable links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Urls to links | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://up.htmlacademy.ru/adaptive/15/check/projects/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const texts = document.querySelectorAll('hr + p'); | |
texts.forEach(function(item) { | |
item.innerHTML = item.innerHTML.replace(/(htt[\S][^<\s]*)/gim,'<a href="$1">$1</a>'); | |
}) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment