forked from a64f7bb4-7358-4778-9fbe-3b882c34cc1d/v1
42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
/**
|
|
* DO NOT EDIT THIS FILE.
|
|
* See the following change record for more information,
|
|
* https://www.drupal.org/node/2815083
|
|
* @preserve
|
|
**/
|
|
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
|
|
(function (Drupal) {
|
|
Drupal.behaviors.flagAttach = {
|
|
attach: function attach(context) {
|
|
var links = [].concat(_toConsumableArray(context.querySelectorAll('.flag a')));
|
|
links.forEach(function (link) {
|
|
return link.addEventListener('click', function (event) {
|
|
return event.target.parentNode.classList.add('flag-waiting');
|
|
});
|
|
});
|
|
}
|
|
};
|
|
|
|
Drupal.AjaxCommands.prototype.actionLinkFlash = function (ajax, response, status) {
|
|
if (status === 'success') {
|
|
if (response.message.length) {
|
|
var para = document.createElement('P');
|
|
para.innerText = response.message;
|
|
|
|
para.setAttribute('class', 'js-flag-message');
|
|
|
|
para.addEventListener('animationend', function (event) {
|
|
return event.target.remove();
|
|
}, false);
|
|
|
|
document.querySelector(response.selector).appendChild(para);
|
|
}
|
|
} else {
|
|
var links = [].concat(_toConsumableArray(document.querySelectAll('.flag-waiting')));
|
|
links.forEach(function (link) {
|
|
return link.classList.remove('flag-waiting');
|
|
});
|
|
}
|
|
};
|
|
})(Drupal); |