Skip to content

Commit 0959048

Browse files
authored
Merge pull request #7671 from TDT-AG/pr/20250307-luci-base
luci-base: revert timeout function argument for addNotification
2 parents 1c4b8dc + 3f832f2 commit 0959048

File tree

1 file changed

+2
-28
lines changed
  • modules/luci-base/htdocs/luci-static/resources

1 file changed

+2
-28
lines changed

modules/luci-base/htdocs/luci-static/resources/ui.js

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3848,19 +3848,14 @@ const UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
38483848
* to the `dom.content()` function - refer to its documentation for
38493849
* applicable values.
38503850
*
3851-
* @param {int} [timeout]
3852-
* A millisecond value after which the notification will disappear
3853-
* automatically. If omitted, the notification will remain until it receives
3854-
* the click event.
3855-
*
38563851
* @param {...string} [classes]
38573852
* A number of extra CSS class names which are set on the notification
38583853
* banner element.
38593854
*
38603855
* @returns {Node}
38613856
* Returns a DOM Node representing the notification banner element.
38623857
*/
3863-
addNotification(title, children, timeout, ...classes) {
3858+
addNotification(title, children, ...classes) {
38643859
const mc = document.querySelector('#maincontent') ?? document.body;
38653860
const msg = E('div', {
38663861
'class': 'alert-message fade-in',
@@ -3877,7 +3872,7 @@ const UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
38773872
'class': 'btn',
38783873
'style': 'margin-left:auto; margin-top:auto',
38793874
'click': function(ev) {
3880-
fadeOutNotification(ev.target);
3875+
dom.parent(ev.target, '.alert-message').classList.add('fade-out');
38813876
},
38823877

38833878
}, [ _('Dismiss') ])
@@ -3893,27 +3888,6 @@ const UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
38933888

38943889
mc.insertBefore(msg, mc.firstElementChild);
38953890

3896-
function fadeOutNotification(element) {
3897-
const notification = dom.parent(element, '.alert-message');
3898-
if (notification) {
3899-
notification.classList.add('fade-out');
3900-
notification.classList.remove('fade-in');
3901-
setTimeout(() => {
3902-
if (notification.parentNode) {
3903-
notification.parentNode.removeChild(notification);
3904-
}
3905-
});
3906-
}
3907-
}
3908-
3909-
if (typeof timeout === 'number' && timeout > 0) {
3910-
setTimeout(() => {
3911-
if (msg && msg.parentNode) {
3912-
fadeOutNotification(msg);
3913-
}
3914-
}, timeout);
3915-
}
3916-
39173891
return msg;
39183892
},
39193893

0 commit comments

Comments
 (0)