Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 1 | "use strict"; |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 2 | |
Nils Diewald | cd57162 | 2014-11-19 00:58:59 +0000 | [diff] [blame] | 3 | /* |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 4 | * Todo: |
| 5 | * - limit the view based on prefix matches |
| 6 | * - highlight matching substrings |
| 7 | * - http://www.cryer.co.uk/resources/javascript/script20_respond_to_keypress.htm |
Nils Diewald | e99d904 | 2014-11-20 23:36:54 +0000 | [diff] [blame] | 8 | * - document.removeEventListener("click",arguments.callee,false); |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 9 | */ |
Nils Diewald | cd57162 | 2014-11-19 00:58:59 +0000 | [diff] [blame] | 10 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 11 | // Don't let events bubble up |
| 12 | Event.prototype.halt = function () { |
| 13 | this.stopPropagation(); |
| 14 | this.preventDefault(); |
| 15 | }; |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 16 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 17 | // http://www.nlpado.de/~sebastian/software/ner_german.shtml |
| 18 | // http://www.cnts.ua.ac.be/conll2003/ner/ |
| 19 | var namedEntities = [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 20 | ["I-LOC", "I-LOC ", "Location"], |
| 21 | ["I-MISC", "I-MISC ", "Miscellaneous"], |
| 22 | ["I-ORG", "I-ORG ", "Organization"], |
| 23 | ["I-PER", "I-PER ", "Person"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 24 | ]; |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 25 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 26 | // http://www.ids-mannheim.de/cosmas2/projekt/referenz/stts/morph.html |
| 27 | // http://nachhalt.sfb632.uni-potsdam.de/owl-docu/stts.html |
| 28 | var sttsArray = [ |
| 29 | // "$.", "$(", "$," |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 30 | ["ADJA","ADJA ", "Attributive Adjective"], |
| 31 | ["ADJD","ADJD ", "Predicative Adjective"], |
| 32 | ["ADV","ADV ", "Adverb"], |
| 33 | ["APPO","APPO ", "Postposition"], |
| 34 | ["APPR","APPR ", "Preposition"], |
| 35 | ["APPRART","APPRART ", "Preposition with Determiner"], |
| 36 | ["APZR","APZR ","Right Circumposition"], |
| 37 | ["ART","ART ", "Determiner"], |
| 38 | ["CARD","CARD ", "Cardinal Number"], |
| 39 | ["FM","FM ", "Foreign Material"], |
| 40 | ["ITJ","ITJ ", "Interjection"], |
| 41 | ["KOKOM","KOKOM ", "Comparison Particle"], |
| 42 | ["KON","KON ", "Coordinating Conjuncion"], |
| 43 | ["KOUI","KOUI ", "Subordinating Conjunction with 'zu'"], |
| 44 | ["KOUS","KOUS ", "Subordinating Conjunction with Sentence"], |
| 45 | ["NE","NE ", "Named Entity"], |
| 46 | ["NN","NN ", "Normal Nomina"], |
| 47 | ["PAV", "PAV ", "Pronominal Adverb"], |
| 48 | ["PDAT","PDAT ","Attributive Demonstrative Pronoun"], |
| 49 | ["PDS","PDS ", "Substitutive Demonstrative Pronoun"], |
| 50 | ["PIAT","PIAT ", "Attributive Indefinite Pronoun without Determiner"], |
| 51 | ["PIDAT","PIDAT ", "Attributive Indefinite Pronoun with Determiner"], |
| 52 | ["PIS","PIS ", "Substitutive Indefinite Pronoun"], |
| 53 | ["PPER","PPER ", "Personal Pronoun"], |
| 54 | ["PPOSAT","PPOSAT ", "Attributive Possessive Pronoun"], |
| 55 | ["PPOSS","PPOSS ", "Substitutive Possessive Pronoun"], |
| 56 | ["PRELAT","PRELAT ", "Attributive Relative Pronoun"], |
| 57 | ["PRELS","PRELS ", "Substitutive Relative Pronoun"], |
| 58 | ["PRF","PRF ", "Reflexive Pronoun"], |
| 59 | ["PROAV","PROAV ", "Pronominal Adverb"], |
| 60 | ["PTKA","PTKA ","Particle with Adjective"], |
| 61 | ["PTKANT","PTKANT ", "Answering Particle"], |
| 62 | ["PTKNEG","PTKNEG ", "Negation Particle"], |
| 63 | ["PTKVZ","PTKVZ ", "Separated Verbal Particle"], |
| 64 | ["PTKZU","PTKZU ", "'zu' Particle"], |
| 65 | ["PWAT","PWAT ", "Attributive Interrogative Pronoun"], |
| 66 | ["PWAV","PWAV ", "Adverbial Interrogative Pronoun"], |
| 67 | ["PWS","PWS ", "Substitutive Interrogative Pronoun"], |
| 68 | ["TRUNC","TRUNC ","Truncated"], |
| 69 | ["VAFIN","VAFIN ", "Auxiliary Finite Verb"], |
| 70 | ["VAINF","VAINF ", "Auxiliary Infinite Verb"], |
| 71 | ["VAIMP","VAIMP ", "Auxiliary Finite Imperative Verb"], |
| 72 | ["VAPP","VAPP ", "Auxiliary Perfect Participle"], |
| 73 | ["VMFIN","VMFIN ", "Modal Finite Verb"], |
| 74 | ["VMINF","VMINF ", "Modal Infinite Verb"], |
| 75 | ["VMPP","VMPP ", "Modal Perfect Participle"], |
| 76 | ["VVFIN","VVFIN ","Finite Verb"], |
| 77 | ["VVIMP","VVIMP ", "Finite Imperative Verb"], |
| 78 | ["VVINF","VVINF ", "Infinite Verb"], |
| 79 | ["VVIZU","VVIZU ", "Infinite Verb with 'zu'"], |
| 80 | ["VVPP","VVPP ", "Perfect Participle"], |
| 81 | ["XY", "XY ", "Non-Word"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 82 | ]; |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 83 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 84 | var mateSttsArray = sttsArray.slice(0); |
| 85 | mateSttsArray.push( |
| 86 | ["<root-POS>","<root-POS>","Root Part of Speech"] |
| 87 | ); |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 88 | |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 89 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 90 | var hintArray = { |
| 91 | "-" : [ |
Nils Diewald | 46e6f18 | 2015-02-04 15:22:49 +0000 | [diff] [blame] | 92 | ["Connexor", "cnx/", "Constituency, Lemma, Morphology, Part-of-Speech, Syntax"], |
| 93 | ["CoreNLP", "corenlp/", "Named Entities"], |
| 94 | ["Mate", "mate/", "Lemma, Morphology, Part-of-Speech"], |
| 95 | ["OpenNLP", "opennlp/", "Part-of-Speech"], |
| 96 | ["TreeTagger", "tt/", "Lemma, Part-of-Speech"], |
| 97 | ["Xerox Parser", "xip/", "Constituency, Lemma, Part-of-Speech"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 98 | ], |
| 99 | "corenlp/" : [ |
| 100 | ["Named Entity", "ne=" , "Combined"], |
| 101 | ["Named Entity", "ne_dewac_175m_600=" , "ne_dewac_175m_600"], |
| 102 | ["Named Entity", "ne_hgc_175m_600=", "ne_hgc_175m_600"] |
| 103 | ], |
| 104 | "corenlp/ne=" : namedEntities, |
| 105 | "corenlp/ne_dewac_175m_600=" : namedEntities, |
| 106 | "corenlp/ne_hgc_175m_600=" : namedEntities, |
| 107 | "cnx/" : [ |
| 108 | ["Constituency", "c="], |
| 109 | ["Lemma", "l="], |
| 110 | ["Morphology", "m="], |
| 111 | ["Part-of-Speech", "p="], |
| 112 | ["Syntax", "syn="] |
| 113 | ], |
| 114 | "cnx/c=" : [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 115 | ["np", "np ", "Nominal Phrase"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 116 | ], |
| 117 | // http://www.ids-mannheim.de/cosmas2/projekt/referenz/connexor/morph.html |
| 118 | "cnx/m=" : [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 119 | ["Abbr","Abbr ", "Nouns: Abbreviation"], |
| 120 | ["CMP","CMP ", "Adjective: Comparative"], |
| 121 | ["IMP", "IMP ", "Mood: Imperative"], |
| 122 | ["IND", "IND ", "Mood: Indicative"], |
| 123 | ["INF", "INF ", "Infinitive"], |
| 124 | ["ORD","ORD ", "Numeral: Ordinal"], |
| 125 | ["PAST", "PAST ", "Tense: past"], |
| 126 | ["PCP", "PCP ", "Participle"], |
| 127 | ["PERF", "PERF ", "Perfective Participle"], |
| 128 | ["PL","PL ", "Nouns: Plural"], |
| 129 | ["PRES", "PRES ", "Tense: present"], |
| 130 | ["PROG", "PROG ", "Progressive Participle"], |
| 131 | ["Prop","Prop ", "Nouns: Proper Noun"], |
| 132 | ["SUB", "SUB ", "Mood: Subjunctive"], |
| 133 | ["SUP","SUP ", "Adjective: Superlative"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 134 | ], |
| 135 | // http://www.ids-mannheim.de/cosmas2/projekt/referenz/connexor/morph.html |
| 136 | "cnx/p=" : [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 137 | ["A", "A ", "Adjective"], |
| 138 | ["ADV", "ADV ", "Adverb"], |
| 139 | ["CC", "CC ", "Coordination Marker"], |
| 140 | ["CS", "CS ", "Clause Marker"], |
| 141 | ["DET", "DET ", "Determiner"], |
| 142 | ["INTERJ", "INTERJ ", "Interjection"], |
| 143 | ["N", "N ", "Noun"], |
| 144 | ["NUM", "NUM ", "Numeral"], |
| 145 | ["PREP", "PREP ", "Preposition"], |
| 146 | ["PRON", "PRON ", "Pro-Nominal"], |
| 147 | ["V", "V ", "Verb"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 148 | ], |
| 149 | // http://www.ids-mannheim.de/cosmas2/projekt/referenz/connexor/syntax.html |
| 150 | "cnx/syn=" : [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 151 | ["@ADVL", "@ADVL ", "Adverbial Head"], |
| 152 | ["@AUX", "@AUX ", "Auxiliary Verb"], |
| 153 | ["@CC", "@CC ", "Coordination"] |
| 154 | ["@MAIN", "@MAIN ", "Main Verb"], |
| 155 | ["@NH", "@NH ", "Nominal Head"], |
| 156 | ["@POSTMOD", "@POSTMOD ", "Postmodifier"], |
| 157 | ["@PREMARK", "@PREMARK ", "Preposed Marker"], |
| 158 | ["@PREMOD", "@POSTMOD ", "Premodifier"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 159 | ], |
| 160 | "opennlp/" : [ |
| 161 | ["Part-of-Speech", "p="] |
| 162 | ], |
| 163 | "opennlp/p=" : sttsArray, |
| 164 | "xip/" : [ |
| 165 | ["Constituency", "c="], |
| 166 | // Inactive: ["Dependency", "d="], |
| 167 | ["Lemma", "l="], |
| 168 | ["Part-of-Speech", "p="], |
| 169 | ], |
| 170 | // "xip/c=" : [], |
| 171 | // Inactive: "xip/d=" : [], |
| 172 | // "xip/p=" : [], |
| 173 | "tt/" : [ |
| 174 | ["Lemma", "l="], |
| 175 | ["Part-of-Speech", "p="] |
| 176 | ], |
| 177 | "tt/p=" : sttsArray, |
| 178 | "mate/" : [ |
| 179 | // Inactive: "d" : ["d=", "Dependency"], |
| 180 | ["Lemma", "l="], |
| 181 | ["Morphology", "m="], |
| 182 | ["Part-of-Speech", "p="] |
| 183 | ], |
| 184 | // Inactive: mate/d= |
| 185 | "mate/p=" : mateSttsArray, |
| 186 | "mate/m=" : [ |
| 187 | ["Case", "case:"], |
| 188 | ["Degree", "degree:"], |
| 189 | ["Gender", "gender:"], |
| 190 | ["Mood", "mood:"], |
| 191 | ["Number", "number:"], |
| 192 | ["Person", "person:"], |
| 193 | ["Tense","tense:"], |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 194 | ["No type", "<no-type> "] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 195 | ], |
| 196 | "mate/m=case:" : [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 197 | ["acc", "acc ", "Accusative"], |
| 198 | ["dat","dat ", "Dative"], |
| 199 | ["gen", "gen ","Genitive"], |
| 200 | ["nom","nom ", "Nominative"], |
| 201 | ["*","* ", "Undefined"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 202 | ], |
| 203 | "mate/m=degree:" : [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 204 | ["comp","comp ", "Comparative"], |
| 205 | ["pos","pos ", "Positive"], |
| 206 | ["sup","sup ", "Superative"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 207 | ], |
| 208 | "mate/m=gender:" : [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 209 | ["fem", "fem ", "Feminium"], |
| 210 | ["masc", "masc ", "Masculinum"], |
| 211 | ["neut","neut ", "Neuter"], |
| 212 | ["*","* ","Undefined"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 213 | ], |
| 214 | "mate/m=mood:" : [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 215 | ["imp","imp ", "Imperative"], |
| 216 | ["ind","ind ", "Indicative"], |
| 217 | ["subj","subj ", "Subjunctive"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 218 | ], |
| 219 | "mate/m=number:" : [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 220 | ["pl","pl ","Plural"], |
| 221 | ["sg","sg ","Singular"], |
| 222 | ["*","* ","Undefined"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 223 | ], |
| 224 | "mate/m=person:" : [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 225 | ["1","1 ", "First Person"], |
| 226 | ["2","2 ", "Second Person"], |
| 227 | ["3","3 ", "Third Person"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 228 | ], |
| 229 | "mate/m=tense:" : [ |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 230 | ["past","past ", "Past"], |
| 231 | ["pres","pres ", "Present"] |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 232 | ] |
| 233 | }; |
| 234 | |
| 235 | |
| 236 | /** |
| 237 | * Analyze strings for prefixes |
| 238 | */ |
| 239 | var PrefixAnalyzer = { |
| 240 | _regex : new RegExp( |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 241 | "(?:^|[^-_a-zA-Z0-9])" + // Anchor |
| 242 | "((?:[-_a-zA-Z0-9]+?)\/" + // Foundry |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 243 | "(?:" + |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 244 | "(?:[-_a-zA-Z0-9]+?)=" + // Layer |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 245 | "(?:(?:[^:=\/ ]+?):)?" + // Key |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 246 | ")?" + |
| 247 | ")$"), |
| 248 | analyze : function (text) { |
| 249 | if (!this._regex.exec(text)) |
| 250 | return undefined; |
| 251 | return RegExp.$1 |
| 252 | } |
| 253 | }; |
| 254 | |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 255 | function codeFromEvent (e) { |
| 256 | if ((e.charCode) && (e.keyCode==0)) |
| 257 | return e.charCode |
| 258 | return e.keyCode; |
| 259 | }; |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 260 | |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 261 | |
| 262 | /* |
| 263 | * Event handling after a key is down |
| 264 | * for arrows! |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 265 | */ |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 266 | function updateKeyDown (that, e) { |
| 267 | var code = codeFromEvent(e); |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 268 | var menu = that.menu(); |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 269 | |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 270 | /* |
| 271 | * keyCodes: |
| 272 | * - Down = 40 |
| 273 | * - Esc = 27 |
| 274 | * - Up = 38 |
| 275 | * - Enter = 13 |
| 276 | * - shift = 16 |
| 277 | * for characters use e.key |
| 278 | */ |
| 279 | switch (code) { |
| 280 | case 27: // 'Esc' |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 281 | // Hide menu |
| 282 | menu.hide(); |
| 283 | break; |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 284 | case 40: // 'Down' |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 285 | e.halt(); // No event propagation |
| 286 | |
| 287 | // Menu is not active |
| 288 | if (!menu.active) { |
| 289 | that.popUp() |
| 290 | } |
| 291 | // Menu is active |
| 292 | else { |
| 293 | that.removePrefix(); |
| 294 | menu.next(); |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 295 | }; |
Nils Diewald | 465c425 | 2014-06-20 21:51:58 +0000 | [diff] [blame] | 296 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 297 | break; |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 298 | case 38: // "Up" |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 299 | if (!menu.active) |
| 300 | break; |
| 301 | e.halt(); // No event propagation |
| 302 | that.removePrefix(); |
| 303 | menu.prev(); |
| 304 | break; |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 305 | case 13: // "Enter" |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 306 | if (!menu.active) |
| 307 | break; |
| 308 | e.halt(); // No event propagation |
| 309 | that.insertText(menu.getActiveItem().getAction()); |
| 310 | that.removePrefix(); |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 311 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 312 | // Remove menu |
| 313 | menu.hide(); |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 314 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 315 | // Fill this with the correct value |
| 316 | // Todo: This is redundant with click function |
| 317 | var show; |
Nils Diewald | c1a6985 | 2014-11-19 03:06:45 +0000 | [diff] [blame] | 318 | if ((show = that.analyzeContext()) != "-") { |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 319 | menu.show(show); |
| 320 | menu.update( |
| 321 | e.target.getBoundingClientRect().right |
| 322 | ); |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 323 | }; |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 324 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 325 | break; |
| 326 | default: |
| 327 | if (!menu.active) |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 328 | return; |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 329 | |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 330 | // Surpress propagation in firefox |
| 331 | if (e.key !== undefined && e.key.length != 1) { |
| 332 | menu.hide(); |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 333 | }; |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 334 | }; |
| 335 | }; |
| 336 | |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 337 | /** |
| 338 | * Event handling after a key pressed |
| 339 | * for characters! |
| 340 | */ |
| 341 | function updateKeyPress (that, e) { |
| 342 | var character = String.fromCharCode(codeFromEvent(e)); |
| 343 | var menu = that.menu(); |
| 344 | |
| 345 | if (!menu.active) |
| 346 | return; |
| 347 | |
| 348 | e.halt(); // No event propagation |
| 349 | |
| 350 | // Try to identify prefix |
| 351 | if (menu.skipToPrefix(character)) |
| 352 | return; |
| 353 | |
| 354 | // Prefix not found |
| 355 | that.insertPrefix(); |
| 356 | menu.hide(); |
| 357 | }; |
| 358 | |
| 359 | |
| 360 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 361 | // new hint object |
| 362 | var Hint = { |
| 363 | _search : undefined, // Return the search element |
| 364 | _mirror : undefined, // Return the mirror element |
| 365 | _menu : undefined, |
| 366 | _analyzer : undefined, |
| 367 | firstTry : true, |
| 368 | menu : function () { |
| 369 | // In case this wasn't defined yet |
| 370 | if (this._menu === undefined) { |
| 371 | this._menu = Object.create(Menu).init(); |
| 372 | this._mirror.appendChild(this._menu.getElement()); |
| 373 | }; |
| 374 | return this._menu; |
| 375 | }, |
| 376 | |
| 377 | // Initialize the object |
| 378 | init : function () { |
| 379 | this._search = document.getElementById("q-field"); |
| 380 | this._mirror = document.createElement("div"); |
| 381 | this._mirror.setAttribute("id", "searchMirror"); |
| 382 | this._mirror.appendChild(document.createElement("span")); |
| 383 | document.getElementsByTagName("body")[0].appendChild(this._mirror); |
| 384 | |
| 385 | this._analyzer = Object.create(PrefixAnalyzer); |
| 386 | |
| 387 | // Update positional information, in case the windows size changes |
| 388 | var that = this; |
| 389 | window.onresize = function () { that.reposition() }; |
| 390 | |
| 391 | // Add event listener for key pressed down |
| 392 | this._search.addEventListener( |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 393 | "keypress", |
| 394 | function (e) { |
| 395 | updateKeyPress(that, e) |
| 396 | }, |
| 397 | false |
| 398 | ); |
| 399 | |
| 400 | // Add event listener for key pressed down |
| 401 | this._search.addEventListener( |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 402 | "keydown", |
| 403 | function (e) { |
Nils Diewald | 0f77cb8 | 2014-11-19 20:24:55 +0000 | [diff] [blame] | 404 | updateKeyDown(that, e) |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 405 | }, |
| 406 | false |
| 407 | ); |
| 408 | |
| 409 | // Reposition the mirror |
| 410 | this.reposition(); |
| 411 | |
| 412 | // Return object for chaining |
| 413 | return this; |
| 414 | }, |
| 415 | |
| 416 | // Popup method |
| 417 | popUp : function () { |
| 418 | if (this.active) |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 419 | return; |
| 420 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 421 | // Reposition hint list on first try |
| 422 | if (this.firstTry) |
| 423 | this.reposition().firstTry = false; |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 424 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 425 | // Update view |
| 426 | this.update(); |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 427 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 428 | // Fill this with the correct value |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 429 | if (this.menu().show(this.analyzeContext())) { |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 430 | this.update( |
| 431 | this._search.getBoundingClientRect().right |
| 432 | ); |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 433 | } |
| 434 | else { |
Nils Diewald | c1a6985 | 2014-11-19 03:06:45 +0000 | [diff] [blame] | 435 | this.menu().hide(); |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 436 | }; |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 437 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 438 | this._search.focus(); |
| 439 | }, |
| 440 | |
| 441 | // Reposition the mirror object |
| 442 | reposition : function () { |
| 443 | |
| 444 | // Update style properties |
| 445 | var searchRect = this._search.getBoundingClientRect(); |
| 446 | var searchStyle = window.getComputedStyle(this._search, null); |
| 447 | var mStyle = this._mirror.style; |
| 448 | mStyle.left = searchRect.left + "px"; |
| 449 | mStyle.top = searchRect.bottom + "px"; |
| 450 | mStyle.borderLeftColor = "transparent"; |
| 451 | mStyle.height = "1px"; |
| 452 | mStyle.paddingLeft = searchStyle.getPropertyValue("padding-left"); |
| 453 | mStyle.marginLeft = searchStyle.getPropertyValue("margin-left"); |
| 454 | mStyle.borderLeftWidth = searchStyle.getPropertyValue("border-left-width"); |
| 455 | mStyle.borderLeftStyle = searchStyle.getPropertyValue("border-left-style"); |
| 456 | mStyle.fontSize = searchStyle.getPropertyValue("font-size"); |
| 457 | mStyle.fontFamily = searchStyle.getPropertyValue("font-family"); |
| 458 | return this; |
| 459 | }, |
| 460 | |
| 461 | // Reposition the menu object |
| 462 | update : function () { |
| 463 | var s = this._search; |
| 464 | var start = s.selectionStart; |
| 465 | this._mirror.firstChild.textContent = s.value.substring(0, start); |
| 466 | }, |
| 467 | |
| 468 | analyzeContext : function () { |
| 469 | var context = this._splitInputText()[0]; |
| 470 | if (context === undefined || context.length === 0) |
| 471 | return "-"; |
| 472 | context = this._analyzer.analyze(context); |
| 473 | if (context === undefined || context.length === 0) |
| 474 | return "-"; |
| 475 | |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 476 | if (!hintArray[context]) |
| 477 | return "-"; |
| 478 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 479 | return context; |
| 480 | }, |
| 481 | |
| 482 | _splitInputText : function () { |
| 483 | var s = this._search; |
| 484 | var value = s.value; |
| 485 | var start = s.selectionStart; |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 486 | var begin = value.substring(0, start); |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 487 | var end = value.substring(start, value.length); |
| 488 | return new Array(begin, end); |
| 489 | }, |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 490 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 491 | // Insert text at the current cursor position |
| 492 | insertText : function (text) { |
| 493 | var s = this._search; |
| 494 | var splitText = this._splitInputText(); |
| 495 | s.value = splitText[0] + text + splitText[1]; |
| 496 | s.selectionStart = (splitText[0] + text).length |
| 497 | s.selectionEnd = s.selectionStart; |
| 498 | this._mirror.firstChild.textContent = splitText[0] + text; |
| 499 | }, |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 500 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 501 | // Remove stored prefix |
| 502 | removePrefix : function () { |
| 503 | this.menu()._prefix = undefined; |
| 504 | }, |
Nils Diewald | 465c425 | 2014-06-20 21:51:58 +0000 | [diff] [blame] | 505 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 506 | // Insert stored prefix at current cursor position |
| 507 | insertPrefix : function () { |
| 508 | if (this.menu()._prefix === undefined) |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 509 | return; |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 510 | this.insertText(this.menu()._prefix); |
| 511 | } |
| 512 | }; |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 513 | |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 514 | |
| 515 | /** |
| 516 | * Menu list |
| 517 | */ |
| 518 | var Menu = { |
| 519 | active : false, |
| 520 | _element : undefined, |
| 521 | _position : 0, // Position of menu item |
| 522 | _offset : 0, // Visual offset for chosen highlight |
| 523 | _size : 8, // Number of items to be shown |
| 524 | _items : [], // Items for menu |
| 525 | _name : undefined, |
| 526 | _prefix : undefined, |
| 527 | getElement : function () { |
| 528 | return this._element; |
| 529 | }, |
| 530 | init : function () { |
| 531 | this._element = document.createElement("ul"); |
| 532 | |
| 533 | // Add onclick event |
Nils Diewald | b01cd95 | 2015-03-04 21:26:32 +0000 | [diff] [blame] | 534 | // Todo: Probably better do this for each <li /> |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 535 | this._element.addEventListener("click", chooseHint, false); |
| 536 | |
| 537 | this._element.style.opacity = 0; |
| 538 | this.active = false; |
| 539 | this._setDefaults(); |
| 540 | return this; |
| 541 | }, |
| 542 | update : function (searchRightPosition) { |
| 543 | var infoRightPosition = this._element.getBoundingClientRect().right; |
| 544 | if (infoRightPosition > searchRightPosition) { |
| 545 | this._element.style.marginLeft = '-' + (infoRightPosition - searchRightPosition) + 'px'; |
| 546 | }; |
| 547 | return this; |
| 548 | }, |
| 549 | next : function () { |
| 550 | if (!this.active) |
| 551 | return; |
| 552 | this._clearView(); |
| 553 | this._position++; |
| 554 | |
| 555 | // In case the list is bigger than the view |
| 556 | if (this._items.length > this._size) { |
| 557 | if (this._position >= this._items.length) { |
| 558 | // Roll to top |
| 559 | this._offset = 0; |
| 560 | this._position = 0; |
| 561 | this._showItems(0); |
| 562 | } |
| 563 | else if (this._position >= (this._size + this._offset)) { |
| 564 | // Roll down |
| 565 | this._element.removeChild(this._element.firstChild); |
| 566 | this._offset++; |
| 567 | this._element.appendChild(this.getItem(this._position).getElement()); |
| 568 | }; |
| 569 | } |
| 570 | else if (this._position >= this._items.length) { |
| 571 | this._position = 0; |
| 572 | }; |
| 573 | this._updateView(); |
| 574 | }, |
| 575 | prev : function () { |
| 576 | if (!this.active) |
| 577 | return; |
| 578 | this._clearView(); |
| 579 | this._position--; |
| 580 | |
| 581 | // In case the list is bigger than the view |
| 582 | if (this._items.length > this._size) { |
| 583 | if (this._position < 0) { |
| 584 | // roll to bottom |
| 585 | this._setToLast(); |
| 586 | this._offset = (this._position - this._size) + 1; |
| 587 | this._showLastItems(); |
| 588 | } |
| 589 | else if (this._position < this._offset) { |
| 590 | // roll up |
| 591 | this._element.removeChild(this._element.lastChild); |
| 592 | this._offset--; |
| 593 | this._element.insertBefore( |
| 594 | this.getItem(this._position).getElement(), |
| 595 | this._element.firstChild |
| 596 | ); |
| 597 | }; |
| 598 | } |
| 599 | else if (this._position < 0) { |
| 600 | this._setToLast(); |
| 601 | }; |
| 602 | this._updateView(); |
| 603 | }, |
| 604 | skipToPrefix : function (prefix) { |
| 605 | if (this._prefix === undefined) |
| 606 | this._prefix = prefix.toLocaleLowerCase(); |
| 607 | else |
| 608 | this._prefix += prefix.toLocaleLowerCase(); |
| 609 | |
| 610 | var pos = 0; |
| 611 | var found = false; |
| 612 | var good = -1; |
| 613 | var test; |
| 614 | for (; pos < this._items.length; pos++) { |
Nils Diewald | c1a6985 | 2014-11-19 03:06:45 +0000 | [diff] [blame] | 615 | if ((test = this.getItem(pos).getLCName().indexOf(this._prefix)) != -1) { |
| 616 | if (test == 0) { |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 617 | found = true; |
| 618 | break; |
| 619 | }; |
| 620 | good = pos; |
Nils Diewald | 465c425 | 2014-06-20 21:51:58 +0000 | [diff] [blame] | 621 | }; |
| 622 | }; |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 623 | |
| 624 | // Perfect prefix |
| 625 | if (found) |
| 626 | return this.skipToPos(pos); |
| 627 | // At least infix |
Nils Diewald | c1a6985 | 2014-11-19 03:06:45 +0000 | [diff] [blame] | 628 | else if (good != -1) |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 629 | return this.skipToPos(good); |
| 630 | // No |
| 631 | return false; |
| 632 | }, |
| 633 | skipToPos : function (index) { |
| 634 | if (!this.active) |
| 635 | return false; |
| 636 | if (index < 0 || index >= this._items.length) |
| 637 | return false; |
| 638 | |
| 639 | this._clearView(); |
| 640 | this._position = index; |
| 641 | |
| 642 | if (index < this._offset || index >= (this._offset + this._size)) { |
| 643 | |
| 644 | // Index is in the final frame |
| 645 | if (index >= (this._items.length - this._size)) { |
| 646 | this._offset = this._items.length - this._size; |
| 647 | this._showLastItems(); |
| 648 | } |
| 649 | |
| 650 | // Index is in the final frame |
| 651 | else { |
| 652 | this._offset = index; |
| 653 | this._showItems(index); |
| 654 | }; |
| 655 | }; |
| 656 | |
| 657 | // Activate new position |
| 658 | this._updateView(); |
| 659 | return true; |
| 660 | }, |
| 661 | show : function (name) { |
| 662 | // The element is already given |
Nils Diewald | c1a6985 | 2014-11-19 03:06:45 +0000 | [diff] [blame] | 663 | if (this._name != name) { |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 664 | |
| 665 | // Todo: store hints in hash |
| 666 | |
| 667 | // Delete items |
| 668 | this._items.length = 0; |
| 669 | |
| 670 | var items = hintArray[name]; |
| 671 | |
| 672 | // Hints not found |
| 673 | if (items === undefined) |
Nils Diewald | c5d9bac | 2014-11-19 18:10:38 +0000 | [diff] [blame] | 674 | return undefined; |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 675 | |
| 676 | var i; |
| 677 | for (i in items) { |
| 678 | var item = Object.create(MenuItem).init(items[i]); |
| 679 | this._items.push(item); |
| 680 | }; |
| 681 | |
| 682 | // Add classes for rolling menus |
| 683 | this.getItem(0).getElement().classList.add("no-more"); |
| 684 | this.getItem(i).getElement().classList.add("no-more"); |
| 685 | |
| 686 | this._name = name; |
| 687 | }; |
| 688 | this._showItems(0); |
| 689 | this._element.style.opacity = 1; |
| 690 | this._setDefaults(); |
| 691 | this.active = true; |
| 692 | this._updateView(); |
| 693 | return true; |
| 694 | }, |
| 695 | hide : function () { |
| 696 | this._element.style.opacity = 0; |
| 697 | if (this.active) |
| 698 | this.getActiveItem().deactivate(); |
| 699 | this._setDefaults(); |
| 700 | this.active = false; |
| 701 | }, |
| 702 | getActiveItem : function () { |
| 703 | return this._items[this._position]; |
| 704 | }, |
| 705 | getItem : function (index) { |
| 706 | return this._items[index]; |
| 707 | }, |
| 708 | getPrefix : function () { |
| 709 | return this._prefix; |
| 710 | }, |
| 711 | _setDefaults : function () { |
| 712 | this._offset = 0; |
| 713 | this._position = 0; |
| 714 | this._prefix = undefined; |
| 715 | }, |
| 716 | // Remove all visible list items |
| 717 | _deleteMenu : function () { |
| 718 | var child; |
| 719 | while (child = this._element.firstChild) |
| 720 | this._element.removeChild(child); |
| 721 | }, |
| 722 | _clearView : function () { |
| 723 | var active = this.getActiveItem(); |
| 724 | if (active !== undefined) |
| 725 | active.deactivate(); |
| 726 | }, |
| 727 | _updateView : function () { |
| 728 | var active = this.getActiveItem(); |
| 729 | if (active !== undefined) |
| 730 | active.activate(); |
| 731 | }, |
| 732 | |
| 733 | // Make all list items visible starting at a certain offset |
| 734 | _showItems : function (offset) { |
| 735 | this._deleteMenu(); |
| 736 | for (var i = offset; i < this._size + offset; i++) { |
| 737 | if (i >= this._items.length) |
| 738 | break; |
| 739 | this._element.appendChild( |
| 740 | this._items[i].getElement() |
| 741 | ) |
| 742 | }; |
| 743 | }, |
| 744 | |
| 745 | // Make all final list items visible |
| 746 | _showLastItems : function () { |
| 747 | this._deleteMenu(); |
| 748 | for (var i = (this._items.length - 1); i >= (this._items.length - this._size); i--) { |
| 749 | if (i < 0) |
| 750 | break; |
| 751 | if (!this._element.firstChild) |
| 752 | this._element.appendChild(this._items[i].getElement()); |
| 753 | else |
| 754 | this._element.insertBefore( |
| 755 | this._items[i].getElement(), |
| 756 | this._element.firstChild |
| 757 | ); |
| 758 | }; |
| 759 | }, |
| 760 | _setToLast : function () { |
| 761 | this._position = this._items.length - 1; |
| 762 | } |
| 763 | }; |
| 764 | |
| 765 | function chooseHint (e) { |
| 766 | var element = e.target; |
| 767 | while (element.nodeName == "STRONG" || element.nodeName == "SPAN") { |
| 768 | element = element.parentNode; |
Nils Diewald | 465c425 | 2014-06-20 21:51:58 +0000 | [diff] [blame] | 769 | }; |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 770 | if (element === undefined || element.nodeName != "LI") |
| 771 | return; |
| 772 | |
Nils Diewald | b01cd95 | 2015-03-04 21:26:32 +0000 | [diff] [blame] | 773 | // console.log(this.getAttribute('data-action')); |
| 774 | |
| 775 | var action = element.getAttribute('data-action'); |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 776 | hint.insertText(action); |
| 777 | var menu = hint.menu(); |
| 778 | menu.hide(); |
| 779 | |
| 780 | // Fill this with the correct value |
| 781 | var show; |
Nils Diewald | c1a6985 | 2014-11-19 03:06:45 +0000 | [diff] [blame] | 782 | if ((show = hint.analyzeContext()) != "-") { |
Nils Diewald | eca3044 | 2014-11-18 20:33:54 +0000 | [diff] [blame] | 783 | menu.show(show); |
| 784 | menu.update( |
| 785 | hint._search.getBoundingClientRect().right |
| 786 | ); |
| 787 | }; |
| 788 | |
| 789 | hint._search.focus(); |
| 790 | }; |
| 791 | |
| 792 | var MenuItem = { |
| 793 | _name : undefined, |
| 794 | _lcname : undefined, |
| 795 | _desc : undefined, |
| 796 | _element : undefined, |
| 797 | _action : "", |
| 798 | activate : function () { |
| 799 | this._element.classList.add("active"); |
| 800 | }, |
| 801 | deactivate : function () { |
| 802 | this._element.classList.remove("active"); |
| 803 | }, |
| 804 | // Initialize this item |
| 805 | init : function (param) { |
| 806 | this._name = param[0]; |
| 807 | this._action = param[1]; |
| 808 | this._lcname = this._name.toLocaleLowerCase(); |
| 809 | |
| 810 | if (param.length > 2) { |
| 811 | this._desc = param[2]; |
| 812 | this._lcname += " " + this._desc.toLocaleLowerCase(); |
| 813 | }; |
| 814 | |
| 815 | return this; |
| 816 | }, |
| 817 | |
| 818 | // Created element of this item |
| 819 | getElement : function () { |
| 820 | if (this._element !== undefined) |
| 821 | return this._element; |
| 822 | |
| 823 | var li = document.createElement("li"); |
| 824 | |
| 825 | li.setAttribute("data-action", this._action); |
| 826 | |
| 827 | var name = document.createElement("strong"); |
| 828 | |
| 829 | name.appendChild(document.createTextNode(this._name)); |
| 830 | li.appendChild(name); |
| 831 | if (this._desc !== undefined) { |
| 832 | var desc = document.createElement("span"); |
| 833 | desc.appendChild(document.createTextNode(this._desc)); |
| 834 | li.appendChild(desc); |
| 835 | }; |
| 836 | this._element = li; |
| 837 | return this._element; |
| 838 | }, |
| 839 | |
| 840 | // Name of this item |
| 841 | getName : function () { |
| 842 | return this._name; |
| 843 | }, |
| 844 | |
| 845 | getLCName : function () { |
| 846 | return this._lcname; |
| 847 | }, |
| 848 | |
| 849 | // Description of this item |
| 850 | getDesc : function () { |
| 851 | return this._desc; |
| 852 | }, |
| 853 | |
| 854 | |
| 855 | getAction : function () { |
| 856 | return this._action; |
| 857 | } |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 858 | }; |