From 91d8ee5a52ece1cb78e5e3bb74178d41761d540f Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 20 Feb 2017 10:34:57 +0900 Subject: wip --- 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 +++--- 24 files changed, 77 insertions(+), 77 deletions(-) (limited to 'src/web/app/mobile') diff --git a/src/web/app/mobile/tags/drive-selector.tag b/src/web/app/mobile/tags/drive-selector.tag index ce9bdd2b56..873c491542 100644 --- a/src/web/app/mobile/tags/drive-selector.tag +++ b/src/web/app/mobile/tags/drive-selector.tag @@ -63,11 +63,11 @@ this.files = files this.update(); - cancel() { + this.cancel = () => { this.trigger('canceled'); this.unmount(); - ok() { + this.ok = () => { this.trigger 'selected' this.files this.unmount(); 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 -- cgit v1.2.3-freya