Skip to content

Instantly share code, notes, and snippets.

@carymrobbins
Last active August 29, 2015 14:04
Show Gist options
  • Save carymrobbins/3eb57a3f43cf11cfd858 to your computer and use it in GitHub Desktop.
Save carymrobbins/3eb57a3f43cf11cfd858 to your computer and use it in GitHub Desktop.
Copy Limechat discussion to HTML file, open it in the browser, then run this in the console to print the discussion in a simple text format.
var rows = [];
var xs = $('body').children;
for (var i = 0; i < xs.length; ++i) {
var ys = xs[i].children;
if (ys.length >= 3) {
rows.push([ys[1].textContent, ys[0].textContent, ys[2].textContent])
}
}
var maxNickLen = Math.max.apply(null, rows.map(function(r) { return r[0].length }));
console.log(rows.map(function(r) {
return r[0] + new Array(maxNickLen - r[0].length + 2).join(' ') + r[1].trim() + ' '+ r[2];
}).join('\n'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment