diff options
Diffstat (limited to 'src/web/app')
| -rw-r--r-- | src/web/app/desktop/mixins/index.ts | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/mixins/user-preview.ts | 66 | ||||
| -rw-r--r-- | src/web/app/desktop/mixins/widget.ts | 31 | ||||
| -rw-r--r-- | src/web/app/desktop/script.ts | 12 | ||||
| -rw-r--r-- | src/web/app/desktop/scripts/autocomplete.ts | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/pages/index.vue | 3 | ||||
| -rw-r--r-- | src/web/app/init.ts | 2 | ||||
| -rw-r--r-- | src/web/app/tsconfig.json | 23 | ||||
| -rw-r--r-- | src/web/app/v.d.ts | 4 |
9 files changed, 39 insertions, 106 deletions
diff --git a/src/web/app/desktop/mixins/index.ts b/src/web/app/desktop/mixins/index.ts deleted file mode 100644 index e0c94ec5ee..0000000000 --- a/src/web/app/desktop/mixins/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -require('./user-preview'); -require('./widget'); diff --git a/src/web/app/desktop/mixins/user-preview.ts b/src/web/app/desktop/mixins/user-preview.ts deleted file mode 100644 index 614de72bea..0000000000 --- a/src/web/app/desktop/mixins/user-preview.ts +++ /dev/null @@ -1,66 +0,0 @@ -import * as riot from 'riot'; - -riot.mixin('user-preview', { - init: function() { - const scan = () => { - this.root.querySelectorAll('[data-user-preview]:not([data-user-preview-attached])') - .forEach(attach.bind(this)); - }; - this.on('mount', scan); - this.on('updated', scan); - } -}); - -function attach(el) { - el.setAttribute('data-user-preview-attached', true); - - const user = el.getAttribute('data-user-preview'); - let tag = null; - let showTimer = null; - let hideTimer = null; - - el.addEventListener('mouseover', () => { - clearTimeout(showTimer); - clearTimeout(hideTimer); - showTimer = setTimeout(show, 500); - }); - - el.addEventListener('mouseleave', () => { - clearTimeout(showTimer); - clearTimeout(hideTimer); - hideTimer = setTimeout(close, 500); - }); - - this.on('unmount', () => { - clearTimeout(showTimer); - clearTimeout(hideTimer); - close(); - }); - - const show = () => { - if (tag) return; - const preview = document.createElement('mk-user-preview'); - const rect = el.getBoundingClientRect(); - const x = rect.left + el.offsetWidth + window.pageXOffset; - const y = rect.top + window.pageYOffset; - preview.style.top = y + 'px'; - preview.style.left = x + 'px'; - preview.addEventListener('mouseover', () => { - clearTimeout(hideTimer); - }); - preview.addEventListener('mouseleave', () => { - clearTimeout(showTimer); - hideTimer = setTimeout(close, 500); - }); - tag = (riot as any).mount(document.body.appendChild(preview), { - user: user - })[0]; - }; - - const close = () => { - if (tag) { - tag.close(); - tag = null; - } - }; -} diff --git a/src/web/app/desktop/mixins/widget.ts b/src/web/app/desktop/mixins/widget.ts deleted file mode 100644 index 04131cd8f0..0000000000 --- a/src/web/app/desktop/mixins/widget.ts +++ /dev/null @@ -1,31 +0,0 @@ -import * as riot from 'riot'; - -// ミックスインにオプションを渡せないのアレ -// SEE: https://github.com/riot/riot/issues/2434 - -(riot as any).mixin('widget', { - init: function() { - this.mixin('i'); - this.mixin('api'); - - this.id = this.opts.id; - this.place = this.opts.place; - - if (this.data) { - Object.keys(this.data).forEach(prop => { - this.data[prop] = this.opts.data.hasOwnProperty(prop) ? this.opts.data[prop] : this.data[prop]; - }); - } - }, - - save: function() { - this.update(); - this.api('i/update_home', { - id: this.id, - data: this.data - }).then(() => { - this.I.client_settings.home.find(w => w.id == this.id).data = this.data; - this.I.update(); - }); - } -}); diff --git a/src/web/app/desktop/script.ts b/src/web/app/desktop/script.ts index 2d3714d845..4aef69b077 100644 --- a/src/web/app/desktop/script.ts +++ b/src/web/app/desktop/script.ts @@ -7,12 +7,13 @@ import './style.styl'; import Vue from 'vue'; import init from '../init'; -import route from './router'; import fuckAdBlock from './scripts/fuck-ad-block'; import MiOS from '../common/mios'; import HomeStreamManager from '../common/scripts/streaming/home-stream-manager'; import composeNotification from '../common/scripts/compose-notification'; +import MkIndex from './tags/pages/index.vue'; + /** * init */ @@ -36,8 +37,9 @@ init(async (mios: MiOS, app: Vue) => { } } - // Start routing - route(mios); + app.$router.addRoutes([{ + path: '/', component: MkIndex, props: { os: mios } + }]); }, true); function registerNotifications(stream: HomeStreamManager) { @@ -96,9 +98,9 @@ function registerNotifications(stream: HomeStreamManager) { }); n.onclick = () => { n.close(); - (riot as any).mount(document.body.appendChild(document.createElement('mk-messaging-room-window')), { + /*(riot as any).mount(document.body.appendChild(document.createElement('mk-messaging-room-window')), { user: message.user - }); + });*/ }; setTimeout(n.close.bind(n), 7000); }); diff --git a/src/web/app/desktop/scripts/autocomplete.ts b/src/web/app/desktop/scripts/autocomplete.ts index 9df7aae08d..8f075efdd1 100644 --- a/src/web/app/desktop/scripts/autocomplete.ts +++ b/src/web/app/desktop/scripts/autocomplete.ts @@ -1,4 +1,4 @@ -import getCaretCoordinates = require('textarea-caret'); +import getCaretCoordinates from 'textarea-caret'; import * as riot from 'riot'; /** diff --git a/src/web/app/desktop/tags/pages/index.vue b/src/web/app/desktop/tags/pages/index.vue new file mode 100644 index 0000000000..6bd036fc22 --- /dev/null +++ b/src/web/app/desktop/tags/pages/index.vue @@ -0,0 +1,3 @@ +<template> + <h1>hi</h1> +</template> diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 5fb6ae7908..f0c36f6c12 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -5,7 +5,7 @@ declare const _VERSION_: string; declare const _LANG_: string; declare const _HOST_: string; -declare const __CONSTS__: any; +//declare const __CONSTS__: any; import Vue from 'vue'; import VueRouter from 'vue-router'; diff --git a/src/web/app/tsconfig.json b/src/web/app/tsconfig.json new file mode 100644 index 0000000000..e31b52dab1 --- /dev/null +++ b/src/web/app/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "allowJs": true, + "noEmitOnError": false, + "noImplicitAny": false, + "noImplicitReturns": true, + "noUnusedParameters": false, + "noUnusedLocals": true, + "noFallthroughCasesInSwitch": true, + "declaration": false, + "sourceMap": false, + "target": "es2017", + "module": "commonjs", + "removeComments": false, + "noLib": false, + "strict": true, + "strictNullChecks": false + }, + "compileOnSave": false, + "include": [ + "./**/*.ts" + ] +} diff --git a/src/web/app/v.d.ts b/src/web/app/v.d.ts new file mode 100644 index 0000000000..8f3a240d80 --- /dev/null +++ b/src/web/app/v.d.ts @@ -0,0 +1,4 @@ +declare module "*.vue" { + import Vue from 'vue'; + export default Vue; +} |