From 91d8ee5a52ece1cb78e5e3bb74178d41761d540f Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 20 Feb 2017 10:34:57 +0900 Subject: [PATCH] wip --- src/web/app/auth/tags/form.tag | 4 +- src/web/app/auth/tags/index.tag | 2 +- src/web/app/common/tags/core-error.tag | 2 +- src/web/app/common/tags/messaging/form.tag | 12 ++-- src/web/app/common/tags/messaging/index.tag | 6 +- src/web/app/common/tags/messaging/room.tag | 30 ++++----- src/web/app/common/tags/poll-editor.tag | 10 +-- src/web/app/common/tags/poll.tag | 4 +- src/web/app/common/tags/signin-history.tag | 2 +- src/web/app/common/tags/signin.tag | 4 +- src/web/app/common/tags/signup.tag | 8 +-- src/web/app/common/tags/time.tag | 2 +- src/web/app/common/tags/uploader.tag | 2 +- src/web/app/desktop/tags/analog-clock.tag | 2 +- .../desktop/tags/autocomplete-suggestion.tag | 24 +++---- .../app/desktop/tags/big-follow-button.tag | 6 +- src/web/app/desktop/tags/contextmenu.tag | 12 ++-- src/web/app/desktop/tags/crop-window.tag | 6 +- src/web/app/desktop/tags/dialog.tag | 4 +- src/web/app/desktop/tags/donation.tag | 2 +- .../desktop/tags/drive/base-contextmenu.tag | 8 +-- .../app/desktop/tags/drive/browser-window.tag | 2 +- src/web/app/desktop/tags/drive/browser.tag | 58 ++++++++--------- .../desktop/tags/drive/file-contextmenu.tag | 16 ++--- src/web/app/desktop/tags/drive/file.tag | 8 +-- .../desktop/tags/drive/folder-contextmenu.tag | 12 ++-- src/web/app/desktop/tags/drive/folder.tag | 20 +++--- src/web/app/desktop/tags/drive/nav-folder.tag | 14 ++--- src/web/app/desktop/tags/follow-button.tag | 6 +- .../app/desktop/tags/following-setuper.tag | 6 +- src/web/app/desktop/tags/go-top.tag | 8 +-- .../desktop/tags/home-widgets/calendar.tag | 2 +- .../desktop/tags/home-widgets/mentions.tag | 18 +++--- .../tags/home-widgets/notifications.tag | 2 +- .../tags/home-widgets/photo-stream.tag | 2 +- .../app/desktop/tags/home-widgets/profile.tag | 4 +- .../desktop/tags/home-widgets/rss-reader.tag | 4 +- .../desktop/tags/home-widgets/timeline.tag | 22 +++---- .../app/desktop/tags/home-widgets/tips.tag | 4 +- .../tags/home-widgets/user-recommendation.tag | 4 +- src/web/app/desktop/tags/image-dialog.tag | 2 +- src/web/app/desktop/tags/images-viewer.tag | 4 +- src/web/app/desktop/tags/input-dialog.tag | 6 +- src/web/app/desktop/tags/notifications.tag | 2 +- src/web/app/desktop/tags/pages/entrance.tag | 6 +- .../desktop/tags/pages/entrance/signin.tag | 2 +- src/web/app/desktop/tags/pages/home.tag | 8 +-- src/web/app/desktop/tags/post-detail-sub.tag | 2 +- src/web/app/desktop/tags/post-detail.tag | 8 +-- src/web/app/desktop/tags/post-form.tag | 34 +++++----- src/web/app/desktop/tags/progress-dialog.tag | 4 +- .../app/desktop/tags/repost-form-window.tag | 6 +- src/web/app/desktop/tags/repost-form.tag | 6 +- src/web/app/desktop/tags/search-posts.tag | 14 ++--- .../tags/select-file-from-drive-window.tag | 6 +- .../desktop/tags/set-avatar-suggestion.tag | 4 +- .../desktop/tags/set-banner-suggestion.tag | 4 +- src/web/app/desktop/tags/settings-window.tag | 2 +- src/web/app/desktop/tags/settings.tag | 12 ++-- src/web/app/desktop/tags/timeline-post.tag | 10 +-- src/web/app/desktop/tags/timeline.tag | 12 ++-- .../app/desktop/tags/ui-header-account.tag | 16 ++--- src/web/app/desktop/tags/ui-header-clock.tag | 2 +- src/web/app/desktop/tags/ui-header-nav.tag | 6 +- .../desktop/tags/ui-header-notifications.tag | 12 ++-- .../desktop/tags/ui-header-post-button.tag | 2 +- src/web/app/desktop/tags/ui-header-search.tag | 2 +- src/web/app/desktop/tags/ui.tag | 10 +-- src/web/app/desktop/tags/user-followers.tag | 2 +- src/web/app/desktop/tags/user-following.tag | 2 +- src/web/app/desktop/tags/user-header.tag | 16 ++--- src/web/app/desktop/tags/user-preview.tag | 2 +- src/web/app/desktop/tags/user-profile.tag | 4 +- src/web/app/desktop/tags/user-timeline.tag | 26 ++++---- src/web/app/desktop/tags/users-list.tag | 6 +- src/web/app/desktop/tags/window.tag | 62 +++++++++---------- src/web/app/dev/tags/new-app-form.tag | 4 +- src/web/app/mobile/tags/drive-selector.tag | 4 +- src/web/app/mobile/tags/drive.tag | 30 ++++----- src/web/app/mobile/tags/drive/file-viewer.tag | 2 +- src/web/app/mobile/tags/drive/file.tag | 2 +- src/web/app/mobile/tags/drive/folder.tag | 2 +- src/web/app/mobile/tags/follow-button.tag | 6 +- src/web/app/mobile/tags/home-timeline.tag | 8 +-- src/web/app/mobile/tags/images-viewer.tag | 2 +- src/web/app/mobile/tags/notifications.tag | 2 +- src/web/app/mobile/tags/page/entrance.tag | 6 +- src/web/app/mobile/tags/page/home.tag | 8 +-- src/web/app/mobile/tags/post-detail.tag | 8 +-- src/web/app/mobile/tags/post-form.tag | 24 +++---- src/web/app/mobile/tags/search-posts.tag | 2 +- src/web/app/mobile/tags/timeline-post.tag | 6 +- src/web/app/mobile/tags/timeline.tag | 10 +-- src/web/app/mobile/tags/ui-header.tag | 2 +- src/web/app/mobile/tags/ui-nav.tag | 2 +- src/web/app/mobile/tags/ui.tag | 8 +-- src/web/app/mobile/tags/user-followers.tag | 2 +- src/web/app/mobile/tags/user-following.tag | 2 +- src/web/app/mobile/tags/user-timeline.tag | 2 +- src/web/app/mobile/tags/user.tag | 8 +-- src/web/app/mobile/tags/users-list.tag | 6 +- 101 files changed, 423 insertions(+), 423 deletions(-) diff --git a/src/web/app/auth/tags/form.tag b/src/web/app/auth/tags/form.tag index b5ace73716..bb424d98c2 100644 --- a/src/web/app/auth/tags/form.tag +++ b/src/web/app/auth/tags/form.tag @@ -111,13 +111,13 @@ this.session = this.opts.session this.app = @session.app - cancel() { + this.cancel = () => { this.api 'auth/deny' do token: @session.token .then => this.trigger('denied'); - accept() { + this.accept = () => { this.api 'auth/accept' do token: @session.token .then => diff --git a/src/web/app/auth/tags/index.tag b/src/web/app/auth/tags/index.tag index a9f7828b96..0059fef20f 100644 --- a/src/web/app/auth/tags/index.tag +++ b/src/web/app/auth/tags/index.tag @@ -127,7 +127,7 @@ this.state = 'fetch-session-error' this.update(); - accepted() { + this.accepted = () => { this.state = 'accepted' this.update(); 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 @@ 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 = diff --git a/src/web/app/desktop/tags/analog-clock.tag b/src/web/app/desktop/tags/analog-clock.tag index 06896fe20b..c1390be649 100644 --- a/src/web/app/desktop/tags/analog-clock.tag +++ b/src/web/app/desktop/tags/analog-clock.tag @@ -16,7 +16,7 @@ this.on('unmount', () => { clear-interval @clock - draw() { + this.draw = () => { now = new Date! s = now.get-seconds! m = now.get-minutes! diff --git a/src/web/app/desktop/tags/autocomplete-suggestion.tag b/src/web/app/desktop/tags/autocomplete-suggestion.tag index cf735255bb..29ce938b84 100644 --- a/src/web/app/desktop/tags/autocomplete-suggestion.tag +++ b/src/web/app/desktop/tags/autocomplete-suggestion.tag @@ -89,11 +89,11 @@ this.select = -1 this.on('mount', () => { - @textarea.add-event-listener 'keydown' this.on-keydown + @textarea.addEventListener 'keydown' this.on-keydown all = document.query-selector-all 'body *' Array.prototype.for-each.call all, (el) => - el.add-event-listener 'mousedown' @mousedown + el.addEventListener 'mousedown' @mousedown this.api 'users/search_by_username' do query: @q @@ -106,20 +106,20 @@ console.error err this.on('unmount', () => { - @textarea.remove-event-listener 'keydown' this.on-keydown + @textarea.removeEventListener 'keydown' this.on-keydown all = document.query-selector-all 'body *' Array.prototype.for-each.call all, (el) => - el.remove-event-listener 'mousedown' @mousedown + el.removeEventListener 'mousedown' @mousedown - mousedown(e) { + this.mousedown = (e) => { if (!contains this.root, e.target) and (this.root != e.target) @close! - on-click(e) { + this.on-click = (e) => { @complete e.item - on-keydown(e) { + this.on-keydown = (e) => { key = e.which switch (key) | 10, 13 => // Key[ENTER] @@ -147,7 +147,7 @@ | _ => @close! - select-next() { + this.select-next = () => { @select++ if @select >= @users.length @@ -155,7 +155,7 @@ @apply-select! - select-prev() { + this.select-prev = () => { @select-- if @select < 0 @@ -163,17 +163,17 @@ @apply-select! - apply-select() { + this.apply-select = () => { this.refs.users.children.for-each (el) => el.remove-attribute 'data-selected' this.refs.users.children[@select].setAttribute 'data-selected' \true this.refs.users.children[@select].focus(); - complete(user) { + this.complete = (user) => { this.opts.complete user - close() { + this.close = () => { this.opts.close! function contains(parent, child) diff --git a/src/web/app/desktop/tags/big-follow-button.tag b/src/web/app/desktop/tags/big-follow-button.tag index 6c87e87558..78ecbc2d62 100644 --- a/src/web/app/desktop/tags/big-follow-button.tag +++ b/src/web/app/desktop/tags/big-follow-button.tag @@ -91,17 +91,17 @@ @stream.off 'follow' this.on-stream-follow @stream.off 'unfollow' this.on-stream-unfollow - on-stream-follow(user) { + this.on-stream-follow = (user) => { if user.id == @user.id this.user = user this.update(); - on-stream-unfollow(user) { + this.on-stream-unfollow = (user) => { if user.id == @user.id this.user = user this.update(); - onclick() { + this.onclick = () => { this.wait = true if @user.is_following this.api 'following/delete' do diff --git a/src/web/app/desktop/tags/contextmenu.tag b/src/web/app/desktop/tags/contextmenu.tag index 0d8cb313ac..400090c6c4 100644 --- a/src/web/app/desktop/tags/contextmenu.tag +++ b/src/web/app/desktop/tags/contextmenu.tag @@ -94,19 +94,19 @@ diff --git a/src/web/app/desktop/tags/dialog.tag b/src/web/app/desktop/tags/dialog.tag index a444ac18f6..f163f99b81 100644 --- a/src/web/app/desktop/tags/dialog.tag +++ b/src/web/app/desktop/tags/dialog.tag @@ -114,7 +114,7 @@ easing: [ 0, 0.5, 0.5, 1 ] } - close() { + this.close = () => { this.refs.bg.style.pointer-events = 'none' Velocity this.refs.bg, 'finish' true Velocity this.refs.bg, { @@ -138,7 +138,7 @@ this.unmount(); } - bg-click() { + this.bg-click = () => { if @can-through if this.opts.on-through? this.opts.on-through! diff --git a/src/web/app/desktop/tags/donation.tag b/src/web/app/desktop/tags/donation.tag index 9ce2ed819f..0946e430da 100644 --- a/src/web/app/desktop/tags/donation.tag +++ b/src/web/app/desktop/tags/donation.tag @@ -50,7 +50,7 @@ this.mixin('api'); this.mixin('i'); - close(e) { + this.close = (e) => { e.preventDefault(); e.stopPropagation(); diff --git a/src/web/app/desktop/tags/drive/base-contextmenu.tag b/src/web/app/desktop/tags/drive/base-contextmenu.tag index 7eb5fd3b98..9503e639d6 100644 --- a/src/web/app/desktop/tags/drive/base-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/base-contextmenu.tag @@ -20,18 +20,18 @@ this.trigger('closed'); this.unmount(); - open(pos) { + this.open = (pos) => { this.refs.ctx.open pos - create-folder() { + this.create-folder = () => { this.browser.create-folder! this.refs.ctx.close! - upload() { + this.upload = () => { this.browser.select-local-file! this.refs.ctx.close! - url-upload() { + this.url-upload = () => { this.browser.url-upload! this.refs.ctx.close! diff --git a/src/web/app/desktop/tags/drive/browser-window.tag b/src/web/app/desktop/tags/drive/browser-window.tag index c36726444f..b5b2572d45 100644 --- a/src/web/app/desktop/tags/drive/browser-window.tag +++ b/src/web/app/desktop/tags/drive/browser-window.tag @@ -40,7 +40,7 @@ @update do usage: info.usage / info.capacity * 100 - close() { + this.close = () => { this.refs.window.close! diff --git a/src/web/app/desktop/tags/drive/browser.tag b/src/web/app/desktop/tags/drive/browser.tag index 2a93afbb24..383da90188 100644 --- a/src/web/app/desktop/tags/drive/browser.tag +++ b/src/web/app/desktop/tags/drive/browser.tag @@ -289,27 +289,27 @@ @stream.off 'drive_folder_created' this.on-stream-drive-folder-created @stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated - on-stream-drive-file-created(file) { + this.on-stream-drive-file-created = (file) => { @add-file file, true - on-stream-drive-file-updated(file) { + this.on-stream-drive-file-updated = (file) => { current = if this.folder? then this.folder.id else null if current != file.folder_id @remove-file file else @add-file file, true - on-stream-drive-folder-created(folder) { + this.on-stream-drive-folder-created = (folder) => { @add-folder folder, true - on-stream-drive-folder-updated(folder) { + this.on-stream-drive-folder-updated = (folder) => { current = if this.folder? then this.folder.id else null if current != folder.parent_id @remove-folder folder else @add-folder folder, true - onmousedown(e) { + this.onmousedown = (e) => { if (contains this.refs.folders-container, e.target) or (contains this.refs.files-container, e.target) return true @@ -341,20 +341,20 @@ this.refs.selection.style.top = cursor-y + 'px' up = (e) => - document.document-element.remove-event-listener 'mousemove' move - document.document-element.remove-event-listener 'mouseup' up + document.document-element.removeEventListener 'mousemove' move + document.document-element.removeEventListener 'mouseup' up this.refs.selection.style.display = 'none' - document.document-element.add-event-listener 'mousemove' move - document.document-element.add-event-listener 'mouseup' up + document.document-element.addEventListener 'mousemove' move + document.document-element.addEventListener 'mouseup' up - path-oncontextmenu(e) { + this.path-oncontextmenu = (e) => { e.preventDefault(); e.stop-immediate-propagation! return false - ondragover(e) { + this.ondragover = (e) => { e.preventDefault(); e.stopPropagation(); @@ -371,15 +371,15 @@ e.dataTransfer.dropEffect = 'none' return false - ondragenter(e) { + this.ondragenter = (e) => { e.preventDefault(); if !@is-drag-source this.draghover = true - ondragleave(e) { + this.ondragleave = (e) => { this.draghover = false - ondrop(e) { + this.ondrop = (e) => { e.preventDefault(); e.stopPropagation(); @@ -438,7 +438,7 @@ return false - oncontextmenu(e) { + this.oncontextmenu = (e) => { e.preventDefault(); e.stop-immediate-propagation! @@ -452,10 +452,10 @@ return false - select-local-file() { + this.select-local-file = () => { this.refs.file-input.click! - url-upload() { + this.url-upload = () => { url <~ @input-dialog do 'URLアップロード' 'アップロードしたいファイルのURL' @@ -473,7 +473,7 @@ text: 'OK' ] - create-folder() { + this.create-folder = () => { name <~ @input-dialog do 'フォルダー作成' 'フォルダー名' @@ -488,26 +488,26 @@ .catch (err) => console.error err - change-file-input() { + this.change-file-input = () => { files = this.refs.file-input.files for i from 0 to files.length - 1 file = files.item i @upload file, this.folder - upload(file, folder) { + this.upload = (file, folder) => { if folder? and typeof folder == 'object' folder = folder.id this.refs.uploader.upload file, folder - get-selection() { + this.get-selection = () => { this.files.filter (file) -> file._selected - new-window(folder-id) { + this.new-window = (folder-id) => { browser = document.body.appendChild document.createElement 'mk-drive-browser-window' riot.mount browser, do folder: folder-id - move(target-folder) { + this.move = (target-folder) => { if target-folder? and typeof target-folder == 'object' target-folder = target-folder.id @@ -537,7 +537,7 @@ .catch (err, text-status) -> console.error err - add-folder(folder, unshift = false) { + this.add-folder = (folder, unshift = false) => { current = if this.folder? then this.folder.id else null if current != folder.parent_id return @@ -555,7 +555,7 @@ this.update(); - add-file(file, unshift = false) { + this.add-file = (file, unshift = false) => { current = if this.folder? then this.folder.id else null if current != file.folder_id return @@ -573,26 +573,26 @@ this.update(); - remove-folder(folder) { + this.remove-folder = (folder) => { if typeof folder == 'object' folder = folder.id this.folders = this.folders.filter (f) -> f.id != folder this.update(); - remove-file(file) { + this.remove-file = (file) => { if typeof file == 'object' file = file.id this.files = this.files.filter (f) -> f.id != file this.update(); - go-root() { + this.go-root = () => { if this.folder != null this.folder = null this.hierarchy-folders = [] this.update(); @load! - load() { + this.load = () => { this.folders = [] this.files = [] this.more-folders = false diff --git a/src/web/app/desktop/tags/drive/file-contextmenu.tag b/src/web/app/desktop/tags/drive/file-contextmenu.tag index 06e7085621..e8d75ccd4d 100644 --- a/src/web/app/desktop/tags/drive/file-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/file-contextmenu.tag @@ -54,10 +54,10 @@ this.trigger('closed'); this.unmount(); - open(pos) { + this.open = (pos) => { this.refs.ctx.open pos - rename() { + this.rename = () => { this.refs.ctx.close! name <~ @input-dialog do @@ -73,25 +73,25 @@ .catch (err) => console.error err - copy-url() { + this.copy-url = () => { @NotImplementedException! - download() { + this.download = () => { this.refs.ctx.close! - set-avatar() { + this.set-avatar = () => { this.refs.ctx.close! @update-avatar this.I, null, this.file - set-banner() { + this.set-banner = () => { this.refs.ctx.close! @update-banner this.I, null, this.file - set-wallpaper() { + this.set-wallpaper = () => { this.refs.ctx.close! @update-wallpaper this.I, null, this.file - add-app() { + this.add-app = () => { @NotImplementedException! diff --git a/src/web/app/desktop/tags/drive/file.tag b/src/web/app/desktop/tags/drive/file.tag index d41c5279fc..e0e9beb217 100644 --- a/src/web/app/desktop/tags/drive/file.tag +++ b/src/web/app/desktop/tags/drive/file.tag @@ -155,7 +155,7 @@ this.is-contextmenu-showing = false - onclick() { + this.onclick = () => { if this.browser.multiple if this.file._selected? this.file._selected = !this.file._selected @@ -171,7 +171,7 @@ this.file._selected = true this.browser.trigger 'change-selection' this.file - oncontextmenu(e) { + this.oncontextmenu = (e) => { e.preventDefault(); e.stop-immediate-propagation! @@ -190,7 +190,7 @@ this.update(); return false - ondragstart(e) { + this.ondragstart = (e) => { e.dataTransfer.effect-allowed = 'move' e.dataTransfer.set-data 'text' JSON.stringify do type: 'file' @@ -202,7 +202,7 @@ // (=あなたの子供が、ドラッグを開始しましたよ) this.browser.is-drag-source = true - ondragend(e) { + this.ondragend = (e) => { this.is-dragging = false this.browser.is-drag-source = false diff --git a/src/web/app/desktop/tags/drive/folder-contextmenu.tag b/src/web/app/desktop/tags/drive/folder-contextmenu.tag index df094d0bc7..92fb5457c2 100644 --- a/src/web/app/desktop/tags/drive/folder-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/folder-contextmenu.tag @@ -24,30 +24,30 @@ this.browser = this.opts.browser this.folder = this.opts.folder - open(pos) { + this.open = (pos) => { this.refs.ctx.open pos this.refs.ctx.on('closed', () => { this.trigger('closed'); this.unmount(); - move() { + this.move = () => { this.browser.move this.folder.id this.refs.ctx.close! - new-window() { + this.new-window = () => { this.browser.new-window this.folder.id this.refs.ctx.close! - create-folder() { + this.create-folder = () => { this.browser.create-folder! this.refs.ctx.close! - upload() { + this.upload = () => { this.browser.select-lcoal-file! this.refs.ctx.close! - rename() { + this.rename = () => { this.refs.ctx.close! name <~ @input-dialog do diff --git a/src/web/app/desktop/tags/drive/folder.tag b/src/web/app/desktop/tags/drive/folder.tag index 2d58ddefc7..25524a80d6 100644 --- a/src/web/app/desktop/tags/drive/folder.tag +++ b/src/web/app/desktop/tags/drive/folder.tag @@ -61,16 +61,16 @@ this.draghover = false this.is-contextmenu-showing = false - onclick() { + this.onclick = () => { this.browser.move this.folder - onmouseover() { + this.onmouseover = () => { this.hover = true - onmouseout() { + this.onmouseout = () => { this.hover = false - ondragover(e) { + this.ondragover = (e) => { e.preventDefault(); e.stopPropagation(); @@ -86,14 +86,14 @@ e.dataTransfer.dropEffect = 'none' return false - ondragenter() { + this.ondragenter = () => { if !@is-dragging this.draghover = true - ondragleave() { + this.ondragleave = () => { this.draghover = false - ondrop(e) { + this.ondrop = (e) => { e.stopPropagation(); this.draghover = false @@ -146,7 +146,7 @@ return false - ondragstart(e) { + this.ondragstart = (e) => { e.dataTransfer.effect-allowed = 'move' e.dataTransfer.set-data 'text' JSON.stringify do type: 'folder' @@ -157,11 +157,11 @@ // (=あなたの子供が、ドラッグを開始しましたよ) this.browser.is-drag-source = true - ondragend(e) { + this.ondragend = (e) => { this.is-dragging = false this.browser.is-drag-source = false - oncontextmenu(e) { + this.oncontextmenu = (e) => { e.preventDefault(); e.stop-immediate-propagation! diff --git a/src/web/app/desktop/tags/drive/nav-folder.tag b/src/web/app/desktop/tags/drive/nav-folder.tag index 8f8f00783a..5a620d76c8 100644 --- a/src/web/app/desktop/tags/drive/nav-folder.tag +++ b/src/web/app/desktop/tags/drive/nav-folder.tag @@ -16,16 +16,16 @@ this.hover = false - onclick() { + this.onclick = () => { this.browser.move this.folder - onmouseover() { + this.onmouseover = () => { this.hover = true - onmouseout() { + this.onmouseout = () => { this.hover = false - ondragover(e) { + this.ondragover = (e) => { e.preventDefault(); e.stopPropagation(); @@ -39,15 +39,15 @@ e.dataTransfer.dropEffect = 'move' return false - ondragenter() { + this.ondragenter = () => { if this.folder != null or this.browser.folder != null this.draghover = true - ondragleave() { + this.ondragleave = () => { if this.folder != null or this.browser.folder != null this.draghover = false - ondrop(e) { + this.ondrop = (e) => { e.stopPropagation(); this.draghover = false diff --git a/src/web/app/desktop/tags/follow-button.tag b/src/web/app/desktop/tags/follow-button.tag index 575c99c700..87284cbc04 100644 --- a/src/web/app/desktop/tags/follow-button.tag +++ b/src/web/app/desktop/tags/follow-button.tag @@ -88,17 +88,17 @@ @stream.off 'follow' this.on-stream-follow @stream.off 'unfollow' this.on-stream-unfollow - on-stream-follow(user) { + this.on-stream-follow = (user) => { if user.id == @user.id this.user = user this.update(); - on-stream-unfollow(user) { + this.on-stream-unfollow = (user) => { if user.id == @user.id this.user = user this.update(); - onclick() { + this.onclick = () => { this.wait = true if @user.is_following this.api 'following/delete' do diff --git a/src/web/app/desktop/tags/following-setuper.tag b/src/web/app/desktop/tags/following-setuper.tag index 5faba3e653..fd1aa4bc88 100644 --- a/src/web/app/desktop/tags/following-setuper.tag +++ b/src/web/app/desktop/tags/following-setuper.tag @@ -135,7 +135,7 @@ this.on('mount', () => { @load! - load() { + this.load = () => { this.loading = true this.users = null this.update(); @@ -150,14 +150,14 @@ .catch (err, text-status) -> console.error err - refresh() { + this.refresh = () => { if @users.length < @limit this.page = 0 else @page++ @load! - close() { + this.close = () => { this.unmount(); diff --git a/src/web/app/desktop/tags/go-top.tag b/src/web/app/desktop/tags/go-top.tag index 42efaf2f2a..cb75c04807 100644 --- a/src/web/app/desktop/tags/go-top.tag +++ b/src/web/app/desktop/tags/go-top.tag @@ -1,11 +1,11 @@ diff --git a/src/web/app/desktop/tags/home-widgets/photo-stream.tag b/src/web/app/desktop/tags/home-widgets/photo-stream.tag index 9b7756108e..f7a80f40a9 100644 --- a/src/web/app/desktop/tags/home-widgets/photo-stream.tag +++ b/src/web/app/desktop/tags/home-widgets/photo-stream.tag @@ -77,7 +77,7 @@ this.on('unmount', () => { @stream.off 'drive_file_created' this.on-stream-drive-file-created - on-stream-drive-file-created(file) { + this.on-stream-drive-file-created = (file) => { if /^image\/.+$/.test file.type @images.unshift file if @images.length > 9 diff --git a/src/web/app/desktop/tags/home-widgets/profile.tag b/src/web/app/desktop/tags/home-widgets/profile.tag index 3cff6b682c..72b2c18c38 100644 --- a/src/web/app/desktop/tags/home-widgets/profile.tag +++ b/src/web/app/desktop/tags/home-widgets/profile.tag @@ -46,10 +46,10 @@ this.mixin('update-avatar'); this.mixin('update-banner'); - set-avatar() { + this.set-avatar = () => { @update-avatar this.I - set-banner() { + this.set-banner = () => { @update-banner this.I diff --git a/src/web/app/desktop/tags/home-widgets/rss-reader.tag b/src/web/app/desktop/tags/home-widgets/rss-reader.tag index 6778ea3bbb..2ced342a43 100644 --- a/src/web/app/desktop/tags/home-widgets/rss-reader.tag +++ b/src/web/app/desktop/tags/home-widgets/rss-reader.tag @@ -78,7 +78,7 @@ this.on('unmount', () => { clear-interval @clock - fetch() { + this.fetch = () => { this.api CONFIG.url + '/api:rss' do url: @url .then (feed) => @@ -88,7 +88,7 @@ .catch (err) -> console.error err - settings() { + this.settings = () => { @NotImplementedException! diff --git a/src/web/app/desktop/tags/home-widgets/timeline.tag b/src/web/app/desktop/tags/home-widgets/timeline.tag index 1fcf4ab572..dbeac5eaf8 100644 --- a/src/web/app/desktop/tags/home-widgets/timeline.tag +++ b/src/web/app/desktop/tags/home-widgets/timeline.tag @@ -46,8 +46,8 @@ @stream.on 'follow' this.on-stream-follow @stream.on 'unfollow' this.on-stream-unfollow - document.add-event-listener 'keydown' this.on-document-keydown - window.add-event-listener 'scroll' this.on-scroll + document.addEventListener 'keydown' this.on-document-keydown + window.addEventListener 'scroll' this.on-scroll @load => this.trigger('loaded'); @@ -57,16 +57,16 @@ @stream.off 'follow' this.on-stream-follow @stream.off 'unfollow' this.on-stream-unfollow - document.remove-event-listener 'keydown' this.on-document-keydown - window.remove-event-listener 'scroll' this.on-scroll + document.removeEventListener 'keydown' this.on-document-keydown + window.removeEventListener 'scroll' this.on-scroll - on-document-keydown(e) { + this.on-document-keydown = (e) => { tag = e.target.tag-name.to-lower-case! if tag != 'input' and tag != 'textarea' if e.which == 84 // t this.refs.timeline.focus(); - load(cb) { + this.load = (cb) => { this.api 'posts/timeline' .then (posts) => this.is-loading = false @@ -78,7 +78,7 @@ console.error err if cb? then cb! - more() { + this.more = () => { if @more-loading or @is-loading or this.refs.timeline.posts.length == 0 return this.more-loading = true @@ -92,18 +92,18 @@ .catch (err) => console.error err - on-stream-post(post) { + this.on-stream-post = (post) => { this.is-empty = false this.update(); this.refs.timeline.add-post post - on-stream-follow() { + this.on-stream-follow = () => { @load! - on-stream-unfollow() { + this.on-stream-unfollow = () => { @load! - on-scroll() { + this.on-scroll = () => { current = window.scroll-y + window.inner-height if current > document.body.offset-height - 8 @more! diff --git a/src/web/app/desktop/tags/home-widgets/tips.tag b/src/web/app/desktop/tags/home-widgets/tips.tag index c28514bbf2..08e1b1737e 100644 --- a/src/web/app/desktop/tags/home-widgets/tips.tag +++ b/src/web/app/desktop/tags/home-widgets/tips.tag @@ -48,11 +48,11 @@ this.on('unmount', () => { clear-interval @clock - set() { + this.set = () => { this.refs.text.innerHTML = @tips[Math.floor Math.random! * @tips.length] this.update(); - change() { + this.change = () => { Velocity this.refs.tip, { opacity: 0 } { diff --git a/src/web/app/desktop/tags/home-widgets/user-recommendation.tag b/src/web/app/desktop/tags/home-widgets/user-recommendation.tag index b2ec4ba888..f2a8a7476d 100644 --- a/src/web/app/desktop/tags/home-widgets/user-recommendation.tag +++ b/src/web/app/desktop/tags/home-widgets/user-recommendation.tag @@ -128,7 +128,7 @@ this.on('unmount', () => { clear-interval @clock - fetch(quiet = false) { + this.fetch = (quiet = false) => { this.loading = true this.users = null if not quiet then this.update(); @@ -142,7 +142,7 @@ .catch (err, text-status) -> console.error err - refresh() { + this.refresh = () => { if @users.length < @limit this.page = 0 else diff --git a/src/web/app/desktop/tags/image-dialog.tag b/src/web/app/desktop/tags/image-dialog.tag index ae42a968bd..9a8a0e3b75 100644 --- a/src/web/app/desktop/tags/image-dialog.tag +++ b/src/web/app/desktop/tags/image-dialog.tag @@ -53,7 +53,7 @@ // easing: 'ease-out' #} - close() { + this.close = () => { Velocity this.root, { opacity: 0 } { diff --git a/src/web/app/desktop/tags/images-viewer.tag b/src/web/app/desktop/tags/images-viewer.tag index 7d552bc9ff..84190d34db 100644 --- a/src/web/app/desktop/tags/images-viewer.tag +++ b/src/web/app/desktop/tags/images-viewer.tag @@ -29,7 +29,7 @@ this.images = this.opts.images this.image = @images.0 - mousemove(e) { + this.mousemove = (e) => { rect = this.refs.view.get-bounding-client-rect! mouse-x = e.client-x - rect.left mouse-y = e.client-y - rect.top @@ -37,7 +37,7 @@ yp = mouse-y / this.refs.view.offset-height * 100 this.refs.view.style.background-position = xp + '% ' + yp + '%' - click() { + this.click = () => { dialog = document.body.appendChild document.createElement 'mk-image-dialog' riot.mount dialog, do image: @image diff --git a/src/web/app/desktop/tags/input-dialog.tag b/src/web/app/desktop/tags/input-dialog.tag index c2cf093304..b5aefcd164 100644 --- a/src/web/app/desktop/tags/input-dialog.tag +++ b/src/web/app/desktop/tags/input-dialog.tag @@ -139,16 +139,16 @@ this.refs.window.on('closed', () => { this.unmount(); - cancel() { + this.cancel = () => { this.done = false this.refs.window.close! - ok() { + this.ok = () => { if not @allow-empty and @text.value == '' then return this.done = true this.refs.window.close! - on-keydown(e) { + this.on-keydown = (e) => { if e.which == 13 // Enter e.preventDefault(); e.stopPropagation(); diff --git a/src/web/app/desktop/tags/notifications.tag b/src/web/app/desktop/tags/notifications.tag index 7ef13ad7eb..39a33e4102 100644 --- a/src/web/app/desktop/tags/notifications.tag +++ b/src/web/app/desktop/tags/notifications.tag @@ -199,7 +199,7 @@ this.on('unmount', () => { @stream.off 'notification' this.on-notification - on-notification(notification) { + this.on-notification = (notification) => { @notifications.unshift notification this.update(); diff --git a/src/web/app/desktop/tags/pages/entrance.tag b/src/web/app/desktop/tags/pages/entrance.tag index 227aec3885..486f83f9dd 100644 --- a/src/web/app/desktop/tags/pages/entrance.tag +++ b/src/web/app/desktop/tags/pages/entrance.tag @@ -65,15 +65,15 @@ diff --git a/src/web/app/desktop/tags/pages/entrance/signin.tag b/src/web/app/desktop/tags/pages/entrance/signin.tag index 67a449a73d..b620c88b88 100644 --- a/src/web/app/desktop/tags/pages/entrance/signin.tag +++ b/src/web/app/desktop/tags/pages/entrance/signin.tag @@ -124,7 +124,7 @@ @update do user: user - introduction() { + this.introduction = () => { this.parent.introduction! diff --git a/src/web/app/desktop/tags/pages/home.tag b/src/web/app/desktop/tags/pages/home.tag index 0f0bc4e378..3dd0b69d83 100644 --- a/src/web/app/desktop/tags/pages/home.tag +++ b/src/web/app/desktop/tags/pages/home.tag @@ -28,18 +28,18 @@ document.title = 'Misskey' this.Progress.start(); @stream.on 'post' this.on-stream-post - document.add-event-listener 'visibilitychange' @window-on-visibilitychange, false + document.addEventListener 'visibilitychange' @window-on-visibilitychange, false this.on('unmount', () => { @stream.off 'post' this.on-stream-post - document.remove-event-listener 'visibilitychange' @window-on-visibilitychange + document.removeEventListener 'visibilitychange' @window-on-visibilitychange - on-stream-post(post) { + this.on-stream-post = (post) => { if document.hidden and post.user_id !== this.I.id @unread-count++ document.title = '(' + @unread-count + ') ' + @get-post-summary post - window-on-visibilitychange() { + this.window-on-visibilitychange = () => { if !document.hidden this.unread-count = 0 document.title = 'Misskey' diff --git a/src/web/app/desktop/tags/post-detail-sub.tag b/src/web/app/desktop/tags/post-detail-sub.tag index ccb475c768..1a6dbe0699 100644 --- a/src/web/app/desktop/tags/post-detail-sub.tag +++ b/src/web/app/desktop/tags/post-detail-sub.tag @@ -123,7 +123,7 @@ if e.tag-name == 'MK-URL' riot.mount e - like() { + this.like = () => { if @post.is_liked this.api 'posts/likes/delete' do post_id: @post.id diff --git a/src/web/app/desktop/tags/post-detail.tag b/src/web/app/desktop/tags/post-detail.tag index 0443ff8836..c835521ad5 100644 --- a/src/web/app/desktop/tags/post-detail.tag +++ b/src/web/app/desktop/tags/post-detail.tag @@ -398,17 +398,17 @@ this.update(); - reply() { + this.reply = () => { form = document.body.appendChild document.createElement 'mk-post-form-window' riot.mount form, do reply: @p - repost() { + this.repost = () => { form = document.body.appendChild document.createElement 'mk-repost-form-window' riot.mount form, do post: @p - like() { + this.like = () => { if @p.is_liked this.api 'posts/likes/delete' do post_id: @p.id @@ -422,7 +422,7 @@ @p.is_liked = true this.update(); - load-context() { + this.load-context = () => { this.loading-context = true // Get context diff --git a/src/web/app/desktop/tags/post-form.tag b/src/web/app/desktop/tags/post-form.tag index b1c06143bc..d49feba144 100644 --- a/src/web/app/desktop/tags/post-form.tag +++ b/src/web/app/desktop/tags/post-form.tag @@ -335,16 +335,16 @@ this.on('unmount', () => { @autocomplete.detach! - focus() { + this.focus = () => { this.refs.text.focus(); - clear() { + this.clear = () => { this.refs.text.value = '' this.files = [] this.trigger('change-files'); this.update(); - ondragover(e) { + this.ondragover = (e) => { e.stopPropagation(); this.draghover = true // ドラッグされてきたものがファイルだったら @@ -354,13 +354,13 @@ e.dataTransfer.dropEffect = 'move' return false - ondragenter(e) { + this.ondragenter = (e) => { this.draghover = true - ondragleave(e) { + this.ondragleave = (e) => { this.draghover = false - ondrop(e) { + this.ondrop = (e) => { e.preventDefault(); e.stopPropagation(); this.draghover = false @@ -388,11 +388,11 @@ return false - onkeydown(e) { + this.onkeydown = (e) => { if (e.which == 10 || e.which == 13) && (e.ctrlKey || e.meta-key) @post! - onpaste(e) { + this.onpaste = (e) => { data = e.clipboardData items = data.items for i from 0 to items.length - 1 @@ -401,26 +401,26 @@ | 'file' => @upload item.getAsFile(); - select-file() { + this.select-file = () => { this.refs.file.click! - select-file-from-drive() { + this.select-file-from-drive = () => { browser = document.body.appendChild document.createElement 'mk-select-file-from-drive-window' i = riot.mount browser, do multiple: true i[0].one 'selected' (files) => files.for-each @add-file - change-file() { + this.change-file = () => { files = this.refs.file.files for i from 0 to files.length - 1 file = files.item i @upload file - upload(file) { + this.upload = (file) => { this.refs.uploader.upload file - add-file(file) { + this.add-file = (file) => { file._remove = => this.files = this.files.filter (x) -> x.id != file.id this.trigger 'change-files' this.files @@ -430,14 +430,14 @@ this.trigger 'change-files' this.files this.update(); - add-poll() { + this.add-poll = () => { this.poll = true - on-poll-destroyed() { + this.on-poll-destroyed = () => { @update do poll: false - post(e) { + this.post = (e) => { this.wait = true files = if this.files? and this.files.length > 0 @@ -459,7 +459,7 @@ this.wait = false this.update(); - cat() { + this.cat = () => { this.refs.text.value = this.refs.text.value + get-cat! diff --git a/src/web/app/desktop/tags/progress-dialog.tag b/src/web/app/desktop/tags/progress-dialog.tag index bb5dea8b43..da0ed16d78 100644 --- a/src/web/app/desktop/tags/progress-dialog.tag +++ b/src/web/app/desktop/tags/progress-dialog.tag @@ -83,12 +83,12 @@ this.refs.window.on('closed', () => { this.unmount(); - update-progress(value, max) { + this.update-progress = (value, max) => { this.value = parse-int value, 10 this.max = parse-int max, 10 this.update(); - close() { + this.close = () => { this.refs.window.close! diff --git a/src/web/app/desktop/tags/repost-form-window.tag b/src/web/app/desktop/tags/repost-form-window.tag index d66f98bb85..7af67094b0 100644 --- a/src/web/app/desktop/tags/repost-form-window.tag +++ b/src/web/app/desktop/tags/repost-form-window.tag @@ -12,7 +12,7 @@ diff --git a/src/web/app/desktop/tags/repost-form.tag b/src/web/app/desktop/tags/repost-form.tag index 58ef564bac..319b42dd01 100644 --- a/src/web/app/desktop/tags/repost-form.tag +++ b/src/web/app/desktop/tags/repost-form.tag @@ -120,10 +120,10 @@ this.wait = false this.quote = false - cancel() { + this.cancel = () => { this.trigger('cancel'); - ok() { + this.ok = () => { this.wait = true this.api 'posts/create' do repost_id: this.opts.post.id @@ -138,7 +138,7 @@ this.wait = false this.update(); - onquote() { + this.onquote = () => { this.quote = true diff --git a/src/web/app/desktop/tags/search-posts.tag b/src/web/app/desktop/tags/search-posts.tag index a61a0a0614..a450e8a02c 100644 --- a/src/web/app/desktop/tags/search-posts.tag +++ b/src/web/app/desktop/tags/search-posts.tag @@ -38,8 +38,8 @@ this.page = 0 this.on('mount', () => { - document.add-event-listener 'keydown' this.on-document-keydown - window.add-event-listener 'scroll' this.on-scroll + document.addEventListener 'keydown' this.on-document-keydown + window.addEventListener 'scroll' this.on-scroll this.api 'posts/search' do query: @query @@ -53,16 +53,16 @@ console.error err this.on('unmount', () => { - document.remove-event-listener 'keydown' this.on-document-keydown - window.remove-event-listener 'scroll' this.on-scroll + document.removeEventListener 'keydown' this.on-document-keydown + window.removeEventListener 'scroll' this.on-scroll - on-document-keydown(e) { + this.on-document-keydown = (e) => { tag = e.target.tag-name.to-lower-case! if tag != 'input' and tag != 'textarea' if e.which == 84 // t this.refs.timeline.focus(); - more() { + this.more = () => { if @more-loading or @is-loading or @timeline.posts.length == 0 return this.more-loading = true @@ -78,7 +78,7 @@ .catch (err) => console.error err - on-scroll() { + this.on-scroll = () => { current = window.scroll-y + window.inner-height if current > document.body.offset-height - 16 // 遊び @more! diff --git a/src/web/app/desktop/tags/select-file-from-drive-window.tag b/src/web/app/desktop/tags/select-file-from-drive-window.tag index c8fc02d223..6979a55211 100644 --- a/src/web/app/desktop/tags/select-file-from-drive-window.tag +++ b/src/web/app/desktop/tags/select-file-from-drive-window.tag @@ -148,13 +148,13 @@ this.refs.window.on('closed', () => { this.unmount(); - close() { + this.close = () => { this.refs.window.close! - upload() { + this.upload = () => { this.refs.window.refs.browser.select-local-file! - ok() { + this.ok = () => { this.trigger 'selected' this.file this.refs.window.close! diff --git a/src/web/app/desktop/tags/set-avatar-suggestion.tag b/src/web/app/desktop/tags/set-avatar-suggestion.tag index e398a6ed29..ba44a7a33d 100644 --- a/src/web/app/desktop/tags/set-avatar-suggestion.tag +++ b/src/web/app/desktop/tags/set-avatar-suggestion.tag @@ -34,10 +34,10 @@ this.mixin('i'); this.mixin('update-avatar'); - set() { + this.set = () => { @update-avatar this.I - close(e) { + this.close = (e) => { e.preventDefault(); e.stopPropagation(); this.unmount(); diff --git a/src/web/app/desktop/tags/set-banner-suggestion.tag b/src/web/app/desktop/tags/set-banner-suggestion.tag index 73c67a02bd..fa735e4e42 100644 --- a/src/web/app/desktop/tags/set-banner-suggestion.tag +++ b/src/web/app/desktop/tags/set-banner-suggestion.tag @@ -34,10 +34,10 @@ this.mixin('i'); this.mixin('update-banner'); - set() { + this.set = () => { @update-banner this.I - close(e) { + this.close = (e) => { e.preventDefault(); e.stopPropagation(); this.unmount(); diff --git a/src/web/app/desktop/tags/settings-window.tag b/src/web/app/desktop/tags/settings-window.tag index 4ffc5f2250..89219fccf8 100644 --- a/src/web/app/desktop/tags/settings-window.tag +++ b/src/web/app/desktop/tags/settings-window.tag @@ -19,7 +19,7 @@ this.refs.window.on('closed', () => { this.unmount(); - close() { + this.close = () => { this.refs.window.close! diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag index e67a1b11a6..e4a83738e6 100644 --- a/src/web/app/desktop/tags/settings.tag +++ b/src/web/app/desktop/tags/settings.tag @@ -205,13 +205,13 @@ this.page = 'account' - set-page(page) { + this.set-page = (page) => { this.page = page - avatar() { + this.avatar = () => { @update-avatar this.I - update-account() { + this.update-account = () => { this.api 'i/update' do name: this.refs.account-name.value location: this.refs.account-location.value @@ -222,19 +222,19 @@ .catch (err) => console.error err - update-cache() { + this.update-cache = () => { this.I.data.cache = !this.I.data.cache this.api 'i/appdata/set' do data: JSON.stringify do cache: this.I.data.cache - update-debug() { + this.update-debug = () => { this.I.data.debug = !this.I.data.debug this.api 'i/appdata/set' do data: JSON.stringify do debug: this.I.data.debug - update-nya() { + this.update-nya = () => { this.I.data.nya = !this.I.data.nya this.api 'i/appdata/set' do data: JSON.stringify do diff --git a/src/web/app/desktop/tags/timeline-post.tag b/src/web/app/desktop/tags/timeline-post.tag index ea1bed257b..5efc050638 100644 --- a/src/web/app/desktop/tags/timeline-post.tag +++ b/src/web/app/desktop/tags/timeline-post.tag @@ -349,17 +349,17 @@ riot.mount @preview, do url: t.content - reply() { + this.reply = () => { form = document.body.appendChild document.createElement 'mk-post-form-window' riot.mount form, do reply: @p - repost() { + this.repost = () => { form = document.body.appendChild document.createElement 'mk-repost-form-window' riot.mount form, do post: @p - like() { + this.like = () => { if @p.is_liked this.api 'posts/likes/delete' do post_id: @p.id @@ -373,11 +373,11 @@ @p.is_liked = true this.update(); - toggle-detail() { + this.toggle-detail = () => { this.is-detail-opened = !@is-detail-opened this.update(); - on-key-down(e) { + this.on-key-down = (e) => { should-be-cancel = true switch | e.which == 38 or e.which == 74 or (e.which == 9 and e.shift-key) => // ↑, j or Shift+Tab diff --git a/src/web/app/desktop/tags/timeline.tag b/src/web/app/desktop/tags/timeline.tag index 5967c2efdd..ebc6249c6b 100644 --- a/src/web/app/desktop/tags/timeline.tag +++ b/src/web/app/desktop/tags/timeline.tag @@ -46,24 +46,24 @@ diff --git a/src/web/app/desktop/tags/ui-header-account.tag b/src/web/app/desktop/tags/ui-header-account.tag index fa3f60a618..e6ededc750 100644 --- a/src/web/app/desktop/tags/ui-header-account.tag +++ b/src/web/app/desktop/tags/ui-header-account.tag @@ -167,37 +167,37 @@ this.on('before-unmount', () => { @close! - toggle() { + this.toggle = () => { if @is-open @close! else @open! - open() { + this.open = () => { this.is-open = true this.update(); all = document.query-selector-all 'body *' Array.prototype.for-each.call all, (el) => - el.add-event-listener 'mousedown' @mousedown + el.addEventListener 'mousedown' @mousedown - close() { + this.close = () => { this.is-open = false this.update(); all = document.query-selector-all 'body *' Array.prototype.for-each.call all, (el) => - el.remove-event-listener 'mousedown' @mousedown + el.removeEventListener 'mousedown' @mousedown - mousedown(e) { + this.mousedown = (e) => { e.preventDefault(); if (!contains this.root, e.target) and (this.root != e.target) @close! return false - drive() { + this.drive = () => { @close! riot.mount document.body.appendChild document.createElement 'mk-drive-browser-window' - settings() { + this.settings = () => { @close! riot.mount document.body.appendChild document.createElement 'mk-settings-window' diff --git a/src/web/app/desktop/tags/ui-header-clock.tag b/src/web/app/desktop/tags/ui-header-clock.tag index 339951fb6f..5b42cefbbf 100644 --- a/src/web/app/desktop/tags/ui-header-clock.tag +++ b/src/web/app/desktop/tags/ui-header-clock.tag @@ -58,7 +58,7 @@ diff --git a/src/web/app/desktop/tags/ui-header-notifications.tag b/src/web/app/desktop/tags/ui-header-notifications.tag index 1768f915e5..0a355e022a 100644 --- a/src/web/app/desktop/tags/ui-header-notifications.tag +++ b/src/web/app/desktop/tags/ui-header-notifications.tag @@ -77,27 +77,27 @@ diff --git a/src/web/app/desktop/tags/ui-header-search.tag b/src/web/app/desktop/tags/ui-header-search.tag index 69d2dd7324..cc8ca2ae02 100644 --- a/src/web/app/desktop/tags/ui-header-search.tag +++ b/src/web/app/desktop/tags/ui-header-search.tag @@ -34,7 +34,7 @@ diff --git a/src/web/app/desktop/tags/ui.tag b/src/web/app/desktop/tags/ui.tag index 1ecb0f5706..1e2cba35be 100644 --- a/src/web/app/desktop/tags/ui.tag +++ b/src/web/app/desktop/tags/ui.tag @@ -14,20 +14,20 @@ diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag index ddaf600619..6daa50c26d 100644 --- a/src/web/app/mobile/tags/drive.tag +++ b/src/web/app/mobile/tags/drive.tag @@ -167,20 +167,20 @@ @stream.off 'drive_folder_created' this.on-stream-drive-folder-created @stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated - on-stream-drive-file-created(file) { + this.on-stream-drive-file-created = (file) => { @add-file file, true - on-stream-drive-file-updated(file) { + this.on-stream-drive-file-updated = (file) => { current = if this.folder? then this.folder.id else null if current != file.folder_id @remove-file file else @add-file file, true - on-stream-drive-folder-created(folder) { + this.on-stream-drive-folder-created = (folder) => { @add-folder folder, true - on-stream-drive-folder-updated(folder) { + this.on-stream-drive-folder-updated = (folder) => { current = if this.folder? then this.folder.id else null if current != folder.parent_id @remove-folder folder @@ -190,10 +190,10 @@ @_move = (ev) => @move ev.item.folder - move(target-folder) { + this.move = (target-folder) => { @cd target-folder - cd(target-folder, silent = false) { + this.cd = (target-folder, silent = false) => { this.file = null if target-folder? and typeof target-folder == 'object' @@ -226,7 +226,7 @@ .catch (err, text-status) -> console.error err - add-folder(folder, unshift = false) { + this.add-folder = (folder, unshift = false) => { current = if this.folder? then this.folder.id else null if current != folder.parent_id return @@ -241,7 +241,7 @@ this.update(); - add-file(file, unshift = false) { + this.add-file = (file, unshift = false) => { current = if this.folder? then this.folder.id else null if current != file.folder_id return @@ -259,19 +259,19 @@ this.update(); - remove-folder(folder) { + this.remove-folder = (folder) => { if typeof folder == 'object' folder = folder.id this.folders = this.folders.filter (f) -> f.id != folder this.update(); - remove-file(file) { + this.remove-file = (file) => { if typeof file == 'object' file = file.id this.files = this.files.filter (f) -> f.id != file this.update(); - go-root() { + this.go-root = () => { if this.folder != null or this.file != null this.file = null this.folder = null @@ -280,7 +280,7 @@ this.trigger('move-root'); @load! - load() { + this.load = () => { this.folders = [] this.files = [] this.more-folders = false @@ -337,11 +337,11 @@ flag := true this.trigger('load-mid'); - choose-file(file) { + this.choose-file = (file) => { if @is-select-mode exist = @selected-files.some (f) => f.id == file.id if exist - selected-files(@selected-files.filter (f) { f.id != file.id) + this.selected-files = (@selected-files.filter (f) => { f.id != file.id) else @selected-files.push file this.update(); @@ -349,7 +349,7 @@ else @cf file - cf(file, silent = false) { + this.cf = (file, silent = false) => { if typeof file == 'object' file = file.id diff --git a/src/web/app/mobile/tags/drive/file-viewer.tag b/src/web/app/mobile/tags/drive/file-viewer.tag index eff41ab85f..5f1380ae80 100644 --- a/src/web/app/mobile/tags/drive/file-viewer.tag +++ b/src/web/app/mobile/tags/drive/file-viewer.tag @@ -188,7 +188,7 @@ this.file = this.opts.file this.kind = this.file.type.split '/' .0 - rename() { + this.rename = () => { name = window.prompt '名前を変更' this.file.name if name? and name != '' and name != this.file.name this.api 'drive/files/update' do diff --git a/src/web/app/mobile/tags/drive/file.tag b/src/web/app/mobile/tags/drive/file.tag index c831349197..77b5b220ad 100644 --- a/src/web/app/mobile/tags/drive/file.tag +++ b/src/web/app/mobile/tags/drive/file.tag @@ -131,7 +131,7 @@ this.browser.on('change-selected', (selects) => { this.is-selected = selects.some (f) => f.id == this.file.id - onclick() { + this.onclick = () => { this.browser.choose-file this.file diff --git a/src/web/app/mobile/tags/drive/folder.tag b/src/web/app/mobile/tags/drive/folder.tag index c536fed9d9..4c4727a308 100644 --- a/src/web/app/mobile/tags/drive/folder.tag +++ b/src/web/app/mobile/tags/drive/folder.tag @@ -40,7 +40,7 @@ this.browser = this.parent this.folder = this.opts.folder - onclick() { + this.onclick = () => { this.browser.move this.folder diff --git a/src/web/app/mobile/tags/follow-button.tag b/src/web/app/mobile/tags/follow-button.tag index 99936530c8..36447f3acd 100644 --- a/src/web/app/mobile/tags/follow-button.tag +++ b/src/web/app/mobile/tags/follow-button.tag @@ -69,17 +69,17 @@ @stream.off 'follow' this.on-stream-follow @stream.off 'unfollow' this.on-stream-unfollow - on-stream-follow(user) { + this.on-stream-follow = (user) => { if user.id == @user.id this.user = user this.update(); - on-stream-unfollow(user) { + this.on-stream-unfollow = (user) => { if user.id == @user.id this.user = user this.update(); - onclick() { + this.onclick = () => { this.wait = true if @user.is_following this.api 'following/delete' do diff --git a/src/web/app/mobile/tags/home-timeline.tag b/src/web/app/mobile/tags/home-timeline.tag index 98c3a08215..322ba8f932 100644 --- a/src/web/app/mobile/tags/home-timeline.tag +++ b/src/web/app/mobile/tags/home-timeline.tag @@ -25,19 +25,19 @@ @stream.off 'follow' this.on-stream-follow @stream.off 'unfollow' this.on-stream-unfollow - more() { + this.more = () => { this.api 'posts/timeline' do max_id: this.refs.timeline.tail!.id - on-stream-post(post) { + this.on-stream-post = (post) => { this.is-empty = false this.update(); this.refs.timeline.add-post post - on-stream-follow() { + this.on-stream-follow = () => { @fetch! - on-stream-unfollow() { + this.on-stream-unfollow = () => { @fetch! diff --git a/src/web/app/mobile/tags/images-viewer.tag b/src/web/app/mobile/tags/images-viewer.tag index 6ff03ba637..ad02850e30 100644 --- a/src/web/app/mobile/tags/images-viewer.tag +++ b/src/web/app/mobile/tags/images-viewer.tag @@ -21,7 +21,7 @@ this.images = this.opts.images this.image = @images.0 - click() { + this.click = () => { window.open @image.url diff --git a/src/web/app/mobile/tags/notifications.tag b/src/web/app/mobile/tags/notifications.tag index 59bcebaa40..9d665ec93e 100644 --- a/src/web/app/mobile/tags/notifications.tag +++ b/src/web/app/mobile/tags/notifications.tag @@ -79,7 +79,7 @@ this.on('unmount', () => { @stream.off 'notification' this.on-notification - on-notification(notification) { + this.on-notification = (notification) => { @notifications.unshift notification this.update(); diff --git a/src/web/app/mobile/tags/page/entrance.tag b/src/web/app/mobile/tags/page/entrance.tag index 3ec43f0f61..1197d0578e 100644 --- a/src/web/app/mobile/tags/page/entrance.tag +++ b/src/web/app/mobile/tags/page/entrance.tag @@ -45,15 +45,15 @@ diff --git a/src/web/app/mobile/tags/page/home.tag b/src/web/app/mobile/tags/page/home.tag index cfa6d55dac..d46e834746 100644 --- a/src/web/app/mobile/tags/page/home.tag +++ b/src/web/app/mobile/tags/page/home.tag @@ -23,21 +23,21 @@ this.Progress.start(); @stream.on 'post' this.on-stream-post - document.add-event-listener 'visibilitychange' @window-on-visibilitychange, false + document.addEventListener 'visibilitychange' @window-on-visibilitychange, false this.refs.ui.refs.home.on('loaded', () => { this.Progress.done(); this.on('unmount', () => { @stream.off 'post' this.on-stream-post - document.remove-event-listener 'visibilitychange' @window-on-visibilitychange + document.removeEventListener 'visibilitychange' @window-on-visibilitychange - on-stream-post(post) { + this.on-stream-post = (post) => { if document.hidden and post.user_id !== this.I.id @unread-count++ document.title = '(' + @unread-count + ') ' + @get-post-summary post - window-on-visibilitychange() { + this.window-on-visibilitychange = () => { if !document.hidden this.unread-count = 0 document.title = 'Misskey' diff --git a/src/web/app/mobile/tags/post-detail.tag b/src/web/app/mobile/tags/post-detail.tag index 7d19a96d54..9319cfe68e 100644 --- a/src/web/app/mobile/tags/post-detail.tag +++ b/src/web/app/mobile/tags/post-detail.tag @@ -391,18 +391,18 @@ this.replies = replies this.update(); - reply() { + this.reply = () => { @open-post-form do reply: @p - repost() { + this.repost = () => { text = window.prompt '「' + @summary + '」をRepost' if text? this.api 'posts/create' do repost_id: @p.id text: if text == '' then undefined else text - like() { + this.like = () => { if @p.is_liked this.api 'posts/likes/delete' do post_id: @p.id @@ -416,7 +416,7 @@ @p.is_liked = true this.update(); - load-context() { + this.load-context = () => { this.loading-context = true // Get context diff --git a/src/web/app/mobile/tags/post-form.tag b/src/web/app/mobile/tags/post-form.tag index 72778f3b40..7b7243cf06 100644 --- a/src/web/app/mobile/tags/post-form.tag +++ b/src/web/app/mobile/tags/post-form.tag @@ -200,13 +200,13 @@ this.refs.text.focus(); - onkeypress(e) { + this.onkeypress = (e) => { if (e.char-code == 10 || e.char-code == 13) && e.ctrlKey @post! else return true - onpaste(e) { + this.onpaste = (e) => { data = e.clipboardData items = data.items for i from 0 to items.length - 1 @@ -216,10 +216,10 @@ @upload item.getAsFile(); return true - select-file() { + this.select-file = () => { this.refs.file.click! - select-file-from-drive() { + this.select-file-from-drive = () => { browser = document.body.appendChild document.createElement 'mk-drive-selector' browser = riot.mount browser, do multiple: true @@ -227,16 +227,16 @@ browser.on('selected', (files) => { files.for-each @add-file - change-file() { + this.change-file = () => { files = this.refs.file.files for i from 0 to files.length - 1 file = files.item i @upload file - upload(file) { + this.upload = (file) => { this.refs.uploader.upload file - add-file(file) { + this.add-file = (file) => { file._remove = => this.files = this.files.filter (x) -> x.id != file.id this.trigger 'change-files' this.files @@ -246,14 +246,14 @@ this.trigger 'change-files' this.files this.update(); - add-poll() { + this.add-poll = () => { this.poll = true - on-poll-destroyed() { + this.on-poll-destroyed = () => { @update do poll: false - post() { + this.post = () => { this.wait = true files = if this.files? and this.files.length > 0 @@ -274,11 +274,11 @@ this.wait = false this.update(); - cancel() { + this.cancel = () => { this.trigger('cancel'); this.unmount(); - cat() { + this.cat = () => { this.refs.text.value = this.refs.text.value + get-cat! diff --git a/src/web/app/mobile/tags/search-posts.tag b/src/web/app/mobile/tags/search-posts.tag index 120df41407..caa0af4be3 100644 --- a/src/web/app/mobile/tags/search-posts.tag +++ b/src/web/app/mobile/tags/search-posts.tag @@ -22,7 +22,7 @@ res posts this.trigger('loaded'); - more() { + this.more = () => { @offset += @max this.api 'posts/search' do query: @query diff --git a/src/web/app/mobile/tags/timeline-post.tag b/src/web/app/mobile/tags/timeline-post.tag index faa05ec7a9..9cc6a088b5 100644 --- a/src/web/app/mobile/tags/timeline-post.tag +++ b/src/web/app/mobile/tags/timeline-post.tag @@ -319,18 +319,18 @@ riot.mount @preview, do url: t.content - reply() { + this.reply = () => { @open-post-form do reply: @p - repost() { + this.repost = () => { text = window.prompt '「' + @summary + '」をRepost' if text? this.api 'posts/create' do repost_id: @p.id text: if text == '' then undefined else text - like() { + this.like = () => { if @p.is_liked this.api 'posts/likes/delete' do post_id: @p.id diff --git a/src/web/app/mobile/tags/timeline.tag b/src/web/app/mobile/tags/timeline.tag index 156c4e4294..c6ae414556 100644 --- a/src/web/app/mobile/tags/timeline.tag +++ b/src/web/app/mobile/tags/timeline.tag @@ -91,7 +91,7 @@ post._date = date post._datetext = month + '月 ' + date + '日' - more() { + this.more = () => { if @init or @fetching or @posts.length == 0 then return this.fetching = true this.update(); @@ -99,20 +99,20 @@ this.fetching = false @prepend-posts posts - set-posts(posts) { + this.set-posts = (posts) => { this.posts = posts this.update(); - prepend-posts(posts) { + this.prepend-posts = (posts) => { posts.for-each (post) => @posts.push post this.update(); - add-post(post) { + this.add-post = (post) => { @posts.unshift post this.update(); - tail() { + this.tail = () => { @posts[@posts.length - 1] diff --git a/src/web/app/mobile/tags/ui-header.tag b/src/web/app/mobile/tags/ui-header.tag index f4f44e972a..6a7ec8ec54 100644 --- a/src/web/app/mobile/tags/ui-header.tag +++ b/src/web/app/mobile/tags/ui-header.tag @@ -98,7 +98,7 @@ if this.refs.title? this.refs.title.innerHTML = title - post() { + this.post = () => { @open-post-form! diff --git a/src/web/app/mobile/tags/ui-nav.tag b/src/web/app/mobile/tags/ui-nav.tag index efdec8e14d..67fbeefd15 100644 --- a/src/web/app/mobile/tags/ui-nav.tag +++ b/src/web/app/mobile/tags/ui-nav.tag @@ -123,7 +123,7 @@ this.on('mount', () => { this.opts.ready! - search() { + this.search = () => { query = window.prompt '検索' if query? and query != '' @page '/search:' + query diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag index cb87469c01..3913de7546 100644 --- a/src/web/app/mobile/tags/ui.tag +++ b/src/web/app/mobile/tags/ui.tag @@ -29,21 +29,21 @@ this.on('unmount', () => { @stream.off 'notification' this.on-stream-notification - ready() { + this.ready = () => { @ready-count++ if @ready-count == 2 @init-view-position! - init-view-position() { + this.init-view-position = () => { top = this.refs.header.root.offset-height this.refs.main.style.padding-top = top + 'px' - toggle-drawer() { + this.toggle-drawer = () => { this.is-drawer-opening = !@is-drawer-opening this.refs.nav.root.style.display = if @is-drawer-opening then 'block' else 'none' - on-stream-notification(notification) { + this.on-stream-notification = (notification) => { el = document.body.appendChild document.createElement 'mk-notify' riot.mount el, do notification: notification diff --git a/src/web/app/mobile/tags/user-followers.tag b/src/web/app/mobile/tags/user-followers.tag index 49091421eb..4eafb1ed90 100644 --- a/src/web/app/mobile/tags/user-followers.tag +++ b/src/web/app/mobile/tags/user-followers.tag @@ -10,7 +10,7 @@ this.user = this.opts.user - fetch(iknow, limit, cursor, cb) { + this.fetch = (iknow, limit, cursor, cb) => { this.api 'users/followers' do user_id: @user.id iknow: iknow diff --git a/src/web/app/mobile/tags/user-following.tag b/src/web/app/mobile/tags/user-following.tag index c00894a4c0..25d3c9926e 100644 --- a/src/web/app/mobile/tags/user-following.tag +++ b/src/web/app/mobile/tags/user-following.tag @@ -10,7 +10,7 @@ this.user = this.opts.user - fetch(iknow, limit, cursor, cb) { + this.fetch = (iknow, limit, cursor, cb) => { this.api 'users/following' do user_id: @user.id iknow: iknow diff --git a/src/web/app/mobile/tags/user-timeline.tag b/src/web/app/mobile/tags/user-timeline.tag index a05fd84228..82a6413546 100644 --- a/src/web/app/mobile/tags/user-timeline.tag +++ b/src/web/app/mobile/tags/user-timeline.tag @@ -22,7 +22,7 @@ res posts this.trigger('loaded'); - more() { + this.more = () => { this.api 'users/posts' do user_id: @user.id with_media: @with-media diff --git a/src/web/app/mobile/tags/user.tag b/src/web/app/mobile/tags/user.tag index 6cd815a37f..d36455e6e9 100644 --- a/src/web/app/mobile/tags/user.tag +++ b/src/web/app/mobile/tags/user.tag @@ -172,19 +172,19 @@ this.trigger 'loaded' user this.update(); - go-posts() { + this.go-posts = () => { this.page = 'posts' this.update(); - go-media() { + this.go-media = () => { this.page = 'media' this.update(); - go-graphs() { + this.go-graphs = () => { this.page = 'graphs' this.update(); - go-likes() { + this.go-likes = () => { this.page = 'likes' this.update(); diff --git a/src/web/app/mobile/tags/users-list.tag b/src/web/app/mobile/tags/users-list.tag index 6d45c32c31..b0f7f73ff5 100644 --- a/src/web/app/mobile/tags/users-list.tag +++ b/src/web/app/mobile/tags/users-list.tag @@ -82,7 +82,7 @@ @fetch => this.trigger('loaded'); - fetch(cb) { + this.fetch = (cb) => { this.fetching = true this.update(); obj <~ this.opts.fetch do @@ -95,7 +95,7 @@ this.update(); if cb? then cb! - more() { + this.more = () => { this.more-fetching = true this.update(); obj <~ this.opts.fetch do @@ -107,7 +107,7 @@ this.more-fetching = false this.update(); - set-mode(mode) { + this.set-mode = (mode) => { @update do mode: mode