Fw: Blocking some pseudo-DHTML events in shopping site listboxes using greaseMonkey

  • From: "Jacob Kruger" <jacobk@xxxxxxxxxxxxxx>
  • To: <ProgrammingBlind@xxxxxxxxxxxxx>
  • Date: Thu, 27 Jan 2011 16:36:26 +0200

See message below, but the site was sort of focusing on is a local online 
grocery shopping website, FWIW.

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- 

Ok, this actually now worked out (I think) way too easy...LOL!

Apart from including the JQuery script library in my script file that was then 
mentioned for the specific domain/site, in the relevant gm4ie file, all I added 
in was the following:
$(document).ready(function() {
$("select").click(function(event) {
alert("clicked");
event.preventDefault();
});//end of select click
});//end of document ready

For a bit of an explanation of the above - FWIW, when using JQuery, the 
following line of script attaches an event handler to all <select /> tags:
$("select").click(function(event)

The { then starts off your handling code block, which gets finished off with 
the ending });, the event object can be used to determine attributes etc. of 
the object sending the event request, and the event.preventDefault() function 
call blocks the default event handler as such, so while this one is still 
performing, it seems to be diverting at least one piece of initial activity or 
something, somehow.

Also, all your own script chunks get enclosed inside the 
$(document).ready(function() {}); piece so that they will only get 
interpreted/assigned to objects after the page has finished loading all of its 
content, to make sure nothing gets misinterpreted/missed out on.

I added that alert() function call in to make sure this was actually getting 
triggered/executed, and while it doesn't seem to be all the time that I would 
expect it to, the one thing I now did pick up on was when I focused on the 
final listbox, before arrowing up and down, which made it reload, but generally 
without necessarily having known which product category was meant to be 
selected, as long as I first hit the space bar, as opposed to hitting enter 
etc., this event does get triggered, but without page being reloaded, so that 
then if it hadn't yet changed category yet, it would then, or else, when I then 
did arrow up and down, it was in fact taking note of the selection change.

I did also now try this without grease monkey activating/loading its script for 
this page, and it seems to work quite a bit better now that have been able to 
figure out what keystrokes do actually work better in terms of triggering 
javascript events, which wasn't too sure of before, but think for now, while 
will take out alert, might keep it loading, and try out a couple more things 
with it, but, the main thing is it does work, in conjunction with JQuery on 
other people's/site's document object models, which was somewhat of an 
irritation in the past.

So, anyway, just want to say, thanks Ian!


Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

Other related posts:

  • » Fw: Blocking some pseudo-DHTML events in shopping site listboxes using greaseMonkey - Jacob Kruger