Browse Source

Added testing if client is running on a mobile phone (which might not work with this website due to some limitation)

master
TFLCL 2 years ago
parent
commit
1e3e238582
  1. 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', () => {

Loading…
Cancel
Save