diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-02-20 10:34:57 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-02-20 10:34:57 +0900 |
| commit | 91d8ee5a52ece1cb78e5e3bb74178d41761d540f (patch) | |
| tree | 0c08cdc5739e7250ab724049ff0a327643ed2be9 /src/web/app/common | |
| parent | wip (diff) | |
| download | misskey-91d8ee5a52ece1cb78e5e3bb74178d41761d540f.tar.gz misskey-91d8ee5a52ece1cb78e5e3bb74178d41761d540f.tar.bz2 misskey-91d8ee5a52ece1cb78e5e3bb74178d41761d540f.zip | |
wip
Diffstat (limited to 'src/web/app/common')
| -rw-r--r-- | src/web/app/common/tags/core-error.tag | 2 | ||||
| -rw-r--r-- | src/web/app/common/tags/messaging/form.tag | 12 | ||||
| -rw-r--r-- | src/web/app/common/tags/messaging/index.tag | 6 | ||||
| -rw-r--r-- | src/web/app/common/tags/messaging/room.tag | 30 | ||||
| -rw-r--r-- | src/web/app/common/tags/poll-editor.tag | 10 | ||||
| -rw-r--r-- | src/web/app/common/tags/poll.tag | 4 | ||||
| -rw-r--r-- | src/web/app/common/tags/signin-history.tag | 2 | ||||
| -rw-r--r-- | src/web/app/common/tags/signin.tag | 4 | ||||
| -rw-r--r-- | src/web/app/common/tags/signup.tag | 8 | ||||
| -rw-r--r-- | src/web/app/common/tags/time.tag | 2 | ||||
| -rw-r--r-- | src/web/app/common/tags/uploader.tag | 2 |
11 files changed, 41 insertions, 41 deletions
diff --git a/src/web/app/common/tags/core-error.tag b/src/web/app/common/tags/core-error.tag index b424c8abb7..e74e205afd 100644 --- a/src/web/app/common/tags/core-error.tag +++ b/src/web/app/common/tags/core-error.tag @@ -57,7 +57,7 @@ </style> <script> - retry() { + this.retry = () => { this.unmount(); this.opts.retry(); } diff --git a/src/web/app/common/tags/messaging/form.tag b/src/web/app/common/tags/messaging/form.tag index 4ae1706ff1..8e74fbd350 100644 --- a/src/web/app/common/tags/messaging/form.tag +++ b/src/web/app/common/tags/messaging/form.tag @@ -119,7 +119,7 @@ <script> this.mixin('api'); - onpaste(e) { + this.onpaste = (e) => { const data = e.clipboardData; const items = data.items; for (let i = 0; i < items.length; i++) { @@ -130,17 +130,17 @@ } } - onkeypress(e) { + this.onkeypress = (e) => { if ((e.which == 10 || e.which == 13) && e.ctrlKey) { this.send(); } } - selectFile() { + this.selectFile = () => { this.refs.file.click(); } - selectFileFromDrive() { + this.selectFileFromDrive = () => { const browser = document.body.appendChild(document.createElement('mk-select-file-from-drive-window')); const event = riot.observable(); riot.mount(browser, { @@ -152,7 +152,7 @@ }); } - send() { + this.send = () => { this.sending = true; this.api('messaging/messages/create', { user_id: this.opts.user.id, @@ -166,7 +166,7 @@ this.update(); }); - clear() { + this.clear = () => { this.refs.text.value = ''; this.files = []; this.update(); diff --git a/src/web/app/common/tags/messaging/index.tag b/src/web/app/common/tags/messaging/index.tag index e9a031a2bd..e7d110140a 100644 --- a/src/web/app/common/tags/messaging/index.tag +++ b/src/web/app/common/tags/messaging/index.tag @@ -305,7 +305,7 @@ }); } - search() { + this.search = () => { const q = this.refs.search.value; if (q == '') { this.searchResult = []; @@ -323,7 +323,7 @@ .catch (err) => console.error err - on-search-keydown(e) { + this.on-search-keydown = (e) => { key = e.which switch (key) | 9, 40 => // Key[TAB] or Key[↓] @@ -331,7 +331,7 @@ e.stopPropagation(); this.refs.search-result.childNodes[0].focus(); - on-search-result-keydown(i, e) { + this.on-search-result-keydown = (i, e) => { key = e.which switch (key) | 10, 13 => // Key[ENTER] diff --git a/src/web/app/common/tags/messaging/room.tag b/src/web/app/common/tags/messaging/room.tag index a402585693..f04fd4638d 100644 --- a/src/web/app/common/tags/messaging/room.tag +++ b/src/web/app/common/tags/messaging/room.tag @@ -128,18 +128,18 @@ this.mixin('api'); this.mixin('messaging-stream'); - this.user = this.opts.user - this.init = true - this.sending = false - this.messages = [] + this.user = this.opts.user; + this.init = true; + this.sending = false; + this.messages = []; - this.connection = new @MessagingStreamConnection this.I, @user.id + this.connection = new this.MessagingStreamConnection(this.I, this.user.id); this.on('mount', () => { - @connection.event.on 'message' this.on-message - @connection.event.on 'read' this.on-read + this.connection.event.on('message' this.onMessage); + this.connection.event.on('read' this.onRead); - document.add-event-listener 'visibilitychange' this.on-visibilitychange + document.addEventListener 'visibilitychange' this.on-visibilitychange this.api 'messaging/messages' do user_id: @user.id @@ -156,7 +156,7 @@ @connection.event.off 'read' this.on-read @connection.close! - document.remove-event-listener 'visibilitychange' this.on-visibilitychange + document.removeEventListener 'visibilitychange' this.on-visibilitychange this.on('update', () => { @messages.for-each (message) => @@ -165,7 +165,7 @@ message._date = date message._datetext = month + '月 ' + date + '日' - on-message(message) { + this.on-message = (message) => { is-bottom = @is-bottom! @messages.push message @@ -182,7 +182,7 @@ // Notify @notify '新しいメッセージがあります' - on-read(ids) { + this.on-read = (ids) => { if not Array.isArray ids then ids = [ids] ids.for-each (id) => if (@messages.some (x) => x.id == id) @@ -190,15 +190,15 @@ @messages[exist].is_read = true this.update(); - is-bottom() { + this.is-bottom = () => { current = this.root.scroll-top + this.root.offset-height max = this.root.scroll-height current > (max - 32) - scroll-to-bottom() { + this.scroll-to-bottom = () => { this.root.scroll-top = this.root.scroll-height - notify(message) { + this.notify = (message) => { n = document.createElement 'p' n.inner-HTML = '<i class="fa fa-arrow-circle-down"></i>' + message n.onclick = => @@ -213,7 +213,7 @@ , 1000ms , 4000ms - on-visibilitychange() { + this.on-visibilitychange = () => { if document.hidden then return @messages.for-each (message) => if message.user_id != this.I.id and not message.is_read diff --git a/src/web/app/common/tags/poll-editor.tag b/src/web/app/common/tags/poll-editor.tag index e35d8e1369..9d9b28c763 100644 --- a/src/web/app/common/tags/poll-editor.tag +++ b/src/web/app/common/tags/poll-editor.tag @@ -88,26 +88,26 @@ <script> this.choices = ['', '']; - oninput(i, e) { + this.oninput = (i, e) => { this.choices[i] = e.target.value; } - add() { + this.add = () => { this.choices.push(''); this.update(); this.refs.choices.childNodes[this.choices.length - 1].childNodes[0].focus(); } - remove(i) { + this.remove = (i) => { this.choices = this.choices.filter((_, _i) => _i != i); this.update(); } - destroy() { + this.destroy = () => { this.opts.ondestroy(); } - get() { + this.get = () => { return { choices: this.choices.filter(choice => choice != '') } diff --git a/src/web/app/common/tags/poll.tag b/src/web/app/common/tags/poll.tag index c9209c3a3b..6ddaf77595 100644 --- a/src/web/app/common/tags/poll.tag +++ b/src/web/app/common/tags/poll.tag @@ -76,11 +76,11 @@ this.isVoted = this.poll.choices.some(c => c.is_voted); this.result = this.isVoted; - toggleResult() { + this.toggleResult = () => { this.result = !this.result; } - vote(id) { + this.vote = (id) => { if (this.poll.choices.some(c => c.is_voted)) return; this.api('posts/polls/vote', { post_id: this.post.id, diff --git a/src/web/app/common/tags/signin-history.tag b/src/web/app/common/tags/signin-history.tag index 4b5c844b7f..97087e3473 100644 --- a/src/web/app/common/tags/signin-history.tag +++ b/src/web/app/common/tags/signin-history.tag @@ -68,7 +68,7 @@ this.on('unmount', () => { @stream.off 'signin' this.on-signin - on-signin(signin) { + this.on-signin = (signin) => { @history.unshift signin this.update(); </script> diff --git a/src/web/app/common/tags/signin.tag b/src/web/app/common/tags/signin.tag index 5cb63685fa..e71795708f 100644 --- a/src/web/app/common/tags/signin.tag +++ b/src/web/app/common/tags/signin.tag @@ -102,7 +102,7 @@ this.user = null; this.signing = false; - oninput() { + this.oninput = () => { this.api 'users/show' do username: this.refs.username.value .then (user) => @@ -110,7 +110,7 @@ this.trigger 'user' user this.update(); - onsubmit(e) { + this.onsubmit = (e) => { e.preventDefault(); if this.refs.username.value == '' diff --git a/src/web/app/common/tags/signup.tag b/src/web/app/common/tags/signup.tag index 55b1b76138..f8ac1c19cd 100644 --- a/src/web/app/common/tags/signup.tag +++ b/src/web/app/common/tags/signup.tag @@ -199,7 +199,7 @@ head.appendChild script }); - on-change-username() { + this.on-change-username = () => { username = this.refs.username.value if username == '' @@ -232,7 +232,7 @@ this.username-state = 'error' this.update(); - on-change-password() { + this.on-change-password = () => { password = this.refs.password.value if password == '' @@ -252,7 +252,7 @@ this.refs.password-metar.style.width = (strength * 100) + '%' - on-change-password-retype() { + this.on-change-password-retype = () => { password = this.refs.password.value retyped-password = this.refs.password-retype.value @@ -265,7 +265,7 @@ else this.password-retype-state = 'not-match' - onsubmit(e) { + this.onsubmit = (e) => { e.preventDefault(); username = this.refs.username.value diff --git a/src/web/app/common/tags/time.tag b/src/web/app/common/tags/time.tag index 9bdb7f4cd7..1311133539 100644 --- a/src/web/app/common/tags/time.tag +++ b/src/web/app/common/tags/time.tag @@ -22,7 +22,7 @@ if @mode == 'relative' or @mode == 'detail' clear-interval @tickid - tick() { + this.tick = () => { now = new Date! ago = (now - @time) / 1000ms this.relative = switch diff --git a/src/web/app/common/tags/uploader.tag b/src/web/app/common/tags/uploader.tag index 72f6eaa224..f6e99892a1 100644 --- a/src/web/app/common/tags/uploader.tag +++ b/src/web/app/common/tags/uploader.tag @@ -145,7 +145,7 @@ this.uploads = [] - upload(file, folder) { + this.upload = (file, folder) => { id = Math.random! ctx = |