mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-71963 js: Address lint issues in integration
This commit is contained in:
parent
89457e9acb
commit
0310b76642
2
lib/amd/build/confirm.min.js
vendored
2
lib/amd/build/confirm.min.js
vendored
@ -1,2 +1,2 @@
|
||||
function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}define ("core/confirm",["core/notification","core/str","core/toast"],function(a,b,c){"use strict";b=e(b);function d(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;d=function(){return a};return a}function e(a){if(a&&a.__esModule){return a}if(null===a||"object"!==_typeof(a)&&"function"!=typeof a){return{default:a}}var b=d();if(b&&b.has(a)){return b.get(a)}var c={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a){if(Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;if(g&&(g.get||g.set)){Object.defineProperty(c,f,g)}else{c[f]=a[f]}}}c.default=a;if(b){b.set(a,c)}return c}var f=!1,g=function(b,c,d){return new Promise(function(e,f){(0,a.saveCancel)(b,c,d,e,f)})},h=function(a,c){if(a["confirmation".concat(c,"Str")]){return b.get_string.apply(null,JSON.parse(a["confirmation".concat(c,"Str")]))}return a["confirmation".concat(c)]},i=function(){document.addEventListener("click",function(b){var d=b.target.closest("[data-confirmation=\"modal\"]");if(d){b.preventDefault();g(h(d.dataset,"Title"),h(d.dataset,"Question"),h(d.dataset,"YesButton")).then(function(){if("true"===d.dataset.confirmationToast){var b=h(d.dataset,"ToastConfirmation");if("string"==typeof b){(0,c.add)(b)}else{b.then(function(a){return(0,c.add)(a)}).catch(function(b){return(0,a.exception)(b)})}}window.location.href=d.dataset.confirmationDestination}).catch(function(){})}})};if(!f){i();f=!0}});
|
||||
function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}define ("core/confirm",["core/notification","core/str","core/toast"],function(a,b,c){"use strict";b=e(b);function d(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;d=function(){return a};return a}function e(a){if(a&&a.__esModule){return a}if(null===a||"object"!==_typeof(a)&&"function"!=typeof a){return{default:a}}var b=d();if(b&&b.has(a)){return b.get(a)}var c={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a){if(Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;if(g&&(g.get||g.set)){Object.defineProperty(c,f,g)}else{c[f]=a[f]}}}c.default=a;if(b){b.set(a,c)}return c}var f=!1,g=function(b,c,d){return new Promise(function(e,f){(0,a.saveCancel)(b,c,d,e,f)})},h=function(a,c){if(a["confirmation".concat(c,"Str")]){return b.get_string.apply(null,JSON.parse(a["confirmation".concat(c,"Str")]))}return Promise.resolve(a["confirmation".concat(c)])},i=function(){document.addEventListener("click",function(b){var d=b.target.closest("[data-confirmation=\"modal\"]");if(d){b.preventDefault();g(h(d.dataset,"Title"),h(d.dataset,"Question"),h(d.dataset,"YesButton")).then(function(){if("true"===d.dataset.confirmationToast){var b=h(d.dataset,"ToastConfirmation");if("string"==typeof b){(0,c.add)(b)}else{b.then(function(a){return(0,c.add)(a)}).catch(function(b){return(0,a.exception)(b)})}}window.location.href=d.dataset.confirmationDestination}).catch(function(){})}})};if(!f){i();f=!0}});
|
||||
//# sourceMappingURL=confirm.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
@ -70,14 +70,14 @@ const confirmedPromise = (title, question, saveLabel) => new Promise((resolve, r
|
||||
* @private
|
||||
* @param {HTMLElement} dataset The page element to fetch dataset items in
|
||||
* @param {String} field The dataset field name to fetch the contents of
|
||||
* @return {Promise|String}
|
||||
* @return {Promise}
|
||||
*
|
||||
*/
|
||||
const getConfirmationString = (dataset, field) => {
|
||||
if (dataset[`confirmation${field}Str`]) {
|
||||
return Str.get_string.apply(null, JSON.parse(dataset[`confirmation${field}Str`]));
|
||||
}
|
||||
return dataset[`confirmation${field}`];
|
||||
return Promise.resolve(dataset[`confirmation${field}`]);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -97,7 +97,7 @@ const registerConfirmationListeners = () => {
|
||||
getConfirmationString(confirmRequest.dataset, 'YesButton'),
|
||||
)
|
||||
.then(() => {
|
||||
if (confirmRequest.dataset[`confirmationToast`] === 'true') {
|
||||
if (confirmRequest.dataset.confirmationToast === 'true') {
|
||||
const stringForToast = getConfirmationString(confirmRequest.dataset, 'ToastConfirmation');
|
||||
if (typeof stringForToast === "string") {
|
||||
addToast(stringForToast);
|
||||
@ -107,7 +107,9 @@ const registerConfirmationListeners = () => {
|
||||
}
|
||||
window.location.href = confirmRequest.dataset.confirmationDestination;
|
||||
return;
|
||||
}).catch(() => {}); // Catch an empty function as the user cancelled rather than an actual error.
|
||||
}).catch(() => {
|
||||
return;
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user