Skip to content

Commit 24da355

Browse files
committed
Merge branch 'release/1.10.49.1'
2 parents 9014757 + 1da5c38 commit 24da355

File tree

8 files changed

+84
-26
lines changed

8 files changed

+84
-26
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v1.10.49.1
2+
## 09/03/2025
3+
4+
1. [](#bugfix)
5+
* Fixed several JS issues with Notifications and Scheduler
6+
17
# v1.10.49
28
## 08/25/2025
39

blueprints.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Admin Panel
22
slug: admin
33
type: plugin
4-
version: 1.10.49
4+
version: 1.10.49.1
55
description: Adds an advanced administration panel to manage your site
66
icon: empire
77
author:

themes/grav/app/forms/state.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,15 @@ const DOMBehaviors = {
1313

1414
preventUnload() {
1515
let selector = '[name="task"][value^="save"], [data-delete-action], [data-flex-safe-action]';
16-
if ($._data(window, 'events') && ($._data(window, 'events').beforeunload || []).filter((event) => event.namespace === '_grav').length) {
17-
return;
16+
// jQuery 3.x removed $._data, use $._data only if available (jQuery < 3.0)
17+
// or check with jQuery's internal data store for jQuery >= 3.0
18+
try {
19+
const hasData = typeof $._data === 'function';
20+
if (hasData && $._data(window, 'events') && ($._data(window, 'events').beforeunload || []).filter((event) => event.namespace === '_grav').length) {
21+
return;
22+
}
23+
} catch (e) {
24+
// $._data not available in jQuery 3.x+, continue with adding event handler
1825
}
1926

2027
// Allow some elements to leave the page without native confirmation
@@ -33,8 +40,15 @@ const DOMBehaviors = {
3340
preventClickAway() {
3441
let selector = 'a[href]:not([href^="#"]):not([target="_blank"]):not([href^="javascript:"])';
3542

36-
if ($._data($(selector).get(0), 'events') && ($._data($(selector).get(0), 'events').click || []).filter((event) => event.namespace === '_grav')) {
37-
return;
43+
// jQuery 3.x removed $._data, use $._data only if available (jQuery < 3.0)
44+
try {
45+
const hasData = typeof $._data === 'function';
46+
const element = $(selector).get(0);
47+
if (element && hasData && $._data(element, 'events') && ($._data(element, 'events').click || []).filter((event) => event.namespace === '_grav')) {
48+
return;
49+
}
50+
} catch (e) {
51+
// $._data not available in jQuery 3.x+, continue with adding event handler
3852
}
3953

4054
// Prevent clicking away if the form state is dirty

themes/grav/app/updates/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default class Updates {
9999
if (!this.payload.resources.total) { return this; }
100100

101101
[plugins, themes].forEach(function(resources, index) {
102-
if (!resources || Array.isArray(resources)) { return; }
102+
if (!resources || Array.isArray(resources) || typeof resources !== 'object') { return; }
103103
let length = Object.keys(resources).length;
104104
let type = map[index];
105105

themes/grav/app/updates/update.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@ import { Instance as Update } from './index';
77
// Dashboard update and Grav update
88
$(document).on('click.remodal', '[data-remodal-id="update-grav"] [data-remodal-action="confirm"]', () => {
99
const element = $('#grav-update-button');
10-
element.html(`${translations.PLUGIN_ADMIN.UPDATING_PLEASE_WAIT} ${formatBytes(Update.payload.grav.assets['grav-update'].size)}..`);
10+
11+
// Safely get the file size with fallback
12+
let sizeText = '';
13+
if (Update.payload &&
14+
Update.payload.grav &&
15+
Update.payload.grav.assets &&
16+
Update.payload.grav.assets['grav-update'] &&
17+
Update.payload.grav.assets['grav-update'].size) {
18+
sizeText = ` ${formatBytes(Update.payload.grav.assets['grav-update'].size)}`;
19+
}
20+
21+
element.html(`${translations.PLUGIN_ADMIN.UPDATING_PLEASE_WAIT}${sizeText}..`);
1122

1223
element.attr('disabled', 'disabled').find('> .fa').removeClass('fa-cloud-download').addClass('fa-refresh fa-spin');
1324

themes/grav/app/utils/request.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ let request = function(url, options = {}, callback = () => true) {
1212
let data = new FormData();
1313

1414
options.body = Object.assign({ 'admin-nonce': config.admin_nonce }, options.body || {});
15-
Object.keys(options.body).map((key) => data.append(key, options.body[key]));
15+
if (options.body && typeof options.body === 'object') {
16+
Object.keys(options.body).map((key) => data.append(key, options.body[key]));
17+
}
1618
options.body = data;
1719
}
1820

themes/grav/app/utils/response.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function userFeedback(response) {
7373
break;
7474
}
7575

76-
if (settings) {
76+
if (settings && typeof settings === 'object' && settings !== null) {
7777
backup = Object.assign({}, toastr.options);
7878
Object.keys(settings).forEach((key) => { toastr.options[key] = settings[key]; });
7979
}

themes/grav/js/admin.min.js

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ const external_GravAdmin_namespaceObject = GravAdmin;
704704
var trim = __webpack_require__(35814);
705705
var trim_default = /*#__PURE__*/__webpack_require__.n(trim);
706706
;// CONCATENATED MODULE: ./app/utils/response.js
707+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
707708

708709

709710

@@ -770,7 +771,7 @@ function userFeedback(response) {
770771
message = message || 'Invalid AJAX response.';
771772
break;
772773
}
773-
if (settings) {
774+
if (settings && _typeof(settings) === 'object' && settings !== null) {
774775
backup = Object.assign({}, utils_toastr.options);
775776
Object.keys(settings).forEach(function (key) {
776777
utils_toastr.options[key] = settings[key];
@@ -796,6 +797,7 @@ external_jQuery_default()(__webpack_require__.g).on('beforeunload._ajax', functi
796797
UNLOADING = true;
797798
});
798799
;// CONCATENATED MODULE: ./app/utils/request.js
800+
function request_typeof(o) { "@babel/helpers - typeof"; return request_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, request_typeof(o); }
799801

800802

801803
var raw;
@@ -813,9 +815,11 @@ var request = function request(url) {
813815
options.body = Object.assign({
814816
'admin-nonce': external_GravAdmin_namespaceObject.config.admin_nonce
815817
}, options.body || {});
816-
Object.keys(options.body).map(function (key) {
817-
return data.append(key, options.body[key]);
818-
});
818+
if (options.body && request_typeof(options.body) === 'object') {
819+
Object.keys(options.body).map(function (key) {
820+
return data.append(key, options.body[key]);
821+
});
822+
}
819823
options.body = data;
820824
}
821825
options = Object.assign({
@@ -833,12 +837,12 @@ var request = function request(url) {
833837
};
834838
/* harmony default export */ const utils_request = (request);
835839
;// CONCATENATED MODULE: ./app/forms/fields/files.js
836-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
840+
function files_typeof(o) { "@babel/helpers - typeof"; return files_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, files_typeof(o); }
837841
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
838842
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
839843
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
840-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
841-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
844+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == files_typeof(i) ? i : i + ""; }
845+
function _toPrimitive(t, r) { if ("object" != files_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != files_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
842846

843847

844848
// import EXIF from 'exif-js';
@@ -1692,7 +1696,13 @@ function formatBytes(bytes, decimals) {
16921696
// Dashboard update and Grav update
16931697
external_jQuery_default()(document).on('click.remodal', '[data-remodal-id="update-grav"] [data-remodal-action="confirm"]', function () {
16941698
var element = external_jQuery_default()('#grav-update-button');
1695-
element.html("".concat(external_GravAdmin_namespaceObject.translations.PLUGIN_ADMIN.UPDATING_PLEASE_WAIT, " ").concat(formatBytes(updates_Instance.payload.grav.assets['grav-update'].size), ".."));
1699+
1700+
// Safely get the file size with fallback
1701+
var sizeText = '';
1702+
if (updates_Instance.payload && updates_Instance.payload.grav && updates_Instance.payload.grav.assets && updates_Instance.payload.grav.assets['grav-update'] && updates_Instance.payload.grav.assets['grav-update'].size) {
1703+
sizeText = " ".concat(formatBytes(updates_Instance.payload.grav.assets['grav-update'].size));
1704+
}
1705+
element.html("".concat(external_GravAdmin_namespaceObject.translations.PLUGIN_ADMIN.UPDATING_PLEASE_WAIT).concat(sizeText, ".."));
16961706
element.attr('disabled', 'disabled').find('> .fa').removeClass('fa-cloud-download').addClass('fa-refresh fa-spin');
16971707
utils_request(updates_Instance.updateURL, function (response) {
16981708
if (response.type === 'updategrav') {
@@ -1824,7 +1834,7 @@ var Updates = /*#__PURE__*/function () {
18241834
return this;
18251835
}
18261836
[plugins, themes].forEach(function (resources, index) {
1827-
if (!resources || Array.isArray(resources)) {
1837+
if (!resources || Array.isArray(resources) || updates_typeof(resources) !== 'object') {
18281838
return;
18291839
}
18301840
var length = Object.keys(resources).length;
@@ -4225,10 +4235,17 @@ var DOMBehaviors = {
42254235
},
42264236
preventUnload: function preventUnload() {
42274237
var selector = '[name="task"][value^="save"], [data-delete-action], [data-flex-safe-action]';
4228-
if (external_jQuery_default()._data(window, 'events') && (external_jQuery_default()._data(window, 'events').beforeunload || []).filter(function (event) {
4229-
return event.namespace === '_grav';
4230-
}).length) {
4231-
return;
4238+
// jQuery 3.x removed $._data, use $._data only if available (jQuery < 3.0)
4239+
// or check with jQuery's internal data store for jQuery >= 3.0
4240+
try {
4241+
var hasData = typeof (external_jQuery_default())._data === 'function';
4242+
if (hasData && external_jQuery_default()._data(window, 'events') && (external_jQuery_default()._data(window, 'events').beforeunload || []).filter(function (event) {
4243+
return event.namespace === '_grav';
4244+
}).length) {
4245+
return;
4246+
}
4247+
} catch (e) {
4248+
// $._data not available in jQuery 3.x+, continue with adding event handler
42324249
}
42334250

42344251
// Allow some elements to leave the page without native confirmation
@@ -4245,10 +4262,18 @@ var DOMBehaviors = {
42454262
},
42464263
preventClickAway: function preventClickAway() {
42474264
var selector = 'a[href]:not([href^="#"]):not([target="_blank"]):not([href^="javascript:"])';
4248-
if (external_jQuery_default()._data(external_jQuery_default()(selector).get(0), 'events') && (external_jQuery_default()._data(external_jQuery_default()(selector).get(0), 'events').click || []).filter(function (event) {
4249-
return event.namespace === '_grav';
4250-
})) {
4251-
return;
4265+
4266+
// jQuery 3.x removed $._data, use $._data only if available (jQuery < 3.0)
4267+
try {
4268+
var hasData = typeof (external_jQuery_default())._data === 'function';
4269+
var element = external_jQuery_default()(selector).get(0);
4270+
if (element && hasData && external_jQuery_default()._data(element, 'events') && (external_jQuery_default()._data(element, 'events').click || []).filter(function (event) {
4271+
return event.namespace === '_grav';
4272+
})) {
4273+
return;
4274+
}
4275+
} catch (e) {
4276+
// $._data not available in jQuery 3.x+, continue with adding event handler
42524277
}
42534278

42544279
// Prevent clicking away if the form state is dirty

0 commit comments

Comments
 (0)