|
Lines 329-349
sub _add_binding {
Link Here
|
| 329 |
#click event applies to buttonDot |
329 |
#click event applies to buttonDot |
| 330 |
|
330 |
|
| 331 |
if( $pars =~ /^(e|ev|event)$/i ) { # new style event handler assumed |
331 |
if( $pars =~ /^(e|ev|event)$/i ) { # new style event handler assumed |
| 332 |
|
332 |
$bind = qq| \$("#$ctl").off('$ev').on('$ev', \{id: '$id'\}, $fname);\n|; # remove old handler if any |
| 333 |
if ($ev eq "click"){ |
333 |
$script = q{}; |
| 334 |
# remove already registered click listeners |
|
|
| 335 |
$bind= qq| \$("#$ctl").off('click');\n|; |
| 336 |
$bind.= qq| \$("#$ctl").$ev(\{id: '$id'\}, $fname);\n|; |
| 337 |
} else { |
| 338 |
$bind= qq| \$("#$ctl").$ev(\{id: '$id'\}, $fname);\n|; |
| 339 |
} |
| 340 |
|
| 341 |
$script=''; |
| 342 |
} elsif( $fname eq 'noclick' ) { # no click: return false, no scroll |
334 |
} elsif( $fname eq 'noclick' ) { # no click: return false, no scroll |
| 343 |
$bind= qq| \$("#$ctl").$ev(function () { return false; });\n|; |
335 |
$bind = qq| \$("#$ctl").$ev(function () { return false; });\n|; |
| 344 |
$script=''; |
336 |
$script = q{}; |
| 345 |
} else { # add real event handler calling the function found |
337 |
} else { # add real event handler calling the function found |
| 346 |
$bind=qq| \$("#$ctl").$ev(\{id: '$id'\}, ${fname}_handler);\n|; |
338 |
$bind = qq| \$("#$ctl").off('$ev').on('$ev', \{id: '$id'\}, ${fname}_handler);\n|; |
| 347 |
$script = $self->_add_handler( $ev, $fname ); |
339 |
$script = $self->_add_handler( $ev, $fname ); |
| 348 |
} |
340 |
} |
| 349 |
return ( $bind, $script ); |
341 |
return ( $bind, $script ); |
| 350 |
- |
|
|