diff --git a/mailcatcher.gemspec b/mailcatcher.gemspec
index 9f330e6..67bba91 100644
--- a/mailcatcher.gemspec
+++ b/mailcatcher.gemspec
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
"public/images/**/*",
"public/javascripts/**/*.js",
"public/stylesheets/**/*.css",
+ "public/stylesheets/**/*.xsl",
"views/**/*"
]
s.require_paths = ["lib"]
diff --git a/public/javascripts/application.coffee b/public/javascripts/application.coffee
index f0185c2..60286fd 100644
--- a/public/javascripts/application.coffee
+++ b/public/javascripts/application.coffee
@@ -150,7 +150,6 @@ class MailCatcher
Analyse your email with Fractal
Fractal is a really neat service that applies common email design and development knowledge from Email Standards Project to your HTML email and tells you what you've done wrong or what you should do instead.
Please note that this sends your email to the Fractal service for analysis. Read their terms of service if you're paranoid.
- (This output is still just raw XML. Someone keen to transform this into something prettier would be greatly appreciated!)
@@ -163,13 +162,8 @@ class MailCatcher
$(this)
.find('input[type="submit"]').attr('disabled', 'disabled').end()
.find('.loading').show()
- $.ajax
- url: "/messages/#{id}/analysis.xml",
- dataType: "text"
- success: (data) ->
- $form.replaceWith('Results
')
- $iframe.find("#result").text data
-
+ $form.xslt("/messages/#{id}/analysis.xml", "/stylesheets/analysis.xsl")
+
refresh: ->
$.getJSON '/messages', (messages) =>
$.each messages, (i, message) =>
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 4c372ff..1255466 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -155,18 +155,11 @@
$("#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("\n\nAnalysis\n" + ($('link[rel="stylesheet"]')[0].outerHTML) + "\n\n\nAnalyse your email with Fractal
\nFractal is a really neat service that applies common email design and development knowledge from Email Standards Project to your HTML email and tells you what you've done wrong or what you should do instead.
\nPlease note that this sends your email to the Fractal service for analysis. Read their terms of service if you're paranoid.
\n(This output is still just raw XML. Someone keen to transform this into something prettier would be greatly appreciated!)
\n\n\n");
+ $iframe = $('#message iframe').contents().children().html("\n\nAnalysis\n" + ($('link[rel="stylesheet"]')[0].outerHTML) + "\n\n\nAnalyse your email with Fractal
\nFractal is a really neat service that applies common email design and development knowledge from Email Standards Project to your HTML email and tells you what you've done wrong or what you should do instead.
\nPlease note that this sends your email to the Fractal service for analysis. Read their terms of service if you're paranoid.
\n\n\n");
return $form = $iframe.find('form').submit(function(e) {
e.preventDefault();
$(this).find('input[type="submit"]').attr('disabled', 'disabled').end().find('.loading').show();
- return $.ajax({
- url: "/messages/" + id + "/analysis.xml",
- dataType: "text",
- success: function(data) {
- $form.replaceWith('Results
');
- return $iframe.find("#result").text(data);
- }
- });
+ return $form.xslt("/messages/" + id + "/analysis.xml", "/stylesheets/analysis.xsl");
});
}
};
diff --git a/public/javascripts/xslt-3.2.js b/public/javascripts/xslt-3.2.js
new file mode 100644
index 0000000..cc199ea
--- /dev/null
+++ b/public/javascripts/xslt-3.2.js
@@ -0,0 +1 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(2(C){C.l.h=2(){k 7};0 D=/^\\s*;1(a.11){C.l.h=2(F,G){0 H=C(7);0 J=2(){0 K="V";1(I.5==K&&E.5==K){b.W(2(){H.z(I.P(E.Q))},R)}};0 I=a.r("6");I.d=J;I[D.f(F)?"n":"o"]=F;0 E=a.r("6");E.d=J;E[D.f(G)?"n":"o"]=G;C("T").g(I).g(E);k 7}}8{1(b.m!=e&&b.U!=e&&b.i!=e){0 B=9 i();0 A=t;1(C.v(B.j)){A=b.M!=e}8{A=q}1(A){C.l.h=2(G,H){0 I=C(7);0 F=t;0 J={5:4};0 E={5:4};0 K=2(){1(J.5==4&&E.5==4&&!F){0 L=9 i();1(C.v(L.j)){c=a.X.Y("","",y);L.j(J.3,E.3,c,y);I.z(9 M().Z(c))}8{L.10(E.3);c=L.O(J.3,a);I.S().g(c)}F=q}};1(D.f(G)){J.3=9 m().x(G,"p/6")}8{J=C.u({w:"6",N:G});J.d=K}1(D.f(H)){E.3=9 m().x(H,"p/6");K()}8{E=C.u({w:"6",N:H});E.d=K}k 7}}}}})(12);',62,65,'var|if|function|responseXML||readyState|xml|this|else|new|document|window|resultDoc|onreadystatechange|undefined|test|append|xslt|XSLTProcessor|transformDocument|return|fn|DOMParser|innerHTML|src|text|true|createElement||false|ajax|isFunction|dataType|parseFromString|null|html|||||||||||||XMLSerializer|url|transformToFragment|transformNode|XMLDocument|50|empty|body|XMLHttpRequest|complete|setTimeout|implementation|createDocument|serializeToString|importStylesheet|recalc|jQuery'.split('|'),0,{}))
diff --git a/public/stylesheets/analysis.xsl b/public/stylesheets/analysis.xsl
new file mode 100644
index 0000000..81713f6
--- /dev/null
+++ b/public/stylesheets/analysis.xsl
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+ . The near on line of your code.
+
+
+ - This is unsupported in:
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 6948286..8b21d54 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -335,6 +335,23 @@ body > header {
#message > header .views .action {
*display: inline; }
+.fractal-analysis .report-intro {
+ background: #eef4f5;
+ margin-top: 1.5em;
+ padding: 1em; }
+ .fractal-analysis .report-intro strong {
+ font-weight: bold; }
+ .fractal-analysis .report-intro .code {
+ background-color: white;
+ font-family: comic Sans MS;
+ padding: 1px 5px; }
+.fractal-analysis .unsupported-clients {
+ margin: 1em; }
+ .fractal-analysis .unsupported-clients dt {
+ padding-left: 1em; }
+ .fractal-analysis .unsupported-clients dd {
+ padding-left: 2em; }
+
iframe {
display: -moz-box;
display: -webkit-box;
diff --git a/public/stylesheets/application.sass b/public/stylesheets/application.sass
index 09961bd..1391763 100644
--- a/public/stylesheets/application.sass
+++ b/public/stylesheets/application.sass
@@ -200,6 +200,24 @@ body > header
float: right
margin: 0 .25em
+.fractal-analysis
+ .report-intro
+ background: #EEF4F5
+ margin-top: 1.5em
+ padding: 1em
+ strong
+ font-weight: bold
+ .code
+ background-color: white
+ font-family: comic Sans MS
+ padding: 1px 5px
+ .unsupported-clients
+ margin: 1em
+ dt
+ padding-left: 1em
+ dd
+ padding-left: 2em
+
iframe
+display-box
+box-flex(1)