From d24e8bb8f162c2cede3b85b29374822aa99a067a Mon Sep 17 00:00:00 2001 From: Joeli Takala Date: Tue, 6 Sep 2022 17:41:03 +0300 Subject: [PATCH 1/4] Setting the cookie for multiple vocabularies in global search --- resource/js/docready.js | 2 +- resource/js/scripts.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resource/js/docready.js b/resource/js/docready.js index 0e3d044d1..e99cc992d 100644 --- a/resource/js/docready.js +++ b/resource/js/docready.js @@ -942,7 +942,7 @@ $(function() { // DOCUMENT READY // activating the custom autocomplete function updateVocabParam() { vocabSelectionString = ''; - var $vocabs = $('li > a.active input'); + var $vocabs = $('button.active input'); $.each($vocabs, function(index, ob) { if (ob.value === 'multiselect-all') { diff --git a/resource/js/scripts.js b/resource/js/scripts.js index 8ef5f5a33..fd91d03f9 100644 --- a/resource/js/scripts.js +++ b/resource/js/scripts.js @@ -16,7 +16,7 @@ function createCookie(name,value,days) { date.setTime(date.getTime() + (days*24*60*60*1000)); expires = "; expires=" + date.toGMTString(); } - document.cookie = name + "=" + value + expires + "; path=/"; + document.cookie = name + "=" + value + expires + "; path=/; SameSite=None; Secure"; } function readCookie(name) { From 4d2c6205878cc8269d026df36faf42c3525752ab Mon Sep 17 00:00:00 2001 From: Joeli Takala Date: Wed, 7 Sep 2022 11:54:03 +0300 Subject: [PATCH 2/4] Setting the search language --- resource/js/docready.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resource/js/docready.js b/resource/js/docready.js index e99cc992d..22a4f81a9 100644 --- a/resource/js/docready.js +++ b/resource/js/docready.js @@ -580,7 +580,7 @@ $(function() { // DOCUMENT READY createCookie('SKOSMOS_SEARCH_LANG', qlang, 365); } - $('.lang-button').on('click', function() { + $('a.dropdown-item').on('click', function() { qlang = $(this)[0].attributes.hreflang ? $(this)[0].attributes.hreflang.value : 'anything'; $('#lang-dropdown-toggle').html($(this).html() + ' '); $('#lang-input').val(qlang); From 10d1595fc6751a83b19419146b5cff288b48add5 Mon Sep 17 00:00:00 2001 From: Takala Joeli A Date: Tue, 13 Sep 2022 13:53:25 +0300 Subject: [PATCH 3/4] Fixed handling of search parameters in the header bar. Changed cookie settings --- resource/js/scripts.js | 2 +- view/headerbar.twig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resource/js/scripts.js b/resource/js/scripts.js index fd91d03f9..63b77dee8 100644 --- a/resource/js/scripts.js +++ b/resource/js/scripts.js @@ -16,7 +16,7 @@ function createCookie(name,value,days) { date.setTime(date.getTime() + (days*24*60*60*1000)); expires = "; expires=" + date.toGMTString(); } - document.cookie = name + "=" + value + expires + "; path=/; SameSite=None; Secure"; + document.cookie = name + "=" + value + expires + "; path=/; SameSite=Lax"; } function readCookie(name) { diff --git a/view/headerbar.twig b/view/headerbar.twig index f6ab5e217..dae567657 100644 --- a/view/headerbar.twig +++ b/view/headerbar.twig @@ -36,8 +36,8 @@ ?clang={{langcode}} {%- set paramSeparator = '&' -%} {%- endif %} - {%- if term %}{{ paramSeparator }}q={{ term }}{% set paramSeparor = '&' %}{% endif -%} - {%- if vocabs %}{{ paramSepartor }}vocabs={{ vocabs }}{% endif -%} + {%- if term %}{{ paramSeparator }}q={{ term }}{% set paramSeparator = '&' %}{% endif -%} + {%- if vocabs %}{{ paramSeparator }}vocabs={{ vocabs }}{% endif -%} " class="lang-button" hreflang="{{ langcode }}">{{ langcode | lang_name(request.lang) }} {% endfor %} {% endif %} From e8715d17d949dcc7f242dff95c99fb9a9ce4e9ed Mon Sep 17 00:00:00 2001 From: Joeli Takala Date: Tue, 13 Sep 2022 15:23:34 +0300 Subject: [PATCH 4/4] Added an event listener for onSelectAll --- resource/js/docready.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resource/js/docready.js b/resource/js/docready.js index 22a4f81a9..1188876b5 100644 --- a/resource/js/docready.js +++ b/resource/js/docready.js @@ -1008,6 +1008,10 @@ $(function() { // DOCUMENT READY } updateVocabParam(); }, + onSelectAll: function() { + selectedVocabs = []; + updateVocabParam(); + }, maxHeight: 300 });