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

@@ -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>

View File

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