mirror of
https://github.com/xodivorce/isdowndetectordown.git
synced 2025-12-20 04:39:33 +05:30
(chore): initial MVP release
This commit is contained in:
51
assets/js/dashboard.js
Normal file
51
assets/js/dashboard.js
Normal file
@@ -0,0 +1,51 @@
|
||||
(function () {
|
||||
const url = new URL(window.location.href);
|
||||
const geo = url.searchParams.get('geo');
|
||||
|
||||
if (geo) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!navigator.geolocation) {
|
||||
url.searchParams.set('geo', 'unsupported');
|
||||
window.history.replaceState({}, '', url.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
function (pos) {
|
||||
url.searchParams.set('geo', '1');
|
||||
url.searchParams.set('lat', pos.coords.latitude.toFixed(6));
|
||||
url.searchParams.set('lon', pos.coords.longitude.toFixed(6));
|
||||
window.location.href = url.toString();
|
||||
},
|
||||
function () {
|
||||
url.searchParams.set('geo', 'denied');
|
||||
window.location.href = url.toString();
|
||||
},
|
||||
{
|
||||
enableHighAccuracy: false,
|
||||
timeout: 8000,
|
||||
maximumAge: 600000
|
||||
}
|
||||
);
|
||||
})();
|
||||
|
||||
(function () {
|
||||
const el = document.getElementById('copyright-text');
|
||||
if (!el) return;
|
||||
|
||||
const config = window.APP_CONFIG || {};
|
||||
const startYear = Number(config.startYear) || new Date().getFullYear();
|
||||
const currentYear = new Date().getFullYear();
|
||||
|
||||
let displayText;
|
||||
if (currentYear === startYear) {
|
||||
displayText = `© ${startYear}. All rights reserved.`;
|
||||
} else {
|
||||
const shortYear = String(currentYear).slice(2);
|
||||
displayText = `© ${startYear} - ${shortYear}. All rights reserved.`;
|
||||
}
|
||||
|
||||
el.textContent = displayText;
|
||||
})();
|
||||
Reference in New Issue
Block a user