Created
November 1, 2014 18:32
-
-
Save AstroCB/855574d22e74b357ca80 to your computer and use it in GitHub Desktop.
Puts links in the format "-hyperlinked_title (source)" and outputs HTML source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var title = "empty"; | |
var url = "empty"; | |
var source = ""; | |
var i = 0; | |
var j = 0; | |
var webData = {}; | |
var sources = []; | |
var finalData = ""; | |
while(title !== ""){ | |
title = prompt("Enter title"); | |
url = prompt("Enter URL"); | |
source = prompt("Enter source"); | |
webData[title] = url; | |
sources[i] = source; | |
i++; | |
} | |
for(var i in webData){ | |
if((webData[i]) === ""){ | |
delete webData[i]; | |
} | |
} | |
var dataLength = Object.keys(webData).length; | |
for(var i in webData){ | |
if(sources[j] !== undefined && sources[j] !== ""){ | |
if(webData[i] === webData[dataLength - 2] && j === dataLength - 2){ | |
finalData += ("-<a href=\"" + webData[i] + "\">" + i + "</a> (" + sources[j] + ")"); | |
}else{ | |
finalData += ("-<a href=\"" + webData[i] + "\">" + i + "</a> (" + sources[j] + ")\n"); | |
} | |
} | |
j++; | |
} | |
console.log(finalData); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment