wip
This commit is contained in:
parent
4c43573c1e
commit
c05abf4da7
|
@ -112,13 +112,13 @@
|
|||
this.app = @session.app
|
||||
|
||||
this.cancel = () => {
|
||||
this.api 'auth/deny' do
|
||||
this.api('auth/deny', {
|
||||
token: @session.token
|
||||
.then =>
|
||||
this.trigger('denied');
|
||||
|
||||
this.accept = () => {
|
||||
this.api 'auth/accept' do
|
||||
this.api('auth/accept', {
|
||||
token: @session.token
|
||||
.then =>
|
||||
this.trigger('accepted');
|
||||
|
|
|
@ -100,15 +100,15 @@
|
|||
if not this.SIGNIN then return
|
||||
|
||||
// Fetch session
|
||||
this.api 'auth/session/show' do
|
||||
this.api('auth/session/show', {
|
||||
token: @token
|
||||
.then (session) =>
|
||||
}).then((session) => {
|
||||
this.session = session
|
||||
this.fetching = false
|
||||
|
||||
// 既に連携していた場合
|
||||
if @session.app.is_authorized
|
||||
this.api 'auth/accept' do
|
||||
this.api('auth/accept', {
|
||||
token: @session.token
|
||||
.then =>
|
||||
@accepted!
|
||||
|
|
|
@ -310,10 +310,10 @@
|
|||
if (q == '') {
|
||||
this.searchResult = [];
|
||||
} else {
|
||||
this.api 'users/search' do
|
||||
this.api('users/search', {
|
||||
query: q
|
||||
max: 5
|
||||
.then (users) =>
|
||||
}).then((users) => {
|
||||
users.forEach (user) =>
|
||||
user._click = =>
|
||||
this.trigger 'navigate-user' user
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
this.on('mount', () => {
|
||||
this.api 'i/signin_history'
|
||||
.then (history) =>
|
||||
}).then((history) => {
|
||||
this.history = history
|
||||
this.fetching = false
|
||||
this.update();
|
||||
|
|
|
@ -103,9 +103,9 @@
|
|||
this.signing = false;
|
||||
|
||||
this.oninput = () => {
|
||||
this.api 'users/show' do
|
||||
this.api('users/show', {
|
||||
username: this.refs.username.value
|
||||
.then (user) =>
|
||||
}).then((user) => {
|
||||
this.user = user
|
||||
this.trigger 'user' user
|
||||
this.update();
|
||||
|
@ -123,7 +123,7 @@
|
|||
this.signing = true
|
||||
this.update();
|
||||
|
||||
this.api 'signin' do
|
||||
this.api('signin', {
|
||||
username: this.refs.username.value
|
||||
password: this.refs.password.value
|
||||
.then =>
|
||||
|
|
|
@ -220,9 +220,9 @@
|
|||
this.username-state = 'wait'
|
||||
this.update();
|
||||
|
||||
this.api 'username/available' do
|
||||
this.api('username/available', {
|
||||
username: username
|
||||
.then (result) =>
|
||||
}).then((result) => {
|
||||
if result.available
|
||||
this.username-state = 'ok'
|
||||
else
|
||||
|
@ -271,14 +271,14 @@
|
|||
const username = this.refs.username.value;
|
||||
const password = this.refs.password.value;
|
||||
|
||||
locker = document.body.appendChild document.createElement 'mk-locker'
|
||||
locker = document.body.appendChild(document.createElement('mk-locker'));
|
||||
|
||||
this.api 'signup' do
|
||||
this.api('signup', {
|
||||
username: username,
|
||||
password: password,
|
||||
'g-recaptcha-response': grecaptcha.getResponse()
|
||||
.then =>
|
||||
this.api 'signin' do
|
||||
this.api('signin', {
|
||||
username: username
|
||||
password: password
|
||||
.then =>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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!
|
||||
|
|
|
@ -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 = () => {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 =>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 =>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -187,7 +187,7 @@
|
|||
|
||||
this.on('mount', () => {
|
||||
this.api 'i/notifications'
|
||||
.then (notifications) =>
|
||||
}).then((notifications) => {
|
||||
this.notifications = notifications
|
||||
this.loading = false
|
||||
this.update();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) =>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -89,6 +89,6 @@
|
|||
this.update();
|
||||
|
||||
this.close = () => {
|
||||
this.refs.window.close!
|
||||
this.refs.window.close();
|
||||
</script>
|
||||
</mk-progress-dialog>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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) =>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
this.unmount();
|
||||
|
||||
this.close = () => {
|
||||
this.refs.window.close!
|
||||
this.refs.window.close();
|
||||
</script>
|
||||
</mk-settings-window>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -165,11 +165,11 @@
|
|||
this.is-open = false
|
||||
|
||||
this.on('before-unmount', () => {
|
||||
@close!
|
||||
@close();
|
||||
|
||||
this.toggle = () => {
|
||||
if @is-open
|
||||
@close!
|
||||
@close();
|
||||
else
|
||||
@open!
|
||||
|
||||
|
@ -190,16 +190,16 @@
|
|||
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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -80,6 +80,5 @@
|
|||
display none
|
||||
|
||||
</style>
|
||||
|
||||
<script>this.mixin('i');</script>
|
||||
</mk-ui-header>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) =>
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -203,9 +203,9 @@
|
|||
this.nid-state = 'wait'
|
||||
this.update();
|
||||
|
||||
this.api 'app/name_id/available' do
|
||||
this.api('app/name_id/available', {
|
||||
name_id: nid
|
||||
.then (result) =>
|
||||
}).then((result) => {
|
||||
if result.available
|
||||
this.nid-state = 'ok'
|
||||
else
|
||||
|
@ -225,9 +225,9 @@
|
|||
this.refs.permission.query-selector-all 'input' .forEach (el) =>
|
||||
if el.checked then permission.push el.value
|
||||
|
||||
locker = document.body.appendChild document.createElement 'mk-locker'
|
||||
locker = document.body.appendChild(document.createElement('mk-locker'));
|
||||
|
||||
this.api 'app/create' do
|
||||
this.api('app/create', {
|
||||
name: name
|
||||
name_id: nid
|
||||
description: description
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
this.fetching = true
|
||||
|
||||
this.on('mount', () => {
|
||||
this.api 'app/show' do
|
||||
this.api('app/show', {
|
||||
app_id: this.opts.app
|
||||
.then (app) =>
|
||||
}).then((app) => {
|
||||
this.app = app
|
||||
this.fetching = false
|
||||
this.update();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
this.on('mount', () => {
|
||||
this.api 'my/apps'
|
||||
.then (apps) =>
|
||||
}).then((apps) => {
|
||||
this.fetching = false
|
||||
this.apps = apps
|
||||
this.update();
|
||||
|
|
|
@ -206,9 +206,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 = []
|
||||
|
||||
|
@ -297,10 +297,10 @@
|
|||
files-max = 20
|
||||
|
||||
// フォルダ一覧取得
|
||||
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!
|
||||
|
@ -310,10 +310,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!
|
||||
|
@ -356,9 +356,9 @@
|
|||
this.loading = true
|
||||
this.update();
|
||||
|
||||
this.api 'drive/files/show' do
|
||||
this.api('drive/files/show', {
|
||||
file_id: file
|
||||
.then (file) =>
|
||||
}).then((file) => {
|
||||
this.file = file
|
||||
this.folder = null
|
||||
this.hierarchyFolders = []
|
||||
|
|
|
@ -191,7 +191,7 @@
|
|||
this.rename = () => {
|
||||
name = window.prompt '名前を変更' this.file.name
|
||||
if name? and name != '' and name != this.file.name
|
||||
this.api 'drive/files/update' do
|
||||
this.api('drive/files/update', {
|
||||
file_id: this.file.id
|
||||
name: name
|
||||
.then =>
|
||||
|
|
|
@ -58,7 +58,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();
|
||||
|
@ -82,7 +82,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
|
||||
|
@ -92,7 +92,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
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
this.init = new Promise (res, rej) =>
|
||||
this.api 'posts/timeline'
|
||||
.then (posts) =>
|
||||
}).then((posts) => {
|
||||
res posts
|
||||
this.trigger('loaded');
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
|||
this.stream.off 'unfollow' this.on-stream-unfollow
|
||||
|
||||
this.more = () => {
|
||||
this.api 'posts/timeline' do
|
||||
this.api('posts/timeline', {
|
||||
max_id: this.refs.timeline.tail!.id
|
||||
|
||||
this.on-stream-post = (post) => {
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
this.on('mount', () => {
|
||||
this.api 'i/notifications'
|
||||
.then (notifications) =>
|
||||
}).then((notifications) => {
|
||||
this.notifications = notifications
|
||||
this.loading = false
|
||||
this.update();
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
this.fetching = true
|
||||
|
||||
this.on('mount', () => {
|
||||
this.api 'users/show' do
|
||||
this.api('users/show', {
|
||||
username: this.opts.username
|
||||
.then (user) =>
|
||||
}).then(user => {
|
||||
this.fetching = false
|
||||
this.user = user
|
||||
this.update();
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
this.on('mount', () => {
|
||||
this.Progress.start();
|
||||
|
||||
this.api 'users/show' do
|
||||
this.api('users/show', {
|
||||
username: this.opts.user
|
||||
.then (user) =>
|
||||
}).then(user => {
|
||||
this.user = user
|
||||
this.fetching = false
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
this.on('mount', () => {
|
||||
this.Progress.start();
|
||||
|
||||
this.api 'users/show' do
|
||||
this.api('users/show', {
|
||||
username: this.opts.user
|
||||
.then (user) =>
|
||||
}).then(user => {
|
||||
this.user = user
|
||||
this.fetching = false
|
||||
|
||||
|
|
|
@ -334,15 +334,15 @@
|
|||
this.mixin('get-post-summary');
|
||||
this.mixin('open-post-form');
|
||||
|
||||
this.fetching = true
|
||||
this.loading-context = false
|
||||
this.content = null
|
||||
this.post = null
|
||||
this.fetching = true;
|
||||
this.loadingContext = false;
|
||||
this.content = null;
|
||||
this.post = null;
|
||||
|
||||
this.on('mount', () => {
|
||||
this.api 'posts/show' do
|
||||
this.api('posts/show', {
|
||||
post_id: this.opts.post
|
||||
.then (post) =>
|
||||
}).then((post) => {
|
||||
this.post = post
|
||||
this.is-repost = this.post.repost?
|
||||
this.p = if @is-repost then this.post.repost else this.post
|
||||
|
@ -363,54 +363,54 @@
|
|||
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.reply = () => {
|
||||
@open-post-form do
|
||||
this.openPostForm do
|
||||
reply: this.p
|
||||
|
||||
this.repost = () => {
|
||||
text = window.prompt '「' + @summary + '」をRepost'
|
||||
if text?
|
||||
this.api 'posts/create' do
|
||||
this.api('posts/create', {
|
||||
repost_id: this.p.id
|
||||
text: if text == '' then undefined else text
|
||||
|
||||
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
|
||||
|
@ -420,9 +420,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();
|
||||
|
|
|
@ -220,8 +220,8 @@
|
|||
this.refs.file.click();
|
||||
|
||||
this.select-file-from-drive = () => {
|
||||
browser = document.body.appendChild document.createElement 'mk-drive-selector'
|
||||
browser = riot.mount browser, do
|
||||
browser = document.body.appendChild(document.createElement('mk-drive-selector'));
|
||||
browser = riot.mount browser, do
|
||||
multiple: true
|
||||
.0
|
||||
browser.on('selected', (files) => {
|
||||
|
@ -260,12 +260,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 this.opts.reply? then this.opts.reply.id else undefined
|
||||
poll: if this.poll then this.refs.poll.get! else undefined
|
||||
.then (data) =>
|
||||
}).then((data) => {
|
||||
this.trigger('post');
|
||||
this.unmount();
|
||||
.catch (err) =>
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
this.with-media = this.opts.with-media
|
||||
|
||||
this.init = new Promise (res, rej) =>
|
||||
this.api 'posts/search' do
|
||||
this.api('posts/search', {
|
||||
query: @query
|
||||
.then (posts) =>
|
||||
}).then((posts) => {
|
||||
res posts
|
||||
this.trigger('loaded');
|
||||
|
||||
this.more = () => {
|
||||
@offset += @max
|
||||
this.api 'posts/search' do
|
||||
this.api('posts/search', {
|
||||
query: @query
|
||||
max: @max
|
||||
offset: @offset
|
||||
|
|
|
@ -3,10 +3,19 @@
|
|||
<mk-timeline-post-sub post={ p.reply_to }></mk-timeline-post-sub>
|
||||
</div>
|
||||
<div class="repost" if={ isRepost }>
|
||||
<p><a class="avatar-anchor" href={ CONFIG.url + '/' + post.user.username }><img class="avatar" src={ post.user.avatar_url + '?thumbnail&size=64' } alt="avatar"/></a><i class="fa fa-retweet"></i><a class="name" href={ CONFIG.url + '/' + post.user.username }>{ post.user.name }</a>がRepost</p>
|
||||
<p>
|
||||
<a class="avatar-anchor" href={ CONFIG.url + '/' + post.user.username }>
|
||||
<img class="avatar" src={ post.user.avatar_url + '?thumbnail&size=64' } alt="avatar"/>
|
||||
</a>
|
||||
<i class="fa fa-retweet"></i>
|
||||
<a class="name" href={ CONFIG.url + '/' + post.user.username }>{ post.user.name }</a>がRepost
|
||||
</p>
|
||||
<mk-time time={ post.created_at }></mk-time>
|
||||
</div>
|
||||
<article><a class="avatar-anchor" href={ CONFIG.url + '/' + p.user.username }><img class="avatar" src={ p.user.avatar_url + '?thumbnail&size=96' } alt="avatar"/></a>
|
||||
<article>
|
||||
<a class="avatar-anchor" href={ CONFIG.url + '/' + p.user.username }>
|
||||
<img class="avatar" src={ p.user.avatar_url + '?thumbnail&size=96' } alt="avatar"/>
|
||||
</a>
|
||||
<div class="main">
|
||||
<header>
|
||||
<a class="name" href={ CONFIG.url + '/' + p.user.username }>{ p.user.name }</a>
|
||||
|
@ -289,59 +298,67 @@
|
|||
this.mixin('api');
|
||||
this.mixin('text');
|
||||
this.mixin('get-post-summary');
|
||||
this.mixin('open-post-form');
|
||||
this.mixin('openPostForm');
|
||||
|
||||
this.post = this.opts.post
|
||||
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.post = this.opts.post;
|
||||
this.isRepost = this.post.repost != null && this.post.text == null;
|
||||
this.p = this.isRepost ? this.post.repost : this.post;
|
||||
this.summary = this.getPostSummary(this.p);
|
||||
this.url = CONFIG.url + '/' + this.p.user.username + '/' + this.p.id
|
||||
|
||||
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 = () => {
|
||||
@open-post-form do
|
||||
this.openPostForm({
|
||||
reply: this.p
|
||||
});
|
||||
};
|
||||
|
||||
this.repost = () => {
|
||||
text = window.prompt '「' + @summary + '」をRepost'
|
||||
if text?
|
||||
this.api 'posts/create' do
|
||||
repost_id: this.p.id
|
||||
text: if text == '' then undefined else text
|
||||
const text = window.prompt(`「${this.summary}」をRepost`);
|
||||
if (text) {
|
||||
this.api('posts/create', {
|
||||
repost_id: this.p.id,
|
||||
text: text == '' ? undefined : text
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.like = () => {
|
||||
if this.p.is_liked
|
||||
this.api 'posts/likes/delete' do
|
||||
if (this.p.is_liked)
|
||||
this.api('posts/likes/delete', {
|
||||
post_id: this.p.id
|
||||
.then =>
|
||||
this.p.is_liked = false
|
||||
}).then(() => {
|
||||
this.p.is_liked = false;
|
||||
this.update();
|
||||
else
|
||||
this.api 'posts/likes/create' do
|
||||
});
|
||||
} else {
|
||||
this.api('posts/likes/create', {
|
||||
post_id: this.p.id
|
||||
.then =>
|
||||
this.p.is_liked = true
|
||||
}).then(() => {
|
||||
this.p.is_liked = true;
|
||||
this.update();
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</mk-timeline-post>
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
this.can-fetch-more = true
|
||||
|
||||
this.on('mount', () => {
|
||||
this.opts.init.then (posts) =>
|
||||
this.opts.init}).then((posts) => {
|
||||
this.init = false
|
||||
@set-posts posts
|
||||
|
||||
|
@ -95,7 +95,7 @@
|
|||
if @init or @fetching or this.posts.length == 0 then return
|
||||
this.fetching = true
|
||||
this.update();
|
||||
this.opts.more!.then (posts) =>
|
||||
this.opts.more!}).then((posts) => {
|
||||
this.fetching = false
|
||||
this.prepend-posts posts
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
</style>
|
||||
<script>
|
||||
this.mixin('ui');
|
||||
this.mixin('open-post-form');
|
||||
this.mixin('openPostForm');
|
||||
|
||||
this.on('mount', () => {
|
||||
this.opts.ready!
|
||||
|
@ -99,6 +99,6 @@
|
|||
this.refs.title.innerHTML = title
|
||||
|
||||
this.post = () => {
|
||||
@open-post-form!
|
||||
this.openPostForm!
|
||||
</script>
|
||||
</mk-ui-header>
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
this.refs.nav.root.style.display = if @is-drawer-opening then 'block' else 'none'
|
||||
|
||||
this.on-stream-notification = (notification) => {
|
||||
el = document.body.appendChild document.createElement 'mk-notify'
|
||||
riot.mount el, do
|
||||
el = document.body.appendChild(document.createElement('mk-notify'));
|
||||
riot.mount el, do
|
||||
notification: notification
|
||||
</script>
|
||||
</mk-ui>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
this.user = this.opts.user
|
||||
|
||||
this.fetch = (iknow, limit, cursor, cb) => {
|
||||
this.api 'users/followers' do
|
||||
this.api('users/followers', {
|
||||
user_id: this.user.id
|
||||
iknow: iknow
|
||||
limit: limit
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
this.user = this.opts.user
|
||||
|
||||
this.fetch = (iknow, limit, cursor, cb) => {
|
||||
this.api 'users/following' do
|
||||
this.api('users/following', {
|
||||
user_id: this.user.id
|
||||
iknow: iknow
|
||||
limit: limit
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
this.with-media = this.opts.with-media
|
||||
|
||||
this.init = new Promise (res, rej) =>
|
||||
this.api 'users/posts' do
|
||||
this.api('users/posts', {
|
||||
user_id: this.user.id
|
||||
with_media: @with-media
|
||||
.then (posts) =>
|
||||
}).then((posts) => {
|
||||
res posts
|
||||
this.trigger('loaded');
|
||||
|
||||
this.more = () => {
|
||||
this.api 'users/posts' do
|
||||
this.api('users/posts', {
|
||||
user_id: this.user.id
|
||||
with_media: @with-media
|
||||
max_id: this.refs.timeline.tail!.id
|
||||
|
|
|
@ -3,20 +3,43 @@
|
|||
<header>
|
||||
<div class="banner" style={ user.banner_url ? 'background-image: url(' + user.banner_url + '?thumbnail&size=1024)' : '' }></div>
|
||||
<div class="body">
|
||||
<div class="top"><a class="avatar"><img src={ user.avatar_url + '?thumbnail&size=160' } alt="avatar"/></a>
|
||||
<div class="top">
|
||||
<a class="avatar">
|
||||
<img src={ user.avatar_url + '?thumbnail&size=160' } alt="avatar"/>
|
||||
</a>
|
||||
<mk-follow-button if={ SIGNIN && I.id != user.id } user={ user }></mk-follow-button>
|
||||
</div>
|
||||
<div class="title">
|
||||
<h1>{ user.name }</h1><span class="username">@{ user.username }</span><span class="followed" if={ user.is_followed }>フォローされています</span>
|
||||
<h1>{ user.name }</h1>
|
||||
<span class="username">@{ user.username }</span>
|
||||
<span class="followed" if={ user.is_followed }>フォローされています</span>
|
||||
</div>
|
||||
<div class="bio">{ user.bio }</div>
|
||||
<div class="info">
|
||||
<p class="location" if={ user.location }><i class="fa fa-map-marker"></i>{ user.location }</p>
|
||||
<p class="birthday" if={ user.birthday }><i class="fa fa-birthday-cake"></i>{ user.birthday.replace('-', '年').replace('-', '月') + '日' } ({ age(user.birthday) }歳)</p>
|
||||
<p class="location" if={ user.location }>
|
||||
<i class="fa fa-map-marker"></i>{ user.location }
|
||||
</p>
|
||||
<p class="birthday" if={ user.birthday }>
|
||||
<i class="fa fa-birthday-cake"></i>{ user.birthday.replace('-', '年').replace('-', '月') + '日' } ({ age(user.birthday) }歳)
|
||||
</p>
|
||||
</div>
|
||||
<div class="friends">
|
||||
<a href="{ user.username }/following">
|
||||
<b>{ user.following_count }</b>
|
||||
<i>フォロー</i>
|
||||
</a>
|
||||
<a href="{ user.username }/followers">
|
||||
<b>{ user.followers_count }</b>
|
||||
<i>フォロワー</i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="friends"><a href="{ user.username }/following"><b>{ user.following_count }</b><i>フォロー</i></a><a href="{ user.username }/followers"><b>{ user.followers_count }</b><i>フォロワー</i></a></div>
|
||||
</div>
|
||||
<nav><a data-is-active={ page == 'posts' } onclick={ goPosts }>投稿</a><a data-is-active={ page == 'media' } onclick={ goMedia }>メディア</a><a data-is-active={ page == 'graphs' } onclick={ goGraphs }>グラフ</a><a data-is-active={ page == 'likes' } onclick={ goLikes }>いいね</a></nav>
|
||||
<nav>
|
||||
<a data-is-active={ page == 'posts' } onclick={ go.bind(null, 'posts') }>投稿</a>
|
||||
<a data-is-active={ page == 'media' } onclick={ go.bind(null, 'media') }>メディア</a>
|
||||
<a data-is-active={ page == 'graphs' } onclick={ go.bind(null, 'graphs') }>グラフ</a>
|
||||
<a data-is-active={ page == 'likes' } onclick={ go.bind(null, 'likes') }>いいね</a>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="body">
|
||||
<mk-user-timeline if={ page == 'posts' } user={ user }></mk-user-timeline>
|
||||
|
@ -154,38 +177,30 @@
|
|||
|
||||
</style>
|
||||
<script>
|
||||
this.age = require 's-age'
|
||||
this.age = require('s-age');
|
||||
|
||||
this.mixin('i');
|
||||
this.mixin('api');
|
||||
|
||||
this.username = this.opts.user
|
||||
this.page = if this.opts.page? then this.opts.page else 'posts'
|
||||
this.fetching = true
|
||||
this.username = this.opts.user;
|
||||
this.page = this.opts.page ? this.opts.page : 'posts';
|
||||
this.fetching = true;
|
||||
|
||||
this.on('mount', () => {
|
||||
this.api 'users/show' do
|
||||
this.api('users/show', {
|
||||
username: this.username
|
||||
.then (user) =>
|
||||
this.fetching = false
|
||||
this.user = user
|
||||
this.trigger 'loaded' user
|
||||
}).then(user => {
|
||||
this.fetching = false;
|
||||
this.user = user;
|
||||
this.trigger('loaded', user);
|
||||
this.update();
|
||||
});
|
||||
});
|
||||
|
||||
this.go-posts = () => {
|
||||
this.page = 'posts'
|
||||
this.update();
|
||||
|
||||
this.go-media = () => {
|
||||
this.page = 'media'
|
||||
this.update();
|
||||
|
||||
this.go-graphs = () => {
|
||||
this.page = 'graphs'
|
||||
this.update();
|
||||
|
||||
this.go-likes = () => {
|
||||
this.page = 'likes'
|
||||
this.update();
|
||||
this.go = page => {
|
||||
this.update({
|
||||
page: page
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</mk-user>
|
||||
|
|
Loading…
Reference in New Issue