JSFiddle - React, Tailwind, and code Playground

by dandapianoman

HTML

<h1>Contract Analysis Prototype</h1>
<textarea id="contractTerm" rows="10" cols="80" style="font-size:12pt">Please enter your assignment clause here.</textarea>
<br />
<input type="submit" value="Analyze" style="font-size:12pt;font-weight:bold;" onclick="analyzeTerm()" />
<br />
<br />
<span id="analysisResults" style="visibility:hidden;">
    <h1>Results:</h1>
    <table id="resultsTable">
    </table>
</span>

CSS

*
{
    font-family: "Palatino Linotype", "Verdana", Serif;
}

td
{
    padding: 0px 5px 0px 5px;
    font-size: 12pt;
    width: 50%;
}

.right
{
    text-align: right;
}

.positive
{
    font-weight: bold;
    color: #009900;
}

.negative
{
    font-weight: bold;
    color: #990000;
}

JavaScript

// Contract Analysis Prototype 0.2

function analyzeTerm ()
{
    // Convert to uppercase; remove punctuation; remove spacing.
    var term = prepareTerm(document.getElementById('contractTerm').value);
    
    // Perform analysis.
    document.getElementById('resultsTable').innerHTML = analyzeAssignmentClause(term);
    
    // Show analysis.
    if (document.getElementById('analysisResults').getAttribute('style') == 'visibility:hidden;')
        document.getElementById('analysisResults').setAttribute('style', 'visibility:visible;');
    else
        document.getElementById('analysisResults').setAttribute('style', 'visibility:hidden;');
}

function prepareTerm (term)
{
    return term.toUpperCase().replace(new RegExp("[^A-Z0-9]", "gm"), "");
}

function analyzeAssignmentClause (term)
{
    var result = "";
    
    // Rights to money.
    var moneyExpl = "Courts favor assignments of rights to money, and will require explicit language to forbid the right to assign when a contract is no longer executory.";
    var money1 = "ANYCLAIMFORDAMAGESARISINGOUTOFTHENONASSIGNINGPARTYSBREACHOFTHEWHOLECONTRACT";
    var money2 = "ANYRIGHTSARISINGOUTOFTHEASSIGNORSFULLPERFORMANCEOFTHISAGREEMENT";
    var moneyClass = "negative";
    
    if (term.search(money1) >= 0 || term.search(money2) >= 0)
        moneyClass = "positive";
    
    var quote1 = "A promise not to assign any &quot;interests&quot; in the agreement &quot;does not clearly and unambiguously prohibit the assignment of the right to pursue a claim for breach of the contract. The term &apos;interests&apos; does not manifest an intent to include the right to sue. If it were intended, the parties would have been specific in their reference to the right to pursue a damage claim.&quot;";
    var cite1 = "<i>Lomas Mortgage U.S.A., Inc. v. W.E. O&apos;Neil Construction Co.</i>, 812 F. Supp. 841, 843-844 (N.D. Ill. 1993)";
    var quote2 = "A clause that prohibits the assignment of a party&apos;s rights under a contract and...