This commit is contained in:
syuilo 2017-02-20 10:34:57 +09:00
parent 7791431717
commit 91d8ee5a52
101 changed files with 423 additions and 423 deletions

View file

@ -111,13 +111,13 @@
this.session = this.opts.session
this.app = @session.app
cancel() {
this.cancel = () => {
this.api 'auth/deny' do
token: @session.token
.then =>
this.trigger('denied');
accept() {
this.accept = () => {
this.api 'auth/accept' do
token: @session.token
.then =>

View file

@ -127,7 +127,7 @@
this.state = 'fetch-session-error'
this.update();
accepted() {
this.accepted = () => {
this.state = 'accepted'
this.update();

View file

@ -57,7 +57,7 @@
</style>
<script>
retry() {
this.retry = () => {
this.unmount();
this.opts.retry();
}

View file

@ -119,7 +119,7 @@
<script>
this.mixin('api');
onpaste(e) {
this.onpaste = (e) => {
const data = e.clipboardData;
const items = data.items;
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) {
this.send();
}
}
selectFile() {
this.selectFile = () => {
this.refs.file.click();
}
selectFileFromDrive() {
this.selectFileFromDrive = () => {
const browser = document.body.appendChild(document.createElement('mk-select-file-from-drive-window'));
const event = riot.observable();
riot.mount(browser, {
@ -152,7 +152,7 @@
});
}
send() {
this.send = () => {
this.sending = true;
this.api('messaging/messages/create', {
user_id: this.opts.user.id,
@ -166,7 +166,7 @@
this.update();
});
clear() {
this.clear = () => {
this.refs.text.value = '';
this.files = [];
this.update();

View file

@ -305,7 +305,7 @@
});
}
search() {
this.search = () => {
const q = this.refs.search.value;
if (q == '') {
this.searchResult = [];
@ -323,7 +323,7 @@
.catch (err) =>
console.error err
on-search-keydown(e) {
this.on-search-keydown = (e) => {
key = e.which
switch (key)
| 9, 40 => // Key[TAB] or Key[↓]
@ -331,7 +331,7 @@
e.stopPropagation();
this.refs.search-result.childNodes[0].focus();
on-search-result-keydown(i, e) {
this.on-search-result-keydown = (i, e) => {
key = e.which
switch (key)
| 10, 13 => // Key[ENTER]

View file

@ -128,18 +128,18 @@
this.mixin('api');
this.mixin('messaging-stream');
this.user = this.opts.user
this.init = true
this.sending = false
this.messages = []
this.user = this.opts.user;
this.init = true;
this.sending = false;
this.messages = [];
this.connection = new @MessagingStreamConnection this.I, @user.id
this.connection = new this.MessagingStreamConnection(this.I, this.user.id);
this.on('mount', () => {
@connection.event.on 'message' this.on-message
@connection.event.on 'read' this.on-read
this.connection.event.on('message' this.onMessage);
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
user_id: @user.id
@ -156,7 +156,7 @@
@connection.event.off 'read' this.on-read
@connection.close!
document.remove-event-listener 'visibilitychange' this.on-visibilitychange
document.removeEventListener 'visibilitychange' this.on-visibilitychange
this.on('update', () => {
@messages.for-each (message) =>
@ -165,7 +165,7 @@
message._date = date
message._datetext = month + '月 ' + date + '日'
on-message(message) {
this.on-message = (message) => {
is-bottom = @is-bottom!
@messages.push message
@ -182,7 +182,7 @@
// Notify
@notify '新しいメッセージがあります'
on-read(ids) {
this.on-read = (ids) => {
if not Array.isArray ids then ids = [ids]
ids.for-each (id) =>
if (@messages.some (x) => x.id == id)
@ -190,15 +190,15 @@
@messages[exist].is_read = true
this.update();
is-bottom() {
this.is-bottom = () => {
current = this.root.scroll-top + this.root.offset-height
max = this.root.scroll-height
current > (max - 32)
scroll-to-bottom() {
this.scroll-to-bottom = () => {
this.root.scroll-top = this.root.scroll-height
notify(message) {
this.notify = (message) => {
n = document.createElement 'p'
n.inner-HTML = '<i class="fa fa-arrow-circle-down"></i>' + message
n.onclick = =>
@ -213,7 +213,7 @@
, 1000ms
, 4000ms
on-visibilitychange() {
this.on-visibilitychange = () => {
if document.hidden then return
@messages.for-each (message) =>
if message.user_id != this.I.id and not message.is_read

View file

@ -88,26 +88,26 @@
<script>
this.choices = ['', ''];
oninput(i, e) {
this.oninput = (i, e) => {
this.choices[i] = e.target.value;
}
add() {
this.add = () => {
this.choices.push('');
this.update();
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.update();
}
destroy() {
this.destroy = () => {
this.opts.ondestroy();
}
get() {
this.get = () => {
return {
choices: this.choices.filter(choice => choice != '')
}

View file

@ -76,11 +76,11 @@
this.isVoted = this.poll.choices.some(c => c.is_voted);
this.result = this.isVoted;
toggleResult() {
this.toggleResult = () => {
this.result = !this.result;
}
vote(id) {
this.vote = (id) => {
if (this.poll.choices.some(c => c.is_voted)) return;
this.api('posts/polls/vote', {
post_id: this.post.id,

View file

@ -68,7 +68,7 @@
this.on('unmount', () => {
@stream.off 'signin' this.on-signin
on-signin(signin) {
this.on-signin = (signin) => {
@history.unshift signin
this.update();
</script>

View file

@ -102,7 +102,7 @@
this.user = null;
this.signing = false;
oninput() {
this.oninput = () => {
this.api 'users/show' do
username: this.refs.username.value
.then (user) =>
@ -110,7 +110,7 @@
this.trigger 'user' user
this.update();
onsubmit(e) {
this.onsubmit = (e) => {
e.preventDefault();
if this.refs.username.value == ''

View file

@ -199,7 +199,7 @@
head.appendChild script
});
on-change-username() {
this.on-change-username = () => {
username = this.refs.username.value
if username == ''
@ -232,7 +232,7 @@
this.username-state = 'error'
this.update();
on-change-password() {
this.on-change-password = () => {
password = this.refs.password.value
if password == ''
@ -252,7 +252,7 @@
this.refs.password-metar.style.width = (strength * 100) + '%'
on-change-password-retype() {
this.on-change-password-retype = () => {
password = this.refs.password.value
retyped-password = this.refs.password-retype.value
@ -265,7 +265,7 @@
else
this.password-retype-state = 'not-match'
onsubmit(e) {
this.onsubmit = (e) => {
e.preventDefault();
username = this.refs.username.value

View file

@ -22,7 +22,7 @@
if @mode == 'relative' or @mode == 'detail'
clear-interval @tickid
tick() {
this.tick = () => {
now = new Date!
ago = (now - @time) / 1000ms
this.relative = switch

View file

@ -145,7 +145,7 @@
this.uploads = []
upload(file, folder) {
this.upload = (file, folder) => {
id = Math.random!
ctx =

View file

@ -16,7 +16,7 @@
this.on('unmount', () => {
clear-interval @clock
draw() {
this.draw = () => {
now = new Date!
s = now.get-seconds!
m = now.get-minutes!

View file

@ -89,11 +89,11 @@
this.select = -1
this.on('mount', () => {
@textarea.add-event-listener 'keydown' this.on-keydown
@textarea.addEventListener 'keydown' this.on-keydown
all = document.query-selector-all 'body *'
Array.prototype.for-each.call all, (el) =>
el.add-event-listener 'mousedown' @mousedown
el.addEventListener 'mousedown' @mousedown
this.api 'users/search_by_username' do
query: @q
@ -106,20 +106,20 @@
console.error err
this.on('unmount', () => {
@textarea.remove-event-listener 'keydown' this.on-keydown
@textarea.removeEventListener 'keydown' this.on-keydown
all = document.query-selector-all 'body *'
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)
@close!
on-click(e) {
this.on-click = (e) => {
@complete e.item
on-keydown(e) {
this.on-keydown = (e) => {
key = e.which
switch (key)
| 10, 13 => // Key[ENTER]
@ -147,7 +147,7 @@
| _ =>
@close!
select-next() {
this.select-next = () => {
@select++
if @select >= @users.length
@ -155,7 +155,7 @@
@apply-select!
select-prev() {
this.select-prev = () => {
@select--
if @select < 0
@ -163,17 +163,17 @@
@apply-select!
apply-select() {
this.apply-select = () => {
this.refs.users.children.for-each (el) =>
el.remove-attribute 'data-selected'
this.refs.users.children[@select].setAttribute 'data-selected' \true
this.refs.users.children[@select].focus();
complete(user) {
this.complete = (user) => {
this.opts.complete user
close() {
this.close = () => {
this.opts.close!
function contains(parent, child)

View file

@ -91,17 +91,17 @@
@stream.off 'follow' this.on-stream-follow
@stream.off 'unfollow' this.on-stream-unfollow
on-stream-follow(user) {
this.on-stream-follow = (user) => {
if user.id == @user.id
this.user = user
this.update();
on-stream-unfollow(user) {
this.on-stream-unfollow = (user) => {
if user.id == @user.id
this.user = user
this.update();
onclick() {
this.onclick = () => {
this.wait = true
if @user.is_following
this.api 'following/delete' do

View file

@ -94,19 +94,19 @@
</style>
<script>
this.root.add-event-listener 'contextmenu' (e) =>
this.root.addEventListener 'contextmenu' (e) =>
e.preventDefault();
mousedown(e) {
this.mousedown = (e) => {
e.preventDefault();
if (!contains this.root, e.target) and (this.root != e.target)
@close!
return false
open(pos) {
this.open = (pos) => {
all = document.query-selector-all 'body *'
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.left = pos.x + 'px'
this.root.style.top = pos.y + 'px'
@ -121,10 +121,10 @@
easing: 'linear'
}
close() {
this.close = () => {
all = document.query-selector-all 'body *'
Array.prototype.for-each.call all, (el) =>
el.remove-event-listener 'mousedown' @mousedown
el.removeEventListener 'mousedown' @mousedown
this.trigger('closed');
this.unmount();

View file

@ -172,16 +172,16 @@
highlight: no
view-mode: 1
ok() {
this.ok = () => {
@cropper.get-cropped-canvas!.to-blob (blob) =>
this.trigger 'cropped' blob
this.refs.window.close!
skip() {
this.skip = () => {
this.trigger('skiped');
this.refs.window.close!
cancel() {
this.cancel = () => {
this.trigger('canceled');
this.refs.window.close!
</script>

View file

@ -114,7 +114,7 @@
easing: [ 0, 0.5, 0.5, 1 ]
}
close() {
this.close = () => {
this.refs.bg.style.pointer-events = 'none'
Velocity this.refs.bg, 'finish' true
Velocity this.refs.bg, {
@ -138,7 +138,7 @@
this.unmount();
}
bg-click() {
this.bg-click = () => {
if @can-through
if this.opts.on-through?
this.opts.on-through!

View file

@ -50,7 +50,7 @@
this.mixin('api');
this.mixin('i');
close(e) {
this.close = (e) => {
e.preventDefault();
e.stopPropagation();

View file

@ -20,18 +20,18 @@
this.trigger('closed');
this.unmount();
open(pos) {
this.open = (pos) => {
this.refs.ctx.open pos
create-folder() {
this.create-folder = () => {
this.browser.create-folder!
this.refs.ctx.close!
upload() {
this.upload = () => {
this.browser.select-local-file!
this.refs.ctx.close!
url-upload() {
this.url-upload = () => {
this.browser.url-upload!
this.refs.ctx.close!
</script>

View file

@ -40,7 +40,7 @@
@update do
usage: info.usage / info.capacity * 100
close() {
this.close = () => {
this.refs.window.close!
</script>
</mk-drive-browser-window>

View file

@ -289,27 +289,27 @@
@stream.off 'drive_folder_created' this.on-stream-drive-folder-created
@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
on-stream-drive-file-updated(file) {
this.on-stream-drive-file-updated = (file) => {
current = if this.folder? then this.folder.id else null
if current != file.folder_id
@remove-file file
else
@add-file file, true
on-stream-drive-folder-created(folder) {
this.on-stream-drive-folder-created = (folder) => {
@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
if current != folder.parent_id
@remove-folder folder
else
@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)
return true
@ -341,20 +341,20 @@
this.refs.selection.style.top = cursor-y + 'px'
up = (e) =>
document.document-element.remove-event-listener 'mousemove' move
document.document-element.remove-event-listener 'mouseup' up
document.document-element.removeEventListener 'mousemove' move
document.document-element.removeEventListener 'mouseup' up
this.refs.selection.style.display = 'none'
document.document-element.add-event-listener 'mousemove' move
document.document-element.add-event-listener 'mouseup' up
document.document-element.addEventListener 'mousemove' move
document.document-element.addEventListener 'mouseup' up
path-oncontextmenu(e) {
this.path-oncontextmenu = (e) => {
e.preventDefault();
e.stop-immediate-propagation!
return false
ondragover(e) {
this.ondragover = (e) => {
e.preventDefault();
e.stopPropagation();
@ -371,15 +371,15 @@
e.dataTransfer.dropEffect = 'none'
return false
ondragenter(e) {
this.ondragenter = (e) => {
e.preventDefault();
if !@is-drag-source
this.draghover = true
ondragleave(e) {
this.ondragleave = (e) => {
this.draghover = false
ondrop(e) {
this.ondrop = (e) => {
e.preventDefault();
e.stopPropagation();
@ -438,7 +438,7 @@
return false
oncontextmenu(e) {
this.oncontextmenu = (e) => {
e.preventDefault();
e.stop-immediate-propagation!
@ -452,10 +452,10 @@
return false
select-local-file() {
this.select-local-file = () => {
this.refs.file-input.click!
url-upload() {
this.url-upload = () => {
url <~ @input-dialog do
'URLアップロード'
'アップロードしたいファイルのURL'
@ -473,7 +473,7 @@
text: 'OK'
]
create-folder() {
this.create-folder = () => {
name <~ @input-dialog do
'フォルダー作成'
'フォルダー名'
@ -488,26 +488,26 @@
.catch (err) =>
console.error err
change-file-input() {
this.change-file-input = () => {
files = this.refs.file-input.files
for i from 0 to files.length - 1
file = files.item i
@upload file, this.folder
upload(file, folder) {
this.upload = (file, folder) => {
if folder? and typeof folder == 'object'
folder = folder.id
this.refs.uploader.upload file, folder
get-selection() {
this.get-selection = () => {
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'
riot.mount browser, do
folder: folder-id
move(target-folder) {
this.move = (target-folder) => {
if target-folder? and typeof target-folder == 'object'
target-folder = target-folder.id
@ -537,7 +537,7 @@
.catch (err, text-status) ->
console.error err
add-folder(folder, unshift = false) {
this.add-folder = (folder, unshift = false) => {
current = if this.folder? then this.folder.id else null
if current != folder.parent_id
return
@ -555,7 +555,7 @@
this.update();
add-file(file, unshift = false) {
this.add-file = (file, unshift = false) => {
current = if this.folder? then this.folder.id else null
if current != file.folder_id
return
@ -573,26 +573,26 @@
this.update();
remove-folder(folder) {
this.remove-folder = (folder) => {
if typeof folder == 'object'
folder = folder.id
this.folders = this.folders.filter (f) -> f.id != folder
this.update();
remove-file(file) {
this.remove-file = (file) => {
if typeof file == 'object'
file = file.id
this.files = this.files.filter (f) -> f.id != file
this.update();
go-root() {
this.go-root = () => {
if this.folder != null
this.folder = null
this.hierarchy-folders = []
this.update();
@load!
load() {
this.load = () => {
this.folders = []
this.files = []
this.more-folders = false

View file

@ -54,10 +54,10 @@
this.trigger('closed');
this.unmount();
open(pos) {
this.open = (pos) => {
this.refs.ctx.open pos
rename() {
this.rename = () => {
this.refs.ctx.close!
name <~ @input-dialog do
@ -73,25 +73,25 @@
.catch (err) =>
console.error err
copy-url() {
this.copy-url = () => {
@NotImplementedException!
download() {
this.download = () => {
this.refs.ctx.close!
set-avatar() {
this.set-avatar = () => {
this.refs.ctx.close!
@update-avatar this.I, null, this.file
set-banner() {
this.set-banner = () => {
this.refs.ctx.close!
@update-banner this.I, null, this.file
set-wallpaper() {
this.set-wallpaper = () => {
this.refs.ctx.close!
@update-wallpaper this.I, null, this.file
add-app() {
this.add-app = () => {
@NotImplementedException!
</script>
</mk-drive-browser-file-contextmenu>

View file

@ -155,7 +155,7 @@
this.is-contextmenu-showing = false
onclick() {
this.onclick = () => {
if this.browser.multiple
if this.file._selected?
this.file._selected = !this.file._selected
@ -171,7 +171,7 @@
this.file._selected = true
this.browser.trigger 'change-selection' this.file
oncontextmenu(e) {
this.oncontextmenu = (e) => {
e.preventDefault();
e.stop-immediate-propagation!
@ -190,7 +190,7 @@
this.update();
return false
ondragstart(e) {
this.ondragstart = (e) => {
e.dataTransfer.effect-allowed = 'move'
e.dataTransfer.set-data 'text' JSON.stringify do
type: 'file'
@ -202,7 +202,7 @@
// (=あなたの子供が、ドラッグを開始しましたよ)
this.browser.is-drag-source = true
ondragend(e) {
this.ondragend = (e) => {
this.is-dragging = false
this.browser.is-drag-source = false
</script>

View file

@ -24,30 +24,30 @@
this.browser = this.opts.browser
this.folder = this.opts.folder
open(pos) {
this.open = (pos) => {
this.refs.ctx.open pos
this.refs.ctx.on('closed', () => {
this.trigger('closed');
this.unmount();
move() {
this.move = () => {
this.browser.move this.folder.id
this.refs.ctx.close!
new-window() {
this.new-window = () => {
this.browser.new-window this.folder.id
this.refs.ctx.close!
create-folder() {
this.create-folder = () => {
this.browser.create-folder!
this.refs.ctx.close!
upload() {
this.upload = () => {
this.browser.select-lcoal-file!
this.refs.ctx.close!
rename() {
this.rename = () => {
this.refs.ctx.close!
name <~ @input-dialog do

View file

@ -61,16 +61,16 @@
this.draghover = false
this.is-contextmenu-showing = false
onclick() {
this.onclick = () => {
this.browser.move this.folder
onmouseover() {
this.onmouseover = () => {
this.hover = true
onmouseout() {
this.onmouseout = () => {
this.hover = false
ondragover(e) {
this.ondragover = (e) => {
e.preventDefault();
e.stopPropagation();
@ -86,14 +86,14 @@
e.dataTransfer.dropEffect = 'none'
return false
ondragenter() {
this.ondragenter = () => {
if !@is-dragging
this.draghover = true
ondragleave() {
this.ondragleave = () => {
this.draghover = false
ondrop(e) {
this.ondrop = (e) => {
e.stopPropagation();
this.draghover = false
@ -146,7 +146,7 @@
return false
ondragstart(e) {
this.ondragstart = (e) => {
e.dataTransfer.effect-allowed = 'move'
e.dataTransfer.set-data 'text' JSON.stringify do
type: 'folder'
@ -157,11 +157,11 @@
// (=あなたの子供が、ドラッグを開始しましたよ)
this.browser.is-drag-source = true
ondragend(e) {
this.ondragend = (e) => {
this.is-dragging = false
this.browser.is-drag-source = false
oncontextmenu(e) {
this.oncontextmenu = (e) => {
e.preventDefault();
e.stop-immediate-propagation!

View file

@ -16,16 +16,16 @@
this.hover = false
onclick() {
this.onclick = () => {
this.browser.move this.folder
onmouseover() {
this.onmouseover = () => {
this.hover = true
onmouseout() {
this.onmouseout = () => {
this.hover = false
ondragover(e) {
this.ondragover = (e) => {
e.preventDefault();
e.stopPropagation();
@ -39,15 +39,15 @@
e.dataTransfer.dropEffect = 'move'
return false
ondragenter() {
this.ondragenter = () => {
if this.folder != null or this.browser.folder != null
this.draghover = true
ondragleave() {
this.ondragleave = () => {
if this.folder != null or this.browser.folder != null
this.draghover = false
ondrop(e) {
this.ondrop = (e) => {
e.stopPropagation();
this.draghover = false

View file

@ -88,17 +88,17 @@
@stream.off 'follow' this.on-stream-follow
@stream.off 'unfollow' this.on-stream-unfollow
on-stream-follow(user) {
this.on-stream-follow = (user) => {
if user.id == @user.id
this.user = user
this.update();
on-stream-unfollow(user) {
this.on-stream-unfollow = (user) => {
if user.id == @user.id
this.user = user
this.update();
onclick() {
this.onclick = () => {
this.wait = true
if @user.is_following
this.api 'following/delete' do

View file

@ -135,7 +135,7 @@
this.on('mount', () => {
@load!
load() {
this.load = () => {
this.loading = true
this.users = null
this.update();
@ -150,14 +150,14 @@
.catch (err, text-status) ->
console.error err
refresh() {
this.refresh = () => {
if @users.length < @limit
this.page = 0
else
@page++
@load!
close() {
this.close = () => {
this.unmount();
</script>
</mk-following-setuper>

View file

@ -1,11 +1,11 @@
<mk-go-top>
<button class="hidden" title="一番上へ"><i class="fa fa-angle-up"></i></button>
<script>
window.add-event-listener 'load' this.on-scroll
window.add-event-listener 'scroll' this.on-scroll
window.add-event-listener 'resize' this.on-scroll
window.addEventListener 'load' this.on-scroll
window.addEventListener 'scroll' this.on-scroll
window.addEventListener 'resize' this.on-scroll
on-scroll() {
this.on-scroll = () => {
if $ window .scroll-top! > 500px
@remove-class 'hidden'
else

View file

@ -106,7 +106,7 @@
</style>
<script>
draw() {
this.draw = () => {
now = new Date!
nd = now.get-date!
nm = now.get-month!

View file

@ -55,23 +55,23 @@
this.mode = 'all'
this.on('mount', () => {
document.add-event-listener 'keydown' this.on-document-keydown
window.add-event-listener 'scroll' this.on-scroll
document.addEventListener 'keydown' this.on-document-keydown
window.addEventListener 'scroll' this.on-scroll
@fetch =>
this.trigger('loaded');
this.on('unmount', () => {
document.remove-event-listener 'keydown' this.on-document-keydown
window.remove-event-listener 'scroll' this.on-scroll
document.removeEventListener 'keydown' this.on-document-keydown
window.removeEventListener 'scroll' this.on-scroll
on-document-keydown(e) {
this.on-document-keydown = (e) => {
tag = e.target.tag-name.to-lower-case!
if tag != 'input' and tag != 'textarea'
if e.which == 84 // t
this.refs.timeline.focus();
fetch(cb) {
this.fetch = (cb) => {
this.api 'posts/mentions' do
following: @mode == 'following'
.then (posts) =>
@ -84,7 +84,7 @@
console.error err
if cb? then cb!
more() {
this.more = () => {
if @more-loading or @is-loading or this.refs.timeline.posts.length == 0
return
this.more-loading = true
@ -99,12 +99,12 @@
.catch (err) =>
console.error err
on-scroll() {
this.on-scroll = () => {
current = window.scroll-y + window.inner-height
if current > document.body.offset-height - 8
@more!
set-mode(mode) {
this.set-mode = (mode) => {
@update do
mode: mode
@fetch!

View file

@ -43,7 +43,7 @@
</style>
<script>
settings() {
this.settings = () => {
w = riot.mount document.body.appendChild document.createElement 'mk-settings-window' .0
w.switch 'notification'
</script>

View file

@ -77,7 +77,7 @@
this.on('unmount', () => {
@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
@images.unshift file
if @images.length > 9

View file

@ -46,10 +46,10 @@
this.mixin('update-avatar');
this.mixin('update-banner');
set-avatar() {
this.set-avatar = () => {
@update-avatar this.I
set-banner() {
this.set-banner = () => {
@update-banner this.I
</script>
</mk-profile-home-widget>

View file

@ -78,7 +78,7 @@
this.on('unmount', () => {
clear-interval @clock
fetch() {
this.fetch = () => {
this.api CONFIG.url + '/api:rss' do
url: @url
.then (feed) =>
@ -88,7 +88,7 @@
.catch (err) ->
console.error err
settings() {
this.settings = () => {
@NotImplementedException!
</script>
</mk-rss-reader-home-widget>

View file

@ -46,8 +46,8 @@
@stream.on 'follow' this.on-stream-follow
@stream.on 'unfollow' this.on-stream-unfollow
document.add-event-listener 'keydown' this.on-document-keydown
window.add-event-listener 'scroll' this.on-scroll
document.addEventListener 'keydown' this.on-document-keydown
window.addEventListener 'scroll' this.on-scroll
@load =>
this.trigger('loaded');
@ -57,16 +57,16 @@
@stream.off 'follow' this.on-stream-follow
@stream.off 'unfollow' this.on-stream-unfollow
document.remove-event-listener 'keydown' this.on-document-keydown
window.remove-event-listener 'scroll' this.on-scroll
document.removeEventListener 'keydown' this.on-document-keydown
window.removeEventListener 'scroll' this.on-scroll
on-document-keydown(e) {
this.on-document-keydown = (e) => {
tag = e.target.tag-name.to-lower-case!
if tag != 'input' and tag != 'textarea'
if e.which == 84 // t
this.refs.timeline.focus();
load(cb) {
this.load = (cb) => {
this.api 'posts/timeline'
.then (posts) =>
this.is-loading = false
@ -78,7 +78,7 @@
console.error err
if cb? then cb!
more() {
this.more = () => {
if @more-loading or @is-loading or this.refs.timeline.posts.length == 0
return
this.more-loading = true
@ -92,18 +92,18 @@
.catch (err) =>
console.error err
on-stream-post(post) {
this.on-stream-post = (post) => {
this.is-empty = false
this.update();
this.refs.timeline.add-post post
on-stream-follow() {
this.on-stream-follow = () => {
@load!
on-stream-unfollow() {
this.on-stream-unfollow = () => {
@load!
on-scroll() {
this.on-scroll = () => {
current = window.scroll-y + window.inner-height
if current > document.body.offset-height - 8
@more!

View file

@ -48,11 +48,11 @@
this.on('unmount', () => {
clear-interval @clock
set() {
this.set = () => {
this.refs.text.innerHTML = @tips[Math.floor Math.random! * @tips.length]
this.update();
change() {
this.change = () => {
Velocity this.refs.tip, {
opacity: 0
} {

View file

@ -128,7 +128,7 @@
this.on('unmount', () => {
clear-interval @clock
fetch(quiet = false) {
this.fetch = (quiet = false) => {
this.loading = true
this.users = null
if not quiet then this.update();
@ -142,7 +142,7 @@
.catch (err, text-status) ->
console.error err
refresh() {
this.refresh = () => {
if @users.length < @limit
this.page = 0
else

View file

@ -53,7 +53,7 @@
// easing: 'ease-out'
#}
close() {
this.close = () => {
Velocity this.root, {
opacity: 0
} {

View file

@ -29,7 +29,7 @@
this.images = this.opts.images
this.image = @images.0
mousemove(e) {
this.mousemove = (e) => {
rect = this.refs.view.get-bounding-client-rect!
mouse-x = e.client-x - rect.left
mouse-y = e.client-y - rect.top
@ -37,7 +37,7 @@
yp = mouse-y / this.refs.view.offset-height * 100
this.refs.view.style.background-position = xp + '% ' + yp + '%'
click() {
this.click = () => {
dialog = document.body.appendChild document.createElement 'mk-image-dialog'
riot.mount dialog, do
image: @image

View file

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

View file

@ -199,7 +199,7 @@
this.on('unmount', () => {
@stream.off 'notification' this.on-notification
on-notification(notification) {
this.on-notification = (notification) => {
@notifications.unshift notification
this.update();

View file

@ -65,15 +65,15 @@
<script>
this.mode = 'signin'
signup() {
this.signup = () => {
this.mode = 'signup'
this.update();
signin() {
this.signin = () => {
this.mode = 'signin'
this.update();
introduction() {
this.introduction = () => {
this.mode = 'introduction'
this.update();
</script>

View file

@ -124,7 +124,7 @@
@update do
user: user
introduction() {
this.introduction = () => {
this.parent.introduction!
</script>
</mk-entrance-signin>

View file

@ -28,18 +28,18 @@
document.title = 'Misskey'
this.Progress.start();
@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', () => {
@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
@unread-count++
document.title = '(' + @unread-count + ') ' + @get-post-summary post
window-on-visibilitychange() {
this.window-on-visibilitychange = () => {
if !document.hidden
this.unread-count = 0
document.title = 'Misskey'

View file

@ -123,7 +123,7 @@
if e.tag-name == 'MK-URL'
riot.mount e
like() {
this.like = () => {
if @post.is_liked
this.api 'posts/likes/delete' do
post_id: @post.id

View file

@ -398,17 +398,17 @@
this.update();
reply() {
this.reply = () => {
form = document.body.appendChild document.createElement 'mk-post-form-window'
riot.mount form, do
reply: @p
repost() {
this.repost = () => {
form = document.body.appendChild document.createElement 'mk-repost-form-window'
riot.mount form, do
post: @p
like() {
this.like = () => {
if @p.is_liked
this.api 'posts/likes/delete' do
post_id: @p.id
@ -422,7 +422,7 @@
@p.is_liked = true
this.update();
load-context() {
this.load-context = () => {
this.loading-context = true
// Get context

View file

@ -335,16 +335,16 @@
this.on('unmount', () => {
@autocomplete.detach!
focus() {
this.focus = () => {
this.refs.text.focus();
clear() {
this.clear = () => {
this.refs.text.value = ''
this.files = []
this.trigger('change-files');
this.update();
ondragover(e) {
this.ondragover = (e) => {
e.stopPropagation();
this.draghover = true
// ドラッグされてきたものがファイルだったら
@ -354,13 +354,13 @@
e.dataTransfer.dropEffect = 'move'
return false
ondragenter(e) {
this.ondragenter = (e) => {
this.draghover = true
ondragleave(e) {
this.ondragleave = (e) => {
this.draghover = false
ondrop(e) {
this.ondrop = (e) => {
e.preventDefault();
e.stopPropagation();
this.draghover = false
@ -388,11 +388,11 @@
return false
onkeydown(e) {
this.onkeydown = (e) => {
if (e.which == 10 || e.which == 13) && (e.ctrlKey || e.meta-key)
@post!
onpaste(e) {
this.onpaste = (e) => {
data = e.clipboardData
items = data.items
for i from 0 to items.length - 1
@ -401,26 +401,26 @@
| 'file' =>
@upload item.getAsFile();
select-file() {
this.select-file = () => {
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'
i = riot.mount browser, do
multiple: true
i[0].one 'selected' (files) =>
files.for-each @add-file
change-file() {
this.change-file = () => {
files = this.refs.file.files
for i from 0 to files.length - 1
file = files.item i
@upload file
upload(file) {
this.upload = (file) => {
this.refs.uploader.upload file
add-file(file) {
this.add-file = (file) => {
file._remove = =>
this.files = this.files.filter (x) -> x.id != file.id
this.trigger 'change-files' this.files
@ -430,14 +430,14 @@
this.trigger 'change-files' this.files
this.update();
add-poll() {
this.add-poll = () => {
this.poll = true
on-poll-destroyed() {
this.on-poll-destroyed = () => {
@update do
poll: false
post(e) {
this.post = (e) => {
this.wait = true
files = if this.files? and this.files.length > 0
@ -459,7 +459,7 @@
this.wait = false
this.update();
cat() {
this.cat = () => {
this.refs.text.value = this.refs.text.value + get-cat!
</script>
</mk-post-form>

View file

@ -83,12 +83,12 @@
this.refs.window.on('closed', () => {
this.unmount();
update-progress(value, max) {
this.update-progress = (value, max) => {
this.value = parse-int value, 10
this.max = parse-int max, 10
this.update();
close() {
this.close = () => {
this.refs.window.close!
</script>
</mk-progress-dialog>

View file

@ -12,7 +12,7 @@
</style>
<script>
on-document-keydown(e) {
this.on-document-keydown = (e) => {
tag = e.target.tag-name.to-lower-case!
if tag != 'input' and tag != 'textarea'
if e.which == 27 // Esc
@ -25,12 +25,12 @@
this.refs.window.refs.form.on('posted', () => {
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.unmount();
this.on('unmount', () => {
document.remove-event-listener 'keydown' this.on-document-keydown
document.removeEventListener 'keydown' this.on-document-keydown
</script>
</mk-repost-form-window>

View file

@ -120,10 +120,10 @@
this.wait = false
this.quote = false
cancel() {
this.cancel = () => {
this.trigger('cancel');
ok() {
this.ok = () => {
this.wait = true
this.api 'posts/create' do
repost_id: this.opts.post.id
@ -138,7 +138,7 @@
this.wait = false
this.update();
onquote() {
this.onquote = () => {
this.quote = true
</script>
</mk-repost-form>

View file

@ -38,8 +38,8 @@
this.page = 0
this.on('mount', () => {
document.add-event-listener 'keydown' this.on-document-keydown
window.add-event-listener 'scroll' this.on-scroll
document.addEventListener 'keydown' this.on-document-keydown
window.addEventListener 'scroll' this.on-scroll
this.api 'posts/search' do
query: @query
@ -53,16 +53,16 @@
console.error err
this.on('unmount', () => {
document.remove-event-listener 'keydown' this.on-document-keydown
window.remove-event-listener 'scroll' this.on-scroll
document.removeEventListener 'keydown' this.on-document-keydown
window.removeEventListener 'scroll' this.on-scroll
on-document-keydown(e) {
this.on-document-keydown = (e) => {
tag = e.target.tag-name.to-lower-case!
if tag != 'input' and tag != 'textarea'
if e.which == 84 // t
this.refs.timeline.focus();
more() {
this.more = () => {
if @more-loading or @is-loading or @timeline.posts.length == 0
return
this.more-loading = true
@ -78,7 +78,7 @@
.catch (err) =>
console.error err
on-scroll() {
this.on-scroll = () => {
current = window.scroll-y + window.inner-height
if current > document.body.offset-height - 16 // 遊び
@more!

View file

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

View file

@ -34,10 +34,10 @@
this.mixin('i');
this.mixin('update-avatar');
set() {
this.set = () => {
@update-avatar this.I
close(e) {
this.close = (e) => {
e.preventDefault();
e.stopPropagation();
this.unmount();

View file

@ -34,10 +34,10 @@
this.mixin('i');
this.mixin('update-banner');
set() {
this.set = () => {
@update-banner this.I
close(e) {
this.close = (e) => {
e.preventDefault();
e.stopPropagation();
this.unmount();

View file

@ -19,7 +19,7 @@
this.refs.window.on('closed', () => {
this.unmount();
close() {
this.close = () => {
this.refs.window.close!
</script>
</mk-settings-window>

View file

@ -205,13 +205,13 @@
this.page = 'account'
set-page(page) {
this.set-page = (page) => {
this.page = page
avatar() {
this.avatar = () => {
@update-avatar this.I
update-account() {
this.update-account = () => {
this.api 'i/update' do
name: this.refs.account-name.value
location: this.refs.account-location.value
@ -222,19 +222,19 @@
.catch (err) =>
console.error err
update-cache() {
this.update-cache = () => {
this.I.data.cache = !this.I.data.cache
this.api 'i/appdata/set' do
data: JSON.stringify do
cache: this.I.data.cache
update-debug() {
this.update-debug = () => {
this.I.data.debug = !this.I.data.debug
this.api 'i/appdata/set' do
data: JSON.stringify do
debug: this.I.data.debug
update-nya() {
this.update-nya = () => {
this.I.data.nya = !this.I.data.nya
this.api 'i/appdata/set' do
data: JSON.stringify do

View file

@ -349,17 +349,17 @@
riot.mount @preview, do
url: t.content
reply() {
this.reply = () => {
form = document.body.appendChild document.createElement 'mk-post-form-window'
riot.mount form, do
reply: @p
repost() {
this.repost = () => {
form = document.body.appendChild document.createElement 'mk-repost-form-window'
riot.mount form, do
post: @p
like() {
this.like = () => {
if @p.is_liked
this.api 'posts/likes/delete' do
post_id: @p.id
@ -373,11 +373,11 @@
@p.is_liked = true
this.update();
toggle-detail() {
this.toggle-detail = () => {
this.is-detail-opened = !@is-detail-opened
this.update();
on-key-down(e) {
this.on-key-down = (e) => {
should-be-cancel = true
switch
| e.which == 38 or e.which == 74 or (e.which == 9 and e.shift-key) => // ↑, j or Shift+Tab

View file

@ -46,24 +46,24 @@
<script>
this.posts = []
set-posts(posts) {
this.set-posts = (posts) => {
this.posts = posts
this.update();
prepend-posts(posts) {
this.prepend-posts = (posts) => {
posts.for-each (post) =>
@posts.push post
this.update();
add-post(post) {
this.add-post = (post) => {
@posts.unshift post
this.update();
clear() {
this.clear = () => {
this.posts = []
this.update();
focus() {
this.focus = () => {
this.root.children.0.focus();
this.on('update', () => {
@ -73,7 +73,7 @@
post._date = date
post._datetext = month + '月 ' + date + '日'
tail() {
this.tail = () => {
@posts[@posts.length - 1]
</script>
</mk-timeline>

View file

@ -167,37 +167,37 @@
this.on('before-unmount', () => {
@close!
toggle() {
this.toggle = () => {
if @is-open
@close!
else
@open!
open() {
this.open = () => {
this.is-open = true
this.update();
all = document.query-selector-all 'body *'
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.update();
all = document.query-selector-all 'body *'
Array.prototype.for-each.call all, (el) =>
el.remove-event-listener 'mousedown' @mousedown
el.removeEventListener 'mousedown' @mousedown
mousedown(e) {
this.mousedown = (e) => {
e.preventDefault();
if (!contains this.root, e.target) and (this.root != e.target)
@close!
return false
drive() {
this.drive = () => {
@close!
riot.mount document.body.appendChild document.createElement 'mk-drive-browser-window'
settings() {
this.settings = () => {
@close!
riot.mount document.body.appendChild document.createElement 'mk-settings-window'

View file

@ -58,7 +58,7 @@
</style>
<script>
draw() {
this.draw = () => {
now = new Date!
yyyy = now.get-full-year!

View file

@ -98,15 +98,15 @@
@stream.off 'read_all_messaging_messages' this.on-read-all-messaging-messages
@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.update();
on-unread-messaging-message() {
this.on-unread-messaging-message = () => {
this.has-unread-messaging-messages = true
this.update();
messaging() {
this.messaging = () => {
riot.mount document.body.appendChild document.createElement 'mk-messaging-window'
</script>
</ul>

View file

@ -77,27 +77,27 @@
<script>
this.is-open = false
toggle() {
this.toggle = () => {
if @is-open
@close!
else
@open!
open() {
this.open = () => {
this.is-open = true
this.update();
all = document.query-selector-all 'body *'
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.update();
all = document.query-selector-all 'body *'
Array.prototype.for-each.call all, (el) =>
el.remove-event-listener 'mousedown' @mousedown
el.removeEventListener 'mousedown' @mousedown
mousedown(e) {
this.mousedown = (e) => {
e.preventDefault();
if (!contains this.root, e.target) and (this.root != e.target)
@close!

View file

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

View file

@ -34,7 +34,7 @@
<script>
this.mixin('page');
onsubmit(e) {
this.onsubmit = (e) => {
e.preventDefault();
@page '/search:' + this.refs.q.value
</script>

View file

@ -14,20 +14,20 @@
<script>
this.mixin('i');
open-post-form() {
this.open-post-form = () => {
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.on('mount', () => {
@set-root-layout!
document.add-event-listener 'keydown' this.onkeydown
document.addEventListener 'keydown' this.onkeydown
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!
if tag != 'input' and tag != 'textarea'
if e.which == 80 or e.which == 78 // p or n

View file

@ -11,7 +11,7 @@
this.user = this.opts.user
fetch(iknow, limit, cursor, cb) {
this.fetch = (iknow, limit, cursor, cb) => {
this.api 'users/followers' do
user_id: @user.id
iknow: iknow

View file

@ -11,7 +11,7 @@
this.user = this.opts.user
fetch(iknow, limit, cursor, cb) {
this.fetch = (iknow, limit, cursor, cb) => {
this.api 'users/following' do
user_id: @user.id
iknow: iknow

View file

@ -111,16 +111,16 @@
this.user = this.opts.user
this.on('mount', () => {
window.add-event-listener 'load' @scroll
window.add-event-listener 'scroll' @scroll
window.add-event-listener 'resize' @scroll
window.addEventListener 'load' @scroll
window.addEventListener 'scroll' @scroll
window.addEventListener 'resize' @scroll
this.on('unmount', () => {
window.remove-event-listener 'load' @scroll
window.remove-event-listener 'scroll' @scroll
window.remove-event-listener 'resize' @scroll
window.removeEventListener 'load' @scroll
window.removeEventListener 'scroll' @scroll
window.removeEventListener 'resize' @scroll
scroll() {
this.scroll = () => {
top = window.scroll-y
height = 280px
@ -131,7 +131,7 @@
if blur <= 10
this.refs.banner.style.filter = 'blur(' + blur + 'px)'
on-update-banner() {
this.on-update-banner = () => {
if not @SIGNIN or this.I.id != @user.id
return

View file

@ -130,7 +130,7 @@
easing: 'ease-out'
}
close() {
this.close = () => {
Velocity this.root, {
opacity: 0
'margin-top': '-8px'

View file

@ -86,12 +86,12 @@
this.user = this.opts.user
show-following() {
this.show-following = () => {
window = document.body.appendChild document.createElement 'mk-user-following-window'
riot.mount window, do
user: @user
show-followers() {
this.show-followers = () => {
window = document.body.appendChild document.createElement 'mk-user-followers-window'
riot.mount window, do
user: @user

View file

@ -59,9 +59,9 @@
this.mode = 'default'
this.on('mount', () => {
document.add-event-listener 'visibilitychange' @window-on-visibilitychange, false
document.add-event-listener 'keydown' this.on-document-keydown
window.add-event-listener 'scroll' this.on-scroll
document.addEventListener 'visibilitychange' @window-on-visibilitychange, false
document.addEventListener 'keydown' this.on-document-keydown
window.addEventListener 'scroll' this.on-scroll
@user-promise.then (user) =>
this.user = user
@ -71,17 +71,17 @@
this.trigger('loaded');
this.on('unmount', () => {
document.remove-event-listener 'visibilitychange' @window-on-visibilitychange
document.remove-event-listener 'keydown' this.on-document-keydown
window.remove-event-listener 'scroll' this.on-scroll
document.removeEventListener 'visibilitychange' @window-on-visibilitychange
document.removeEventListener 'keydown' this.on-document-keydown
window.removeEventListener 'scroll' this.on-scroll
on-document-keydown(e) {
this.on-document-keydown = (e) => {
tag = e.target.tag-name.to-lower-case!
if tag != 'input' and tag != 'textarea'
if e.which == 84 // t
this.refs.timeline.focus();
fetch(cb) {
this.fetch = (cb) => {
this.api 'users/posts' do
user_id: @user.id
with_replies: @mode == 'with-replies'
@ -95,7 +95,7 @@
console.error err
if cb? then cb!
more() {
this.more = () => {
if @more-loading or @is-loading or this.refs.timeline.posts.length == 0
return
this.more-loading = true
@ -111,7 +111,7 @@
.catch (err) =>
console.error err
on-stream-post(post) {
this.on-stream-post = (post) => {
this.is-empty = false
this.update();
this.refs.timeline.add-post post
@ -120,17 +120,17 @@
@unread-count++
document.title = '(' + @unread-count + ') ' + @get-post-summary post
window-on-visibilitychange() {
this.window-on-visibilitychange = () => {
if !document.hidden
this.unread-count = 0
document.title = 'Misskey'
on-scroll() {
this.on-scroll = () => {
current = window.scroll-y + window.inner-height
if current > document.body.offset-height - 16 // 遊び
@more!
set-mode(mode) {
this.set-mode = (mode) => {
@update do
mode: mode
@fetch!

View file

@ -100,7 +100,7 @@
@fetch =>
this.trigger('loaded');
fetch(cb) {
this.fetch = (cb) => {
this.fetching = true
this.update();
obj <~ this.opts.fetch do
@ -113,7 +113,7 @@
this.update();
if cb? then cb!
more() {
this.more = () => {
this.more-fetching = true
this.update();
obj <~ this.opts.fetch do
@ -125,7 +125,7 @@
this.more-fetching = false
this.update();
set-mode(mode) {
this.set-mode = (mode) => {
@update do
mode: mode

View file

@ -207,17 +207,17 @@
this.refs.main.style.top = '15%'
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();
window.add-event-listener 'resize' this.on-browser-resize
window.addEventListener 'resize' this.on-browser-resize
@open!
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!
browser-width = window.inner-width
browser-height = window.inner-height
@ -236,7 +236,7 @@
if position.top + window-height > browser-height
this.refs.main.style.top = browser-height - window-height + 'px'
open() {
this.open = () => {
this.trigger('opening');
@top!
@ -270,7 +270,7 @@
this.trigger('opened');
, 300ms
close() {
this.close = () => {
this.trigger('closing');
if @is-modal
@ -300,7 +300,7 @@
, 300ms
// 最前面へ移動します
top() {
this.top = () => {
z = 0
ws = document.query-selector-all 'mk-window'
@ -314,20 +314,20 @@
this.refs.main.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();
return true
bg-click() {
this.bg-click = () => {
if @can-close
@close!
on-body-mousedown(e) {
this.on-body-mousedown = (e) => {
@top!
true
// ヘッダー掴み時
on-header-mousedown(e) {
this.on-header-mousedown = (e) => {
e.preventDefault();
if not contains this.refs.main, document.active-element
@ -369,7 +369,7 @@
this.refs.main.style.top = move-top + 'px'
// 上ハンドル掴み時
on-top-handle-mousedown(e) {
this.on-top-handle-mousedown = (e) => {
e.preventDefault();
base = e.client-y
@ -391,7 +391,7 @@
@apply-transform-top 0
// 右ハンドル掴み時
on-right-handle-mousedown(e) {
this.on-right-handle-mousedown = (e) => {
e.preventDefault();
base = e.client-x
@ -411,7 +411,7 @@
@apply-transform-width browser-width - left
// 下ハンドル掴み時
on-bottom-handle-mousedown(e) {
this.on-bottom-handle-mousedown = (e) => {
e.preventDefault();
base = e.client-y
@ -431,7 +431,7 @@
@apply-transform-height browser-height - top
// 左ハンドル掴み時
on-left-handle-mousedown(e) {
this.on-left-handle-mousedown = (e) => {
e.preventDefault();
base = e.client-x
@ -453,55 +453,55 @@
@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-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-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-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-left-handle-mousedown e
// 高さを適用
apply-transform-height(height) {
this.apply-transform-height = (height) => {
this.refs.main.style.height = height + 'px'
// 幅を適用
apply-transform-width(width) {
this.apply-transform-width = (width) => {
this.refs.main.style.width = width + 'px'
// Y座標を適用
apply-transform-top(top) {
this.apply-transform-top = (top) => {
this.refs.main.style.top = top + 'px'
// X座標を適用
apply-transform-left(left) {
this.apply-transform-left = (left) => {
this.refs.main.style.left = left + 'px'
function drag-listen fn
window.add-event-listener 'mousemove' fn
window.add-event-listener 'mouseleave' drag-clear.bind null fn
window.add-event-listener 'mouseup' drag-clear.bind null fn
window.addEventListener 'mousemove' fn
window.addEventListener 'mouseleave' drag-clear.bind null fn
window.addEventListener 'mouseup' drag-clear.bind null fn
function drag-clear fn
window.remove-event-listener 'mousemove' fn
window.remove-event-listener 'mouseleave' drag-clear
window.remove-event-listener 'mouseup' drag-clear
window.removeEventListener 'mousemove' fn
window.removeEventListener 'mouseleave' drag-clear
window.removeEventListener 'mouseup' drag-clear
ondragover(e) {
this.ondragover = (e) => {
e.dataTransfer.dropEffect = 'none'
on-keydown(e) {
this.on-keydown = (e) => {
if e.which == 27 // Esc
if @can-close
e.preventDefault();

View file

@ -182,7 +182,7 @@
this.nid-state = null
on-change-nid() {
this.on-change-nid = () => {
nid = this.refs.nid.value
if nid == ''
@ -215,7 +215,7 @@
this.nid-state = 'error'
this.update();
onsubmit() {
this.onsubmit = () => {
name = this.refs.name.value
nid = this.refs.nid.value
description = this.refs.description.value

View file

@ -63,11 +63,11 @@
this.files = files
this.update();
cancel() {
this.cancel = () => {
this.trigger('canceled');
this.unmount();
ok() {
this.ok = () => {
this.trigger 'selected' this.files
this.unmount();
</script>

View file

@ -167,20 +167,20 @@
@stream.off 'drive_folder_created' this.on-stream-drive-folder-created
@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
on-stream-drive-file-updated(file) {
this.on-stream-drive-file-updated = (file) => {
current = if this.folder? then this.folder.id else null
if current != file.folder_id
@remove-file file
else
@add-file file, true
on-stream-drive-folder-created(folder) {
this.on-stream-drive-folder-created = (folder) => {
@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
if current != folder.parent_id
@remove-folder folder
@ -190,10 +190,10 @@
@_move = (ev) =>
@move ev.item.folder
move(target-folder) {
this.move = (target-folder) => {
@cd target-folder
cd(target-folder, silent = false) {
this.cd = (target-folder, silent = false) => {
this.file = null
if target-folder? and typeof target-folder == 'object'
@ -226,7 +226,7 @@
.catch (err, text-status) ->
console.error err
add-folder(folder, unshift = false) {
this.add-folder = (folder, unshift = false) => {
current = if this.folder? then this.folder.id else null
if current != folder.parent_id
return
@ -241,7 +241,7 @@
this.update();
add-file(file, unshift = false) {
this.add-file = (file, unshift = false) => {
current = if this.folder? then this.folder.id else null
if current != file.folder_id
return
@ -259,19 +259,19 @@
this.update();
remove-folder(folder) {
this.remove-folder = (folder) => {
if typeof folder == 'object'
folder = folder.id
this.folders = this.folders.filter (f) -> f.id != folder
this.update();
remove-file(file) {
this.remove-file = (file) => {
if typeof file == 'object'
file = file.id
this.files = this.files.filter (f) -> f.id != file
this.update();
go-root() {
this.go-root = () => {
if this.folder != null or this.file != null
this.file = null
this.folder = null
@ -280,7 +280,7 @@
this.trigger('move-root');
@load!
load() {
this.load = () => {
this.folders = []
this.files = []
this.more-folders = false
@ -337,11 +337,11 @@
flag := true
this.trigger('load-mid');
choose-file(file) {
this.choose-file = (file) => {
if @is-select-mode
exist = @selected-files.some (f) => f.id == file.id
if exist
selected-files(@selected-files.filter (f) { f.id != file.id)
this.selected-files = (@selected-files.filter (f) => { f.id != file.id)
else
@selected-files.push file
this.update();
@ -349,7 +349,7 @@
else
@cf file
cf(file, silent = false) {
this.cf = (file, silent = false) => {
if typeof file == 'object'
file = file.id

View file

@ -188,7 +188,7 @@
this.file = this.opts.file
this.kind = this.file.type.split '/' .0
rename() {
this.rename = () => {
name = window.prompt '名前を変更' this.file.name
if name? and name != '' and name != this.file.name
this.api 'drive/files/update' do

View file

@ -131,7 +131,7 @@
this.browser.on('change-selected', (selects) => {
this.is-selected = selects.some (f) => f.id == this.file.id
onclick() {
this.onclick = () => {
this.browser.choose-file this.file
</script>
</mk-drive-file>

View file

@ -40,7 +40,7 @@
this.browser = this.parent
this.folder = this.opts.folder
onclick() {
this.onclick = () => {
this.browser.move this.folder
</script>
</mk-drive-folder>

View file

@ -69,17 +69,17 @@
@stream.off 'follow' this.on-stream-follow
@stream.off 'unfollow' this.on-stream-unfollow
on-stream-follow(user) {
this.on-stream-follow = (user) => {
if user.id == @user.id
this.user = user
this.update();
on-stream-unfollow(user) {
this.on-stream-unfollow = (user) => {
if user.id == @user.id
this.user = user
this.update();
onclick() {
this.onclick = () => {
this.wait = true
if @user.is_following
this.api 'following/delete' do

View file

@ -25,19 +25,19 @@
@stream.off 'follow' this.on-stream-follow
@stream.off 'unfollow' this.on-stream-unfollow
more() {
this.more = () => {
this.api 'posts/timeline' do
max_id: this.refs.timeline.tail!.id
on-stream-post(post) {
this.on-stream-post = (post) => {
this.is-empty = false
this.update();
this.refs.timeline.add-post post
on-stream-follow() {
this.on-stream-follow = () => {
@fetch!
on-stream-unfollow() {
this.on-stream-unfollow = () => {
@fetch!
</script>
</mk-home-timeline>

View file

@ -21,7 +21,7 @@
this.images = this.opts.images
this.image = @images.0
click() {
this.click = () => {
window.open @image.url
</script>
</mk-images-viewer>

View file

@ -79,7 +79,7 @@
this.on('unmount', () => {
@stream.off 'notification' this.on-notification
on-notification(notification) {
this.on-notification = (notification) => {
@notifications.unshift notification
this.update();

View file

@ -45,15 +45,15 @@
<script>
this.mode = 'signin'
signup() {
this.signup = () => {
this.mode = 'signup'
this.update();
signin() {
this.signin = () => {
this.mode = 'signin'
this.update();
introduction() {
this.introduction = () => {
this.mode = 'introduction'
this.update();
</script>

View file

@ -23,21 +23,21 @@
this.Progress.start();
@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.Progress.done();
this.on('unmount', () => {
@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
@unread-count++
document.title = '(' + @unread-count + ') ' + @get-post-summary post
window-on-visibilitychange() {
this.window-on-visibilitychange = () => {
if !document.hidden
this.unread-count = 0
document.title = 'Misskey'

View file

@ -391,18 +391,18 @@
this.replies = replies
this.update();
reply() {
this.reply = () => {
@open-post-form do
reply: @p
repost() {
this.repost = () => {
text = window.prompt '「' + @summary + '」をRepost'
if text?
this.api 'posts/create' do
repost_id: @p.id
text: if text == '' then undefined else text
like() {
this.like = () => {
if @p.is_liked
this.api 'posts/likes/delete' do
post_id: @p.id
@ -416,7 +416,7 @@
@p.is_liked = true
this.update();
load-context() {
this.load-context = () => {
this.loading-context = true
// Get context

View file

@ -200,13 +200,13 @@
this.refs.text.focus();
onkeypress(e) {
this.onkeypress = (e) => {
if (e.char-code == 10 || e.char-code == 13) && e.ctrlKey
@post!
else
return true
onpaste(e) {
this.onpaste = (e) => {
data = e.clipboardData
items = data.items
for i from 0 to items.length - 1
@ -216,10 +216,10 @@
@upload item.getAsFile();
return true
select-file() {
this.select-file = () => {
this.refs.file.click!
select-file-from-drive() {
this.select-file-from-drive = () => {
browser = document.body.appendChild document.createElement 'mk-drive-selector'
browser = riot.mount browser, do
multiple: true
@ -227,16 +227,16 @@
browser.on('selected', (files) => {
files.for-each @add-file
change-file() {
this.change-file = () => {
files = this.refs.file.files
for i from 0 to files.length - 1
file = files.item i
@upload file
upload(file) {
this.upload = (file) => {
this.refs.uploader.upload file
add-file(file) {
this.add-file = (file) => {
file._remove = =>
this.files = this.files.filter (x) -> x.id != file.id
this.trigger 'change-files' this.files
@ -246,14 +246,14 @@
this.trigger 'change-files' this.files
this.update();
add-poll() {
this.add-poll = () => {
this.poll = true
on-poll-destroyed() {
this.on-poll-destroyed = () => {
@update do
poll: false
post() {
this.post = () => {
this.wait = true
files = if this.files? and this.files.length > 0
@ -274,11 +274,11 @@
this.wait = false
this.update();
cancel() {
this.cancel = () => {
this.trigger('cancel');
this.unmount();
cat() {
this.cat = () => {
this.refs.text.value = this.refs.text.value + get-cat!
</script>
</mk-post-form>

View file

@ -22,7 +22,7 @@
res posts
this.trigger('loaded');
more() {
this.more = () => {
@offset += @max
this.api 'posts/search' do
query: @query

View file

@ -319,18 +319,18 @@
riot.mount @preview, do
url: t.content
reply() {
this.reply = () => {
@open-post-form do
reply: @p
repost() {
this.repost = () => {
text = window.prompt '「' + @summary + '」をRepost'
if text?
this.api 'posts/create' do
repost_id: @p.id
text: if text == '' then undefined else text
like() {
this.like = () => {
if @p.is_liked
this.api 'posts/likes/delete' do
post_id: @p.id

View file

@ -91,7 +91,7 @@
post._date = date
post._datetext = month + '月 ' + date + '日'
more() {
this.more = () => {
if @init or @fetching or @posts.length == 0 then return
this.fetching = true
this.update();
@ -99,20 +99,20 @@
this.fetching = false
@prepend-posts posts
set-posts(posts) {
this.set-posts = (posts) => {
this.posts = posts
this.update();
prepend-posts(posts) {
this.prepend-posts = (posts) => {
posts.for-each (post) =>
@posts.push post
this.update();
add-post(post) {
this.add-post = (post) => {
@posts.unshift post
this.update();
tail() {
this.tail = () => {
@posts[@posts.length - 1]
</script>
</mk-timeline>

View file

@ -98,7 +98,7 @@
if this.refs.title?
this.refs.title.innerHTML = title
post() {
this.post = () => {
@open-post-form!
</script>
</mk-ui-header>

View file

@ -123,7 +123,7 @@
this.on('mount', () => {
this.opts.ready!
search() {
this.search = () => {
query = window.prompt '検索'
if query? and query != ''
@page '/search:' + query

View file

@ -29,21 +29,21 @@
this.on('unmount', () => {
@stream.off 'notification' this.on-stream-notification
ready() {
this.ready = () => {
@ready-count++
if @ready-count == 2
@init-view-position!
init-view-position() {
this.init-view-position = () => {
top = this.refs.header.root.offset-height
this.refs.main.style.padding-top = top + 'px'
toggle-drawer() {
this.toggle-drawer = () => {
this.is-drawer-opening = !@is-drawer-opening
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'
riot.mount el, do
notification: notification

View file

@ -10,7 +10,7 @@
this.user = this.opts.user
fetch(iknow, limit, cursor, cb) {
this.fetch = (iknow, limit, cursor, cb) => {
this.api 'users/followers' do
user_id: @user.id
iknow: iknow

View file

@ -10,7 +10,7 @@
this.user = this.opts.user
fetch(iknow, limit, cursor, cb) {
this.fetch = (iknow, limit, cursor, cb) => {
this.api 'users/following' do
user_id: @user.id
iknow: iknow

View file

@ -22,7 +22,7 @@
res posts
this.trigger('loaded');
more() {
this.more = () => {
this.api 'users/posts' do
user_id: @user.id
with_media: @with-media

View file

@ -172,19 +172,19 @@
this.trigger 'loaded' user
this.update();
go-posts() {
this.go-posts = () => {
this.page = 'posts'
this.update();
go-media() {
this.go-media = () => {
this.page = 'media'
this.update();
go-graphs() {
this.go-graphs = () => {
this.page = 'graphs'
this.update();
go-likes() {
this.go-likes = () => {
this.page = 'likes'
this.update();
</script>

Some files were not shown because too many files have changed in this diff Show more