This is an old revision of the document!


Notes on CMT

Link to translate URLs to links. Execute this in your browser's debug console. (On IE, press F12, select the “Console” tab, and paste in the code below.)

function replace_urls() {
  n = document.getElementsByTagName('b');
  for(i = 0; i < n.length; ++i) {
    if (n[i].innerText.match('URL:')) {
      text = n[i].nextSibling;
      url = text.wholeText.replace(/\s+/,'');
      nn = document.createElement('div');
      nn.innerHTML = '<b>URL</b> (<'+'a target="_blank" href="' + url + '">link<'+'/a>):';
      n[i].replaceNode(nn);
    }
  }
}
replace_urls()

<html> <script> function replace_urls() { n = document.getElementsByTagName('b'); for(i = 0; i < n.length; ++i) {

if (n[i].innerText.match('URL:')) {
   	text = n[i].nextSibling;
url = text.wholeText.replace(/\s+/,'');
nn = document.createElement('div');
nn.innerHTML = '<'+'a target="_blank" href="' + url + '">Link<'+'/a>';
text.replaceNode(nn);
   }

} }

</script> <a href=“javascript:n = document.getElementsByTagName('b'); n[0].innerHTML += 'bbb';”>link</a> button: <button onclick='javascript:replace_urls()'>replace</button>

<div> <b>URL:</b> http://awf.fitzgibbon.ie/cmt </div> </html>

cmt.1368022583.txt.gz · Last modified: 2013/05/08 14:16 by awf
CC Attribution 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0