From 6821e517db405b69368c5ac1591e511403925367 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Sun, 17 Nov 2019 20:05:51 +0100 Subject: [PATCH] Update js files to be compatible with jQuery3 --- colleges/static/colleges/colleges.js | 2 +- ontology/templates/ontology/_topic_card.html | 4 ++-- scipost/static/scipost/assets/js/newsticker.js | 1 - scipost/static/scipost/assets/js/scripts.js | 2 +- .../static/scipost/{formset.js => formset.js_deprec20191117} | 0 scipost/static/scipost/report-compile.js | 2 +- scipost/static/scipost/slugify-name.js | 2 +- scipost/static/scipost/table-row-blank.js | 2 +- scipost/templates/scipost/bare_base.html | 2 +- 9 files changed, 8 insertions(+), 9 deletions(-) rename scipost/static/scipost/{formset.js => formset.js_deprec20191117} (100%) diff --git a/colleges/static/colleges/colleges.js b/colleges/static/colleges/colleges.js index 34cb85d6e..8dc9da577 100644 --- a/colleges/static/colleges/colleges.js +++ b/colleges/static/colleges/colleges.js @@ -29,7 +29,7 @@ $(function() { }) .on('click', function() { // Remove hover-class - $(this) + $(this) .toggleClass('active-search') .trigger('search-specialization'); }) diff --git a/ontology/templates/ontology/_topic_card.html b/ontology/templates/ontology/_topic_card.html index 360a46aeb..6237bd592 100644 --- a/ontology/templates/ontology/_topic_card.html +++ b/ontology/templates/ontology/_topic_card.html @@ -4,11 +4,11 @@ <script type="text/javascript" nonce="{{ request.csp_nonce }}"> $(document).ready(function() { - $("#id_A_text").keyup(function() { + $("#id_A_text").on("keyup", function() { $("#id_B_text").val("{{ topic }}"); $("#id_B").val({{ topic.id }}); }); - $("#id_B_text").keyup(function() { + $("#id_B_text").on("keyup", function() { $("#id_A_text").val("{{ topic }}"); $("#id_A").val({{ topic.id }}); }); diff --git a/scipost/static/scipost/assets/js/newsticker.js b/scipost/static/scipost/assets/js/newsticker.js index 882691fab..dd88b78ea 100644 --- a/scipost/static/scipost/assets/js/newsticker.js +++ b/scipost/static/scipost/assets/js/newsticker.js @@ -70,7 +70,6 @@ NewsTicker = (function() { // Extend jQuery $.fn.scipost_newsticker = function(options) { var ticker = new NewsTicker(this, options) - console.log('SciPost NewTicker') return this; } diff --git a/scipost/static/scipost/assets/js/scripts.js b/scipost/static/scipost/assets/js/scripts.js index e8ecb3b02..cbe040ed7 100644 --- a/scipost/static/scipost/assets/js/scripts.js +++ b/scipost/static/scipost/assets/js/scripts.js @@ -78,7 +78,7 @@ function init_page() { // Auto-submit hook for general form elements $("form .auto-submit input, form.auto-submit input, form.auto-submit select").on('change', function(){ - $(this).parents('form').submit() + $(this).parents('form').trigger('submit') }); // Start general toggle diff --git a/scipost/static/scipost/formset.js b/scipost/static/scipost/formset.js_deprec20191117 similarity index 100% rename from scipost/static/scipost/formset.js rename to scipost/static/scipost/formset.js_deprec20191117 diff --git a/scipost/static/scipost/report-compile.js b/scipost/static/scipost/report-compile.js index 3984ee3a3..0639a08f8 100644 --- a/scipost/static/scipost/report-compile.js +++ b/scipost/static/scipost/report-compile.js @@ -11,7 +11,7 @@ jQuery.fn.selectText = function(){ if (doc.body.createTextRange) { var range = document.body.createTextRange(); range.moveToElementText(element); - range.select(); + range.trigger('select'); } else if (window.getSelection) { var selection = window.getSelection(); var range = document.createRange(); diff --git a/scipost/static/scipost/slugify-name.js b/scipost/static/scipost/slugify-name.js index 21abef48e..b8f9eb350 100644 --- a/scipost/static/scipost/slugify-name.js +++ b/scipost/static/scipost/slugify-name.js @@ -1,5 +1,5 @@ $(document).ready(function() { - $("#id_name").keyup(function() { + $("#id_name").on("keyup", function() { slug_value = this.value.split(" ").join("_"); $("#id_slug").val(slug_value); }); diff --git a/scipost/static/scipost/table-row-blank.js b/scipost/static/scipost/table-row-blank.js index 75db4444a..b109ed3ae 100644 --- a/scipost/static/scipost/table-row-blank.js +++ b/scipost/static/scipost/table-row-blank.js @@ -1,5 +1,5 @@ $(document).ready(function($) { - $(".table-row").click(function() { + $(".table-row").on("click", function() { var addr = $(this).data("href"); window.open(addr, "_blank"); }); diff --git a/scipost/templates/scipost/bare_base.html b/scipost/templates/scipost/bare_base.html index ca203b0e3..b04d5e0a3 100644 --- a/scipost/templates/scipost/bare_base.html +++ b/scipost/templates/scipost/bare_base.html @@ -9,7 +9,7 @@ <link href="https://fonts.googleapis.com/css?family=Merriweather+Sans:300,400,700" rel="stylesheet"> <link rel="stylesheet" type="text/css" href="{% static 'scipost/SciPost.css' %}" /> <link rel="stylesheet" type="text/css" href="{% static 'fa/css/font-awesome.min.css' %}" /> - <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://code.jquery.com/jquery-migrate-3.1.0.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> -- GitLab