mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 14:03:09 +02:00
debug
This commit is contained in:
parent
1dec3461cd
commit
fa5140310f
1 changed files with 30 additions and 0 deletions
|
@ -74,12 +74,14 @@ if (_DEV_) {
|
||||||
|
|
||||||
// タッチデバイスでCSSの:hoverを機能させる
|
// タッチデバイスでCSSの:hoverを機能させる
|
||||||
document.addEventListener('touchend', () => {}, { passive: true });
|
document.addEventListener('touchend', () => {}, { passive: true });
|
||||||
|
console.info('1');
|
||||||
|
|
||||||
// 一斉リロード
|
// 一斉リロード
|
||||||
reloadChannel.addEventListener('message', path => {
|
reloadChannel.addEventListener('message', path => {
|
||||||
if (path !== null) location.href = path;
|
if (path !== null) location.href = path;
|
||||||
else location.reload();
|
else location.reload();
|
||||||
});
|
});
|
||||||
|
console.info('2');
|
||||||
|
|
||||||
//#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
//#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
||||||
// TODO: いつの日にか消したい
|
// TODO: いつの日にか消したい
|
||||||
|
@ -90,6 +92,7 @@ window.addEventListener('resize', () => {
|
||||||
document.documentElement.style.setProperty('--vh', `${vh}px`);
|
document.documentElement.style.setProperty('--vh', `${vh}px`);
|
||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
|
console.info('3');
|
||||||
|
|
||||||
// If mobile, insert the viewport meta tag
|
// If mobile, insert the viewport meta tag
|
||||||
if (['smartphone', 'tablet'].includes(deviceKind)) {
|
if (['smartphone', 'tablet'].includes(deviceKind)) {
|
||||||
|
@ -97,15 +100,18 @@ if (['smartphone', 'tablet'].includes(deviceKind)) {
|
||||||
viewport.setAttribute('content',
|
viewport.setAttribute('content',
|
||||||
`${viewport.getAttribute('content')}, minimum-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover`);
|
`${viewport.getAttribute('content')}, minimum-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover`);
|
||||||
}
|
}
|
||||||
|
console.info('4');
|
||||||
|
|
||||||
//#region Set lang attr
|
//#region Set lang attr
|
||||||
const html = document.documentElement;
|
const html = document.documentElement;
|
||||||
html.setAttribute('lang', lang);
|
html.setAttribute('lang', lang);
|
||||||
//#endregion
|
//#endregion
|
||||||
|
console.info('5');
|
||||||
|
|
||||||
//#region loginId
|
//#region loginId
|
||||||
const params = new URLSearchParams(location.search);
|
const params = new URLSearchParams(location.search);
|
||||||
const loginId = params.get('loginId');
|
const loginId = params.get('loginId');
|
||||||
|
console.info('6', loginId);
|
||||||
|
|
||||||
if (loginId) {
|
if (loginId) {
|
||||||
const target = getUrlWithoutLoginId(location.href);
|
const target = getUrlWithoutLoginId(location.href);
|
||||||
|
@ -119,6 +125,7 @@ if (loginId) {
|
||||||
|
|
||||||
history.replaceState({ misskey: 'loginId' }, '', target);
|
history.replaceState({ misskey: 'loginId' }, '', target);
|
||||||
}
|
}
|
||||||
|
console.info('7');
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
@ -127,12 +134,14 @@ if ($i && $i.token) {
|
||||||
if (_DEV_) {
|
if (_DEV_) {
|
||||||
console.log('account cache found. refreshing...');
|
console.log('account cache found. refreshing...');
|
||||||
}
|
}
|
||||||
|
console.info('8');
|
||||||
|
|
||||||
refreshAccount();
|
refreshAccount();
|
||||||
} else {
|
} else {
|
||||||
if (_DEV_) {
|
if (_DEV_) {
|
||||||
console.log('no account cache found.');
|
console.log('no account cache found.');
|
||||||
}
|
}
|
||||||
|
console.info('9');
|
||||||
|
|
||||||
// 連携ログインの場合用にCookieを参照する
|
// 連携ログインの場合用にCookieを参照する
|
||||||
const i = (document.cookie.match(/igi=(\w+)/) || [null, null])[1];
|
const i = (document.cookie.match(/igi=(\w+)/) || [null, null])[1];
|
||||||
|
@ -166,6 +175,7 @@ fetchInstanceMetaPromise.then(() => {
|
||||||
// Init service worker
|
// Init service worker
|
||||||
initializeSw();
|
initializeSw();
|
||||||
});
|
});
|
||||||
|
console.info('10');
|
||||||
|
|
||||||
const app = createApp(
|
const app = createApp(
|
||||||
window.location.search === '?zen' ? defineAsyncComponent(() => import('@/ui/zen.vue')) :
|
window.location.search === '?zen' ? defineAsyncComponent(() => import('@/ui/zen.vue')) :
|
||||||
|
@ -175,6 +185,8 @@ const app = createApp(
|
||||||
defineAsyncComponent(() => import('@/ui/universal.vue')),
|
defineAsyncComponent(() => import('@/ui/universal.vue')),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.info('11');
|
||||||
|
|
||||||
if (_DEV_) {
|
if (_DEV_) {
|
||||||
app.config.performance = true;
|
app.config.performance = true;
|
||||||
}
|
}
|
||||||
|
@ -191,12 +203,16 @@ widgets(app);
|
||||||
directives(app);
|
directives(app);
|
||||||
components(app);
|
components(app);
|
||||||
|
|
||||||
|
console.info('12');
|
||||||
|
|
||||||
const splash = document.getElementById('splash');
|
const splash = document.getElementById('splash');
|
||||||
// 念のためnullチェック(HTMLが古い場合があるため(そのうち消す))
|
// 念のためnullチェック(HTMLが古い場合があるため(そのうち消す))
|
||||||
if (splash) splash.addEventListener('transitionend', () => {
|
if (splash) splash.addEventListener('transitionend', () => {
|
||||||
splash.remove();
|
splash.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.info('13');
|
||||||
|
|
||||||
// https://github.com/misskey-dev/misskey/pull/8575#issuecomment-1114239210
|
// https://github.com/misskey-dev/misskey/pull/8575#issuecomment-1114239210
|
||||||
// なぜかinit.tsの内容が2回実行されることがあるため、mountするdivを1つに制限する
|
// なぜかinit.tsの内容が2回実行されることがあるため、mountするdivを1つに制限する
|
||||||
const rootEl = (() => {
|
const rootEl = (() => {
|
||||||
|
@ -215,19 +231,27 @@ const rootEl = (() => {
|
||||||
return rootEl;
|
return rootEl;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
console.info('14');
|
||||||
|
|
||||||
app.mount(rootEl);
|
app.mount(rootEl);
|
||||||
|
|
||||||
|
console.info('15');
|
||||||
|
|
||||||
// boot.jsのやつを解除
|
// boot.jsのやつを解除
|
||||||
window.onerror = null;
|
window.onerror = null;
|
||||||
window.onunhandledrejection = null;
|
window.onunhandledrejection = null;
|
||||||
|
|
||||||
reactionPicker.init();
|
reactionPicker.init();
|
||||||
|
|
||||||
|
console.info('16');
|
||||||
|
|
||||||
if (splash) {
|
if (splash) {
|
||||||
splash.style.opacity = '0';
|
splash.style.opacity = '0';
|
||||||
splash.style.pointerEvents = 'none';
|
splash.style.pointerEvents = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.info('17');
|
||||||
|
|
||||||
// クライアントが更新されたか?
|
// クライアントが更新されたか?
|
||||||
const lastVersion = localStorage.getItem('lastVersion');
|
const lastVersion = localStorage.getItem('lastVersion');
|
||||||
if (lastVersion !== version) {
|
if (lastVersion !== version) {
|
||||||
|
@ -247,6 +271,8 @@ if (lastVersion !== version) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.info('18');
|
||||||
|
|
||||||
// NOTE: この処理は必ず↑のクライアント更新時処理より後に来ること(テーマ再構築のため)
|
// NOTE: この処理は必ず↑のクライアント更新時処理より後に来ること(テーマ再構築のため)
|
||||||
watch(defaultStore.reactiveState.darkMode, (darkMode) => {
|
watch(defaultStore.reactiveState.darkMode, (darkMode) => {
|
||||||
applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
|
applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
|
||||||
|
@ -267,6 +293,8 @@ watch(lightTheme, (theme) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.info('19');
|
||||||
|
|
||||||
//#region Sync dark mode
|
//#region Sync dark mode
|
||||||
if (ColdDeviceStorage.get('syncDeviceDarkMode')) {
|
if (ColdDeviceStorage.get('syncDeviceDarkMode')) {
|
||||||
defaultStore.set('darkMode', isDeviceDarkmode());
|
defaultStore.set('darkMode', isDeviceDarkmode());
|
||||||
|
@ -279,6 +307,8 @@ window.matchMedia('(prefers-color-scheme: dark)').addListener(mql => {
|
||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
console.info('20');
|
||||||
|
|
||||||
fetchInstanceMetaPromise.then(() => {
|
fetchInstanceMetaPromise.then(() => {
|
||||||
if (defaultStore.state.themeInitial) {
|
if (defaultStore.state.themeInitial) {
|
||||||
if (instance.defaultLightTheme != null) ColdDeviceStorage.set('lightTheme', JSON5.parse(instance.defaultLightTheme));
|
if (instance.defaultLightTheme != null) ColdDeviceStorage.set('lightTheme', JSON5.parse(instance.defaultLightTheme));
|
||||||
|
|
Loading…
Reference in a new issue