ソースを参照

Clean up HTML for the result detail.

pull/24/head
Ben Kurtovic 10年前
コミット
4622e6d69d
4個のファイルの変更28行の追加47行の削除
  1. +11
    -12
      static/script.js
  2. +0
    -11
      static/style.css
  3. +16
    -23
      templates/index.mako
  4. +1
    -1
      templates/settings.mako

+ 11
- 12
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");
}
}



+ 0
- 11
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;
}


+ 16
- 23
templates/index.mako ファイルの表示

@@ -105,7 +105,7 @@
</table>
</form>
% 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" %>
<div class="divider"></div>
<div id="cv-result" class="${'red' if result.violation else 'green'}-box">
% if result.violation:
@@ -134,32 +134,25 @@
<li>Results are <a id="cv-cached" href="#">cached
<span>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.</span>
</a> from ${result.cache_time} (${result.cache_age} ago). <a href="${request.url | httpsfix, h}&amp;nocache=1">Bypass the cache.</a></li>
% if result.queries:
<li>Retrieved from cache in <span class="mono">${round(result.time, 3)}</span> seconds (originally generated in <span class="mono">${round(result.original_time, 3)}</span>s using <span class="mono">${result.queries}</span> queries; <span class="mono">${round(result.original_time - result.time, 3)}</span>s saved).</li>
% else:
<li>Retrieved from cache in <span class="mono">${round(result.time, 3)}</span> seconds (originally generated in <span class="mono">${round(result.original_time, 3)}</span>s; <span class="mono">${round(result.original_time - result.time, 3)}</span>s saved).</li>
% endif
% else:
<li>Results generated in <span class="mono">${round(result.time, 3)}</span> seconds using <span class="mono">${result.queries}</span> queries.</li>
% endif
<li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">${"Hide" if show_details else "Show"} details:</a></li>
% if result.queries:
<li><i>Fun fact:</i> The Wikimedia Foundation paid Yahoo! Inc. <a href="http://info.yahoo.com/legal/us/yahoo/search/bosspricing/details.html">$${result.queries * 0.0008} USD</a> for these results.</li>
% endif
<li><a id="cv-chain-link" href="#cv-chain-table" onclick="copyvio_toggle_details()">${"Show" if hide_comparison else "Hide"} comparison:</a></li>
</ul>
<div id="cv-result-detail" style="display: ${'block' if show_details else 'none'};">
<ul id="cv-result-detail-list">
<li>Trigrams: <i>Article:</i> <span class="mono">${result.article_chain.size()}</span> / <i>Source:</i> <span class="mono">${result.source_chain.size()}</span> / <i>Delta:</i> <span class="mono">${result.delta_chain.size()}</span></li>
% if result.cached:
% if result.queries:
<li>Retrieved from cache in <span class="mono">${round(result.time, 3)}</span> seconds (originally generated in <span class="mono">${round(result.original_time, 3)}</span>s using <span class="mono">${result.queries}</span> queries; <span class="mono">${round(result.original_time - result.time, 3)}</span>s saved).</li>
% else:
<li>Retrieved from cache in <span class="mono">${round(result.time, 3)}</span> seconds (originally generated in <span class="mono">${round(result.original_time, 3)}</span>s; <span class="mono">${round(result.original_time - result.time, 3)}</span>s saved).</li>
% endif
% endif
% if result.queries:
<li><i>Fun fact:</i> The Wikimedia Foundation paid Yahoo! Inc. <a href="http://info.yahoo.com/legal/us/yahoo/search/bosspricing/details.html">$${result.queries * 0.0008} USD</a> for these results.</li>
% endif
</ul>
<table id="cv-chain-table">
<tr>
<td class="cv-chain-cell">Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.delta_chain)}</p></div></td>
<td class="cv-chain-cell">Source: <div class="cv-chain-detail"><p>${highlight_delta(result.source_chain, result.delta_chain)}</p></div></td>
</tr>
</table>
</div>
<table id="cv-chain-table" style="display: ${'none' if hide_comparison else 'table'};">
<tr>
<td class="cv-chain-cell">Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.delta_chain)}</p></div></td>
<td class="cv-chain-cell">Source: <div class="cv-chain-detail"><p>${highlight_delta(result.source_chain, result.delta_chain)}</p></div></td>
</tr>
</table>
</div>
% endif
<%include file="/support/footer.mako"/>

+ 1
- 1
templates/settings.mako ファイルの表示

@@ -70,7 +70,7 @@
<h2>Cookies</h2>
% if g.cookies:
<table>
<% 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] %>\
<tr>


読み込み中…
キャンセル
保存