Fix jQuery 4 removed-API usage in app-base.js

jQuery 4 removed $.isFunction and $.holdReady. Replace the isFunction
checks with typeof and drop the holdReady calls (the redirect already
guards the page). Mirrors the master hotfix (#108) so this branch is
testable on jQuery 4.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-10 12:24:01 -04:00
parent 10abd36340
commit 08bef1bd00
+5 -6
View File
@@ -76,7 +76,7 @@ app.api = (function(app){
var baseURL = '/api/' var baseURL = '/api/'
function post(url, data, callback){ function post(url, data, callback){
if(!$.isFunction(callback)) callback = callback2; if(typeof callback !== 'function') callback = callback2;
return $.ajax({ return $.ajax({
type: 'POST', type: 'POST',
url: baseURL+url, url: baseURL+url,
@@ -97,7 +97,7 @@ app.api = (function(app){
} }
function put(url, data, callback){ function put(url, data, callback){
if(!$.isFunction(callback)) callback = callback2; if(typeof callback !== 'function') callback = callback2;
return $.ajax({ return $.ajax({
type: 'PUT', type: 'PUT',
url: baseURL+url, url: baseURL+url,
@@ -118,7 +118,7 @@ app.api = (function(app){
} }
function remove(url, callback, callback2){ function remove(url, callback, callback2){
if(!$.isFunction(callback)) callback = callback2; if(typeof callback !== 'function') callback = callback2;
return $.ajax({ return $.ajax({
type: 'delete', type: 'delete',
url: baseURL+url, url: baseURL+url,
@@ -237,13 +237,12 @@ app.auth = (function(app){
} }
function forceLogin(){ function forceLogin(){
$.holdReady(true); // jQuery 4 removed $.holdReady; rely on the redirect below to keep an
// unauthenticated user off the page instead of pausing document ready.
app.auth.isLoggedIn(function(error, isLoggedIn){ app.auth.isLoggedIn(function(error, isLoggedIn){
if(error || !isLoggedIn){ if(error || !isLoggedIn){
app.auth.logOut(function(){}) app.auth.logOut(function(){})
location.replace(`/login${location.href.replace(location.origin, '')}`); location.replace(`/login${location.href.replace(location.origin, '')}`);
}else{
$.holdReady(false);
} }
}); });
} }