MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / click

Function click

src/handlers/quickToolsInit.js:355–378  ·  view source on GitHub ↗

* Executes the action associated with the button * @param {HTMLElement} $el

($el)

Source from the content-addressed store, hash-verified

353 * @param {HTMLElement} $el
354 */
355function click($el) {
356 if ($el.disabled) return;
357
358 $el.classList.add("click");
359 clearTimeout($el.dataset.timeout);
360 $el.dataset.timeout = setTimeout(() => {
361 $el.classList.remove("click");
362 }, 300);
363
364 if (appSettings.value.vibrateOnTap) {
365 navigator.vibrate(config.VIBRATION_TIME);
366 }
367
368 const { action } = $el.dataset;
369 if (!action) return;
370
371 let { value } = $el.dataset;
372
373 if (!value) {
374 value = $el.value;
375 }
376
377 actions(action, value);
378}
379
380function scheduleUpdateQuickToolsState() {
381 setTimeout(updateQuickToolsState, 0);

Callers 3

onclickFunction · 0.70
touchendFunction · 0.70
dispatchEventWithTimeoutFunction · 0.70

Calls 3

actionsFunction · 0.85
addMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected