From 4622e6d69de9fc70dc3bcec97d9f2fa24c7d7969 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Tue, 15 Jul 2014 23:42:29 -0400 Subject: [PATCH] Clean up HTML for the result detail. --- static/script.js | 23 +++++++++++------------ static/style.css | 11 ----------- templates/index.mako | 39 ++++++++++++++++----------------------- templates/settings.mako | 2 +- 4 files changed, 28 insertions(+), 47 deletions(-) diff --git a/static/script.js b/static/script.js index 510d9a7..783ec35 100644 --- a/static/script.js +++ b/static/script.js @@ -1,17 +1,16 @@ -function copyvio_toggle_details(details) { - link = document.getElementById("cv-result-detail-link"); - details = document.getElementById("cv-result-detail"); +function copyvio_toggle_details() { + link = document.getElementById("cv-chain-link"); + table = document.getElementById("cv-chain-table"); - if (link.innerHTML == "Show details:") { - details.style.display = "block"; - link.innerHTML = "Hide details:"; - set_cookie("CopyviosShowDetails", "True", 1095); + if (link.innerHTML == "Hide comparison:") { + table.style.display = "none"; + link.innerHTML = "Show comparison:"; + set_cookie("CopyviosHideComparison", "True", 1095); } else { - details.style.display = "none"; - link.innerHTML = "Show details:"; - if (get_cookie("CopyviosShowDetails")) { - delete_cookie("CopyviosShowDetails"); - } + table.style.display = "table"; + link.innerHTML = "Hide comparison:"; + if (get_cookie("CopyviosHideComparison")) + delete_cookie("CopyviosHideComparison"); } } diff --git a/static/style.css b/static/style.css index f2d61e5..5655292 100644 --- a/static/style.css +++ b/static/style.css @@ -54,13 +54,6 @@ div#cv-result { margin: 0 5px 10px 5px; } -div#cv-result-detail { - padding: 0 10px 0 10px; - margin: 10px 10px 20px 10px; - background-color: #F3F3F3; - border: 1px solid #AAA; -} - table#heading { width: 100%; } @@ -104,10 +97,6 @@ ul#cv-result-list { margin-top: 0.5em; } -ul#cv-result-detail-list { - margin-bottom: 0; -} - a#cv-cached { position: relative; } diff --git a/templates/index.mako b/templates/index.mako index 898afe0..c46823b 100644 --- a/templates/index.mako +++ b/templates/index.mako @@ -105,7 +105,7 @@ % if result: - <% show_details = "CopyviosShowDetails" in g.cookies and g.cookies["CopyviosShowDetails"].value == "True" %> + <% hide_comparison = "CopyviosHideComparison" in g.cookies and g.cookies["CopyviosHideComparison"].value == "True" %>
% if result.violation: @@ -134,32 +134,25 @@
  • Results are cached To save time (and money), this tool will retain the results of checks for up to 72 hours. This includes the URL of the "violated" source, but neither its content nor the content of the article. Future checks on the same page (assuming it remains unchanged) will not involve additional search queries, but a fresh comparison against the source URL will be made. If the page is modified, a new check will be run. from ${result.cache_time} (${result.cache_age} ago). Bypass the cache.
  • + % if result.queries: +
  • Retrieved from cache in ${round(result.time, 3)} seconds (originally generated in ${round(result.original_time, 3)}s using ${result.queries} queries; ${round(result.original_time - result.time, 3)}s saved).
  • + % else: +
  • Retrieved from cache in ${round(result.time, 3)} seconds (originally generated in ${round(result.original_time, 3)}s; ${round(result.original_time - result.time, 3)}s saved).
  • + % endif % else:
  • Results generated in ${round(result.time, 3)} seconds using ${result.queries} queries.
  • % endif -
  • ${"Hide" if show_details else "Show"} details:
  • + % if result.queries: +
  • Fun fact: The Wikimedia Foundation paid Yahoo! Inc. $${result.queries * 0.0008} USD for these results.
  • + % endif +
  • ${"Show" if hide_comparison else "Hide"} comparison:
  • -
    -
      -
    • Trigrams: Article: ${result.article_chain.size()} / Source: ${result.source_chain.size()} / Delta: ${result.delta_chain.size()}
    • - % if result.cached: - % if result.queries: -
    • Retrieved from cache in ${round(result.time, 3)} seconds (originally generated in ${round(result.original_time, 3)}s using ${result.queries} queries; ${round(result.original_time - result.time, 3)}s saved).
    • - % else: -
    • Retrieved from cache in ${round(result.time, 3)} seconds (originally generated in ${round(result.original_time, 3)}s; ${round(result.original_time - result.time, 3)}s saved).
    • - % endif - % endif - % if result.queries: -
    • Fun fact: The Wikimedia Foundation paid Yahoo! Inc. $${result.queries * 0.0008} USD for these results.
    • - % endif -
    - - - - - -
    Article:

    ${highlight_delta(result.article_chain, result.delta_chain)}

    Source:

    ${highlight_delta(result.source_chain, result.delta_chain)}

    -
    + + + + + +
    Article:

    ${highlight_delta(result.article_chain, result.delta_chain)}

    Source:

    ${highlight_delta(result.source_chain, result.delta_chain)}

    % endif <%include file="/support/footer.mako"/> diff --git a/templates/settings.mako b/templates/settings.mako index 058f91d..7869b8d 100644 --- a/templates/settings.mako +++ b/templates/settings.mako @@ -70,7 +70,7 @@

    Cookies

    % if g.cookies: - <% cookie_order = ["CopyviosDefaultProject", "CopyviosDefaultLang", "CopyviosBackground", "CopyviosShowDetails", "CopyviosScreenCache"] %>\ + <% cookie_order = ["CopyviosDefaultProject", "CopyviosDefaultLang", "CopyviosBackground", "CopyviosHideComparison", "CopyviosScreenCache"] %>\ % for key in [key for key in cookie_order if key in g.cookies]: <% cookie = g.cookies[key] %>\