wip
This commit is contained in:
@@ -133,7 +133,7 @@
|
||||
|
||||
this.files = []
|
||||
this.folders = []
|
||||
this.hierarchy-folders = []
|
||||
this.hierarchyFolders = []
|
||||
this.selected-files = []
|
||||
|
||||
// 現在の階層(フォルダ)
|
||||
@@ -146,10 +146,10 @@
|
||||
this.multiple = if this.opts.multiple? then this.opts.multiple else false
|
||||
|
||||
this.on('mount', () => {
|
||||
@stream.on 'drive_file_created' this.on-stream-drive-file-created
|
||||
@stream.on 'drive_file_updated' this.on-stream-drive-file-updated
|
||||
@stream.on 'drive_folder_created' this.on-stream-drive-folder-created
|
||||
@stream.on 'drive_folder_updated' this.on-stream-drive-folder-updated
|
||||
this.stream.on 'drive_file_created' this.on-stream-drive-file-created
|
||||
this.stream.on 'drive_file_updated' this.on-stream-drive-file-updated
|
||||
this.stream.on 'drive_folder_created' this.on-stream-drive-folder-created
|
||||
this.stream.on 'drive_folder_updated' this.on-stream-drive-folder-updated
|
||||
|
||||
// Riotのバグでnullを渡しても""になる
|
||||
// https://github.com/riot/riot/issues/2080
|
||||
@@ -162,10 +162,10 @@
|
||||
@load!
|
||||
|
||||
this.on('unmount', () => {
|
||||
@stream.off 'drive_file_created' this.on-stream-drive-file-created
|
||||
@stream.off 'drive_file_updated' this.on-stream-drive-file-updated
|
||||
@stream.off 'drive_folder_created' this.on-stream-drive-folder-created
|
||||
@stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated
|
||||
this.stream.off 'drive_file_created' this.on-stream-drive-file-created
|
||||
this.stream.off 'drive_file_updated' this.on-stream-drive-file-updated
|
||||
this.stream.off 'drive_folder_created' this.on-stream-drive-folder-created
|
||||
this.stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated
|
||||
|
||||
this.on-stream-drive-file-created = (file) => {
|
||||
@add-file file, true
|
||||
@@ -210,10 +210,10 @@
|
||||
folder_id: target-folder
|
||||
.then (folder) =>
|
||||
this.folder = folder
|
||||
this.hierarchy-folders = []
|
||||
this.hierarchyFolders = []
|
||||
|
||||
x = (f) =>
|
||||
@hierarchy-folders.unshift f
|
||||
@hierarchyFolders.unshift f
|
||||
if f.parent?
|
||||
x f.parent
|
||||
|
||||
@@ -275,7 +275,7 @@
|
||||
if this.folder != null or this.file != null
|
||||
this.file = null
|
||||
this.folder = null
|
||||
this.hierarchy-folders = []
|
||||
this.hierarchyFolders = []
|
||||
this.update();
|
||||
this.trigger('move-root');
|
||||
@load!
|
||||
@@ -325,9 +325,9 @@
|
||||
flag = false
|
||||
complete = =>
|
||||
if flag
|
||||
load-folders.for-each (folder) =>
|
||||
load-folders.forEach (folder) =>
|
||||
@add-folder folder
|
||||
load-files.for-each (file) =>
|
||||
load-files.forEach (file) =>
|
||||
@add-file file
|
||||
this.loading = false
|
||||
this.update();
|
||||
@@ -361,10 +361,10 @@
|
||||
.then (file) =>
|
||||
this.file = file
|
||||
this.folder = null
|
||||
this.hierarchy-folders = []
|
||||
this.hierarchyFolders = []
|
||||
|
||||
x = (f) =>
|
||||
@hierarchy-folders.unshift f
|
||||
@hierarchyFolders.unshift f
|
||||
if f.parent?
|
||||
x f.parent
|
||||
|
||||
|
@@ -62,12 +62,12 @@
|
||||
this.user = user
|
||||
this.init = false
|
||||
this.update();
|
||||
@stream.on 'follow' this.on-stream-follow
|
||||
@stream.on 'unfollow' this.on-stream-unfollow
|
||||
this.stream.on 'follow' this.on-stream-follow
|
||||
this.stream.on 'unfollow' this.on-stream-unfollow
|
||||
|
||||
this.on('unmount', () => {
|
||||
@stream.off 'follow' this.on-stream-follow
|
||||
@stream.off 'unfollow' this.on-stream-unfollow
|
||||
this.stream.off 'follow' this.on-stream-follow
|
||||
this.stream.off 'unfollow' this.on-stream-unfollow
|
||||
|
||||
this.on-stream-follow = (user) => {
|
||||
if user.id == @user.id
|
||||
|
@@ -16,14 +16,14 @@
|
||||
this.trigger('loaded');
|
||||
|
||||
this.on('mount', () => {
|
||||
@stream.on 'post' this.on-stream-post
|
||||
@stream.on 'follow' this.on-stream-follow
|
||||
@stream.on 'unfollow' this.on-stream-unfollow
|
||||
this.stream.on 'post' this.on-stream-post
|
||||
this.stream.on 'follow' this.on-stream-follow
|
||||
this.stream.on 'unfollow' this.on-stream-unfollow
|
||||
|
||||
this.on('unmount', () => {
|
||||
@stream.off 'post' this.on-stream-post
|
||||
@stream.off 'follow' this.on-stream-follow
|
||||
@stream.off 'unfollow' this.on-stream-unfollow
|
||||
this.stream.off 'post' this.on-stream-post
|
||||
this.stream.off 'follow' this.on-stream-follow
|
||||
this.stream.off 'unfollow' this.on-stream-unfollow
|
||||
|
||||
this.more = () => {
|
||||
this.api 'posts/timeline' do
|
||||
|
@@ -74,19 +74,19 @@
|
||||
.catch (err, text-status) ->
|
||||
console.error err
|
||||
|
||||
@stream.on 'notification' this.on-notification
|
||||
this.stream.on 'notification' this.on-notification
|
||||
|
||||
this.on('unmount', () => {
|
||||
@stream.off 'notification' this.on-notification
|
||||
this.stream.off 'notification' this.on-notification
|
||||
|
||||
this.on-notification = (notification) => {
|
||||
@notifications.unshift notification
|
||||
this.update();
|
||||
|
||||
this.on('update', () => {
|
||||
@notifications.for-each (notification) =>
|
||||
date = (new Date notification.created_at).get-date!
|
||||
month = (new Date notification.created_at).get-month! + 1
|
||||
@notifications.forEach (notification) =>
|
||||
date = (new Date notification.created_at).getDate()
|
||||
month = (new Date notification.created_at).getMonth() + 1
|
||||
notification._date = date
|
||||
notification._datetext = month + '月 ' + date + '日'
|
||||
</script>
|
||||
|
@@ -22,14 +22,14 @@
|
||||
|
||||
this.Progress.start();
|
||||
|
||||
@stream.on 'post' this.on-stream-post
|
||||
this.stream.on 'post' this.on-stream-post
|
||||
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
|
||||
this.stream.off 'post' this.on-stream-post
|
||||
document.removeEventListener 'visibilitychange' @window-on-visibilitychange
|
||||
|
||||
this.on-stream-post = (post) => {
|
||||
|
@@ -15,7 +15,7 @@
|
||||
this.ui.trigger('title', '<i class="fa fa-comments-o"></i>メッセージ');
|
||||
|
||||
this.refs.ui.refs.index.on('navigate-user', (user) => {
|
||||
@page '/i/messaging/' + user.username
|
||||
this.page '/i/messaging/' + user.username
|
||||
|
||||
</script>
|
||||
</mk-messaging-page>
|
||||
|
@@ -344,18 +344,18 @@
|
||||
post_id: this.opts.post
|
||||
.then (post) =>
|
||||
this.post = post
|
||||
this.is-repost = @post.repost?
|
||||
this.p = if @is-repost then @post.repost else @post
|
||||
this.summary = @get-post-summary @p
|
||||
this.is-repost = this.post.repost?
|
||||
this.p = if @is-repost then this.post.repost else this.post
|
||||
this.summary = @get-post-summary this.p
|
||||
this.trigger('loaded');
|
||||
this.fetching = false
|
||||
this.update();
|
||||
|
||||
if @p.text?
|
||||
tokens = @analyze @p.text
|
||||
if this.p.text?
|
||||
tokens = @analyze this.p.text
|
||||
this.refs.text.innerHTML = @compile tokens
|
||||
|
||||
this.refs.text.children.for-each (e) =>
|
||||
this.refs.text.children.forEach (e) =>
|
||||
if e.tag-name == 'MK-URL'
|
||||
riot.mount e
|
||||
|
||||
@@ -364,12 +364,12 @@
|
||||
.filter (t) -> t.type == 'link'
|
||||
.map (t) =>
|
||||
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
|
||||
riot.mount @preview, do
|
||||
riot.mount this.preview, do
|
||||
url: t.content
|
||||
|
||||
// Get likes
|
||||
this.api 'posts/likes' do
|
||||
post_id: @p.id
|
||||
post_id: this.p.id
|
||||
limit: 8
|
||||
.then (likes) =>
|
||||
this.likes = likes
|
||||
@@ -377,7 +377,7 @@
|
||||
|
||||
// Get reposts
|
||||
this.api 'posts/reposts' do
|
||||
post_id: @p.id
|
||||
post_id: this.p.id
|
||||
limit: 8
|
||||
.then (reposts) =>
|
||||
this.reposts = reposts
|
||||
@@ -385,7 +385,7 @@
|
||||
|
||||
// Get replies
|
||||
this.api 'posts/replies' do
|
||||
post_id: @p.id
|
||||
post_id: this.p.id
|
||||
limit: 8
|
||||
.then (replies) =>
|
||||
this.replies = replies
|
||||
@@ -393,27 +393,27 @@
|
||||
|
||||
this.reply = () => {
|
||||
@open-post-form do
|
||||
reply: @p
|
||||
reply: this.p
|
||||
|
||||
this.repost = () => {
|
||||
text = window.prompt '「' + @summary + '」をRepost'
|
||||
if text?
|
||||
this.api 'posts/create' do
|
||||
repost_id: @p.id
|
||||
repost_id: this.p.id
|
||||
text: if text == '' then undefined else text
|
||||
|
||||
this.like = () => {
|
||||
if @p.is_liked
|
||||
if this.p.is_liked
|
||||
this.api 'posts/likes/delete' do
|
||||
post_id: @p.id
|
||||
post_id: this.p.id
|
||||
.then =>
|
||||
@p.is_liked = false
|
||||
this.p.is_liked = false
|
||||
this.update();
|
||||
else
|
||||
this.api 'posts/likes/create' do
|
||||
post_id: @p.id
|
||||
post_id: this.p.id
|
||||
.then =>
|
||||
@p.is_liked = true
|
||||
this.p.is_liked = true
|
||||
this.update();
|
||||
|
||||
this.load-context = () => {
|
||||
@@ -421,7 +421,7 @@
|
||||
|
||||
// Get context
|
||||
this.api 'posts/context' do
|
||||
post_id: @p.reply_to_id
|
||||
post_id: this.p.reply_to_id
|
||||
.then (context) =>
|
||||
this.context = context.reverse!
|
||||
this.loading-context = false
|
||||
|
@@ -202,7 +202,7 @@
|
||||
|
||||
this.onkeypress = (e) => {
|
||||
if (e.char-code == 10 || e.char-code == 13) && e.ctrlKey
|
||||
@post!
|
||||
this.post!
|
||||
else
|
||||
return true
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
return true
|
||||
|
||||
this.select-file = () => {
|
||||
this.refs.file.click!
|
||||
this.refs.file.click();
|
||||
|
||||
this.select-file-from-drive = () => {
|
||||
browser = document.body.appendChild document.createElement 'mk-drive-selector'
|
||||
@@ -225,7 +225,7 @@
|
||||
multiple: true
|
||||
.0
|
||||
browser.on('selected', (files) => {
|
||||
files.for-each @add-file
|
||||
files.forEach @add-file
|
||||
|
||||
this.change-file = () => {
|
||||
files = this.refs.file.files
|
||||
@@ -264,7 +264,7 @@
|
||||
text: this.refs.text.value
|
||||
media_ids: files
|
||||
reply_to_id: if this.opts.reply? then this.opts.reply.id else undefined
|
||||
poll: if @poll then this.refs.poll.get! else undefined
|
||||
poll: if this.poll then this.refs.poll.get! else undefined
|
||||
.then (data) =>
|
||||
this.trigger('post');
|
||||
this.unmount();
|
||||
|
@@ -35,7 +35,7 @@
|
||||
if @state == 'connected'
|
||||
this.root.style.opacity = 0
|
||||
|
||||
@stream-state-ev.on('connected', () => {
|
||||
this.stream-state-ev.on('connected', () => {
|
||||
this.state = @get-stream-state!
|
||||
this.update();
|
||||
setTimeout =>
|
||||
@@ -44,7 +44,7 @@
|
||||
} 200ms 'linear'
|
||||
, 1000ms
|
||||
|
||||
@stream-state-ev.on('closed', () => {
|
||||
this.stream-state-ev.on('closed', () => {
|
||||
this.state = @get-stream-state!
|
||||
this.update();
|
||||
Velocity this.root, {
|
||||
|
@@ -33,11 +33,11 @@
|
||||
this.post = this.opts.post
|
||||
|
||||
this.on('mount', () => {
|
||||
if @post.text?
|
||||
tokens = @analyze @post.text
|
||||
if this.post.text?
|
||||
tokens = @analyze this.post.text
|
||||
this.refs.text.innerHTML = @compile tokens, false
|
||||
|
||||
this.refs.text.children.for-each (e) =>
|
||||
this.refs.text.children.forEach (e) =>
|
||||
if e.tag-name == 'MK-URL'
|
||||
riot.mount e
|
||||
</script>
|
||||
|
@@ -292,22 +292,22 @@
|
||||
this.mixin('open-post-form');
|
||||
|
||||
this.post = this.opts.post
|
||||
this.is-repost = @post.repost? and !@post.text?
|
||||
this.p = if @is-repost then @post.repost else @post
|
||||
this.summary = @get-post-summary @p
|
||||
this.url = CONFIG.url + '/' + @p.user.username + '/' + @p.id
|
||||
this.is-repost = this.post.repost? and !this.post.text?
|
||||
this.p = if @is-repost then this.post.repost else this.post
|
||||
this.summary = @get-post-summary this.p
|
||||
this.url = CONFIG.url + '/' + this.p.user.username + '/' + this.p.id
|
||||
|
||||
this.on('mount', () => {
|
||||
if @p.text?
|
||||
tokens = if @p._highlight?
|
||||
then @analyze @p._highlight
|
||||
else @analyze @p.text
|
||||
if this.p.text?
|
||||
tokens = if this.p._highlight?
|
||||
then @analyze this.p._highlight
|
||||
else @analyze this.p.text
|
||||
|
||||
this.refs.text.innerHTML = this.refs.text.innerHTML.replace '<p class="dummy"></p>' if @p._highlight?
|
||||
this.refs.text.innerHTML = this.refs.text.innerHTML.replace '<p class="dummy"></p>' if this.p._highlight?
|
||||
then @compile tokens, true, false
|
||||
else @compile tokens
|
||||
|
||||
this.refs.text.children.for-each (e) =>
|
||||
this.refs.text.children.forEach (e) =>
|
||||
if e.tag-name == 'MK-URL'
|
||||
riot.mount e
|
||||
|
||||
@@ -316,32 +316,32 @@
|
||||
.filter (t) -> t.type == 'link'
|
||||
.map (t) =>
|
||||
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
|
||||
riot.mount @preview, do
|
||||
riot.mount this.preview, do
|
||||
url: t.content
|
||||
|
||||
this.reply = () => {
|
||||
@open-post-form do
|
||||
reply: @p
|
||||
reply: this.p
|
||||
|
||||
this.repost = () => {
|
||||
text = window.prompt '「' + @summary + '」をRepost'
|
||||
if text?
|
||||
this.api 'posts/create' do
|
||||
repost_id: @p.id
|
||||
repost_id: this.p.id
|
||||
text: if text == '' then undefined else text
|
||||
|
||||
this.like = () => {
|
||||
if @p.is_liked
|
||||
if this.p.is_liked
|
||||
this.api 'posts/likes/delete' do
|
||||
post_id: @p.id
|
||||
post_id: this.p.id
|
||||
.then =>
|
||||
@p.is_liked = false
|
||||
this.p.is_liked = false
|
||||
this.update();
|
||||
else
|
||||
this.api 'posts/likes/create' do
|
||||
post_id: @p.id
|
||||
post_id: this.p.id
|
||||
.then =>
|
||||
@p.is_liked = true
|
||||
this.p.is_liked = true
|
||||
this.update();
|
||||
</script>
|
||||
</mk-timeline-post>
|
||||
|
@@ -85,34 +85,34 @@
|
||||
@set-posts posts
|
||||
|
||||
this.on('update', () => {
|
||||
@posts.for-each (post) =>
|
||||
date = (new Date post.created_at).get-date!
|
||||
month = (new Date post.created_at).get-month! + 1
|
||||
this.posts.forEach (post) =>
|
||||
date = (new Date post.created_at).getDate()
|
||||
month = (new Date post.created_at).getMonth() + 1
|
||||
post._date = date
|
||||
post._datetext = month + '月 ' + date + '日'
|
||||
|
||||
this.more = () => {
|
||||
if @init or @fetching or @posts.length == 0 then return
|
||||
if @init or @fetching or this.posts.length == 0 then return
|
||||
this.fetching = true
|
||||
this.update();
|
||||
this.opts.more!.then (posts) =>
|
||||
this.fetching = false
|
||||
@prepend-posts posts
|
||||
this.prepend-posts posts
|
||||
|
||||
this.set-posts = (posts) => {
|
||||
this.posts = posts
|
||||
this.update();
|
||||
|
||||
this.prepend-posts = (posts) => {
|
||||
posts.for-each (post) =>
|
||||
@posts.push post
|
||||
posts.forEach (post) =>
|
||||
this.posts.push post
|
||||
this.update();
|
||||
|
||||
this.add-post = (post) => {
|
||||
@posts.unshift post
|
||||
this.posts.unshift post
|
||||
this.update();
|
||||
|
||||
this.tail = () => {
|
||||
@posts[@posts.length - 1]
|
||||
this.posts[this.posts.length - 1]
|
||||
</script>
|
||||
</mk-timeline>
|
||||
|
@@ -126,6 +126,6 @@
|
||||
this.search = () => {
|
||||
query = window.prompt '検索'
|
||||
if query? and query != ''
|
||||
@page '/search:' + query
|
||||
this.page '/search:' + query
|
||||
</script>
|
||||
</mk-ui-nav>
|
||||
|
@@ -23,11 +23,11 @@
|
||||
// alert text
|
||||
|
||||
this.on('mount', () => {
|
||||
@stream.on 'notification' this.on-stream-notification
|
||||
this.stream.on 'notification' this.on-stream-notification
|
||||
@ready!
|
||||
|
||||
this.on('unmount', () => {
|
||||
@stream.off 'notification' this.on-stream-notification
|
||||
this.stream.off 'notification' this.on-stream-notification
|
||||
|
||||
this.ready = () => {
|
||||
@ready-count++
|
||||
|
@@ -86,7 +86,7 @@
|
||||
this.fetching = true
|
||||
this.update();
|
||||
obj <~ this.opts.fetch do
|
||||
@mode == 'iknow'
|
||||
this.mode == 'iknow'
|
||||
@limit
|
||||
null
|
||||
this.users = obj.users
|
||||
@@ -99,7 +99,7 @@
|
||||
this.more-fetching = true
|
||||
this.update();
|
||||
obj <~ this.opts.fetch do
|
||||
@mode == 'iknow'
|
||||
this.mode == 'iknow'
|
||||
@limit
|
||||
@cursor
|
||||
this.users = @users.concat obj.users
|
||||
|
Reference in New Issue
Block a user