Skip to content

Instantly share code, notes, and snippets.

@thomas4g
Created March 27, 2012 23:06
Show Gist options
  • Save thomas4g/2221303 to your computer and use it in GitHub Desktop.
Save thomas4g/2221303 to your computer and use it in GitHub Desktop.
using Utils
var messages = document.getElementById("messages"),
i=0;
for(;i<Mail.messages.length;i++) {
function addSender(m, row) {
var cell = row.insertCell(-1);
Utils.traversal.setText(m.from.name, cell);
}
function addSubject(m, row) {
var cell = row.insertCell(-1);
Utils.traversal.setText(m.subject, cell);
}
function addDate(m, row) {
var cell = row.insertCell(-1),
prettier = Object.create(DATE_PRETTIFIER);
prettier.date = m.date;
Utils.traversal.setText(prettier.slash(),
cell);
}
var rowFunctions = {
"0": addSender,
"1": addSubject,
"2": addDate
},
row = messages.insertRow(-1);
m = Mail.messages[i],
index = 0,
limit = 3;
while(index<limit) {
rowFunctions[index](m, row);
index++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment