findmydevice 고정밀 상태 토글과 5초 갱신

This commit is contained in:
seo
2026-07-10 20:32:08 +09:00
parent 2e93c4151f
commit eea0846e68
3 changed files with 34 additions and 6 deletions
+28 -5
View File
@@ -464,6 +464,7 @@ let langCode = localStorage.getItem("currentLang") || deviceLang,
lastLat,
lastLng,
lastUpdateISOTime,
highAccuracyModeActive = false,
map,
marker,
circle,
@@ -980,7 +981,12 @@ document.getElementById('wakeLockSwitch').addEventListener('change', async funct
document.getElementById('autoUpdateSwitch').addEventListener('change', () => {
syncUpdateBtn();
const isChecked = document.getElementById('autoUpdateSwitch')?.checked;
const switchEl = document.getElementById('autoUpdateSwitch');
const isChecked = switchEl?.checked;
if (switchEl?.disabled) {
return;
}
if (isChecked) {
callDeviceWebhook('auto_on');
@@ -995,7 +1001,7 @@ document.getElementById('autoUpdateSwitch').addEventListener('change', () => {
const switchEl = document.getElementById('autoUpdateSwitch');
const isAutoUpdateOn = switchEl?.checked;
if (isAutoUpdateOn) {
if (isAutoUpdateOn && !switchEl?.disabled) {
callDeviceWebhook('auto_off', true);
// 스위치 UI 강제 끔
@@ -1007,10 +1013,10 @@ document.getElementById('autoUpdateSwitch').addEventListener('change', () => {
setInterval(() => {
if (!findmydeviceAuthenticated) return;
if (document.getElementById('autoUpdateSwitch')?.checked) {
if (document.getElementById('autoUpdateSwitch')?.checked || highAccuracyModeActive) {
callDeviceWebhook('auto_tick');
}
}, 10000);
}, 5000);
setInterval(() => {
if (!findmydeviceAuthenticated) return;
@@ -1129,6 +1135,9 @@ function setCookieHours(name, value, hours) {
}
function updateDOM(data) {
highAccuracyModeActive = !!data.highAccuracyMode;
syncUpdateBtn();
const textMap = {
currentPosition: data.address,
lastUpdateTime: data.updated ? getRelativeTime(data.updated) : "-",
@@ -2480,7 +2489,21 @@ function syncLocateBtn() {
}
function syncUpdateBtn() {
const isChecked = document.getElementById('autoUpdateSwitch').checked;
const switchEl = document.getElementById('autoUpdateSwitch');
if (!switchEl) return;
if (highAccuracyModeActive) {
switchEl.dataset.highAccuracyLocked = '1';
switchEl.checked = true;
switchEl.disabled = true;
} else {
switchEl.disabled = false;
if (switchEl.dataset.highAccuracyLocked === '1') {
switchEl.checked = false;
delete switchEl.dataset.highAccuracyLocked;
}
}
const isChecked = switchEl.checked;
const parent = document.getElementById('autoUpdateBtn');
const exist = document.getElementById('updateBtn');