Akron | 99713ef | 2017-06-28 18:19:28 +0200 | [diff] [blame] | 1 | /** |
| 2 | * Information about a match. |
| 3 | */ |
Nils Diewald | 7c8ced2 | 2015-04-15 19:21:00 +0000 | [diff] [blame] | 4 | define([ |
| 5 | 'match/infolayer', |
| 6 | 'match/table', |
Akron | 41387d2 | 2018-02-02 18:10:06 +0100 | [diff] [blame^] | 7 | 'match/treehierarchy', |
| 8 | 'match/treearc', |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 9 | 'match/meta', |
Akron | 99713ef | 2017-06-28 18:19:28 +0200 | [diff] [blame] | 10 | 'match/querycreator', |
Nils Diewald | 7c8ced2 | 2015-04-15 19:21:00 +0000 | [diff] [blame] | 11 | 'util' |
| 12 | ], function (infoLayerClass, |
Akron | 3bb91bc | 2016-12-02 16:43:17 +0100 | [diff] [blame] | 13 | matchTableClass, |
Akron | 41387d2 | 2018-02-02 18:10:06 +0100 | [diff] [blame^] | 14 | matchTreeHierarchyClass, |
| 15 | matchTreeArcClass, |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 16 | matchMetaClass, |
Akron | 0988d88 | 2017-11-10 16:13:12 +0100 | [diff] [blame] | 17 | matchQueryCreator) { |
Akron | 3bb91bc | 2016-12-02 16:43:17 +0100 | [diff] [blame] | 18 | |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 19 | // Override |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 20 | KorAP.API.getMatchInfo = KorAP.API.getMatchInfo || function () { |
| 21 | KorAP.log(0, 'KorAP.API.getMatchInfo() not implemented') |
| 22 | return {}; |
| 23 | }; |
| 24 | |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 25 | const loc = KorAP.Locale; |
| 26 | const d = document; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 27 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 28 | return { |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 29 | |
| 30 | /** |
| 31 | * Create new match object |
| 32 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 33 | create : function (match) { |
| 34 | return Object.create(this)._init(match); |
| 35 | }, |
| 36 | |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 37 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 38 | /** |
| 39 | * Initialize object |
| 40 | */ |
| 41 | _init : function (match) { |
| 42 | this._match = match; |
| 43 | this.opened = false; |
| 44 | return this; |
| 45 | }, |
| 46 | |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 47 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 48 | /** |
| 49 | * Get match object |
| 50 | */ |
| 51 | match : function () { |
| 52 | return this._match; |
| 53 | }, |
| 54 | |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * Open the information view, |
| 58 | * if closed, otherwise close. |
| 59 | */ |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 60 | /* |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 61 | toggle : function () { |
Akron | 3bb91bc | 2016-12-02 16:43:17 +0100 | [diff] [blame] | 62 | |
Akron | 08b82d6 | 2016-12-05 15:06:05 +0100 | [diff] [blame] | 63 | var elem = this._match.element(); |
Akron | 3bb91bc | 2016-12-02 16:43:17 +0100 | [diff] [blame] | 64 | |
| 65 | if (this.opened == true) { |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 66 | elem.removeChild( |
| 67 | this.element() |
| 68 | ); |
| 69 | this.opened = false; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 70 | } |
| 71 | else { |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 72 | // Append element to match |
Akron | 3bb91bc | 2016-12-02 16:43:17 +0100 | [diff] [blame] | 73 | elem.appendChild( |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 74 | this.element() |
| 75 | ); |
| 76 | this.opened = true; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | return this.opened; |
| 80 | }, |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 81 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 82 | |
| 83 | |
| 84 | /** |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 85 | * Retrieve and parse snippet for table |
| 86 | * representation |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 87 | */ |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 88 | getTableData : function (tokens, cb) { |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 89 | var focus = []; |
| 90 | |
| 91 | // Get all tokens |
| 92 | if (tokens === undefined) { |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 93 | focus = this._match.getTokens(); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | // Get only some tokens |
| 97 | else { |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 98 | |
| 99 | // Push newly to focus array |
| 100 | for (var i = 0; i < tokens.length; i++) { |
| 101 | var term = tokens[i]; |
| 102 | try { |
| 103 | // Create info layer objects |
| 104 | var layer = infoLayerClass.create(term); |
| 105 | layer.type = "tokens"; |
| 106 | focus.push(layer); |
| 107 | } |
| 108 | catch (e) { |
| 109 | continue; |
| 110 | }; |
| 111 | }; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 112 | }; |
| 113 | |
| 114 | // No tokens chosen |
| 115 | if (focus.length == 0) |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 116 | cb(null); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 117 | |
| 118 | // Get info (may be cached) |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 119 | KorAP.API.getMatchInfo( |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 120 | this._match, |
| 121 | { 'spans' : false, 'layer' : focus }, |
| 122 | |
| 123 | // Callback for retrieval |
| 124 | function (matchResponse) { |
Akron | 3bb91bc | 2016-12-02 16:43:17 +0100 | [diff] [blame] | 125 | |
Akron | 515851a | 2017-05-02 12:53:17 +0200 | [diff] [blame] | 126 | if (matchResponse === undefined) |
| 127 | cb(null); |
| 128 | |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 129 | // Get snippet from match info |
| 130 | if (matchResponse["snippet"] !== undefined) { |
| 131 | this._table = matchTableClass.create(matchResponse["snippet"]); |
| 132 | cb(this._table); |
| 133 | }; |
| 134 | }.bind(this) |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 135 | ); |
| 136 | |
| 137 | /* |
| 138 | // Todo: Store the table as a hash of the focus |
| 139 | return null; |
| 140 | */ |
| 141 | }, |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 142 | |
| 143 | |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 144 | getMetaData : function (metaInfo, cb) { |
| 145 | // ... |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 146 | }, |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 147 | |
| 148 | |
| 149 | /** |
| 150 | * Retrieve and parse snippet for tree representation |
| 151 | */ |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 152 | getTreeData : function (foundry, layer, type, cb) { |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 153 | var focus = []; |
| 154 | |
| 155 | // TODO: Support and cache multiple trees |
| 156 | KorAP.API.getMatchInfo( |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 157 | this._match, { |
| 158 | 'spans' : true, |
| 159 | 'foundry' : foundry, |
| 160 | 'layer' : layer |
| 161 | }, |
| 162 | function (matchResponse) { |
| 163 | // Get snippet from match info |
| 164 | if (matchResponse["snippet"] !== undefined) { |
| 165 | // Todo: This should be cached somehow |
Akron | c56cf2d | 2016-11-09 22:02:38 +0100 | [diff] [blame] | 166 | |
Akron | 0988d88 | 2017-11-10 16:13:12 +0100 | [diff] [blame] | 167 | if (type === "spans") { |
Akron | 41387d2 | 2018-02-02 18:10:06 +0100 | [diff] [blame^] | 168 | cb(matchTreeHierarchyClass.create(matchResponse["snippet"])); |
Akron | 0988d88 | 2017-11-10 16:13:12 +0100 | [diff] [blame] | 169 | } |
| 170 | else if (type === "rels") { |
Akron | 41387d2 | 2018-02-02 18:10:06 +0100 | [diff] [blame^] | 171 | cb(matchTreeArcClass.create(matchResponse["snippet"])); |
Akron | 0988d88 | 2017-11-10 16:13:12 +0100 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | // Unknown tree type |
| 175 | else { |
| 176 | cb(null); |
| 177 | }; |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 178 | } |
| 179 | else { |
| 180 | cb(null); |
| 181 | }; |
| 182 | }.bind(this) |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 183 | ); |
| 184 | }, |
| 185 | |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 186 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 187 | /** |
| 188 | * Destroy this match information view. |
| 189 | */ |
| 190 | destroy : function () { |
| 191 | |
| 192 | // Remove circular reference |
Akron | 8b592d4 | 2018-01-26 18:33:06 +0100 | [diff] [blame] | 193 | /* |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 194 | if (this._treeMenu !== undefined) |
Akron | 99713ef | 2017-06-28 18:19:28 +0200 | [diff] [blame] | 195 | delete this._treeMenu["info"]; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 196 | |
| 197 | this._treeMenu.destroy(); |
| 198 | this._treeMenu = undefined; |
Akron | 8b592d4 | 2018-01-26 18:33:06 +0100 | [diff] [blame] | 199 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 200 | this._match = undefined; |
Akron | 99713ef | 2017-06-28 18:19:28 +0200 | [diff] [blame] | 201 | this._matchCreator = undefined; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 202 | // Element destroy |
| 203 | }, |
| 204 | |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 205 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 206 | /** |
| 207 | * Add a new tree view to the list |
| 208 | */ |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 209 | showTree : function (foundry, layer, type, cb) { |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 210 | var matchtree = d.createElement('div'); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 211 | matchtree.classList.add('matchtree'); |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 212 | |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 213 | // Add title line |
| 214 | var h6 = matchtree.addE('h6'); |
| 215 | h6.addE('span').addT(foundry); |
| 216 | h6.addE('span').addT(layer); |
| 217 | |
| 218 | var tree = matchtree.addE('div'); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 219 | |
| 220 | this._element.insertBefore(matchtree, this._element.lastChild); |
| 221 | |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 222 | // Add close action button |
| 223 | var actions = tree.addE('ul'); |
Akron | c56cf2d | 2016-11-09 22:02:38 +0100 | [diff] [blame] | 224 | actions.classList.add('action', 'image'); |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 225 | var close = actions.addE('li'); |
Akron | c56cf2d | 2016-11-09 22:02:38 +0100 | [diff] [blame] | 226 | close.className = 'close'; |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 227 | close.addE('span'); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 228 | close.addEventListener( |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 229 | 'click', function (e) { |
| 230 | matchtree.parentNode.removeChild(matchtree); |
| 231 | e.halt(); |
| 232 | } |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 233 | ); |
| 234 | |
Nils Diewald | 0ec142f | 2015-05-05 00:29:23 +0000 | [diff] [blame] | 235 | tree.classList.add('loading'); |
| 236 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 237 | // Get tree data async |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 238 | this.getTreeData(foundry, layer, type, function (treeObj) { |
Nils Diewald | 0ec142f | 2015-05-05 00:29:23 +0000 | [diff] [blame] | 239 | |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 240 | tree.classList.remove('loading'); |
Nils Diewald | 0ec142f | 2015-05-05 00:29:23 +0000 | [diff] [blame] | 241 | |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 242 | // Something went wrong - probably log!!! |
Nils Diewald | 0ec142f | 2015-05-05 00:29:23 +0000 | [diff] [blame] | 243 | |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 244 | if (treeObj === null) { |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 245 | tree.addT('No data available.'); |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 246 | } |
| 247 | else { |
| 248 | tree.appendChild(treeObj.element()); |
Akron | 0988d88 | 2017-11-10 16:13:12 +0100 | [diff] [blame] | 249 | treeObj.show(); |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 250 | |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 251 | // Reposition the view to the center |
| 252 | // (This may in a future release be a reposition |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 253 | // to move the root to the actual match) |
Akron | c56cf2d | 2016-11-09 22:02:38 +0100 | [diff] [blame] | 254 | |
Akron | 0988d88 | 2017-11-10 16:13:12 +0100 | [diff] [blame] | 255 | // This is currently not supported by relations |
| 256 | if (type === "spans") { |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 257 | var dl = d.createElement('li'); |
Akron | 0988d88 | 2017-11-10 16:13:12 +0100 | [diff] [blame] | 258 | dl.className = 'download'; |
| 259 | dl.addEventListener( |
| 260 | 'click', function (e) { |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 261 | var a = treeObj.downloadLink(); |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 262 | d.body.appendChild(a); |
Akron | 0988d88 | 2017-11-10 16:13:12 +0100 | [diff] [blame] | 263 | a.click(); |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 264 | d.body.removeChild(a) |
Akron | 0988d88 | 2017-11-10 16:13:12 +0100 | [diff] [blame] | 265 | e.halt(); |
| 266 | } |
| 267 | ); |
| 268 | |
| 269 | actions.appendChild(dl); |
| 270 | }; |
| 271 | |
Akron | c56cf2d | 2016-11-09 22:02:38 +0100 | [diff] [blame] | 272 | treeObj.center(); |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 273 | }; |
| 274 | |
| 275 | if (cb !== undefined) |
| 276 | cb(treeObj); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 277 | }); |
| 278 | }, |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 279 | |
| 280 | |
Akron | e767969 | 2018-01-26 12:06:33 +0100 | [diff] [blame] | 281 | // Add meta information to match |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 282 | showMeta : function () { |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 283 | var matchmeta = d.createElement('div'); |
Akron | 41387d2 | 2018-02-02 18:10:06 +0100 | [diff] [blame^] | 284 | matchmeta.classList.add('matchmeta', 'loading'); |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 285 | |
| 286 | // TODO: This is part of the getMeta! |
| 287 | var metaInfo = this._match.element().getAttribute('data-info'); |
| 288 | |
| 289 | if (metaInfo) |
| 290 | metaInfo = JSON.parse(metaInfo); |
| 291 | |
| 292 | // There is metainfo |
| 293 | if (metaInfo) { |
| 294 | |
| 295 | // Add metainfo to matchview |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 296 | var metaElem = matchMetaClass.create(this._match).element(metaInfo); |
Akron | 41387d2 | 2018-02-02 18:10:06 +0100 | [diff] [blame^] | 297 | this.element().appendChild(metaElem); |
| 298 | /* |
Akron | e767969 | 2018-01-26 12:06:33 +0100 | [diff] [blame] | 299 | elem.insertBefore( |
| 300 | metaElem, |
| 301 | elem.firstChild |
| 302 | ); |
Akron | 41387d2 | 2018-02-02 18:10:06 +0100 | [diff] [blame^] | 303 | */ |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 304 | }; |
Akron | 41387d2 | 2018-02-02 18:10:06 +0100 | [diff] [blame^] | 305 | |
| 306 | // Load data |
| 307 | matchmeta.classList.remove('loading'); |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 308 | }, |
| 309 | |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 310 | |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 311 | // Add table |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 312 | showTable : function () { |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 313 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 314 | // Append default table |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 315 | var matchtable = d.createElement('div'); |
Nils Diewald | 0ec142f | 2015-05-05 00:29:23 +0000 | [diff] [blame] | 316 | matchtable.classList.add('matchtable', 'loading'); |
Akron | 41387d2 | 2018-02-02 18:10:06 +0100 | [diff] [blame^] | 317 | this.element().appendChild(matchtable); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 318 | |
| 319 | // Create the table asynchronous |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 320 | this.getTableData(undefined, function (table) { |
Akron | 3bb91bc | 2016-12-02 16:43:17 +0100 | [diff] [blame] | 321 | |
Akron | d67d45b | 2017-05-18 21:47:38 +0200 | [diff] [blame] | 322 | if (table !== null) { |
Akron | 3bb91bc | 2016-12-02 16:43:17 +0100 | [diff] [blame] | 323 | matchtable.appendChild(table.element()); |
| 324 | }; |
Akron | 151bc87 | 2018-02-02 14:04:15 +0100 | [diff] [blame] | 325 | |
| 326 | // Load data |
| 327 | matchtable.classList.remove('loading'); |
Akron | 99713ef | 2017-06-28 18:19:28 +0200 | [diff] [blame] | 328 | |
| 329 | // Add query creator |
Akron | e8ea000 | 2017-06-28 18:51:52 +0200 | [diff] [blame] | 330 | this._matchCreator = matchQueryCreator.create(info); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 331 | }); |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 332 | }, |
| 333 | |
| 334 | /** |
| 335 | * Create match information view. |
| 336 | */ |
| 337 | element : function () { |
| 338 | |
| 339 | if (this._element !== undefined) |
| 340 | return this._element; |
| 341 | |
| 342 | // Create info table |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 343 | var info = d.createElement('div'); |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 344 | info.classList.add('matchinfo'); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 345 | |
| 346 | this._element = info; |
| 347 | |
Akron | bd34298 | 2018-01-25 18:01:46 +0100 | [diff] [blame] | 348 | return this._element; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 349 | } |
| 350 | }; |
| 351 | }); |