1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 18:19:25 +00:00

Fix ios safari

This commit is contained in:
2022-04-22 03:07:54 +00:00
parent d5cdf70705
commit 62cfe7b643
9 changed files with 28 additions and 15 deletions

View File

@@ -17,8 +17,9 @@
<script> <script>
document.querySelectorAll('.classUser i').forEach(elem => { document.querySelectorAll('.classUser i').forEach(elem => {
elem.addEventListener('click', (e) => { elem.addEventListener(touchEvent, (e) => {
const userId = e.path[1].getAttribute('data-uid'); const path = e.path || (e.composedPath && e.composedPath());
const userId = path[1].getAttribute('data-uid');
window.location.href = `${window.location.href}/${userId}/remove`; window.location.href = `${window.location.href}/${userId}/remove`;
}); });
}); });

View File

@@ -17,7 +17,7 @@
<script> <script>
const classes = document.querySelectorAll('.classes__class'); const classes = document.querySelectorAll('.classes__class');
classes.forEach(c => { classes.forEach(c => {
c.addEventListener('click', () => { c.addEventListener(touchEvent, () => {
window.location.href = `/admin/class/${c.getAttribute('data-id')}`; window.location.href = `/admin/class/${c.getAttribute('data-id')}`;
}); });
}); });

View File

@@ -2,6 +2,9 @@
<html lang='en'> <html lang='en'>
{{> head title=title }} {{> head title=title }}
<body> <body>
<script>
const touchEvent = 'ontouchstart' in window ? 'touchstart' : 'click';
</script>
{{> adminHeader }} {{> adminHeader }}
{{> adminNav current=current name=name }} {{> adminNav current=current name=name }}
<main class='adminContent'> <main class='adminContent'>
@@ -12,7 +15,7 @@
const toggle = document.querySelector('.adminNav-toggle'); const toggle = document.querySelector('.adminNav-toggle');
const nav = document.querySelector('.adminNav'); const nav = document.querySelector('.adminNav');
toggle.addEventListener('click', () => { toggle.addEventListener(touchEvent, () => {
nav.style.display = nav.style.display =
(nav.style.display === 'flex') (nav.style.display === 'flex')
? 'none' ? 'none'

View File

@@ -2,6 +2,9 @@
<html lang='en'> <html lang='en'>
{{> head title=title }} {{> head title=title }}
<body> <body>
<script>
const touchEvent = 'ontouchstart' in window ? 'touchstart' : 'click';
</script>
{{> mainNav }} {{> mainNav }}
{{{ body }}} {{{ body }}}
{{> scripts }} {{> scripts }}

View File

@@ -4,8 +4,9 @@
</tr> </tr>
<script> <script>
document.querySelector('.adminTable tr[data-id="{{id}}"]').addEventListener('click', (e) => { document.querySelector('.adminTable tr[data-id="{{id}}"]').addEventListener(touchEvent, (e) => {
const test = e.path[1]; const path = e.path || (e.composedPath && e.composedPath());
const test = path[1];
window.location.href = `/admin/test/${test.getAttribute('data-id')}`; window.location.href = `/admin/test/${test.getAttribute('data-id')}`;
}); });
</script> </script>

View File

@@ -6,8 +6,9 @@
</tr> </tr>
<script> <script>
document.querySelector('.tests tbody tr[data-id="{{id}}"]').addEventListener('click', (e) => { document.querySelector('.tests tbody tr[data-id="{{id}}"]').addEventListener(touchEvent, (e) => {
const test = e.path[1]; const path = e.path || (e.composedPath && e.composedPath());
const test = path[1];
window.location.href = `/admin/test/${test.getAttribute('data-id')}`; window.location.href = `/admin/test/${test.getAttribute('data-id')}`;
}); });
</script> </script>

View File

@@ -48,11 +48,12 @@
{{#if edit}} {{#if edit}}
<script> <script>
document.querySelector('.testPage__testResultWrapper[data-id="{{result.id}}"] a.resultEdit').addEventListener('click', (e) => { document.querySelector('.testPage__testResultWrapper[data-id="{{result.id}}"] a.resultEdit').addEventListener(touchEvent, (e) => {
e.preventDefault(); e.preventDefault();
const form = e.path[1].childNodes[3]; const path = e.path || (e.composedPath && e.composedPath());
const link = e.path[0]; const form = path[1].childNodes[3];
const link = path[0];
link.innerText = link.innerText =
(form.style.display === 'none') (form.style.display === 'none')

View File

@@ -45,11 +45,13 @@
</section> </section>
<script> <script>
document.querySelector('.editButton').addEventListener('click', (e) => { document.querySelector('.editButton').addEventListener(touchEvent, (e) => {
e.preventDefault(); e.preventDefault();
const form = document.querySelector('.editForm'); const form = document.querySelector('.editForm');
const link = e.path[0];
const path = e.path || (e.composedPath && e.composedPath());
const link = path[0];
link.innerText = link.innerText =
(form.style.display === 'none') (form.style.display === 'none')

View File

@@ -24,8 +24,9 @@
</tr> </tr>
<script> <script>
document.querySelector('.tests tbody tr[data-id="{{id}}"]').addEventListener('click', (e) => { document.querySelector('.tests tbody tr[data-id="{{id}}"]').addEventListener(touchEvent, (e) => {
const template = e.path[1]; const path = e.path || (e.composedPath && e.composedPath());
const template = path[1];
window.location.href = `/admin/test-template/${template.getAttribute('data-id')}`; window.location.href = `/admin/test-template/${template.getAttribute('data-id')}`;
}); });
</script> </script>