From a93385a4f80c9c3cc3ee6777868e5752238ea3de Mon Sep 17 00:00:00 2001 From: Kai Labusch Date: Thu, 22 Aug 2019 18:34:25 +0200 Subject: [PATCH] add demo url text parameter --- qurator/sbb_ner/webapp/static/js/ner-demo.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/qurator/sbb_ner/webapp/static/js/ner-demo.js b/qurator/sbb_ner/webapp/static/js/ner-demo.js index 3e97dc8..0dff38e 100644 --- a/qurator/sbb_ner/webapp/static/js/ner-demo.js +++ b/qurator/sbb_ner/webapp/static/js/ner-demo.js @@ -30,7 +30,7 @@ $(document).ready(function(){ if (url_params.has('text')) { - var text = url_params.get('text') + var text = decodeURIComponent(url_params.get('text')) $('#inputtext').val(text); @@ -52,5 +52,16 @@ function update() { var model_id = $('#model').val(); var input_text = $('#inputtext').val() + if (input_text.length < 200) { + + var url_params = new URLSearchParams(window.location.search); + + url_params.set('text', encodeURIComponent(input_text)) + + window.history.replaceState({}, '', `${location.pathname}?${url_params}`); + } + + + do_task(task, model_id, input_text); } \ No newline at end of file