diff --git a/packages/backend/native-utils/src/util/id.rs b/packages/backend/native-utils/src/util/id.rs index 2fd94e901..9d1427e65 100644 --- a/packages/backend/native-utils/src/util/id.rs +++ b/packages/backend/native-utils/src/util/id.rs @@ -21,7 +21,7 @@ const TIME_2000: i64 = 946_684_800_000; const TIMESTAMP_LENGTH: u16 = 8; /// Initializes Cuid2 generator. Must be called before any [create_id]. -pub fn init_id<'a>(length: u16, fingerprint: &'a str) { +pub fn init_id(length: u16, fingerprint: &str) { FINGERPRINT.get_or_init(move || format!("{}{}", fingerprint, cuid2::create_id())); GENERATOR.get_or_init(move || { cuid2::CuidConstructor::new() diff --git a/packages/client/assets/tagcanvas.min.js b/packages/client/assets/tagcanvas.min.js index 2a19f5c14..f8476f43e 100644 --- a/packages/client/assets/tagcanvas.min.js +++ b/packages/client/assets/tagcanvas.min.js @@ -968,8 +968,8 @@ a = c.documentElement, d = c.body, e = window, - h = e.pageXOffset || a.scrollLeft, - i = e.pageYOffset || a.scrollTop, + h = e.scrollX || a.scrollLeft, + i = e.scrollY || a.scrollTop, j = a.clientLeft || d.clientLeft, k = a.clientTop || d.clientTop; return { x: b.left + h - j, y: b.top + i - k }; diff --git a/packages/client/src/components/MkContextMenu.vue b/packages/client/src/components/MkContextMenu.vue index 3944719fa..319f7fd0f 100644 --- a/packages/client/src/components/MkContextMenu.vue +++ b/packages/client/src/components/MkContextMenu.vue @@ -33,18 +33,18 @@ const rootEl = ref(); const zIndex = ref(os.claimZIndex("high")); onMounted(() => { - let left = props.ev.pageX + 1, // 間違って右ダブルクリックした場合に意図せずアイテムがクリックされるのを防ぐため + 1 - top = props.ev.pageY + 1; // 間違って右ダブルクリックした場合に意図せずアイテムがクリックされるのを防ぐため + 1 + let left = props.ev.pageX + 1; // 間違って右ダブルクリックした場合に意図せずアイテムがクリックされるのを防ぐため + 1 + let top = props.ev.pageY + 1; // 間違って右ダブルクリックした場合に意図せずアイテムがクリックされるのを防ぐため + 1 const width = rootEl.value.offsetWidth; const height = rootEl.value.offsetHeight; - if (left + width - window.pageXOffset > window.innerWidth) { - left = window.innerWidth - width + window.pageXOffset; + if (left + width - window.scrollX > window.innerWidth) { + left = window.innerWidth - width + window.scrollX; } - if (top + height - window.pageYOffset > window.innerHeight) { - top = window.innerHeight - height + window.pageYOffset; + if (top + height - window.scrollY > window.innerHeight) { + top = window.innerHeight - height + window.scrollY; } if (top < 0) { diff --git a/packages/client/src/components/MkModal.vue b/packages/client/src/components/MkModal.vue index f3476b7f0..1186b04cc 100644 --- a/packages/client/src/components/MkModal.vue +++ b/packages/client/src/components/MkModal.vue @@ -237,8 +237,8 @@ const align = () => { let left, top; - const x = srcRect.left + (fixed.value ? 0 : window.pageXOffset); - const y = srcRect.top + (fixed.value ? 0 : window.pageYOffset); + const x = srcRect.left + (fixed.value ? 0 : window.scrollX); + const y = srcRect.top + (fixed.value ? 0 : window.scrollY); if (props.anchor.x === "center") { left = x + props.src.offsetWidth / 2 - width / 2; @@ -286,8 +286,7 @@ const align = () => { left = window.innerWidth - width + window.scrollX - 1; } - const underSpace = - window.innerHeight - MARGIN - (top - window.pageYOffset); + const underSpace = window.innerHeight - MARGIN - (top - window.scrollY); const upperSpace = srcRect.top - MARGIN; // 画面から縦にはみ出る場合 @@ -300,12 +299,7 @@ const align = () => { top = window.scrollY + (upperSpace + MARGIN - height); } } else { - top = - window.innerHeight - - MARGIN - - height + - window.pageYOffset - - 1; + top = window.innerHeight - MARGIN - height + window.scrollY - 1; } } else { maxHeight.value = underSpace; @@ -327,12 +321,12 @@ const align = () => { top >= srcRect.top + props.src.offsetHeight + - (fixed.value ? 0 : window.pageYOffset) + (fixed.value ? 0 : window.scrollY) ) { transformOriginY = "top"; } else if ( top + height <= - srcRect.top + (fixed.value ? 0 : window.pageYOffset) + srcRect.top + (fixed.value ? 0 : window.scrollY) ) { transformOriginY = "bottom"; } @@ -341,12 +335,12 @@ const align = () => { left >= srcRect.left + props.src.offsetWidth + - (fixed.value ? 0 : window.pageXOffset) + (fixed.value ? 0 : window.scrollX) ) { transformOriginX = "left"; } else if ( left + width <= - srcRect.left + (fixed.value ? 0 : window.pageXOffset) + srcRect.left + (fixed.value ? 0 : window.scrollX) ) { transformOriginX = "right"; } diff --git a/packages/client/src/components/MkPostForm.vue b/packages/client/src/components/MkPostForm.vue index db1c964cc..80a5c4a5b 100644 --- a/packages/client/src/components/MkPostForm.vue +++ b/packages/client/src/components/MkPostForm.vue @@ -309,7 +309,7 @@ import { deepClone } from "@/scripts/clone"; import preprocess from "@/scripts/preprocess"; import { vibrate } from "@/scripts/vibrate"; import { langmap } from "@/scripts/langmap"; -import { MenuItem } from "@/types/menu"; +import type { MenuItem } from "@/types/menu"; import detectLanguage from "@/scripts/detect-language"; import icon from "@/scripts/icon"; @@ -747,8 +747,8 @@ function filterLangmapByPrefix( if (prefix === "zh") to_return = to_return.concat([ - { langCode: "yue", nativeName: langmap["yue"].nativeName }, - { langCode: "nan", nativeName: langmap["nan"].nativeName }, + { langCode: "yue", nativeName: langmap.yue.nativeName }, + { langCode: "nan", nativeName: langmap.nan.nativeName }, ]); return to_return; diff --git a/packages/client/src/components/MkPullToRefresh.vue b/packages/client/src/components/MkPullToRefresh.vue index 4aa984c51..c7b09a91f 100644 --- a/packages/client/src/components/MkPullToRefresh.vue +++ b/packages/client/src/components/MkPullToRefresh.vue @@ -45,7 +45,6 @@ const isRefreshing = ref(false); const pullDistance = ref(0); let disabled = false; - let supportPointerDesktop = false; let startScreenY: number | null = null; @@ -94,7 +93,7 @@ function moveBySystem(to: number): Promise { return; } const startTime = Date.now(); - let intervalId = setInterval(() => { + const intervalId = setInterval(() => { const time = Date.now() - startTime; if (time > RELEASE_TRANSITION_DURATION) { pullDistance.value = to; diff --git a/packages/client/src/components/MkReleaseNotesWindow.vue b/packages/client/src/components/MkReleaseNotesWindow.vue index 72060e814..fef29fcd5 100644 --- a/packages/client/src/components/MkReleaseNotesWindow.vue +++ b/packages/client/src/components/MkReleaseNotesWindow.vue @@ -4,8 +4,8 @@ :can-resize="true" :front="true" :buttons-right="buttonsRight" - @closed="emit('closed')" class="oxzftdfc" + @closed="emit('closed')" >