wip
This commit is contained in:
parent
3211d90e09
commit
12cba7a76d
|
@ -97,7 +97,7 @@
|
||||||
this.token = window.location.href.split '/' .pop!
|
this.token = window.location.href.split '/' .pop!
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
if not @SIGNIN then return
|
if not this.SIGNIN then return
|
||||||
|
|
||||||
// Fetch session
|
// Fetch session
|
||||||
this.api 'auth/session/show' do
|
this.api 'auth/session/show' do
|
||||||
|
|
|
@ -126,7 +126,7 @@
|
||||||
if @select != -1
|
if @select != -1
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@complete @users[@select]
|
@complete this.users[@select]
|
||||||
else
|
else
|
||||||
@close!
|
@close!
|
||||||
| 27 => // Key[ESC]
|
| 27 => // Key[ESC]
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
this.select-next = () => {
|
this.select-next = () => {
|
||||||
@select++
|
@select++
|
||||||
|
|
||||||
if @select >= @users.length
|
if @select >= this.users.length
|
||||||
this.select = 0
|
this.select = 0
|
||||||
|
|
||||||
@apply-select!
|
@apply-select!
|
||||||
|
@ -159,7 +159,7 @@
|
||||||
@select--
|
@select--
|
||||||
|
|
||||||
if @select < 0
|
if @select < 0
|
||||||
this.select = @users.length - 1
|
this.select = this.users.length - 1
|
||||||
|
|
||||||
@apply-select!
|
@apply-select!
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
this.wait = false
|
this.wait = false
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@user-promise.then (user) =>
|
this.user-promise.then (user) =>
|
||||||
this.user = user
|
this.user = user
|
||||||
this.init = false
|
this.init = false
|
||||||
this.update();
|
this.update();
|
||||||
|
@ -92,22 +92,22 @@
|
||||||
this.stream.off 'unfollow' this.on-stream-unfollow
|
this.stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
this.on-stream-follow = (user) => {
|
this.on-stream-follow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == this.user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.on-stream-unfollow = (user) => {
|
this.on-stream-unfollow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == this.user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.onclick = () => {
|
this.onclick = () => {
|
||||||
this.wait = true
|
this.wait = true
|
||||||
if @user.is_following
|
if this.user.is_following
|
||||||
this.api 'following/delete' do
|
this.api 'following/delete' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
.then =>
|
.then =>
|
||||||
@user.is_following = false
|
this.user.is_following = false
|
||||||
.catch (err) ->
|
.catch (err) ->
|
||||||
console.error err
|
console.error err
|
||||||
.then =>
|
.then =>
|
||||||
|
@ -115,9 +115,9 @@
|
||||||
this.update();
|
this.update();
|
||||||
else
|
else
|
||||||
this.api 'following/create' do
|
this.api 'following/create' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
.then =>
|
.then =>
|
||||||
@user.is_following = true
|
this.user.is_following = true
|
||||||
.catch (err) ->
|
.catch (err) ->
|
||||||
console.error err
|
console.error err
|
||||||
.then =>
|
.then =>
|
||||||
|
|
|
@ -111,11 +111,11 @@
|
||||||
this.root.style.left = pos.x + 'px'
|
this.root.style.left = pos.x + 'px'
|
||||||
this.root.style.top = pos.y + 'px'
|
this.root.style.top = pos.y + 'px'
|
||||||
|
|
||||||
Velocity this.root, 'finish' true
|
Velocity(this.root, 'finish' true
|
||||||
Velocity this.root, { opacity: 0 } 0ms
|
Velocity(this.root, { opacity: 0 } 0ms
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
} {
|
}, {
|
||||||
queue: false
|
queue: false
|
||||||
duration: 100ms
|
duration: 100ms
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
|
|
|
@ -91,46 +91,46 @@
|
||||||
this.refs.body.innerHTML = this.opts.text
|
this.refs.body.innerHTML = this.opts.text
|
||||||
|
|
||||||
this.refs.bg.style.pointer-events = 'auto'
|
this.refs.bg.style.pointer-events = 'auto'
|
||||||
Velocity this.refs.bg, 'finish' true
|
Velocity(this.refs.bg, 'finish' true
|
||||||
Velocity this.refs.bg, {
|
Velocity(this.refs.bg, {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
} {
|
}, {
|
||||||
queue: false
|
queue: false
|
||||||
duration: 100ms
|
duration: 100ms
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
}
|
}
|
||||||
|
|
||||||
Velocity this.refs.main, {
|
Velocity(this.refs.main, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
scale: 1.2
|
scale: 1.2
|
||||||
} {
|
}, {
|
||||||
duration: 0
|
duration: 0
|
||||||
}
|
}
|
||||||
Velocity this.refs.main, {
|
Velocity(this.refs.main, {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
scale: 1
|
scale: 1
|
||||||
} {
|
}, {
|
||||||
duration: 300ms
|
duration: 300ms
|
||||||
easing: [ 0, 0.5, 0.5, 1 ]
|
easing: [ 0, 0.5, 0.5, 1 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
this.refs.bg.style.pointer-events = 'none'
|
this.refs.bg.style.pointer-events = 'none'
|
||||||
Velocity this.refs.bg, 'finish' true
|
Velocity(this.refs.bg, 'finish' true
|
||||||
Velocity this.refs.bg, {
|
Velocity(this.refs.bg, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
} {
|
}, {
|
||||||
queue: false
|
queue: false
|
||||||
duration: 300ms
|
duration: 300ms
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.refs.main.style.pointer-events = 'none'
|
this.refs.main.style.pointer-events = 'none'
|
||||||
Velocity this.refs.main, 'finish' true
|
Velocity(this.refs.main, 'finish' true
|
||||||
Velocity this.refs.main, {
|
Velocity(this.refs.main, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
scale: 0.8
|
scale: 0.8
|
||||||
} {
|
}, {
|
||||||
queue: false
|
queue: false
|
||||||
duration: 300ms
|
duration: 300ms
|
||||||
easing: [ 0.5, -0.5, 1, 0.5 ]
|
easing: [ 0.5, -0.5, 1, 0.5 ]
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
this.wait = false
|
this.wait = false
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@user-promise.then (user) =>
|
this.user-promise.then (user) =>
|
||||||
this.user = user
|
this.user = user
|
||||||
this.init = false
|
this.init = false
|
||||||
this.update();
|
this.update();
|
||||||
|
@ -89,22 +89,22 @@
|
||||||
this.stream.off 'unfollow' this.on-stream-unfollow
|
this.stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
this.on-stream-follow = (user) => {
|
this.on-stream-follow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == this.user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.on-stream-unfollow = (user) => {
|
this.on-stream-unfollow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == this.user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.onclick = () => {
|
this.onclick = () => {
|
||||||
this.wait = true
|
this.wait = true
|
||||||
if @user.is_following
|
if this.user.is_following
|
||||||
this.api 'following/delete' do
|
this.api 'following/delete' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
.then =>
|
.then =>
|
||||||
@user.is_following = false
|
this.user.is_following = false
|
||||||
.catch (err) ->
|
.catch (err) ->
|
||||||
console.error err
|
console.error err
|
||||||
.then =>
|
.then =>
|
||||||
|
@ -112,9 +112,9 @@
|
||||||
this.update();
|
this.update();
|
||||||
else
|
else
|
||||||
this.api 'following/create' do
|
this.api 'following/create' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
.then =>
|
.then =>
|
||||||
@user.is_following = true
|
this.user.is_following = true
|
||||||
.catch (err) ->
|
.catch (err) ->
|
||||||
console.error err
|
console.error err
|
||||||
.then =>
|
.then =>
|
||||||
|
|
|
@ -151,7 +151,7 @@
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
this.refresh = () => {
|
this.refresh = () => {
|
||||||
if @users.length < @limit
|
if this.users.length < @limit
|
||||||
this.page = 0
|
this.page = 0
|
||||||
else
|
else
|
||||||
this.page++
|
this.page++
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
this.on-scroll = () => {
|
this.on-scroll = () => {
|
||||||
current = window.scroll-y + window.inner-height
|
current = window.scrollY + window.inner-height
|
||||||
if current > document.body.offset-height - 8
|
if current > document.body.offset-height - 8
|
||||||
@more!
|
@more!
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
@load!
|
@load!
|
||||||
|
|
||||||
this.on-scroll = () => {
|
this.on-scroll = () => {
|
||||||
current = window.scroll-y + window.inner-height
|
current = window.scrollY + window.inner-height
|
||||||
if current > document.body.offset-height - 8
|
if current > document.body.offset-height - 8
|
||||||
@more!
|
@more!
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -53,17 +53,17 @@
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.change = () => {
|
this.change = () => {
|
||||||
Velocity this.refs.tip, {
|
Velocity(this.refs.tip, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
} {
|
}, {
|
||||||
duration: 500ms
|
duration: 500ms
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
complete: @set
|
complete: @set
|
||||||
}
|
}
|
||||||
|
|
||||||
Velocity this.refs.tip, {
|
Velocity(this.refs.tip, {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
} {
|
}, {
|
||||||
duration: 500ms
|
duration: 500ms
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@fetch!
|
@fetch!
|
||||||
this.clock = setInterval =>
|
this.clock = setInterval =>
|
||||||
if @users.length < @limit
|
if this.users.length < @limit
|
||||||
@fetch true
|
@fetch true
|
||||||
, 60000ms
|
, 60000ms
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
this.refresh = () => {
|
this.refresh = () => {
|
||||||
if @users.length < @limit
|
if this.users.length < @limit
|
||||||
this.page = 0
|
this.page = 0
|
||||||
else
|
else
|
||||||
this.page++
|
this.page++
|
||||||
|
|
|
@ -38,34 +38,34 @@
|
||||||
this.image = this.opts.image
|
this.image = this.opts.image
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
} {
|
}, {
|
||||||
duration: 100ms
|
duration: 100ms
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
}
|
}
|
||||||
|
|
||||||
#Velocity @img, {
|
#Velocity(@img, {
|
||||||
// scale: 1
|
// scale: 1
|
||||||
// opacity: 1
|
// opacity: 1
|
||||||
#} {
|
#}, {
|
||||||
// duration: 200ms
|
// duration: 200ms
|
||||||
// easing: 'ease-out'
|
// easing: 'ease-out'
|
||||||
#}
|
#}
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
} {
|
}, {
|
||||||
duration: 100ms
|
duration: 100ms
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
complete: => this.unmount();
|
complete: => this.unmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
#Velocity @img, {
|
#Velocity(@img, {
|
||||||
// scale: 0.9
|
// scale: 0.9
|
||||||
// opacity: 0
|
// opacity: 0
|
||||||
#} {
|
#}, {
|
||||||
// duration: 200ms
|
// duration: 200ms
|
||||||
// easing: 'ease-in'
|
// easing: 'ease-in'
|
||||||
// complete: =>
|
// complete: =>
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
this.on-scroll = () => {
|
this.on-scroll = () => {
|
||||||
current = window.scroll-y + window.inner-height
|
current = window.scrollY + window.inner-height
|
||||||
if current > document.body.offset-height - 16 // 遊び
|
if current > document.body.offset-height - 16 // 遊び
|
||||||
@more!
|
@more!
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -30,24 +30,24 @@
|
||||||
this.mixin('stream');
|
this.mixin('stream');
|
||||||
|
|
||||||
this.on('before-mount', () => {
|
this.on('before-mount', () => {
|
||||||
this.state = @get-stream-state!
|
this.state = this.getStreamState();
|
||||||
|
|
||||||
if @state == 'connected'
|
if this.state == 'connected'
|
||||||
this.root.style.opacity = 0
|
this.root.style.opacity = 0
|
||||||
|
|
||||||
this.stream-state-ev.on('connected', () => {
|
this.stream-state-ev.on('connected', () => {
|
||||||
this.state = @get-stream-state!
|
this.state = this.getStreamState();
|
||||||
this.update();
|
this.update();
|
||||||
setTimeout =>
|
setTimeout =>
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
} 200ms 'linear'
|
} 200ms 'linear'
|
||||||
, 1000ms
|
, 1000ms
|
||||||
|
|
||||||
this.stream-state-ev.on('closed', () => {
|
this.stream-state-ev.on('closed', () => {
|
||||||
this.state = @get-stream-state!
|
this.state = this.getStreamState();
|
||||||
this.update();
|
this.update();
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
} 0ms
|
} 0ms
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -23,22 +23,22 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
top: '0px'
|
top: '0px'
|
||||||
} {
|
}, {
|
||||||
duration: 500ms
|
duration: 500,
|
||||||
easing: 'ease-out'
|
easing: 'ease-out'
|
||||||
}
|
})
|
||||||
|
|
||||||
setTimeout =>
|
setTimeout(() => {
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
top: '-64px'
|
top: '-64px'
|
||||||
} {
|
}, {
|
||||||
duration: 500ms
|
duration: 500,
|
||||||
easing: 'ease-out'
|
easing: 'ease-out',
|
||||||
complete: =>
|
complete: () => this.unmount()
|
||||||
this.unmount();
|
});
|
||||||
}
|
}, 6000);
|
||||||
, 6000ms
|
});
|
||||||
</script>
|
</script>
|
||||||
</mk-ui-notification>
|
</mk-ui-notification>
|
||||||
|
|
|
@ -9,14 +9,15 @@
|
||||||
<script>
|
<script>
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
|
|
||||||
this.user = this.opts.user
|
this.user = this.opts.user;
|
||||||
|
|
||||||
this.fetch = (iknow, limit, cursor, cb) => {
|
this.fetch = (iknow, limit, cursor, cb) => {
|
||||||
this.api 'users/followers' do
|
this.api('users/followers', {
|
||||||
user_id: @user.id
|
user_id: this.user.id,
|
||||||
iknow: iknow
|
iknow: iknow,
|
||||||
limit: limit
|
limit: limit,
|
||||||
cursor: if cursor? then cursor else undefined
|
cursor: cursor ? cursor : undefined
|
||||||
.then cb
|
}).then(cb);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-user-followers>
|
</mk-user-followers>
|
||||||
|
|
|
@ -9,14 +9,15 @@
|
||||||
<script>
|
<script>
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
|
|
||||||
this.user = this.opts.user
|
this.user = this.opts.user;
|
||||||
|
|
||||||
this.fetch = (iknow, limit, cursor, cb) => {
|
this.fetch = (iknow, limit, cursor, cb) => {
|
||||||
this.api 'users/following' do
|
this.api('users/following', {
|
||||||
user_id: @user.id
|
user_id: this.user.id,
|
||||||
iknow: iknow
|
iknow: iknow,
|
||||||
limit: limit
|
limit: limit,
|
||||||
cursor: if cursor? then cursor else undefined
|
cursor: cursor ? cursor : undefined
|
||||||
.then cb
|
}).then(cb);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-user-following>
|
</mk-user-following>
|
||||||
|
|
|
@ -15,18 +15,18 @@
|
||||||
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
|
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
user <~ @user-promise.then
|
user <~ this.user-promise.then
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.api 'aggregation/users/followers' do
|
this.api 'aggregation/users/followers' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
limit: 30days
|
limit: 30days
|
||||||
.then (followers) =>
|
.then (followers) =>
|
||||||
followers = followers.reverse!
|
followers = followers.reverse!
|
||||||
|
|
||||||
this.api 'aggregation/users/following' do
|
this.api 'aggregation/users/following' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
limit: 30days
|
limit: 30days
|
||||||
.then (following) =>
|
.then (following) =>
|
||||||
following = following.reverse!
|
following = following.reverse!
|
||||||
|
|
|
@ -36,5 +36,6 @@
|
||||||
<script>
|
<script>
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</mk-user-graphs>
|
</mk-user-graphs>
|
||||||
|
|
|
@ -108,35 +108,38 @@
|
||||||
this.mixin('update-banner');
|
this.mixin('update-banner');
|
||||||
this.mixin('NotImplementedException');
|
this.mixin('NotImplementedException');
|
||||||
|
|
||||||
this.user = this.opts.user
|
this.user = this.opts.user;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
window.addEventListener 'load' @scroll
|
window.addEventListener('load', this.scroll);
|
||||||
window.addEventListener 'scroll' @scroll
|
window.addEventListener('scroll', this.scroll);
|
||||||
window.addEventListener 'resize' @scroll
|
window.addEventListener('resize', this.scroll);
|
||||||
|
});
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
window.removeEventListener 'load' @scroll
|
window.removeEventListener('load', this.scroll);
|
||||||
window.removeEventListener 'scroll' @scroll
|
window.removeEventListener('scroll', this.scroll);
|
||||||
window.removeEventListener 'resize' @scroll
|
window.removeEventListener('resize', this.scroll);
|
||||||
|
});
|
||||||
|
|
||||||
this.scroll = () => {
|
this.scroll = () => {
|
||||||
top = window.scroll-y
|
const top = window.scrollY;
|
||||||
height = 280px
|
const height = 280/*px*/;
|
||||||
|
|
||||||
pos = 50 - ((top / height) * 50)
|
const pos = 50 - ((top / height) * 50);
|
||||||
this.refs.banner.style.background-position = 'center ' + pos + '%'
|
this.refs.banner.style.backgroundPosition = `center ${pos}%`;
|
||||||
|
|
||||||
blur = top / 32
|
const blur = top / 32
|
||||||
if blur <= 10
|
if (blur <= 10) this.refs.banner.style.filter = `blur(${blur}px)`;
|
||||||
this.refs.banner.style.filter = 'blur(' + blur + 'px)'
|
};
|
||||||
|
|
||||||
this.on-update-banner = () => {
|
this.onUpdateBanner = () => {
|
||||||
if not @SIGNIN or this.I.id != @user.id
|
if (!this.SIGNIN || this.I.id != this.user.id) return;
|
||||||
return
|
|
||||||
|
|
||||||
@update-banner this.I, (i) =>
|
this.updateBanner(this.I, i => {
|
||||||
@user.banner_url = i.banner_url
|
this.user.banner_url = i.banner_url;
|
||||||
this.update();
|
this.update();
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-user-header>
|
</mk-user-header>
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
|
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
user <~ @user-promise.then
|
user <~ this.user-promise.then
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.api 'aggregation/users/like' do
|
this.api 'aggregation/users/like' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
limit: 30days
|
limit: 30days
|
||||||
.then (likes) =>
|
.then (likes) =>
|
||||||
likes = likes.reverse!
|
likes = likes.reverse!
|
||||||
|
|
|
@ -67,12 +67,12 @@
|
||||||
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
|
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@user-promise.then (user) =>
|
this.user-promise.then (user) =>
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.api 'users/posts' do
|
this.api 'users/posts' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
with_media: true
|
with_media: true
|
||||||
limit: 9posts
|
limit: 9posts
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
|
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
user <~ @user-promise.then
|
user <~ this.user-promise.then
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.api 'aggregation/users/post' do
|
this.api 'aggregation/users/post' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
limit: 30days
|
limit: 30days
|
||||||
.then (data) =>
|
.then (data) =>
|
||||||
data = data.reverse!
|
data = data.reverse!
|
||||||
|
|
|
@ -114,27 +114,27 @@
|
||||||
Promise.resolve @u
|
Promise.resolve @u
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@user-promise.then (user) =>
|
this.user-promise.then (user) =>
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
'margin-top': '-8px'
|
'margin-top': '-8px'
|
||||||
} 0ms
|
} 0ms
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
'margin-top': 0
|
'margin-top': 0
|
||||||
} {
|
}, {
|
||||||
duration: 200ms
|
duration: 200ms
|
||||||
easing: 'ease-out'
|
easing: 'ease-out'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
'margin-top': '-8px'
|
'margin-top': '-8px'
|
||||||
} {
|
}, {
|
||||||
duration: 200ms
|
duration: 200ms
|
||||||
easing: 'ease-out'
|
easing: 'ease-out'
|
||||||
complete: => this.unmount();
|
complete: => this.unmount();
|
||||||
|
|
|
@ -89,11 +89,11 @@
|
||||||
this.show-following = () => {
|
this.show-following = () => {
|
||||||
window = document.body.appendChild document.createElement 'mk-user-following-window'
|
window = document.body.appendChild document.createElement 'mk-user-following-window'
|
||||||
riot.mount window, do
|
riot.mount window, do
|
||||||
user: @user
|
user: this.user
|
||||||
|
|
||||||
this.show-followers = () => {
|
this.show-followers = () => {
|
||||||
window = document.body.appendChild document.createElement 'mk-user-followers-window'
|
window = document.body.appendChild document.createElement 'mk-user-followers-window'
|
||||||
riot.mount window, do
|
riot.mount window, do
|
||||||
user: @user
|
user: this.user
|
||||||
</script>
|
</script>
|
||||||
</mk-user-profile>
|
</mk-user-profile>
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
document.addEventListener 'keydown' this.on-document-keydown
|
document.addEventListener 'keydown' this.on-document-keydown
|
||||||
window.addEventListener 'scroll' this.on-scroll
|
window.addEventListener 'scroll' this.on-scroll
|
||||||
|
|
||||||
@user-promise.then (user) =>
|
this.user-promise.then (user) =>
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
|
|
||||||
this.fetch = (cb) => {
|
this.fetch = (cb) => {
|
||||||
this.api 'users/posts' do
|
this.api 'users/posts' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
with_replies: this.mode == 'with-replies'
|
with_replies: this.mode == 'with-replies'
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
this.is-loading = false
|
this.is-loading = false
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
this.more-loading = true
|
this.more-loading = true
|
||||||
this.update();
|
this.update();
|
||||||
this.api 'users/posts' do
|
this.api 'users/posts' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
with_replies: this.mode == 'with-replies'
|
with_replies: this.mode == 'with-replies'
|
||||||
max_id: this.refs.timeline.tail!.id
|
max_id: this.refs.timeline.tail!.id
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
|
@ -126,7 +126,7 @@
|
||||||
document.title = 'Misskey'
|
document.title = 'Misskey'
|
||||||
|
|
||||||
this.on-scroll = () => {
|
this.on-scroll = () => {
|
||||||
current = window.scroll-y + window.inner-height
|
current = window.scrollY + window.inner-height
|
||||||
if current > document.body.offset-height - 16 // 遊び
|
if current > document.body.offset-height - 16 // 遊び
|
||||||
@more!
|
@more!
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.api 'users/show' do
|
this.api 'users/show' do
|
||||||
username: @username
|
username: this.username
|
||||||
.then (user) =>
|
.then (user) =>
|
||||||
this.fetching = false
|
this.fetching = false
|
||||||
this.user = user
|
this.user = user
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
this.mode == 'iknow'
|
this.mode == 'iknow'
|
||||||
@limit
|
@limit
|
||||||
@cursor
|
@cursor
|
||||||
this.users = @users.concat obj.users
|
this.users = this.users.concat obj.users
|
||||||
this.next = obj.next
|
this.next = obj.next
|
||||||
this.more-fetching = false
|
this.more-fetching = false
|
||||||
this.update();
|
this.update();
|
||||||
|
|
|
@ -243,22 +243,22 @@
|
||||||
|
|
||||||
if @is-modal
|
if @is-modal
|
||||||
this.refs.bg.style.pointer-events = 'auto'
|
this.refs.bg.style.pointer-events = 'auto'
|
||||||
Velocity this.refs.bg, 'finish' true
|
Velocity(this.refs.bg, 'finish' true
|
||||||
Velocity this.refs.bg, {
|
Velocity(this.refs.bg, {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
} {
|
}, {
|
||||||
queue: false
|
queue: false
|
||||||
duration: 100ms
|
duration: 100ms
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.refs.main.style.pointer-events = 'auto'
|
this.refs.main.style.pointer-events = 'auto'
|
||||||
Velocity this.refs.main, 'finish' true
|
Velocity(this.refs.main, 'finish' true
|
||||||
Velocity this.refs.main, {scale: 1.1} 0ms
|
Velocity(this.refs.main, {scale: 1.1} 0ms
|
||||||
Velocity this.refs.main, {
|
Velocity(this.refs.main, {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
scale: 1
|
scale: 1
|
||||||
} {
|
}, {
|
||||||
queue: false
|
queue: false
|
||||||
duration: 200ms
|
duration: 200ms
|
||||||
easing: 'ease-out'
|
easing: 'ease-out'
|
||||||
|
@ -275,21 +275,21 @@
|
||||||
|
|
||||||
if @is-modal
|
if @is-modal
|
||||||
this.refs.bg.style.pointer-events = 'none'
|
this.refs.bg.style.pointer-events = 'none'
|
||||||
Velocity this.refs.bg, 'finish' true
|
Velocity(this.refs.bg, 'finish' true
|
||||||
Velocity this.refs.bg, {
|
Velocity(this.refs.bg, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
} {
|
}, {
|
||||||
queue: false
|
queue: false
|
||||||
duration: 300ms
|
duration: 300ms
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.refs.main.style.pointer-events = 'none'
|
this.refs.main.style.pointer-events = 'none'
|
||||||
Velocity this.refs.main, 'finish' true
|
Velocity(this.refs.main, 'finish' true
|
||||||
Velocity this.refs.main, {
|
Velocity(this.refs.main, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
scale: 0.8
|
scale: 0.8
|
||||||
} {
|
}, {
|
||||||
queue: false
|
queue: false
|
||||||
duration: 300ms
|
duration: 300ms
|
||||||
easing: [ 0.5, -0.5, 1, 0.5 ]
|
easing: [ 0.5, -0.5, 1, 0.5 ]
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
this.wait = false
|
this.wait = false
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@user-promise.then (user) =>
|
this.user-promise.then (user) =>
|
||||||
this.user = user
|
this.user = user
|
||||||
this.init = false
|
this.init = false
|
||||||
this.update();
|
this.update();
|
||||||
|
@ -70,22 +70,22 @@
|
||||||
this.stream.off 'unfollow' this.on-stream-unfollow
|
this.stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
this.on-stream-follow = (user) => {
|
this.on-stream-follow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == this.user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.on-stream-unfollow = (user) => {
|
this.on-stream-unfollow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == this.user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.onclick = () => {
|
this.onclick = () => {
|
||||||
this.wait = true
|
this.wait = true
|
||||||
if @user.is_following
|
if this.user.is_following
|
||||||
this.api 'following/delete' do
|
this.api 'following/delete' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
.then =>
|
.then =>
|
||||||
@user.is_following = false
|
this.user.is_following = false
|
||||||
.catch (err) ->
|
.catch (err) ->
|
||||||
console.error err
|
console.error err
|
||||||
.then =>
|
.then =>
|
||||||
|
@ -93,9 +93,9 @@
|
||||||
this.update();
|
this.update();
|
||||||
else
|
else
|
||||||
this.api 'following/create' do
|
this.api 'following/create' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
.then =>
|
.then =>
|
||||||
@user.is_following = true
|
this.user.is_following = true
|
||||||
.catch (err) ->
|
.catch (err) ->
|
||||||
console.error err
|
console.error err
|
||||||
.then =>
|
.then =>
|
||||||
|
|
|
@ -17,17 +17,17 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
bottom: '0px'
|
bottom: '0px'
|
||||||
} {
|
}, {
|
||||||
duration: 500ms
|
duration: 500ms
|
||||||
easing: 'ease-out'
|
easing: 'ease-out'
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout =>
|
setTimeout =>
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
bottom: '-64px'
|
bottom: '-64px'
|
||||||
} {
|
}, {
|
||||||
duration: 500ms
|
duration: 500ms
|
||||||
easing: 'ease-out'
|
easing: 'ease-out'
|
||||||
complete: =>
|
complete: =>
|
||||||
|
|
|
@ -30,24 +30,24 @@
|
||||||
this.mixin('stream');
|
this.mixin('stream');
|
||||||
|
|
||||||
this.on('before-mount', () => {
|
this.on('before-mount', () => {
|
||||||
this.state = @get-stream-state!
|
this.state = this.getStreamState();
|
||||||
|
|
||||||
if @state == 'connected'
|
if this.state == 'connected'
|
||||||
this.root.style.opacity = 0
|
this.root.style.opacity = 0
|
||||||
|
|
||||||
this.stream-state-ev.on('connected', () => {
|
this.stream-state-ev.on('connected', () => {
|
||||||
this.state = @get-stream-state!
|
this.state = this.getStreamState();
|
||||||
this.update();
|
this.update();
|
||||||
setTimeout =>
|
setTimeout =>
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
} 200ms 'linear'
|
} 200ms 'linear'
|
||||||
, 1000ms
|
, 1000ms
|
||||||
|
|
||||||
this.stream-state-ev.on('closed', () => {
|
this.stream-state-ev.on('closed', () => {
|
||||||
this.state = @get-stream-state!
|
this.state = this.getStreamState();
|
||||||
this.update();
|
this.update();
|
||||||
Velocity this.root, {
|
Velocity(this.root, {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
} 0ms
|
} 0ms
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
this.fetch = (iknow, limit, cursor, cb) => {
|
this.fetch = (iknow, limit, cursor, cb) => {
|
||||||
this.api 'users/followers' do
|
this.api 'users/followers' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
iknow: iknow
|
iknow: iknow
|
||||||
limit: limit
|
limit: limit
|
||||||
cursor: if cursor? then cursor else undefined
|
cursor: if cursor? then cursor else undefined
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
this.fetch = (iknow, limit, cursor, cb) => {
|
this.fetch = (iknow, limit, cursor, cb) => {
|
||||||
this.api 'users/following' do
|
this.api 'users/following' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
iknow: iknow
|
iknow: iknow
|
||||||
limit: limit
|
limit: limit
|
||||||
cursor: if cursor? then cursor else undefined
|
cursor: if cursor? then cursor else undefined
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
this.init = new Promise (res, rej) =>
|
this.init = new Promise (res, rej) =>
|
||||||
this.api 'users/posts' do
|
this.api 'users/posts' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
with_media: @with-media
|
with_media: @with-media
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
res posts
|
res posts
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
this.more = () => {
|
this.more = () => {
|
||||||
this.api 'users/posts' do
|
this.api 'users/posts' do
|
||||||
user_id: @user.id
|
user_id: this.user.id
|
||||||
with_media: @with-media
|
with_media: @with-media
|
||||||
max_id: this.refs.timeline.tail!.id
|
max_id: this.refs.timeline.tail!.id
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -165,7 +165,7 @@
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.api 'users/show' do
|
this.api 'users/show' do
|
||||||
username: @username
|
username: this.username
|
||||||
.then (user) =>
|
.then (user) =>
|
||||||
this.fetching = false
|
this.fetching = false
|
||||||
this.user = user
|
this.user = user
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
this.mode == 'iknow'
|
this.mode == 'iknow'
|
||||||
@limit
|
@limit
|
||||||
@cursor
|
@cursor
|
||||||
this.users = @users.concat obj.users
|
this.users = this.users.concat obj.users
|
||||||
this.next = obj.next
|
this.next = obj.next
|
||||||
this.more-fetching = false
|
this.more-fetching = false
|
||||||
this.update();
|
this.update();
|
||||||
|
|
Loading…
Reference in New Issue