Remove fractal analysis, it doesn't work at the moment anyway

This commit is contained in:
Samuel Cochran 2014-03-26 20:33:37 +11:00
parent 65743c22fd
commit 184773b664
5 changed files with 1 additions and 429 deletions

View File

@ -4,7 +4,6 @@
#= require favcount
#= require flexie
#= require keymaster
#= require xslt
# Add a new jQuery selector expression which does a case-insensitive :contains
jQuery.expr[":"].icontains = (a, i, m) ->
@ -27,10 +26,6 @@ class MailCatcher
e.preventDefault()
@loadMessageBody @selectedMessage(), $($(e.currentTarget).parent("li")).data("message-format")
$("#message .views .analysis.tab a").live "click", (e) =>
e.preventDefault()
@loadMessageAnalysis @selectedMessage()
$("#message iframe").load =>
@decorateMessageBody()
@ -254,10 +249,7 @@ class MailCatcher
$("#message .views .download a").attr("href", "/messages/#{id}.eml")
if $("#message .views .tab.analysis.selected").length
@loadMessageAnalysis()
else
@loadMessageBody()
@loadMessageBody()
# XXX: These should probably cache their iframes for the current message now we're using a remote service:

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/xml">
<section class="fractal-analysis">
<h1>Fractal Results</h1>
<xsl:choose>
<xsl:when test="not(result/errors/node())">
<p class="report-intro valid">Your HTML and CSS for your email is valid.</p>
</xsl:when>
<xsl:otherwise>
<p class="report-intro invalid">Your HTML and CSS for your email contains potential errors:</p>
<ol>
<xsl:for-each select="result/errors/error">
<li>
<p class="error-intro">The <code><xsl:value-of select="rule/rule_name" /></code> near <code><xsl:value-of select="snippet" /></code> on line <code><xsl:value-of select="error_line" /></code> of your code.</p>
<dl class="unsupported-clients">
<dt>This is unsupported in:</dt>
<dd>
<ul>
<xsl:for-each select="rule/email_client//item">
<li><xsl:value-of select="." /></li>
</xsl:for-each>
</ul>
</dd>
</dl>
</li>
</xsl:for-each>
</ol>
</xsl:otherwise>
</xsl:choose>
</section>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,122 +0,0 @@
/*
* jquery.xslt.js
*
* Copyright (c) 2005-2008 Johann Burkard (<mailto:jb@eaio.com>)
* <http://eaio.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
* jQuery client-side XSLT plugins.
*
* @author <a href="mailto:jb@eaio.com">Johann Burkard</a>
* @version $Id: jquery.xslt.js,v 1.10 2008/08/29 21:34:24 Johann Exp $
*/
(function($) {
$.fn.xslt = function() {
return this;
}
var str = /^\s*</;
if (document.recalc) { // IE 5+
$.fn.xslt = function(xml, xslt) {
var target = $(this);
var change = function() {
var c = 'complete';
if (xm.readyState == c && xs.readyState == c) {
window.setTimeout(function() {
target.html(xm.transformNode(xs.XMLDocument));
}, 50);
}
};
var xm = document.createElement('xml');
xm.onreadystatechange = change;
xm[str.test(xml) ? "innerHTML" : "src"] = xml;
var xs = document.createElement('xml');
xs.onreadystatechange = change;
xs[str.test(xslt) ? "innerHTML" : "src"] = xslt;
$('body').append(xm).append(xs);
return this;
};
}
else if (window.DOMParser != undefined && window.XMLHttpRequest != undefined && window.XSLTProcessor != undefined) { // Mozilla 0.9.4+, Opera 9+
var processor = new XSLTProcessor();
var support = false;
if ($.isFunction(processor.transformDocument)) {
support = window.XMLSerializer != undefined;
}
else {
support = true;
}
if (support) {
$.fn.xslt = function(xml, xslt) {
var target = $(this);
var transformed = false;
var xm = {
readyState: 4
};
var xs = {
readyState: 4
};
var change = function() {
if (xm.readyState == 4 && xs.readyState == 4 && !transformed) {
var processor = new XSLTProcessor();
if ($.isFunction(processor.transformDocument)) {
// obsolete Mozilla interface
resultDoc = document.implementation.createDocument("", "", null);
processor.transformDocument(xm.responseXML, xs.responseXML, resultDoc, null);
target.html(new XMLSerializer().serializeToString(resultDoc));
}
else {
processor.importStylesheet(xs.responseXML);
resultDoc = processor.transformToFragment(xm.responseXML, document);
target.empty().append(resultDoc);
}
transformed = true;
}
};
if (str.test(xml)) {
xm.responseXML = new DOMParser().parseFromString(xml, "text/xml");
}
else {
xm = $.ajax({ dataType: "xml", url: xml});
xm.onreadystatechange = change;
}
if (str.test(xslt)) {
xs.responseXML = new DOMParser().parseFromString(xslt, "text/xml");
change();
}
else {
xs = $.ajax({ dataType: "xml", url: xslt});
xs.onreadystatechange = change;
}
return this;
};
}
}
})(jQuery);

View File

