Popup for touch devices

This commit is contained in:
Claude Brisson
2024-08-03 16:07:28 +02:00
parent c9a51fdf57
commit 01a6e05e73
4 changed files with 44 additions and 1 deletions

View File

@@ -733,6 +733,9 @@
#standings-table { #standings-table {
font-size: 0.70rem; font-size: 0.70rem;
} }
.title-popup {
display: none;
}
} }
} }

View File

@@ -405,6 +405,14 @@
margin-top: 0.2em; margin-top: 0.2em;
} }
.bottom-pairing-actions {
margin-top: 0.2em;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
gap: 0.2em;
}
.tables-exclusion { .tables-exclusion {
margin-top: 0.2em; margin-top: 0.2em;
} }
@@ -476,6 +484,19 @@
max-width: 95vw; max-width: 95vw;
} }
td.game-result {
position: relative;
.title-popup {
position: absolute;
top: 90%;
background: silver;
padding: 4px;
left: 10%;
white-space: nowrap;
z-index: 2;
}
}
.ui.steps { .ui.steps {
margin-top: 0.2em; margin-top: 0.2em;
.step { .step {

View File

@@ -194,6 +194,12 @@ function downloadFile(blob, filename) {
document.body.removeChild(link); document.body.removeChild(link);
} }
function isTouchDevice() {
return (('ontouchstart' in window) ||
(navigator.maxTouchPoints > 0) ||
(navigator.msMaxTouchPoints > 0));
}
onLoad(() => { onLoad(() => {
$('button.close').on('click', e => { $('button.close').on('click', e => {
close_modal(); close_modal();
@@ -342,4 +348,17 @@ onLoad(() => {
let dialog = e.target.closest('.popup'); let dialog = e.target.closest('.popup');
if (!dialog) close_modal(); if (!dialog) close_modal();
}); });
if (isTouchDevice()) {
$("[title]").on('click', e => {
let item = e.target.closest('[title]');
let title = item.getAttribute('title');
let popup = item.find('.title-popup')
if (popup.length === 0) {
item.insertAdjacentHTML('beforeend', `<span class="title-popup">${title}</span>`);
} else {
item.removeChild(popup[0]);
}
});
}
}); });

View File

@@ -85,7 +85,7 @@
#elseif($rst.contains('-')) #elseif($rst.contains('-'))
#set($rst = "<i>$rst</i>") #set($rst = "<i>$rst</i>")
#end #end
<td class="nobreak" #if($opponent)title="$esc.html($opponent.name)#if($opponent.firstname) $esc.html($opponent.firstname)#end #rank($opponent.rank)#if($opponent.country) $opponent.country#end"#end>$rst</td> <td class="nobreak game-result" #if($opponent)title="$esc.html($opponent.name)#if($opponent.firstname) $esc.html($opponent.firstname)#end #rank($opponent.rank)#if($opponent.country) $opponent.country#end"#end>$rst</td>
#end #end
#foreach($crit in $tour.pairing.placement) #foreach($crit in $tour.pairing.placement)
<td>$number.format('0.#', $part[$crit])</td> <td>$number.format('0.#', $part[$crit])</td>