Skip to content

Commit 32a2730

Browse files
committed
refactor: ♻️ refactor code
1 parent 51c18ab commit 32a2730

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

js/main-en.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@
380380

381381
// 處理中間圖片跟隨視窗大小移動位置
382382
window.addEventListener('resize', () => {
383-
document.documentElement.clientWidth = location.reload();
383+
location.reload();
384384
});
385385

386386
}();

js/main.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
});
8585
saveBtn.addEventListener('click', async function () {
8686
let t = new Date();
87-
list.time = `${t.getFullYear()}/${t.getMonth()*1+1}/${t.getDate()} ${t.getHours()}:${t.getMinutes()}:${t.getSeconds()}`;
87+
list.time = `${t.getFullYear()}/${t.getMonth() * 1 + 1}/${t.getDate()} ${t.getHours()}:${t.getMinutes()}:${t.getSeconds()}`;
8888
let write = await database.ref('/').push(list);
8989
popup.classList.add('show');
9090
let url = `${urlOrigin}${urlPath}#${write.key}`;
@@ -290,12 +290,12 @@
290290

291291
// 注意,小車一開始的中心點 y 座標,不等於畫面的中心點 y 座標。
292292
// 邊界在中心的周圍 1/3 小車寬/高的距離
293-
const kxCenter = kx + carSize.width/2; // 車子中心點 x 座標
294-
const kyCenter = ky + carSize.height/2; // 車子中心點 y 座標
295-
const leftSide = ww * 0.5 - carSize.width/3; // 左邊界,小於這個值,判定車子移動到左邊
296-
const rightSide = ww * 0.5 + carSize.width/3; // 右邊界,大於這個值,判定車子移動到右邊
297-
const topSide = oy + carSize.height/6; // 上邊界,小於這個值,判定車子移動到上面
298-
const bottomSide = oy + 5 * carSize.height/6; // 下邊界,小於這個值,判定車子移動到下面
293+
const kxCenter = kx + carSize.width / 2; // 車子中心點 x 座標
294+
const kyCenter = ky + carSize.height / 2; // 車子中心點 y 座標
295+
const leftSide = ww * 0.5 - carSize.width / 3; // 左邊界,小於這個值,判定車子移動到左邊
296+
const rightSide = ww * 0.5 + carSize.width / 3; // 右邊界,大於這個值,判定車子移動到右邊
297+
const topSide = oy + carSize.height / 6; // 上邊界,小於這個值,判定車子移動到上面
298+
const bottomSide = oy + 5 * carSize.height / 6; // 下邊界,小於這個值,判定車子移動到下面
299299

300300
if (kxCenter < leftSide) {
301301
if (!send.left) {
@@ -378,9 +378,9 @@
378378
kebbi.addEventListener('touchstart', target);
379379
}
380380

381-
// 處理中間圖片跟隨視窗大小移動位置
381+
// 處理中間圖片跟隨視窗大小移動位置
382382
window.addEventListener('resize', () => {
383-
document.documentElement.clientWidth = location.reload();
383+
location.reload();
384384
});
385385

386386
}();

0 commit comments

Comments
 (0)