blob: 4f6074f730d47fdaa6987dc9c93ef5ef3dd1f1db [file] [log] [blame]
Akron7524be12016-06-01 17:31:33 +02001/*
Akron5cb9b2b2018-07-24 17:01:09 +02002 * Initialize The JS frontend part and decorate
3 * the static HTML data.
4 *
5 * @author Nils Diewald
6 *
Akron7524be12016-06-01 17:31:33 +02007 * TODO: Create lazy loading of objects including
8 * - obj.hint()
9 * - obj.alertify()
10 * - obj.session()
11 * - obj.tutorial()
12 * - obj.vc() // toggle
13 * - obj.matchCreate() (using webpack)
14 * - obj.koral() (show result, parse for errors ...)
15 * - obj.alignment() // toggle
16 */
17
Akrone51eaa32020-11-10 09:35:53 +010018"use strict";
Nils Diewald0e6992a2015-04-14 20:13:52 +000019define([
20 'match',
21 'hint',
22 'vc',
23 'tutorial',
24 'lib/domReady',
Akron27ae9ec2015-06-23 00:43:21 +020025 'vc/array',
Nils Diewald7148c6f2015-05-04 15:07:53 +000026 'lib/alertify',
Akron7716f012015-07-01 20:38:32 +020027 'session',
Akron6bb71582016-06-10 20:41:08 +020028 'selectMenu',
Akron5cb9b2b2018-07-24 17:01:09 +020029 'panel/result',
Akron2d0d96d2019-11-18 19:49:50 +010030 'panel/query',
hebasta75cfca52019-02-19 13:15:27 +010031 'tour/tours',
Akron24f48ea2020-07-01 09:37:19 +020032 'plugin/server',
33 'pipe',
Nils Diewald7148c6f2015-05-04 15:07:53 +000034 'api',
Nils Diewaldc46003b2015-05-07 15:55:35 +000035 'mailToChiffre',
Akron858cbc82019-12-05 16:53:13 +010036 'util',
37 'state'
Nils Diewald0e6992a2015-04-14 20:13:52 +000038], function (matchClass,
Akron19d97fe2016-09-06 20:47:05 +020039 hintClass,
40 vcClass,
41 tutClass,
42 domReady,
Akron19d97fe2016-09-06 20:47:05 +020043 vcArray,
44 alertifyClass,
45 sessionClass,
Akron4d926f12018-07-16 15:30:25 +020046 selectMenuClass,
hebasta75cfca52019-02-19 13:15:27 +010047 resultPanelClass,
Akron2d0d96d2019-11-18 19:49:50 +010048 queryPanelClass,
Akron24f48ea2020-07-01 09:37:19 +020049 tourClass,
50 pluginClass,
51 pipeClass) {
Nils Diewalda0defc42015-05-07 23:54:17 +000052
Akron0b489ad2018-02-02 16:49:32 +010053 const d = document;
Akron9cc3eaf2015-06-10 22:15:52 +020054
Akronbc6b3f22021-01-13 14:53:12 +010055 // Set base URL
56 KorAP.URL = d.body.getAttribute('data-korap-url') || "";
57
58 // Get koralQuery response
59 const kqe = d.getElementById('koralQuery');
60 if (kqe !== null) {
61 KorAP.koralQuery = JSON.parse(kqe.getAttribute('data-koralquery') || "");
62 };
63
Akron0c4cd222019-07-19 16:33:34 +020064 // Create suffix if KorAP is run in a subfolder
65 KorAP.session = sessionClass.create(
66 KorAP.URL.length > 0 ? 'kalamarJS-' + KorAP.URL.slugify() : 'kalamarJS'
67 );
Akronf8035592018-05-24 20:40:51 +020068
Nils Diewalda0defc42015-05-07 23:54:17 +000069 // Override KorAP.log
70 window.alertify = alertifyClass;
Akronc0a2da82018-07-04 15:27:37 +020071 KorAP.log = function (code, msg, src) {
72
73 if (src) {
74 msg += '<code class="src">'+src+'</code>';
75 };
Nils Diewalda0defc42015-05-07 23:54:17 +000076
77 // Use alertify to log errors
78 alertifyClass.log(
Akronf55504a2015-06-18 16:42:55 +020079 (code === 0 ? '' : code + ': ') +
Akron19d97fe2016-09-06 20:47:05 +020080 msg,
Nils Diewalda0defc42015-05-07 23:54:17 +000081 'error',
Akronf55504a2015-06-18 16:42:55 +020082 10000
Nils Diewalda0defc42015-05-07 23:54:17 +000083 );
84 };
85
hebasta2758b582018-11-19 15:59:42 +010086 KorAP.vc = vcClass.create(vcArray);
87
hebasta5df796f2019-05-21 15:27:12 +020088 KorAP.tourshow = function(){
89 tourClass.gTstartSearch().start();
90 };
91
92 KorAP.tourshowR = function(){
93 tourClass.gTshowResults().start();
94 };
Akroncb5c1712021-01-26 18:01:04 +010095
Nils Diewald0e6992a2015-04-14 20:13:52 +000096 domReady(function (event) {
hebasta5df796f2019-05-21 15:27:12 +020097
Nils Diewald0e6992a2015-04-14 20:13:52 +000098 var obj = {};
Akron71b91e42016-06-01 22:12:43 +020099
Akron4d926f12018-07-16 15:30:25 +0200100 // What should be visible in the beginning?
Akronf8035592018-05-24 20:40:51 +0200101 var show = KorAP.session.get('show') || {};
hebasta043e96f2019-11-28 12:33:00 +0100102
103 KorAP.Panel = KorAP.Panel || {}
Nils Diewalda297f062015-04-02 00:23:46 +0000104
105 /**
Akronf55504a2015-06-18 16:42:55 +0200106 * Release notifications
107 */
Akroncb5c1712021-01-26 18:01:04 +0100108 d.querySelectorAll('#notifications div.notify').forEach(
109 function(e) {
110 let msg = e.textContent;
111
112 let src = e.getAttribute('data-src');
113 if (src) {
114 msg += '<code class="src">'+src+'</code>';
Akron8ea84292018-10-24 13:41:52 +0200115 };
Akroncb5c1712021-01-26 18:01:04 +0100116
117 let type = e.getAttribute('data-type') || "error";
118 alertifyClass.log(msg, type, 10000);
119 }
120 );
Akronf55504a2015-06-18 16:42:55 +0200121
122 /**
Akroncd42a142019-07-12 18:55:37 +0200123 * Replace Virtual Corpus field
Nils Diewald7148c6f2015-05-04 15:07:53 +0000124 */
Akron5c829e92017-05-12 18:10:00 +0200125 var vcname, vcchoose;
Akroncd42a142019-07-12 18:55:37 +0200126 var input = d.getElementById('cq');
Akron1f0521b2018-08-28 13:01:24 +0200127
hebasta2758b582018-11-19 15:59:42 +0100128 var vc = KorAP.vc;
hebasta48842cf2018-12-11 12:57:38 +0100129
Akron1f0521b2018-08-28 13:01:24 +0200130 // Add vc name object
Nils Diewald7148c6f2015-05-04 15:07:53 +0000131 if (input) {
132 input.style.display = 'none';
Akron0b489ad2018-02-02 16:49:32 +0100133 vcname = d.createElement('span');
Nils Diewald7148c6f2015-05-04 15:07:53 +0000134 vcname.setAttribute('id', 'vc-choose');
Akron6bb71582016-06-10 20:41:08 +0200135 vcname.classList.add('select');
Akron941551e2015-06-11 16:06:22 +0200136
Akron1f0521b2018-08-28 13:01:24 +0200137 // Load virtual corpus object
Akroncd42a142019-07-12 18:55:37 +0200138 // Supports "collection" for legacy reasons
139 if (KorAP.koralQuery !== undefined && (KorAP.koralQuery["collection"] || KorAP.koralQuery["corpus"])) {
Akron1f0521b2018-08-28 13:01:24 +0200140 try {
Akroncd42a142019-07-12 18:55:37 +0200141 vc.fromJson(KorAP.koralQuery["collection"] || KorAP.koralQuery["corpus"]);
Akron1f0521b2018-08-28 13:01:24 +0200142 }
143 catch (e) {
144 KorAP.log(0,e);
145 }
Akron27ae9ec2015-06-23 00:43:21 +0200146 };
147
Akron0b489ad2018-02-02 16:49:32 +0100148 vcchoose = vcname.addE('span');
Akronec6bb8e2018-08-29 13:07:56 +0200149 vcchoose.addT(vc.getName());
Akron27ae9ec2015-06-23 00:43:21 +0200150
Akron1f0521b2018-08-28 13:01:24 +0200151 if (vc.wasRewritten()) {
152 vcchoose.classList.add('rewritten');
153 };
154
Nils Diewald7148c6f2015-05-04 15:07:53 +0000155 input.parentNode.insertBefore(vcname, input);
156 };
157
Nils Diewald7148c6f2015-05-04 15:07:53 +0000158 /**
Nils Diewalda297f062015-04-02 00:23:46 +0000159 * Add actions to match entries
160 */
Akronb50964a2020-10-12 11:44:37 +0200161 var matchElements = d.querySelectorAll(
Akron3c390c42020-03-30 09:06:21 +0200162 '#search > ol > li'
Nils Diewald5c5a7472015-04-02 22:13:38 +0000163 );
Akron6a535d42015-08-26 20:16:58 +0200164
Akronb50964a2020-10-12 11:44:37 +0200165 matchElements.forEach(function(e) {
Akron3c390c42020-03-30 09:06:21 +0200166
167 // Define class for active elements
168 if (e.classList.contains('active')) {
169 if (this._match === undefined) {
Akron19d97fe2016-09-06 20:47:05 +0200170 // lazyLoad
Akron3c390c42020-03-30 09:06:21 +0200171 matchClass.create(e).init();
Akron19d97fe2016-09-06 20:47:05 +0200172 };
Akron3c390c42020-03-30 09:06:21 +0200173 }
174
175 // Define class for inactive elements
176 else {
177 e.addEventListener('click', function (e) {
Akron19d97fe2016-09-06 20:47:05 +0200178 if (this._match !== undefined)
Akron3c390c42020-03-30 09:06:21 +0200179 this._match.open();
Akron19d97fe2016-09-06 20:47:05 +0200180 else {
181 // lazyLoad
182 matchClass.create(this).open();
183 };
Akron3c390c42020-03-30 09:06:21 +0200184 // This would prevent the sidebar to go back
185 // e.halt();
186 });
187 e.addEventListener('keydown', function (e) {
188 var code = _codeFromEvent(e);
189
190 switch (code) {
191 case 32:
192 if (this._match !== undefined)
193 this._match.toggle();
194 else {
195 // lazyLoad
196 matchClass.create(this).open();
197 };
198 e.halt();
199 break;
200 };
201 });
202 };
Akronb50964a2020-10-12 11:44:37 +0200203 }, this);
Akron3c390c42020-03-30 09:06:21 +0200204
Akrone0c32c72017-04-25 22:38:23 +0200205 // Add focus listener to aside
Akron0b489ad2018-02-02 16:49:32 +0100206 var aside = d.getElementsByTagName('aside')[0];
Akrone0c32c72017-04-25 22:38:23 +0200207
208 if (aside && aside.classList.contains('active') == false) {
Akron1885ce92017-04-26 23:10:01 +0200209
Akron5258d462017-04-26 23:32:57 +0200210 // Horrible lock to deal with sidebar clicks
211 var asideClicked = false;
212
Akron1885ce92017-04-26 23:10:01 +0200213 // Make aside active on focus
214 aside.addEventListener('focus', function(e) {
Akrone0c32c72017-04-25 22:38:23 +0200215 this.classList.add('active');
216 });
217
Akron1885ce92017-04-26 23:10:01 +0200218 // Deactivate focus when clicking anywhere else
Akron0b489ad2018-02-02 16:49:32 +0100219 var body = d.getElementsByTagName('body')[0];
Akron1885ce92017-04-26 23:10:01 +0200220 if (body !== null) {
221 body.addEventListener('click', function() {
Akron5258d462017-04-26 23:32:57 +0200222 if (!asideClicked) {
223 aside.classList.remove('active');
224 }
225 else {
226 asideClicked = false;
227 };
Akron1885ce92017-04-26 23:10:01 +0200228 });
229 };
230
231 /* Stop click event on aside
232 * (to not trickle down to body)
233 */
234 aside.addEventListener('click', function(e) {
Akron5258d462017-04-26 23:32:57 +0200235 asideClicked = true;
Akrone0c32c72017-04-25 22:38:23 +0200236 });
237 };
Akronb9cdb102017-04-25 00:52:31 +0200238
239
Akron6bb71582016-06-10 20:41:08 +0200240 // Replace QL select menus with KorAP menus
Akron0b489ad2018-02-02 16:49:32 +0100241 var qlField = d.getElementById('ql-field');
Akronaba7a5a2016-08-15 21:58:33 +0200242 if (qlField !== null) {
Akron086fe5d2017-11-13 14:01:45 +0100243 KorAP.QLmenu = selectMenuClass.create(
Akron0b489ad2018-02-02 16:49:32 +0100244 d.getElementById('ql-field').parentNode
Akronaba7a5a2016-08-15 21:58:33 +0200245 ).limit(5);
246 };
Akron6bb71582016-06-10 20:41:08 +0200247
Akron4d926f12018-07-16 15:30:25 +0200248 var resultInfo = d.getElementById('resultinfo');
249
Akron4d926f12018-07-16 15:30:25 +0200250 /**
251 * Add result panel
252 */
Akron5cb9b2b2018-07-24 17:01:09 +0200253 var resultPanel = resultPanelClass.create(show);
254
Akron4d926f12018-07-16 15:30:25 +0200255 if (resultInfo != null) {
Akron4d926f12018-07-16 15:30:25 +0200256
257 // Move buttons to resultinfo
258 resultInfo.appendChild(resultPanel.actions.element());
259
Akrone6538cd2018-07-16 17:52:33 +0200260 // The views are at the top of the search results
Akron4d926f12018-07-16 15:30:25 +0200261 var sb = d.getElementById('search');
262 sb.insertBefore(resultPanel.element(), sb.firstChild);
Akron4d926f12018-07-16 15:30:25 +0200263 };
264
265
Akron179c8ac2015-06-30 19:30:50 +0200266 // There is a koralQuery
Akron4d926f12018-07-16 15:30:25 +0200267 if (KorAP.koralQuery !== undefined) {
Akron5cb9b2b2018-07-24 17:01:09 +0200268
269 // Add KoralQuery view to result panel
Akron4d926f12018-07-16 15:30:25 +0200270 if (resultInfo !== null) {
Akron5cb9b2b2018-07-24 17:01:09 +0200271 resultPanel.addKqAction()
Akron179c8ac2015-06-30 19:30:50 +0200272 };
Akron7716f012015-07-01 20:38:32 +0200273
Akron00cd4d12016-05-31 21:01:11 +0200274 if (KorAP.koralQuery["errors"]) {
Akron678c26f2020-10-09 08:52:50 +0200275 KorAP.koralQuery["errors"].forEach(function(e) {
Akronf0c31ed2016-06-11 11:27:01 +0200276
Akron19d97fe2016-09-06 20:47:05 +0200277 // Malformed query
Akron4a24b722020-10-13 12:44:25 +0200278 if (e[0] === 302 && e[2] !== undefined) {
Akron19d97fe2016-09-06 20:47:05 +0200279 obj.hint = hintClass.create();
Akron678c26f2020-10-09 08:52:50 +0200280 obj.hint.alert(e[2], e[1]);
Akron19d97fe2016-09-06 20:47:05 +0200281 }
Akronf0c31ed2016-06-11 11:27:01 +0200282
Akron19d97fe2016-09-06 20:47:05 +0200283 // no query
Akron678c26f2020-10-09 08:52:50 +0200284 else if (e[0] === 301) {
Akron19d97fe2016-09-06 20:47:05 +0200285 obj.hint = hintClass.create();
Akron678c26f2020-10-09 08:52:50 +0200286 obj.hint.alert(0, e[1]);
Akron19d97fe2016-09-06 20:47:05 +0200287 }
Akron678c26f2020-10-09 08:52:50 +0200288 });
Akron00cd4d12016-05-31 21:01:11 +0200289 };
Akron179c8ac2015-06-30 19:30:50 +0200290 };
291
Akron5cb9b2b2018-07-24 17:01:09 +0200292
293 /*
294 * There is more than 0 matches, so allow for
295 * alignment toggling (left <=> right)
296 */
Akronb50964a2020-10-12 11:44:37 +0200297 if (matchElements.length > 0)
Akron5cb9b2b2018-07-24 17:01:09 +0200298 resultPanel.addAlignAction();
Nils Diewald7148c6f2015-05-04 15:07:53 +0000299
hebasta043e96f2019-11-28 12:33:00 +0100300 KorAP.Panel['result'] = resultPanel;
Akron5cb9b2b2018-07-24 17:01:09 +0200301 /*
Akroncd42a142019-07-12 18:55:37 +0200302 * Toggle the Virtual Corpus builder
Nils Diewald7148c6f2015-05-04 15:07:53 +0000303 */
304 if (vcname) {
Akronec6bb8e2018-08-29 13:07:56 +0200305 vc.onMinimize = function () {
306 vcname.classList.remove('active');
Akroncd42a142019-07-12 18:55:37 +0200307 delete show['vc'];
Akronec6bb8e2018-08-29 13:07:56 +0200308 };
Nils Diewald6283d692015-04-23 20:32:53 +0000309
Akronec6bb8e2018-08-29 13:07:56 +0200310 vc.onOpen = function () {
311 vcname.classList.add('active');
Akroncfe8ecc2018-11-20 18:46:16 +0100312
313 var view = d.getElementById('vc-view');
314 if (!view.firstChild)
315 view.appendChild(this.element());
316
Akroncd42a142019-07-12 18:55:37 +0200317 show['vc'] = true;
Akronec6bb8e2018-08-29 13:07:56 +0200318 };
319
320 var vcclick = function () {
Akronec6bb8e2018-08-29 13:07:56 +0200321 if (vc.isOpen()) {
322 vc.minimize()
323 }
324 else {
Akronec6bb8e2018-08-29 13:07:56 +0200325 vc.open();
Akron19d97fe2016-09-06 20:47:05 +0200326 };
Nils Diewald58141332015-04-07 16:18:45 +0000327 };
Akron04671e72017-05-11 20:47:32 +0200328
Akron179c8ac2015-06-30 19:30:50 +0200329 vcname.onclick = vcclick;
Akron5c829e92017-05-12 18:10:00 +0200330
331 // Click, if the VC should be shown
Akroncd42a142019-07-12 18:55:37 +0200332 if (show['vc']) {
Akron19d97fe2016-09-06 20:47:05 +0200333 vcclick.apply();
Akron04671e72017-05-11 20:47:32 +0200334 };
Nils Diewald58141332015-04-07 16:18:45 +0000335 };
336
Akron19d97fe2016-09-06 20:47:05 +0200337
Nils Diewald58141332015-04-07 16:18:45 +0000338 /**
339 * Init Tutorial view
340 */
Akron0b489ad2018-02-02 16:49:32 +0100341 if (d.getElementById('view-tutorial')) {
Nils Diewaldfccfbcb2015-04-29 20:48:19 +0000342 window.tutorial = tutClass.create(
Akron0b489ad2018-02-02 16:49:32 +0100343 d.getElementById('view-tutorial'),
Akronf8035592018-05-24 20:40:51 +0200344 KorAP.session
Nils Diewaldfccfbcb2015-04-29 20:48:19 +0000345 );
346 obj.tutorial = window.tutorial;
347 }
Nils Diewald58141332015-04-07 16:18:45 +0000348
Nils Diewaldfccfbcb2015-04-29 20:48:19 +0000349 // Tutorial is in parent
350 else if (window.parent) {
351 obj.tutorial = window.parent.tutorial;
352 };
353
Akron0b489ad2018-02-02 16:49:32 +0100354 // Initialize queries for d
Akron6ed13992016-05-23 18:06:05 +0200355 if (obj.tutorial) {
Akron0b489ad2018-02-02 16:49:32 +0100356 obj.tutorial.initQueries(d);
Nils Diewaldfccfbcb2015-04-29 20:48:19 +0000357
Akron6ed13992016-05-23 18:06:05 +0200358 // Initialize documentation links
Akron0b489ad2018-02-02 16:49:32 +0100359 obj.tutorial.initDocLinks(d);
Akron6ed13992016-05-23 18:06:05 +0200360 };
Nils Diewald61e6ff52015-05-07 17:26:50 +0000361
Nils Diewald845282c2015-05-14 07:53:03 +0000362
Nils Diewald58141332015-04-07 16:18:45 +0000363 /**
Akronc1457bf2015-06-11 19:24:00 +0200364 * Add VC creation on submission.
365 */
Akron0b489ad2018-02-02 16:49:32 +0100366 var form = d.getElementById('searchform');
Akron792f58b2015-07-08 18:59:36 +0200367 if (form !== null) {
Akronc1457bf2015-06-11 19:24:00 +0200368 form.addEventListener('submit', function (e) {
Akron0b489ad2018-02-02 16:49:32 +0100369 var qf = d.getElementById('q-field');
Akron1be6c1c2020-01-07 15:29:58 +0100370
Akron19d97fe2016-09-06 20:47:05 +0200371 // No query was defined
372 if (qf.value === undefined || qf.value === '') {
373 qf.focus();
374 e.halt();
375 KorAP.log(700, "No query given");
376 return;
377 };
Akron1be6c1c2020-01-07 15:29:58 +0100378
Akron19d97fe2016-09-06 20:47:05 +0200379 // Store session information
Akronf8035592018-05-24 20:40:51 +0200380 KorAP.session.set("show", show);
Akron7716f012015-07-01 20:38:32 +0200381
Akron19d97fe2016-09-06 20:47:05 +0200382 if (vc !== undefined) {
383 input.value = vc.toQuery();
Akrond7ad9072019-12-09 07:08:20 +0100384 if (input.value == '')
385 input.removeAttribute('name');
Akron19d97fe2016-09-06 20:47:05 +0200386 }
387 else {
Akrond7ad9072019-12-09 07:08:20 +0100388 input.removeAttribute('value');
389 input.removeAttribute('name');
Akron19d97fe2016-09-06 20:47:05 +0200390 };
Akron1be6c1c2020-01-07 15:29:58 +0100391
392 // This would preferably set the query to be "disabled",
393 // but in that case the query wouldn't be submitted
394 // at all.
395 // Setting the cursor to "progress" fails in current versions
396 // of webkit.
397 qf.classList.add("loading");
398 d.getElementById('qsubmit').classList.add("loading");
Akronc1457bf2015-06-11 19:24:00 +0200399 });
400 };
hebasta5df796f2019-05-21 15:27:12 +0200401
402
403 //Starts the guided tour at the next page
404 if(KorAP.session.get("tour")){
405 tourClass.gTshowResults().start();
406 }
407
Akronc1457bf2015-06-11 19:24:00 +0200408 /**
Nils Diewald58141332015-04-07 16:18:45 +0000409 * Init hint helper
410 * has to be final because of
411 * reposition
412 */
Nils Diewald0e6992a2015-04-14 20:13:52 +0000413 // Todo: Pass an element, so this works with
414 // tutorial pages as well!
Akron00cd4d12016-05-31 21:01:11 +0200415 if (obj.hint === undefined)
416 obj.hint = hintClass.create();
Nils Diewald7148c6f2015-05-04 15:07:53 +0000417
Akron99713ef2017-06-28 18:19:28 +0200418 // Add the hinthelper to the KorAP object to make it manipulatable globally
Akron72f73572017-12-05 12:31:09 +0100419 KorAP.Hint = obj.hint;
Akron99713ef2017-06-28 18:19:28 +0200420
Akron2d0d96d2019-11-18 19:49:50 +0100421
422 /**
423 * Add query panel
424 */
425 var queryPanel = queryPanelClass.create();
426
427 // Get input field
428 var sform = d.getElementById("searchform");
429 var vcView = d.getElementById('vc-view')
430 if (sform && vcView) {
431 // The views are below the query bar
432 sform.insertBefore(queryPanel.element(), vcView);
Akron2d0d96d2019-11-18 19:49:50 +0100433 KorAP.Panel['query'] = queryPanel;
434 }
Akron24f48ea2020-07-01 09:37:19 +0200435
436 /**
437 * Initialize Plugin registry.
438 */
Akron8dda1c62021-01-20 10:27:32 +0100439 let pe;
440 if (pe = d.getElementById("kalamar-plugins")) {
441 let url = pe.getAttribute('data-plugins');
442 if (url !== undefined) {
443 KorAP.API.getPluginList(url, function (json) {
444 if (json && json.length > 0) {
445 // Load Plugin Server first
446 KorAP.Plugin = pluginClass.create();
Akron24f48ea2020-07-01 09:37:19 +0200447
Akron8dda1c62021-01-20 10:27:32 +0100448 // Add services container to head
449 d.head.appendChild(KorAP.Plugin.element());
Akron24f48ea2020-07-01 09:37:19 +0200450
Akron8dda1c62021-01-20 10:27:32 +0100451 // Add pipe form
452 KorAP.Pipe = pipeClass.create();
453 d.getElementById("searchform").appendChild(KorAP.Pipe.element());
454
455 try {
456
457 // Register all plugins
458 json.forEach(i => KorAP.Plugin.register(i));
459 }
460 catch (e) {
461 KorAP.log(0, e);
462 }
463 }
464 });
465 };
Akron24f48ea2020-07-01 09:37:19 +0200466 };
Akron8dda1c62021-01-20 10:27:32 +0100467
Nils Diewald58141332015-04-07 16:18:45 +0000468 return obj;
Nils Diewald0e6992a2015-04-14 20:13:52 +0000469 });
hebasta75cfca52019-02-19 13:15:27 +0100470
Nils Diewald0e6992a2015-04-14 20:13:52 +0000471});