Authentication Bypass in MailboxImportServlet vulnerability (reminder)
https://blog.zimbra.com/2022/08/authentication-bypass-in-mailboximportservlet-vulnerability/

EventListener on App Button

Interested in talking about Mash-up's? This is the place.
lepolDan
Posts: 2
Joined: Mon Aug 29, 2022 8:40 am

EventListener on App Button

Postby lepolDan » Mon Aug 29, 2022 9:14 am

Hi,

I want to customize zimbra-zimlet-anyframe and add an event listener on the apps buttons registered in
slot::vertical-menu-item
.
For that i need to listen to click events for class zimbra-client_app-navigation_navListItem.
These portions of code doesn't work:

Code: Select all

const apps = document.getElementsByClassName('zimbra-client_app-navigation_navListItem');
for (const app of apps) {
              app.addEventListener('click', function getClick(event) {
              console.log('app clicked', event);
              });
        }

nor

Code: Select all

const apps = Array.from(document.getElementsByClassName('zimbra-client_app-navigation_navListItem'));
apps.forEach(app => {
      app.addEventListener('click', function handleClick(event) {
        console.log('app clicked', event);
      });
    });

The variable apps is still empty.

Can you explain to me what i did wrong ?
thanks


lepolDan
Posts: 2
Joined: Mon Aug 29, 2022 8:40 am

Re: EventListener on App Button

Postby lepolDan » Thu Sep 01, 2022 10:47 am

I finally found a method that works!

window.parent.document.getElementsByClassName is the key !

Code: Select all

const apps = Array.from(window.parent.document.getElementsByClassName('zimbra-client_app-navigation_link'));
    //console.log("Elements:"+JSON.stringify(apps));
    apps.forEach(app => {
      app.addEventListener('click', function handleClick(event) {
        console.log('app clicked', event);
      });
    });     

Return to “Zimlets”

Who is online

Users browsing this forum: No registered users and 2 guests