From 77adda5c90338225b359cb874a4b9057cf5f18d2 Mon Sep 17 00:00:00 2001
From: Emmanuel Viennet <emmanuel.viennet@gmail.com>
Date: Sun, 28 Jul 2024 19:15:51 +0200
Subject: [PATCH] Upgrade jQuery to 3.7.1. (#943)

---
 app/scodoc/html_sco_header.py | 24 +++++++++++++-----------
 app/static/jQuery/jquery.js   |  2 +-
 app/static/libjs/menu.js      | 11 ++++++-----
 app/templates/babase.j2       |  2 +-
 sco_version.py                |  2 +-
 5 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/app/scodoc/html_sco_header.py b/app/scodoc/html_sco_header.py
index 7a0f4441a..77149ca6a 100644
--- a/app/scodoc/html_sco_header.py
+++ b/app/scodoc/html_sco_header.py
@@ -97,19 +97,10 @@ _HTML_BEGIN = f"""<!DOCTYPE html>
 <link href="{scu.STATIC_DIR}/css/gt_table.css" rel="stylesheet" type="text/css" />
 <script src="{scu.STATIC_DIR}/libjs/menu.js"></script>
 <script src="{scu.STATIC_DIR}/libjs/bubble.js"></script>
-<script>
- window.onload=function(){{
-     if (document.getElementById('gtrcontent')) {{
-        enableTooltips("gtrcontent");
-     }}
-     if (document.getElementById('sidebar')) {{
-        enableTooltips("sidebar");
-     }}
- }};
-</script>
+
 
 <script src="{scu.STATIC_DIR}/jQuery/jquery.js"></script>
-<script src="{scu.STATIC_DIR}/jQuery/jquery-migrate-1.2.0.min.js"></script>
+<script src="{scu.STATIC_DIR}/jQuery/jquery-migrate-3.5.2.min.js"></script>
 <script src="{scu.STATIC_DIR}/libjs/jquery.field.min.js"></script>
 
 <script src="{scu.STATIC_DIR}/libjs/jquery-ui-1.10.4.custom/js/jquery-ui-1.10.4.custom.min.js"></script>
@@ -126,6 +117,17 @@ _HTML_BEGIN = f"""<!DOCTYPE html>
 
 <script src="{scu.STATIC_DIR}/libjs/qtip/jquery.qtip-3.0.3.min.js"></script>
 <link type="text/css" rel="stylesheet" href="{scu.STATIC_DIR}/libjs/qtip/jquery.qtip-3.0.3.min.css" />
+
+<script>
+document.addEventListener('DOMContentLoaded', function() {{
+    if (document.getElementById('gtrcontent')) {{
+        enableTooltips("gtrcontent");
+    }}
+    if (document.getElementById('sidebar')) {{
+        enableTooltips("sidebar");
+    }}
+}});
+</script>
 """
 
 
diff --git a/app/static/jQuery/jquery.js b/app/static/jQuery/jquery.js
index 504903595..4f54328df 120000
--- a/app/static/jQuery/jquery.js
+++ b/app/static/jQuery/jquery.js
@@ -1 +1 @@
-jquery-1.12.4.min.js
\ No newline at end of file
+jquery-3.7.1.min.js
\ No newline at end of file
diff --git a/app/static/libjs/menu.js b/app/static/libjs/menu.js
index 07ca8bf44..dd9abf01b 100644
--- a/app/static/libjs/menu.js
+++ b/app/static/libjs/menu.js
@@ -1,12 +1,13 @@
 /* -*- mode: javascript -*-
+ * Legacy code used by old group editor. To be removed.
  */
 
 function getMouseXY(e) // works on IE6,FF,Moz,Opera7
-{ 
+{
   if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)
 
   if (e)
-  { 
+  {
     if (e.pageY)
     { // this doesn't work on IE6!! (works on FF,Moz,Opera7)
       mousey = e.pageY;
@@ -15,11 +16,11 @@ function getMouseXY(e) // works on IE6,FF,Moz,Opera7
     }
     else if (e.clientY)
     { // works on IE6,FF,Moz,Opera7
-if ( document.documentElement && document.documentElement.scrollTop )	
+if ( document.documentElement && document.documentElement.scrollTop )
 	{
       mousey = e.clientY + document.documentElement.scrollTop;
 	}
-	
+
 	else
 	{
       mousey = e.clientY + document.body.scrollTop;
@@ -53,7 +54,7 @@ function MenuDisplay(l_element)
 		l_element.childNodes[1].style.top = - l_element.childNodes[1].offsetHeight + 'px' ;
 		}
 	}
-	
+
 function MenuHide(l_element)
 	{
 	if ( ! menu_firefox_flicker )
diff --git a/app/templates/babase.j2 b/app/templates/babase.j2
index 690a460a8..2dc3aa89a 100644
--- a/app/templates/babase.j2
+++ b/app/templates/babase.j2
@@ -25,7 +25,7 @@
 
     {% block scripts %}
     <script src="{{scu.STATIC_DIR}}/jQuery/jquery.js"></script>
-    <script src="{{scu.STATIC_DIR}}/jQuery/jquery-migrate-1.2.0.min.js"></script>
+    <script src="{{scu.STATIC_DIR}}/jQuery/jquery-migrate-3.5.2.min.js"></script>
     <script src="{{scu.STATIC_DIR}}/libjs/jquery.field.min.js"></script>
     <script src="{{scu.STATIC_DIR}}/libjs/jquery-ui-1.10.4.custom/js/jquery-ui-1.10.4.custom.min.js"></script>
     <script src="{{scu.STATIC_DIR}}/libjs/bootstrap/js/bootstrap.min.js"></script>
diff --git a/sco_version.py b/sco_version.py
index 722425811..c05bb3986 100644
--- a/sco_version.py
+++ b/sco_version.py
@@ -1,7 +1,7 @@
 # -*- mode: python -*-
 # -*- coding: utf-8 -*-
 
-SCOVERSION = "9.7.R"
+SCOVERSION = "9.7.R000"
 
 SCONAME = "ScoDoc"
 
-- 
GitLab