Skip to content

Commit 967a179

Browse files
committed
Update VanillePlugin.js
1 parent 1599bd1 commit 967a179

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

VanillePlugin.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -686,10 +686,10 @@
686686
};
687687

688688
const strings = self.getString();
689-
const message = args.message || strings.confirm || '';
690-
const title = strings.confirmation || 'confirmation';
691-
const yes = strings.yes || 'yes';
692-
const cancel = strings.cancel || 'cancel';
689+
const message = args.message || strings?.confirm || '';
690+
const title = strings?.confirmation || 'confirmation';
691+
const yes = strings?.yes || 'yes';
692+
const cancel = strings?.cancel || 'cancel';
693693

694694
$.confirm({
695695
title: title,
@@ -940,10 +940,10 @@
940940
error: function (error) {
941941

942942
const strings = self.getString('activation');
943-
const title = strings.error || 'activation';
943+
const title = strings?.error || 'activation';
944944

945945
const globalStrings = self.getString('global');
946-
const message = globalStrings.error || 'error';
946+
const message = globalStrings?.error || 'error';
947947

948948
self.popupMore(title, message, 'error');
949949

@@ -976,7 +976,7 @@
976976
if (!files.length) {
977977
self.unloading(form);
978978
const strings = self.getString('upload');
979-
const message = strings.error || 'error';
979+
const message = strings?.error || 'error';
980980
self.notify(message, 'warning');
981981
return;
982982
}
@@ -1430,7 +1430,7 @@
14301430

14311431
// Check file size
14321432
if (file.size > args.size) {
1433-
self.notify(strings.size, 'warning', 0);
1433+
self.notify(strings?.size, 'warning', 0);
14341434
input.val('');
14351435
return;
14361436
}
@@ -1456,9 +1456,9 @@
14561456
// Set content
14571457
parent.addClass('uploaded');
14581458
if (span.length) {
1459-
span.text(strings.added);
1459+
span.text(strings?.added);
14601460
} else {
1461-
label.appendChild(`<span>${strings.added}</span>`)
1461+
label.appendChild(`<span>${strings?.added}</span>`)
14621462
}
14631463

14641464
if (icon.length) {
@@ -1814,10 +1814,10 @@
18141814

18151815
const strings = self.getString('cookie');
18161816
const more = self.getString('more');
1817-
const title = strings.title || 'title';
1818-
const message = strings.message || 'message';
1819-
const accept = strings.accept || 'accept';
1820-
const decline = strings.decline || 'decline';
1817+
const title = strings?.title || 'title';
1818+
const message = strings?.message || 'message';
1819+
const accept = strings?.accept || 'accept';
1820+
const decline = strings?.decline || 'decline';
18211821

18221822
let link = self.getLinking('privacy');
18231823
link = self.getBaseUrl(link, true);
@@ -2008,7 +2008,7 @@
20082008

20092009
// getString
20102010
VanillePlugin.getString = function (item) {
2011-
const strings = plugin.strings;
2011+
const strings = plugin.strings || {};
20122012
if (item !== undefined) {
20132013
return strings[item] ?? null;
20142014
}

0 commit comments

Comments
 (0)