Skip to content

Instantly share code, notes, and snippets.

@jkishner
Created January 29, 2014 21:16
Show Gist options
  • Save jkishner/8697380 to your computer and use it in GitHub Desktop.
Save jkishner/8697380 to your computer and use it in GitHub Desktop.
function PaperlessWeb(url,title) {
url = url.replace("www.dropbox","dl.dropboxusercontent");
var xmlDoc=loadXMLDoc(url);
var howmanyitems=xmlDoc.getElementsByTagName("itemName");
//var howmanynotes=xmlDoc.getElementsByTagName("itemNote");
var output="<p>";
for (i=0;i<howmanyitems.length;i++) {
//exclude completed items
if (xmlDoc.getElementsByTagName("itemCompleted")[i].childNodes[0].nodeValue == "NO") {
output+="<i class='fa fa-square-o'></i> " + xmlDoc.getElementsByTagName("itemName")[i].childNodes[0].nodeValue + "<br>";
// very helpful --> http://stackoverflow.com/questions/10195429/cannot-read-property-nodevalue-of-null
if (xmlDoc.getElementsByTagName("itemNote")[i].childNodes[0] != undefined) {
output+="<span style=margin-left:5em;>" + xmlDoc.getElementsByTagName("itemNote")[i].childNodes[0].nodeValue + "</span><br>";
}
}
if (xmlDoc.getElementsByTagName("itemCompleted")[i].childNodes[0].nodeValue == "YES") {
output+="<i class='fa fa-check-square-o'></i> " + xmlDoc.getElementsByTagName("itemName")[i].childNodes[0].nodeValue + "<br>";
// very helpful --> http://stackoverflow.com/questions/10195429/cannot-read-property-nodevalue-of-null
if (xmlDoc.getElementsByTagName("itemNote")[i].childNodes[0] != undefined) {
output+="<span style=margin-left:5em;>" + xmlDoc.getElementsByTagName("itemNote")[i].childNodes[0].nodeValue + "</span><br>";
}
}
}
output+="</p>";
document.getElementById(title).innerHTML=output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment