Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
cmt [2013/05/08 12:03] – created awfcmt [2015/01/28 23:16] awf
Line 1: Line 1:
 Notes on CMT Notes on CMT
  
-Link to translate URLs to links.  Add this to your browser toolbar.+Niceify reviews: 
 <code> <code>
-n = document.getElementsByTagName('b'); +var jq = document.createElement('script'); 
-for(i = 0; i < n.length; ++i) { +jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"; 
-  if (n[i].innerText.match('URL:')) { +document.getElementsByTagName('head')[0].appendChild(jq); 
-     text = n[i].nextSibling; +// ... give time for script to load, then type. 
- url = text.wholeText.replace(/\s+/,''); + 
- nn = document.createElement('div'); + 
- nn.innerHTML = '<'+'a target="_blank" href="' + url + '">Link<'+'/a>'; +var rows = $("#ctl00_cph_pnlReviews>div>table>tbody>tr"
- text.replaceNode(nn); + 
-     }+var elt = ''; for(i=1; i < rows.length; ++i) { elt += '<p/><b style="font-size: small;">' + rows[i].children[0].innerHTML + '</b><p>' + rows[i].children[1].innerHTML + '</p>'
 + 
 +$(elt).insertBefore($("#ctl00_cph_pnlReviews")) 
 +</code> 
 + 
 + 
 +Link to translate URLs to links.  Navigate to a page with URLs in it, then execute this in your browser's debug console. 
 + 
 +(On IE, press F12, select the "Console" tab, and paste in the code below.) 
 +<code> 
 +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+/,''); 
 +      n[i].innerHTML = '<b>URL</b> (<'+'a target="_blank" href="' + url + '">link<'+'/a>):'; 
 +    } 
 +  
 +
 +replace_urls()</code> 
 +And this one zaps the links too 
 +<code> 
 +  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+/,''); 
 +      n[i].innerHTML = 'URL (<'+'a target="_blank" href="' + url + '">link<'+'/a>):'; 
 +      n[i].nextSibling.replaceNode(document.createElement('div')); 
 +    } 
 +  } 
 +</code> 
 +<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 = '<b>URL</b> (<'+'a target="_blank" href="' + url + '">link<'+'/a>):'; 
 +      n[i].replaceNode(nn); 
 +    } 
 +  }
 } }
-</code+ 
 +</script> 
 +<button onclick='javascript:replace_urls()'>TEST</button> 
 + 
 +<div> 
 +<b>URL:</b> http://awf.fitzgibbon.ie/cmt 
 +</div> 
 +</html> 
 + 
 +~~DISCUSSION~~
  
cmt.txt · Last modified: 2021/04/13 13:50 by awf
CC Attribution 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0