diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/search.html | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/templates/search.html b/templates/search.html index d4e8590..b99c053 100644 --- a/templates/search.html +++ b/templates/search.html @@ -1,31 +1,34 @@ {% extends "_base.html" %} {% block title %} - {% if term != "" %} - {{ term }} - {% else %} - Start a new Search - {% endif %} + {% if term: %}{{ term }}{% else %}Start a new Search{% endif %} {% endblock %} {% block searchValue %}{{ term }}{% endblock %} {% block javascript %} <script> jQuery(document).ready(function() { - var acc = jQuery("div.matches").accordion({active:false}); + // createa accordion for all books + var acc = jQuery("div.book div.matches").accordion({active:false, autoHeight:false}); + // accordion change handler acc.bind('accordionchangestart', function(event, ui) { var docnum = ui.newContent.find("p.docnum").text(); var term = ui.newContent.find("p.term").text(); + /* load excerpt */ jQuery.get('/excerpt/' + docnum + '/' + term, function(data) { ui.newContent.children("div.excerpt").html(data); - ui.newHeader.parent().accordion('resize'); - ui.newHeader.parent().accordion('resize'); } ); - var frontpage = jQuery(this).parent().parent().children("img.frontpage"); + + /* update image preview */ + var frontpage = jQuery(this).parent().parent().find("img.frontpage"); frontpage.attr('src', '/static/ajax-loader.gif'); frontpage.load(function() { frontpage.attr('src', '/page/image/' + docnum); }); + + /* scroll image preview */ + var offset = ui.newHeader[0].offsetTop - frontpage.parent()[0].offsetTop; + frontpage.parent().css({paddingTop: offset+"px"}); }); }); </script> @@ -36,7 +39,9 @@ {% for docnum, matches in matches.items() %} <h2 asd="foo"> <a href="{{ url_for("do_book_file", docnum=docnum) }}">book: {{ docnum }}</a> </h2> <div class="book"> - <img class="frontpage" src="{{ url_for("do_book_frontpage", docnum=docnum) }}"/> + <div class="c_frontpage"> + <img class="frontpage" src="{{ url_for("do_book_frontpage", docnum=docnum) }}"/> + </div> <div class="description"> filename, creationtime, indexed-time, +any pdf metadata </div> |