template::register_double_click_handler (private)
template::register_double_click_handler
Defined in packages/acs-templating/tcl/head-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set default_timeout [parameter::get_from_package_key -package_key acs-templating -parameter DefaultPreventDoubleClickTimeoutMs -default 2000] if {$default_timeout == 0} { return } template::add_body_script -script [subst -nobackslashes -nocommands [ns_trim { function oacs_reenable_double_click_handler(target) { if ( target.dataset.oacsClicked == 'true') { target.dataset.oacsClicked = false; target.disabled = false; target.classList.remove("disabled"); console.log("re-enable click handler"); } }; for (e of document.getElementsByClassName('prevent-double-click')) { if (!e.dataset.oacsDoubleClickHandlerRegistered) { e.addEventListener('click', function(event) { let target = event.target || event.srcElement; if ( target.dataset.oacsClicked == 'true') { event.stopPropagation(); event.preventDefault(); console.log("blocked double-click"); return false; } else { setTimeout(function () { target.disabled = true; target.dataset.oacsClicked = true; target.classList.add("disabled"); }); const timeout = target.dataset.oacsTimeout || $default_timeout; setTimeout(oacs_reenable_double_click_handler, timeout, target); return true; } }, true); // In case the page has changed before the button was re-enabled // and the user uses the brower's back button, we have to establish // a clickable state. e.addEventListener('focus', function(event) { oacs_reenable_double_click_handler(event.target || event.srcElement); }); e.dataset.oacsDoubleClickHandlerRegistered = true; } }; }]]XQL Not present: Generic, PostgreSQL, Oracle