mirror of
https://github.com/moparisthebest/mailcatcher
synced 2024-12-21 23:08:54 -05:00
Load stylesheets earlier in Analysis tab.
This commit is contained in:
parent
6ba508c635
commit
eed61fe11e
@ -137,13 +137,14 @@ class MailCatcher
|
||||
if id?
|
||||
# Makes a new iframe which will have a foreign origin eventually, and populate it with a quick intro and a form to send to Fractal.
|
||||
$iframe = $('#message iframe').contents().children().html("""
|
||||
<html class="mailcatcher"><body><iframe></iframe></body></html>
|
||||
<html class="mailcatcher"><head>#{$('link[rel="stylesheet"]')[0].outerHTML}</head><body><iframe></iframe></body></html>
|
||||
""")
|
||||
.find("head").append($('link[rel="stylesheet"]').clone()).end()
|
||||
.find('iframe').contents().children().html("""
|
||||
<html>
|
||||
<head>
|
||||
<title>Analysis</title>
|
||||
#{$('link[rel="stylesheet"]')[0].outerHTML}
|
||||
</head>
|
||||
<body class="iframe">
|
||||
<h1>Analyse your email with Fractal</h1>
|
||||
@ -156,7 +157,6 @@ class MailCatcher
|
||||
</body>
|
||||
</html>
|
||||
""")
|
||||
.find("head").append($('link[rel="stylesheet"]').clone()).end()
|
||||
# This should be cached if already accessed, so it's actually quite quick
|
||||
$.get "/messages/#{id}.html", (html) ->
|
||||
$iframe
|
||||
|
@ -152,7 +152,7 @@
|
||||
$("#message .views .analysis.tab:not(.selected)").addClass('selected');
|
||||
$("#message .views :not(.analysis).tab.selected").removeClass('selected');
|
||||
if (id != null) {
|
||||
$iframe = $('#message iframe').contents().children().html("<html class=\"mailcatcher\"><body><iframe></iframe></body></html>").find("head").append($('link[rel="stylesheet"]').clone()).end().find('iframe').contents().children().html("<html>\n<head>\n<title>Analysis</title>\n</head>\n<body class=\"iframe\">\n<h1>Analyse your email with Fractal</h1>\n<p><a href=\"http://getfractal.com/\" target=\"_blank\">Fractal</a> is a really neat service that applies common email design and development knowledge from <a href=\"http://www.email-standards.org/\" target=\"_blank\">Email Standards Project</a> to your HTML email and tells you what you've done wrong or what you should do instead.</p>\n<p>Please note that this <strong>sends your email to the Fractal service</strong> for analysis. Read their <a href=\"http://getfractal.com/terms\" target=\"_blank\">terms of service</a> if you're paranoid.</p>\n<form action=\"http://getfractal.com/validate\" method=\"POST\">\n<input type=\"hidden\" name=\"html\" />\n<input type=\"submit\" value=\"Analyse\" disabled=\"disabled\" /><span class=\"loading\" style=\"color: #999\">Loading your email...</span>\n</form>\n</body>\n</html>").find("head").append($('link[rel="stylesheet"]').clone()).end();
|
||||
$iframe = $('#message iframe').contents().children().html("<html class=\"mailcatcher\"><head>" + ($('link[rel="stylesheet"]')[0].outerHTML) + "</head><body><iframe></iframe></body></html>").find("head").append($('link[rel="stylesheet"]').clone()).end().find('iframe').contents().children().html("<html>\n<head>\n<title>Analysis</title>\n" + ($('link[rel="stylesheet"]')[0].outerHTML) + "\n</head>\n<body class=\"iframe\">\n<h1>Analyse your email with Fractal</h1>\n<p><a href=\"http://getfractal.com/\" target=\"_blank\">Fractal</a> is a really neat service that applies common email design and development knowledge from <a href=\"http://www.email-standards.org/\" target=\"_blank\">Email Standards Project</a> to your HTML email and tells you what you've done wrong or what you should do instead.</p>\n<p>Please note that this <strong>sends your email to the Fractal service</strong> for analysis. Read their <a href=\"http://getfractal.com/terms\" target=\"_blank\">terms of service</a> if you're paranoid.</p>\n<form action=\"http://getfractal.com/validate\" method=\"POST\">\n<input type=\"hidden\" name=\"html\" />\n<input type=\"submit\" value=\"Analyse\" disabled=\"disabled\" /><span class=\"loading\" style=\"color: #999\">Loading your email...</span>\n</form>\n</body>\n</html>");
|
||||
return $.get("/messages/" + id + ".html", function(html) {
|
||||
return $iframe.find('input[name="html"]').attr('value', html).end().find('.loading').hide().end().find('input[type="submit"]').attr('disabled', null).end().find('form').submit(function() {
|
||||
return $(this).find('input[type="submit"]').attr('disabled', 'disabled').end().find('.loading').text('Analysing...').show();
|
||||
|
Loading…
Reference in New Issue
Block a user