Added testing if client is running on a mobile phone (which might not work with this website due to some limitation)
All checks were successful
Gitea/YTDJ/pipeline/head This commit looks good
All checks were successful
Gitea/YTDJ/pipeline/head This commit looks good
This commit is contained in:
28
js/main.js
28
js/main.js
@@ -1,3 +1,19 @@
|
||||
// Check if client is using a mobile phone
|
||||
const getMobileOS = () => {
|
||||
const ua = navigator.userAgent
|
||||
if (/android/i.test(ua)) {
|
||||
return "Android"
|
||||
}
|
||||
else if (/iPad|iPhone|iPod/.test(ua) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) {
|
||||
return "iOS"
|
||||
}
|
||||
return "Other"
|
||||
}
|
||||
const isRunningOn = getMobileOS();
|
||||
if (isRunningOn != 'Other') {
|
||||
alert('Whoop, it seems that you attempt to access this website on a ' + isRunningOn + ' mobile/tablet, which might not work properly. You should better use a computer instead.');
|
||||
}
|
||||
|
||||
// Loads the Youtube IFrame Player API code asynchronously.
|
||||
let tag = document.createElement('script');
|
||||
tag.src = 'https://www.youtube.com/iframe_api';
|
||||
@@ -314,21 +330,9 @@ function newShootingStar() {
|
||||
}, duration);
|
||||
// setTimeout('newShootingStar()', duration + nextIn);
|
||||
}
|
||||
// function endShootingStar(el) {
|
||||
// el.remove();
|
||||
// console.log('removed!');
|
||||
// let nextIn = 4000;
|
||||
// setTimeout('newShootingStar()', nextIn);
|
||||
// }
|
||||
|
||||
newShootingStar();
|
||||
hsnqK2yJ8D66haK
|
||||
|
||||
|
||||
// Enable/disable shooting stars
|
||||
// let separatorSpan = document.createElement('span');
|
||||
// separatorSpan.innerHTML = ' - ';
|
||||
// document.getElementById('shooting-stars-enable').after(separatorSpan);
|
||||
document.getElementById('shooting-stars-enable').innerHTML = '⭐️Disable shooting stars⭐️';
|
||||
|
||||
document.getElementById('shooting-stars-enable').addEventListener('click', () => {
|
||||
|
Reference in New Issue
Block a user