diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-11-13 18:05:35 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-11-13 18:05:35 +0900 |
| commit | bc9a8283c66d7588f931d4b802f7ab1fa7aa3226 (patch) | |
| tree | cac529d136737c95b1656564756da8c4ae84df32 /src/web/app/desktop | |
| parent | :v: (diff) | |
| download | misskey-bc9a8283c66d7588f931d4b802f7ab1fa7aa3226.tar.gz misskey-bc9a8283c66d7588f931d4b802f7ab1fa7aa3226.tar.bz2 misskey-bc9a8283c66d7588f931d4b802f7ab1fa7aa3226.zip | |
なんかもうめっちゃ変えた
Diffstat (limited to 'src/web/app/desktop')
| -rw-r--r-- | src/web/app/desktop/mixins/index.ts (renamed from src/web/app/desktop/mixins/index.js) | 0 | ||||
| -rw-r--r-- | src/web/app/desktop/mixins/user-preview.ts (renamed from src/web/app/desktop/mixins/user-preview.js) | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/mixins/widget.ts (renamed from src/web/app/desktop/mixins/widget.js) | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/router.ts (renamed from src/web/app/desktop/router.js) | 6 | ||||
| -rw-r--r-- | src/web/app/desktop/script.ts (renamed from src/web/app/desktop/script.js) | 8 | ||||
| -rw-r--r-- | src/web/app/desktop/scripts/autocomplete.ts (renamed from src/web/app/desktop/scripts/autocomplete.js) | 26 | ||||
| -rw-r--r-- | src/web/app/desktop/scripts/dialog.ts (renamed from src/web/app/desktop/scripts/dialog.js) | 4 | ||||
| -rw-r--r-- | src/web/app/desktop/scripts/fuck-ad-block.ts (renamed from src/web/app/desktop/scripts/fuck-ad-block.js) | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/scripts/input-dialog.ts (renamed from src/web/app/desktop/scripts/input-dialog.js) | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/scripts/not-implemented-exception.ts (renamed from src/web/app/desktop/scripts/not-implemented-exception.js) | 0 | ||||
| -rw-r--r-- | src/web/app/desktop/scripts/notify.ts (renamed from src/web/app/desktop/scripts/notify.js) | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/scripts/password-dialog.ts (renamed from src/web/app/desktop/scripts/password-dialog.js) | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/scripts/update-avatar.ts (renamed from src/web/app/desktop/scripts/update-avatar.js) | 8 | ||||
| -rw-r--r-- | src/web/app/desktop/scripts/update-banner.ts (renamed from src/web/app/desktop/scripts/update-banner.js) | 8 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/autocomplete-suggestion.tag | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/drive/browser.tag | 4 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/drive/folder.tag | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/drive/nav-folder.tag | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/index.ts (renamed from src/web/app/desktop/tags/index.js) | 0 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/post-detail-sub.tag | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/post-detail.tag | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/post-form.tag | 6 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/sub-post-content.tag | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/timeline.tag | 2 |
24 files changed, 50 insertions, 46 deletions
diff --git a/src/web/app/desktop/mixins/index.js b/src/web/app/desktop/mixins/index.ts index e0c94ec5ee..e0c94ec5ee 100644 --- a/src/web/app/desktop/mixins/index.js +++ b/src/web/app/desktop/mixins/index.ts diff --git a/src/web/app/desktop/mixins/user-preview.js b/src/web/app/desktop/mixins/user-preview.ts index 3f483beb3a..614de72bea 100644 --- a/src/web/app/desktop/mixins/user-preview.js +++ b/src/web/app/desktop/mixins/user-preview.ts @@ -52,7 +52,7 @@ function attach(el) { clearTimeout(showTimer); hideTimer = setTimeout(close, 500); }); - tag = riot.mount(document.body.appendChild(preview), { + tag = (riot as any).mount(document.body.appendChild(preview), { user: user })[0]; }; diff --git a/src/web/app/desktop/mixins/widget.js b/src/web/app/desktop/mixins/widget.ts index cb04295fc5..04131cd8f0 100644 --- a/src/web/app/desktop/mixins/widget.js +++ b/src/web/app/desktop/mixins/widget.ts @@ -3,7 +3,7 @@ import * as riot from 'riot'; // ミックスインにオプションを渡せないのアレ // SEE: https://github.com/riot/riot/issues/2434 -riot.mixin('widget', { +(riot as any).mixin('widget', { init: function() { this.mixin('i'); this.mixin('api'); diff --git a/src/web/app/desktop/router.js b/src/web/app/desktop/router.ts index 4675b967d6..a74299b281 100644 --- a/src/web/app/desktop/router.js +++ b/src/web/app/desktop/router.ts @@ -3,7 +3,7 @@ */ import * as riot from 'riot'; -const route = require('page'); +import * as route from 'page'; let page = null; export default me => { @@ -83,12 +83,12 @@ export default me => { mount(document.createElement('mk-not-found')); } - riot.mixin('page', { + (riot as any).mixin('page', { page: route }); // EXEC - route(); + (route as any)(); }; function mount(content) { diff --git a/src/web/app/desktop/script.js b/src/web/app/desktop/script.ts index 46a7fce700..a0453865ec 100644 --- a/src/web/app/desktop/script.js +++ b/src/web/app/desktop/script.ts @@ -11,7 +11,7 @@ import * as riot from 'riot'; import init from '../init'; import route from './router'; import fuckAdBlock from './scripts/fuck-ad-block'; -import getPostSummary from '../../../common/get-post-summary.ts'; +import getPostSummary from '../../../common/get-post-summary'; /** * init @@ -27,11 +27,11 @@ init(async (me, stream) => { */ if ('Notification' in window) { // 許可を得ていなかったらリクエスト - if (Notification.permission == 'default') { + if ((Notification as any).permission == 'default') { await Notification.requestPermission(); } - if (Notification.permission == 'granted') { + if ((Notification as any).permission == 'granted') { registerNotifications(stream); } } @@ -82,7 +82,7 @@ function registerNotifications(stream) { }); n.onclick = () => { n.close(); - riot.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 }); }; diff --git a/src/web/app/desktop/scripts/autocomplete.js b/src/web/app/desktop/scripts/autocomplete.ts index 8ca516e2a9..9df7aae08d 100644 --- a/src/web/app/desktop/scripts/autocomplete.js +++ b/src/web/app/desktop/scripts/autocomplete.ts @@ -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; diff --git a/src/web/app/desktop/scripts/dialog.js b/src/web/app/desktop/scripts/dialog.ts index c502d3fcb8..816ba4b5f5 100644 --- a/src/web/app/desktop/scripts/dialog.js +++ b/src/web/app/desktop/scripts/dialog.ts @@ -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, diff --git a/src/web/app/desktop/scripts/fuck-ad-block.js b/src/web/app/desktop/scripts/fuck-ad-block.ts index ccfc43ce6e..3307ba2f30 100644 --- a/src/web/app/desktop/scripts/fuck-ad-block.js +++ b/src/web/app/desktop/scripts/fuck-ad-block.ts @@ -1,6 +1,8 @@ require('fuckadblock'); import dialog from './dialog'; +declare var fuckAdBlock: any; + export default () => { if (fuckAdBlock === undefined) { adBlockDetected(); diff --git a/src/web/app/desktop/scripts/input-dialog.js b/src/web/app/desktop/scripts/input-dialog.ts index 954fabfb67..b06d011c6b 100644 --- a/src/web/app/desktop/scripts/input-dialog.js +++ b/src/web/app/desktop/scripts/input-dialog.ts @@ -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, diff --git a/src/web/app/desktop/scripts/not-implemented-exception.js b/src/web/app/desktop/scripts/not-implemented-exception.ts index dd00c7662f..dd00c7662f 100644 --- a/src/web/app/desktop/scripts/not-implemented-exception.js +++ b/src/web/app/desktop/scripts/not-implemented-exception.ts diff --git a/src/web/app/desktop/scripts/notify.js b/src/web/app/desktop/scripts/notify.ts index e58a8e4d36..2e6cbdeed8 100644 --- a/src/web/app/desktop/scripts/notify.js +++ b/src/web/app/desktop/scripts/notify.ts @@ -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 }); }; diff --git a/src/web/app/desktop/scripts/password-dialog.js b/src/web/app/desktop/scripts/password-dialog.ts index 2bdc93e421..39d7f3db7a 100644 --- a/src/web/app/desktop/scripts/password-dialog.js +++ b/src/web/app/desktop/scripts/password-dialog.ts @@ -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, diff --git a/src/web/app/desktop/scripts/update-avatar.js b/src/web/app/desktop/scripts/update-avatar.ts index 165c90567c..5fd7f2d3d1 100644 --- a/src/web/app/desktop/scripts/update-avatar.js +++ b/src/web/app/desktop/scripts/update-avatar.ts @@ -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]; diff --git a/src/web/app/desktop/scripts/update-banner.js b/src/web/app/desktop/scripts/update-banner.ts index d83b2bf1b1..23a671c44d 100644 --- a/src/web/app/desktop/scripts/update-banner.js +++ b/src/web/app/desktop/scripts/update-banner.ts @@ -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]; diff --git a/src/web/app/desktop/tags/autocomplete-suggestion.tag b/src/web/app/desktop/tags/autocomplete-suggestion.tag index b936360402..7311606694 100644 --- a/src/web/app/desktop/tags/autocomplete-suggestion.tag +++ b/src/web/app/desktop/tags/autocomplete-suggestion.tag @@ -177,7 +177,7 @@ }; this.applySelect = () => { - this.refs.users.children.forEach(el => { + Array.from(this.refs.users.children).forEach(el => { el.removeAttribute('data-selected'); }); diff --git a/src/web/app/desktop/tags/drive/browser.tag b/src/web/app/desktop/tags/drive/browser.tag index be16a782d7..18e27f24bc 100644 --- a/src/web/app/desktop/tags/drive/browser.tag +++ b/src/web/app/desktop/tags/drive/browser.tag @@ -408,7 +408,7 @@ // ドロップされてきたものがファイルだったら if (e.dataTransfer.files.length > 0) { - e.dataTransfer.files.forEach(file => { + Array.from(e.dataTransfer.files).forEach(file => { this.upload(file, this.folder); }); return false; @@ -510,7 +510,7 @@ }; this.changeFileInput = () => { - this.refs.fileInput.files.forEach(file => { + Array.from(this.refs.fileInput.files).forEach(file => { this.upload(file, this.folder); }); }; diff --git a/src/web/app/desktop/tags/drive/folder.tag b/src/web/app/desktop/tags/drive/folder.tag index e03c4e3534..1c361c8e4d 100644 --- a/src/web/app/desktop/tags/drive/folder.tag +++ b/src/web/app/desktop/tags/drive/folder.tag @@ -109,7 +109,7 @@ // ファイルだったら if (e.dataTransfer.files.length > 0) { - e.dataTransfer.files.forEach(file => { + Array.from(e.dataTransfer.files).forEach(file => { this.browser.upload(file, this.folder); }); return false; diff --git a/src/web/app/desktop/tags/drive/nav-folder.tag b/src/web/app/desktop/tags/drive/nav-folder.tag index c89d9edc1c..0a9421353c 100644 --- a/src/web/app/desktop/tags/drive/nav-folder.tag +++ b/src/web/app/desktop/tags/drive/nav-folder.tag @@ -55,7 +55,7 @@ // ファイルだったら if (e.dataTransfer.files.length > 0) { - e.dataTransfer.files.forEach(file => { + Array.from(e.dataTransfer.files).forEach(file => { this.browser.upload(file, this.folder); }); return false; diff --git a/src/web/app/desktop/tags/index.js b/src/web/app/desktop/tags/index.ts index 15677471c3..15677471c3 100644 --- a/src/web/app/desktop/tags/index.js +++ b/src/web/app/desktop/tags/index.ts diff --git a/src/web/app/desktop/tags/post-detail-sub.tag b/src/web/app/desktop/tags/post-detail-sub.tag index 8a0ada5f2a..e22386df91 100644 --- a/src/web/app/desktop/tags/post-detail-sub.tag +++ b/src/web/app/desktop/tags/post-detail-sub.tag @@ -129,7 +129,7 @@ this.refs.text.innerHTML = compile(tokens); - this.refs.text.children.forEach(e => { + Array.from(this.refs.text.children).forEach(e => { if (e.tagName == 'MK-URL') riot.mount(e); }); } diff --git a/src/web/app/desktop/tags/post-detail.tag b/src/web/app/desktop/tags/post-detail.tag index ce7f81e32c..1a0eefe13e 100644 --- a/src/web/app/desktop/tags/post-detail.tag +++ b/src/web/app/desktop/tags/post-detail.tag @@ -273,7 +273,7 @@ this.refs.text.innerHTML = compile(tokens); - this.refs.text.children.forEach(e => { + Array.from(this.refs.text.children).forEach(e => { if (e.tagName == 'MK-URL') riot.mount(e); }); diff --git a/src/web/app/desktop/tags/post-form.tag b/src/web/app/desktop/tags/post-form.tag index 5041078bee..e49beeedbc 100644 --- a/src/web/app/desktop/tags/post-form.tag +++ b/src/web/app/desktop/tags/post-form.tag @@ -405,7 +405,7 @@ // ファイルだったら if (e.dataTransfer.files.length > 0) { - e.dataTransfer.files.forEach(this.upload); + Array.from(e.dataTransfer.files).forEach(this.upload); } }; @@ -414,7 +414,7 @@ }; this.onpaste = e => { - e.clipboardData.items.forEach(item => { + Array.from(e.clipboardData.items).forEach(item => { if (item.kind == 'file') { this.upload(item.getAsFile()); } @@ -435,7 +435,7 @@ }; this.changeFile = () => { - this.refs.file.files.forEach(this.upload); + Array.from(this.refs.file.files).forEach(this.upload); }; this.upload = file => { diff --git a/src/web/app/desktop/tags/sub-post-content.tag b/src/web/app/desktop/tags/sub-post-content.tag index c75ae2911c..86269fdbe9 100644 --- a/src/web/app/desktop/tags/sub-post-content.tag +++ b/src/web/app/desktop/tags/sub-post-content.tag @@ -45,7 +45,7 @@ const tokens = this.post.ast; this.refs.text.innerHTML = compile(tokens, false); - this.refs.text.children.forEach(e => { + Array.from(this.refs.text.children).forEach(e => { if (e.tagName == 'MK-URL') riot.mount(e); }); } diff --git a/src/web/app/desktop/tags/timeline.tag b/src/web/app/desktop/tags/timeline.tag index 44f3d5d8ec..5e3b883b47 100644 --- a/src/web/app/desktop/tags/timeline.tag +++ b/src/web/app/desktop/tags/timeline.tag @@ -498,7 +498,7 @@ this.refs.text.innerHTML = this.refs.text.innerHTML.replace('<p class="dummy"></p>', compile(tokens)); - this.refs.text.children.forEach(e => { + Array.from(this.refs.text.children).forEach(e => { if (e.tagName == 'MK-URL') riot.mount(e); }); |