Kangry.com [insert cool graphic here]
home | Topics | Logout | Search | Contact | ?? Kangry ?? | Bandwitdh
Topics:
DVR
nvrec
Mplayer
Links
Misc
Commands
Humor

Name

Password

New user

uploaded files
(blogware)-> show sources DHTML code submited by Russell Wed 21 Dec 05
Edited Fri 23 Dec 05
Web kangry.com
I just added a link to the display pages called "show sources". What this does is read the links on a page and if the link contains an extra field called source it adds a link after the refrenced link to the source of that link. I do this with a bit of javascript:

function show_sources() {
     if (!document.getElementsByTagName || !document.createElement ||
!document.appendChild) return;
     var quotes = document.getElementsByTagName("a");
     for (var i=0; i<quotes.length; i++) {
          var source = quotes[i].getAttribute("source");
          if (!source) continue;
          var para = document.createElement("span");
          var link = document.createElement("a");
          para.className = "attribution";
          para.appendChild(document.createTextNode(" "));
          link.setAttribute("href",source);
          link.appendChild(document.createTextNode("(source)"));
       quotes[i].parentNode.insertBefore(link,quotes[i].nextSibling);
       quotes[i].parentNode.insertBefore(para,quotes[i].nextSibling);
     }

 }
This is a (probably not clean) hack and rewrite of some code from 24 ways

Still to do:
  • Don't display "Show Sources" link if there is nothing to reveal.
  • Don't let the user click it over and over
  • improve formatting of the page ( applys to the whole website)



Replys:
updates to show sorces (Russell)

Add comment or question...:
Subject:
Submited by: NOT email address. Leave blank for anonymous    (Spam Policy)

Enter Text: (text must match image for posting)




This file (the script that presented the data, not the data itself) , last modified Tuesday 06th of March 2018 11:41:12 PM
your client: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
current time: Saturday 20th of April 2024 07:01:23 AM