diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | query.py | 21 | ||||
-rw-r--r-- | static/logo.png | bin | 0 -> 13557 bytes | |||
-rw-r--r-- | static/style.css | 23 | ||||
-rw-r--r-- | templates/_base.html | 32 | ||||
-rw-r--r-- | templates/search.html | 23 |
6 files changed, 48 insertions, 52 deletions
@@ -1 +1,2 @@ index +*pyc diff --git a/query.py b/query.py deleted file mode 100644 index b9033f3..0000000 --- a/query.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/python2.6 -# coding: utf-8 -from whoosh.index import open_dir -from whoosh.qparser import QueryParser - -index = open_dir(u"index", mapped=False) - - -searcher = index.searcher() - -while True: - term = raw_input("query> ") - query = QueryParser("content").parse(term) - print query - - results = searcher.search(query) - for result in results: - print "Match in {0}".format(result.get("path")) - - print "{0} results".format(len(results)) - diff --git a/static/logo.png b/static/logo.png Binary files differnew file mode 100644 index 0000000..2e2082d --- /dev/null +++ b/static/logo.png diff --git a/static/style.css b/static/style.css index 0a036ed..5e767e8 100644 --- a/static/style.css +++ b/static/style.css @@ -1,17 +1,14 @@ div#header { font-size: 150%; } - -div#search { - text-align: center; -} - -div#search span.preSearchField { - font-style: italic; +div#header img { + float: left; } -div#content div#navigation { - text-align: center; +div#search { + position: absolute; + top: 40px; + left: 260px; } div#footer { @@ -35,14 +32,18 @@ div.book div.c_frontpage img.frontpage { overflow-y: visible; } +div.book div.c_frontpage div.loader { + display: none; + text-align: center; + padding-top: 100px; +} + div.book div.c_matches, div.book div.description { margin-left: 260px; padding-left: 5px; } - - div.book div.toolbar { background-color: white; border: 1px solid black; diff --git a/templates/_base.html b/templates/_base.html index ba9e8f2..d6d2010 100644 --- a/templates/_base.html +++ b/templates/_base.html @@ -3,30 +3,36 @@ <head> {% block head %} <link type="text/css" href="{{ url_for("static", filename="style.css") }}" rel="stylesheet" /> - <link type="text/css" href="{{ url_for("static", filename="css/ui-lightness/jquery-ui-1.8.6.custom.css") }}"rel="Stylesheet" /> + <link type="text/css" href="{{ url_for("static", filename="css/smoothness/jquery-ui-1.8.6.custom.css") }}"rel="Stylesheet" /> <script type="text/javascript" src="{{ url_for("static", filename="js/jquery-1.4.2.min.js") }}"></script> <script type="text/javascript" src="{{ url_for("static", filename="js/jquery-ui-1.8.6.custom.min.js") }}"></script> <title>{% block title %}{% endblock %} - booksearch</title> <script> - function start() { - var inputField = document.getElementById("searchInput"); - window.location = "{{ url_for("do_search") }}" + inputField.value; - return false; - } + jQuery(document).ready(function() { + function start() { + var inputField = document.getElementById("searchInput"); + window.location = "{{ url_for("do_search") }}" + inputField.value; + return false; + } + jQuery("#searchInput").bind('keyup', function(evt) { + if (evt.which == 13) + start(); + }); + jQuery("#searchSubmit").click(start); + }); </script> {% block javascript %}{% endblock %} {% endblock %} </head> <body> <div id="header"> - booksearch + <img title="A book is a loaded gun" src="{{ url_for("static", filename="logo.png") }}"/> + <div id="search"> + <input id="searchInput" type="text" value="{% block searchValue %}{% endblock %}" placeholder="terms..." size=40/> + <button id="searchSubmit">Senden</button> + </div> </div> - <div id="search"> - <span class="preSearchField">Search:</span> - <input id="searchInput" type="text" value="{% block searchValue %}{% endblock %}" placeholder="terms..." /> - <button onclick="start()">Senden</button> - </div> - <hr /> + <hr style="clear: both;"/> <div id="content"> {% block content %}{% endblock %} </div> diff --git a/templates/search.html b/templates/search.html index dc4cfe8..adbd92d 100644 --- a/templates/search.html +++ b/templates/search.html @@ -18,17 +18,22 @@ ui.newContent.children("div.excerpt").html(data); } ); - /* update image preview */ var frontpage = jQuery(this).parent().parent().find("img.frontpage"); - frontpage.attr('src', "{{ url_for("static", filename="ajax-loader.gif") }}"); + var loader = jQuery(this).parent().parent().find("div.loader"); + frontpage.attr('src', "{{ url_for("do_page_image",docnum=-9999) }}".replace("-9999", docnum)); + frontpage.hide(); + loader.show() frontpage.load(function() { - frontpage.attr('src', "{{ url_for("do_page_image",docnum=-9999) }}".replace("-9999", docnum)); + loader.hide(); + frontpage.show(); }); - - /* scroll image preview */ - var offset = ui.newHeader[0].offsetTop - frontpage.parent()[0].offsetTop; - frontpage.parent().css({paddingTop: offset+"px"}); + }); + acc.bind('accordionchange', function(event, ui) { + /* align image preview to current match */ + var frontpage = jQuery(this).parent().parent().find("img.frontpage"); + var offset = ui.newHeader[0].offsetTop - frontpage.parent()[0].offsetTop; + frontpage.parent().animate({paddingTop: offset}); }); }); </script> @@ -51,6 +56,10 @@ <div class="book"> <div class="c_frontpage"> <img class="frontpage" src="{{ url_for("do_book_frontpage", docnum=docnum) }}"/> + <div class="loader"> + <img class="ajaxLoader" src="{{ url_for("static", filename="ajax-loader.gif") }}"/> + Loading.. + </div> </div> <div class="description"> filename, creationtime, indexed-time, +any pdf metadata |