From e0b964fcdf10e6905bf9c4d64baeaf6b1a163faa Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 5 Sep 2014 23:30:24 -0500 Subject: [PATCH] Hide URLs after the first 10 by default. --- static/script.js | 10 ++++++++++ static/style.css | 4 ++++ templates/index.mako | 41 ++++++++++++++++++++++++----------------- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/static/script.js b/static/script.js index 4317e49..ed8bd45 100644 --- a/static/script.js +++ b/static/script.js @@ -109,4 +109,14 @@ $(document).ready(function() { $(".cv-search[type='hidden'][name='use_links'").prop("disabled", true); } }); + + if ($("#cv-additional").length) { + $("#cv-additional").css("display", "block"); + $(".source-default-hidden").css("display", "none"); + $("#show-additional-sources").click(function() { + $(".source-default-hidden").css("display", ""); + $("#cv-additional").css("display", "none"); + return false; + }); + } }); diff --git a/static/style.css b/static/style.css index 3ea66b5..8d88877 100644 --- a/static/style.css +++ b/static/style.css @@ -54,6 +54,10 @@ div#cv-result { margin: 15px 5px 10px 5px; } +div#cv-additional { + display: none; +} + table#heading { width: 100%; } diff --git a/templates/index.mako b/templates/index.mako index 2af1828..f99a10a 100644 --- a/templates/index.mako +++ b/templates/index.mako @@ -165,25 +165,32 @@ <% skips = False %> % if query.action == "search": - - - - - - - % for source in result.sources: +
+
URLCompareConfidence
- - - % if source.skipped: - <% skips = True %> - - % else: - - % endif + + + - % endfor -
${source.url | h}CompareSkipped= T_SUSPECT else "source-possible" if source.confidence >= T_POSSIBLE else "source-novio"}">${round(source.confidence * 100, 1)}%URLCompareConfidence
+ % for i, source in enumerate(result.sources): + = 10 else ""}> + ${source.url | h} + Compare + % if source.skipped: + <% skips = True %> + Skipped + % else: + = T_SUSPECT else "source-possible" if source.confidence >= T_POSSIBLE else "source-novio"}">${round(source.confidence * 100, 1)}% + % endif + + % endfor + + % if len(result.sources) > 10: +
+ ${len(result.sources) - 10} additional sources hidden. Show them. +

+ % endif +
% endif