Sandbox3: Difference between revisions
(test it raw with the WikiWord SandBox) |
(bards try) |
||
Line 23: | Line 23: | ||
} | } | ||
})(); | })(); | ||
</html> | |||
---- | |||
<html> | |||
javascript:(function(){ | |||
var wikiWords = document.querySelectorAll(".wikilink"); | |||
for (var i = 0; i < wikiWords.length; i++) { | |||
wikiWords[i].style.textDecoration = "underline"; | |||
} | |||
})() | |||
</html> | </html> |
Revision as of 20:58, 19 October 2023
test RedeSchrift BitCoin atxt-> https://www.trankynam.com/atext/ SandBox
javascript: (() => { // Get all the text nodes in the document let textNodes = document.evaluate("//text()", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); // Loop through each text node for (let i = 0; i < textNodes.snapshotLength; i++) { let node = textNodes.snapshotItem(i); // Split the text by whitespace and punctuation let words = node.data.split(/[\s,.!?;:()'"`]+/); // Loop through each word for (let word of words) { // Check if the word is camel case if (word.match(/^[a-z]+[A-Z][a-zA-Z]*$/)) { // Replace the word with a span element that has an underline style node.data = node.data.replace(word, `${word}`); } } } })();
javascript:(function(){ var wikiWords = document.querySelectorAll(".wikilink"); for (var i = 0; i < wikiWords.length; i++) { wikiWords[i].style.textDecoration = "underline"; } })()