mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
chore: Clarify usage of window fields in UINotification.js
The click handler also makes use of the `options` parameter from UINotification(), which isn't available there, so I've commented that out. This needs more work. /puter/src/UI/UINotification.js 21:5 error 'global_element_id' is not defined no-undef 26:39 error 'global_element_id' is not defined no-undef 34:73 error 'global_element_id' is not defined no-undef 47:14 error 'toolbar_height' is not defined no-undef 55:12 error 'options' is not defined no-undef 55:36 error 'options' is not defined no-undef 56:13 error 'options' is not defined no-undef
This commit is contained in:
parent
620a1a1334
commit
eecaf759ea
@ -18,12 +18,12 @@
|
||||
*/
|
||||
|
||||
function UINotification(options){
|
||||
global_element_id++;
|
||||
window.global_element_id++;
|
||||
|
||||
options.content = options.content ?? '';
|
||||
|
||||
let h = '';
|
||||
h += `<div id="ui-notification__${global_element_id}" class="notification antialiased animate__animated animate__fadeInRight animate__slow">`;
|
||||
h += `<div id="ui-notification__${window.global_element_id}" class="notification antialiased animate__animated animate__fadeInRight animate__slow">`;
|
||||
h += `<img class="notification-close" src="${html_encode(window.icons['close.svg'])}">`;
|
||||
h += html_encode(options.content);
|
||||
h += `</div>`;
|
||||
@ -31,7 +31,7 @@ function UINotification(options){
|
||||
$('body').append(h);
|
||||
|
||||
|
||||
const el_notification = document.getElementById(`ui-notification__${global_element_id}`);
|
||||
const el_notification = document.getElementById(`ui-notification__${window.global_element_id}`);
|
||||
|
||||
$(el_notification).show(0, function(e){
|
||||
// options.onAppend()
|
||||
@ -44,7 +44,7 @@ function UINotification(options){
|
||||
$(el_notification).delay(100).show(0).
|
||||
// In the right position (the mouse)
|
||||
css({
|
||||
top: toolbar_height + 15,
|
||||
top: window.toolbar_height + 15,
|
||||
});
|
||||
|
||||
return el_notification;
|
||||
@ -52,9 +52,10 @@ function UINotification(options){
|
||||
|
||||
$(document).on('click', '.notification', function(e){
|
||||
if($(e.target).hasClass('notification')){
|
||||
if(options.click && typeof options.click === 'function'){
|
||||
options.click(e);
|
||||
}
|
||||
// TODO: options isn't available here
|
||||
// if(options.click && typeof options.click === 'function'){
|
||||
// options.click(e);
|
||||
// }
|
||||
window.close_notification(e.target);
|
||||
}else{
|
||||
window.close_notification($(e.target).closest('.notification'));
|
||||
|
Loading…
Reference in New Issue
Block a user