This commit is contained in:
syuilo 2017-02-20 16:09:46 +09:00
parent 4c43573c1e
commit c05abf4da7
80 changed files with 400 additions and 366 deletions

View file

@ -95,10 +95,10 @@
Array.prototype.forEach.call all, (el) =>
el.addEventListener 'mousedown' @mousedown
this.api 'users/search_by_username' do
this.api('users/search_by_username', {
query: @q
limit: 30users
.then (users) =>
}).then((users) => {
this.users = users
this.loading = false
this.update();
@ -114,7 +114,7 @@
this.mousedown = (e) => {
if (!contains this.root, e.target) and (this.root != e.target)
@close!
@close();
this.on-click = (e) => {
@complete e.item
@ -128,24 +128,24 @@
e.stopPropagation();
@complete this.users[@select]
else
@close!
@close();
| 27 => // Key[ESC]
e.preventDefault();
e.stopPropagation();
@close!
@close();
| 38 => // Key[↑]
if @select != -1
e.preventDefault();
e.stopPropagation();
@select-prev!
else
@close!
@close();
| 9, 40 => // Key[TAB] or Key[↓]
e.preventDefault();
e.stopPropagation();
@select-next!
| _ =>
@close!
@close();
this.select-next = () => {
@select++
@ -174,7 +174,7 @@
this.opts.complete user
this.close = () => {
this.opts.close!
this.opts.close();
function contains(parent, child)
node = child.parentNode

View file

@ -80,7 +80,7 @@
this.wait = false
this.on('mount', () => {
this.user-promise.then (user) =>
this.user-promise}).then((user) => {
this.user = user
this.init = false
this.update();
@ -104,7 +104,7 @@
this.onclick = () => {
this.wait = true
if this.user.is_following
this.api 'following/delete' do
this.api('following/delete', {
user_id: this.user.id
.then =>
this.user.is_following = false
@ -114,7 +114,7 @@
this.wait = false
this.update();
else
this.api 'following/create' do
this.api('following/create', {
user_id: this.user.id
.then =>
this.user.is_following = true

View file

@ -100,7 +100,7 @@
this.mousedown = (e) => {
e.preventDefault();
if (!contains this.root, e.target) and (this.root != e.target)
@close!
@close();
return false
this.open = (pos) => {

View file

@ -175,14 +175,14 @@
this.ok = () => {
@cropper.get-cropped-canvas!.to-blob (blob) =>
this.trigger 'cropped' blob
this.refs.window.close!
this.refs.window.close();
this.skip = () => {
this.trigger('skiped');
this.refs.window.close!
this.refs.window.close();
this.cancel = () => {
this.trigger('canceled');
this.refs.window.close!
this.refs.window.close();
</script>
</mk-crop-window>

View file

@ -84,7 +84,7 @@
button._onclick = =>
if button.onclick?
button.onclick();
@close!
@close();
this.on('mount', () => {
this.refs.header.innerHTML = this.opts.title
@ -142,6 +142,6 @@
if @can-through
if this.opts.on-through?
this.opts.on-through!
@close!
@close();
</script>
</mk-dialog>

View file

@ -54,11 +54,13 @@
e.preventDefault();
e.stopPropagation();
this.I.data.no_donation = true
this.I.update!
this.api 'i/appdata/set' do
data: JSON.stringify do
this.I.data.no_donation = true;
this.I.update();
this.api('i/appdata/set', {
data: JSON.stringify({
no_donation: this.I.data.no_donation
})
});
this.unmount();
};

View file

@ -23,16 +23,16 @@
this.open = (pos) => {
this.refs.ctx.open pos
this.create-folder = () => {
this.browser.create-folder!
this.refs.ctx.close!
this.createFolder = () => {
this.browser.createFolder!
this.refs.ctx.close();
this.upload = () => {
this.browser.select-local-file!
this.refs.ctx.close!
this.refs.ctx.close();
this.url-upload = () => {
this.browser.url-upload!
this.refs.ctx.close!
this.refs.ctx.close();
</script>
</mk-drive-browser-base-contextmenu>

View file

@ -36,11 +36,11 @@
this.refs.window.on('closed', () => {
this.unmount();
this.api 'drive' .then (info) =>
this.api 'drive' }).then((info) => {
@update do
usage: info.usage / info.capacity * 100
this.close = () => {
this.refs.window.close!
this.refs.window.close();
</script>
</mk-drive-browser-window>

View file

@ -405,7 +405,7 @@
if (this.files.some (f) => f.id == file)
return false
@remove-file file
this.api 'drive/files/update' do
this.api('drive/files/update', {
file_id: file
folder_id: if this.folder? then this.folder.id else null
.then =>
@ -422,7 +422,7 @@
if (this.folders.some (f) => f.id == folder)
return false
@remove-folder folder
this.api 'drive/folders/update' do
this.api('drive/folders/update', {
folder_id: folder
parent_id: if this.folder? then this.folder.id else null
.then =>
@ -442,8 +442,8 @@
e.preventDefault();
e.stopImmediatePropagation();
ctx = document.body.appendChild document.createElement 'mk-drive-browser-base-contextmenu'
ctx = riot.mount ctx, do
ctx = document.body.appendChild(document.createElement('mk-drive-browser-base-contextmenu'));
ctx = riot.mount ctx, do
browser: this
ctx = ctx.0
ctx.open do
@ -462,7 +462,7 @@
null
if url? and url != ''
this.api 'drive/files/upload_from_url' do
this.api('drive/files/upload_from_url', {
url: url
folder_id: if this.folder? then this.folder.id else undefined
@ -473,16 +473,16 @@
text: 'OK'
]
this.create-folder = () => {
this.createFolder = () => {
name <~ @input-dialog do
'フォルダー作成'
'フォルダー名'
null
this.api 'drive/folders/create' do
this.api('drive/folders/create', {
name: name
folder_id: if this.folder? then this.folder.id else undefined
.then (folder) =>
}).then((folder) => {
@add-folder folder, true
this.update();
.catch (err) =>
@ -502,9 +502,9 @@
this.get-selection = () => {
this.files.filter (file) -> file._selected
this.new-window = (folder-id) => {
browser = document.body.appendChild document.createElement 'mk-drive-browser-window'
riot.mount browser, do
this.newWindow = (folder-id) => {
browser = document.body.appendChild(document.createElement('mk-drive-browser-window'));
riot.mount browser, do
folder: folder-id
this.move = (target-folder) => {
@ -518,9 +518,9 @@
this.loading = true
this.update();
this.api 'drive/folders/show' do
this.api('drive/folders/show', {
folder_id: target-folder
.then (folder) =>
}).then((folder) => {
this.folder = folder
this.hierarchyFolders = []
@ -607,10 +607,10 @@
files-max = 30
// フォルダ一覧取得
this.api 'drive/folders' do
this.api('drive/folders', {
folder_id: if this.folder? then this.folder.id else null
limit: folders-max + 1
.then (folders) =>
}).then((folders) => {
if folders.length == folders-max + 1
this.more-folders = true
folders.pop!
@ -620,10 +620,10 @@
console.error err
// ファイル一覧取得
this.api 'drive/files' do
this.api('drive/files', {
folder_id: if this.folder? then this.folder.id else null
limit: files-max + 1
.then (files) =>
}).then((files) => {
if files.length == files-max + 1
this.more-files = true
files.pop!

View file

@ -58,14 +58,14 @@
this.refs.ctx.open pos
this.rename = () => {
this.refs.ctx.close!
this.refs.ctx.close();
name <~ @input-dialog do
'ファイル名の変更'
'新しいファイル名を入力してください'
this.file.name
this.api 'drive/files/update' do
this.api('drive/files/update', {
file_id: this.file.id
name: name
.then =>
@ -77,18 +77,18 @@
@NotImplementedException!
this.download = () => {
this.refs.ctx.close!
this.refs.ctx.close();
this.set-avatar = () => {
this.refs.ctx.close!
this.refs.ctx.close();
@update-avatar this.I, null, this.file
this.set-banner = () => {
this.refs.ctx.close!
this.refs.ctx.close();
@update-banner this.I, null, this.file
this.set-wallpaper = () => {
this.refs.ctx.close!
this.refs.ctx.close();
@update-wallpaper this.I, null, this.file
this.add-app = () => {

View file

@ -177,8 +177,8 @@
this.is-contextmenu-showing = true
this.update();
ctx = document.body.appendChild document.createElement 'mk-drive-browser-file-contextmenu'
ctx = riot.mount ctx, do
ctx = document.body.appendChild(document.createElement('mk-drive-browser-file-contextmenu'));
ctx = riot.mount ctx, do
browser: this.browser
file: this.file
ctx = ctx.0

View file

@ -21,11 +21,11 @@
this.mixin('api');
this.mixin('input-dialog');
this.browser = this.opts.browser
this.folder = this.opts.folder
this.browser = this.opts.browser;
this.folder = this.opts.folder;
this.open = (pos) => {
this.refs.ctx.open pos
this.open = pos => {
this.refs.ctx.open(pos);
this.refs.ctx.on('closed', () => {
this.trigger('closed');
@ -33,29 +33,25 @@
this.move = () => {
this.browser.move this.folder.id
this.refs.ctx.close!
this.refs.ctx.close();
this.new-window = () => {
this.browser.new-window this.folder.id
this.refs.ctx.close!
this.newWindow = () => {
this.browser.newWindow this.folder.id
this.refs.ctx.close();
this.create-folder = () => {
this.browser.create-folder!
this.refs.ctx.close!
this.upload = () => {
this.browser.select-lcoal-file!
this.refs.ctx.close!
this.createFolder = () => {
this.browser.createFolder();
this.refs.ctx.close();
this.rename = () => {
this.refs.ctx.close!
this.refs.ctx.close();
name <~ @input-dialog do
'フォルダ名の変更'
'新しいフォルダ名を入力してください'
this.folder.name
this.api 'drive/folders/update' do
this.api('drive/folders/update', {
folder_id: this.folder.id
name: name
.then =>

View file

@ -115,7 +115,7 @@
if obj.type == 'file'
file = obj.id
this.browser.remove-file file
this.api 'drive/files/update' do
this.api('drive/files/update', {
file_id: file
folder_id: this.folder.id
.then =>
@ -130,7 +130,7 @@
if folder == this.folder.id
return false
this.browser.remove-folder folder
this.api 'drive/folders/update' do
this.api('drive/folders/update', {
folder_id: folder
parent_id: this.folder.id
.then =>
@ -167,8 +167,8 @@
this.is-contextmenu-showing = true
this.update();
ctx = document.body.appendChild document.createElement 'mk-drive-browser-folder-contextmenu'
ctx = riot.mount ctx, do
ctx = document.body.appendChild(document.createElement('mk-drive-browser-folder-contextmenu'));
ctx = riot.mount ctx, do
browser: this.browser
folder: this.folder
ctx = ctx.0

View file

@ -69,7 +69,7 @@
if obj.type == 'file'
file = obj.id
this.browser.remove-file file
this.api 'drive/files/update' do
this.api('drive/files/update', {
file_id: file
folder_id: if this.folder? then this.folder.id else null
.then =>
@ -84,7 +84,7 @@
if this.folder? and folder == this.folder.id
return false
this.browser.remove-folder folder
this.api 'drive/folders/update' do
this.api('drive/folders/update', {
folder_id: folder
parent_id: if this.folder? then this.folder.id else null
.then =>

View file

@ -77,7 +77,7 @@
this.wait = false
this.on('mount', () => {
this.user-promise.then (user) =>
this.user-promise}).then((user) => {
this.user = user
this.init = false
this.update();
@ -101,7 +101,7 @@
this.onclick = () => {
this.wait = true
if this.user.is_following
this.api 'following/delete' do
this.api('following/delete', {
user_id: this.user.id
.then =>
this.user.is_following = false
@ -111,7 +111,7 @@
this.wait = false
this.update();
else
this.api 'following/create' do
this.api('following/create', {
user_id: this.user.id
.then =>
this.user.is_following = true

View file

@ -140,10 +140,10 @@
this.users = null
this.update();
this.api 'users/recommendation' do
this.api('users/recommendation', {
limit: @limit
offset: @limit * this.page
.then (users) =>
}).then((users) => {
this.loading = false
this.users = users
this.update();

View file

@ -72,9 +72,9 @@
this.refs.timeline.focus();
this.fetch = (cb) => {
this.api 'posts/mentions' do
this.api('posts/mentions', {
following: this.mode == 'following'
.then (posts) =>
}).then((posts) => {
this.is-loading = false
this.is-empty = posts.length == 0
this.update();
@ -89,10 +89,10 @@
return
this.more-loading = true
this.update();
this.api 'posts/mentions' do
this.api('posts/mentions', {
following: this.mode == 'following'
max_id: this.refs.timeline.tail!.id
.then (posts) =>
}).then((posts) => {
this.more-loading = false
this.update();
this.refs.timeline.prepend-posts posts

View file

@ -66,10 +66,10 @@
this.on('mount', () => {
this.stream.on 'drive_file_created' this.on-stream-drive-file-created
this.api 'drive/stream' do
this.api('drive/stream', {
type: 'image/*'
limit: 9images
.then (images) =>
}).then((images) => {
this.initializing = false
this.images = images
this.update();

View file

@ -81,7 +81,7 @@
this.fetch = () => {
this.api CONFIG.url + '/api:rss' do
url: @url
.then (feed) =>
}).then((feed) => {
this.items = feed.rss.channel.item
this.initializing = false
this.update();

View file

@ -68,7 +68,7 @@
this.load = (cb) => {
this.api 'posts/timeline'
.then (posts) =>
}).then((posts) => {
this.is-loading = false
this.is-empty = posts.length == 0
this.update();
@ -83,9 +83,9 @@
return
this.more-loading = true
this.update();
this.api 'posts/timeline' do
this.api('posts/timeline', {
max_id: this.refs.timeline.tail!.id
.then (posts) =>
}).then((posts) => {
this.more-loading = false
this.update();
this.refs.timeline.prepend-posts posts

View file

@ -132,10 +132,10 @@
this.loading = true
this.users = null
if not quiet then this.update();
this.api 'users/recommendation' do
this.api('users/recommendation', {
limit: @limit
offset: @limit * this.page
.then (users) =>
}).then((users) => {
this.loading = false
this.users = users
this.update();

View file

@ -38,8 +38,8 @@
this.refs.view.style.background-position = xp + '% ' + yp + '%'
this.click = () => {
dialog = document.body.appendChild document.createElement 'mk-image-dialog'
riot.mount dialog, do
dialog = document.body.appendChild(document.createElement('mk-image-dialog'));
riot.mount dialog, do
image: @image
</script>
</mk-images-viewer>

View file

@ -141,12 +141,12 @@
this.cancel = () => {
this.done = false
this.refs.window.close!
this.refs.window.close();
this.ok = () => {
if not @allow-empty and @text.value == '' then return
this.done = true
this.refs.window.close!
this.refs.window.close();
this.on-keydown = (e) => {
if e.which == 13 // Enter

View file

@ -24,8 +24,8 @@
this.unmount();
this.refs.window.refs.index.on('navigate-user', user => {
w = document.body.appendChild document.createElement 'mk-messaging-room-window'
riot.mount w, do
w = document.body.appendChild(document.createElement('mk-messaging-room-window'));
riot.mount w, do
user: user
</script>
</mk-messaging-window>

View file

@ -187,7 +187,7 @@
this.on('mount', () => {
this.api 'i/notifications'
.then (notifications) =>
}).then((notifications) => {
this.notifications = notifications
this.loading = false
this.update();

View file

@ -125,13 +125,13 @@
this.like = () => {
if this.post.is_liked
this.api 'posts/likes/delete' do
this.api('posts/likes/delete', {
post_id: this.post.id
.then =>
this.post.is_liked = false
this.update();
else
this.api 'posts/likes/create' do
this.api('posts/likes/create', {
post_id: this.post.id
.then =>
this.post.is_liked = true

View file

@ -342,9 +342,9 @@
this.on('mount', () => {
this.api 'posts/show' do
this.api('posts/show', {
post_id: this.opts.post
.then (post) =>
}).then((post) => {
this.fetching = false
this.post = post
this.trigger('loaded');
@ -368,55 +368,55 @@
tokens
.filter (t) -> t.type == 'link'
.map (t) =>
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
riot.mount this.preview, do
this.preview = this.refs.text.appendChild(document.createElement('mk-url-preview'));
riot.mount this.preview, do
url: t.content
// Get likes
this.api 'posts/likes' do
this.api('posts/likes', {
post_id: this.p.id
limit: 8
.then (likes) =>
}).then((likes) => {
this.likes = likes
this.update();
// Get reposts
this.api 'posts/reposts' do
this.api('posts/reposts', {
post_id: this.p.id
limit: 8
.then (reposts) =>
}).then((reposts) => {
this.reposts = reposts
this.update();
// Get replies
this.api 'posts/replies' do
this.api('posts/replies', {
post_id: this.p.id
limit: 8
.then (replies) =>
}).then((replies) => {
this.replies = replies
this.update();
this.update();
this.reply = () => {
form = document.body.appendChild document.createElement 'mk-post-form-window'
riot.mount form, do
form = document.body.appendChild(document.createElement('mk-post-form-window'));
riot.mount form, do
reply: this.p
this.repost = () => {
form = document.body.appendChild document.createElement 'mk-repost-form-window'
riot.mount form, do
form = document.body.appendChild(document.createElement('mk-repost-form-window'));
riot.mount form, do
post: this.p
this.like = () => {
if this.p.is_liked
this.api 'posts/likes/delete' do
this.api('posts/likes/delete', {
post_id: this.p.id
.then =>
this.p.is_liked = false
this.update();
else
this.api 'posts/likes/create' do
this.api('posts/likes/create', {
post_id: this.p.id
.then =>
this.p.is_liked = true
@ -426,9 +426,9 @@
this.loading-context = true
// Get context
this.api 'posts/context' do
this.api('posts/context', {
post_id: this.p.reply_to_id
.then (context) =>
}).then((context) => {
this.context = context.reverse!
this.loading-context = false
this.update();

View file

@ -42,7 +42,7 @@
this.unmount();
this.refs.window.refs.form.on('post', () => {
this.refs.window.close!
this.refs.window.close();
this.refs.window.refs.form.on('change-uploading-files', (files) => {
this.uploading-files = files

View file

@ -405,8 +405,8 @@
this.refs.file.click();
this.select-file-from-drive = () => {
browser = document.body.appendChild document.createElement 'mk-select-file-from-drive-window'
i = riot.mount browser, do
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.forEach @add-file
@ -444,12 +444,12 @@
then this.files.map (f) -> f.id
else undefined
this.api 'posts/create' do
this.api('posts/create', {
text: this.refs.text.value
media_ids: files
reply_to_id: if @in-reply-to-post? then @in-reply-to-post.id else undefined
poll: if this.poll then this.refs.poll.get! else undefined
.then (data) =>
}).then((data) => {
this.trigger('post');
@notify if @in-reply-to-post? then '返信しました!' else '投稿しました!'
.catch (err) =>

View file

@ -20,22 +20,22 @@
this.post = post
this.update();
this.api 'aggregation/posts/like' do
this.api('aggregation/posts/like', {
post_id: this.post.id
limit: 30days
.then (likes) =>
}).then((likes) => {
likes = likes.reverse!
this.api 'aggregation/posts/repost' do
this.api('aggregation/posts/repost', {
post_id: this.post.id
limit: 30days
.then (repost) =>
}).then((repost) => {
repost = repost.reverse!
this.api 'aggregation/posts/reply' do
this.api('aggregation/posts/reply', {
post_id: this.post.id
limit: 30days
.then (replies) =>
}).then((replies) => {
replies = replies.reverse!
new Chart this.refs.canv, do

View file

@ -89,6 +89,6 @@
this.update();
this.close = () => {
this.refs.window.close!
this.refs.window.close();
</script>
</mk-progress-dialog>

View file

@ -16,14 +16,14 @@
tag = e.target.tag-name.to-lower-case!
if tag != 'input' and tag != 'textarea'
if e.which == 27 // Esc
this.refs.window.close!
this.refs.window.close();
this.on('mount', () => {
this.refs.window.refs.form.on('cancel', () => {
this.refs.window.close!
this.refs.window.close();
this.refs.window.refs.form.on('posted', () => {
this.refs.window.close!
this.refs.window.close();
document.addEventListener 'keydown' this.on-document-keydown

View file

@ -125,10 +125,10 @@
this.ok = () => {
this.wait = true
this.api 'posts/create' do
this.api('posts/create', {
repost_id: this.opts.post.id
text: if @quote then this.refs.text.value else undefined
.then (data) =>
}).then((data) => {
this.trigger('posted');
@notify 'Repostしました'
.catch (err) =>

View file

@ -41,9 +41,9 @@
document.addEventListener 'keydown' this.on-document-keydown
window.addEventListener 'scroll' this.on-scroll
this.api 'posts/search' do
this.api('posts/search', {
query: @query
.then (posts) =>
}).then((posts) => {
this.is-loading = false
this.is-empty = posts.length == 0
this.update();
@ -67,10 +67,10 @@
return
this.more-loading = true
this.update();
this.api 'posts/search' do
this.api('posts/search', {
query: @query
page: this.page + 1
.then (posts) =>
}).then((posts) => {
this.more-loading = false
this.page++
this.update();

View file

@ -149,13 +149,13 @@
this.unmount();
this.close = () => {
this.refs.window.close!
this.refs.window.close();
this.upload = () => {
this.refs.window.refs.browser.select-local-file!
this.ok = () => {
this.trigger 'selected' this.file
this.refs.window.close!
this.refs.window.close();
</script>
</mk-select-file-from-drive-window>

View file

@ -20,6 +20,6 @@
this.unmount();
this.close = () => {
this.refs.window.close!
this.refs.window.close();
</script>
</mk-settings-window>

View file

@ -212,31 +212,31 @@
@update-avatar this.I
this.update-account = () => {
this.api 'i/update' do
this.api('i/update', {
name: this.refs.account-name.value
location: this.refs.account-location.value
bio: this.refs.account-bio.value
birthday: this.refs.account-birthday.value
.then (i) =>
}).then((i) => {
alert 'ok'
.catch (err) =>
console.error err
this.update-cache = () => {
this.I.data.cache = !this.I.data.cache
this.api 'i/appdata/set' do
this.api('i/appdata/set', {
data: JSON.stringify do
cache: this.I.data.cache
this.update-debug = () => {
this.I.data.debug = !this.I.data.debug
this.api 'i/appdata/set' do
this.api('i/appdata/set', {
data: JSON.stringify do
debug: this.I.data.debug
this.update-nya = () => {
this.I.data.nya = !this.I.data.nya
this.api 'i/appdata/set' do
this.api('i/appdata/set', {
data: JSON.stringify do
nya: this.I.data.nya
</script>

View file

@ -55,8 +55,13 @@
<button class={ liked: p.is_liked } onclick={ like } title="善哉"><i class="fa fa-thumbs-o-up"></i>
<p class="count" if={ p.likes_count > 0 }>{ p.likes_count }</p>
</button>
<button onclick={ NotImplementedException }><i class="fa fa-ellipsis-h"></i></button>
<button onclick={ toggleDetail } title="詳細"><i class="fa fa-caret-down" if={ !isDetailOpened }></i><i class="fa fa-caret-up" if={ isDetailOpened }></i></button>
<button onclick={ NotImplementedException }>
<i class="fa fa-ellipsis-h"></i>
</button>
<button onclick={ toggleDetail } title="詳細">
<i class="fa fa-caret-down" if={ !isDetailOpened }></i>
<i class="fa fa-caret-up" if={ isDetailOpened }></i>
</button>
</footer>
</div>
</article>
@ -328,46 +333,45 @@
this.isDetailOpened = false;
this.on('mount', () => {
if this.p.text?
tokens = if this.p._highlight?
then @analyze this.p._highlight
else @analyze this.p.text
if (this.p.text) {
const tokens = this.analyze(this.p.text);
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.innerHTML = this.refs.text.innerHTML.replace('<p class="dummy"></p>', this.compile(tokens));
this.refs.text.children.forEach (e) =>
if e.tag-name == 'MK-URL'
riot.mount e
this.refs.text.children.forEach(e => {
if (e.tagName == 'MK-URL') riot.mount(e);
});
// URLをプレビュー
tokens
.filter (t) -> t.type == 'link'
.map (t) =>
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
riot.mount this.preview, do
url: t.content
.filter(t => t.type == 'link')
.map(t => {
riot.mount(this.refs.text.appendChild(document.createElement('mk-url-preview')), {
url: t.content
});
});
}
});
this.reply = () => {
form = document.body.appendChild document.createElement 'mk-post-form-window'
riot.mount form, do
form = document.body.appendChild(document.createElement('mk-post-form-window'));
riot.mount form, do
reply: this.p
this.repost = () => {
form = document.body.appendChild document.createElement 'mk-repost-form-window'
riot.mount form, do
form = document.body.appendChild(document.createElement('mk-repost-form-window'));
riot.mount form, do
post: this.p
this.like = () => {
if this.p.is_liked
this.api 'posts/likes/delete' do
this.api('posts/likes/delete', {
post_id: this.p.id
.then =>
this.p.is_liked = false
this.update();
else
this.api 'posts/likes/create' do
this.api('posts/likes/create', {
post_id: this.p.id
.then =>
this.p.is_liked = true

View file

@ -165,11 +165,11 @@
this.is-open = false
this.on('before-unmount', () => {
@close!
@close();
this.toggle = () => {
if @is-open
@close!
@close();
else
@open!
@ -190,17 +190,17 @@
this.mousedown = (e) => {
e.preventDefault();
if (!contains this.root, e.target) and (this.root != e.target)
@close!
@close();
return false
this.drive = () => {
@close!
riot.mount document.body.appendChild document.createElement 'mk-drive-browser-window'
@close();
riot.mount document.body.appendChild(document.createElement('mk-drive-browser-window'));
this.settings = () => {
@close!
riot.mount document.body.appendChild document.createElement 'mk-settings-window'
@close();
riot.mount document.body.appendChild(document.createElement('mk-settings-window'));
function contains(parent, child)
node = child.parentNode
while node?

View file

@ -89,7 +89,7 @@
// Fetch count of unread messaging messages
this.api 'messaging/unread'
.then (count) =>
}).then((count) => {
if count.count > 0
this.has-unread-messaging-messages = true
this.update();
@ -107,7 +107,7 @@
this.update();
this.messaging = () => {
riot.mount document.body.appendChild document.createElement 'mk-messaging-window'
</script>
riot.mount document.body.appendChild(document.createElement('mk-messaging-window'));
</script>
</ul>
</mk-ui-header-nav>

View file

@ -79,7 +79,7 @@
this.toggle = () => {
if @is-open
@close!
@close();
else
@open!
@ -100,7 +100,7 @@
this.mousedown = (e) => {
e.preventDefault();
if (!contains this.root, e.target) and (this.root != e.target)
@close!
@close();
return false
function contains(parent, child)

View file

@ -35,7 +35,8 @@
</style>
<script>
this.post = (e) => {
this.parent.parent.open-post-form!
this.post = e => {
this.parent.parent.openPostForm();
};
</script>
</mk-ui-header-post-button>

View file

@ -80,6 +80,5 @@
display none
</style>
<script>this.mixin('i');</script>
</mk-ui-header>

View file

@ -19,16 +19,16 @@
this.user = user
this.update();
this.api 'aggregation/users/followers' do
this.api('aggregation/users/followers', {
user_id: this.user.id
limit: 30days
.then (followers) =>
}).then((followers) => {
followers = followers.reverse!
this.api 'aggregation/users/following' do
this.api('aggregation/users/following', {
user_id: this.user.id
limit: 30days
.then (following) =>
}).then((following) => {
following = following.reverse!
new Chart this.refs.canv, do

View file

@ -19,10 +19,10 @@
this.user = user
this.update();
this.api 'aggregation/users/like' do
this.api('aggregation/users/like', {
user_id: this.user.id
limit: 30days
.then (likes) =>
}).then((likes) => {
likes = likes.reverse!
new Chart this.refs.canv, do

View file

@ -67,15 +67,15 @@
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
this.on('mount', () => {
this.user-promise.then (user) =>
this.user-promise}).then((user) => {
this.user = user
this.update();
this.api 'users/posts' do
this.api('users/posts', {
user_id: this.user.id
with_media: true
limit: 9posts
.then (posts) =>
}).then((posts) => {
this.initializing = false
posts.forEach (post) =>
post.media.forEach (image) =>

View file

@ -19,10 +19,10 @@
this.user = user
this.update();
this.api 'aggregation/users/post' do
this.api('aggregation/users/post', {
user_id: this.user.id
limit: 30days
.then (data) =>
}).then((data) => {
data = data.reverse!
new Chart this.refs.canv, do
type: 'line'

View file

@ -105,16 +105,16 @@
this.user-promise =
if typeof @u == 'string'
new Promise (resolve, reject) =>
this.api 'users/show' do
this.api('users/show', {
user_id: if @u.0 == '@' then undefined else @u
username: if @u.0 == '@' then @u.substr 1 else undefined
.then (user) =>
}).then((user) => {
resolve user
else
Promise.resolve @u
this.on('mount', () => {
this.user-promise.then (user) =>
this.user-promise}).then((user) => {
this.user = user
this.update();

View file

@ -87,13 +87,13 @@
this.user = this.opts.user
this.show-following = () => {
window = document.body.appendChild document.createElement 'mk-user-following-window'
riot.mount window, do
window = document.body.appendChild(document.createElement('mk-user-following-window'));
riot.mount window, do
user: this.user
this.show-followers = () => {
window = document.body.appendChild document.createElement 'mk-user-followers-window'
riot.mount window, do
window = document.body.appendChild(document.createElement('mk-user-followers-window'));
riot.mount window, do
user: this.user
</script>
</mk-user-profile>

View file

@ -63,7 +63,7 @@
document.addEventListener 'keydown' this.on-document-keydown
window.addEventListener 'scroll' this.on-scroll
this.user-promise.then (user) =>
this.user-promise}).then((user) => {
this.user = user
this.update();
@ -82,10 +82,10 @@
this.refs.timeline.focus();
this.fetch = (cb) => {
this.api 'users/posts' do
this.api('users/posts', {
user_id: this.user.id
with_replies: this.mode == 'with-replies'
.then (posts) =>
}).then((posts) => {
this.is-loading = false
this.is-empty = posts.length == 0
this.update();
@ -100,11 +100,11 @@
return
this.more-loading = true
this.update();
this.api 'users/posts' do
this.api('users/posts', {
user_id: this.user.id
with_replies: this.mode == 'with-replies'
max_id: this.refs.timeline.tail!.id
.then (posts) =>
}).then((posts) => {
this.more-loading = false
this.update();
this.refs.timeline.prepend-posts posts

View file

@ -40,9 +40,9 @@
this.user = null
this.on('mount', () => {
this.api 'users/show' do
this.api('users/show', {
username: this.username
.then (user) =>
}).then((user) => {
this.fetching = false
this.user = user
this.update();

View file

@ -320,7 +320,7 @@
this.bg-click = () => {
if @can-close
@close!
@close();
this.on-body-mousedown = (e) => {
@top!
@ -506,7 +506,7 @@
if @can-close
e.preventDefault();
e.stopPropagation();
@close!
@close();
function contains(parent, child)
node = child.parentNode