Use the native JSON.parse method instead of the jQuery variation

This commit is contained in:
Alex Tselegidis 2020-12-14 20:38:17 +02:00
parent 17e1f77a69
commit 8fb111190b
2 changed files with 5 additions and 5 deletions

View file

@ -181,7 +181,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
var successCallback = function () {
Backend.displayNotification(EALang.working_plan_exception_deleted);
var workingPlanExceptions = jQuery.parseJSON(provider.settings.working_plan_exceptions) || {};
var workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions) || {};
delete workingPlanExceptions[date];
for (var index in GlobalVariables.availableProviders) {
@ -1098,8 +1098,8 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
throw new Error('Provider was not found.');
}
var workingPlan = jQuery.parseJSON(provider.settings.working_plan);
var workingPlanExceptions = jQuery.parseJSON(provider.settings.working_plan_exceptions);
var workingPlan = JSON.parse(provider.settings.working_plan);
var workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions);
var unavailabilityEvent;
var viewStart;
var viewEnd;

View file

@ -157,7 +157,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
var successCallback = function () {
Backend.displayNotification(EALang.working_plan_exception_saved);
var workingPlanExceptions = jQuery.parseJSON(provider.settings.working_plan_exceptions) || {};
var workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions) || {};
workingPlanExceptions[date] = workingPlanException;
@ -259,7 +259,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
.done(function () {
$('#message-box').dialog('close');
var workingPlanExceptions = jQuery.parseJSON(lastFocusedEventData.data.settings.working_plan_exceptions);
var workingPlanExceptions = JSON.parse(lastFocusedEventData.data.settings.working_plan_exceptions);
delete workingPlanExceptions[lastFocusedEventData.start.format('YYYY-MM-DD')];
lastFocusedEventData.data.settings.working_plan_exceptions = JSON.stringify(workingPlanExceptions);