2020-10-17 06:12:00 -05:00
|
|
|
<template>
|
2021-12-03 07:09:40 -06:00
|
|
|
<div class="gbhvwtnk" :class="{ wallpaper }" :style="`--globalHeaderHeight:${globalHeaderHeight}px`">
|
2021-10-08 22:33:08 -05:00
|
|
|
<XHeaderMenu v-if="showMenuOnTop" v-get-size="(w, h) => globalHeaderHeight = h"/>
|
2021-07-18 21:36:35 -05:00
|
|
|
|
|
|
|
<div class="columns" :class="{ fullView, withGlobalHeader: showMenuOnTop }">
|
2021-12-03 07:09:40 -06:00
|
|
|
<div v-if="!showMenuOnTop" class="sidebar">
|
|
|
|
<XSidebar/>
|
|
|
|
</div>
|
|
|
|
<div v-else ref="widgetsLeft" class="widgets left">
|
|
|
|
<XWidgets :place="'left'" @mounted="attachSticky('widgetsLeft')"/>
|
|
|
|
</div>
|
2021-04-09 22:40:50 -05:00
|
|
|
|
2021-11-19 04:36:12 -06:00
|
|
|
<main class="main" :style="{ background: pageInfo?.bg }" @contextmenu.stop="onContextmenu">
|
2021-10-23 09:22:20 -05:00
|
|
|
<div class="content">
|
2021-10-23 14:03:07 -05:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkHeader v-if="pageInfo && !pageInfo.hideHeader" :info="pageInfo"/></template>
|
|
|
|
<router-view v-slot="{ Component }">
|
|
|
|
<transition :name="$store.state.animation ? 'page' : ''" mode="out-in" @enter="onTransition">
|
2022-01-21 06:47:36 -06:00
|
|
|
<keep-alive :include="['MkTimelinePage']">
|
2021-10-23 14:03:07 -05:00
|
|
|
<component :is="Component" :ref="changePage"/>
|
|
|
|
</keep-alive>
|
|
|
|
</transition>
|
|
|
|
</router-view>
|
|
|
|
</MkStickyContainer>
|
2020-10-17 06:12:00 -05:00
|
|
|
</div>
|
|
|
|
</main>
|
2020-10-24 11:21:41 -05:00
|
|
|
|
2021-11-19 04:36:12 -06:00
|
|
|
<div v-if="isDesktop" ref="widgetsRight" class="widgets right">
|
|
|
|
<XWidgets :place="null" @mounted="attachSticky('widgetsRight')"/>
|
2021-04-09 22:40:50 -05:00
|
|
|
</div>
|
2020-10-17 06:12:00 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<transition name="tray-back">
|
2021-11-19 04:36:12 -06:00
|
|
|
<div v-if="widgetsShowing"
|
|
|
|
class="tray-back _modalBg"
|
2020-10-17 06:12:00 -05:00
|
|
|
@click="widgetsShowing = false"
|
|
|
|
@touchstart.passive="widgetsShowing = false"
|
|
|
|
></div>
|
|
|
|
</transition>
|
|
|
|
|
|
|
|
<transition name="tray">
|
|
|
|
<XWidgets v-if="widgetsShowing" class="tray"/>
|
|
|
|
</transition>
|
|
|
|
|
2021-11-19 04:36:12 -06:00
|
|
|
<iframe v-if="$store.state.aiChanMode" ref="live2d" class="ivnzpscs" src="https://misskey-dev.github.io/mascot-web/?scale=2&y=1.4"></iframe>
|
2021-09-04 03:54:24 -05:00
|
|
|
|
2020-10-24 11:21:41 -05:00
|
|
|
<XCommon/>
|
2020-10-17 06:12:00 -05:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-09-04 03:54:24 -05:00
|
|
|
import { defineComponent, defineAsyncComponent, markRaw } from 'vue';
|
2021-11-11 11:02:25 -06:00
|
|
|
import { instanceName } from '@/config';
|
|
|
|
import { StickySidebar } from '@/scripts/sticky-sidebar';
|
2021-10-24 00:50:00 -05:00
|
|
|
import XSidebar from './classic.sidebar.vue';
|
2020-10-24 11:21:41 -05:00
|
|
|
import XCommon from './_common_/common.vue';
|
2021-11-11 11:02:25 -06:00
|
|
|
import * as os from '@/os';
|
|
|
|
import { menuDef } from '@/menu';
|
|
|
|
import * as symbols from '@/symbols';
|
2020-10-17 06:12:00 -05:00
|
|
|
|
|
|
|
const DESKTOP_THRESHOLD = 1100;
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
2020-10-24 11:21:41 -05:00
|
|
|
XCommon,
|
2020-10-17 06:12:00 -05:00
|
|
|
XSidebar,
|
2021-10-24 00:50:00 -05:00
|
|
|
XHeaderMenu: defineAsyncComponent(() => import('./classic.header.vue')),
|
|
|
|
XWidgets: defineAsyncComponent(() => import('./classic.widgets.vue')),
|
2020-10-17 06:12:00 -05:00
|
|
|
},
|
|
|
|
|
2021-10-14 07:21:10 -05:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
shouldHeaderThin: this.showMenuOnTop,
|
2021-12-02 22:52:57 -06:00
|
|
|
shouldSpacerMin: true,
|
2021-10-14 07:21:10 -05:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
pageInfo: null,
|
2021-07-18 21:36:35 -05:00
|
|
|
menuDef: menuDef,
|
2021-10-08 22:33:08 -05:00
|
|
|
globalHeaderHeight: 0,
|
2021-04-09 22:40:50 -05:00
|
|
|
isDesktop: window.innerWidth >= DESKTOP_THRESHOLD,
|
2020-10-17 06:12:00 -05:00
|
|
|
widgetsShowing: false,
|
2021-04-11 10:05:13 -05:00
|
|
|
fullView: false,
|
2020-10-17 06:12:00 -05:00
|
|
|
wallpaper: localStorage.getItem('wallpaper') != null,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2021-07-18 21:36:35 -05:00
|
|
|
showMenuOnTop(): boolean {
|
2021-12-03 07:09:40 -06:00
|
|
|
return this.$store.state.menuDisplay === 'top';
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
2021-12-03 07:26:09 -06:00
|
|
|
if (window.innerWidth < 1024) {
|
|
|
|
localStorage.setItem('ui', 'default');
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
document.documentElement.style.overflowY = 'scroll';
|
|
|
|
|
2020-12-18 19:55:52 -06:00
|
|
|
if (this.$store.state.widgets.length === 0) {
|
|
|
|
this.$store.set('widgets', [{
|
2020-10-17 06:12:00 -05:00
|
|
|
name: 'calendar',
|
2021-07-24 23:07:08 -05:00
|
|
|
id: 'a', place: null, data: {}
|
2020-10-17 06:12:00 -05:00
|
|
|
}, {
|
|
|
|
name: 'notifications',
|
2021-07-24 23:07:08 -05:00
|
|
|
id: 'b', place: null, data: {}
|
2020-10-17 06:12:00 -05:00
|
|
|
}, {
|
|
|
|
name: 'trends',
|
2021-07-24 23:07:08 -05:00
|
|
|
id: 'c', place: null, data: {}
|
2020-10-17 06:12:00 -05:00
|
|
|
}]);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
2021-04-09 22:40:50 -05:00
|
|
|
window.addEventListener('resize', () => {
|
|
|
|
this.isDesktop = (window.innerWidth >= DESKTOP_THRESHOLD);
|
|
|
|
}, { passive: true });
|
2021-09-04 03:54:24 -05:00
|
|
|
|
|
|
|
if (this.$store.state.aiChanMode) {
|
|
|
|
const iframeRect = this.$refs.live2d.getBoundingClientRect();
|
|
|
|
window.addEventListener('mousemove', ev => {
|
|
|
|
this.$refs.live2d.contentWindow.postMessage({
|
|
|
|
type: 'moveCursor',
|
|
|
|
body: {
|
|
|
|
x: ev.clientX - iframeRect.left,
|
|
|
|
y: ev.clientY - iframeRect.top,
|
|
|
|
}
|
|
|
|
}, '*');
|
|
|
|
}, { passive: true });
|
2021-09-17 08:39:15 -05:00
|
|
|
window.addEventListener('touchmove', ev => {
|
|
|
|
this.$refs.live2d.contentWindow.postMessage({
|
|
|
|
type: 'moveCursor',
|
|
|
|
body: {
|
|
|
|
x: ev.touches[0].clientX - iframeRect.left,
|
|
|
|
y: ev.touches[0].clientY - iframeRect.top,
|
|
|
|
}
|
|
|
|
}, '*');
|
|
|
|
}, { passive: true });
|
2021-09-04 03:54:24 -05:00
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
changePage(page) {
|
|
|
|
if (page == null) return;
|
2021-04-09 22:54:12 -05:00
|
|
|
if (page[symbols.PAGE_INFO]) {
|
|
|
|
this.pageInfo = page[symbols.PAGE_INFO];
|
2020-12-29 20:01:33 -06:00
|
|
|
document.title = `${this.pageInfo.title} | ${instanceName}`;
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-07-18 21:36:35 -05:00
|
|
|
attachSticky(ref) {
|
2021-07-27 07:37:32 -05:00
|
|
|
const sticky = new StickySidebar(this.$refs[ref], this.$store.state.menuDisplay === 'top' ? 0 : 16, this.$store.state.menuDisplay === 'top' ? 60 : 0); // TODO: ヘッダーの高さを60pxと決め打ちしているのを直す
|
2020-10-17 06:12:00 -05:00
|
|
|
window.addEventListener('scroll', () => {
|
|
|
|
sticky.calc(window.scrollY);
|
|
|
|
}, { passive: true });
|
|
|
|
},
|
|
|
|
|
|
|
|
top() {
|
|
|
|
window.scroll({ top: 0, behavior: 'smooth' });
|
|
|
|
},
|
|
|
|
|
|
|
|
onTransition() {
|
|
|
|
if (window._scroll) window._scroll();
|
|
|
|
},
|
|
|
|
|
2022-01-18 06:35:57 -06:00
|
|
|
onContextmenu(ev: MouseEvent) {
|
2021-02-06 09:11:16 -06:00
|
|
|
const isLink = (el: HTMLElement) => {
|
|
|
|
if (el.tagName === 'A') return true;
|
|
|
|
if (el.parentElement) {
|
|
|
|
return isLink(el.parentElement);
|
|
|
|
}
|
|
|
|
};
|
2022-01-18 06:35:57 -06:00
|
|
|
if (isLink(ev.target)) return;
|
|
|
|
if (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes(ev.target.tagName) || ev.target.attributes['contenteditable']) return;
|
2021-01-11 03:49:39 -06:00
|
|
|
if (window.getSelection().toString() !== '') return;
|
2020-11-02 19:06:19 -06:00
|
|
|
const path = this.$route.path;
|
2020-10-24 19:26:19 -05:00
|
|
|
os.contextMenu([{
|
|
|
|
type: 'label',
|
2020-11-02 19:06:19 -06:00
|
|
|
text: path,
|
2021-04-11 10:05:13 -05:00
|
|
|
}, {
|
2021-04-20 09:22:59 -05:00
|
|
|
icon: this.fullView ? 'fas fa-compress' : 'fas fa-expand',
|
2021-04-11 10:05:13 -05:00
|
|
|
text: this.fullView ? this.$ts.quitFullView : this.$ts.fullView,
|
|
|
|
action: () => {
|
|
|
|
this.fullView = !this.fullView;
|
|
|
|
}
|
2020-10-24 19:26:19 -05:00
|
|
|
}, {
|
2021-04-20 09:22:59 -05:00
|
|
|
icon: 'fas fa-window-maximize',
|
2020-12-25 19:47:36 -06:00
|
|
|
text: this.$ts.openInWindow,
|
2020-10-24 19:26:19 -05:00
|
|
|
action: () => {
|
2020-11-02 19:06:19 -06:00
|
|
|
os.pageWindow(path);
|
2020-10-24 19:26:19 -05:00
|
|
|
}
|
2022-01-18 06:35:57 -06:00
|
|
|
}], ev);
|
2020-10-24 19:26:19 -05:00
|
|
|
},
|
2021-09-04 03:54:24 -05:00
|
|
|
|
|
|
|
onAiClick(ev) {
|
|
|
|
//if (this.live2d) this.live2d.click(ev);
|
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.tray-enter-active,
|
|
|
|
.tray-leave-active {
|
|
|
|
opacity: 1;
|
|
|
|
transform: translateX(0);
|
|
|
|
transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1), opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
|
|
}
|
|
|
|
.tray-enter-from,
|
|
|
|
.tray-leave-active {
|
|
|
|
opacity: 0;
|
|
|
|
transform: translateX(240px);
|
|
|
|
}
|
|
|
|
|
|
|
|
.tray-back-enter-active,
|
|
|
|
.tray-back-leave-active {
|
|
|
|
opacity: 1;
|
|
|
|
transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
|
|
}
|
|
|
|
.tray-back-enter-from,
|
|
|
|
.tray-back-leave-active {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
2021-12-03 07:09:40 -06:00
|
|
|
.gbhvwtnk {
|
2021-04-09 22:40:50 -05:00
|
|
|
$ui-font-size: 1em;
|
|
|
|
$widgets-hide-threshold: 1200px;
|
2020-10-17 06:12:00 -05:00
|
|
|
|
|
|
|
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
|
|
|
min-height: calc(var(--vh, 1vh) * 100);
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
2020-11-27 22:30:09 -06:00
|
|
|
&.wallpaper {
|
|
|
|
background: var(--wallpaperOverlay);
|
2021-08-11 08:34:45 -05:00
|
|
|
//backdrop-filter: var(--blur, blur(4px));
|
2020-11-27 22:30:09 -06:00
|
|
|
}
|
|
|
|
|
2021-04-09 22:40:50 -05:00
|
|
|
> .columns {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
max-width: 100%;
|
2021-04-22 21:31:43 -05:00
|
|
|
//margin: 32px 0;
|
2021-04-09 22:40:50 -05:00
|
|
|
|
2021-04-11 10:05:13 -05:00
|
|
|
&.fullView {
|
|
|
|
margin: 0;
|
|
|
|
|
|
|
|
> .sidebar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .widgets {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
|
|
|
margin: 0;
|
|
|
|
border-radius: 0;
|
|
|
|
box-shadow: none;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-09 22:40:50 -05:00
|
|
|
> .main {
|
2021-04-12 11:59:18 -05:00
|
|
|
min-width: 0;
|
2021-04-09 22:40:50 -05:00
|
|
|
width: 750px;
|
|
|
|
margin: 0 16px 0 0;
|
2021-08-05 08:43:14 -05:00
|
|
|
background: var(--panel);
|
2021-08-07 08:06:50 -05:00
|
|
|
border-left: solid 1px var(--divider);
|
|
|
|
border-right: solid 1px var(--divider);
|
2021-04-22 21:31:43 -05:00
|
|
|
border-radius: 0;
|
2021-08-07 08:06:50 -05:00
|
|
|
overflow: clip;
|
2021-04-09 22:40:50 -05:00
|
|
|
--margin: 12px;
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
2020-10-24 11:21:41 -05:00
|
|
|
|
2021-04-09 22:40:50 -05:00
|
|
|
> .widgets {
|
2021-07-27 07:37:32 -05:00
|
|
|
//--panelBorder: none;
|
2021-04-16 01:44:17 -05:00
|
|
|
width: 300px;
|
2021-04-22 21:31:43 -05:00
|
|
|
margin-top: 16px;
|
2020-10-17 06:12:00 -05:00
|
|
|
|
2021-04-09 22:40:50 -05:00
|
|
|
@media (max-width: $widgets-hide-threshold) {
|
|
|
|
display: none;
|
|
|
|
}
|
2021-07-18 21:36:35 -05:00
|
|
|
|
|
|
|
&.left {
|
|
|
|
margin-right: 16px;
|
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
|
2021-04-22 21:31:43 -05:00
|
|
|
> .sidebar {
|
|
|
|
margin-top: 16px;
|
|
|
|
}
|
|
|
|
|
2021-07-18 21:36:35 -05:00
|
|
|
&.withGlobalHeader {
|
|
|
|
> .main {
|
2021-07-27 07:37:32 -05:00
|
|
|
margin-top: 0;
|
2021-08-07 08:06:50 -05:00
|
|
|
border: solid 1px var(--divider);
|
2021-07-18 21:36:35 -05:00
|
|
|
border-radius: var(--radius);
|
2021-10-08 22:33:08 -05:00
|
|
|
--stickyTop: var(--globalHeaderHeight);
|
2021-07-18 21:36:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
> .widgets {
|
|
|
|
--stickyTop: var(--globalHeaderHeight);
|
2021-07-27 07:37:32 -05:00
|
|
|
margin-top: 0;
|
2021-07-18 21:36:35 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-09 22:40:50 -05:00
|
|
|
@media (max-width: 850px) {
|
|
|
|
margin: 0;
|
|
|
|
|
|
|
|
> .sidebar {
|
|
|
|
border-right: solid 0.5px var(--divider);
|
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
|
2021-04-09 22:40:50 -05:00
|
|
|
> .main {
|
|
|
|
margin: 0;
|
|
|
|
border-radius: 0;
|
|
|
|
box-shadow: none;
|
|
|
|
width: 100%;
|
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .tray-back {
|
|
|
|
z-index: 1001;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .tray {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 1001;
|
|
|
|
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
|
|
|
height: calc(var(--vh, 1vh) * 100);
|
|
|
|
padding: var(--margin);
|
|
|
|
box-sizing: border-box;
|
|
|
|
overflow: auto;
|
|
|
|
background: var(--bg);
|
|
|
|
}
|
2021-09-04 03:54:24 -05:00
|
|
|
|
|
|
|
> .ivnzpscs {
|
|
|
|
position: fixed;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
width: 300px;
|
|
|
|
height: 600px;
|
|
|
|
border: none;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
|
|
|
</style>
|