@ -1,263 +0,0 @@
/*
* xslt.js
*
* Copyright (c) 2005-2008 Johann Burkard (<mailto:jb@eaio.com>)
* <http://eaio.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
* Constructor for client-side XSLT transformations.
*
* @author <a href="mailto:jb@eaio.com">Johann Burkard</a>
* @version $Id: xslt.js,v 1.7 2008/08/29 21:22:55 Johann Exp $
* @constructor
*/
function Transformation() {
var xml;
var xmlDoc;
var xslt;
var xsltDoc;
var callback = function() {};
/**
* Sort of like a fix for Opera who doesn't always get readyStates right.
*/
var transformed = false;
/**
* Returns the URL of the XML document.
*
* @return the URL of the XML document
* @type String
*/
this.getXml = function() {
return xml;
}
/**
* Returns the XML document.
*
* @return the XML document
*/
this.getXmlDocument = function() {
return xmlDoc
}
/**
* Sets the URL of the XML document.
*
* @param x the URL of the XML document
* @return this
* @type Transformation
*/
this.setXml = function(x) {
xml = x;
return this;
}
/**
* Returns the URL of the XSLT document.
*
* @return the URL of the XSLT document
* @type String
*/
this.getXslt = function() {
return xslt;
}
/**
* Returns the XSLT document.
*
* @return the XSLT document
*/
this.getXsltDocument = function() {
return xsltDoc;
}
/**
* Sets the URL of the XSLT document.
*
* @param x the URL of the XML document
* @return this
* @type Transformation
*/
this.setXslt = function(x) {
xslt = x;
return this;
}
/**
* Returns the callback function.
*
* @return the callback function
*/
this.getCallback = function() {
return callback;
}
/**
* Sets the callback function
*
* @param c the callback function
* @return this
* @type Transformation
*/
this.setCallback = function(c) {
callback = c;
return this;
}
/**
* Sets the target element to write the transformed content to and <em>asynchronously</em>
* starts the transformation process.
* <p>
* <code>target</code> is the ID of an element. 2DO
* <p>
* This method may only be called after {@link #setXml} and {@link #setXslt} have
* been called.
* <p>
* Note that the target element must exist once this method is called. Calling
* this method before <code>onload</code> was fired will most likely
* not work.
*
* @param target the ID of an element
*/
this.transform = function(target) {
if (!browserSupportsXSLT()) {
return;
}
var str = /^\s*</;
var t = this;
if (document.recalc) {
var change = function() {
var c = 'complete';
if (xm.readyState == c && xs.readyState == c) {
window.setTimeout(function() {
xmlDoc = xm.XMLDocument;
xsltDoc = xs.XMLDocument;
callback(t);
document.all[target].innerHTML = xm.transformNode(xs.XMLDocument);
}, 50);
}
};
var xm = document.createElement('xml');
xm.onreadystatechange = change;
xm[str.test(xml) ? "innerHTML" : "src"] = xml;
var xs = document.createElement('xml');
xs.onreadystatechange = change;
xs[str.test(xslt) ? "innerHTML" : "src"] = xslt;
with (document.body) {
insertBefore(xm);
insertBefore(xs);
};
}
else {
var transformed = false;
var xm = {
readyState: 4
};
var xs = {
readyState: 4
};
var change = function() {
if (xm.readyState == 4 && xs.readyState == 4 && !transformed) {
xmlDoc = xm.responseXML;
xsltDoc = xs.responseXML;
var resultDoc;
var processor = new XSLTProcessor();
if (typeof processor.transformDocument == 'function') {
// obsolete Mozilla interface
resultDoc = document.implementation.createDocument("", "", null);
processor.transformDocument(xm.responseXML, xs.responseXML, resultDoc, null);
var out = new XMLSerializer().serializeToString(resultDoc);
callback(t);
document.getElementById(target).innerHTML = out;
}
else {
processor.importStylesheet(xs.responseXML);
resultDoc = processor.transformToFragment(xm.responseXML, document);
callback(t);
document.getElementById(target).innerHTML = '';
document.getElementById(target).appendChild(resultDoc);
}
transformed = true;
}
};
if (str.test(xml)) {
xm.responseXML = new DOMParser().parseFromString(xml, "text/xml");
}
else {
xm = new XMLHttpRequest();
xm.onreadystatechange = change;
xm.open("GET", xml);
xm.send(null);
}
if (str.test(xslt)) {
xs.responseXML = new DOMParser().parseFromString(xslt, "text/xml");
change();
}
else {
xs = new XMLHttpRequest();
xs.onreadystatechange = change;
xs.open("GET", xslt);
xs.send(null);
}
}
}
}
/**
* Returns whether the browser supports XSLT.
*
* @return the browser supports XSLT
* @type boolean
*/
function browserSupportsXSLT() {
var support = false;
if (document.recalc) { // IE 5+
support = true;
}
else if (window.XMLHttpRequest != undefined && window.XSLTProcessor != undefined) { // Mozilla 0.9.4+, Opera 9+
var processor = new XSLTProcessor();
if (typeof processor.transformDocument == 'function') {
support = window.XMLSerializer != undefined;
}
else {
support = true;
}
}
return support;
}

View File

@ -50,8 +50,6 @@
%a{:href => "#"} Plain Text
%li.format.tab.source{"data-message-format" => "source"}
%a{:href => "#"} Source
%li.tab.analysis
%a{:href => "#"} Analysis
%li.action.download
%a.button{:href => "#"}
%span Download