mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-12 17:00:51 +01:00
wip
This commit is contained in:
parent
7791431717
commit
91d8ee5a52
101 changed files with 423 additions and 423 deletions
|
@ -111,13 +111,13 @@
|
||||||
this.session = this.opts.session
|
this.session = this.opts.session
|
||||||
this.app = @session.app
|
this.app = @session.app
|
||||||
|
|
||||||
cancel() {
|
this.cancel = () => {
|
||||||
this.api 'auth/deny' do
|
this.api 'auth/deny' do
|
||||||
token: @session.token
|
token: @session.token
|
||||||
.then =>
|
.then =>
|
||||||
this.trigger('denied');
|
this.trigger('denied');
|
||||||
|
|
||||||
accept() {
|
this.accept = () => {
|
||||||
this.api 'auth/accept' do
|
this.api 'auth/accept' do
|
||||||
token: @session.token
|
token: @session.token
|
||||||
.then =>
|
.then =>
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
this.state = 'fetch-session-error'
|
this.state = 'fetch-session-error'
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
accepted() {
|
this.accepted = () => {
|
||||||
this.state = 'accepted'
|
this.state = 'accepted'
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
retry() {
|
this.retry = () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
this.opts.retry();
|
this.opts.retry();
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@
|
||||||
<script>
|
<script>
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
|
|
||||||
onpaste(e) {
|
this.onpaste = (e) => {
|
||||||
const data = e.clipboardData;
|
const data = e.clipboardData;
|
||||||
const items = data.items;
|
const items = data.items;
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
|
@ -130,17 +130,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onkeypress(e) {
|
this.onkeypress = (e) => {
|
||||||
if ((e.which == 10 || e.which == 13) && e.ctrlKey) {
|
if ((e.which == 10 || e.which == 13) && e.ctrlKey) {
|
||||||
this.send();
|
this.send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectFile() {
|
this.selectFile = () => {
|
||||||
this.refs.file.click();
|
this.refs.file.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
selectFileFromDrive() {
|
this.selectFileFromDrive = () => {
|
||||||
const browser = document.body.appendChild(document.createElement('mk-select-file-from-drive-window'));
|
const browser = document.body.appendChild(document.createElement('mk-select-file-from-drive-window'));
|
||||||
const event = riot.observable();
|
const event = riot.observable();
|
||||||
riot.mount(browser, {
|
riot.mount(browser, {
|
||||||
|
@ -152,7 +152,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
send() {
|
this.send = () => {
|
||||||
this.sending = true;
|
this.sending = true;
|
||||||
this.api('messaging/messages/create', {
|
this.api('messaging/messages/create', {
|
||||||
user_id: this.opts.user.id,
|
user_id: this.opts.user.id,
|
||||||
|
@ -166,7 +166,7 @@
|
||||||
this.update();
|
this.update();
|
||||||
});
|
});
|
||||||
|
|
||||||
clear() {
|
this.clear = () => {
|
||||||
this.refs.text.value = '';
|
this.refs.text.value = '';
|
||||||
this.files = [];
|
this.files = [];
|
||||||
this.update();
|
this.update();
|
||||||
|
|
|
@ -305,7 +305,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
search() {
|
this.search = () => {
|
||||||
const q = this.refs.search.value;
|
const q = this.refs.search.value;
|
||||||
if (q == '') {
|
if (q == '') {
|
||||||
this.searchResult = [];
|
this.searchResult = [];
|
||||||
|
@ -323,7 +323,7 @@
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
on-search-keydown(e) {
|
this.on-search-keydown = (e) => {
|
||||||
key = e.which
|
key = e.which
|
||||||
switch (key)
|
switch (key)
|
||||||
| 9, 40 => // Key[TAB] or Key[↓]
|
| 9, 40 => // Key[TAB] or Key[↓]
|
||||||
|
@ -331,7 +331,7 @@
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.refs.search-result.childNodes[0].focus();
|
this.refs.search-result.childNodes[0].focus();
|
||||||
|
|
||||||
on-search-result-keydown(i, e) {
|
this.on-search-result-keydown = (i, e) => {
|
||||||
key = e.which
|
key = e.which
|
||||||
switch (key)
|
switch (key)
|
||||||
| 10, 13 => // Key[ENTER]
|
| 10, 13 => // Key[ENTER]
|
||||||
|
|
|
@ -128,18 +128,18 @@
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
this.mixin('messaging-stream');
|
this.mixin('messaging-stream');
|
||||||
|
|
||||||
this.user = this.opts.user
|
this.user = this.opts.user;
|
||||||
this.init = true
|
this.init = true;
|
||||||
this.sending = false
|
this.sending = false;
|
||||||
this.messages = []
|
this.messages = [];
|
||||||
|
|
||||||
this.connection = new @MessagingStreamConnection this.I, @user.id
|
this.connection = new this.MessagingStreamConnection(this.I, this.user.id);
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@connection.event.on 'message' this.on-message
|
this.connection.event.on('message' this.onMessage);
|
||||||
@connection.event.on 'read' this.on-read
|
this.connection.event.on('read' this.onRead);
|
||||||
|
|
||||||
document.add-event-listener 'visibilitychange' this.on-visibilitychange
|
document.addEventListener 'visibilitychange' this.on-visibilitychange
|
||||||
|
|
||||||
this.api 'messaging/messages' do
|
this.api 'messaging/messages' do
|
||||||
user_id: @user.id
|
user_id: @user.id
|
||||||
|
@ -156,7 +156,7 @@
|
||||||
@connection.event.off 'read' this.on-read
|
@connection.event.off 'read' this.on-read
|
||||||
@connection.close!
|
@connection.close!
|
||||||
|
|
||||||
document.remove-event-listener 'visibilitychange' this.on-visibilitychange
|
document.removeEventListener 'visibilitychange' this.on-visibilitychange
|
||||||
|
|
||||||
this.on('update', () => {
|
this.on('update', () => {
|
||||||
@messages.for-each (message) =>
|
@messages.for-each (message) =>
|
||||||
|
@ -165,7 +165,7 @@
|
||||||
message._date = date
|
message._date = date
|
||||||
message._datetext = month + '月 ' + date + '日'
|
message._datetext = month + '月 ' + date + '日'
|
||||||
|
|
||||||
on-message(message) {
|
this.on-message = (message) => {
|
||||||
is-bottom = @is-bottom!
|
is-bottom = @is-bottom!
|
||||||
|
|
||||||
@messages.push message
|
@messages.push message
|
||||||
|
@ -182,7 +182,7 @@
|
||||||
// Notify
|
// Notify
|
||||||
@notify '新しいメッセージがあります'
|
@notify '新しいメッセージがあります'
|
||||||
|
|
||||||
on-read(ids) {
|
this.on-read = (ids) => {
|
||||||
if not Array.isArray ids then ids = [ids]
|
if not Array.isArray ids then ids = [ids]
|
||||||
ids.for-each (id) =>
|
ids.for-each (id) =>
|
||||||
if (@messages.some (x) => x.id == id)
|
if (@messages.some (x) => x.id == id)
|
||||||
|
@ -190,15 +190,15 @@
|
||||||
@messages[exist].is_read = true
|
@messages[exist].is_read = true
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
is-bottom() {
|
this.is-bottom = () => {
|
||||||
current = this.root.scroll-top + this.root.offset-height
|
current = this.root.scroll-top + this.root.offset-height
|
||||||
max = this.root.scroll-height
|
max = this.root.scroll-height
|
||||||
current > (max - 32)
|
current > (max - 32)
|
||||||
|
|
||||||
scroll-to-bottom() {
|
this.scroll-to-bottom = () => {
|
||||||
this.root.scroll-top = this.root.scroll-height
|
this.root.scroll-top = this.root.scroll-height
|
||||||
|
|
||||||
notify(message) {
|
this.notify = (message) => {
|
||||||
n = document.createElement 'p'
|
n = document.createElement 'p'
|
||||||
n.inner-HTML = '<i class="fa fa-arrow-circle-down"></i>' + message
|
n.inner-HTML = '<i class="fa fa-arrow-circle-down"></i>' + message
|
||||||
n.onclick = =>
|
n.onclick = =>
|
||||||
|
@ -213,7 +213,7 @@
|
||||||
, 1000ms
|
, 1000ms
|
||||||
, 4000ms
|
, 4000ms
|
||||||
|
|
||||||
on-visibilitychange() {
|
this.on-visibilitychange = () => {
|
||||||
if document.hidden then return
|
if document.hidden then return
|
||||||
@messages.for-each (message) =>
|
@messages.for-each (message) =>
|
||||||
if message.user_id != this.I.id and not message.is_read
|
if message.user_id != this.I.id and not message.is_read
|
||||||
|
|
|
@ -88,26 +88,26 @@
|
||||||
<script>
|
<script>
|
||||||
this.choices = ['', ''];
|
this.choices = ['', ''];
|
||||||
|
|
||||||
oninput(i, e) {
|
this.oninput = (i, e) => {
|
||||||
this.choices[i] = e.target.value;
|
this.choices[i] = e.target.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
add() {
|
this.add = () => {
|
||||||
this.choices.push('');
|
this.choices.push('');
|
||||||
this.update();
|
this.update();
|
||||||
this.refs.choices.childNodes[this.choices.length - 1].childNodes[0].focus();
|
this.refs.choices.childNodes[this.choices.length - 1].childNodes[0].focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
remove(i) {
|
this.remove = (i) => {
|
||||||
this.choices = this.choices.filter((_, _i) => _i != i);
|
this.choices = this.choices.filter((_, _i) => _i != i);
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
this.destroy = () => {
|
||||||
this.opts.ondestroy();
|
this.opts.ondestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
get() {
|
this.get = () => {
|
||||||
return {
|
return {
|
||||||
choices: this.choices.filter(choice => choice != '')
|
choices: this.choices.filter(choice => choice != '')
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,11 +76,11 @@
|
||||||
this.isVoted = this.poll.choices.some(c => c.is_voted);
|
this.isVoted = this.poll.choices.some(c => c.is_voted);
|
||||||
this.result = this.isVoted;
|
this.result = this.isVoted;
|
||||||
|
|
||||||
toggleResult() {
|
this.toggleResult = () => {
|
||||||
this.result = !this.result;
|
this.result = !this.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
vote(id) {
|
this.vote = (id) => {
|
||||||
if (this.poll.choices.some(c => c.is_voted)) return;
|
if (this.poll.choices.some(c => c.is_voted)) return;
|
||||||
this.api('posts/polls/vote', {
|
this.api('posts/polls/vote', {
|
||||||
post_id: this.post.id,
|
post_id: this.post.id,
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'signin' this.on-signin
|
@stream.off 'signin' this.on-signin
|
||||||
|
|
||||||
on-signin(signin) {
|
this.on-signin = (signin) => {
|
||||||
@history.unshift signin
|
@history.unshift signin
|
||||||
this.update();
|
this.update();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
this.user = null;
|
this.user = null;
|
||||||
this.signing = false;
|
this.signing = false;
|
||||||
|
|
||||||
oninput() {
|
this.oninput = () => {
|
||||||
this.api 'users/show' do
|
this.api 'users/show' do
|
||||||
username: this.refs.username.value
|
username: this.refs.username.value
|
||||||
.then (user) =>
|
.then (user) =>
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
this.trigger 'user' user
|
this.trigger 'user' user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
onsubmit(e) {
|
this.onsubmit = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if this.refs.username.value == ''
|
if this.refs.username.value == ''
|
||||||
|
|
|
@ -199,7 +199,7 @@
|
||||||
head.appendChild script
|
head.appendChild script
|
||||||
});
|
});
|
||||||
|
|
||||||
on-change-username() {
|
this.on-change-username = () => {
|
||||||
username = this.refs.username.value
|
username = this.refs.username.value
|
||||||
|
|
||||||
if username == ''
|
if username == ''
|
||||||
|
@ -232,7 +232,7 @@
|
||||||
this.username-state = 'error'
|
this.username-state = 'error'
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
on-change-password() {
|
this.on-change-password = () => {
|
||||||
password = this.refs.password.value
|
password = this.refs.password.value
|
||||||
|
|
||||||
if password == ''
|
if password == ''
|
||||||
|
@ -252,7 +252,7 @@
|
||||||
|
|
||||||
this.refs.password-metar.style.width = (strength * 100) + '%'
|
this.refs.password-metar.style.width = (strength * 100) + '%'
|
||||||
|
|
||||||
on-change-password-retype() {
|
this.on-change-password-retype = () => {
|
||||||
password = this.refs.password.value
|
password = this.refs.password.value
|
||||||
retyped-password = this.refs.password-retype.value
|
retyped-password = this.refs.password-retype.value
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@
|
||||||
else
|
else
|
||||||
this.password-retype-state = 'not-match'
|
this.password-retype-state = 'not-match'
|
||||||
|
|
||||||
onsubmit(e) {
|
this.onsubmit = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
username = this.refs.username.value
|
username = this.refs.username.value
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
if @mode == 'relative' or @mode == 'detail'
|
if @mode == 'relative' or @mode == 'detail'
|
||||||
clear-interval @tickid
|
clear-interval @tickid
|
||||||
|
|
||||||
tick() {
|
this.tick = () => {
|
||||||
now = new Date!
|
now = new Date!
|
||||||
ago = (now - @time) / 1000ms
|
ago = (now - @time) / 1000ms
|
||||||
this.relative = switch
|
this.relative = switch
|
||||||
|
|
|
@ -145,7 +145,7 @@
|
||||||
this.uploads = []
|
this.uploads = []
|
||||||
|
|
||||||
|
|
||||||
upload(file, folder) {
|
this.upload = (file, folder) => {
|
||||||
id = Math.random!
|
id = Math.random!
|
||||||
|
|
||||||
ctx =
|
ctx =
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
clear-interval @clock
|
clear-interval @clock
|
||||||
|
|
||||||
draw() {
|
this.draw = () => {
|
||||||
now = new Date!
|
now = new Date!
|
||||||
s = now.get-seconds!
|
s = now.get-seconds!
|
||||||
m = now.get-minutes!
|
m = now.get-minutes!
|
||||||
|
|
|
@ -89,11 +89,11 @@
|
||||||
this.select = -1
|
this.select = -1
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@textarea.add-event-listener 'keydown' this.on-keydown
|
@textarea.addEventListener 'keydown' this.on-keydown
|
||||||
|
|
||||||
all = document.query-selector-all 'body *'
|
all = document.query-selector-all 'body *'
|
||||||
Array.prototype.for-each.call all, (el) =>
|
Array.prototype.for-each.call all, (el) =>
|
||||||
el.add-event-listener 'mousedown' @mousedown
|
el.addEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
this.api 'users/search_by_username' do
|
this.api 'users/search_by_username' do
|
||||||
query: @q
|
query: @q
|
||||||
|
@ -106,20 +106,20 @@
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@textarea.remove-event-listener 'keydown' this.on-keydown
|
@textarea.removeEventListener 'keydown' this.on-keydown
|
||||||
|
|
||||||
all = document.query-selector-all 'body *'
|
all = document.query-selector-all 'body *'
|
||||||
Array.prototype.for-each.call all, (el) =>
|
Array.prototype.for-each.call all, (el) =>
|
||||||
el.remove-event-listener 'mousedown' @mousedown
|
el.removeEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
mousedown(e) {
|
this.mousedown = (e) => {
|
||||||
if (!contains this.root, e.target) and (this.root != e.target)
|
if (!contains this.root, e.target) and (this.root != e.target)
|
||||||
@close!
|
@close!
|
||||||
|
|
||||||
on-click(e) {
|
this.on-click = (e) => {
|
||||||
@complete e.item
|
@complete e.item
|
||||||
|
|
||||||
on-keydown(e) {
|
this.on-keydown = (e) => {
|
||||||
key = e.which
|
key = e.which
|
||||||
switch (key)
|
switch (key)
|
||||||
| 10, 13 => // Key[ENTER]
|
| 10, 13 => // Key[ENTER]
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
| _ =>
|
| _ =>
|
||||||
@close!
|
@close!
|
||||||
|
|
||||||
select-next() {
|
this.select-next = () => {
|
||||||
@select++
|
@select++
|
||||||
|
|
||||||
if @select >= @users.length
|
if @select >= @users.length
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
|
|
||||||
@apply-select!
|
@apply-select!
|
||||||
|
|
||||||
select-prev() {
|
this.select-prev = () => {
|
||||||
@select--
|
@select--
|
||||||
|
|
||||||
if @select < 0
|
if @select < 0
|
||||||
|
@ -163,17 +163,17 @@
|
||||||
|
|
||||||
@apply-select!
|
@apply-select!
|
||||||
|
|
||||||
apply-select() {
|
this.apply-select = () => {
|
||||||
this.refs.users.children.for-each (el) =>
|
this.refs.users.children.for-each (el) =>
|
||||||
el.remove-attribute 'data-selected'
|
el.remove-attribute 'data-selected'
|
||||||
|
|
||||||
this.refs.users.children[@select].setAttribute 'data-selected' \true
|
this.refs.users.children[@select].setAttribute 'data-selected' \true
|
||||||
this.refs.users.children[@select].focus();
|
this.refs.users.children[@select].focus();
|
||||||
|
|
||||||
complete(user) {
|
this.complete = (user) => {
|
||||||
this.opts.complete user
|
this.opts.complete user
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
this.opts.close!
|
this.opts.close!
|
||||||
|
|
||||||
function contains(parent, child)
|
function contains(parent, child)
|
||||||
|
|
|
@ -91,17 +91,17 @@
|
||||||
@stream.off 'follow' this.on-stream-follow
|
@stream.off 'follow' this.on-stream-follow
|
||||||
@stream.off 'unfollow' this.on-stream-unfollow
|
@stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
on-stream-follow(user) {
|
this.on-stream-follow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == @user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
on-stream-unfollow(user) {
|
this.on-stream-unfollow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == @user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
onclick() {
|
this.onclick = () => {
|
||||||
this.wait = true
|
this.wait = true
|
||||||
if @user.is_following
|
if @user.is_following
|
||||||
this.api 'following/delete' do
|
this.api 'following/delete' do
|
||||||
|
|
|
@ -94,19 +94,19 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.root.add-event-listener 'contextmenu' (e) =>
|
this.root.addEventListener 'contextmenu' (e) =>
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
mousedown(e) {
|
this.mousedown = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!contains this.root, e.target) and (this.root != e.target)
|
if (!contains this.root, e.target) and (this.root != e.target)
|
||||||
@close!
|
@close!
|
||||||
return false
|
return false
|
||||||
|
|
||||||
open(pos) {
|
this.open = (pos) => {
|
||||||
all = document.query-selector-all 'body *'
|
all = document.query-selector-all 'body *'
|
||||||
Array.prototype.for-each.call all, (el) =>
|
Array.prototype.for-each.call all, (el) =>
|
||||||
el.add-event-listener 'mousedown' @mousedown
|
el.addEventListener 'mousedown' @mousedown
|
||||||
this.root.style.display = 'block'
|
this.root.style.display = 'block'
|
||||||
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'
|
||||||
|
@ -121,10 +121,10 @@
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
all = document.query-selector-all 'body *'
|
all = document.query-selector-all 'body *'
|
||||||
Array.prototype.for-each.call all, (el) =>
|
Array.prototype.for-each.call all, (el) =>
|
||||||
el.remove-event-listener 'mousedown' @mousedown
|
el.removeEventListener 'mousedown' @mousedown
|
||||||
this.trigger('closed');
|
this.trigger('closed');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
|
|
|
@ -172,16 +172,16 @@
|
||||||
highlight: no
|
highlight: no
|
||||||
view-mode: 1
|
view-mode: 1
|
||||||
|
|
||||||
ok() {
|
this.ok = () => {
|
||||||
@cropper.get-cropped-canvas!.to-blob (blob) =>
|
@cropper.get-cropped-canvas!.to-blob (blob) =>
|
||||||
this.trigger 'cropped' blob
|
this.trigger 'cropped' blob
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
|
|
||||||
skip() {
|
this.skip = () => {
|
||||||
this.trigger('skiped');
|
this.trigger('skiped');
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
|
|
||||||
cancel() {
|
this.cancel = () => {
|
||||||
this.trigger('canceled');
|
this.trigger('canceled');
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -114,7 +114,7 @@
|
||||||
easing: [ 0, 0.5, 0.5, 1 ]
|
easing: [ 0, 0.5, 0.5, 1 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
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, {
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
this.unmount();
|
this.unmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
bg-click() {
|
this.bg-click = () => {
|
||||||
if @can-through
|
if @can-through
|
||||||
if this.opts.on-through?
|
if this.opts.on-through?
|
||||||
this.opts.on-through!
|
this.opts.on-through!
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
this.mixin('i');
|
this.mixin('i');
|
||||||
|
|
||||||
close(e) {
|
this.close = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
|
|
|
@ -20,18 +20,18 @@
|
||||||
this.trigger('closed');
|
this.trigger('closed');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
open(pos) {
|
this.open = (pos) => {
|
||||||
this.refs.ctx.open pos
|
this.refs.ctx.open pos
|
||||||
|
|
||||||
create-folder() {
|
this.create-folder = () => {
|
||||||
this.browser.create-folder!
|
this.browser.create-folder!
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
upload() {
|
this.upload = () => {
|
||||||
this.browser.select-local-file!
|
this.browser.select-local-file!
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
url-upload() {
|
this.url-upload = () => {
|
||||||
this.browser.url-upload!
|
this.browser.url-upload!
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
@update do
|
@update do
|
||||||
usage: info.usage / info.capacity * 100
|
usage: info.usage / info.capacity * 100
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-browser-window>
|
</mk-drive-browser-window>
|
||||||
|
|
|
@ -289,27 +289,27 @@
|
||||||
@stream.off 'drive_folder_created' this.on-stream-drive-folder-created
|
@stream.off 'drive_folder_created' this.on-stream-drive-folder-created
|
||||||
@stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated
|
@stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated
|
||||||
|
|
||||||
on-stream-drive-file-created(file) {
|
this.on-stream-drive-file-created = (file) => {
|
||||||
@add-file file, true
|
@add-file file, true
|
||||||
|
|
||||||
on-stream-drive-file-updated(file) {
|
this.on-stream-drive-file-updated = (file) => {
|
||||||
current = if this.folder? then this.folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != file.folder_id
|
if current != file.folder_id
|
||||||
@remove-file file
|
@remove-file file
|
||||||
else
|
else
|
||||||
@add-file file, true
|
@add-file file, true
|
||||||
|
|
||||||
on-stream-drive-folder-created(folder) {
|
this.on-stream-drive-folder-created = (folder) => {
|
||||||
@add-folder folder, true
|
@add-folder folder, true
|
||||||
|
|
||||||
on-stream-drive-folder-updated(folder) {
|
this.on-stream-drive-folder-updated = (folder) => {
|
||||||
current = if this.folder? then this.folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != folder.parent_id
|
if current != folder.parent_id
|
||||||
@remove-folder folder
|
@remove-folder folder
|
||||||
else
|
else
|
||||||
@add-folder folder, true
|
@add-folder folder, true
|
||||||
|
|
||||||
onmousedown(e) {
|
this.onmousedown = (e) => {
|
||||||
if (contains this.refs.folders-container, e.target) or (contains this.refs.files-container, e.target)
|
if (contains this.refs.folders-container, e.target) or (contains this.refs.files-container, e.target)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
@ -341,20 +341,20 @@
|
||||||
this.refs.selection.style.top = cursor-y + 'px'
|
this.refs.selection.style.top = cursor-y + 'px'
|
||||||
|
|
||||||
up = (e) =>
|
up = (e) =>
|
||||||
document.document-element.remove-event-listener 'mousemove' move
|
document.document-element.removeEventListener 'mousemove' move
|
||||||
document.document-element.remove-event-listener 'mouseup' up
|
document.document-element.removeEventListener 'mouseup' up
|
||||||
|
|
||||||
this.refs.selection.style.display = 'none'
|
this.refs.selection.style.display = 'none'
|
||||||
|
|
||||||
document.document-element.add-event-listener 'mousemove' move
|
document.document-element.addEventListener 'mousemove' move
|
||||||
document.document-element.add-event-listener 'mouseup' up
|
document.document-element.addEventListener 'mouseup' up
|
||||||
|
|
||||||
path-oncontextmenu(e) {
|
this.path-oncontextmenu = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stop-immediate-propagation!
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragover(e) {
|
this.ondragover = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
|
@ -371,15 +371,15 @@
|
||||||
e.dataTransfer.dropEffect = 'none'
|
e.dataTransfer.dropEffect = 'none'
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragenter(e) {
|
this.ondragenter = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if !@is-drag-source
|
if !@is-drag-source
|
||||||
this.draghover = true
|
this.draghover = true
|
||||||
|
|
||||||
ondragleave(e) {
|
this.ondragleave = (e) => {
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
ondrop(e) {
|
this.ondrop = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
oncontextmenu(e) {
|
this.oncontextmenu = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stop-immediate-propagation!
|
||||||
|
|
||||||
|
@ -452,10 +452,10 @@
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
select-local-file() {
|
this.select-local-file = () => {
|
||||||
this.refs.file-input.click!
|
this.refs.file-input.click!
|
||||||
|
|
||||||
url-upload() {
|
this.url-upload = () => {
|
||||||
url <~ @input-dialog do
|
url <~ @input-dialog do
|
||||||
'URLアップロード'
|
'URLアップロード'
|
||||||
'アップロードしたいファイルのURL'
|
'アップロードしたいファイルのURL'
|
||||||
|
@ -473,7 +473,7 @@
|
||||||
text: 'OK'
|
text: 'OK'
|
||||||
]
|
]
|
||||||
|
|
||||||
create-folder() {
|
this.create-folder = () => {
|
||||||
name <~ @input-dialog do
|
name <~ @input-dialog do
|
||||||
'フォルダー作成'
|
'フォルダー作成'
|
||||||
'フォルダー名'
|
'フォルダー名'
|
||||||
|
@ -488,26 +488,26 @@
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
change-file-input() {
|
this.change-file-input = () => {
|
||||||
files = this.refs.file-input.files
|
files = this.refs.file-input.files
|
||||||
for i from 0 to files.length - 1
|
for i from 0 to files.length - 1
|
||||||
file = files.item i
|
file = files.item i
|
||||||
@upload file, this.folder
|
@upload file, this.folder
|
||||||
|
|
||||||
upload(file, folder) {
|
this.upload = (file, folder) => {
|
||||||
if folder? and typeof folder == 'object'
|
if folder? and typeof folder == 'object'
|
||||||
folder = folder.id
|
folder = folder.id
|
||||||
this.refs.uploader.upload file, folder
|
this.refs.uploader.upload file, folder
|
||||||
|
|
||||||
get-selection() {
|
this.get-selection = () => {
|
||||||
this.files.filter (file) -> file._selected
|
this.files.filter (file) -> file._selected
|
||||||
|
|
||||||
new-window(folder-id) {
|
this.new-window = (folder-id) => {
|
||||||
browser = document.body.appendChild document.createElement 'mk-drive-browser-window'
|
browser = document.body.appendChild document.createElement 'mk-drive-browser-window'
|
||||||
riot.mount browser, do
|
riot.mount browser, do
|
||||||
folder: folder-id
|
folder: folder-id
|
||||||
|
|
||||||
move(target-folder) {
|
this.move = (target-folder) => {
|
||||||
if target-folder? and typeof target-folder == 'object'
|
if target-folder? and typeof target-folder == 'object'
|
||||||
target-folder = target-folder.id
|
target-folder = target-folder.id
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@
|
||||||
.catch (err, text-status) ->
|
.catch (err, text-status) ->
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
add-folder(folder, unshift = false) {
|
this.add-folder = (folder, unshift = false) => {
|
||||||
current = if this.folder? then this.folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != folder.parent_id
|
if current != folder.parent_id
|
||||||
return
|
return
|
||||||
|
@ -555,7 +555,7 @@
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
add-file(file, unshift = false) {
|
this.add-file = (file, unshift = false) => {
|
||||||
current = if this.folder? then this.folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != file.folder_id
|
if current != file.folder_id
|
||||||
return
|
return
|
||||||
|
@ -573,26 +573,26 @@
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
remove-folder(folder) {
|
this.remove-folder = (folder) => {
|
||||||
if typeof folder == 'object'
|
if typeof folder == 'object'
|
||||||
folder = folder.id
|
folder = folder.id
|
||||||
this.folders = this.folders.filter (f) -> f.id != folder
|
this.folders = this.folders.filter (f) -> f.id != folder
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
remove-file(file) {
|
this.remove-file = (file) => {
|
||||||
if typeof file == 'object'
|
if typeof file == 'object'
|
||||||
file = file.id
|
file = file.id
|
||||||
this.files = this.files.filter (f) -> f.id != file
|
this.files = this.files.filter (f) -> f.id != file
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
go-root() {
|
this.go-root = () => {
|
||||||
if this.folder != null
|
if this.folder != null
|
||||||
this.folder = null
|
this.folder = null
|
||||||
this.hierarchy-folders = []
|
this.hierarchy-folders = []
|
||||||
this.update();
|
this.update();
|
||||||
@load!
|
@load!
|
||||||
|
|
||||||
load() {
|
this.load = () => {
|
||||||
this.folders = []
|
this.folders = []
|
||||||
this.files = []
|
this.files = []
|
||||||
this.more-folders = false
|
this.more-folders = false
|
||||||
|
|
|
@ -54,10 +54,10 @@
|
||||||
this.trigger('closed');
|
this.trigger('closed');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
open(pos) {
|
this.open = (pos) => {
|
||||||
this.refs.ctx.open pos
|
this.refs.ctx.open pos
|
||||||
|
|
||||||
rename() {
|
this.rename = () => {
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
name <~ @input-dialog do
|
name <~ @input-dialog do
|
||||||
|
@ -73,25 +73,25 @@
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
copy-url() {
|
this.copy-url = () => {
|
||||||
@NotImplementedException!
|
@NotImplementedException!
|
||||||
|
|
||||||
download() {
|
this.download = () => {
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
set-avatar() {
|
this.set-avatar = () => {
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
@update-avatar this.I, null, this.file
|
@update-avatar this.I, null, this.file
|
||||||
|
|
||||||
set-banner() {
|
this.set-banner = () => {
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
@update-banner this.I, null, this.file
|
@update-banner this.I, null, this.file
|
||||||
|
|
||||||
set-wallpaper() {
|
this.set-wallpaper = () => {
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
@update-wallpaper this.I, null, this.file
|
@update-wallpaper this.I, null, this.file
|
||||||
|
|
||||||
add-app() {
|
this.add-app = () => {
|
||||||
@NotImplementedException!
|
@NotImplementedException!
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-browser-file-contextmenu>
|
</mk-drive-browser-file-contextmenu>
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
|
|
||||||
this.is-contextmenu-showing = false
|
this.is-contextmenu-showing = false
|
||||||
|
|
||||||
onclick() {
|
this.onclick = () => {
|
||||||
if this.browser.multiple
|
if this.browser.multiple
|
||||||
if this.file._selected?
|
if this.file._selected?
|
||||||
this.file._selected = !this.file._selected
|
this.file._selected = !this.file._selected
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
this.file._selected = true
|
this.file._selected = true
|
||||||
this.browser.trigger 'change-selection' this.file
|
this.browser.trigger 'change-selection' this.file
|
||||||
|
|
||||||
oncontextmenu(e) {
|
this.oncontextmenu = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stop-immediate-propagation!
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@
|
||||||
this.update();
|
this.update();
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragstart(e) {
|
this.ondragstart = (e) => {
|
||||||
e.dataTransfer.effect-allowed = 'move'
|
e.dataTransfer.effect-allowed = 'move'
|
||||||
e.dataTransfer.set-data 'text' JSON.stringify do
|
e.dataTransfer.set-data 'text' JSON.stringify do
|
||||||
type: 'file'
|
type: 'file'
|
||||||
|
@ -202,7 +202,7 @@
|
||||||
// (=あなたの子供が、ドラッグを開始しましたよ)
|
// (=あなたの子供が、ドラッグを開始しましたよ)
|
||||||
this.browser.is-drag-source = true
|
this.browser.is-drag-source = true
|
||||||
|
|
||||||
ondragend(e) {
|
this.ondragend = (e) => {
|
||||||
this.is-dragging = false
|
this.is-dragging = false
|
||||||
this.browser.is-drag-source = false
|
this.browser.is-drag-source = false
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -24,30 +24,30 @@
|
||||||
this.browser = this.opts.browser
|
this.browser = this.opts.browser
|
||||||
this.folder = this.opts.folder
|
this.folder = this.opts.folder
|
||||||
|
|
||||||
open(pos) {
|
this.open = (pos) => {
|
||||||
this.refs.ctx.open pos
|
this.refs.ctx.open pos
|
||||||
|
|
||||||
this.refs.ctx.on('closed', () => {
|
this.refs.ctx.on('closed', () => {
|
||||||
this.trigger('closed');
|
this.trigger('closed');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
move() {
|
this.move = () => {
|
||||||
this.browser.move this.folder.id
|
this.browser.move this.folder.id
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
new-window() {
|
this.new-window = () => {
|
||||||
this.browser.new-window this.folder.id
|
this.browser.new-window this.folder.id
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
create-folder() {
|
this.create-folder = () => {
|
||||||
this.browser.create-folder!
|
this.browser.create-folder!
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
upload() {
|
this.upload = () => {
|
||||||
this.browser.select-lcoal-file!
|
this.browser.select-lcoal-file!
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
rename() {
|
this.rename = () => {
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
name <~ @input-dialog do
|
name <~ @input-dialog do
|
||||||
|
|
|
@ -61,16 +61,16 @@
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
this.is-contextmenu-showing = false
|
this.is-contextmenu-showing = false
|
||||||
|
|
||||||
onclick() {
|
this.onclick = () => {
|
||||||
this.browser.move this.folder
|
this.browser.move this.folder
|
||||||
|
|
||||||
onmouseover() {
|
this.onmouseover = () => {
|
||||||
this.hover = true
|
this.hover = true
|
||||||
|
|
||||||
onmouseout() {
|
this.onmouseout = () => {
|
||||||
this.hover = false
|
this.hover = false
|
||||||
|
|
||||||
ondragover(e) {
|
this.ondragover = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
|
@ -86,14 +86,14 @@
|
||||||
e.dataTransfer.dropEffect = 'none'
|
e.dataTransfer.dropEffect = 'none'
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragenter() {
|
this.ondragenter = () => {
|
||||||
if !@is-dragging
|
if !@is-dragging
|
||||||
this.draghover = true
|
this.draghover = true
|
||||||
|
|
||||||
ondragleave() {
|
this.ondragleave = () => {
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
ondrop(e) {
|
this.ondrop = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragstart(e) {
|
this.ondragstart = (e) => {
|
||||||
e.dataTransfer.effect-allowed = 'move'
|
e.dataTransfer.effect-allowed = 'move'
|
||||||
e.dataTransfer.set-data 'text' JSON.stringify do
|
e.dataTransfer.set-data 'text' JSON.stringify do
|
||||||
type: 'folder'
|
type: 'folder'
|
||||||
|
@ -157,11 +157,11 @@
|
||||||
// (=あなたの子供が、ドラッグを開始しましたよ)
|
// (=あなたの子供が、ドラッグを開始しましたよ)
|
||||||
this.browser.is-drag-source = true
|
this.browser.is-drag-source = true
|
||||||
|
|
||||||
ondragend(e) {
|
this.ondragend = (e) => {
|
||||||
this.is-dragging = false
|
this.is-dragging = false
|
||||||
this.browser.is-drag-source = false
|
this.browser.is-drag-source = false
|
||||||
|
|
||||||
oncontextmenu(e) {
|
this.oncontextmenu = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stop-immediate-propagation!
|
||||||
|
|
||||||
|
|
|
@ -16,16 +16,16 @@
|
||||||
|
|
||||||
this.hover = false
|
this.hover = false
|
||||||
|
|
||||||
onclick() {
|
this.onclick = () => {
|
||||||
this.browser.move this.folder
|
this.browser.move this.folder
|
||||||
|
|
||||||
onmouseover() {
|
this.onmouseover = () => {
|
||||||
this.hover = true
|
this.hover = true
|
||||||
|
|
||||||
onmouseout() {
|
this.onmouseout = () => {
|
||||||
this.hover = false
|
this.hover = false
|
||||||
|
|
||||||
ondragover(e) {
|
this.ondragover = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
|
@ -39,15 +39,15 @@
|
||||||
e.dataTransfer.dropEffect = 'move'
|
e.dataTransfer.dropEffect = 'move'
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragenter() {
|
this.ondragenter = () => {
|
||||||
if this.folder != null or this.browser.folder != null
|
if this.folder != null or this.browser.folder != null
|
||||||
this.draghover = true
|
this.draghover = true
|
||||||
|
|
||||||
ondragleave() {
|
this.ondragleave = () => {
|
||||||
if this.folder != null or this.browser.folder != null
|
if this.folder != null or this.browser.folder != null
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
ondrop(e) {
|
this.ondrop = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
|
|
|
@ -88,17 +88,17 @@
|
||||||
@stream.off 'follow' this.on-stream-follow
|
@stream.off 'follow' this.on-stream-follow
|
||||||
@stream.off 'unfollow' this.on-stream-unfollow
|
@stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
on-stream-follow(user) {
|
this.on-stream-follow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == @user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
on-stream-unfollow(user) {
|
this.on-stream-unfollow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == @user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
onclick() {
|
this.onclick = () => {
|
||||||
this.wait = true
|
this.wait = true
|
||||||
if @user.is_following
|
if @user.is_following
|
||||||
this.api 'following/delete' do
|
this.api 'following/delete' do
|
||||||
|
|
|
@ -135,7 +135,7 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@load!
|
@load!
|
||||||
|
|
||||||
load() {
|
this.load = () => {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.users = null
|
this.users = null
|
||||||
this.update();
|
this.update();
|
||||||
|
@ -150,14 +150,14 @@
|
||||||
.catch (err, text-status) ->
|
.catch (err, text-status) ->
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
refresh() {
|
this.refresh = () => {
|
||||||
if @users.length < @limit
|
if @users.length < @limit
|
||||||
this.page = 0
|
this.page = 0
|
||||||
else
|
else
|
||||||
@page++
|
@page++
|
||||||
@load!
|
@load!
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
</script>
|
</script>
|
||||||
</mk-following-setuper>
|
</mk-following-setuper>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<mk-go-top>
|
<mk-go-top>
|
||||||
<button class="hidden" title="一番上へ"><i class="fa fa-angle-up"></i></button>
|
<button class="hidden" title="一番上へ"><i class="fa fa-angle-up"></i></button>
|
||||||
<script>
|
<script>
|
||||||
window.add-event-listener 'load' this.on-scroll
|
window.addEventListener 'load' this.on-scroll
|
||||||
window.add-event-listener 'scroll' this.on-scroll
|
window.addEventListener 'scroll' this.on-scroll
|
||||||
window.add-event-listener 'resize' this.on-scroll
|
window.addEventListener 'resize' this.on-scroll
|
||||||
|
|
||||||
on-scroll() {
|
this.on-scroll = () => {
|
||||||
if $ window .scroll-top! > 500px
|
if $ window .scroll-top! > 500px
|
||||||
@remove-class 'hidden'
|
@remove-class 'hidden'
|
||||||
else
|
else
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
draw() {
|
this.draw = () => {
|
||||||
now = new Date!
|
now = new Date!
|
||||||
nd = now.get-date!
|
nd = now.get-date!
|
||||||
nm = now.get-month!
|
nm = now.get-month!
|
||||||
|
|
|
@ -55,23 +55,23 @@
|
||||||
this.mode = 'all'
|
this.mode = 'all'
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
document.add-event-listener 'keydown' this.on-document-keydown
|
document.addEventListener 'keydown' this.on-document-keydown
|
||||||
window.add-event-listener 'scroll' this.on-scroll
|
window.addEventListener 'scroll' this.on-scroll
|
||||||
|
|
||||||
@fetch =>
|
@fetch =>
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
document.remove-event-listener 'keydown' this.on-document-keydown
|
document.removeEventListener 'keydown' this.on-document-keydown
|
||||||
window.remove-event-listener 'scroll' this.on-scroll
|
window.removeEventListener 'scroll' this.on-scroll
|
||||||
|
|
||||||
on-document-keydown(e) {
|
this.on-document-keydown = (e) => {
|
||||||
tag = e.target.tag-name.to-lower-case!
|
tag = e.target.tag-name.to-lower-case!
|
||||||
if tag != 'input' and tag != 'textarea'
|
if tag != 'input' and tag != 'textarea'
|
||||||
if e.which == 84 // t
|
if e.which == 84 // t
|
||||||
this.refs.timeline.focus();
|
this.refs.timeline.focus();
|
||||||
|
|
||||||
fetch(cb) {
|
this.fetch = (cb) => {
|
||||||
this.api 'posts/mentions' do
|
this.api 'posts/mentions' do
|
||||||
following: @mode == 'following'
|
following: @mode == 'following'
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
console.error err
|
console.error err
|
||||||
if cb? then cb!
|
if cb? then cb!
|
||||||
|
|
||||||
more() {
|
this.more = () => {
|
||||||
if @more-loading or @is-loading or this.refs.timeline.posts.length == 0
|
if @more-loading or @is-loading or this.refs.timeline.posts.length == 0
|
||||||
return
|
return
|
||||||
this.more-loading = true
|
this.more-loading = true
|
||||||
|
@ -99,12 +99,12 @@
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
on-scroll() {
|
this.on-scroll = () => {
|
||||||
current = window.scroll-y + window.inner-height
|
current = window.scroll-y + window.inner-height
|
||||||
if current > document.body.offset-height - 8
|
if current > document.body.offset-height - 8
|
||||||
@more!
|
@more!
|
||||||
|
|
||||||
set-mode(mode) {
|
this.set-mode = (mode) => {
|
||||||
@update do
|
@update do
|
||||||
mode: mode
|
mode: mode
|
||||||
@fetch!
|
@fetch!
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
settings() {
|
this.settings = () => {
|
||||||
w = riot.mount document.body.appendChild document.createElement 'mk-settings-window' .0
|
w = riot.mount document.body.appendChild document.createElement 'mk-settings-window' .0
|
||||||
w.switch 'notification'
|
w.switch 'notification'
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'drive_file_created' this.on-stream-drive-file-created
|
@stream.off 'drive_file_created' this.on-stream-drive-file-created
|
||||||
|
|
||||||
on-stream-drive-file-created(file) {
|
this.on-stream-drive-file-created = (file) => {
|
||||||
if /^image\/.+$/.test file.type
|
if /^image\/.+$/.test file.type
|
||||||
@images.unshift file
|
@images.unshift file
|
||||||
if @images.length > 9
|
if @images.length > 9
|
||||||
|
|
|
@ -46,10 +46,10 @@
|
||||||
this.mixin('update-avatar');
|
this.mixin('update-avatar');
|
||||||
this.mixin('update-banner');
|
this.mixin('update-banner');
|
||||||
|
|
||||||
set-avatar() {
|
this.set-avatar = () => {
|
||||||
@update-avatar this.I
|
@update-avatar this.I
|
||||||
|
|
||||||
set-banner() {
|
this.set-banner = () => {
|
||||||
@update-banner this.I
|
@update-banner this.I
|
||||||
</script>
|
</script>
|
||||||
</mk-profile-home-widget>
|
</mk-profile-home-widget>
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
clear-interval @clock
|
clear-interval @clock
|
||||||
|
|
||||||
fetch() {
|
this.fetch = () => {
|
||||||
this.api CONFIG.url + '/api:rss' do
|
this.api CONFIG.url + '/api:rss' do
|
||||||
url: @url
|
url: @url
|
||||||
.then (feed) =>
|
.then (feed) =>
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
.catch (err) ->
|
.catch (err) ->
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
settings() {
|
this.settings = () => {
|
||||||
@NotImplementedException!
|
@NotImplementedException!
|
||||||
</script>
|
</script>
|
||||||
</mk-rss-reader-home-widget>
|
</mk-rss-reader-home-widget>
|
||||||
|
|
|
@ -46,8 +46,8 @@
|
||||||
@stream.on 'follow' this.on-stream-follow
|
@stream.on 'follow' this.on-stream-follow
|
||||||
@stream.on 'unfollow' this.on-stream-unfollow
|
@stream.on 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
document.add-event-listener 'keydown' this.on-document-keydown
|
document.addEventListener 'keydown' this.on-document-keydown
|
||||||
window.add-event-listener 'scroll' this.on-scroll
|
window.addEventListener 'scroll' this.on-scroll
|
||||||
|
|
||||||
@load =>
|
@load =>
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
@ -57,16 +57,16 @@
|
||||||
@stream.off 'follow' this.on-stream-follow
|
@stream.off 'follow' this.on-stream-follow
|
||||||
@stream.off 'unfollow' this.on-stream-unfollow
|
@stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
document.remove-event-listener 'keydown' this.on-document-keydown
|
document.removeEventListener 'keydown' this.on-document-keydown
|
||||||
window.remove-event-listener 'scroll' this.on-scroll
|
window.removeEventListener 'scroll' this.on-scroll
|
||||||
|
|
||||||
on-document-keydown(e) {
|
this.on-document-keydown = (e) => {
|
||||||
tag = e.target.tag-name.to-lower-case!
|
tag = e.target.tag-name.to-lower-case!
|
||||||
if tag != 'input' and tag != 'textarea'
|
if tag != 'input' and tag != 'textarea'
|
||||||
if e.which == 84 // t
|
if e.which == 84 // t
|
||||||
this.refs.timeline.focus();
|
this.refs.timeline.focus();
|
||||||
|
|
||||||
load(cb) {
|
this.load = (cb) => {
|
||||||
this.api 'posts/timeline'
|
this.api 'posts/timeline'
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
this.is-loading = false
|
this.is-loading = false
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
console.error err
|
console.error err
|
||||||
if cb? then cb!
|
if cb? then cb!
|
||||||
|
|
||||||
more() {
|
this.more = () => {
|
||||||
if @more-loading or @is-loading or this.refs.timeline.posts.length == 0
|
if @more-loading or @is-loading or this.refs.timeline.posts.length == 0
|
||||||
return
|
return
|
||||||
this.more-loading = true
|
this.more-loading = true
|
||||||
|
@ -92,18 +92,18 @@
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
on-stream-post(post) {
|
this.on-stream-post = (post) => {
|
||||||
this.is-empty = false
|
this.is-empty = false
|
||||||
this.update();
|
this.update();
|
||||||
this.refs.timeline.add-post post
|
this.refs.timeline.add-post post
|
||||||
|
|
||||||
on-stream-follow() {
|
this.on-stream-follow = () => {
|
||||||
@load!
|
@load!
|
||||||
|
|
||||||
on-stream-unfollow() {
|
this.on-stream-unfollow = () => {
|
||||||
@load!
|
@load!
|
||||||
|
|
||||||
on-scroll() {
|
this.on-scroll = () => {
|
||||||
current = window.scroll-y + window.inner-height
|
current = window.scroll-y + window.inner-height
|
||||||
if current > document.body.offset-height - 8
|
if current > document.body.offset-height - 8
|
||||||
@more!
|
@more!
|
||||||
|
|
|
@ -48,11 +48,11 @@
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
clear-interval @clock
|
clear-interval @clock
|
||||||
|
|
||||||
set() {
|
this.set = () => {
|
||||||
this.refs.text.innerHTML = @tips[Math.floor Math.random! * @tips.length]
|
this.refs.text.innerHTML = @tips[Math.floor Math.random! * @tips.length]
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
change() {
|
this.change = () => {
|
||||||
Velocity this.refs.tip, {
|
Velocity this.refs.tip, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
} {
|
} {
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
clear-interval @clock
|
clear-interval @clock
|
||||||
|
|
||||||
fetch(quiet = false) {
|
this.fetch = (quiet = false) => {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.users = null
|
this.users = null
|
||||||
if not quiet then this.update();
|
if not quiet then this.update();
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
.catch (err, text-status) ->
|
.catch (err, text-status) ->
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
refresh() {
|
this.refresh = () => {
|
||||||
if @users.length < @limit
|
if @users.length < @limit
|
||||||
this.page = 0
|
this.page = 0
|
||||||
else
|
else
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
// easing: 'ease-out'
|
// easing: 'ease-out'
|
||||||
#}
|
#}
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
Velocity this.root, {
|
Velocity this.root, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
} {
|
} {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
this.images = this.opts.images
|
this.images = this.opts.images
|
||||||
this.image = @images.0
|
this.image = @images.0
|
||||||
|
|
||||||
mousemove(e) {
|
this.mousemove = (e) => {
|
||||||
rect = this.refs.view.get-bounding-client-rect!
|
rect = this.refs.view.get-bounding-client-rect!
|
||||||
mouse-x = e.client-x - rect.left
|
mouse-x = e.client-x - rect.left
|
||||||
mouse-y = e.client-y - rect.top
|
mouse-y = e.client-y - rect.top
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
yp = mouse-y / this.refs.view.offset-height * 100
|
yp = mouse-y / this.refs.view.offset-height * 100
|
||||||
this.refs.view.style.background-position = xp + '% ' + yp + '%'
|
this.refs.view.style.background-position = xp + '% ' + yp + '%'
|
||||||
|
|
||||||
click() {
|
this.click = () => {
|
||||||
dialog = document.body.appendChild document.createElement 'mk-image-dialog'
|
dialog = document.body.appendChild document.createElement 'mk-image-dialog'
|
||||||
riot.mount dialog, do
|
riot.mount dialog, do
|
||||||
image: @image
|
image: @image
|
||||||
|
|
|
@ -139,16 +139,16 @@
|
||||||
this.refs.window.on('closed', () => {
|
this.refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
cancel() {
|
this.cancel = () => {
|
||||||
this.done = false
|
this.done = false
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
|
|
||||||
ok() {
|
this.ok = () => {
|
||||||
if not @allow-empty and @text.value == '' then return
|
if not @allow-empty and @text.value == '' then return
|
||||||
this.done = true
|
this.done = true
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
|
|
||||||
on-keydown(e) {
|
this.on-keydown = (e) => {
|
||||||
if e.which == 13 // Enter
|
if e.which == 13 // Enter
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
|
@ -199,7 +199,7 @@
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'notification' this.on-notification
|
@stream.off 'notification' this.on-notification
|
||||||
|
|
||||||
on-notification(notification) {
|
this.on-notification = (notification) => {
|
||||||
@notifications.unshift notification
|
@notifications.unshift notification
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
|
|
|
@ -65,15 +65,15 @@
|
||||||
<script>
|
<script>
|
||||||
this.mode = 'signin'
|
this.mode = 'signin'
|
||||||
|
|
||||||
signup() {
|
this.signup = () => {
|
||||||
this.mode = 'signup'
|
this.mode = 'signup'
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
signin() {
|
this.signin = () => {
|
||||||
this.mode = 'signin'
|
this.mode = 'signin'
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
introduction() {
|
this.introduction = () => {
|
||||||
this.mode = 'introduction'
|
this.mode = 'introduction'
|
||||||
this.update();
|
this.update();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -124,7 +124,7 @@
|
||||||
@update do
|
@update do
|
||||||
user: user
|
user: user
|
||||||
|
|
||||||
introduction() {
|
this.introduction = () => {
|
||||||
this.parent.introduction!
|
this.parent.introduction!
|
||||||
</script>
|
</script>
|
||||||
</mk-entrance-signin>
|
</mk-entrance-signin>
|
||||||
|
|
|
@ -28,18 +28,18 @@
|
||||||
document.title = 'Misskey'
|
document.title = 'Misskey'
|
||||||
this.Progress.start();
|
this.Progress.start();
|
||||||
@stream.on 'post' this.on-stream-post
|
@stream.on 'post' this.on-stream-post
|
||||||
document.add-event-listener 'visibilitychange' @window-on-visibilitychange, false
|
document.addEventListener 'visibilitychange' @window-on-visibilitychange, false
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'post' this.on-stream-post
|
@stream.off 'post' this.on-stream-post
|
||||||
document.remove-event-listener 'visibilitychange' @window-on-visibilitychange
|
document.removeEventListener 'visibilitychange' @window-on-visibilitychange
|
||||||
|
|
||||||
on-stream-post(post) {
|
this.on-stream-post = (post) => {
|
||||||
if document.hidden and post.user_id !== this.I.id
|
if document.hidden and post.user_id !== this.I.id
|
||||||
@unread-count++
|
@unread-count++
|
||||||
document.title = '(' + @unread-count + ') ' + @get-post-summary post
|
document.title = '(' + @unread-count + ') ' + @get-post-summary post
|
||||||
|
|
||||||
window-on-visibilitychange() {
|
this.window-on-visibilitychange = () => {
|
||||||
if !document.hidden
|
if !document.hidden
|
||||||
this.unread-count = 0
|
this.unread-count = 0
|
||||||
document.title = 'Misskey'
|
document.title = 'Misskey'
|
||||||
|
|
|
@ -123,7 +123,7 @@
|
||||||
if e.tag-name == 'MK-URL'
|
if e.tag-name == 'MK-URL'
|
||||||
riot.mount e
|
riot.mount e
|
||||||
|
|
||||||
like() {
|
this.like = () => {
|
||||||
if @post.is_liked
|
if @post.is_liked
|
||||||
this.api 'posts/likes/delete' do
|
this.api 'posts/likes/delete' do
|
||||||
post_id: @post.id
|
post_id: @post.id
|
||||||
|
|
|
@ -398,17 +398,17 @@
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
reply() {
|
this.reply = () => {
|
||||||
form = document.body.appendChild document.createElement 'mk-post-form-window'
|
form = document.body.appendChild document.createElement 'mk-post-form-window'
|
||||||
riot.mount form, do
|
riot.mount form, do
|
||||||
reply: @p
|
reply: @p
|
||||||
|
|
||||||
repost() {
|
this.repost = () => {
|
||||||
form = document.body.appendChild document.createElement 'mk-repost-form-window'
|
form = document.body.appendChild document.createElement 'mk-repost-form-window'
|
||||||
riot.mount form, do
|
riot.mount form, do
|
||||||
post: @p
|
post: @p
|
||||||
|
|
||||||
like() {
|
this.like = () => {
|
||||||
if @p.is_liked
|
if @p.is_liked
|
||||||
this.api 'posts/likes/delete' do
|
this.api 'posts/likes/delete' do
|
||||||
post_id: @p.id
|
post_id: @p.id
|
||||||
|
@ -422,7 +422,7 @@
|
||||||
@p.is_liked = true
|
@p.is_liked = true
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
load-context() {
|
this.load-context = () => {
|
||||||
this.loading-context = true
|
this.loading-context = true
|
||||||
|
|
||||||
// Get context
|
// Get context
|
||||||
|
|
|
@ -335,16 +335,16 @@
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@autocomplete.detach!
|
@autocomplete.detach!
|
||||||
|
|
||||||
focus() {
|
this.focus = () => {
|
||||||
this.refs.text.focus();
|
this.refs.text.focus();
|
||||||
|
|
||||||
clear() {
|
this.clear = () => {
|
||||||
this.refs.text.value = ''
|
this.refs.text.value = ''
|
||||||
this.files = []
|
this.files = []
|
||||||
this.trigger('change-files');
|
this.trigger('change-files');
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
ondragover(e) {
|
this.ondragover = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.draghover = true
|
this.draghover = true
|
||||||
// ドラッグされてきたものがファイルだったら
|
// ドラッグされてきたものがファイルだったら
|
||||||
|
@ -354,13 +354,13 @@
|
||||||
e.dataTransfer.dropEffect = 'move'
|
e.dataTransfer.dropEffect = 'move'
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragenter(e) {
|
this.ondragenter = (e) => {
|
||||||
this.draghover = true
|
this.draghover = true
|
||||||
|
|
||||||
ondragleave(e) {
|
this.ondragleave = (e) => {
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
ondrop(e) {
|
this.ondrop = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
@ -388,11 +388,11 @@
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
onkeydown(e) {
|
this.onkeydown = (e) => {
|
||||||
if (e.which == 10 || e.which == 13) && (e.ctrlKey || e.meta-key)
|
if (e.which == 10 || e.which == 13) && (e.ctrlKey || e.meta-key)
|
||||||
@post!
|
@post!
|
||||||
|
|
||||||
onpaste(e) {
|
this.onpaste = (e) => {
|
||||||
data = e.clipboardData
|
data = e.clipboardData
|
||||||
items = data.items
|
items = data.items
|
||||||
for i from 0 to items.length - 1
|
for i from 0 to items.length - 1
|
||||||
|
@ -401,26 +401,26 @@
|
||||||
| 'file' =>
|
| 'file' =>
|
||||||
@upload item.getAsFile();
|
@upload item.getAsFile();
|
||||||
|
|
||||||
select-file() {
|
this.select-file = () => {
|
||||||
this.refs.file.click!
|
this.refs.file.click!
|
||||||
|
|
||||||
select-file-from-drive() {
|
this.select-file-from-drive = () => {
|
||||||
browser = document.body.appendChild document.createElement 'mk-select-file-from-drive-window'
|
browser = document.body.appendChild document.createElement 'mk-select-file-from-drive-window'
|
||||||
i = riot.mount browser, do
|
i = riot.mount browser, do
|
||||||
multiple: true
|
multiple: true
|
||||||
i[0].one 'selected' (files) =>
|
i[0].one 'selected' (files) =>
|
||||||
files.for-each @add-file
|
files.for-each @add-file
|
||||||
|
|
||||||
change-file() {
|
this.change-file = () => {
|
||||||
files = this.refs.file.files
|
files = this.refs.file.files
|
||||||
for i from 0 to files.length - 1
|
for i from 0 to files.length - 1
|
||||||
file = files.item i
|
file = files.item i
|
||||||
@upload file
|
@upload file
|
||||||
|
|
||||||
upload(file) {
|
this.upload = (file) => {
|
||||||
this.refs.uploader.upload file
|
this.refs.uploader.upload file
|
||||||
|
|
||||||
add-file(file) {
|
this.add-file = (file) => {
|
||||||
file._remove = =>
|
file._remove = =>
|
||||||
this.files = this.files.filter (x) -> x.id != file.id
|
this.files = this.files.filter (x) -> x.id != file.id
|
||||||
this.trigger 'change-files' this.files
|
this.trigger 'change-files' this.files
|
||||||
|
@ -430,14 +430,14 @@
|
||||||
this.trigger 'change-files' this.files
|
this.trigger 'change-files' this.files
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
add-poll() {
|
this.add-poll = () => {
|
||||||
this.poll = true
|
this.poll = true
|
||||||
|
|
||||||
on-poll-destroyed() {
|
this.on-poll-destroyed = () => {
|
||||||
@update do
|
@update do
|
||||||
poll: false
|
poll: false
|
||||||
|
|
||||||
post(e) {
|
this.post = (e) => {
|
||||||
this.wait = true
|
this.wait = true
|
||||||
|
|
||||||
files = if this.files? and this.files.length > 0
|
files = if this.files? and this.files.length > 0
|
||||||
|
@ -459,7 +459,7 @@
|
||||||
this.wait = false
|
this.wait = false
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
cat() {
|
this.cat = () => {
|
||||||
this.refs.text.value = this.refs.text.value + get-cat!
|
this.refs.text.value = this.refs.text.value + get-cat!
|
||||||
</script>
|
</script>
|
||||||
</mk-post-form>
|
</mk-post-form>
|
||||||
|
|
|
@ -83,12 +83,12 @@
|
||||||
this.refs.window.on('closed', () => {
|
this.refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
update-progress(value, max) {
|
this.update-progress = (value, max) => {
|
||||||
this.value = parse-int value, 10
|
this.value = parse-int value, 10
|
||||||
this.max = parse-int max, 10
|
this.max = parse-int max, 10
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
</script>
|
</script>
|
||||||
</mk-progress-dialog>
|
</mk-progress-dialog>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
on-document-keydown(e) {
|
this.on-document-keydown = (e) => {
|
||||||
tag = e.target.tag-name.to-lower-case!
|
tag = e.target.tag-name.to-lower-case!
|
||||||
if tag != 'input' and tag != 'textarea'
|
if tag != 'input' and tag != 'textarea'
|
||||||
if e.which == 27 // Esc
|
if e.which == 27 // Esc
|
||||||
|
@ -25,12 +25,12 @@
|
||||||
this.refs.window.refs.form.on('posted', () => {
|
this.refs.window.refs.form.on('posted', () => {
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
|
|
||||||
document.add-event-listener 'keydown' this.on-document-keydown
|
document.addEventListener 'keydown' this.on-document-keydown
|
||||||
|
|
||||||
this.refs.window.on('closed', () => {
|
this.refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
document.remove-event-listener 'keydown' this.on-document-keydown
|
document.removeEventListener 'keydown' this.on-document-keydown
|
||||||
</script>
|
</script>
|
||||||
</mk-repost-form-window>
|
</mk-repost-form-window>
|
||||||
|
|
|
@ -120,10 +120,10 @@
|
||||||
this.wait = false
|
this.wait = false
|
||||||
this.quote = false
|
this.quote = false
|
||||||
|
|
||||||
cancel() {
|
this.cancel = () => {
|
||||||
this.trigger('cancel');
|
this.trigger('cancel');
|
||||||
|
|
||||||
ok() {
|
this.ok = () => {
|
||||||
this.wait = true
|
this.wait = true
|
||||||
this.api 'posts/create' do
|
this.api 'posts/create' do
|
||||||
repost_id: this.opts.post.id
|
repost_id: this.opts.post.id
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
this.wait = false
|
this.wait = false
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
onquote() {
|
this.onquote = () => {
|
||||||
this.quote = true
|
this.quote = true
|
||||||
</script>
|
</script>
|
||||||
</mk-repost-form>
|
</mk-repost-form>
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
this.page = 0
|
this.page = 0
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
document.add-event-listener 'keydown' this.on-document-keydown
|
document.addEventListener 'keydown' this.on-document-keydown
|
||||||
window.add-event-listener 'scroll' this.on-scroll
|
window.addEventListener 'scroll' this.on-scroll
|
||||||
|
|
||||||
this.api 'posts/search' do
|
this.api 'posts/search' do
|
||||||
query: @query
|
query: @query
|
||||||
|
@ -53,16 +53,16 @@
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
document.remove-event-listener 'keydown' this.on-document-keydown
|
document.removeEventListener 'keydown' this.on-document-keydown
|
||||||
window.remove-event-listener 'scroll' this.on-scroll
|
window.removeEventListener 'scroll' this.on-scroll
|
||||||
|
|
||||||
on-document-keydown(e) {
|
this.on-document-keydown = (e) => {
|
||||||
tag = e.target.tag-name.to-lower-case!
|
tag = e.target.tag-name.to-lower-case!
|
||||||
if tag != 'input' and tag != 'textarea'
|
if tag != 'input' and tag != 'textarea'
|
||||||
if e.which == 84 // t
|
if e.which == 84 // t
|
||||||
this.refs.timeline.focus();
|
this.refs.timeline.focus();
|
||||||
|
|
||||||
more() {
|
this.more = () => {
|
||||||
if @more-loading or @is-loading or @timeline.posts.length == 0
|
if @more-loading or @is-loading or @timeline.posts.length == 0
|
||||||
return
|
return
|
||||||
this.more-loading = true
|
this.more-loading = true
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
on-scroll() {
|
this.on-scroll = () => {
|
||||||
current = window.scroll-y + window.inner-height
|
current = window.scroll-y + window.inner-height
|
||||||
if current > document.body.offset-height - 16 // 遊び
|
if current > document.body.offset-height - 16 // 遊び
|
||||||
@more!
|
@more!
|
||||||
|
|
|
@ -148,13 +148,13 @@
|
||||||
this.refs.window.on('closed', () => {
|
this.refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
|
|
||||||
upload() {
|
this.upload = () => {
|
||||||
this.refs.window.refs.browser.select-local-file!
|
this.refs.window.refs.browser.select-local-file!
|
||||||
|
|
||||||
ok() {
|
this.ok = () => {
|
||||||
this.trigger 'selected' this.file
|
this.trigger 'selected' this.file
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -34,10 +34,10 @@
|
||||||
this.mixin('i');
|
this.mixin('i');
|
||||||
this.mixin('update-avatar');
|
this.mixin('update-avatar');
|
||||||
|
|
||||||
set() {
|
this.set = () => {
|
||||||
@update-avatar this.I
|
@update-avatar this.I
|
||||||
|
|
||||||
close(e) {
|
this.close = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
|
@ -34,10 +34,10 @@
|
||||||
this.mixin('i');
|
this.mixin('i');
|
||||||
this.mixin('update-banner');
|
this.mixin('update-banner');
|
||||||
|
|
||||||
set() {
|
this.set = () => {
|
||||||
@update-banner this.I
|
@update-banner this.I
|
||||||
|
|
||||||
close(e) {
|
this.close = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
this.refs.window.on('closed', () => {
|
this.refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
</script>
|
</script>
|
||||||
</mk-settings-window>
|
</mk-settings-window>
|
||||||
|
|
|
@ -205,13 +205,13 @@
|
||||||
|
|
||||||
this.page = 'account'
|
this.page = 'account'
|
||||||
|
|
||||||
set-page(page) {
|
this.set-page = (page) => {
|
||||||
this.page = page
|
this.page = page
|
||||||
|
|
||||||
avatar() {
|
this.avatar = () => {
|
||||||
@update-avatar this.I
|
@update-avatar this.I
|
||||||
|
|
||||||
update-account() {
|
this.update-account = () => {
|
||||||
this.api 'i/update' do
|
this.api 'i/update' do
|
||||||
name: this.refs.account-name.value
|
name: this.refs.account-name.value
|
||||||
location: this.refs.account-location.value
|
location: this.refs.account-location.value
|
||||||
|
@ -222,19 +222,19 @@
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
update-cache() {
|
this.update-cache = () => {
|
||||||
this.I.data.cache = !this.I.data.cache
|
this.I.data.cache = !this.I.data.cache
|
||||||
this.api 'i/appdata/set' do
|
this.api 'i/appdata/set' do
|
||||||
data: JSON.stringify do
|
data: JSON.stringify do
|
||||||
cache: this.I.data.cache
|
cache: this.I.data.cache
|
||||||
|
|
||||||
update-debug() {
|
this.update-debug = () => {
|
||||||
this.I.data.debug = !this.I.data.debug
|
this.I.data.debug = !this.I.data.debug
|
||||||
this.api 'i/appdata/set' do
|
this.api 'i/appdata/set' do
|
||||||
data: JSON.stringify do
|
data: JSON.stringify do
|
||||||
debug: this.I.data.debug
|
debug: this.I.data.debug
|
||||||
|
|
||||||
update-nya() {
|
this.update-nya = () => {
|
||||||
this.I.data.nya = !this.I.data.nya
|
this.I.data.nya = !this.I.data.nya
|
||||||
this.api 'i/appdata/set' do
|
this.api 'i/appdata/set' do
|
||||||
data: JSON.stringify do
|
data: JSON.stringify do
|
||||||
|
|
|
@ -349,17 +349,17 @@
|
||||||
riot.mount @preview, do
|
riot.mount @preview, do
|
||||||
url: t.content
|
url: t.content
|
||||||
|
|
||||||
reply() {
|
this.reply = () => {
|
||||||
form = document.body.appendChild document.createElement 'mk-post-form-window'
|
form = document.body.appendChild document.createElement 'mk-post-form-window'
|
||||||
riot.mount form, do
|
riot.mount form, do
|
||||||
reply: @p
|
reply: @p
|
||||||
|
|
||||||
repost() {
|
this.repost = () => {
|
||||||
form = document.body.appendChild document.createElement 'mk-repost-form-window'
|
form = document.body.appendChild document.createElement 'mk-repost-form-window'
|
||||||
riot.mount form, do
|
riot.mount form, do
|
||||||
post: @p
|
post: @p
|
||||||
|
|
||||||
like() {
|
this.like = () => {
|
||||||
if @p.is_liked
|
if @p.is_liked
|
||||||
this.api 'posts/likes/delete' do
|
this.api 'posts/likes/delete' do
|
||||||
post_id: @p.id
|
post_id: @p.id
|
||||||
|
@ -373,11 +373,11 @@
|
||||||
@p.is_liked = true
|
@p.is_liked = true
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
toggle-detail() {
|
this.toggle-detail = () => {
|
||||||
this.is-detail-opened = !@is-detail-opened
|
this.is-detail-opened = !@is-detail-opened
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
on-key-down(e) {
|
this.on-key-down = (e) => {
|
||||||
should-be-cancel = true
|
should-be-cancel = true
|
||||||
switch
|
switch
|
||||||
| e.which == 38 or e.which == 74 or (e.which == 9 and e.shift-key) => // ↑, j or Shift+Tab
|
| e.which == 38 or e.which == 74 or (e.which == 9 and e.shift-key) => // ↑, j or Shift+Tab
|
||||||
|
|
|
@ -46,24 +46,24 @@
|
||||||
<script>
|
<script>
|
||||||
this.posts = []
|
this.posts = []
|
||||||
|
|
||||||
set-posts(posts) {
|
this.set-posts = (posts) => {
|
||||||
this.posts = posts
|
this.posts = posts
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
prepend-posts(posts) {
|
this.prepend-posts = (posts) => {
|
||||||
posts.for-each (post) =>
|
posts.for-each (post) =>
|
||||||
@posts.push post
|
@posts.push post
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
add-post(post) {
|
this.add-post = (post) => {
|
||||||
@posts.unshift post
|
@posts.unshift post
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
clear() {
|
this.clear = () => {
|
||||||
this.posts = []
|
this.posts = []
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
focus() {
|
this.focus = () => {
|
||||||
this.root.children.0.focus();
|
this.root.children.0.focus();
|
||||||
|
|
||||||
this.on('update', () => {
|
this.on('update', () => {
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
post._date = date
|
post._date = date
|
||||||
post._datetext = month + '月 ' + date + '日'
|
post._datetext = month + '月 ' + date + '日'
|
||||||
|
|
||||||
tail() {
|
this.tail = () => {
|
||||||
@posts[@posts.length - 1]
|
@posts[@posts.length - 1]
|
||||||
</script>
|
</script>
|
||||||
</mk-timeline>
|
</mk-timeline>
|
||||||
|
|
|
@ -167,37 +167,37 @@
|
||||||
this.on('before-unmount', () => {
|
this.on('before-unmount', () => {
|
||||||
@close!
|
@close!
|
||||||
|
|
||||||
toggle() {
|
this.toggle = () => {
|
||||||
if @is-open
|
if @is-open
|
||||||
@close!
|
@close!
|
||||||
else
|
else
|
||||||
@open!
|
@open!
|
||||||
|
|
||||||
open() {
|
this.open = () => {
|
||||||
this.is-open = true
|
this.is-open = true
|
||||||
this.update();
|
this.update();
|
||||||
all = document.query-selector-all 'body *'
|
all = document.query-selector-all 'body *'
|
||||||
Array.prototype.for-each.call all, (el) =>
|
Array.prototype.for-each.call all, (el) =>
|
||||||
el.add-event-listener 'mousedown' @mousedown
|
el.addEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
this.is-open = false
|
this.is-open = false
|
||||||
this.update();
|
this.update();
|
||||||
all = document.query-selector-all 'body *'
|
all = document.query-selector-all 'body *'
|
||||||
Array.prototype.for-each.call all, (el) =>
|
Array.prototype.for-each.call all, (el) =>
|
||||||
el.remove-event-listener 'mousedown' @mousedown
|
el.removeEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
mousedown(e) {
|
this.mousedown = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!contains this.root, e.target) and (this.root != e.target)
|
if (!contains this.root, e.target) and (this.root != e.target)
|
||||||
@close!
|
@close!
|
||||||
return false
|
return false
|
||||||
|
|
||||||
drive() {
|
this.drive = () => {
|
||||||
@close!
|
@close!
|
||||||
riot.mount document.body.appendChild document.createElement 'mk-drive-browser-window'
|
riot.mount document.body.appendChild document.createElement 'mk-drive-browser-window'
|
||||||
|
|
||||||
settings() {
|
this.settings = () => {
|
||||||
@close!
|
@close!
|
||||||
riot.mount document.body.appendChild document.createElement 'mk-settings-window'
|
riot.mount document.body.appendChild document.createElement 'mk-settings-window'
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
draw() {
|
this.draw = () => {
|
||||||
now = new Date!
|
now = new Date!
|
||||||
|
|
||||||
yyyy = now.get-full-year!
|
yyyy = now.get-full-year!
|
||||||
|
|
|
@ -98,15 +98,15 @@
|
||||||
@stream.off 'read_all_messaging_messages' this.on-read-all-messaging-messages
|
@stream.off 'read_all_messaging_messages' this.on-read-all-messaging-messages
|
||||||
@stream.off 'unread_messaging_message' this.on-unread-messaging-message
|
@stream.off 'unread_messaging_message' this.on-unread-messaging-message
|
||||||
|
|
||||||
on-read-all-messaging-messages() {
|
this.on-read-all-messaging-messages = () => {
|
||||||
this.has-unread-messaging-messages = false
|
this.has-unread-messaging-messages = false
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
on-unread-messaging-message() {
|
this.on-unread-messaging-message = () => {
|
||||||
this.has-unread-messaging-messages = true
|
this.has-unread-messaging-messages = true
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
messaging() {
|
this.messaging = () => {
|
||||||
riot.mount document.body.appendChild document.createElement 'mk-messaging-window'
|
riot.mount document.body.appendChild document.createElement 'mk-messaging-window'
|
||||||
</script>
|
</script>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -77,27 +77,27 @@
|
||||||
<script>
|
<script>
|
||||||
this.is-open = false
|
this.is-open = false
|
||||||
|
|
||||||
toggle() {
|
this.toggle = () => {
|
||||||
if @is-open
|
if @is-open
|
||||||
@close!
|
@close!
|
||||||
else
|
else
|
||||||
@open!
|
@open!
|
||||||
|
|
||||||
open() {
|
this.open = () => {
|
||||||
this.is-open = true
|
this.is-open = true
|
||||||
this.update();
|
this.update();
|
||||||
all = document.query-selector-all 'body *'
|
all = document.query-selector-all 'body *'
|
||||||
Array.prototype.for-each.call all, (el) =>
|
Array.prototype.for-each.call all, (el) =>
|
||||||
el.add-event-listener 'mousedown' @mousedown
|
el.addEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
this.is-open = false
|
this.is-open = false
|
||||||
this.update();
|
this.update();
|
||||||
all = document.query-selector-all 'body *'
|
all = document.query-selector-all 'body *'
|
||||||
Array.prototype.for-each.call all, (el) =>
|
Array.prototype.for-each.call all, (el) =>
|
||||||
el.remove-event-listener 'mousedown' @mousedown
|
el.removeEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
mousedown(e) {
|
this.mousedown = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!contains this.root, e.target) and (this.root != e.target)
|
if (!contains this.root, e.target) and (this.root != e.target)
|
||||||
@close!
|
@close!
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
post(e) {
|
this.post = (e) => {
|
||||||
this.parent.parent.open-post-form!
|
this.parent.parent.open-post-form!
|
||||||
</script>
|
</script>
|
||||||
</mk-ui-header-post-button>
|
</mk-ui-header-post-button>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<script>
|
<script>
|
||||||
this.mixin('page');
|
this.mixin('page');
|
||||||
|
|
||||||
onsubmit(e) {
|
this.onsubmit = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@page '/search:' + this.refs.q.value
|
@page '/search:' + this.refs.q.value
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -14,20 +14,20 @@
|
||||||
<script>
|
<script>
|
||||||
this.mixin('i');
|
this.mixin('i');
|
||||||
|
|
||||||
open-post-form() {
|
this.open-post-form = () => {
|
||||||
riot.mount document.body.appendChild document.createElement 'mk-post-form-window'
|
riot.mount document.body.appendChild document.createElement 'mk-post-form-window'
|
||||||
|
|
||||||
set-root-layout() {
|
this.set-root-layout = () => {
|
||||||
this.root.style.padding-top = this.refs.header.root.client-height + 'px'
|
this.root.style.padding-top = this.refs.header.root.client-height + 'px'
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@set-root-layout!
|
@set-root-layout!
|
||||||
document.add-event-listener 'keydown' this.onkeydown
|
document.addEventListener 'keydown' this.onkeydown
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
document.remove-event-listener 'keydown' this.onkeydown
|
document.removeEventListener 'keydown' this.onkeydown
|
||||||
|
|
||||||
onkeydown(e) {
|
this.onkeydown = (e) => {
|
||||||
tag = e.target.tag-name.to-lower-case!
|
tag = e.target.tag-name.to-lower-case!
|
||||||
if tag != 'input' and tag != 'textarea'
|
if tag != 'input' and tag != 'textarea'
|
||||||
if e.which == 80 or e.which == 78 // p or n
|
if e.which == 80 or e.which == 78 // p or n
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
this.user = this.opts.user
|
this.user = this.opts.user
|
||||||
|
|
||||||
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: @user.id
|
||||||
iknow: iknow
|
iknow: iknow
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
this.user = this.opts.user
|
this.user = this.opts.user
|
||||||
|
|
||||||
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: @user.id
|
||||||
iknow: iknow
|
iknow: iknow
|
||||||
|
|
|
@ -111,16 +111,16 @@
|
||||||
this.user = this.opts.user
|
this.user = this.opts.user
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
window.add-event-listener 'load' @scroll
|
window.addEventListener 'load' @scroll
|
||||||
window.add-event-listener 'scroll' @scroll
|
window.addEventListener 'scroll' @scroll
|
||||||
window.add-event-listener 'resize' @scroll
|
window.addEventListener 'resize' @scroll
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
window.remove-event-listener 'load' @scroll
|
window.removeEventListener 'load' @scroll
|
||||||
window.remove-event-listener 'scroll' @scroll
|
window.removeEventListener 'scroll' @scroll
|
||||||
window.remove-event-listener 'resize' @scroll
|
window.removeEventListener 'resize' @scroll
|
||||||
|
|
||||||
scroll() {
|
this.scroll = () => {
|
||||||
top = window.scroll-y
|
top = window.scroll-y
|
||||||
height = 280px
|
height = 280px
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
if blur <= 10
|
if blur <= 10
|
||||||
this.refs.banner.style.filter = 'blur(' + blur + 'px)'
|
this.refs.banner.style.filter = 'blur(' + blur + 'px)'
|
||||||
|
|
||||||
on-update-banner() {
|
this.on-update-banner = () => {
|
||||||
if not @SIGNIN or this.I.id != @user.id
|
if not @SIGNIN or this.I.id != @user.id
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
easing: 'ease-out'
|
easing: 'ease-out'
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
Velocity this.root, {
|
Velocity this.root, {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
'margin-top': '-8px'
|
'margin-top': '-8px'
|
||||||
|
|
|
@ -86,12 +86,12 @@
|
||||||
|
|
||||||
this.user = this.opts.user
|
this.user = this.opts.user
|
||||||
|
|
||||||
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: @user
|
||||||
|
|
||||||
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: @user
|
||||||
|
|
|
@ -59,9 +59,9 @@
|
||||||
this.mode = 'default'
|
this.mode = 'default'
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
document.add-event-listener 'visibilitychange' @window-on-visibilitychange, false
|
document.addEventListener 'visibilitychange' @window-on-visibilitychange, false
|
||||||
document.add-event-listener 'keydown' this.on-document-keydown
|
document.addEventListener 'keydown' this.on-document-keydown
|
||||||
window.add-event-listener 'scroll' this.on-scroll
|
window.addEventListener 'scroll' this.on-scroll
|
||||||
|
|
||||||
@user-promise.then (user) =>
|
@user-promise.then (user) =>
|
||||||
this.user = user
|
this.user = user
|
||||||
|
@ -71,17 +71,17 @@
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
document.remove-event-listener 'visibilitychange' @window-on-visibilitychange
|
document.removeEventListener 'visibilitychange' @window-on-visibilitychange
|
||||||
document.remove-event-listener 'keydown' this.on-document-keydown
|
document.removeEventListener 'keydown' this.on-document-keydown
|
||||||
window.remove-event-listener 'scroll' this.on-scroll
|
window.removeEventListener 'scroll' this.on-scroll
|
||||||
|
|
||||||
on-document-keydown(e) {
|
this.on-document-keydown = (e) => {
|
||||||
tag = e.target.tag-name.to-lower-case!
|
tag = e.target.tag-name.to-lower-case!
|
||||||
if tag != 'input' and tag != 'textarea'
|
if tag != 'input' and tag != 'textarea'
|
||||||
if e.which == 84 // t
|
if e.which == 84 // t
|
||||||
this.refs.timeline.focus();
|
this.refs.timeline.focus();
|
||||||
|
|
||||||
fetch(cb) {
|
this.fetch = (cb) => {
|
||||||
this.api 'users/posts' do
|
this.api 'users/posts' do
|
||||||
user_id: @user.id
|
user_id: @user.id
|
||||||
with_replies: @mode == 'with-replies'
|
with_replies: @mode == 'with-replies'
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
console.error err
|
console.error err
|
||||||
if cb? then cb!
|
if cb? then cb!
|
||||||
|
|
||||||
more() {
|
this.more = () => {
|
||||||
if @more-loading or @is-loading or this.refs.timeline.posts.length == 0
|
if @more-loading or @is-loading or this.refs.timeline.posts.length == 0
|
||||||
return
|
return
|
||||||
this.more-loading = true
|
this.more-loading = true
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
on-stream-post(post) {
|
this.on-stream-post = (post) => {
|
||||||
this.is-empty = false
|
this.is-empty = false
|
||||||
this.update();
|
this.update();
|
||||||
this.refs.timeline.add-post post
|
this.refs.timeline.add-post post
|
||||||
|
@ -120,17 +120,17 @@
|
||||||
@unread-count++
|
@unread-count++
|
||||||
document.title = '(' + @unread-count + ') ' + @get-post-summary post
|
document.title = '(' + @unread-count + ') ' + @get-post-summary post
|
||||||
|
|
||||||
window-on-visibilitychange() {
|
this.window-on-visibilitychange = () => {
|
||||||
if !document.hidden
|
if !document.hidden
|
||||||
this.unread-count = 0
|
this.unread-count = 0
|
||||||
document.title = 'Misskey'
|
document.title = 'Misskey'
|
||||||
|
|
||||||
on-scroll() {
|
this.on-scroll = () => {
|
||||||
current = window.scroll-y + window.inner-height
|
current = window.scroll-y + window.inner-height
|
||||||
if current > document.body.offset-height - 16 // 遊び
|
if current > document.body.offset-height - 16 // 遊び
|
||||||
@more!
|
@more!
|
||||||
|
|
||||||
set-mode(mode) {
|
this.set-mode = (mode) => {
|
||||||
@update do
|
@update do
|
||||||
mode: mode
|
mode: mode
|
||||||
@fetch!
|
@fetch!
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
@fetch =>
|
@fetch =>
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
|
||||||
fetch(cb) {
|
this.fetch = (cb) => {
|
||||||
this.fetching = true
|
this.fetching = true
|
||||||
this.update();
|
this.update();
|
||||||
obj <~ this.opts.fetch do
|
obj <~ this.opts.fetch do
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
this.update();
|
this.update();
|
||||||
if cb? then cb!
|
if cb? then cb!
|
||||||
|
|
||||||
more() {
|
this.more = () => {
|
||||||
this.more-fetching = true
|
this.more-fetching = true
|
||||||
this.update();
|
this.update();
|
||||||
obj <~ this.opts.fetch do
|
obj <~ this.opts.fetch do
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
this.more-fetching = false
|
this.more-fetching = false
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
set-mode(mode) {
|
this.set-mode = (mode) => {
|
||||||
@update do
|
@update do
|
||||||
mode: mode
|
mode: mode
|
||||||
|
|
||||||
|
|
|
@ -207,17 +207,17 @@
|
||||||
this.refs.main.style.top = '15%'
|
this.refs.main.style.top = '15%'
|
||||||
this.refs.main.style.left = (window.inner-width / 2) - (this.refs.main.offset-width / 2) + 'px'
|
this.refs.main.style.left = (window.inner-width / 2) - (this.refs.main.offset-width / 2) + 'px'
|
||||||
|
|
||||||
this.refs.header.add-event-listener 'contextmenu' (e) =>
|
this.refs.header.addEventListener 'contextmenu' (e) =>
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
window.add-event-listener 'resize' this.on-browser-resize
|
window.addEventListener 'resize' this.on-browser-resize
|
||||||
|
|
||||||
@open!
|
@open!
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
window.remove-event-listener 'resize' this.on-browser-resize
|
window.removeEventListener 'resize' this.on-browser-resize
|
||||||
|
|
||||||
on-browser-resize() {
|
this.on-browser-resize = () => {
|
||||||
position = this.refs.main.get-bounding-client-rect!
|
position = this.refs.main.get-bounding-client-rect!
|
||||||
browser-width = window.inner-width
|
browser-width = window.inner-width
|
||||||
browser-height = window.inner-height
|
browser-height = window.inner-height
|
||||||
|
@ -236,7 +236,7 @@
|
||||||
if position.top + window-height > browser-height
|
if position.top + window-height > browser-height
|
||||||
this.refs.main.style.top = browser-height - window-height + 'px'
|
this.refs.main.style.top = browser-height - window-height + 'px'
|
||||||
|
|
||||||
open() {
|
this.open = () => {
|
||||||
this.trigger('opening');
|
this.trigger('opening');
|
||||||
|
|
||||||
@top!
|
@top!
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
this.trigger('opened');
|
this.trigger('opened');
|
||||||
, 300ms
|
, 300ms
|
||||||
|
|
||||||
close() {
|
this.close = () => {
|
||||||
this.trigger('closing');
|
this.trigger('closing');
|
||||||
|
|
||||||
if @is-modal
|
if @is-modal
|
||||||
|
@ -300,7 +300,7 @@
|
||||||
, 300ms
|
, 300ms
|
||||||
|
|
||||||
// 最前面へ移動します
|
// 最前面へ移動します
|
||||||
top() {
|
this.top = () => {
|
||||||
z = 0
|
z = 0
|
||||||
|
|
||||||
ws = document.query-selector-all 'mk-window'
|
ws = document.query-selector-all 'mk-window'
|
||||||
|
@ -314,20 +314,20 @@
|
||||||
this.refs.main.style.z-index = z + 1
|
this.refs.main.style.z-index = z + 1
|
||||||
if @is-modal then this.refs.bg.style.z-index = z + 1
|
if @is-modal then this.refs.bg.style.z-index = z + 1
|
||||||
|
|
||||||
repel-move(e) {
|
this.repel-move = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
return true
|
return true
|
||||||
|
|
||||||
bg-click() {
|
this.bg-click = () => {
|
||||||
if @can-close
|
if @can-close
|
||||||
@close!
|
@close!
|
||||||
|
|
||||||
on-body-mousedown(e) {
|
this.on-body-mousedown = (e) => {
|
||||||
@top!
|
@top!
|
||||||
true
|
true
|
||||||
|
|
||||||
// ヘッダー掴み時
|
// ヘッダー掴み時
|
||||||
on-header-mousedown(e) {
|
this.on-header-mousedown = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if not contains this.refs.main, document.active-element
|
if not contains this.refs.main, document.active-element
|
||||||
|
@ -369,7 +369,7 @@
|
||||||
this.refs.main.style.top = move-top + 'px'
|
this.refs.main.style.top = move-top + 'px'
|
||||||
|
|
||||||
// 上ハンドル掴み時
|
// 上ハンドル掴み時
|
||||||
on-top-handle-mousedown(e) {
|
this.on-top-handle-mousedown = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
base = e.client-y
|
base = e.client-y
|
||||||
|
@ -391,7 +391,7 @@
|
||||||
@apply-transform-top 0
|
@apply-transform-top 0
|
||||||
|
|
||||||
// 右ハンドル掴み時
|
// 右ハンドル掴み時
|
||||||
on-right-handle-mousedown(e) {
|
this.on-right-handle-mousedown = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
base = e.client-x
|
base = e.client-x
|
||||||
|
@ -411,7 +411,7 @@
|
||||||
@apply-transform-width browser-width - left
|
@apply-transform-width browser-width - left
|
||||||
|
|
||||||
// 下ハンドル掴み時
|
// 下ハンドル掴み時
|
||||||
on-bottom-handle-mousedown(e) {
|
this.on-bottom-handle-mousedown = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
base = e.client-y
|
base = e.client-y
|
||||||
|
@ -431,7 +431,7 @@
|
||||||
@apply-transform-height browser-height - top
|
@apply-transform-height browser-height - top
|
||||||
|
|
||||||
// 左ハンドル掴み時
|
// 左ハンドル掴み時
|
||||||
on-left-handle-mousedown(e) {
|
this.on-left-handle-mousedown = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
base = e.client-x
|
base = e.client-x
|
||||||
|
@ -453,55 +453,55 @@
|
||||||
@apply-transform-left 0
|
@apply-transform-left 0
|
||||||
|
|
||||||
// 左上ハンドル掴み時
|
// 左上ハンドル掴み時
|
||||||
on-top-left-handle-mousedown(e) {
|
this.on-top-left-handle-mousedown = (e) => {
|
||||||
this.on-top-handle-mousedown e
|
this.on-top-handle-mousedown e
|
||||||
this.on-left-handle-mousedown e
|
this.on-left-handle-mousedown e
|
||||||
|
|
||||||
// 右上ハンドル掴み時
|
// 右上ハンドル掴み時
|
||||||
on-top-right-handle-mousedown(e) {
|
this.on-top-right-handle-mousedown = (e) => {
|
||||||
this.on-top-handle-mousedown e
|
this.on-top-handle-mousedown e
|
||||||
this.on-right-handle-mousedown e
|
this.on-right-handle-mousedown e
|
||||||
|
|
||||||
// 右下ハンドル掴み時
|
// 右下ハンドル掴み時
|
||||||
on-bottom-right-handle-mousedown(e) {
|
this.on-bottom-right-handle-mousedown = (e) => {
|
||||||
this.on-bottom-handle-mousedown e
|
this.on-bottom-handle-mousedown e
|
||||||
this.on-right-handle-mousedown e
|
this.on-right-handle-mousedown e
|
||||||
|
|
||||||
// 左下ハンドル掴み時
|
// 左下ハンドル掴み時
|
||||||
on-bottom-left-handle-mousedown(e) {
|
this.on-bottom-left-handle-mousedown = (e) => {
|
||||||
this.on-bottom-handle-mousedown e
|
this.on-bottom-handle-mousedown e
|
||||||
this.on-left-handle-mousedown e
|
this.on-left-handle-mousedown e
|
||||||
|
|
||||||
// 高さを適用
|
// 高さを適用
|
||||||
apply-transform-height(height) {
|
this.apply-transform-height = (height) => {
|
||||||
this.refs.main.style.height = height + 'px'
|
this.refs.main.style.height = height + 'px'
|
||||||
|
|
||||||
// 幅を適用
|
// 幅を適用
|
||||||
apply-transform-width(width) {
|
this.apply-transform-width = (width) => {
|
||||||
this.refs.main.style.width = width + 'px'
|
this.refs.main.style.width = width + 'px'
|
||||||
|
|
||||||
// Y座標を適用
|
// Y座標を適用
|
||||||
apply-transform-top(top) {
|
this.apply-transform-top = (top) => {
|
||||||
this.refs.main.style.top = top + 'px'
|
this.refs.main.style.top = top + 'px'
|
||||||
|
|
||||||
// X座標を適用
|
// X座標を適用
|
||||||
apply-transform-left(left) {
|
this.apply-transform-left = (left) => {
|
||||||
this.refs.main.style.left = left + 'px'
|
this.refs.main.style.left = left + 'px'
|
||||||
|
|
||||||
function drag-listen fn
|
function drag-listen fn
|
||||||
window.add-event-listener 'mousemove' fn
|
window.addEventListener 'mousemove' fn
|
||||||
window.add-event-listener 'mouseleave' drag-clear.bind null fn
|
window.addEventListener 'mouseleave' drag-clear.bind null fn
|
||||||
window.add-event-listener 'mouseup' drag-clear.bind null fn
|
window.addEventListener 'mouseup' drag-clear.bind null fn
|
||||||
|
|
||||||
function drag-clear fn
|
function drag-clear fn
|
||||||
window.remove-event-listener 'mousemove' fn
|
window.removeEventListener 'mousemove' fn
|
||||||
window.remove-event-listener 'mouseleave' drag-clear
|
window.removeEventListener 'mouseleave' drag-clear
|
||||||
window.remove-event-listener 'mouseup' drag-clear
|
window.removeEventListener 'mouseup' drag-clear
|
||||||
|
|
||||||
ondragover(e) {
|
this.ondragover = (e) => {
|
||||||
e.dataTransfer.dropEffect = 'none'
|
e.dataTransfer.dropEffect = 'none'
|
||||||
|
|
||||||
on-keydown(e) {
|
this.on-keydown = (e) => {
|
||||||
if e.which == 27 // Esc
|
if e.which == 27 // Esc
|
||||||
if @can-close
|
if @can-close
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
@ -182,7 +182,7 @@
|
||||||
|
|
||||||
this.nid-state = null
|
this.nid-state = null
|
||||||
|
|
||||||
on-change-nid() {
|
this.on-change-nid = () => {
|
||||||
nid = this.refs.nid.value
|
nid = this.refs.nid.value
|
||||||
|
|
||||||
if nid == ''
|
if nid == ''
|
||||||
|
@ -215,7 +215,7 @@
|
||||||
this.nid-state = 'error'
|
this.nid-state = 'error'
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
onsubmit() {
|
this.onsubmit = () => {
|
||||||
name = this.refs.name.value
|
name = this.refs.name.value
|
||||||
nid = this.refs.nid.value
|
nid = this.refs.nid.value
|
||||||
description = this.refs.description.value
|
description = this.refs.description.value
|
||||||
|
|
|
@ -63,11 +63,11 @@
|
||||||
this.files = files
|
this.files = files
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
cancel() {
|
this.cancel = () => {
|
||||||
this.trigger('canceled');
|
this.trigger('canceled');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
ok() {
|
this.ok = () => {
|
||||||
this.trigger 'selected' this.files
|
this.trigger 'selected' this.files
|
||||||
this.unmount();
|
this.unmount();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -167,20 +167,20 @@
|
||||||
@stream.off 'drive_folder_created' this.on-stream-drive-folder-created
|
@stream.off 'drive_folder_created' this.on-stream-drive-folder-created
|
||||||
@stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated
|
@stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated
|
||||||
|
|
||||||
on-stream-drive-file-created(file) {
|
this.on-stream-drive-file-created = (file) => {
|
||||||
@add-file file, true
|
@add-file file, true
|
||||||
|
|
||||||
on-stream-drive-file-updated(file) {
|
this.on-stream-drive-file-updated = (file) => {
|
||||||
current = if this.folder? then this.folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != file.folder_id
|
if current != file.folder_id
|
||||||
@remove-file file
|
@remove-file file
|
||||||
else
|
else
|
||||||
@add-file file, true
|
@add-file file, true
|
||||||
|
|
||||||
on-stream-drive-folder-created(folder) {
|
this.on-stream-drive-folder-created = (folder) => {
|
||||||
@add-folder folder, true
|
@add-folder folder, true
|
||||||
|
|
||||||
on-stream-drive-folder-updated(folder) {
|
this.on-stream-drive-folder-updated = (folder) => {
|
||||||
current = if this.folder? then this.folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != folder.parent_id
|
if current != folder.parent_id
|
||||||
@remove-folder folder
|
@remove-folder folder
|
||||||
|
@ -190,10 +190,10 @@
|
||||||
@_move = (ev) =>
|
@_move = (ev) =>
|
||||||
@move ev.item.folder
|
@move ev.item.folder
|
||||||
|
|
||||||
move(target-folder) {
|
this.move = (target-folder) => {
|
||||||
@cd target-folder
|
@cd target-folder
|
||||||
|
|
||||||
cd(target-folder, silent = false) {
|
this.cd = (target-folder, silent = false) => {
|
||||||
this.file = null
|
this.file = null
|
||||||
|
|
||||||
if target-folder? and typeof target-folder == 'object'
|
if target-folder? and typeof target-folder == 'object'
|
||||||
|
@ -226,7 +226,7 @@
|
||||||
.catch (err, text-status) ->
|
.catch (err, text-status) ->
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
add-folder(folder, unshift = false) {
|
this.add-folder = (folder, unshift = false) => {
|
||||||
current = if this.folder? then this.folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != folder.parent_id
|
if current != folder.parent_id
|
||||||
return
|
return
|
||||||
|
@ -241,7 +241,7 @@
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
add-file(file, unshift = false) {
|
this.add-file = (file, unshift = false) => {
|
||||||
current = if this.folder? then this.folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != file.folder_id
|
if current != file.folder_id
|
||||||
return
|
return
|
||||||
|
@ -259,19 +259,19 @@
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
remove-folder(folder) {
|
this.remove-folder = (folder) => {
|
||||||
if typeof folder == 'object'
|
if typeof folder == 'object'
|
||||||
folder = folder.id
|
folder = folder.id
|
||||||
this.folders = this.folders.filter (f) -> f.id != folder
|
this.folders = this.folders.filter (f) -> f.id != folder
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
remove-file(file) {
|
this.remove-file = (file) => {
|
||||||
if typeof file == 'object'
|
if typeof file == 'object'
|
||||||
file = file.id
|
file = file.id
|
||||||
this.files = this.files.filter (f) -> f.id != file
|
this.files = this.files.filter (f) -> f.id != file
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
go-root() {
|
this.go-root = () => {
|
||||||
if this.folder != null or this.file != null
|
if this.folder != null or this.file != null
|
||||||
this.file = null
|
this.file = null
|
||||||
this.folder = null
|
this.folder = null
|
||||||
|
@ -280,7 +280,7 @@
|
||||||
this.trigger('move-root');
|
this.trigger('move-root');
|
||||||
@load!
|
@load!
|
||||||
|
|
||||||
load() {
|
this.load = () => {
|
||||||
this.folders = []
|
this.folders = []
|
||||||
this.files = []
|
this.files = []
|
||||||
this.more-folders = false
|
this.more-folders = false
|
||||||
|
@ -337,11 +337,11 @@
|
||||||
flag := true
|
flag := true
|
||||||
this.trigger('load-mid');
|
this.trigger('load-mid');
|
||||||
|
|
||||||
choose-file(file) {
|
this.choose-file = (file) => {
|
||||||
if @is-select-mode
|
if @is-select-mode
|
||||||
exist = @selected-files.some (f) => f.id == file.id
|
exist = @selected-files.some (f) => f.id == file.id
|
||||||
if exist
|
if exist
|
||||||
selected-files(@selected-files.filter (f) { f.id != file.id)
|
this.selected-files = (@selected-files.filter (f) => { f.id != file.id)
|
||||||
else
|
else
|
||||||
@selected-files.push file
|
@selected-files.push file
|
||||||
this.update();
|
this.update();
|
||||||
|
@ -349,7 +349,7 @@
|
||||||
else
|
else
|
||||||
@cf file
|
@cf file
|
||||||
|
|
||||||
cf(file, silent = false) {
|
this.cf = (file, silent = false) => {
|
||||||
if typeof file == 'object'
|
if typeof file == 'object'
|
||||||
file = file.id
|
file = file.id
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@
|
||||||
this.file = this.opts.file
|
this.file = this.opts.file
|
||||||
this.kind = this.file.type.split '/' .0
|
this.kind = this.file.type.split '/' .0
|
||||||
|
|
||||||
rename() {
|
this.rename = () => {
|
||||||
name = window.prompt '名前を変更' this.file.name
|
name = window.prompt '名前を変更' this.file.name
|
||||||
if name? and name != '' and name != this.file.name
|
if name? and name != '' and name != this.file.name
|
||||||
this.api 'drive/files/update' do
|
this.api 'drive/files/update' do
|
||||||
|
|
|
@ -131,7 +131,7 @@
|
||||||
this.browser.on('change-selected', (selects) => {
|
this.browser.on('change-selected', (selects) => {
|
||||||
this.is-selected = selects.some (f) => f.id == this.file.id
|
this.is-selected = selects.some (f) => f.id == this.file.id
|
||||||
|
|
||||||
onclick() {
|
this.onclick = () => {
|
||||||
this.browser.choose-file this.file
|
this.browser.choose-file this.file
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-file>
|
</mk-drive-file>
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
this.browser = this.parent
|
this.browser = this.parent
|
||||||
this.folder = this.opts.folder
|
this.folder = this.opts.folder
|
||||||
|
|
||||||
onclick() {
|
this.onclick = () => {
|
||||||
this.browser.move this.folder
|
this.browser.move this.folder
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-folder>
|
</mk-drive-folder>
|
||||||
|
|
|
@ -69,17 +69,17 @@
|
||||||
@stream.off 'follow' this.on-stream-follow
|
@stream.off 'follow' this.on-stream-follow
|
||||||
@stream.off 'unfollow' this.on-stream-unfollow
|
@stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
on-stream-follow(user) {
|
this.on-stream-follow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == @user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
on-stream-unfollow(user) {
|
this.on-stream-unfollow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == @user.id
|
||||||
this.user = user
|
this.user = user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
onclick() {
|
this.onclick = () => {
|
||||||
this.wait = true
|
this.wait = true
|
||||||
if @user.is_following
|
if @user.is_following
|
||||||
this.api 'following/delete' do
|
this.api 'following/delete' do
|
||||||
|
|
|
@ -25,19 +25,19 @@
|
||||||
@stream.off 'follow' this.on-stream-follow
|
@stream.off 'follow' this.on-stream-follow
|
||||||
@stream.off 'unfollow' this.on-stream-unfollow
|
@stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
more() {
|
this.more = () => {
|
||||||
this.api 'posts/timeline' do
|
this.api 'posts/timeline' do
|
||||||
max_id: this.refs.timeline.tail!.id
|
max_id: this.refs.timeline.tail!.id
|
||||||
|
|
||||||
on-stream-post(post) {
|
this.on-stream-post = (post) => {
|
||||||
this.is-empty = false
|
this.is-empty = false
|
||||||
this.update();
|
this.update();
|
||||||
this.refs.timeline.add-post post
|
this.refs.timeline.add-post post
|
||||||
|
|
||||||
on-stream-follow() {
|
this.on-stream-follow = () => {
|
||||||
@fetch!
|
@fetch!
|
||||||
|
|
||||||
on-stream-unfollow() {
|
this.on-stream-unfollow = () => {
|
||||||
@fetch!
|
@fetch!
|
||||||
</script>
|
</script>
|
||||||
</mk-home-timeline>
|
</mk-home-timeline>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
this.images = this.opts.images
|
this.images = this.opts.images
|
||||||
this.image = @images.0
|
this.image = @images.0
|
||||||
|
|
||||||
click() {
|
this.click = () => {
|
||||||
window.open @image.url
|
window.open @image.url
|
||||||
</script>
|
</script>
|
||||||
</mk-images-viewer>
|
</mk-images-viewer>
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'notification' this.on-notification
|
@stream.off 'notification' this.on-notification
|
||||||
|
|
||||||
on-notification(notification) {
|
this.on-notification = (notification) => {
|
||||||
@notifications.unshift notification
|
@notifications.unshift notification
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
|
|
|
@ -45,15 +45,15 @@
|
||||||
<script>
|
<script>
|
||||||
this.mode = 'signin'
|
this.mode = 'signin'
|
||||||
|
|
||||||
signup() {
|
this.signup = () => {
|
||||||
this.mode = 'signup'
|
this.mode = 'signup'
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
signin() {
|
this.signin = () => {
|
||||||
this.mode = 'signin'
|
this.mode = 'signin'
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
introduction() {
|
this.introduction = () => {
|
||||||
this.mode = 'introduction'
|
this.mode = 'introduction'
|
||||||
this.update();
|
this.update();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -23,21 +23,21 @@
|
||||||
this.Progress.start();
|
this.Progress.start();
|
||||||
|
|
||||||
@stream.on 'post' this.on-stream-post
|
@stream.on 'post' this.on-stream-post
|
||||||
document.add-event-listener 'visibilitychange' @window-on-visibilitychange, false
|
document.addEventListener 'visibilitychange' @window-on-visibilitychange, false
|
||||||
|
|
||||||
this.refs.ui.refs.home.on('loaded', () => {
|
this.refs.ui.refs.home.on('loaded', () => {
|
||||||
this.Progress.done();
|
this.Progress.done();
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'post' this.on-stream-post
|
@stream.off 'post' this.on-stream-post
|
||||||
document.remove-event-listener 'visibilitychange' @window-on-visibilitychange
|
document.removeEventListener 'visibilitychange' @window-on-visibilitychange
|
||||||
|
|
||||||
on-stream-post(post) {
|
this.on-stream-post = (post) => {
|
||||||
if document.hidden and post.user_id !== this.I.id
|
if document.hidden and post.user_id !== this.I.id
|
||||||
@unread-count++
|
@unread-count++
|
||||||
document.title = '(' + @unread-count + ') ' + @get-post-summary post
|
document.title = '(' + @unread-count + ') ' + @get-post-summary post
|
||||||
|
|
||||||
window-on-visibilitychange() {
|
this.window-on-visibilitychange = () => {
|
||||||
if !document.hidden
|
if !document.hidden
|
||||||
this.unread-count = 0
|
this.unread-count = 0
|
||||||
document.title = 'Misskey'
|
document.title = 'Misskey'
|
||||||
|
|
|
@ -391,18 +391,18 @@
|
||||||
this.replies = replies
|
this.replies = replies
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
reply() {
|
this.reply = () => {
|
||||||
@open-post-form do
|
@open-post-form do
|
||||||
reply: @p
|
reply: @p
|
||||||
|
|
||||||
repost() {
|
this.repost = () => {
|
||||||
text = window.prompt '「' + @summary + '」をRepost'
|
text = window.prompt '「' + @summary + '」をRepost'
|
||||||
if text?
|
if text?
|
||||||
this.api 'posts/create' do
|
this.api 'posts/create' do
|
||||||
repost_id: @p.id
|
repost_id: @p.id
|
||||||
text: if text == '' then undefined else text
|
text: if text == '' then undefined else text
|
||||||
|
|
||||||
like() {
|
this.like = () => {
|
||||||
if @p.is_liked
|
if @p.is_liked
|
||||||
this.api 'posts/likes/delete' do
|
this.api 'posts/likes/delete' do
|
||||||
post_id: @p.id
|
post_id: @p.id
|
||||||
|
@ -416,7 +416,7 @@
|
||||||
@p.is_liked = true
|
@p.is_liked = true
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
load-context() {
|
this.load-context = () => {
|
||||||
this.loading-context = true
|
this.loading-context = true
|
||||||
|
|
||||||
// Get context
|
// Get context
|
||||||
|
|
|
@ -200,13 +200,13 @@
|
||||||
|
|
||||||
this.refs.text.focus();
|
this.refs.text.focus();
|
||||||
|
|
||||||
onkeypress(e) {
|
this.onkeypress = (e) => {
|
||||||
if (e.char-code == 10 || e.char-code == 13) && e.ctrlKey
|
if (e.char-code == 10 || e.char-code == 13) && e.ctrlKey
|
||||||
@post!
|
@post!
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
|
|
||||||
onpaste(e) {
|
this.onpaste = (e) => {
|
||||||
data = e.clipboardData
|
data = e.clipboardData
|
||||||
items = data.items
|
items = data.items
|
||||||
for i from 0 to items.length - 1
|
for i from 0 to items.length - 1
|
||||||
|
@ -216,10 +216,10 @@
|
||||||
@upload item.getAsFile();
|
@upload item.getAsFile();
|
||||||
return true
|
return true
|
||||||
|
|
||||||
select-file() {
|
this.select-file = () => {
|
||||||
this.refs.file.click!
|
this.refs.file.click!
|
||||||
|
|
||||||
select-file-from-drive() {
|
this.select-file-from-drive = () => {
|
||||||
browser = document.body.appendChild document.createElement 'mk-drive-selector'
|
browser = document.body.appendChild document.createElement 'mk-drive-selector'
|
||||||
browser = riot.mount browser, do
|
browser = riot.mount browser, do
|
||||||
multiple: true
|
multiple: true
|
||||||
|
@ -227,16 +227,16 @@
|
||||||
browser.on('selected', (files) => {
|
browser.on('selected', (files) => {
|
||||||
files.for-each @add-file
|
files.for-each @add-file
|
||||||
|
|
||||||
change-file() {
|
this.change-file = () => {
|
||||||
files = this.refs.file.files
|
files = this.refs.file.files
|
||||||
for i from 0 to files.length - 1
|
for i from 0 to files.length - 1
|
||||||
file = files.item i
|
file = files.item i
|
||||||
@upload file
|
@upload file
|
||||||
|
|
||||||
upload(file) {
|
this.upload = (file) => {
|
||||||
this.refs.uploader.upload file
|
this.refs.uploader.upload file
|
||||||
|
|
||||||
add-file(file) {
|
this.add-file = (file) => {
|
||||||
file._remove = =>
|
file._remove = =>
|
||||||
this.files = this.files.filter (x) -> x.id != file.id
|
this.files = this.files.filter (x) -> x.id != file.id
|
||||||
this.trigger 'change-files' this.files
|
this.trigger 'change-files' this.files
|
||||||
|
@ -246,14 +246,14 @@
|
||||||
this.trigger 'change-files' this.files
|
this.trigger 'change-files' this.files
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
add-poll() {
|
this.add-poll = () => {
|
||||||
this.poll = true
|
this.poll = true
|
||||||
|
|
||||||
on-poll-destroyed() {
|
this.on-poll-destroyed = () => {
|
||||||
@update do
|
@update do
|
||||||
poll: false
|
poll: false
|
||||||
|
|
||||||
post() {
|
this.post = () => {
|
||||||
this.wait = true
|
this.wait = true
|
||||||
|
|
||||||
files = if this.files? and this.files.length > 0
|
files = if this.files? and this.files.length > 0
|
||||||
|
@ -274,11 +274,11 @@
|
||||||
this.wait = false
|
this.wait = false
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
cancel() {
|
this.cancel = () => {
|
||||||
this.trigger('cancel');
|
this.trigger('cancel');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
cat() {
|
this.cat = () => {
|
||||||
this.refs.text.value = this.refs.text.value + get-cat!
|
this.refs.text.value = this.refs.text.value + get-cat!
|
||||||
</script>
|
</script>
|
||||||
</mk-post-form>
|
</mk-post-form>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
res posts
|
res posts
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
|
||||||
more() {
|
this.more = () => {
|
||||||
@offset += @max
|
@offset += @max
|
||||||
this.api 'posts/search' do
|
this.api 'posts/search' do
|
||||||
query: @query
|
query: @query
|
||||||
|
|
|
@ -319,18 +319,18 @@
|
||||||
riot.mount @preview, do
|
riot.mount @preview, do
|
||||||
url: t.content
|
url: t.content
|
||||||
|
|
||||||
reply() {
|
this.reply = () => {
|
||||||
@open-post-form do
|
@open-post-form do
|
||||||
reply: @p
|
reply: @p
|
||||||
|
|
||||||
repost() {
|
this.repost = () => {
|
||||||
text = window.prompt '「' + @summary + '」をRepost'
|
text = window.prompt '「' + @summary + '」をRepost'
|
||||||
if text?
|
if text?
|
||||||
this.api 'posts/create' do
|
this.api 'posts/create' do
|
||||||
repost_id: @p.id
|
repost_id: @p.id
|
||||||
text: if text == '' then undefined else text
|
text: if text == '' then undefined else text
|
||||||
|
|
||||||
like() {
|
this.like = () => {
|
||||||
if @p.is_liked
|
if @p.is_liked
|
||||||
this.api 'posts/likes/delete' do
|
this.api 'posts/likes/delete' do
|
||||||
post_id: @p.id
|
post_id: @p.id
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
post._date = date
|
post._date = date
|
||||||
post._datetext = month + '月 ' + date + '日'
|
post._datetext = month + '月 ' + date + '日'
|
||||||
|
|
||||||
more() {
|
this.more = () => {
|
||||||
if @init or @fetching or @posts.length == 0 then return
|
if @init or @fetching or @posts.length == 0 then return
|
||||||
this.fetching = true
|
this.fetching = true
|
||||||
this.update();
|
this.update();
|
||||||
|
@ -99,20 +99,20 @@
|
||||||
this.fetching = false
|
this.fetching = false
|
||||||
@prepend-posts posts
|
@prepend-posts posts
|
||||||
|
|
||||||
set-posts(posts) {
|
this.set-posts = (posts) => {
|
||||||
this.posts = posts
|
this.posts = posts
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
prepend-posts(posts) {
|
this.prepend-posts = (posts) => {
|
||||||
posts.for-each (post) =>
|
posts.for-each (post) =>
|
||||||
@posts.push post
|
@posts.push post
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
add-post(post) {
|
this.add-post = (post) => {
|
||||||
@posts.unshift post
|
@posts.unshift post
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
tail() {
|
this.tail = () => {
|
||||||
@posts[@posts.length - 1]
|
@posts[@posts.length - 1]
|
||||||
</script>
|
</script>
|
||||||
</mk-timeline>
|
</mk-timeline>
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
if this.refs.title?
|
if this.refs.title?
|
||||||
this.refs.title.innerHTML = title
|
this.refs.title.innerHTML = title
|
||||||
|
|
||||||
post() {
|
this.post = () => {
|
||||||
@open-post-form!
|
@open-post-form!
|
||||||
</script>
|
</script>
|
||||||
</mk-ui-header>
|
</mk-ui-header>
|
||||||
|
|
|
@ -123,7 +123,7 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.opts.ready!
|
this.opts.ready!
|
||||||
|
|
||||||
search() {
|
this.search = () => {
|
||||||
query = window.prompt '検索'
|
query = window.prompt '検索'
|
||||||
if query? and query != ''
|
if query? and query != ''
|
||||||
@page '/search:' + query
|
@page '/search:' + query
|
||||||
|
|
|
@ -29,21 +29,21 @@
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'notification' this.on-stream-notification
|
@stream.off 'notification' this.on-stream-notification
|
||||||
|
|
||||||
ready() {
|
this.ready = () => {
|
||||||
@ready-count++
|
@ready-count++
|
||||||
|
|
||||||
if @ready-count == 2
|
if @ready-count == 2
|
||||||
@init-view-position!
|
@init-view-position!
|
||||||
|
|
||||||
init-view-position() {
|
this.init-view-position = () => {
|
||||||
top = this.refs.header.root.offset-height
|
top = this.refs.header.root.offset-height
|
||||||
this.refs.main.style.padding-top = top + 'px'
|
this.refs.main.style.padding-top = top + 'px'
|
||||||
|
|
||||||
toggle-drawer() {
|
this.toggle-drawer = () => {
|
||||||
this.is-drawer-opening = !@is-drawer-opening
|
this.is-drawer-opening = !@is-drawer-opening
|
||||||
this.refs.nav.root.style.display = if @is-drawer-opening then 'block' else 'none'
|
this.refs.nav.root.style.display = if @is-drawer-opening then 'block' else 'none'
|
||||||
|
|
||||||
on-stream-notification(notification) {
|
this.on-stream-notification = (notification) => {
|
||||||
el = document.body.appendChild document.createElement 'mk-notify'
|
el = document.body.appendChild document.createElement 'mk-notify'
|
||||||
riot.mount el, do
|
riot.mount el, do
|
||||||
notification: notification
|
notification: notification
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
this.user = this.opts.user
|
this.user = this.opts.user
|
||||||
|
|
||||||
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: @user.id
|
||||||
iknow: iknow
|
iknow: iknow
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
this.user = this.opts.user
|
this.user = this.opts.user
|
||||||
|
|
||||||
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: @user.id
|
||||||
iknow: iknow
|
iknow: iknow
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
res posts
|
res posts
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
|
||||||
more() {
|
this.more = () => {
|
||||||
this.api 'users/posts' do
|
this.api 'users/posts' do
|
||||||
user_id: @user.id
|
user_id: @user.id
|
||||||
with_media: @with-media
|
with_media: @with-media
|
||||||
|
|
|
@ -172,19 +172,19 @@
|
||||||
this.trigger 'loaded' user
|
this.trigger 'loaded' user
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
go-posts() {
|
this.go-posts = () => {
|
||||||
this.page = 'posts'
|
this.page = 'posts'
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
go-media() {
|
this.go-media = () => {
|
||||||
this.page = 'media'
|
this.page = 'media'
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
go-graphs() {
|
this.go-graphs = () => {
|
||||||
this.page = 'graphs'
|
this.page = 'graphs'
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
go-likes() {
|
this.go-likes = () => {
|
||||||
this.page = 'likes'
|
this.page = 'likes'
|
||||||
this.update();
|
this.update();
|
||||||
</script>
|
</script>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue