diff --git a/index.html b/index.html
index 9ca2dcd..aee05e6 100644
--- a/index.html
+++ b/index.html
@@ -1,9 +1,17 @@
-
+
+ AO3 Mirror
+
+
+
+
+
+
+
-
+
diff --git a/src/App.vue b/src/App.vue
index 7af591c..4b1bdb7 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,6 +1,8 @@
-
-
+
+
-
+
diff --git a/src/ssr/ClientOnly1.vue b/src/ssr/ClientOnly1.vue
deleted file mode 100644
index e812ae6..0000000
--- a/src/ssr/ClientOnly1.vue
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/ssr/useInitialState.js b/src/ssr/useInitialState.js
deleted file mode 100644
index 08784b0..0000000
--- a/src/ssr/useInitialState.js
+++ /dev/null
@@ -1,9 +0,0 @@
-export function getInitialState(key) {
- if (typeof window !== 'undefined' && window.__INITIAL_STATE__) {
- if (window.__INITIAL_STATE__[key] !== undefined) {
- let value = window.__INITIAL_STATE__[key]
- delete window.__INITIAL_STATE__[key]
- return value
- }
- }
-}
diff --git a/src/stores/api.js b/src/stores/api.js
index 3065bc6..62023f9 100644
--- a/src/stores/api.js
+++ b/src/stores/api.js
@@ -1,5 +1,5 @@
import { defineStore } from 'pinia'
-import { useApiRequest } from '../composables/apiRequest'
+import { useApiRequest } from '../composables/apiRequest.js'
export const useApiStore = defineStore('api', () => {
async function getWork(workId, chapterId) {
diff --git a/src/stores/appSetting.js b/src/stores/appSetting.js
index 5f81b2d..81e3f93 100644
--- a/src/stores/appSetting.js
+++ b/src/stores/appSetting.js
@@ -1,6 +1,5 @@
import { defineStore } from 'pinia'
-import { reactive } from 'vue'
-import { useStorage, watchWithFilter, debounceFilter } from '@vueuse/core'
+import { useStorage } from '@vueuse/core'
const CURRENT_VERSION = 1
diff --git a/src/stores/route.js b/src/stores/route.js
index 26cecfa..de1a803 100644
--- a/src/stores/route.js
+++ b/src/stores/route.js
@@ -21,9 +21,7 @@ export const useRouteStore = defineStore('route', () => {
if (lastFromDrawer.value == 0) {
lastFromDrawer.value = 1
router.push(target)
- } else {
- router.replace(target)
- }
+ } else router.replace(target)
}
const progress = ref(0)
const progressMax = ref(1)
@@ -32,11 +30,9 @@ export const useRouteStore = defineStore('route', () => {
watch(title, title => document.title = title)
let progressTimer = null
router.beforeEach((to, from) => {
- if (lastFromDrawer.value == 2) {
- lastFromDrawer.value = 0
- } else if (lastFromDrawer.value == 1) {
- lastFromDrawer.value = 2
- }
+ if (showProgress.value) return false
+ if (lastFromDrawer.value == 2) lastFromDrawer.value = 0
+ else if (lastFromDrawer.value == 1) lastFromDrawer.value = 2
progress.value = 0
progressMax.value = 1
showProgress.value = true
diff --git a/src/ui/Form.vue b/src/ui/Form.vue
index 19ef9a6..d36c574 100644
--- a/src/ui/Form.vue
+++ b/src/ui/Form.vue
@@ -1,9 +1,3 @@
-
-
-
-
+
+
+
+
diff --git a/src/utils.js b/src/utils.js
index 6a0345f..65ab98e 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -1,11 +1,7 @@
import { snackbar } from 'mdui/functions/snackbar.js'
import { alert } from 'mdui/functions/alert.js'
-export function mduiSnackbar(message) {
- snackbar({
- message: message,
- })
-}
+export const mduiSnackbar = (message) => snackbar({ message })
export function mduiAlert(title,desc,callback = null,confirmText = "OK") {
alert({
@@ -19,50 +15,44 @@ export function mduiAlert(title,desc,callback = null,confirmText = "OK") {
}
export function getQueryVariable(variable) {
- var query = window.location.search.substring(1);
- var vars = query.split("&")
- for (var i=0;i
- text
- .replace(/&/g, "&") // 转义 &
- .replace(//g, ">") // 转义 >
- .replace(/"/g, """) // 转义 "
- .replace(/'/g, "'"); // 转义 '
+export const escapeHtml = (text) => text
+ .replace(/&/g, "&") // 转义 &
+ .replace(//g, ">") // 转义 >
+ .replace(/"/g, """) // 转义 "
+ .replace(/'/g, "'"); // 转义 '
-export function escapeAndFormatText(input) {
- let escapedText = escapeHtml(input);
- escapedText = escapedText.replace(/ /g, " ");
- escapedText = escapedText.replace(/\t/g, " ");
- escapedText = escapedText.replace(/\n/g, "
");
- return escapedText;
-}
+export const escapeAndFormatText = (text) => escapeHtml(text)
+ .replace(/ /g, " ")
+ .replace(/\t/g, " ")
+ .replace(/\n/g, "
")
export function getCookie(name) {
const cookieArr = document.cookie.split(";")
for (let i = 0; i < cookieArr.length; i++) {
const cookiePair = cookieArr[i].trim()
- if (cookiePair.startsWith(name + "=")) {
- return cookiePair.substring(name.length + 1);
- }
- }
- return null;
+ if (cookiePair.startsWith(name + "=")) return cookiePair.substring(name.length + 1)
+ }
+ return null
}
export function setCookie(name, value, days = 3650) {
var expires = ""
if (days) {
var date = new Date()
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000))
expires = "; expires=" + date.toUTCString()
}
- document.cookie = name + "=" + value + expires + "; path=/";
+ document.cookie = name + "=" + value + expires + "; path=/"
}
export function objectToQueryString(obj, parentKey = '') {
@@ -71,42 +61,37 @@ export function objectToQueryString(obj, parentKey = '') {
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue
let value = obj[key]
let newKey = parentKey ? `${parentKey}[${key}]` : key
- if (typeof value === 'object' && value !== null) {
- parts.push(objectToQueryString(value, newKey))
- } else {
- parts.push(encodeURIComponent(newKey) + '=' + encodeURIComponent(value))
- }
+ if (typeof value === 'object' && value !== null) parts.push(objectToQueryString(value, newKey))
+ else parts.push(encodeURIComponent(newKey) + '=' + encodeURIComponent(value))
}
return parts.join('&')
}
export function formatUnixTimestamp(unixTimestamp, timeZone) {
- const date = new Date(unixTimestamp * 1000); // 将 UNIX 时间戳转换为毫秒
- const options = {
- timeZone: timeZone || Intl.DateTimeFormat().resolvedOptions().timeZone, // 使用指定时区或浏览器本地时区
- year: 'numeric',
- month: '2-digit',
- day: '2-digit',
- hour: '2-digit',
- minute: '2-digit',
- second: '2-digit',
- hour12: false, // 24小时制
- };
- const formatter = new Intl.DateTimeFormat('en-US', options);
- const parts = formatter.formatToParts(date);
- const formatMap = {};
- parts.forEach(({ type, value }) => {
- formatMap[type] = value;
- });
- return `${formatMap.year}-${formatMap.month}-${formatMap.day} ${formatMap.hour}:${formatMap.minute}:${formatMap.second}`;
+ const date = new Date(unixTimestamp * 1000)
+ const options = {
+ timeZone: timeZone || Intl.DateTimeFormat().resolvedOptions().timeZone,
+ year: 'numeric',
+ month: '2-digit',
+ day: '2-digit',
+ hour: '2-digit',
+ minute: '2-digit',
+ second: '2-digit',
+ hour12: false,
+ }
+ const formatter = new Intl.DateTimeFormat('en-US', options)
+ const parts = formatter.formatToParts(date)
+ const formatMap = {}
+ parts.forEach(({ type, value }) => { formatMap[type] = value })
+ return `${formatMap.year}-${formatMap.month}-${formatMap.day} ${formatMap.hour}:${formatMap.minute}:${formatMap.second}`
}
export function isMobileDeviceByUA() {
- const ua = navigator.userAgent || navigator.vendor || window.opera;
- return /android/i.test(ua) ||
- /iphone/i.test(ua) ||
- /ipod/i.test(ua) ||
- /ipad/i.test(ua) ||
- /blackberry/i.test(ua) ||
- /windows phone/i.test(ua);
+ const ua = navigator.userAgent || navigator.vendor || window.opera
+ return /android/i.test(ua) ||
+ /iphone/i.test(ua) ||
+ /ipod/i.test(ua) ||
+ /ipad/i.test(ua) ||
+ /blackberry/i.test(ua) ||
+ /windows phone/i.test(ua)
}
diff --git a/src/views/Developer.vue b/src/views/Developer.vue
index bff7734..6d8b2c5 100644
--- a/src/views/Developer.vue
+++ b/src/views/Developer.vue
@@ -1,11 +1,9 @@
-
注意本页面仅为测试用!
当然如果你是乱点那个唐鬼小人进来的, 这就是个彩蛋? (神金
-
-
+
页面信息
可见路由信息:
{{ routeStore.allRoutes }}
-
-
-
-
- 浏览器信息
-
- - User-Agent:
- - {{ ua }}
- - 语言:
- - {{ language }}
- - 平台:
- - {{ platform }}
- - 屏幕尺寸:
- - {{ screenSize }}
- - 视口尺寸:
- - {{ viewportSize }}
- - 像素比:
- - {{ pixelRatio }}
- - 是否触屏设备:
- - {{ touchSupport ? '是' : '否' }}
- - 页面可见性状态:
- - {{ visibility }}
-
-
-
-
+
+
+ 浏览器信息
+ - User-Agent:
+ - {{ ua }}
+ - 语言:
+ - {{ language }}
+ - 平台:
+ - {{ platform }}
+ - 屏幕尺寸:
+ - {{ screenSize }}
+ - 视口尺寸:
+ - {{ viewportSize }}
+ - 像素比:
+ - {{ pixelRatio }}
+ - 是否触屏设备:
+ - {{ touchSupport ? '是' : '否' }}
+ - 页面可见性状态:
+ - {{ visibility }}
+
-
-
-
diff --git a/src/views/Mask.vue b/src/views/Mask.vue
deleted file mode 100644
index a9feefb..0000000
--- a/src/views/Mask.vue
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- Padding! No content cause hydration mismatch!
-
-
-
diff --git a/src/views/Root.vue b/src/views/Root.vue
index 3194d09..9d98711 100644
--- a/src/views/Root.vue
+++ b/src/views/Root.vue
@@ -10,29 +10,23 @@ import Intro from '../texts/intro.md'
const router = useRouter()
function convert(from) {
- if( Number(from) ) {
- return {
- type: 's',
- id: Number(from)
- }
- } else if (from.includes('https://archiveofourown.org/works/')) {
+ if( Number(from) ) {return {
+ type: 's',
+ id: Number(from)
+ }} else if (from.includes('https://archiveofourown.org/works/')) {
const sid = from.split('https://archiveofourown.org/works/')[1];
if ( sid ) {
const id = Number(sid)
- if (id) {
- return {
- type: 's',
- id
- }
- } else {
+ if (id) { return {
+ type: 's',
+ id
+ }} else {
const splited = sid.split('/chapters/')
const id = Number(splited[0])
const cid = Number(splited[1])
- if (id && cid) {
- return {
- type: 'c',
- id, cid
- }
+ if (id && cid) return {
+ type: 'c',
+ id, cid
}
}
}
@@ -42,22 +36,19 @@ function convert(from) {
function onConvert(data) {
const { type, id, cid, key } = convert(data.src)
- if (type == null) {
- } else if ( type == 'f') {
- router.push(`/search/simple?keyword=${encodeURIComponent(key)}`)
- } else {
+ if (type == null) return
+ else if ( type == 'f') router.push(`/search/simple?keyword=${encodeURIComponent(key)}`)
+ else {
if (cid) router.push(`/work/${id}/${cid}`)
else router.push(`/work/${id}`)
}
}
-
欢迎来到 AO3 Mirror! 👋👋
- 一个基于重构渲染的 AO3 镜像站
-
+ 一个基于重构渲染的 AO3 镜像站
-
+
diff --git a/src/views/Settings.vue b/src/views/Settings.vue
index 8d88701..d3121ad 100644
--- a/src/views/Settings.vue
+++ b/src/views/Settings.vue
@@ -11,25 +11,21 @@ let appSetting = null
onBeforeMount(() => {
appSetting = useAppSettingStore()
})
-
- 设置
-
-
-
- 界面
- 自动黑暗模式
-
appSetting.value.autoTheme = e.target.checked">
-
- 默认黑暗模式
-
appSetting.value.darkTheme = e.target.checked">
-
-
-
+ 设置
+
+ 界面
+ 自动黑暗模式
+
appSetting.value.autoTheme = e.target.checked">
+
+ 默认黑暗模式
+
appSetting.value.darkTheme = e.target.checked">
+
+