Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brianpow/0db41771448c02d52ce5d5178933361c to your computer and use it in GitHub Desktop.
Save brianpow/0db41771448c02d52ce5d5178933361c to your computer and use it in GitHub Desktop.
//https://www.vgmusic.com/music/console/nintendo/nes/
var go = function($) {
lastHeader = ""
data = $("table tr").map(function() {
if ($(this).hasClass("header")) {
lastHeader = $(this).find("a:eq(0)").text().trim()
return ""
} else {
if ($("td:eq(0)", this).attr("colspan") == 5)
return ""
else
return [lastHeader].concat($("td", this).map(function(i, v) {
if (i == 0 && $("a", this).length)
return $(this).text().trim() + "\t" + $("a", this).attr("href")
return $(this).text().trim()
}).filter(function(i, v) {
return v !== ""
}).get()).join("\t");
}
}).filter(function(i, v) {
return v !== ""
}).get()
$ta = $("#link").length ? $("#link") : $("<textarea id='link' />").prependTo(document.body);
$ta.html(data.join("\n"))
}
var jQuerify = function() {
var s = document.createElement('script');
s.setAttribute('src', 'https://code.jquery.com/jquery.js');
document.getElementsByTagName('body')[0].appendChild(s);
}
var wait = function(f) {
if (typeof jQuery == "undefined")
setTimeout(wait, 100, f, maxWait)
else
f(jQuery)
}
if (typeof jQuery == "undefined") {
jQuerify()
wait(go)
} else
go(jQuery)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment