diff options
author | yvesf <yvesf-git@xapek.org> | 2010-11-22 19:54:33 +0100 |
---|---|---|
committer | yvesf <yvesf-git@xapek.org> | 2010-11-22 19:54:33 +0100 |
commit | 858107a929e826681629f34b384926488aeb1cd1 (patch) | |
tree | b6cb1b1497c2af8bb939ca8640caf5143616975e /templates | |
parent | 37212428d94d95b14618a2e69610fa77c99ae123 (diff) | |
download | booksearch-858107a929e826681629f34b384926488aeb1cd1.tar.gz booksearch-858107a929e826681629f34b384926488aeb1cd1.zip |
scroll preview page to page-match; sort matches by pagenumber
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> |