Commit b55ed79b582c474d45a028e2e204d629b84852a9
- server.py 4 -+++
- static/text-annotation.js 14 -----+++++++++
- templates/blank.html 3 ---
- Diff rendering mode:
- inline
- side by side
server.py
90 | del(i['_id']) | 90 | del(i['_id']) |
---|---|---|---|
91 | ret[y] = i | 91 | ret[y] = i |
92 | y = y + 1 | 92 | y = y + 1 |
93 | 93 | ||
94 | return render_template('blank.html', content = ret, flag =\ | ||
95 | request.args['flag']) | ||
94 | 96 | ||
95 | 97 | ||
96 | @app.route('/submit', methods=['POST']) | 98 | @app.route('/submit', methods=['POST']) |
static/text-annotation.js
51 | backdrop: false, | 51 | backdrop: false, |
---|---|---|---|
52 | }); | 52 | }); |
53 | $('.well a').click(function(event){ | 53 | $('.well a').click(function(event){ |
54 | 54 | $('.highlight').removeClass('highlight'); | |
55 | if($(event.currentTarget).text().search('#') >= 0) { | ||
55 | len = $(event.currentTarget).text().split('#').length; | 56 | len = $(event.currentTarget).text().split('#').length; |
56 | 57 | var xpath = $(event.currentTarget).text().split('#')[len-1]; | |
57 | } | 58 | } |
58 | |||
59 | 59 | else { | |
60 | var xpath = $(event.currentTarget).text(); | ||
61 | } | ||
60 | var nodes = document.evaluate(xpath, document, null, XPathResult.ANY_TYPE,null); | 62 | var nodes = document.evaluate(xpath, document, null, XPathResult.ANY_TYPE,null); |
61 | result = nodes.iterateNext(); | 63 | result = nodes.iterateNext(); |
62 | while(result){ | 64 | while(result){ |
63 | $(result).addClass("highlight"); | 65 | $(result).addClass("highlight"); |
64 | 66 | if(nodes.iterateNext) { | |
67 | result = nodes.iterateNext(); | ||
68 | } | ||
65 | } | 69 | } |
66 | }); | 70 | }); |
67 | }); | 71 | }); |
templates/blank.html
1 | <!doctype html> | 1 | <!doctype html> |
---|---|---|---|
2 | |||
3 | {% if flag == '1' %} | 2 | {% if flag == '1' %} |
4 | {% for obj in content %} | 3 | {% for obj in content %} |
5 | <div class="well"> | 4 | <div class="well"> |
… | … | ||
20 | </div> | 20 | </div> |
21 | {% endfor %} | 21 | {% endfor %} |
22 | {% endif %} | 22 | {% endif %} |
23 | |||
24 |