Selaa lähdekoodia

Polishing for URL list; remove 'hide comparison' option.

pull/24/head
Ben Kurtovic 10 vuotta sitten
vanhempi
commit
10c68e6823
4 muutettua tiedostoa jossa 38 lisäystä ja 32 poistoa
  1. +0
    -16
      static/script.js
  2. +18
    -2
      static/style.css
  3. +19
    -13
      templates/index.mako
  4. +1
    -1
      templates/settings.mako

+ 0
- 16
static/script.js Näytä tiedosto

@@ -1,19 +1,3 @@
function copyvio_toggle_details() {
link = document.getElementById("cv-chain-link");
table = document.getElementById("cv-chain-table");

if (link.innerHTML == "Hide comparison:") {
table.style.display = "none";
link.innerHTML = "Show comparison:";
set_cookie("CopyviosHideComparison", "True", 1095);
} else {
table.style.display = "table";
link.innerHTML = "Hide comparison:";
if (get_cookie("CopyviosHideComparison"))
delete_cookie("CopyviosHideComparison");
}
}

function update_screen_size() {
var cache = cache_cookie();
var data = {


+ 18
- 2
static/style.css Näytä tiedosto

@@ -54,7 +54,15 @@ div#cv-result {
margin: 15px 5px 10px 5px;
}

div#sources-container {
padding: 5px 10px;
margin: 15px 5px 10px 5px;
background-color: #EEE;
border: 1px solid #BBB;
}

div#cv-additional {
padding-bottom: 5px;
display: none;
}

@@ -73,7 +81,7 @@ table#cv-form-inner {

table#cv-result-sources {
width: 100%;
background-color: #EEE;
border-spacing: 0 4px;
}

table#cv-result-sources th {
@@ -81,7 +89,7 @@ table#cv-result-sources th {
}

table#cv-result-sources tr:nth-child(even) {
background-color: #F0F0F0;
background-color: #E0E0E0;
}

table#cv-chain-table {
@@ -131,6 +139,14 @@ ul#cv-result-list {
margin: 0.5em 0;
}

span#cv-additional-text {
font-style: italic;
}

a#source-selected {
font-weight: bold;
}

a#cv-cached {
position: relative;
}


+ 19
- 13
templates/index.mako Näytä tiedosto

@@ -145,7 +145,6 @@
</table>
</form>
% if result:
<% hide_comparison = "CopyviosHideComparison" in g.cookies and g.cookies["CopyviosHideComparison"].value == "True" %>
<div id="cv-result" class="${'red' if result.confidence >= T_SUSPECT else 'yellow' if result.confidence >= T_POSSIBLE else 'green'}-box">
<h2 id="cv-result-header">
% if result.confidence >= T_POSSIBLE:
@@ -169,25 +168,33 @@
<table id="cv-result-sources">
<tr>
<th>URL</th>
<th>Compare</th>
<th>Confidence</th>
<th>Compare</th>
</tr>
% for i, source in enumerate(result.sources):
<tr ${'class="source-default-hidden"' if i >= 10 else ""}>
<td><a href="${source.url | h}">${source.url | h}</a></td>
<td><a href="${request.url | httpsfix, h}&amp;action=compare&amp;url=${source.url | u}">Compare</a></td>
% if source.skipped:
<% skips = True %>
<td><span class="source-skipped">Skipped</span></td>
% else:
<td><span class="source-confidence ${"source-suspect" if source.confidence >= T_SUSPECT else "source-possible" if source.confidence >= T_POSSIBLE else "source-novio"}">${round(source.confidence * 100, 1)}%</span></td>
% endif
<td><a ${'id="source-selected"' if i == 0 else ""} href="${source.url | h}">${source.url | h}</a></td>
<td>
% if source.skipped:
<% skips = True %>
<span class="source-skipped">Skipped</span>
% else:
<span class="source-confidence ${"source-suspect" if source.confidence >= T_SUSPECT else "source-possible" if source.confidence >= T_POSSIBLE else "source-novio"}">${round(source.confidence * 100, 1)}%</span>
% endif
</td>
<td>
% if i == 0:
<a href="#cv-chain-table">Compare</a>
% else:
<a href="${request.url | httpsfix, h}&amp;action=compare&amp;url=${source.url | u}">Compare</a>
% endif
</td>
</tr>
% endfor
</table>
% if len(result.sources) > 10:
<div id="cv-additional">
${len(result.sources) - 10} URL${"s" if len(result.sources) > 11 else ""} with lower confidence hidden. <a id="show-additional-sources" href="#">Show them.</a>
<span id="cv-additional-text">${len(result.sources) - 10} URL${"s" if len(result.sources) > 11 else ""} with lower confidence hidden.</span> <a id="show-additional-sources" href="#">Show them.</a>
</div>
% endif
</div>
@@ -209,9 +216,8 @@
% 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-chain-link" href="#cv-chain-table" onclick="copyvio_toggle_details()">${"Show" if hide_comparison else "Hide"} comparison:</a></li>
</ul>
<table id="cv-chain-table" style="display: ${'none' if hide_comparison else 'table'};">
<table id="cv-chain-table">
<tr>
<td class="cv-chain-cell">Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.best.chains[1] if result.best else None)}</p></div></td>
<td class="cv-chain-cell">Source: <div class="cv-chain-detail"><p>${highlight_delta(result.best.chains[0], result.best.chains[1]) if result.best else ""}</p></div></td>


+ 1
- 1
templates/settings.mako Näytä tiedosto

@@ -70,7 +70,7 @@
<h2>Cookies</h2>
% if g.cookies:
<table>
<% cookie_order = ["CopyviosDefaultProject", "CopyviosDefaultLang", "CopyviosBackground", "CopyviosHideComparison", "CopyviosScreenCache"] %>\
<% cookie_order = ["CopyviosDefaultProject", "CopyviosDefaultLang", "CopyviosBackground", "CopyviosScreenCache"] %>\
% for key in [key for key in cookie_order if key in g.cookies]:
<% cookie = g.cookies[key] %>\
<tr>


Ladataan…
Peruuta
Tallenna