Re:Canned Emails – a minimal site with prewritten emails
by bramgg on Saturday February 14, 2015 @02:10AM
(#9048984)
Today I contributed to the greater good of society:
That being said I love the site :)
[ Parent
| on HN ]
Re:Canned Emails – a minimal site with prewritten emails
by amarraja on Saturday February 14, 2015 @09:40AM
(#9049733)
Slightly tweaked your script to display inline
$("h2 a").each(function(){
var email = decodeURIComponent(this.href).slice(13).split("&subject=");
var subject = email[1];
var body = email[0].replace(/\n( )+/g, "\n");
var parent = $(this).parent("h2")
parent.after($("<div />").text(body));
parent.after($("<h4 />").text(subject));
});
Re:Canned Emails – a minimal site with prewritten emails
by bramgg on Saturday February 14, 2015 @01:17PM
(#9050292)
This is great! For anyone wondering, use this one.
Re:Canned Emails – a minimal site with prewritten emails
by benbowdene on Saturday February 14, 2015 @02:19PM
(#9050484)
SO much easier reading it this way :D
Re:Canned Emails – a minimal site with prewritten emails
by hippich on Saturday February 14, 2015 @09:04AM
(#9049656)
console.log(output);
needs to be last line outside each() :) Or move var content = "" inside each()
Re:Canned Emails – a minimal site with prewritten emails
by bramgg on Saturday February 14, 2015 @01:17PM
(#9050289)
Whoops, you're right, console.log was supposed to be at the very bottom of the script. By default most browser consoles scroll you to the bottom of the output, so I just read the first half scrolling up and never noticed. No matter, amarraja's version is much better.