From c85f50d6bfd5edfadac4196da92e2df2e9fa738c Mon Sep 17 00:00:00 2001
From: kouralex <1723419+kouralex@users.noreply.github.com>
Date: Thu, 4 Mar 2021 22:40:48 +0200
Subject: [PATCH 1/9] prepare code for jquery 3.x; replace deprecated features;
tags must be properly closed
---
resource/js/docready.js | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/resource/js/docready.js b/resource/js/docready.js
index 2300065e3..88702b220 100644
--- a/resource/js/docready.js
+++ b/resource/js/docready.js
@@ -1,6 +1,6 @@
$(function() { // DOCUMENT READY
- var spinner = '
'+ loading_text + '
';
+ var spinner = ''+ loading_text + '
';
var searchString = ''; // stores the search field's value before autocomplete selection changes it
var selectedVocabs = [];
var vocabId;
@@ -14,7 +14,7 @@ $(function() { // DOCUMENT READY
shortenProperties();
// kills the autocomplete after a form submit so we won't have to wait for the ajax to complete.
- $('.navbar-form').submit(
+ $('.navbar-form').on('submit',
function() {
$('#search-field').typeahead('destroy');
$.ajaxQ.abortAll();
@@ -228,8 +228,8 @@ $(function() { // DOCUMENT READY
// ajaxing the concept count and the preflabel counts on the vocabulary front page
if ($('#vocab-info').length && $('#statistics').length) {
// adding the spinners
- $('#counts tr:nth-of-type(1)').after(' |
');
- $('#statistics tr:nth-of-type(1)').after(' |
');
+ $('#counts tr:nth-of-type(1)').after(' |
');
+ $('#statistics tr:nth-of-type(1)').after(' |
');
$.ajax({
url : rest_base_url + vocab + '/vocabularyStatistics',
data: $.param({'lang' : content_lang}),
@@ -520,7 +520,7 @@ $(function() { // DOCUMENT READY
// Event handlers for the language selection links for setting the cookie
$('#language a').each( function(index, el) {
- $(el).click(function() {
+ $(el).on('click', function() {
var langCode = el.id.substr(el.id.indexOf("-") + 1);
setLangCookie(langCode);
});
@@ -605,7 +605,7 @@ $(function() { // DOCUMENT READY
createCookie('SKOSMOS_SEARCH_LANG', qlang, 365);
}
- $('.lang-button').click(function() {
+ $('.lang-button').on('click', function() {
qlang = $(this)[0].attributes.hreflang ? $(this)[0].attributes.hreflang.value : 'anything';
var any = (qlang === 'anything') ? '1' : '0';
$('#lang-dropdown-toggle').html($(this).html() + ' ');
@@ -615,7 +615,7 @@ $(function() { // DOCUMENT READY
if (concepts) { concepts.clear(); }
});
- $('.lang-button, .lang-button-all').click(function() {
+ $('.lang-button, .lang-button-all').on('click', function() {
$('#search-field').focus();
});
@@ -625,7 +625,7 @@ $(function() { // DOCUMENT READY
}
// disables the button with an empty search form
- $('#search-field').keyup(function() {
+ $('#search-field').on('keyup', function() {
var empty = false;
$('#search-field').each(function() {
if ($(this).val().length === 0) { empty = true; }
@@ -800,7 +800,7 @@ $(function() { // DOCUMENT READY
source: concepts.ttAdapter()
}).on('typeahead:cursorchanged', function() {
$('.tt-dropdown-menu').mCustomScrollbar("scrollTo", '.tt-cursor');
- }).on('typeahead:selected', onSelection).bind('focus', function() {
+ }).on('typeahead:selected', onSelection).on('focus', function() {
$('#search-field').typeahead('open');
}).after(clearButton).on('keypress', function() {
if ($typeahead.val().length > 0 && $(this).hasClass('clear-search-dark') === false) {
@@ -832,7 +832,7 @@ $(function() { // DOCUMENT READY
});
// Some form validation for the feedback form
- $("#send-feedback").click(function() {
+ $('#send-feedback').on('click', function() {
$('#email').removeClass('missing-value');
$('#message').removeClass('missing-value');
var emailMessageVal = $("#message").val();
@@ -850,7 +850,7 @@ $(function() { // DOCUMENT READY
});
// Initializes the waypoints plug-in used for the search listings.
- var $loading = $("" + loading_text + "…
");
+ var $loading = $("" + loading_text + "…
");
var $trigger = $('.search-result:nth-last-of-type(6)');
var options = { offset : '100%', continuous: false, triggerOnce: true };
var alpha_complete = false;
@@ -1076,7 +1076,7 @@ $(function() { // DOCUMENT READY
if ($('#alpha').hasClass('active') && $('#vocab-info').length === 1 && $('.alphabetical-search-results').length === 0) {
// taking into account the possibility that the lang parameter has been changed by the WebController.
var urlLangCorrected = vocab + '/' + lang + '/index?limit=250&offset=0&clang=' + clang;
- $('.sidebar-grey').empty().append(''+ loading_text + '
');
+ $('.sidebar-grey').empty().append(''+ loading_text + '
');
$.ajax({
url : urlLangCorrected,
success : function(data) {
@@ -1129,7 +1129,7 @@ $(function() { // DOCUMENT READY
source: concepts.ttAdapter()
}).on('typeahead:cursorchanged', function() {
$('.tt-dropdown-menu').mCustomScrollbar("scrollTo", '.tt-cursor');
- }).on('typeahead:selected', onSelection).bind('focus', function() {
+ }).on('typeahead:selected', onSelection).on('focus', function() {
$('#search-field').typeahead('open');
});
}
From 191b1121442eaf370ec3aa2af2173cffd837667b Mon Sep 17 00:00:00 2001
From: kouralex <1723419+kouralex@users.noreply.github.com>
Date: Thu, 4 Mar 2021 22:43:25 +0200
Subject: [PATCH 2/9] properly close html tag; mitigate jquery 3.x warning
---
resource/js/scripts.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resource/js/scripts.js b/resource/js/scripts.js
index 3a4357836..8f0e6187b 100644
--- a/resource/js/scripts.js
+++ b/resource/js/scripts.js
@@ -161,7 +161,7 @@ function setLangCookie(lang) {
}
function clearResultsAndAddSpinner() {
- var $loading = $("");
+ var $loading = $("");
$('.search-result-listing').empty().append($loading);
}
From 68e820caccf6f1a9a8a4692d48c86ef5fc600f04 Mon Sep 17 00:00:00 2001
From: kouralex <1723419+kouralex@users.noreply.github.com>
Date: Thu, 4 Mar 2021 23:00:37 +0200
Subject: [PATCH 3/9] mitigate validator.w3.org warnings
---
view/scripts.twig | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/view/scripts.twig b/view/scripts.twig
index 5bdc7c734..6d832e43b 100644
--- a/view/scripts.twig
+++ b/view/scripts.twig
@@ -1,4 +1,4 @@
-
{% endif %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{% for files in request.plugins.pluginsJS %}{% for file in files %}{% endfor %}{% endfor %}
-{% if request.plugins.callbacks %}{% endif %}
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% for files in request.plugins.pluginsJS %}{% for file in files %}{% endfor %}{% endfor %}
+{% if request.plugins.callbacks %}{% endif %}
+
From edb04ec21953e100a748f3b6753ed895ed9efc90 Mon Sep 17 00:00:00 2001
From: kouralex <1723419+kouralex@users.noreply.github.com>
Date: Thu, 4 Mar 2021 23:04:06 +0200
Subject: [PATCH 4/9] upgrade jquery to 3.5.x; addresses #1122
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index a498d3092..65ee830ca 100644
--- a/composer.json
+++ b/composer.json
@@ -54,7 +54,7 @@
}
},
"require": {
- "components/jquery": "2.2.*",
+ "components/jquery": "3.5.*",
"components/jqueryui": "1.12.*",
"components/handlebars.js": "v4.7.6",
"davidstutz/bootstrap-multiselect": "v0.9.13",
From f980a533e9db7b9efbb5ec85090ea43c44e3e6ec Mon Sep 17 00:00:00 2001
From: kouralex <1723419+kouralex@users.noreply.github.com>
Date: Thu, 4 Mar 2021 22:40:48 +0200
Subject: [PATCH 5/9] prepare code for jquery 3.x; replace deprecated features;
tags must be properly closed
---
resource/js/docready.js | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/resource/js/docready.js b/resource/js/docready.js
index 57ad600a5..8840ea1a7 100644
--- a/resource/js/docready.js
+++ b/resource/js/docready.js
@@ -1,6 +1,6 @@
$(function() { // DOCUMENT READY
- var spinner = ''+ loading_text + '
';
+ var spinner = ''+ loading_text + '
';
var searchString = ''; // stores the search field's value before autocomplete selection changes it
var selectedVocabs = [];
var vocabId;
@@ -14,7 +14,7 @@ $(function() { // DOCUMENT READY
shortenProperties();
// kills the autocomplete after a form submit so we won't have to wait for the ajax to complete.
- $('.navbar-form').submit(
+ $('.navbar-form').on('submit',
function() {
$('#search-field').typeahead('destroy');
$.ajaxQ.abortAll();
@@ -198,8 +198,8 @@ $(function() { // DOCUMENT READY
// ajaxing the concept count and the preflabel counts on the vocabulary front page
if ($('#vocab-info').length && $('#statistics').length) {
// adding the spinners
- $('#counts tr:nth-of-type(1)').after(' |
');
- $('#statistics tr:nth-of-type(1)').after(' |
');
+ $('#counts tr:nth-of-type(1)').after(' |
');
+ $('#statistics tr:nth-of-type(1)').after(' |
');
$.ajax({
url : rest_base_url + vocab + '/vocabularyStatistics',
req_kind: $.ajaxQ.requestKind.GLOBAL,
@@ -501,7 +501,7 @@ $(function() { // DOCUMENT READY
// Event handlers for the language selection links for setting the cookie
$('#language a').each( function(index, el) {
- $(el).click(function() {
+ $(el).on('click', function() {
var langCode = el.id.substr(el.id.indexOf("-") + 1);
setLangCookie(langCode);
});
@@ -579,7 +579,7 @@ $(function() { // DOCUMENT READY
createCookie('SKOSMOS_SEARCH_LANG', qlang, 365);
}
- $('.lang-button').click(function() {
+ $('.lang-button').on('click', function() {
qlang = $(this)[0].attributes.hreflang ? $(this)[0].attributes.hreflang.value : 'anything';
$('#lang-dropdown-toggle').html($(this).html() + ' ');
$('#lang-input').val(qlang);
@@ -587,7 +587,7 @@ $(function() { // DOCUMENT READY
if (concepts) { concepts.clear(); }
});
- $('.lang-button, .lang-button-all').click(function() {
+ $('.lang-button, .lang-button-all').on('click', function() {
$('#search-field').focus();
});
@@ -597,7 +597,7 @@ $(function() { // DOCUMENT READY
}
// disables the button with an empty search form
- $('#search-field').keyup(function() {
+ $('#search-field').on('keyup', function() {
var empty = false;
$('#search-field').each(function() {
if ($(this).val().length === 0) { empty = true; }
@@ -779,7 +779,7 @@ $(function() { // DOCUMENT READY
source: concepts.ttAdapter()
}).on('typeahead:cursorchanged', function() {
$('.tt-dropdown-menu').mCustomScrollbar("scrollTo", '.tt-cursor');
- }).on('typeahead:selected', onSelection).bind('focus', function() {
+ }).on('typeahead:selected', onSelection).on('focus', function() {
$('#search-field').typeahead('open');
}).after(clearButton).on('keypress', function() {
if ($typeahead.val().length > 0 && $(this).hasClass('clear-search-dark') === false) {
@@ -811,7 +811,8 @@ $(function() { // DOCUMENT READY
});
// Some form validation for the feedback form
- $("#send-feedback").click(function() {
+ $('#send-feedback').on('click', function() {
+ $('#email').removeClass('missing-value');
$('#message').removeClass('missing-value');
$('#msgsubject').removeClass('missing-value');
var emailMessageVal = $("#message").val();
@@ -829,7 +830,7 @@ $(function() { // DOCUMENT READY
});
// Initializes the waypoints plug-in used for the search listings.
- var $loading = $("" + loading_text + "…
");
+ var $loading = $("" + loading_text + "…
");
var $trigger = $('.search-result:nth-last-of-type(6)');
var options = { offset : '100%', continuous: false, triggerOnce: true };
var alpha_complete = false;
@@ -1060,7 +1061,7 @@ $(function() { // DOCUMENT READY
if ($('#alpha').hasClass('active') && $('#vocab-info').length === 1 && $('.alphabetical-search-results').length === 0) {
// taking into account the possibility that the lang parameter has been changed by the WebController.
var urlLangCorrected = vocab + '/' + lang + '/index?limit=250&offset=0&clang=' + clang;
- $('.sidebar-grey').empty().append(''+ loading_text + '
');
+ $('.sidebar-grey').empty().append(''+ loading_text + '
');
$.ajax({
url : urlLangCorrected,
req_kind: $.ajaxQ.requestKind.SIDEBAR,
@@ -1114,7 +1115,7 @@ $(function() { // DOCUMENT READY
source: concepts.ttAdapter()
}).on('typeahead:cursorchanged', function() {
$('.tt-dropdown-menu').mCustomScrollbar("scrollTo", '.tt-cursor');
- }).on('typeahead:selected', onSelection).bind('focus', function() {
+ }).on('typeahead:selected', onSelection).on('focus', function() {
$('#search-field').typeahead('open');
});
}
From d85d5b4019d794db5418837e43b7365f9057432f Mon Sep 17 00:00:00 2001
From: kouralex <1723419+kouralex@users.noreply.github.com>
Date: Thu, 4 Mar 2021 22:43:25 +0200
Subject: [PATCH 6/9] properly close html tag; mitigate jquery 3.x warning
---
resource/js/scripts.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resource/js/scripts.js b/resource/js/scripts.js
index d86c5d567..6ec85e381 100644
--- a/resource/js/scripts.js
+++ b/resource/js/scripts.js
@@ -185,7 +185,7 @@ function setLangCookie(lang) {
}
function clearResultsAndAddSpinner() {
- var $loading = $("");
+ var $loading = $("");
$('.search-result-listing').empty().append($loading);
}
From a8c9d91744476b496e2c18ef9f687e51da9a4744 Mon Sep 17 00:00:00 2001
From: kouralex <1723419+kouralex@users.noreply.github.com>
Date: Thu, 4 Mar 2021 23:00:37 +0200
Subject: [PATCH 7/9] mitigate validator.w3.org warnings
---
view/scripts.twig | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/view/scripts.twig b/view/scripts.twig
index 5bdc7c734..6d832e43b 100644
--- a/view/scripts.twig
+++ b/view/scripts.twig
@@ -1,4 +1,4 @@
-
{% endif %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{% for files in request.plugins.pluginsJS %}{% for file in files %}{% endfor %}{% endfor %}
-{% if request.plugins.callbacks %}{% endif %}
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% for files in request.plugins.pluginsJS %}{% for file in files %}{% endfor %}{% endfor %}
+{% if request.plugins.callbacks %}{% endif %}
+
From 82a7f215177218900220678b768362793bf04779 Mon Sep 17 00:00:00 2001
From: kouralex <1723419+kouralex@users.noreply.github.com>
Date: Thu, 4 Mar 2021 23:04:06 +0200
Subject: [PATCH 8/9] upgrade jquery to 3.5.x; addresses #1122
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index 2354c2830..36a1c2137 100644
--- a/composer.json
+++ b/composer.json
@@ -54,7 +54,7 @@
}
},
"require": {
- "components/jquery": "2.2.*",
+ "components/jquery": "3.5.*",
"components/jqueryui": "1.12.*",
"components/handlebars.js": "v4.7.6",
"davidstutz/bootstrap-multiselect": "v0.9.13",
From 1c02a272c5bdc06afc4edfdf51c43d983c9b9e67 Mon Sep 17 00:00:00 2001
From: kouralex <1723419+kouralex@users.noreply.github.com>
Date: Tue, 23 Mar 2021 22:19:54 +0200
Subject: [PATCH 9/9] fix blunder in rebase; separate jquery upgrade into
another branch/PR
---
composer.json | 2 +-
resource/js/docready.js | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/composer.json b/composer.json
index 36a1c2137..2354c2830 100644
--- a/composer.json
+++ b/composer.json
@@ -54,7 +54,7 @@
}
},
"require": {
- "components/jquery": "3.5.*",
+ "components/jquery": "2.2.*",
"components/jqueryui": "1.12.*",
"components/handlebars.js": "v4.7.6",
"davidstutz/bootstrap-multiselect": "v0.9.13",
diff --git a/resource/js/docready.js b/resource/js/docready.js
index 8840ea1a7..f899d4995 100644
--- a/resource/js/docready.js
+++ b/resource/js/docready.js
@@ -812,7 +812,6 @@ $(function() { // DOCUMENT READY
// Some form validation for the feedback form
$('#send-feedback').on('click', function() {
- $('#email').removeClass('missing-value');
$('#message').removeClass('missing-value');
$('#msgsubject').removeClass('missing-value');
var emailMessageVal = $("#message").val();