Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title><%= title %></title> |
| 5 | %= stylesheet '/style.css' |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 6 | %= stylesheet '/hint.css' |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 7 | %= stylesheet '/table.css' |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 8 | %= stylesheet '/kwic-4.0.css' |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 9 | %= stylesheet '/fontawesome/font-awesome.min.css' |
Nils Diewald | bd56adc | 2014-06-22 18:44:53 +0000 | [diff] [blame] | 10 | %= stylesheet '/responsive.css', media => '(max-width: 640px)' |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 11 | %= javascript '/jquery-2.0.0.min.js' |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 12 | %= javascript '/translateTable.js' |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 13 | %= javascript '/hint.js' |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 14 | <meta charset="utf-8" /> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 15 | </head> |
| 16 | <body> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 17 | |
Nils Diewald | db03fa9 | 2014-06-23 13:36:55 +0000 | [diff] [blame^] | 18 | % my $search_route = url_for; |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame] | 19 | % unless (current_route 'tutorial') { |
Nils Diewald | db03fa9 | 2014-06-23 13:36:55 +0000 | [diff] [blame^] | 20 | <div id="tutorial"> |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame] | 21 | % my $tut_page = url_for(session('tutorial') || 'tutorial'); |
| 22 | <a href="<%= $tut_page %>" target="_blank"><i title="Open in new tab" class="fa fa-external-link-square"></i></a> |
| 23 | <i onclick="closeTutorial()" title="close" class="fa fa-toggle-up"></i> |
| 24 | <iframe src="about:blank" data-src="<%= $tut_page->query([snippet => 1]) %>"></iframe> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 25 | </div> |
Nils Diewald | db03fa9 | 2014-06-23 13:36:55 +0000 | [diff] [blame^] | 26 | % } |
| 27 | % else { |
| 28 | % $search_route = url_for('index'); |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame] | 29 | % }; |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 30 | |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 31 | <div id="top"> |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame] | 32 | <a href="<%= url_for 'index' %>"><h1><span>KorAP- Korpusanalyseplattform der nächsten Generation</span></h1></a> |
Nils Diewald | db03fa9 | 2014-06-23 13:36:55 +0000 | [diff] [blame^] | 33 | |
| 34 | |
| 35 | %= form_for $search_route => begin |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 36 | %= select_field ql => [[Poliqarp => 'poliqarp'], ['Cosmas II' => 'cosmas2']], id => 'ql-field' |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 37 | <br /> |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 38 | %= search_field 'q', id => 'q-field', autofocus => 'autofocus' |
| 39 | %= javascript begin |
| 40 | new Hint({ |
| 41 | "ref" : "q-field", |
Nils Diewald | 465c425 | 2014-06-20 21:51:58 +0000 | [diff] [blame] | 42 | "qlRef" : "ql-field", |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 43 | "hintSize" : 10, |
| 44 | "hints" : { |
Nils Diewald | 465c425 | 2014-06-20 21:51:58 +0000 | [diff] [blame] | 45 | "-foundries" : { |
| 46 | "corenlp" : ["corenlp/", "CoreNLP"], |
| 47 | "cnx" : ["cnx/", "Connexor"], |
| 48 | "opennlp" : ["opennlp/", "OpenNLP"], |
| 49 | "xip" : ["xip/", "Xerox"], |
| 50 | "tt" : ["tt/", "TreeTagger"], |
| 51 | "mate" : ["mate/", "Mate"] |
| 52 | }, |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 53 | "corenlp" : { |
| 54 | "ne_dewac_175m_600" : ["ne_dewac_175m_600=", "Named Entity"], |
| 55 | "ne_hgc_175m_600" : ["ne_hgc_175m_600=", "Named Entity"] |
| 56 | }, |
| 57 | "corenlp/ne_dewac_175m_600" : ["I-LOC","I-MISC","I-ORG","I-PER"], |
| 58 | "corenlp/ne_hgc_175m_600" : ["I-LOC","I-MISC","I-ORG","I-PER"], |
| 59 | "cnx" : { |
| 60 | "c" : ["c=", "Constituency"], |
| 61 | "l" : ["l=", "Lemma"], |
| 62 | "m" : ["m=", "Morpho Syntax"], |
| 63 | "p" : ["p=", "Part of Speech"], |
| 64 | "syn" : ["syn=", "Syntax"] |
| 65 | }, |
| 66 | "cnx/m" : ["Abbr","CMP","IMP","IND","INF","ORD","PAST","PCP","PERF","PL","PRES","PROG","Prop","SUB","SUP"], |
| 67 | "cnx/p" : ["A","ADV","CC","CS","DET","INTERJ","N","NUM","PREP","PRON","V"], |
| 68 | "cnx/syn" : ["@ADVL","@AUX","@CC","@MAIN","@NH","@POSTMOD","@PREMARK","@PREMOD"], |
| 69 | "opennlp" : { |
| 70 | "p" : ["p=", "Part of Speech"] |
| 71 | }, |
| 72 | "opennlp/p" : ["$(","$,","$.","ADJA","ADJD","ADV","APPR","APPRART","ART","CARD","FM","KOKOM","KON","KOUI","KOUS","NE","NN","PDAT","PDS","PIAT","PIS","PPER","PPOSAT","PRELS","PRF","PROAV","PTKNEG","PTKVZ","PTKZU","PWAT","PWAV","PWS","TRUNC","VAFIN","VAINF","VAPP","VMFIN","VVFIN","VVIMP","VVINF","VVIZU","VVPP","XY"], |
| 73 | "xip" : { |
| 74 | "c" : ["c=", "Constituency"], |
| 75 | "d" : ["d=", "Dependency"], |
| 76 | "l" : ["l=", "Lemma"], |
| 77 | "p" : ["p=", "Part of Speech"] |
| 78 | }, |
| 79 | "xip/c" : ["ADJ","ADV","AP","CONJ","DET","INFC","INS","ITJ","MC","NEGAT","NOUN","NP","NPA","NUM","POSTP","PP","PREP","PRON","PTCL","PUNCT","SC","SYMBOL","TOP","TRUNC","VERB"], |
| 80 | "xip/d" : ["ADJMOD","AUXIL","CONNECT","COORD","DATE","DETERM","EXPL","LOC","MODAL","NEGAT","NMOD","NMOD2","NUMMOD","OBJ","ORG","PERSON","PLINK","PRED","REFLEX","SUBJ","THEMA","TIME","TRUNC","VMAIN","VMOD","VPREF"], |
| 81 | "xip/p" : ["ADJ","ADV","CONJ","DET","ITJ","NEGAT","NOUN","NUM","POSTP","PREP","PRON","PTCL","PUNCT","SYMBOL","TRUNC","VERB"], |
| 82 | "tt" : { |
| 83 | "l" : ["l=", "Lemma"], |
| 84 | "p" : ["p=", "Part of Speech"] |
| 85 | }, |
| 86 | "tt/p" : ["$.","ADJA","ADJD","ADV","APPO","APPR","APPRART","APZR","ART","CARD","FM","ITJ","KOKOM","KON","KOUI","KOUS","NE","NN","PDAT","PDS","PIAT","PIS","PPER","PPOSAT","PRELS","PRF","PROAV","PTKA","PTKNEG","PTKVZ","PTKZU","PWAT","PWAV","PWS","TRUNC","VAFIN","VAINF","VAPP","VMFIN","VMINF","VVFIN","VVIMP","VVINF","VVIZU","VVPP","XY"], |
| 87 | "mate" : { |
| 88 | "d" : ["d=", "Dependency"], |
| 89 | "l" : ["l=", "Lemma"], |
| 90 | "m" : ["m=", "Morpho Syntax"], |
| 91 | "p" : ["p=", "Part of Speech"] |
| 92 | }, |
| 93 | "mate/d" : ["--","AG","AMS","APP","CC","CD","CJ","CM","CP","CVC","DA","DM","EP","JU","MNR","MO","NG","NK","NMC","OA","OC","OG","OP","PAR","PD","PG","PH","PM","PNC","RC","RE","RS","SB","SBP","SVP","UC"], |
| 94 | "mate/m" : ["<no-type>","case:*","case:acc","case:dat","case:gen","case:nom","degree:comp","degree:pos","degree:sup","gender:*","gender:fem","gender:masc","gender:neut","mood:imp","mood:ind","mood:subj","number:*","number:pl","number:sg","person:1","person:2","person:3","tense:past","tense:pres"], |
| 95 | "mate/p" : ["$(","$,","$.","<root-POS>","ADJA","ADJD","ADV","APPO","APPR","APPRART","ART","CARD","FM","ITJ","KOKOM","KON","KOUI","KOUS","NE","NN","PDAT","PDS","PIAT","PIS","PPER","PPOSAT","PPOSS","PRELAT","PRELS","PRF","PROAV","PTKA","PTKNEG","PTKVZ","PTKZU","PWAT","PWAV","PWS","TRUNC","VAFIN","VAINF","VAPP","VMFIN","VVFIN","VVIMP","VVINF","VVIZU","VVPP","XY"] |
| 96 | }} |
| 97 | ); |
| 98 | |
| 99 | % end |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 100 | <button type="submit" name="action" value="ok"><i class="fa fa-search"></i></button> |
| 101 | <button type="submit" name="action" value="inspect"><i class="fa fa-code"></i></button> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 102 | % end |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 103 | |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 104 | <div id="button-right"> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 105 | % if (param('q')) { |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 106 | <button type="button" onclick="$('#search > ol').toggleClass('left-aligned right-aligned'); $(this).children('i').toggleClass('fa-align-right fa-align-left')"><i class="fa fa-align-right"></i></button> |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 107 | % } |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame] | 108 | % unless (current_route 'tutorial') { |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 109 | <button type="button" onclick="openTutorial()"><i class="fa fa-graduation-cap"></i></button> |
Nils Diewald | b22abdf | 2014-06-18 22:57:50 +0000 | [diff] [blame] | 110 | % }; |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 111 | </div> |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 112 | |
| 113 | </div> |
| 114 | |
| 115 | <div id="sidebar" style="padding-top: 90px"> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 116 | %= include 'collections' |
Nils Diewald | db03fa9 | 2014-06-23 13:36:55 +0000 | [diff] [blame^] | 117 | <i class="fa fa-bars"></i> |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 118 | </div> |
| 119 | |
| 120 | <div id="search"> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 121 | %= content |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 122 | </div> |
| 123 | |
| 124 | %= javascript begin |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 125 | |
Nils Diewald | 002e8fb | 2014-06-22 14:27:01 +0000 | [diff] [blame] | 126 | $("#search > ol > li:not(.active)").on("click", function (e) { |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 127 | $(this).addClass('active'); |
Nils Diewald | 002e8fb | 2014-06-22 14:27:01 +0000 | [diff] [blame] | 128 | e.stopPropagation(); |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 129 | }); |
| 130 | |
Nils Diewald | 002e8fb | 2014-06-22 14:27:01 +0000 | [diff] [blame] | 131 | $("#search > ol > li:not(.active) > ul > li.close").on("click", function (e) { |
| 132 | $(this.parentNode.parentNode).removeClass('active'); |
| 133 | e.stopPropagation(); |
| 134 | }); |
| 135 | |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 136 | |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 137 | function showTable (o) { |
| 138 | var match = o.parentNode.parentNode; |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 139 | var table = $(match).children("div").children("div.tokenInfo").first(); |
| 140 | |
| 141 | if (table.hasClass("active")) { |
| 142 | table.removeClass("active"); |
| 143 | return; |
| 144 | } |
| 145 | else if (table.children("table").length > 0) { |
| 146 | table.addClass("active"); |
| 147 | return; |
| 148 | }; |
| 149 | |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 150 | var corpusID = match.getAttribute('data-corpus-id'); |
Nils Diewald | 002e8fb | 2014-06-22 14:27:01 +0000 | [diff] [blame] | 151 | var docID = match.getAttribute('data-doc-id'); |
| 152 | var matchID = match.getAttribute('data-match-id'); |
| 153 | var url = '/corpus/' + corpusID + '/' + docID + '/' + matchID; |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 154 | var snippet; |
| 155 | |
| 156 | jQuery.getJSON(url, function (res) { |
| 157 | var snippet = new SnippetTable(res['snippet']); |
| 158 | table.addClass("active"); |
| 159 | table.append(snippet.toTable()); |
| 160 | }); |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 161 | }; |
| 162 | |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 163 | function openTutorial (o) { |
| 164 | var tut = $("#tutorial"); |
Nils Diewald | db03fa9 | 2014-06-23 13:36:55 +0000 | [diff] [blame^] | 165 | tut.addClass("active"); |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 166 | var iframe = tut.children("iframe"); |
| 167 | var src = iframe.attr("data-src"); |
| 168 | iframe.attr("src", src); |
| 169 | }; |
| 170 | |
| 171 | function closeTutorial (o) { |
Nils Diewald | db03fa9 | 2014-06-23 13:36:55 +0000 | [diff] [blame^] | 172 | $("#tutorial").removeClass("active"); |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 173 | }; |
| 174 | |
| 175 | function useQuery (o) { |
| 176 | var q = o.getAttribute("data-query"); |
| 177 | var ql = o.getAttribute("data-query-language"); |
| 178 | $("#ql-field").val(ql); |
| 179 | $("#q-field").val(q); |
| 180 | closeTutorial(); |
| 181 | }; |
| 182 | |
Nils Diewald | 002e8fb | 2014-06-22 14:27:01 +0000 | [diff] [blame] | 183 | $("code.query.serial, #sidebar").on("click", function () { |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 184 | $(this).toggleClass('active'); |
| 185 | }); |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 186 | |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 187 | % end |
| 188 | |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 189 | |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 190 | %= notifications 'Alertify' |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 191 | </body> |
| 192 | </html> |