From b55ed79b582c474d45a028e2e204d629b84852a9 Mon Sep 17 00:00:00 2001 From: Anon Ray Date: Wed, 10 Jul 2013 18:11:12 +0530 Subject: [PATCH] Fix UI issues --- server.py | 4 +++- static/text-annotation.js | 14 +++++++++----- templates/blank.html | 3 --- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/server.py b/server.py index 65b31b6..6032698 100644 --- a/server.py +++ b/server.py @@ -90,7 +90,9 @@ def search(): del(i['_id']) ret[y] = i y = y + 1 - return render_template('blank.html', content = ret, flag = request.args['flag']) + + return render_template('blank.html', content = ret, flag =\ + request.args['flag']) @app.route('/submit', methods=['POST']) diff --git a/static/text-annotation.js b/static/text-annotation.js index f191dcf..40b2fb0 100644 --- a/static/text-annotation.js +++ b/static/text-annotation.js @@ -51,17 +51,21 @@ var attributes = {}; backdrop: false, }); $('.well a').click(function(event){ - if($(event.currentTarget).text().search('#')){ + $('.highlight').removeClass('highlight'); + if($(event.currentTarget).text().search('#') >= 0) { len = $(event.currentTarget).text().split('#').length; - xpath = $(event.currentTarget).text().split('#')[len-1]; + var xpath = $(event.currentTarget).text().split('#')[len-1]; } - else - xpath = $(event.currentTarget).text(); + else { + var xpath = $(event.currentTarget).text(); + } var nodes = document.evaluate(xpath, document, null, XPathResult.ANY_TYPE,null); result = nodes.iterateNext(); while(result){ $(result).addClass("highlight"); - result = nodes.iterateNext(); + if(nodes.iterateNext) { + result = nodes.iterateNext(); + } } }); }); diff --git a/templates/blank.html b/templates/blank.html index 57a68c9..fb3c9f5 100644 --- a/templates/blank.html +++ b/templates/blank.html @@ -1,5 +1,4 @@ - {% if flag == '1' %} {% for obj in content %}
@@ -21,5 +20,3 @@
{% endfor %} {% endif %} - - -- 1.7.10.4