なんかもうめっちゃ変えた

This commit is contained in:
syuilo 2017-11-13 18:05:35 +09:00
parent f8dddc81e2
commit bc9a8283c6
77 changed files with 170 additions and 165 deletions

View file

@ -1,10 +1,12 @@
const getCaretCoordinates = require('textarea-caret');
import getCaretCoordinates = require('textarea-caret');
import * as riot from 'riot';
/**
*
*/
class Autocomplete {
private suggestion: any;
private textarea: any;
/**
*
@ -23,22 +25,22 @@ class Autocomplete {
/**
*
*/
attach() {
public attach() {
this.textarea.addEventListener('input', this.onInput);
}
/**
*
*/
detach() {
public detach() {
this.textarea.removeEventListener('input', this.onInput);
this.close();
}
/**
* [Private]
*
*/
onInput() {
private onInput() {
this.close();
const caret = this.textarea.selectionStart;
@ -56,9 +58,9 @@ class Autocomplete {
}
/**
* [Private]
*
*/
open(type, q) {
private open(type, q) {
// 既に開いているサジェストは閉じる
this.close();
@ -81,7 +83,7 @@ class Autocomplete {
const el = document.body.appendChild(tag);
// マウント
this.suggestion = riot.mount(el, {
this.suggestion = (riot as any).mount(el, {
textarea: this.textarea,
complete: this.complete,
close: this.close,
@ -91,9 +93,9 @@ class Autocomplete {
}
/**
* [Private]
*
*/
close() {
private close() {
if (this.suggestion == null) return;
this.suggestion.unmount();
@ -103,9 +105,9 @@ class Autocomplete {
}
/**
* [Private]
*
*/
complete(user) {
private complete(user) {
this.close();
const value = user.username;

View file

@ -1,9 +1,9 @@
import * as riot from 'riot';
export default (title, text, buttons, canThrough, onThrough) => {
export default (title, text, buttons, canThrough?, onThrough?) => {
const dialog = document.body.appendChild(document.createElement('mk-dialog'));
const controller = riot.observable();
riot.mount(dialog, {
(riot as any).mount(dialog, {
controller: controller,
title: title,
text: text,

View file

@ -1,6 +1,8 @@
require('fuckadblock');
import dialog from './dialog';
declare var fuckAdBlock: any;
export default () => {
if (fuckAdBlock === undefined) {
adBlockDetected();

View file

@ -2,7 +2,7 @@ import * as riot from 'riot';
export default (title, placeholder, defaultValue, onOk, onCancel) => {
const dialog = document.body.appendChild(document.createElement('mk-input-dialog'));
return riot.mount(dialog, {
return (riot as any).mount(dialog, {
title: title,
placeholder: placeholder,
'default': defaultValue,

View file

@ -2,7 +2,7 @@ import * as riot from 'riot';
export default message => {
const notification = document.body.appendChild(document.createElement('mk-ui-notification'));
riot.mount(notification, {
(riot as any).mount(notification, {
message: message
});
};

View file

@ -2,7 +2,7 @@ import * as riot from 'riot';
export default (title, onOk, onCancel) => {
const dialog = document.body.appendChild(document.createElement('mk-input-dialog'));
return riot.mount(dialog, {
return (riot as any).mount(dialog, {
title: title,
type: 'password',
onOk: onOk,

View file

@ -5,7 +5,7 @@ import api from '../../common/scripts/api';
export default (I, cb, file = null) => {
const fileSelected = file => {
const cropper = riot.mount(document.body.appendChild(document.createElement('mk-crop-window')), {
const cropper = (riot as any).mount(document.body.appendChild(document.createElement('mk-crop-window')), {
file: file,
title: 'アバターとして表示する部分を選択',
aspectRatio: 1 / 1
@ -37,7 +37,7 @@ export default (I, cb, file = null) => {
};
const upload = (data, folder) => {
const progress = riot.mount(document.body.appendChild(document.createElement('mk-progress-dialog')), {
const progress = (riot as any).mount(document.body.appendChild(document.createElement('mk-progress-dialog')), {
title: '新しいアバターをアップロードしています'
})[0];
@ -46,7 +46,7 @@ export default (I, cb, file = null) => {
const xhr = new XMLHttpRequest();
xhr.open('POST', CONFIG.apiUrl + '/drive/files/create', true);
xhr.onload = e => {
const file = JSON.parse(e.target.response);
const file = JSON.parse((e.target as any).response);
progress.close();
set(file);
};
@ -75,7 +75,7 @@ export default (I, cb, file = null) => {
if (file) {
fileSelected(file);
} else {
const browser = riot.mount(document.body.appendChild(document.createElement('mk-select-file-from-drive-window')), {
const browser = (riot as any).mount(document.body.appendChild(document.createElement('mk-select-file-from-drive-window')), {
multiple: false,
title: '<i class="fa fa-picture-o"></i>アバターにする画像を選択'
})[0];

View file

@ -5,7 +5,7 @@ import api from '../../common/scripts/api';
export default (I, cb, file = null) => {
const fileSelected = file => {
const cropper = riot.mount(document.body.appendChild(document.createElement('mk-crop-window')), {
const cropper = (riot as any).mount(document.body.appendChild(document.createElement('mk-crop-window')), {
file: file,
title: 'バナーとして表示する部分を選択',
aspectRatio: 16 / 9
@ -37,7 +37,7 @@ export default (I, cb, file = null) => {
};
const upload = (data, folder) => {
const progress = riot.mount(document.body.appendChild(document.createElement('mk-progress-dialog')), {
const progress = (riot as any).mount(document.body.appendChild(document.createElement('mk-progress-dialog')), {
title: '新しいバナーをアップロードしています'
})[0];
@ -46,7 +46,7 @@ export default (I, cb, file = null) => {
const xhr = new XMLHttpRequest();
xhr.open('POST', CONFIG.apiUrl + '/drive/files/create', true);
xhr.onload = e => {
const file = JSON.parse(e.target.response);
const file = JSON.parse((e.target as any).response);
progress.close();
set(file);
};
@ -75,7 +75,7 @@ export default (I, cb, file = null) => {
if (file) {
fileSelected(file);
} else {
const browser = riot.mount(document.body.appendChild(document.createElement('mk-select-file-from-drive-window')), {
const browser = (riot as any).mount(document.body.appendChild(document.createElement('mk-select-file-from-drive-window')), {
multiple: false,
title: '<i class="fa fa-picture-o"></i>バナーにする画像を選択'
})[0];