Skip to content

Commit

Permalink
No need to add a function param.
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoknjas committed Feb 2, 2025
1 parent 5e6f40c commit b692c3f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions ui/site/src/powertip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,8 @@ const imagePowertip = (el: HTMLElement) =>
placement: 's',
});

function powerTipWith(
el: HTMLElement,
ev: Event,
f: (el: HTMLElement) => void,
allow_mobile_powertip: boolean = false,
) {
if ('ontouchstart' in window && !allow_mobile_powertip) return;
function powerTipWith(el: HTMLElement, ev: Event, f: (el: HTMLElement) => void) {
if ('ontouchstart' in window && !el.classList.contains('mobile-powertip')) return;
f(el);
$.powerTip.show(el, ev);
}
Expand All @@ -85,8 +80,7 @@ const powertip: LichessPowertip = {
watchMouse() {
document.body.addEventListener('mouseover', e => {
const t = e.target as HTMLElement;
if (t.classList.contains('ulpt'))
powerTipWith(t, e, userPowertip, t.classList.contains('mobile-powertip'));
if (t.classList.contains('ulpt')) powerTipWith(t, e, userPowertip);
else if (t.classList.contains('glpt')) powerTipWith(t, e, gamePowertip);
else if (t.classList.contains('image-powertip')) powerTipWith(t, e, imagePowertip);
});
Expand Down

0 comments on commit b692c3f

Please sign in to comment.