wip
This commit is contained in:
@ -305,7 +305,7 @@ class TlContext extends Context {
|
||||
private async getTl() {
|
||||
const tl = await require('../endpoints/posts/timeline')({
|
||||
limit: 5,
|
||||
max_id: this.next ? this.next : undefined
|
||||
until_id: this.next ? this.next : undefined
|
||||
}, this.bot.user);
|
||||
|
||||
if (tl.length > 0) {
|
||||
@ -357,7 +357,7 @@ class NotificationsContext extends Context {
|
||||
private async getNotifications() {
|
||||
const notifications = await require('../endpoints/i/notifications')({
|
||||
limit: 5,
|
||||
max_id: this.next ? this.next : undefined
|
||||
until_id: this.next ? this.next : undefined
|
||||
}, this.bot.user);
|
||||
|
||||
if (notifications.length > 0) {
|
||||
|
@ -17,12 +17,19 @@ export default class Replacer {
|
||||
}
|
||||
|
||||
private get(key: string) {
|
||||
let text = locale[this.lang];
|
||||
const texts = locale[this.lang];
|
||||
|
||||
if (texts == null) {
|
||||
console.warn(`lang '${this.lang}' is not supported`);
|
||||
return key; // Fallback
|
||||
}
|
||||
|
||||
let text;
|
||||
|
||||
// Check the key existance
|
||||
const error = key.split('.').some(k => {
|
||||
if (text.hasOwnProperty(k)) {
|
||||
text = text[k];
|
||||
if (texts.hasOwnProperty(k)) {
|
||||
text = texts[k];
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -1,2 +0,0 @@
|
||||
require('./user-preview');
|
||||
require('./widget');
|
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
@ -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();
|
||||
});
|
||||
}
|
||||
});
|
@ -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);
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import getCaretCoordinates = require('textarea-caret');
|
||||
import getCaretCoordinates from 'textarea-caret';
|
||||
import * as riot from 'riot';
|
||||
|
||||
/**
|
||||
|
3
src/web/app/desktop/tags/pages/index.vue
Normal file
3
src/web/app/desktop/tags/pages/index.vue
Normal file
@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<h1>hi</h1>
|
||||
</template>
|
@ -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';
|
||||
|
@ -19,8 +19,5 @@
|
||||
"compileOnSave": false,
|
||||
"include": [
|
||||
"./**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"./web/app/**/*.ts"
|
||||
]
|
||||
}
|
4
src/web/app/v.d.ts
vendored
Normal file
4
src/web/app/v.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
declare module "*.vue" {
|
||||
import Vue from 'vue';
|
||||
export default Vue;
|
||||
}
|
Reference in New Issue
Block a user