This commit is contained in:
syuilo 2017-02-20 14:33:30 +09:00
parent 3211d90e09
commit 12cba7a76d
37 changed files with 173 additions and 167 deletions

View File

@ -97,7 +97,7 @@
this.token = window.location.href.split '/' .pop!
this.on('mount', () => {
if not @SIGNIN then return
if not this.SIGNIN then return
// Fetch session
this.api 'auth/session/show' do

View File

@ -126,7 +126,7 @@
if @select != -1
e.preventDefault();
e.stopPropagation();
@complete @users[@select]
@complete this.users[@select]
else
@close!
| 27 => // Key[ESC]
@ -150,7 +150,7 @@
this.select-next = () => {
@select++
if @select >= @users.length
if @select >= this.users.length
this.select = 0
@apply-select!
@ -159,7 +159,7 @@
@select--
if @select < 0
this.select = @users.length - 1
this.select = this.users.length - 1
@apply-select!

View File

@ -80,7 +80,7 @@
this.wait = false
this.on('mount', () => {
@user-promise.then (user) =>
this.user-promise.then (user) =>
this.user = user
this.init = false
this.update();
@ -92,22 +92,22 @@
this.stream.off 'unfollow' this.on-stream-unfollow
this.on-stream-follow = (user) => {
if user.id == @user.id
if user.id == this.user.id
this.user = user
this.update();
this.on-stream-unfollow = (user) => {
if user.id == @user.id
if user.id == this.user.id
this.user = user
this.update();
this.onclick = () => {
this.wait = true
if @user.is_following
if this.user.is_following
this.api 'following/delete' do
user_id: @user.id
user_id: this.user.id
.then =>
@user.is_following = false
this.user.is_following = false
.catch (err) ->
console.error err
.then =>
@ -115,9 +115,9 @@
this.update();
else
this.api 'following/create' do
user_id: @user.id
user_id: this.user.id
.then =>
@user.is_following = true
this.user.is_following = true
.catch (err) ->
console.error err
.then =>

View File

@ -111,11 +111,11 @@
this.root.style.left = pos.x + 'px'
this.root.style.top = pos.y + 'px'
Velocity this.root, 'finish' true
Velocity this.root, { opacity: 0 } 0ms
Velocity this.root, {
Velocity(this.root, 'finish' true
Velocity(this.root, { opacity: 0 } 0ms
Velocity(this.root, {
opacity: 1
} {
}, {
queue: false
duration: 100ms
easing: 'linear'

View File

@ -91,46 +91,46 @@
this.refs.body.innerHTML = this.opts.text
this.refs.bg.style.pointer-events = 'auto'
Velocity this.refs.bg, 'finish' true
Velocity this.refs.bg, {
Velocity(this.refs.bg, 'finish' true
Velocity(this.refs.bg, {
opacity: 1
} {
}, {
queue: false
duration: 100ms
easing: 'linear'
}
Velocity this.refs.main, {
Velocity(this.refs.main, {
opacity: 0
scale: 1.2
} {
}, {
duration: 0
}
Velocity this.refs.main, {
Velocity(this.refs.main, {
opacity: 1
scale: 1
} {
}, {
duration: 300ms
easing: [ 0, 0.5, 0.5, 1 ]
}
this.close = () => {
this.refs.bg.style.pointer-events = 'none'
Velocity this.refs.bg, 'finish' true
Velocity this.refs.bg, {
Velocity(this.refs.bg, 'finish' true
Velocity(this.refs.bg, {
opacity: 0
} {
}, {
queue: false
duration: 300ms
easing: 'linear'
}
this.refs.main.style.pointer-events = 'none'
Velocity this.refs.main, 'finish' true
Velocity this.refs.main, {
Velocity(this.refs.main, 'finish' true
Velocity(this.refs.main, {
opacity: 0
scale: 0.8
} {
}, {
queue: false
duration: 300ms
easing: [ 0.5, -0.5, 1, 0.5 ]

View File

@ -77,7 +77,7 @@
this.wait = false
this.on('mount', () => {
@user-promise.then (user) =>
this.user-promise.then (user) =>
this.user = user
this.init = false
this.update();
@ -89,22 +89,22 @@
this.stream.off 'unfollow' this.on-stream-unfollow
this.on-stream-follow = (user) => {
if user.id == @user.id
if user.id == this.user.id
this.user = user
this.update();
this.on-stream-unfollow = (user) => {
if user.id == @user.id
if user.id == this.user.id
this.user = user
this.update();
this.onclick = () => {
this.wait = true
if @user.is_following
if this.user.is_following
this.api 'following/delete' do
user_id: @user.id
user_id: this.user.id
.then =>
@user.is_following = false
this.user.is_following = false
.catch (err) ->
console.error err
.then =>
@ -112,9 +112,9 @@
this.update();
else
this.api 'following/create' do
user_id: @user.id
user_id: this.user.id
.then =>
@user.is_following = true
this.user.is_following = true
.catch (err) ->
console.error err
.then =>

View File

@ -151,7 +151,7 @@
console.error err
this.refresh = () => {
if @users.length < @limit
if this.users.length < @limit
this.page = 0
else
this.page++

View File

@ -100,7 +100,7 @@
console.error err
this.on-scroll = () => {
current = window.scroll-y + window.inner-height
current = window.scrollY + window.inner-height
if current > document.body.offset-height - 8
@more!

View File

@ -104,7 +104,7 @@
@load!
this.on-scroll = () => {
current = window.scroll-y + window.inner-height
current = window.scrollY + window.inner-height
if current > document.body.offset-height - 8
@more!
</script>

View File

@ -53,17 +53,17 @@
this.update();
this.change = () => {
Velocity this.refs.tip, {
Velocity(this.refs.tip, {
opacity: 0
} {
}, {
duration: 500ms
easing: 'linear'
complete: @set
}
Velocity this.refs.tip, {
Velocity(this.refs.tip, {
opacity: 1
} {
}, {
duration: 500ms
easing: 'linear'
}

View File

@ -121,7 +121,7 @@
this.on('mount', () => {
@fetch!
this.clock = setInterval =>
if @users.length < @limit
if this.users.length < @limit
@fetch true
, 60000ms
@ -143,7 +143,7 @@
console.error err
this.refresh = () => {
if @users.length < @limit
if this.users.length < @limit
this.page = 0
else
this.page++

View File

@ -38,34 +38,34 @@
this.image = this.opts.image
this.on('mount', () => {
Velocity this.root, {
Velocity(this.root, {
opacity: 1
} {
}, {
duration: 100ms
easing: 'linear'
}
#Velocity @img, {
#Velocity(@img, {
// scale: 1
// opacity: 1
#} {
#}, {
// duration: 200ms
// easing: 'ease-out'
#}
this.close = () => {
Velocity this.root, {
Velocity(this.root, {
opacity: 0
} {
}, {
duration: 100ms
easing: 'linear'
complete: => this.unmount();
}
#Velocity @img, {
#Velocity(@img, {
// scale: 0.9
// opacity: 0
#} {
#}, {
// duration: 200ms
// easing: 'ease-in'
// complete: =>

View File

@ -79,7 +79,7 @@
console.error err
this.on-scroll = () => {
current = window.scroll-y + window.inner-height
current = window.scrollY + window.inner-height
if current > document.body.offset-height - 16 // 遊び
@more!
</script>

View File

@ -30,24 +30,24 @@
this.mixin('stream');
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.stream-state-ev.on('connected', () => {
this.state = @get-stream-state!
this.state = this.getStreamState();
this.update();
setTimeout =>
Velocity this.root, {
Velocity(this.root, {
opacity: 0
} 200ms 'linear'
, 1000ms
this.stream-state-ev.on('closed', () => {
this.state = @get-stream-state!
this.state = this.getStreamState();
this.update();
Velocity this.root, {
Velocity(this.root, {
opacity: 1
} 0ms
</script>

View File

@ -23,22 +23,22 @@
</style>
<script>
this.on('mount', () => {
Velocity this.root, {
Velocity(this.root, {
top: '0px'
} {
duration: 500ms
}, {
duration: 500,
easing: 'ease-out'
}
})
setTimeout =>
Velocity this.root, {
setTimeout(() => {
Velocity(this.root, {
top: '-64px'
} {
duration: 500ms
easing: 'ease-out'
complete: =>
this.unmount();
}
, 6000ms
}, {
duration: 500,
easing: 'ease-out',
complete: () => this.unmount()
});
}, 6000);
});
</script>
</mk-ui-notification>

View File

@ -9,14 +9,15 @@
<script>
this.mixin('api');
this.user = this.opts.user
this.user = this.opts.user;
this.fetch = (iknow, limit, cursor, cb) => {
this.api 'users/followers' do
user_id: @user.id
iknow: iknow
limit: limit
cursor: if cursor? then cursor else undefined
.then cb
this.api('users/followers', {
user_id: this.user.id,
iknow: iknow,
limit: limit,
cursor: cursor ? cursor : undefined
}).then(cb);
};
</script>
</mk-user-followers>

View File

@ -9,14 +9,15 @@
<script>
this.mixin('api');
this.user = this.opts.user
this.user = this.opts.user;
this.fetch = (iknow, limit, cursor, cb) => {
this.api 'users/following' do
user_id: @user.id
iknow: iknow
limit: limit
cursor: if cursor? then cursor else undefined
.then cb
this.api('users/following', {
user_id: this.user.id,
iknow: iknow,
limit: limit,
cursor: cursor ? cursor : undefined
}).then(cb);
};
</script>
</mk-user-following>

View File

@ -15,18 +15,18 @@
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
this.on('mount', () => {
user <~ @user-promise.then
user <~ this.user-promise.then
this.user = user
this.update();
this.api 'aggregation/users/followers' do
user_id: @user.id
user_id: this.user.id
limit: 30days
.then (followers) =>
followers = followers.reverse!
this.api 'aggregation/users/following' do
user_id: @user.id
user_id: this.user.id
limit: 30days
.then (following) =>
following = following.reverse!

View File

@ -36,5 +36,6 @@
<script>
this.on('mount', () => {
this.trigger('loaded');
});
</script>
</mk-user-graphs>

View File

@ -108,35 +108,38 @@
this.mixin('update-banner');
this.mixin('NotImplementedException');
this.user = this.opts.user
this.user = this.opts.user;
this.on('mount', () => {
window.addEventListener 'load' @scroll
window.addEventListener 'scroll' @scroll
window.addEventListener 'resize' @scroll
window.addEventListener('load', this.scroll);
window.addEventListener('scroll', this.scroll);
window.addEventListener('resize', this.scroll);
});
this.on('unmount', () => {
window.removeEventListener 'load' @scroll
window.removeEventListener 'scroll' @scroll
window.removeEventListener 'resize' @scroll
window.removeEventListener('load', this.scroll);
window.removeEventListener('scroll', this.scroll);
window.removeEventListener('resize', this.scroll);
});
this.scroll = () => {
top = window.scroll-y
height = 280px
const top = window.scrollY;
const height = 280/*px*/;
pos = 50 - ((top / height) * 50)
this.refs.banner.style.background-position = 'center ' + pos + '%'
const pos = 50 - ((top / height) * 50);
this.refs.banner.style.backgroundPosition = `center ${pos}%`;
blur = top / 32
if blur <= 10
this.refs.banner.style.filter = 'blur(' + blur + 'px)'
const blur = top / 32
if (blur <= 10) this.refs.banner.style.filter = `blur(${blur}px)`;
};
this.on-update-banner = () => {
if not @SIGNIN or this.I.id != @user.id
return
this.onUpdateBanner = () => {
if (!this.SIGNIN || this.I.id != this.user.id) return;
@update-banner this.I, (i) =>
@user.banner_url = i.banner_url
this.updateBanner(this.I, i => {
this.user.banner_url = i.banner_url;
this.update();
});
};
</script>
</mk-user-header>

View File

@ -15,12 +15,12 @@
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
this.on('mount', () => {
user <~ @user-promise.then
user <~ this.user-promise.then
this.user = user
this.update();
this.api 'aggregation/users/like' do
user_id: @user.id
user_id: this.user.id
limit: 30days
.then (likes) =>
likes = likes.reverse!

View File

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

View File

@ -15,12 +15,12 @@
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
this.on('mount', () => {
user <~ @user-promise.then
user <~ this.user-promise.then
this.user = user
this.update();
this.api 'aggregation/users/post' do
user_id: @user.id
user_id: this.user.id
limit: 30days
.then (data) =>
data = data.reverse!

View File

@ -114,27 +114,27 @@
Promise.resolve @u
this.on('mount', () => {
@user-promise.then (user) =>
this.user-promise.then (user) =>
this.user = user
this.update();
Velocity this.root, {
Velocity(this.root, {
opacity: 0
'margin-top': '-8px'
} 0ms
Velocity this.root, {
Velocity(this.root, {
opacity: 1
'margin-top': 0
} {
}, {
duration: 200ms
easing: 'ease-out'
}
this.close = () => {
Velocity this.root, {
Velocity(this.root, {
opacity: 0
'margin-top': '-8px'
} {
}, {
duration: 200ms
easing: 'ease-out'
complete: => this.unmount();

View File

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

View File

@ -63,7 +63,7 @@
document.addEventListener 'keydown' this.on-document-keydown
window.addEventListener 'scroll' this.on-scroll
@user-promise.then (user) =>
this.user-promise.then (user) =>
this.user = user
this.update();
@ -83,7 +83,7 @@
this.fetch = (cb) => {
this.api 'users/posts' do
user_id: @user.id
user_id: this.user.id
with_replies: this.mode == 'with-replies'
.then (posts) =>
this.is-loading = false
@ -101,7 +101,7 @@
this.more-loading = true
this.update();
this.api 'users/posts' do
user_id: @user.id
user_id: this.user.id
with_replies: this.mode == 'with-replies'
max_id: this.refs.timeline.tail!.id
.then (posts) =>
@ -126,7 +126,7 @@
document.title = 'Misskey'
this.on-scroll = () => {
current = window.scroll-y + window.inner-height
current = window.scrollY + window.inner-height
if current > document.body.offset-height - 16 // 遊び
@more!

View File

@ -41,7 +41,7 @@
this.on('mount', () => {
this.api 'users/show' do
username: @username
username: this.username
.then (user) =>
this.fetching = false
this.user = user

View File

@ -120,7 +120,7 @@
this.mode == 'iknow'
@limit
@cursor
this.users = @users.concat obj.users
this.users = this.users.concat obj.users
this.next = obj.next
this.more-fetching = false
this.update();

View File

@ -243,22 +243,22 @@
if @is-modal
this.refs.bg.style.pointer-events = 'auto'
Velocity this.refs.bg, 'finish' true
Velocity this.refs.bg, {
Velocity(this.refs.bg, 'finish' true
Velocity(this.refs.bg, {
opacity: 1
} {
}, {
queue: false
duration: 100ms
easing: 'linear'
}
this.refs.main.style.pointer-events = 'auto'
Velocity this.refs.main, 'finish' true
Velocity this.refs.main, {scale: 1.1} 0ms
Velocity this.refs.main, {
Velocity(this.refs.main, 'finish' true
Velocity(this.refs.main, {scale: 1.1} 0ms
Velocity(this.refs.main, {
opacity: 1
scale: 1
} {
}, {
queue: false
duration: 200ms
easing: 'ease-out'
@ -275,21 +275,21 @@
if @is-modal
this.refs.bg.style.pointer-events = 'none'
Velocity this.refs.bg, 'finish' true
Velocity this.refs.bg, {
Velocity(this.refs.bg, 'finish' true
Velocity(this.refs.bg, {
opacity: 0
} {
}, {
queue: false
duration: 300ms
easing: 'linear'
}
this.refs.main.style.pointer-events = 'none'
Velocity this.refs.main, 'finish' true
Velocity this.refs.main, {
Velocity(this.refs.main, 'finish' true
Velocity(this.refs.main, {
opacity: 0
scale: 0.8
} {
}, {
queue: false
duration: 300ms
easing: [ 0.5, -0.5, 1, 0.5 ]

View File

@ -58,7 +58,7 @@
this.wait = false
this.on('mount', () => {
@user-promise.then (user) =>
this.user-promise.then (user) =>
this.user = user
this.init = false
this.update();
@ -70,22 +70,22 @@
this.stream.off 'unfollow' this.on-stream-unfollow
this.on-stream-follow = (user) => {
if user.id == @user.id
if user.id == this.user.id
this.user = user
this.update();
this.on-stream-unfollow = (user) => {
if user.id == @user.id
if user.id == this.user.id
this.user = user
this.update();
this.onclick = () => {
this.wait = true
if @user.is_following
if this.user.is_following
this.api 'following/delete' do
user_id: @user.id
user_id: this.user.id
.then =>
@user.is_following = false
this.user.is_following = false
.catch (err) ->
console.error err
.then =>
@ -93,9 +93,9 @@
this.update();
else
this.api 'following/create' do
user_id: @user.id
user_id: this.user.id
.then =>
@user.is_following = true
this.user.is_following = true
.catch (err) ->
console.error err
.then =>

View File

@ -17,17 +17,17 @@
</style>
<script>
this.on('mount', () => {
Velocity this.root, {
Velocity(this.root, {
bottom: '0px'
} {
}, {
duration: 500ms
easing: 'ease-out'
}
setTimeout =>
Velocity this.root, {
Velocity(this.root, {
bottom: '-64px'
} {
}, {
duration: 500ms
easing: 'ease-out'
complete: =>

View File

@ -30,24 +30,24 @@
this.mixin('stream');
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.stream-state-ev.on('connected', () => {
this.state = @get-stream-state!
this.state = this.getStreamState();
this.update();
setTimeout =>
Velocity this.root, {
Velocity(this.root, {
opacity: 0
} 200ms 'linear'
, 1000ms
this.stream-state-ev.on('closed', () => {
this.state = @get-stream-state!
this.state = this.getStreamState();
this.update();
Velocity this.root, {
Velocity(this.root, {
opacity: 1
} 0ms
</script>

View File

@ -12,7 +12,7 @@
this.fetch = (iknow, limit, cursor, cb) => {
this.api 'users/followers' do
user_id: @user.id
user_id: this.user.id
iknow: iknow
limit: limit
cursor: if cursor? then cursor else undefined

View File

@ -12,7 +12,7 @@
this.fetch = (iknow, limit, cursor, cb) => {
this.api 'users/following' do
user_id: @user.id
user_id: this.user.id
iknow: iknow
limit: limit
cursor: if cursor? then cursor else undefined

View File

@ -16,7 +16,7 @@
this.init = new Promise (res, rej) =>
this.api 'users/posts' do
user_id: @user.id
user_id: this.user.id
with_media: @with-media
.then (posts) =>
res posts
@ -24,7 +24,7 @@
this.more = () => {
this.api 'users/posts' do
user_id: @user.id
user_id: this.user.id
with_media: @with-media
max_id: this.refs.timeline.tail!.id
</script>

View File

@ -165,7 +165,7 @@
this.on('mount', () => {
this.api 'users/show' do
username: @username
username: this.username
.then (user) =>
this.fetching = false
this.user = user

View File

@ -102,7 +102,7 @@
this.mode == 'iknow'
@limit
@cursor
this.users = @users.concat obj.users
this.users = this.users.concat obj.users
this.next = obj.next
this.more-fetching = false
this.update();