Click here to Skip to main content
15,887,417 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am new to Tampermonkey and Javascript but I'll try to be as clear as possible.

I have a page with one button "New Ticket". On the click of this button a modal page is opened and I'd like to tamper with it but I don't know how.
The href of the modal page is a javascript void:(0) as you can see in the code of said Button (so I don't know which page should follow the @match directive):

<a href="javascript:void(0)" class="sui-bttn new_ticket" id="new_ticket_toolbar_button" title="Create a new ticket">New Ticket</a>


Any idea? Thanks

What I have tried:

I tried an alert which would pop up the name of the page you are on for all webpages but, obviously, no pagename was displayed for the modal page. I tried also to look on the web but could not find a clear answer
Posted
Updated 11-Feb-16 0:56am
v4
Comments
Richard Deeming 11-Feb-16 8:34am    
There will be some javascript in the page which launches the dialog when the link is clicked. You need to find that script and see what it's doing.

It's unlikely to be launching a modal dialog in a new window, since most browsers have deprecated or removed that functionality. It's more likely to be displaying an element within the page with an overlay to prevent you from interacting with anything outside of the dialog. For example:
Bootstrap Modals[^]
jQuery UI Dialog[^]
Paolo_H 12-Feb-16 5:41am    
Thank you for your answer Richard!
Unfortunately I could find no script after the button code I posted.
Moroever I inspected some elements of the "modal" page (right mouse button click on web element with Chrome) but could not find their id in the main html page so either it's another page or (more probably, as you pointed out) some java script creates the contents on the fly.
Richard Deeming 12-Feb-16 7:50am    
I'm not sure if Chrome does it, but the Firefox developer tools will show you a little "ev" box next to elements which have event handlers attached:
Examine event listeners | Firefox Developer Tools | MDN[^]

That might help you find the script that's running when you click the link.
Paolo_H 12-Feb-16 9:12am    
Many Thanks Richard! I installed Firefox and found the ev icon you mentioned. Now I have to understand the chain of events triggered by the click but that's another story! :)
Thanks again

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900