mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-04 11:54:49 +01:00
wip
This commit is contained in:
parent
a9dfe278f8
commit
d042aa4fcb
64 changed files with 332 additions and 332 deletions
|
@ -314,11 +314,11 @@
|
||||||
query: q
|
query: q
|
||||||
max: 5
|
max: 5
|
||||||
.then (users) =>
|
.then (users) =>
|
||||||
users.for-each (user) =>
|
users.forEach (user) =>
|
||||||
user._click = =>
|
user._click = =>
|
||||||
this.trigger 'navigate-user' user
|
this.trigger 'navigate-user' user
|
||||||
this.search-result = []
|
this.searchResult = []
|
||||||
this.search-result = users
|
this.searchResult = users
|
||||||
this.update();
|
this.update();
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
console.error err
|
console.error err
|
||||||
|
@ -330,16 +330,16 @@
|
||||||
| 9, 40 => // Key[TAB] or Key[↓]
|
| 9, 40 => // Key[TAB] or Key[↓]
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.refs.search-result.childNodes[0].focus();
|
this.refs.searchResult.childNodes[0].focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.on-search-result-keydown = (i, e) => {
|
this.on-searchResult-keydown = (i, e) => {
|
||||||
key = e.which
|
key = e.which
|
||||||
switch (key)
|
switch (key)
|
||||||
| 10, 13 => // Key[ENTER]
|
| 10, 13 => // Key[ENTER]
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@search-result[i]._click!
|
this.searchResult[i]._click();
|
||||||
| 27 => // Key[ESC]
|
| 27 => // Key[ESC]
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -347,11 +347,11 @@
|
||||||
| 38 => // Key[↑]
|
| 38 => // Key[↑]
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
(this.refs.search-result.childNodes[i].previous-element-sibling || this.refs.search-result.childNodes[@search-result.length - 1]).focus();
|
(this.refs.searchResult.childNodes[i].previousElementSibling || this.refs.searchResult.childNodes[this.searchResult.length - 1]).focus();
|
||||||
| 9, 40 => // Key[TAB] or Key[↓]
|
| 9, 40 => // Key[TAB] or Key[↓]
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
(this.refs.search-result.childNodes[i].next-element-sibling || this.refs.search-result.childNodes[0]).focus();
|
(this.refs.searchResult.childNodes[i].nextElementSibling || this.refs.searchResult.childNodes[0]).focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -159,9 +159,9 @@
|
||||||
document.removeEventListener 'visibilitychange' this.on-visibilitychange
|
document.removeEventListener 'visibilitychange' this.on-visibilitychange
|
||||||
|
|
||||||
this.on('update', () => {
|
this.on('update', () => {
|
||||||
@messages.for-each (message) =>
|
@messages.forEach (message) =>
|
||||||
date = (new Date message.created_at).get-date!
|
date = (new Date message.created_at).getDate()
|
||||||
month = (new Date message.created_at).get-month! + 1
|
month = (new Date message.created_at).getMonth() + 1
|
||||||
message._date = date
|
message._date = date
|
||||||
message._datetext = month + '月 ' + date + '日'
|
message._datetext = month + '月 ' + date + '日'
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@
|
||||||
|
|
||||||
this.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.forEach (id) =>
|
||||||
if (@messages.some (x) => x.id == id)
|
if (@messages.some (x) => x.id == id)
|
||||||
exist = (@messages.map (x) -> x.id).index-of id
|
exist = (@messages.map (x) -> x.id).index-of id
|
||||||
@messages[exist].is_read = true
|
@messages[exist].is_read = true
|
||||||
|
@ -215,7 +215,7 @@
|
||||||
|
|
||||||
this.on-visibilitychange = () => {
|
this.on-visibilitychange = () => {
|
||||||
if document.hidden then return
|
if document.hidden then return
|
||||||
@messages.for-each (message) =>
|
@messages.forEach (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
|
||||||
@connection.socket.send JSON.stringify do
|
@connection.socket.send JSON.stringify do
|
||||||
type: 'read'
|
type: 'read'
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
text = this.root.innerHTML
|
text = this.root.innerHTML
|
||||||
this.root.innerHTML = ''
|
this.root.innerHTML = ''
|
||||||
(text.split '').for-each (c, i) =>
|
(text.split '').forEach (c, i) =>
|
||||||
ce = document.createElement 'span'
|
ce = document.createElement 'span'
|
||||||
ce.innerHTML = c
|
ce.innerHTML = c
|
||||||
ce.style.animationDelay = (i / 10) + 's'
|
ce.style.animationDelay = (i / 10) + 's'
|
||||||
|
|
|
@ -63,10 +63,10 @@
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
@stream.on 'signin' this.on-signin
|
this.stream.on 'signin' this.on-signin
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'signin' this.on-signin
|
this.stream.off 'signin' this.on-signin
|
||||||
|
|
||||||
this.on-signin = (signin) => {
|
this.on-signin = (signin) => {
|
||||||
@history.unshift signin
|
@history.unshift signin
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
username: this.refs.username.value
|
username: this.refs.username.value
|
||||||
password: this.refs.password.value
|
password: this.refs.password.value
|
||||||
.then =>
|
.then =>
|
||||||
location.reload!
|
location.reload();
|
||||||
.catch =>
|
.catch =>
|
||||||
alert 'something happened'
|
alert 'something happened'
|
||||||
this.signing = false
|
this.signing = false
|
||||||
|
|
|
@ -268,15 +268,15 @@
|
||||||
this.onsubmit = (e) => {
|
this.onsubmit = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
username = this.refs.username.value
|
const username = this.refs.username.value;
|
||||||
password = this.refs.password.value
|
const password = this.refs.password.value;
|
||||||
|
|
||||||
locker = document.body.appendChild document.createElement 'mk-locker'
|
locker = document.body.appendChild document.createElement 'mk-locker'
|
||||||
|
|
||||||
this.api 'signup' do
|
this.api 'signup' do
|
||||||
username: username
|
username: username,
|
||||||
password: password
|
password: password,
|
||||||
'g-recaptcha-response': grecaptcha.get-response!
|
'g-recaptcha-response': grecaptcha.getResponse()
|
||||||
.then =>
|
.then =>
|
||||||
this.api 'signin' do
|
this.api 'signin' do
|
||||||
username: username
|
username: username
|
||||||
|
|
|
@ -6,25 +6,25 @@
|
||||||
this.tickid = null
|
this.tickid = null
|
||||||
|
|
||||||
this.absolute =
|
this.absolute =
|
||||||
@time.get-full-year! + '年' +
|
this.time.getFullYear() + '年' +
|
||||||
@time.get-month! + 1 + '月' +
|
this.time.getMonth() + 1 + '月' +
|
||||||
@time.get-date! + '日' +
|
this.time.getDate() + '日' +
|
||||||
' ' +
|
' ' +
|
||||||
@time.get-hours! + '時' +
|
this.time.getHours() + '時' +
|
||||||
@time.get-minutes! + '分'
|
this.time.getMinutes() + '分'
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
if @mode == 'relative' or @mode == 'detail'
|
if this.mode == 'relative' or this.mode == 'detail'
|
||||||
@tick!
|
this.tick!
|
||||||
this.tickid = set-interval @tick, 1000ms
|
this.tickid = setInterval this.tick, 1000ms
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
if @mode == 'relative' or @mode == 'detail'
|
if this.mode == 'relative' or this.mode == 'detail'
|
||||||
clear-interval @tickid
|
clearInterval this.tickid
|
||||||
|
|
||||||
this.tick = () => {
|
this.tick = () => {
|
||||||
now = new Date!
|
const now = new Date();
|
||||||
ago = (now - @time) / 1000ms
|
ago = (now - this.time) / 1000ms
|
||||||
this.relative = switch
|
this.relative = switch
|
||||||
| ago >= 31536000s => ~~(ago / 31536000s) + '年前'
|
| ago >= 31536000s => ~~(ago / 31536000s) + '年前'
|
||||||
| ago >= 2592000s => ~~(ago / 2592000s) + 'ヶ月前'
|
| ago >= 2592000s => ~~(ago / 2592000s) + 'ヶ月前'
|
||||||
|
|
|
@ -11,16 +11,16 @@
|
||||||
<script>
|
<script>
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@draw!
|
@draw!
|
||||||
this.clock = set-interval @draw, 1000ms
|
this.clock = setInterval @draw, 1000ms
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
clear-interval @clock
|
clearInterval @clock
|
||||||
|
|
||||||
this.draw = () => {
|
this.draw = () => {
|
||||||
now = new Date!
|
const now = new Date();
|
||||||
s = now.get-seconds!
|
s = now.get-seconds!
|
||||||
m = now.get-minutes!
|
m = now.getMinutes()
|
||||||
h = now.get-hours!
|
h = now.getHours()
|
||||||
|
|
||||||
vec2 = (x, y) ->
|
vec2 = (x, y) ->
|
||||||
this.x = x
|
this.x = x
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
@textarea.addEventListener '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.forEach.call all, (el) =>
|
||||||
el.addEventListener 'mousedown' @mousedown
|
el.addEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
this.api 'users/search_by_username' do
|
this.api 'users/search_by_username' do
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
@textarea.removeEventListener '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.forEach.call all, (el) =>
|
||||||
el.removeEventListener 'mousedown' @mousedown
|
el.removeEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
this.mousedown = (e) => {
|
this.mousedown = (e) => {
|
||||||
|
@ -164,7 +164,7 @@
|
||||||
@apply-select!
|
@apply-select!
|
||||||
|
|
||||||
this.apply-select = () => {
|
this.apply-select = () => {
|
||||||
this.refs.users.children.for-each (el) =>
|
this.refs.users.children.forEach (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
|
||||||
|
|
|
@ -84,12 +84,12 @@
|
||||||
this.user = user
|
this.user = user
|
||||||
this.init = false
|
this.init = false
|
||||||
this.update();
|
this.update();
|
||||||
@stream.on 'follow' this.on-stream-follow
|
this.stream.on 'follow' this.on-stream-follow
|
||||||
@stream.on 'unfollow' this.on-stream-unfollow
|
this.stream.on 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'follow' this.on-stream-follow
|
this.stream.off 'follow' this.on-stream-follow
|
||||||
@stream.off 'unfollow' this.on-stream-unfollow
|
this.stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
this.on-stream-follow = (user) => {
|
this.on-stream-follow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == @user.id
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
|
|
||||||
this.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.forEach.call all, (el) =>
|
||||||
el.addEventListener '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'
|
||||||
|
@ -123,7 +123,7 @@
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
all = document.query-selector-all 'body *'
|
all = document.query-selector-all 'body *'
|
||||||
Array.prototype.for-each.call all, (el) =>
|
Array.prototype.forEach.call all, (el) =>
|
||||||
el.removeEventListener 'mousedown' @mousedown
|
el.removeEventListener 'mousedown' @mousedown
|
||||||
this.trigger('closed');
|
this.trigger('closed');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
|
@ -80,10 +80,10 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.can-through = if opts.can-through? then opts.can-through else true
|
this.can-through = if opts.can-through? then opts.can-through else true
|
||||||
this.opts.buttons.for-each (button) =>
|
this.opts.buttons.forEach (button) =>
|
||||||
button._onclick = =>
|
button._onclick = =>
|
||||||
if button.onclick?
|
if button.onclick?
|
||||||
button.onclick!
|
button.onclick();
|
||||||
@close!
|
@close!
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
|
|
|
@ -243,24 +243,24 @@
|
||||||
this.mixin('input-dialog');
|
this.mixin('input-dialog');
|
||||||
this.mixin('stream');
|
this.mixin('stream');
|
||||||
|
|
||||||
this.files = []
|
this.files = [];
|
||||||
this.folders = []
|
this.folders = [];
|
||||||
this.hierarchy-folders = []
|
this.hierarchyFolders = [];
|
||||||
|
|
||||||
this.uploads = []
|
this.uploads = [];
|
||||||
|
|
||||||
// 現在の階層(フォルダ)
|
// 現在の階層(フォルダ)
|
||||||
// * null でルートを表す
|
// * null でルートを表す
|
||||||
this.folder = null
|
this.folder = null;
|
||||||
|
|
||||||
this.multiple = if this.opts.multiple? then this.opts.multiple else false
|
this.multiple = if this.opts.multiple? then this.opts.multiple else false
|
||||||
|
|
||||||
// ドロップされようとしているか
|
// ドロップされようとしているか
|
||||||
this.draghover = false
|
this.draghover = false;
|
||||||
|
|
||||||
// 自信の所有するアイテムがドラッグをスタートさせたか
|
// 自信の所有するアイテムがドラッグをスタートさせたか
|
||||||
// (自分自身の階層にドロップできないようにするためのフラグ)
|
// (自分自身の階層にドロップできないようにするためのフラグ)
|
||||||
this.is-drag-source = false
|
this.is-drag-source = false;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.uploader.on('uploaded', (file) => {
|
this.refs.uploader.on('uploaded', (file) => {
|
||||||
|
@ -270,10 +270,10 @@
|
||||||
this.uploads = uploads
|
this.uploads = uploads
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
@stream.on 'drive_file_created' this.on-stream-drive-file-created
|
this.stream.on 'drive_file_created' this.on-stream-drive-file-created
|
||||||
@stream.on 'drive_file_updated' this.on-stream-drive-file-updated
|
this.stream.on 'drive_file_updated' this.on-stream-drive-file-updated
|
||||||
@stream.on 'drive_folder_created' this.on-stream-drive-folder-created
|
this.stream.on 'drive_folder_created' this.on-stream-drive-folder-created
|
||||||
@stream.on 'drive_folder_updated' this.on-stream-drive-folder-updated
|
this.stream.on 'drive_folder_updated' this.on-stream-drive-folder-updated
|
||||||
|
|
||||||
// Riotのバグでnullを渡しても""になる
|
// Riotのバグでnullを渡しても""になる
|
||||||
// https://github.com/riot/riot/issues/2080
|
// https://github.com/riot/riot/issues/2080
|
||||||
|
@ -284,10 +284,10 @@
|
||||||
@load!
|
@load!
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'drive_file_created' this.on-stream-drive-file-created
|
this.stream.off 'drive_file_created' this.on-stream-drive-file-created
|
||||||
@stream.off 'drive_file_updated' this.on-stream-drive-file-updated
|
this.stream.off 'drive_file_updated' this.on-stream-drive-file-updated
|
||||||
@stream.off 'drive_folder_created' this.on-stream-drive-folder-created
|
this.stream.off 'drive_folder_created' this.on-stream-drive-folder-created
|
||||||
@stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated
|
this.stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated
|
||||||
|
|
||||||
this.on-stream-drive-file-created = (file) => {
|
this.on-stream-drive-file-created = (file) => {
|
||||||
@add-file file, true
|
@add-file file, true
|
||||||
|
@ -315,30 +315,30 @@
|
||||||
|
|
||||||
rect = this.refs.main.get-bounding-client-rect!
|
rect = this.refs.main.get-bounding-client-rect!
|
||||||
|
|
||||||
left = e.page-x + this.refs.main.scroll-left - rect.left - window.page-x-offset
|
left = e.pageX + this.refs.main.scroll-left - rect.left - window.pageXOffset
|
||||||
top = e.page-y + this.refs.main.scroll-top - rect.top - window.page-y-offset
|
top = e.pageY + this.refs.main.scroll-top - rect.top - window.pageYOffset
|
||||||
|
|
||||||
move = (e) =>
|
move = (e) =>
|
||||||
this.refs.selection.style.display = 'block'
|
this.refs.selection.style.display = 'block'
|
||||||
|
|
||||||
cursor-x = e.page-x + this.refs.main.scroll-left - rect.left - window.page-x-offset
|
cursorX = e.pageX + this.refs.main.scroll-left - rect.left - window.pageXOffset
|
||||||
cursor-y = e.page-y + this.refs.main.scroll-top - rect.top - window.page-y-offset
|
cursorY = e.pageY + this.refs.main.scroll-top - rect.top - window.pageYOffset
|
||||||
w = cursor-x - left
|
w = cursorX - left
|
||||||
h = cursor-y - top
|
h = cursorY - top
|
||||||
|
|
||||||
if w > 0
|
if w > 0
|
||||||
this.refs.selection.style.width = w + 'px'
|
this.refs.selection.style.width = w + 'px'
|
||||||
this.refs.selection.style.left = left + 'px'
|
this.refs.selection.style.left = left + 'px'
|
||||||
else
|
else
|
||||||
this.refs.selection.style.width = -w + 'px'
|
this.refs.selection.style.width = -w + 'px'
|
||||||
this.refs.selection.style.left = cursor-x + 'px'
|
this.refs.selection.style.left = cursorX + 'px'
|
||||||
|
|
||||||
if h > 0
|
if h > 0
|
||||||
this.refs.selection.style.height = h + 'px'
|
this.refs.selection.style.height = h + 'px'
|
||||||
this.refs.selection.style.top = top + 'px'
|
this.refs.selection.style.top = top + 'px'
|
||||||
else
|
else
|
||||||
this.refs.selection.style.height = -h + 'px'
|
this.refs.selection.style.height = -h + 'px'
|
||||||
this.refs.selection.style.top = cursor-y + 'px'
|
this.refs.selection.style.top = cursorY + 'px'
|
||||||
|
|
||||||
up = (e) =>
|
up = (e) =>
|
||||||
document.document-element.removeEventListener 'mousemove' move
|
document.document-element.removeEventListener 'mousemove' move
|
||||||
|
@ -351,7 +351,7 @@
|
||||||
|
|
||||||
this.path-oncontextmenu = (e) => {
|
this.path-oncontextmenu = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stopImmediatePropagation();
|
||||||
return false
|
return false
|
||||||
|
|
||||||
this.ondragover = (e) => {
|
this.ondragover = (e) => {
|
||||||
|
@ -361,7 +361,7 @@
|
||||||
// ドラッグ元が自分自身の所有するアイテムかどうか
|
// ドラッグ元が自分自身の所有するアイテムかどうか
|
||||||
if !@is-drag-source
|
if !@is-drag-source
|
||||||
// ドラッグされてきたものがファイルだったら
|
// ドラッグされてきたものがファイルだったら
|
||||||
if e.dataTransfer.effect-allowed == 'all'
|
if e.dataTransfer.effectAllowed == 'all'
|
||||||
e.dataTransfer.dropEffect = 'copy'
|
e.dataTransfer.dropEffect = 'copy'
|
||||||
else
|
else
|
||||||
e.dataTransfer.dropEffect = 'move'
|
e.dataTransfer.dropEffect = 'move'
|
||||||
|
@ -387,7 +387,7 @@
|
||||||
|
|
||||||
// ドロップされてきたものがファイルだったら
|
// ドロップされてきたものがファイルだったら
|
||||||
if e.dataTransfer.files.length > 0
|
if e.dataTransfer.files.length > 0
|
||||||
Array.prototype.for-each.call e.dataTransfer.files, (file) =>
|
Array.prototype.forEach.call e.dataTransfer.files, (file) =>
|
||||||
@upload file, this.folder
|
@upload file, this.folder
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -440,20 +440,20 @@
|
||||||
|
|
||||||
this.oncontextmenu = (e) => {
|
this.oncontextmenu = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
ctx = document.body.appendChild document.createElement 'mk-drive-browser-base-contextmenu'
|
ctx = document.body.appendChild document.createElement 'mk-drive-browser-base-contextmenu'
|
||||||
ctx = riot.mount ctx, do
|
ctx = riot.mount ctx, do
|
||||||
browser: @
|
browser: this
|
||||||
ctx = ctx.0
|
ctx = ctx.0
|
||||||
ctx.open do
|
ctx.open do
|
||||||
x: e.page-x - window.page-x-offset
|
x: e.pageX - window.pageXOffset
|
||||||
y: e.page-y - window.page-y-offset
|
y: e.pageY - window.pageYOffset
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
this.select-local-file = () => {
|
this.select-local-file = () => {
|
||||||
this.refs.file-input.click!
|
this.refs.file-input.click();
|
||||||
|
|
||||||
this.url-upload = () => {
|
this.url-upload = () => {
|
||||||
url <~ @input-dialog do
|
url <~ @input-dialog do
|
||||||
|
@ -522,10 +522,10 @@
|
||||||
folder_id: target-folder
|
folder_id: target-folder
|
||||||
.then (folder) =>
|
.then (folder) =>
|
||||||
this.folder = folder
|
this.folder = folder
|
||||||
this.hierarchy-folders = []
|
this.hierarchyFolders = []
|
||||||
|
|
||||||
x = (f) =>
|
x = (f) =>
|
||||||
@hierarchy-folders.unshift f
|
@hierarchyFolders.unshift f
|
||||||
if f.parent?
|
if f.parent?
|
||||||
x f.parent
|
x f.parent
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@
|
||||||
this.go-root = () => {
|
this.go-root = () => {
|
||||||
if this.folder != null
|
if this.folder != null
|
||||||
this.folder = null
|
this.folder = null
|
||||||
this.hierarchy-folders = []
|
this.hierarchyFolders = []
|
||||||
this.update();
|
this.update();
|
||||||
@load!
|
@load!
|
||||||
|
|
||||||
|
@ -635,9 +635,9 @@
|
||||||
flag = false
|
flag = false
|
||||||
complete = =>
|
complete = =>
|
||||||
if flag
|
if flag
|
||||||
load-folders.for-each (folder) =>
|
load-folders.forEach (folder) =>
|
||||||
@add-folder folder
|
@add-folder folder
|
||||||
load-files.for-each (file) =>
|
load-files.forEach (file) =>
|
||||||
@add-file file
|
@add-file file
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.update();
|
this.update();
|
||||||
|
|
|
@ -166,14 +166,14 @@
|
||||||
if this.file._selected
|
if this.file._selected
|
||||||
this.browser.trigger 'selected' this.file
|
this.browser.trigger 'selected' this.file
|
||||||
else
|
else
|
||||||
this.browser.files.for-each (file) =>
|
this.browser.files.forEach (file) =>
|
||||||
file._selected = false
|
file._selected = false
|
||||||
this.file._selected = true
|
this.file._selected = true
|
||||||
this.browser.trigger 'change-selection' this.file
|
this.browser.trigger 'change-selection' this.file
|
||||||
|
|
||||||
this.oncontextmenu = (e) => {
|
this.oncontextmenu = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
this.is-contextmenu-showing = true
|
this.is-contextmenu-showing = true
|
||||||
this.update();
|
this.update();
|
||||||
|
@ -183,15 +183,15 @@
|
||||||
file: this.file
|
file: this.file
|
||||||
ctx = ctx.0
|
ctx = ctx.0
|
||||||
ctx.open do
|
ctx.open do
|
||||||
x: e.page-x - window.page-x-offset
|
x: e.pageX - window.pageXOffset
|
||||||
y: e.page-y - window.page-y-offset
|
y: e.pageY - window.pageYOffset
|
||||||
ctx.on('closed', () => {
|
ctx.on('closed', () => {
|
||||||
this.is-contextmenu-showing = false
|
this.is-contextmenu-showing = false
|
||||||
this.update();
|
this.update();
|
||||||
return false
|
return false
|
||||||
|
|
||||||
this.ondragstart = (e) => {
|
this.ondragstart = (e) => {
|
||||||
e.dataTransfer.effect-allowed = 'move'
|
e.dataTransfer.effectAllowed = 'move'
|
||||||
e.dataTransfer.set-data 'text' JSON.stringify do
|
e.dataTransfer.set-data 'text' JSON.stringify do
|
||||||
type: 'file'
|
type: 'file'
|
||||||
id: this.file.id
|
id: this.file.id
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
// 自分自身がドラッグされていない場合
|
// 自分自身がドラッグされていない場合
|
||||||
if !@is-dragging
|
if !@is-dragging
|
||||||
// ドラッグされてきたものがファイルだったら
|
// ドラッグされてきたものがファイルだったら
|
||||||
if e.dataTransfer.effect-allowed == 'all'
|
if e.dataTransfer.effectAllowed == 'all'
|
||||||
e.dataTransfer.dropEffect = 'copy'
|
e.dataTransfer.dropEffect = 'copy'
|
||||||
else
|
else
|
||||||
e.dataTransfer.dropEffect = 'move'
|
e.dataTransfer.dropEffect = 'move'
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
|
|
||||||
// ファイルだったら
|
// ファイルだったら
|
||||||
if e.dataTransfer.files.length > 0
|
if e.dataTransfer.files.length > 0
|
||||||
Array.prototype.for-each.call e.dataTransfer.files, (file) =>
|
Array.prototype.forEach.call e.dataTransfer.files, (file) =>
|
||||||
this.browser.upload file, this.folder
|
this.browser.upload file, this.folder
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
return false
|
return false
|
||||||
|
|
||||||
this.ondragstart = (e) => {
|
this.ondragstart = (e) => {
|
||||||
e.dataTransfer.effect-allowed = 'move'
|
e.dataTransfer.effectAllowed = 'move'
|
||||||
e.dataTransfer.set-data 'text' JSON.stringify do
|
e.dataTransfer.set-data 'text' JSON.stringify do
|
||||||
type: 'folder'
|
type: 'folder'
|
||||||
id: this.folder.id
|
id: this.folder.id
|
||||||
|
@ -163,7 +163,7 @@
|
||||||
|
|
||||||
this.oncontextmenu = (e) => {
|
this.oncontextmenu = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
this.is-contextmenu-showing = true
|
this.is-contextmenu-showing = true
|
||||||
this.update();
|
this.update();
|
||||||
|
@ -173,8 +173,8 @@
|
||||||
folder: this.folder
|
folder: this.folder
|
||||||
ctx = ctx.0
|
ctx = ctx.0
|
||||||
ctx.open do
|
ctx.open do
|
||||||
x: e.page-x - window.page-x-offset
|
x: e.pageX - window.pageXOffset
|
||||||
y: e.page-y - window.page-y-offset
|
y: e.pageY - window.pageYOffset
|
||||||
ctx.on('closed', () => {
|
ctx.on('closed', () => {
|
||||||
this.is-contextmenu-showing = false
|
this.is-contextmenu-showing = false
|
||||||
this.update();
|
this.update();
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
if this.folder == null and this.browser.folder == null
|
if this.folder == null and this.browser.folder == null
|
||||||
e.dataTransfer.dropEffect = 'none'
|
e.dataTransfer.dropEffect = 'none'
|
||||||
// ドラッグされてきたものがファイルだったら
|
// ドラッグされてきたものがファイルだったら
|
||||||
else if e.dataTransfer.effect-allowed == 'all'
|
else if e.dataTransfer.effectAllowed == 'all'
|
||||||
e.dataTransfer.dropEffect = 'copy'
|
e.dataTransfer.dropEffect = 'copy'
|
||||||
else
|
else
|
||||||
e.dataTransfer.dropEffect = 'move'
|
e.dataTransfer.dropEffect = 'move'
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
// ファイルだったら
|
// ファイルだったら
|
||||||
if e.dataTransfer.files.length > 0
|
if e.dataTransfer.files.length > 0
|
||||||
Array.prototype.for-each.call e.dataTransfer.files, (file) =>
|
Array.prototype.forEach.call e.dataTransfer.files, (file) =>
|
||||||
this.browser.upload file, this.folder
|
this.browser.upload file, this.folder
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
|
@ -81,12 +81,12 @@
|
||||||
this.user = user
|
this.user = user
|
||||||
this.init = false
|
this.init = false
|
||||||
this.update();
|
this.update();
|
||||||
@stream.on 'follow' this.on-stream-follow
|
this.stream.on 'follow' this.on-stream-follow
|
||||||
@stream.on 'unfollow' this.on-stream-unfollow
|
this.stream.on 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'follow' this.on-stream-follow
|
this.stream.off 'follow' this.on-stream-follow
|
||||||
@stream.off 'unfollow' this.on-stream-unfollow
|
this.stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
this.on-stream-follow = (user) => {
|
this.on-stream-follow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == @user.id
|
||||||
|
|
|
@ -142,7 +142,7 @@
|
||||||
|
|
||||||
this.api 'users/recommendation' do
|
this.api 'users/recommendation' do
|
||||||
limit: @limit
|
limit: @limit
|
||||||
offset: @limit * @page
|
offset: @limit * this.page
|
||||||
.then (users) =>
|
.then (users) =>
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.users = users
|
this.users = users
|
||||||
|
@ -154,7 +154,7 @@
|
||||||
if @users.length < @limit
|
if @users.length < @limit
|
||||||
this.page = 0
|
this.page = 0
|
||||||
else
|
else
|
||||||
@page++
|
this.page++
|
||||||
@load!
|
@load!
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
|
|
|
@ -107,10 +107,10 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.draw = () => {
|
this.draw = () => {
|
||||||
now = new Date!
|
const now = new Date();
|
||||||
nd = now.get-date!
|
nd = now.getDate()
|
||||||
nm = now.get-month!
|
nm = now.getMonth()
|
||||||
ny = now.get-full-year!
|
ny = now.getFullYear()
|
||||||
|
|
||||||
this.year = ny
|
this.year = ny
|
||||||
this.month = nm + 1
|
this.month = nm + 1
|
||||||
|
@ -140,9 +140,9 @@
|
||||||
@draw!
|
@draw!
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.clock = set-interval @draw, 1000ms
|
this.clock = setInterval @draw, 1000ms
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
clear-interval @clock
|
clearInterval @clock
|
||||||
</script>
|
</script>
|
||||||
</mk-calendar-home-widget>
|
</mk-calendar-home-widget>
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
this.fetch = (cb) => {
|
this.fetch = (cb) => {
|
||||||
this.api 'posts/mentions' do
|
this.api 'posts/mentions' do
|
||||||
following: @mode == 'following'
|
following: this.mode == 'following'
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
this.is-loading = false
|
this.is-loading = false
|
||||||
this.is-empty = posts.length == 0
|
this.is-empty = posts.length == 0
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
this.more-loading = true
|
this.more-loading = true
|
||||||
this.update();
|
this.update();
|
||||||
this.api 'posts/mentions' do
|
this.api 'posts/mentions' do
|
||||||
following: @mode == 'following'
|
following: this.mode == 'following'
|
||||||
max_id: this.refs.timeline.tail!.id
|
max_id: this.refs.timeline.tail!.id
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
this.more-loading = false
|
this.more-loading = false
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
this.initializing = true
|
this.initializing = true
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@stream.on 'drive_file_created' this.on-stream-drive-file-created
|
this.stream.on 'drive_file_created' this.on-stream-drive-file-created
|
||||||
|
|
||||||
this.api 'drive/stream' do
|
this.api 'drive/stream' do
|
||||||
type: 'image/*'
|
type: 'image/*'
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'drive_file_created' this.on-stream-drive-file-created
|
this.stream.off 'drive_file_created' this.on-stream-drive-file-created
|
||||||
|
|
||||||
this.on-stream-drive-file-created = (file) => {
|
this.on-stream-drive-file-created = (file) => {
|
||||||
if /^image\/.+$/.test file.type
|
if /^image\/.+$/.test file.type
|
||||||
|
|
|
@ -73,10 +73,10 @@
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@fetch!
|
@fetch!
|
||||||
this.clock = set-interval @fetch, 60000ms
|
this.clock = setInterval @fetch, 60000ms
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
clear-interval @clock
|
clearInterval @clock
|
||||||
|
|
||||||
this.fetch = () => {
|
this.fetch = () => {
|
||||||
this.api CONFIG.url + '/api:rss' do
|
this.api CONFIG.url + '/api:rss' do
|
||||||
|
|
|
@ -42,9 +42,9 @@
|
||||||
this.no-following = this.I.following_count == 0
|
this.no-following = this.I.following_count == 0
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@stream.on 'post' this.on-stream-post
|
this.stream.on 'post' this.on-stream-post
|
||||||
@stream.on 'follow' this.on-stream-follow
|
this.stream.on 'follow' this.on-stream-follow
|
||||||
@stream.on 'unfollow' this.on-stream-unfollow
|
this.stream.on 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
document.addEventListener 'keydown' this.on-document-keydown
|
document.addEventListener 'keydown' this.on-document-keydown
|
||||||
window.addEventListener 'scroll' this.on-scroll
|
window.addEventListener 'scroll' this.on-scroll
|
||||||
|
@ -53,9 +53,9 @@
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'post' this.on-stream-post
|
this.stream.off 'post' this.on-stream-post
|
||||||
@stream.off 'follow' this.on-stream-follow
|
this.stream.off 'follow' this.on-stream-follow
|
||||||
@stream.off 'unfollow' this.on-stream-unfollow
|
this.stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
document.removeEventListener 'keydown' this.on-document-keydown
|
document.removeEventListener 'keydown' this.on-document-keydown
|
||||||
window.removeEventListener 'scroll' this.on-scroll
|
window.removeEventListener 'scroll' this.on-scroll
|
||||||
|
|
|
@ -43,10 +43,10 @@
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@set!
|
@set!
|
||||||
this.clock = set-interval @change, 20000ms
|
this.clock = setInterval @change, 20000ms
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
clear-interval @clock
|
clearInterval @clock
|
||||||
|
|
||||||
this.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]
|
||||||
|
|
|
@ -120,13 +120,13 @@
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@fetch!
|
@fetch!
|
||||||
this.clock = set-interval =>
|
this.clock = setInterval =>
|
||||||
if @users.length < @limit
|
if @users.length < @limit
|
||||||
@fetch true
|
@fetch true
|
||||||
, 60000ms
|
, 60000ms
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
clear-interval @clock
|
clearInterval @clock
|
||||||
|
|
||||||
this.fetch = (quiet = false) => {
|
this.fetch = (quiet = false) => {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
if not quiet then this.update();
|
if not quiet then this.update();
|
||||||
this.api 'users/recommendation' do
|
this.api 'users/recommendation' do
|
||||||
limit: @limit
|
limit: @limit
|
||||||
offset: @limit * @page
|
offset: @limit * this.page
|
||||||
.then (users) =>
|
.then (users) =>
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.users = users
|
this.users = users
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
if @users.length < @limit
|
if @users.length < @limit
|
||||||
this.page = 0
|
this.page = 0
|
||||||
else
|
else
|
||||||
@page++
|
this.page++
|
||||||
@fetch!
|
@fetch!
|
||||||
</script>
|
</script>
|
||||||
</mk-user-recommendation-home-widget>
|
</mk-user-recommendation-home-widget>
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
this.mode = this.opts.mode || 'timeline'
|
this.mode = this.opts.mode || 'timeline'
|
||||||
|
|
||||||
// https://github.com/riot/riot/issues/2080
|
// https://github.com/riot/riot/issues/2080
|
||||||
if @mode == '' then this.mode = 'timeline'
|
if this.mode == '' then this.mode = 'timeline'
|
||||||
|
|
||||||
this.home = []
|
this.home = []
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
this.refs.tl.on('loaded', () => {
|
this.refs.tl.on('loaded', () => {
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
|
||||||
this.I.data.home.for-each (widget) =>
|
this.I.data.home.forEach (widget) =>
|
||||||
try
|
try
|
||||||
el = document.createElement 'mk-' + widget.name + '-home-widget'
|
el = document.createElement 'mk-' + widget.name + '-home-widget'
|
||||||
switch widget.place
|
switch widget.place
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
// noop
|
// noop
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@home.for-each (widget) =>
|
@home.forEach (widget) =>
|
||||||
widget.unmount!
|
widget.unmount!
|
||||||
</script>
|
</script>
|
||||||
</mk-home>
|
</mk-home>
|
||||||
|
|
|
@ -194,19 +194,19 @@
|
||||||
.catch (err, text-status) ->
|
.catch (err, text-status) ->
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
@stream.on 'notification' this.on-notification
|
this.stream.on 'notification' this.on-notification
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'notification' this.on-notification
|
this.stream.off 'notification' this.on-notification
|
||||||
|
|
||||||
this.on-notification = (notification) => {
|
this.on-notification = (notification) => {
|
||||||
@notifications.unshift notification
|
@notifications.unshift notification
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.on('update', () => {
|
this.on('update', () => {
|
||||||
@notifications.for-each (notification) =>
|
@notifications.forEach (notification) =>
|
||||||
date = (new Date notification.created_at).get-date!
|
date = (new Date notification.created_at).getDate()
|
||||||
month = (new Date notification.created_at).get-month! + 1
|
month = (new Date notification.created_at).getMonth() + 1
|
||||||
notification._date = date
|
notification._date = date
|
||||||
notification._datetext = month + '月 ' + date + '日'
|
notification._datetext = month + '月 ' + date + '日'
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -27,11 +27,11 @@
|
||||||
|
|
||||||
document.title = 'Misskey'
|
document.title = 'Misskey'
|
||||||
this.Progress.start();
|
this.Progress.start();
|
||||||
@stream.on 'post' this.on-stream-post
|
this.stream.on 'post' this.on-stream-post
|
||||||
document.addEventListener '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
|
this.stream.off 'post' this.on-stream-post
|
||||||
document.removeEventListener 'visibilitychange' @window-on-visibilitychange
|
document.removeEventListener 'visibilitychange' @window-on-visibilitychange
|
||||||
|
|
||||||
this.on-stream-post = (post) => {
|
this.on-stream-post = (post) => {
|
||||||
|
|
|
@ -110,31 +110,31 @@
|
||||||
|
|
||||||
this.post = this.opts.post
|
this.post = this.opts.post
|
||||||
|
|
||||||
this.url = CONFIG.url + '/' + @post.user.username + '/' + @post.id
|
this.url = CONFIG.url + '/' + this.post.user.username + '/' + this.post.id
|
||||||
|
|
||||||
this.title = @date-stringify @post.created_at
|
this.title = @date-stringify this.post.created_at
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
if @post.text?
|
if this.post.text?
|
||||||
tokens = @analyze @post.text
|
tokens = @analyze this.post.text
|
||||||
this.refs.text.innerHTML = @compile tokens
|
this.refs.text.innerHTML = @compile tokens
|
||||||
|
|
||||||
this.refs.text.children.for-each (e) =>
|
this.refs.text.children.forEach (e) =>
|
||||||
if e.tag-name == 'MK-URL'
|
if e.tag-name == 'MK-URL'
|
||||||
riot.mount e
|
riot.mount e
|
||||||
|
|
||||||
this.like = () => {
|
this.like = () => {
|
||||||
if @post.is_liked
|
if this.post.is_liked
|
||||||
this.api 'posts/likes/delete' do
|
this.api 'posts/likes/delete' do
|
||||||
post_id: @post.id
|
post_id: this.post.id
|
||||||
.then =>
|
.then =>
|
||||||
@post.is_liked = false
|
this.post.is_liked = false
|
||||||
this.update();
|
this.update();
|
||||||
else
|
else
|
||||||
this.api 'posts/likes/create' do
|
this.api 'posts/likes/create' do
|
||||||
post_id: @post.id
|
post_id: this.post.id
|
||||||
.then =>
|
.then =>
|
||||||
@post.is_liked = true
|
this.post.is_liked = true
|
||||||
this.update();
|
this.update();
|
||||||
</script>
|
</script>
|
||||||
</mk-post-detail-sub>
|
</mk-post-detail-sub>
|
||||||
|
|
|
@ -349,18 +349,18 @@
|
||||||
this.post = post
|
this.post = post
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
|
||||||
this.is-repost = @post.repost?
|
this.is-repost = this.post.repost?
|
||||||
this.p = if @is-repost then @post.repost else @post
|
this.p = if @is-repost then this.post.repost else this.post
|
||||||
|
|
||||||
this.title = @date-stringify @p.created_at
|
this.title = @date-stringify this.p.created_at
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
if @p.text?
|
if this.p.text?
|
||||||
tokens = @analyze @p.text
|
tokens = @analyze this.p.text
|
||||||
this.refs.text.innerHTML = @compile tokens
|
this.refs.text.innerHTML = @compile tokens
|
||||||
|
|
||||||
this.refs.text.children.for-each (e) =>
|
this.refs.text.children.forEach (e) =>
|
||||||
if e.tag-name == 'MK-URL'
|
if e.tag-name == 'MK-URL'
|
||||||
riot.mount e
|
riot.mount e
|
||||||
|
|
||||||
|
@ -369,12 +369,12 @@
|
||||||
.filter (t) -> t.type == 'link'
|
.filter (t) -> t.type == 'link'
|
||||||
.map (t) =>
|
.map (t) =>
|
||||||
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
|
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
|
||||||
riot.mount @preview, do
|
riot.mount this.preview, do
|
||||||
url: t.content
|
url: t.content
|
||||||
|
|
||||||
// Get likes
|
// Get likes
|
||||||
this.api 'posts/likes' do
|
this.api 'posts/likes' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
limit: 8
|
limit: 8
|
||||||
.then (likes) =>
|
.then (likes) =>
|
||||||
this.likes = likes
|
this.likes = likes
|
||||||
|
@ -382,7 +382,7 @@
|
||||||
|
|
||||||
// Get reposts
|
// Get reposts
|
||||||
this.api 'posts/reposts' do
|
this.api 'posts/reposts' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
limit: 8
|
limit: 8
|
||||||
.then (reposts) =>
|
.then (reposts) =>
|
||||||
this.reposts = reposts
|
this.reposts = reposts
|
||||||
|
@ -390,7 +390,7 @@
|
||||||
|
|
||||||
// Get replies
|
// Get replies
|
||||||
this.api 'posts/replies' do
|
this.api 'posts/replies' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
limit: 8
|
limit: 8
|
||||||
.then (replies) =>
|
.then (replies) =>
|
||||||
this.replies = replies
|
this.replies = replies
|
||||||
|
@ -401,25 +401,25 @@
|
||||||
this.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: this.p
|
||||||
|
|
||||||
this.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: this.p
|
||||||
|
|
||||||
this.like = () => {
|
this.like = () => {
|
||||||
if @p.is_liked
|
if this.p.is_liked
|
||||||
this.api 'posts/likes/delete' do
|
this.api 'posts/likes/delete' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
.then =>
|
.then =>
|
||||||
@p.is_liked = false
|
this.p.is_liked = false
|
||||||
this.update();
|
this.update();
|
||||||
else
|
else
|
||||||
this.api 'posts/likes/create' do
|
this.api 'posts/likes/create' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
.then =>
|
.then =>
|
||||||
@p.is_liked = true
|
this.p.is_liked = true
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.load-context = () => {
|
this.load-context = () => {
|
||||||
|
@ -427,7 +427,7 @@
|
||||||
|
|
||||||
// Get context
|
// Get context
|
||||||
this.api 'posts/context' do
|
this.api 'posts/context' do
|
||||||
post_id: @p.reply_to_id
|
post_id: this.p.reply_to_id
|
||||||
.then (context) =>
|
.then (context) =>
|
||||||
this.context = context.reverse!
|
this.context = context.reverse!
|
||||||
this.loading-context = false
|
this.loading-context = false
|
||||||
|
|
|
@ -348,7 +348,7 @@
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.draghover = true
|
this.draghover = true
|
||||||
// ドラッグされてきたものがファイルだったら
|
// ドラッグされてきたものがファイルだったら
|
||||||
if e.dataTransfer.effect-allowed == 'all'
|
if e.dataTransfer.effectAllowed == 'all'
|
||||||
e.dataTransfer.dropEffect = 'copy'
|
e.dataTransfer.dropEffect = 'copy'
|
||||||
else
|
else
|
||||||
e.dataTransfer.dropEffect = 'move'
|
e.dataTransfer.dropEffect = 'move'
|
||||||
|
@ -367,7 +367,7 @@
|
||||||
|
|
||||||
// ファイルだったら
|
// ファイルだったら
|
||||||
if e.dataTransfer.files.length > 0
|
if e.dataTransfer.files.length > 0
|
||||||
Array.prototype.for-each.call e.dataTransfer.files, (file) =>
|
Array.prototype.forEach.call e.dataTransfer.files, (file) =>
|
||||||
@upload file
|
@upload file
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@
|
||||||
|
|
||||||
this.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!
|
this.post!
|
||||||
|
|
||||||
this.onpaste = (e) => {
|
this.onpaste = (e) => {
|
||||||
data = e.clipboardData
|
data = e.clipboardData
|
||||||
|
@ -402,14 +402,14 @@
|
||||||
@upload item.getAsFile();
|
@upload item.getAsFile();
|
||||||
|
|
||||||
this.select-file = () => {
|
this.select-file = () => {
|
||||||
this.refs.file.click!
|
this.refs.file.click();
|
||||||
|
|
||||||
this.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.forEach @add-file
|
||||||
|
|
||||||
this.change-file = () => {
|
this.change-file = () => {
|
||||||
files = this.refs.file.files
|
files = this.refs.file.files
|
||||||
|
@ -448,7 +448,7 @@
|
||||||
text: this.refs.text.value
|
text: this.refs.text.value
|
||||||
media_ids: files
|
media_ids: files
|
||||||
reply_to_id: if @in-reply-to-post? then @in-reply-to-post.id else undefined
|
reply_to_id: if @in-reply-to-post? then @in-reply-to-post.id else undefined
|
||||||
poll: if @poll then this.refs.poll.get! else undefined
|
poll: if this.poll then this.refs.poll.get! else undefined
|
||||||
.then (data) =>
|
.then (data) =>
|
||||||
this.trigger('post');
|
this.trigger('post');
|
||||||
@notify if @in-reply-to-post? then '返信しました!' else '投稿しました!'
|
@notify if @in-reply-to-post? then '返信しました!' else '投稿しました!'
|
||||||
|
|
|
@ -88,6 +88,6 @@
|
||||||
|
|
||||||
this.post = this.opts.post
|
this.post = this.opts.post
|
||||||
|
|
||||||
this.title = @date-stringify @post.created_at
|
this.title = @date-stringify this.post.created_at
|
||||||
</script>
|
</script>
|
||||||
</mk-post-preview>
|
</mk-post-preview>
|
||||||
|
|
|
@ -16,24 +16,24 @@
|
||||||
this.post-promise = if @is-promise this.opts.post then this.opts.post else Promise.resolve this.opts.post
|
this.post-promise = if @is-promise this.opts.post then this.opts.post else Promise.resolve this.opts.post
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
post <~ @post-promise.then
|
post <~ this.post-promise.then
|
||||||
this.post = post
|
this.post = post
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.api 'aggregation/posts/like' do
|
this.api 'aggregation/posts/like' do
|
||||||
post_id: @post.id
|
post_id: this.post.id
|
||||||
limit: 30days
|
limit: 30days
|
||||||
.then (likes) =>
|
.then (likes) =>
|
||||||
likes = likes.reverse!
|
likes = likes.reverse!
|
||||||
|
|
||||||
this.api 'aggregation/posts/repost' do
|
this.api 'aggregation/posts/repost' do
|
||||||
post_id: @post.id
|
post_id: this.post.id
|
||||||
limit: 30days
|
limit: 30days
|
||||||
.then (repost) =>
|
.then (repost) =>
|
||||||
repost = repost.reverse!
|
repost = repost.reverse!
|
||||||
|
|
||||||
this.api 'aggregation/posts/reply' do
|
this.api 'aggregation/posts/reply' do
|
||||||
post_id: @post.id
|
post_id: this.post.id
|
||||||
limit: 30days
|
limit: 30days
|
||||||
.then (replies) =>
|
.then (replies) =>
|
||||||
replies = replies.reverse!
|
replies = replies.reverse!
|
||||||
|
|
|
@ -63,16 +63,16 @@
|
||||||
this.refs.timeline.focus();
|
this.refs.timeline.focus();
|
||||||
|
|
||||||
this.more = () => {
|
this.more = () => {
|
||||||
if @more-loading or @is-loading or @timeline.posts.length == 0
|
if @more-loading or @is-loading or this.timeline.posts.length == 0
|
||||||
return
|
return
|
||||||
this.more-loading = true
|
this.more-loading = true
|
||||||
this.update();
|
this.update();
|
||||||
this.api 'posts/search' do
|
this.api 'posts/search' do
|
||||||
query: @query
|
query: @query
|
||||||
page: @page + 1
|
page: this.page + 1
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
this.more-loading = false
|
this.more-loading = false
|
||||||
@page++
|
this.page++
|
||||||
this.update();
|
this.update();
|
||||||
this.refs.timeline.prepend-posts posts
|
this.refs.timeline.prepend-posts posts
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
if @state == 'connected'
|
if @state == 'connected'
|
||||||
this.root.style.opacity = 0
|
this.root.style.opacity = 0
|
||||||
|
|
||||||
@stream-state-ev.on('connected', () => {
|
this.stream-state-ev.on('connected', () => {
|
||||||
this.state = @get-stream-state!
|
this.state = @get-stream-state!
|
||||||
this.update();
|
this.update();
|
||||||
setTimeout =>
|
setTimeout =>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
} 200ms 'linear'
|
} 200ms 'linear'
|
||||||
, 1000ms
|
, 1000ms
|
||||||
|
|
||||||
@stream-state-ev.on('closed', () => {
|
this.stream-state-ev.on('closed', () => {
|
||||||
this.state = @get-stream-state!
|
this.state = @get-stream-state!
|
||||||
this.update();
|
this.update();
|
||||||
Velocity this.root, {
|
Velocity this.root, {
|
||||||
|
|
|
@ -34,11 +34,11 @@
|
||||||
this.post = this.opts.post
|
this.post = this.opts.post
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
if @post.text?
|
if this.post.text?
|
||||||
tokens = @analyze @post.text
|
tokens = @analyze this.post.text
|
||||||
this.refs.text.innerHTML = @compile tokens, false
|
this.refs.text.innerHTML = @compile tokens, false
|
||||||
|
|
||||||
this.refs.text.children.for-each (e) =>
|
this.refs.text.children.forEach (e) =>
|
||||||
if e.tag-name == 'MK-URL'
|
if e.tag-name == 'MK-URL'
|
||||||
riot.mount e
|
riot.mount e
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
this.post = this.opts.post
|
this.post = this.opts.post
|
||||||
|
|
||||||
this.title = @date-stringify @post.created_at
|
this.title = @date-stringify this.post.created_at
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -319,25 +319,25 @@
|
||||||
this.mixin('NotImplementedException');
|
this.mixin('NotImplementedException');
|
||||||
|
|
||||||
this.post = this.opts.post
|
this.post = this.opts.post
|
||||||
this.is-repost = @post.repost? and !@post.text?
|
this.is-repost = this.post.repost? and !this.post.text?
|
||||||
this.p = if @is-repost then @post.repost else @post
|
this.p = if @is-repost then this.post.repost else this.post
|
||||||
|
|
||||||
this.title = @date-stringify @p.created_at
|
this.title = @date-stringify this.p.created_at
|
||||||
|
|
||||||
this.url = CONFIG.url + '/' + @p.user.username + '/' + @p.id
|
this.url = CONFIG.url + '/' + this.p.user.username + '/' + this.p.id
|
||||||
this.is-detail-opened = false
|
this.is-detail-opened = false
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
if @p.text?
|
if this.p.text?
|
||||||
tokens = if @p._highlight?
|
tokens = if this.p._highlight?
|
||||||
then @analyze @p._highlight
|
then @analyze this.p._highlight
|
||||||
else @analyze @p.text
|
else @analyze this.p.text
|
||||||
|
|
||||||
this.refs.text.innerHTML = this.refs.text.innerHTML.replace '<p class="dummy"></p>' if @p._highlight?
|
this.refs.text.innerHTML = this.refs.text.innerHTML.replace '<p class="dummy"></p>' if this.p._highlight?
|
||||||
then @compile tokens, true, false
|
then @compile tokens, true, false
|
||||||
else @compile tokens
|
else @compile tokens
|
||||||
|
|
||||||
this.refs.text.children.for-each (e) =>
|
this.refs.text.children.forEach (e) =>
|
||||||
if e.tag-name == 'MK-URL'
|
if e.tag-name == 'MK-URL'
|
||||||
riot.mount e
|
riot.mount e
|
||||||
|
|
||||||
|
@ -346,31 +346,31 @@
|
||||||
.filter (t) -> t.type == 'link'
|
.filter (t) -> t.type == 'link'
|
||||||
.map (t) =>
|
.map (t) =>
|
||||||
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
|
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
|
||||||
riot.mount @preview, do
|
riot.mount this.preview, do
|
||||||
url: t.content
|
url: t.content
|
||||||
|
|
||||||
this.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: this.p
|
||||||
|
|
||||||
this.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: this.p
|
||||||
|
|
||||||
this.like = () => {
|
this.like = () => {
|
||||||
if @p.is_liked
|
if this.p.is_liked
|
||||||
this.api 'posts/likes/delete' do
|
this.api 'posts/likes/delete' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
.then =>
|
.then =>
|
||||||
@p.is_liked = false
|
this.p.is_liked = false
|
||||||
this.update();
|
this.update();
|
||||||
else
|
else
|
||||||
this.api 'posts/likes/create' do
|
this.api 'posts/likes/create' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
.then =>
|
.then =>
|
||||||
@p.is_liked = true
|
this.p.is_liked = true
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.toggle-detail = () => {
|
this.toggle-detail = () => {
|
||||||
|
@ -381,9 +381,9 @@
|
||||||
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
|
||||||
focus this.root, (e) -> e.previous-element-sibling
|
focus this.root, (e) -> e.previousElementSibling
|
||||||
| e.which == 40 or e.which == 75 or e.which == 9 => // ↓, k or Tab
|
| e.which == 40 or e.which == 75 or e.which == 9 => // ↓, k or Tab
|
||||||
focus this.root, (e) -> e.next-element-sibling
|
focus this.root, (e) -> e.nextElementSibling
|
||||||
| e.which == 81 or e.which == 69 => // q or e
|
| e.which == 81 or e.which == 69 => // q or e
|
||||||
@repost!
|
@repost!
|
||||||
| e.which == 70 or e.which == 76 => // f or l
|
| e.which == 70 or e.which == 76 => // f or l
|
||||||
|
|
|
@ -51,12 +51,12 @@
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.prepend-posts = (posts) => {
|
this.prepend-posts = (posts) => {
|
||||||
posts.for-each (post) =>
|
posts.forEach (post) =>
|
||||||
@posts.push post
|
this.posts.push post
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.add-post = (post) => {
|
this.add-post = (post) => {
|
||||||
@posts.unshift post
|
this.posts.unshift post
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.clear = () => {
|
this.clear = () => {
|
||||||
|
@ -67,13 +67,13 @@
|
||||||
this.root.children.0.focus();
|
this.root.children.0.focus();
|
||||||
|
|
||||||
this.on('update', () => {
|
this.on('update', () => {
|
||||||
@posts.for-each (post) =>
|
this.posts.forEach (post) =>
|
||||||
date = (new Date post.created_at).get-date!
|
date = (new Date post.created_at).getDate()
|
||||||
month = (new Date post.created_at).get-month! + 1
|
month = (new Date post.created_at).getMonth() + 1
|
||||||
post._date = date
|
post._date = date
|
||||||
post._datetext = month + '月 ' + date + '日'
|
post._datetext = month + '月 ' + date + '日'
|
||||||
|
|
||||||
this.tail = () => {
|
this.tail = () => {
|
||||||
@posts[@posts.length - 1]
|
this.posts[this.posts.length - 1]
|
||||||
</script>
|
</script>
|
||||||
</mk-timeline>
|
</mk-timeline>
|
||||||
|
|
|
@ -177,14 +177,14 @@
|
||||||
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.forEach.call all, (el) =>
|
||||||
el.addEventListener 'mousedown' @mousedown
|
el.addEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
this.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.forEach.call all, (el) =>
|
||||||
el.removeEventListener 'mousedown' @mousedown
|
el.removeEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
this.mousedown = (e) => {
|
this.mousedown = (e) => {
|
||||||
|
|
|
@ -59,15 +59,15 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.draw = () => {
|
this.draw = () => {
|
||||||
now = new Date!
|
const now = new Date();
|
||||||
|
|
||||||
yyyy = now.get-full-year!
|
yyyy = now.getFullYear()
|
||||||
mm = (\0 + (now.get-month! + 1)).slice -2
|
mm = (\0 + (now.getMonth() + 1)).slice -2
|
||||||
dd = (\0 + now.get-date!).slice -2
|
dd = (\0 + now.getDate()).slice -2
|
||||||
yyyymmdd = "<span class='yyyymmdd'>#yyyy/#mm/#dd</span>"
|
yyyymmdd = "<span class='yyyymmdd'>#yyyy/#mm/#dd</span>"
|
||||||
|
|
||||||
hh = (\0 + now.get-hours!).slice -2
|
hh = (\0 + now.getHours()).slice -2
|
||||||
mm = (\0 + now.get-minutes!).slice -2
|
mm = (\0 + now.getMinutes()).slice -2
|
||||||
hhmm = "<span class='hhmm'>#hh:#mm</span>"
|
hhmm = "<span class='hhmm'>#hh:#mm</span>"
|
||||||
|
|
||||||
if now.get-seconds! % 2 == 0
|
if now.get-seconds! % 2 == 0
|
||||||
|
@ -79,9 +79,9 @@
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@draw!
|
@draw!
|
||||||
this.clock = set-interval @draw, 1000ms
|
this.clock = setInterval @draw, 1000ms
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
clear-interval @clock
|
clearInterval @clock
|
||||||
</script>
|
</script>
|
||||||
</mk-ui-header-clock>
|
</mk-ui-header-clock>
|
||||||
|
|
|
@ -84,8 +84,8 @@
|
||||||
this.page = this.opts.page
|
this.page = this.opts.page
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@stream.on 'read_all_messaging_messages' this.on-read-all-messaging-messages
|
this.stream.on 'read_all_messaging_messages' this.on-read-all-messaging-messages
|
||||||
@stream.on 'unread_messaging_message' this.on-unread-messaging-message
|
this.stream.on 'unread_messaging_message' this.on-unread-messaging-message
|
||||||
|
|
||||||
// Fetch count of unread messaging messages
|
// Fetch count of unread messaging messages
|
||||||
this.api 'messaging/unread'
|
this.api 'messaging/unread'
|
||||||
|
@ -95,8 +95,8 @@
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'read_all_messaging_messages' this.on-read-all-messaging-messages
|
this.stream.off 'read_all_messaging_messages' this.on-read-all-messaging-messages
|
||||||
@stream.off 'unread_messaging_message' this.on-unread-messaging-message
|
this.stream.off 'unread_messaging_message' this.on-unread-messaging-message
|
||||||
|
|
||||||
this.on-read-all-messaging-messages = () => {
|
this.on-read-all-messaging-messages = () => {
|
||||||
this.has-unread-messaging-messages = false
|
this.has-unread-messaging-messages = false
|
||||||
|
|
|
@ -87,14 +87,14 @@
|
||||||
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.forEach.call all, (el) =>
|
||||||
el.addEventListener 'mousedown' @mousedown
|
el.addEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
this.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.forEach.call all, (el) =>
|
||||||
el.removeEventListener 'mousedown' @mousedown
|
el.removeEventListener 'mousedown' @mousedown
|
||||||
|
|
||||||
this.mousedown = (e) => {
|
this.mousedown = (e) => {
|
||||||
|
|
|
@ -36,6 +36,6 @@
|
||||||
|
|
||||||
this.onsubmit = (e) => {
|
this.onsubmit = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@page '/search:' + this.refs.q.value
|
this.page '/search:' + this.refs.q.value
|
||||||
</script>
|
</script>
|
||||||
</mk-ui-header-search>
|
</mk-ui-header-search>
|
||||||
|
|
|
@ -77,8 +77,8 @@
|
||||||
limit: 9posts
|
limit: 9posts
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
this.initializing = false
|
this.initializing = false
|
||||||
posts.for-each (post) =>
|
posts.forEach (post) =>
|
||||||
post.media.for-each (image) =>
|
post.media.forEach (image) =>
|
||||||
if @images.length < 9
|
if @images.length < 9
|
||||||
@images.push image
|
@images.push image
|
||||||
this.update();
|
this.update();
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
this.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: this.mode == 'with-replies'
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
this.is-loading = false
|
this.is-loading = false
|
||||||
this.is-empty = posts.length == 0
|
this.is-empty = posts.length == 0
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
this.update();
|
this.update();
|
||||||
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: this.mode == 'with-replies'
|
||||||
max_id: this.refs.timeline.tail!.id
|
max_id: this.refs.timeline.tail!.id
|
||||||
.then (posts) =>
|
.then (posts) =>
|
||||||
this.more-loading = false
|
this.more-loading = false
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
this.fetching = true
|
this.fetching = true
|
||||||
this.update();
|
this.update();
|
||||||
obj <~ this.opts.fetch do
|
obj <~ this.opts.fetch do
|
||||||
@mode == 'iknow'
|
this.mode == 'iknow'
|
||||||
@limit
|
@limit
|
||||||
null
|
null
|
||||||
this.users = obj.users
|
this.users = obj.users
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
this.more-fetching = true
|
this.more-fetching = true
|
||||||
this.update();
|
this.update();
|
||||||
obj <~ this.opts.fetch do
|
obj <~ this.opts.fetch do
|
||||||
@mode == 'iknow'
|
this.mode == 'iknow'
|
||||||
@limit
|
@limit
|
||||||
@cursor
|
@cursor
|
||||||
this.users = @users.concat obj.users
|
this.users = @users.concat obj.users
|
||||||
|
|
|
@ -304,7 +304,7 @@
|
||||||
z = 0
|
z = 0
|
||||||
|
|
||||||
ws = document.query-selector-all 'mk-window'
|
ws = document.query-selector-all 'mk-window'
|
||||||
ws.for-each (w) !=>
|
ws.forEach (w) !=>
|
||||||
if w == this.root then return
|
if w == this.root then return
|
||||||
m = w.query-selector ':scope > .main'
|
m = w.query-selector ':scope > .main'
|
||||||
mz = Number(document.default-view.get-computed-style m, null .z-index)
|
mz = Number(document.default-view.get-computed-style m, null .z-index)
|
||||||
|
|
|
@ -222,7 +222,7 @@
|
||||||
cb = this.refs.cb.value
|
cb = this.refs.cb.value
|
||||||
permission = []
|
permission = []
|
||||||
|
|
||||||
this.refs.permission.query-selector-all 'input' .for-each (el) =>
|
this.refs.permission.query-selector-all 'input' .forEach (el) =>
|
||||||
if el.checked then permission.push el.value
|
if el.checked then permission.push el.value
|
||||||
|
|
||||||
locker = document.body.appendChild document.createElement 'mk-locker'
|
locker = document.body.appendChild document.createElement 'mk-locker'
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
|
|
||||||
this.files = []
|
this.files = []
|
||||||
this.folders = []
|
this.folders = []
|
||||||
this.hierarchy-folders = []
|
this.hierarchyFolders = []
|
||||||
this.selected-files = []
|
this.selected-files = []
|
||||||
|
|
||||||
// 現在の階層(フォルダ)
|
// 現在の階層(フォルダ)
|
||||||
|
@ -146,10 +146,10 @@
|
||||||
this.multiple = if this.opts.multiple? then this.opts.multiple else false
|
this.multiple = if this.opts.multiple? then this.opts.multiple else false
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@stream.on 'drive_file_created' this.on-stream-drive-file-created
|
this.stream.on 'drive_file_created' this.on-stream-drive-file-created
|
||||||
@stream.on 'drive_file_updated' this.on-stream-drive-file-updated
|
this.stream.on 'drive_file_updated' this.on-stream-drive-file-updated
|
||||||
@stream.on 'drive_folder_created' this.on-stream-drive-folder-created
|
this.stream.on 'drive_folder_created' this.on-stream-drive-folder-created
|
||||||
@stream.on 'drive_folder_updated' this.on-stream-drive-folder-updated
|
this.stream.on 'drive_folder_updated' this.on-stream-drive-folder-updated
|
||||||
|
|
||||||
// Riotのバグでnullを渡しても""になる
|
// Riotのバグでnullを渡しても""になる
|
||||||
// https://github.com/riot/riot/issues/2080
|
// https://github.com/riot/riot/issues/2080
|
||||||
|
@ -162,10 +162,10 @@
|
||||||
@load!
|
@load!
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'drive_file_created' this.on-stream-drive-file-created
|
this.stream.off 'drive_file_created' this.on-stream-drive-file-created
|
||||||
@stream.off 'drive_file_updated' this.on-stream-drive-file-updated
|
this.stream.off 'drive_file_updated' this.on-stream-drive-file-updated
|
||||||
@stream.off 'drive_folder_created' this.on-stream-drive-folder-created
|
this.stream.off 'drive_folder_created' this.on-stream-drive-folder-created
|
||||||
@stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated
|
this.stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated
|
||||||
|
|
||||||
this.on-stream-drive-file-created = (file) => {
|
this.on-stream-drive-file-created = (file) => {
|
||||||
@add-file file, true
|
@add-file file, true
|
||||||
|
@ -210,10 +210,10 @@
|
||||||
folder_id: target-folder
|
folder_id: target-folder
|
||||||
.then (folder) =>
|
.then (folder) =>
|
||||||
this.folder = folder
|
this.folder = folder
|
||||||
this.hierarchy-folders = []
|
this.hierarchyFolders = []
|
||||||
|
|
||||||
x = (f) =>
|
x = (f) =>
|
||||||
@hierarchy-folders.unshift f
|
@hierarchyFolders.unshift f
|
||||||
if f.parent?
|
if f.parent?
|
||||||
x f.parent
|
x f.parent
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@
|
||||||
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
|
||||||
this.hierarchy-folders = []
|
this.hierarchyFolders = []
|
||||||
this.update();
|
this.update();
|
||||||
this.trigger('move-root');
|
this.trigger('move-root');
|
||||||
@load!
|
@load!
|
||||||
|
@ -325,9 +325,9 @@
|
||||||
flag = false
|
flag = false
|
||||||
complete = =>
|
complete = =>
|
||||||
if flag
|
if flag
|
||||||
load-folders.for-each (folder) =>
|
load-folders.forEach (folder) =>
|
||||||
@add-folder folder
|
@add-folder folder
|
||||||
load-files.for-each (file) =>
|
load-files.forEach (file) =>
|
||||||
@add-file file
|
@add-file file
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.update();
|
this.update();
|
||||||
|
@ -361,10 +361,10 @@
|
||||||
.then (file) =>
|
.then (file) =>
|
||||||
this.file = file
|
this.file = file
|
||||||
this.folder = null
|
this.folder = null
|
||||||
this.hierarchy-folders = []
|
this.hierarchyFolders = []
|
||||||
|
|
||||||
x = (f) =>
|
x = (f) =>
|
||||||
@hierarchy-folders.unshift f
|
@hierarchyFolders.unshift f
|
||||||
if f.parent?
|
if f.parent?
|
||||||
x f.parent
|
x f.parent
|
||||||
|
|
||||||
|
|
|
@ -62,12 +62,12 @@
|
||||||
this.user = user
|
this.user = user
|
||||||
this.init = false
|
this.init = false
|
||||||
this.update();
|
this.update();
|
||||||
@stream.on 'follow' this.on-stream-follow
|
this.stream.on 'follow' this.on-stream-follow
|
||||||
@stream.on 'unfollow' this.on-stream-unfollow
|
this.stream.on 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'follow' this.on-stream-follow
|
this.stream.off 'follow' this.on-stream-follow
|
||||||
@stream.off 'unfollow' this.on-stream-unfollow
|
this.stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
this.on-stream-follow = (user) => {
|
this.on-stream-follow = (user) => {
|
||||||
if user.id == @user.id
|
if user.id == @user.id
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@stream.on 'post' this.on-stream-post
|
this.stream.on 'post' this.on-stream-post
|
||||||
@stream.on 'follow' this.on-stream-follow
|
this.stream.on 'follow' this.on-stream-follow
|
||||||
@stream.on 'unfollow' this.on-stream-unfollow
|
this.stream.on 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'post' this.on-stream-post
|
this.stream.off 'post' this.on-stream-post
|
||||||
@stream.off 'follow' this.on-stream-follow
|
this.stream.off 'follow' this.on-stream-follow
|
||||||
@stream.off 'unfollow' this.on-stream-unfollow
|
this.stream.off 'unfollow' this.on-stream-unfollow
|
||||||
|
|
||||||
this.more = () => {
|
this.more = () => {
|
||||||
this.api 'posts/timeline' do
|
this.api 'posts/timeline' do
|
||||||
|
|
|
@ -74,19 +74,19 @@
|
||||||
.catch (err, text-status) ->
|
.catch (err, text-status) ->
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
@stream.on 'notification' this.on-notification
|
this.stream.on 'notification' this.on-notification
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'notification' this.on-notification
|
this.stream.off 'notification' this.on-notification
|
||||||
|
|
||||||
this.on-notification = (notification) => {
|
this.on-notification = (notification) => {
|
||||||
@notifications.unshift notification
|
@notifications.unshift notification
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.on('update', () => {
|
this.on('update', () => {
|
||||||
@notifications.for-each (notification) =>
|
@notifications.forEach (notification) =>
|
||||||
date = (new Date notification.created_at).get-date!
|
date = (new Date notification.created_at).getDate()
|
||||||
month = (new Date notification.created_at).get-month! + 1
|
month = (new Date notification.created_at).getMonth() + 1
|
||||||
notification._date = date
|
notification._date = date
|
||||||
notification._datetext = month + '月 ' + date + '日'
|
notification._datetext = month + '月 ' + date + '日'
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -22,14 +22,14 @@
|
||||||
|
|
||||||
this.Progress.start();
|
this.Progress.start();
|
||||||
|
|
||||||
@stream.on 'post' this.on-stream-post
|
this.stream.on 'post' this.on-stream-post
|
||||||
document.addEventListener '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
|
this.stream.off 'post' this.on-stream-post
|
||||||
document.removeEventListener 'visibilitychange' @window-on-visibilitychange
|
document.removeEventListener 'visibilitychange' @window-on-visibilitychange
|
||||||
|
|
||||||
this.on-stream-post = (post) => {
|
this.on-stream-post = (post) => {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
this.ui.trigger('title', '<i class="fa fa-comments-o"></i>メッセージ');
|
this.ui.trigger('title', '<i class="fa fa-comments-o"></i>メッセージ');
|
||||||
|
|
||||||
this.refs.ui.refs.index.on('navigate-user', (user) => {
|
this.refs.ui.refs.index.on('navigate-user', (user) => {
|
||||||
@page '/i/messaging/' + user.username
|
this.page '/i/messaging/' + user.username
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</mk-messaging-page>
|
</mk-messaging-page>
|
||||||
|
|
|
@ -344,18 +344,18 @@
|
||||||
post_id: this.opts.post
|
post_id: this.opts.post
|
||||||
.then (post) =>
|
.then (post) =>
|
||||||
this.post = post
|
this.post = post
|
||||||
this.is-repost = @post.repost?
|
this.is-repost = this.post.repost?
|
||||||
this.p = if @is-repost then @post.repost else @post
|
this.p = if @is-repost then this.post.repost else this.post
|
||||||
this.summary = @get-post-summary @p
|
this.summary = @get-post-summary this.p
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
this.fetching = false
|
this.fetching = false
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
if @p.text?
|
if this.p.text?
|
||||||
tokens = @analyze @p.text
|
tokens = @analyze this.p.text
|
||||||
this.refs.text.innerHTML = @compile tokens
|
this.refs.text.innerHTML = @compile tokens
|
||||||
|
|
||||||
this.refs.text.children.for-each (e) =>
|
this.refs.text.children.forEach (e) =>
|
||||||
if e.tag-name == 'MK-URL'
|
if e.tag-name == 'MK-URL'
|
||||||
riot.mount e
|
riot.mount e
|
||||||
|
|
||||||
|
@ -364,12 +364,12 @@
|
||||||
.filter (t) -> t.type == 'link'
|
.filter (t) -> t.type == 'link'
|
||||||
.map (t) =>
|
.map (t) =>
|
||||||
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
|
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
|
||||||
riot.mount @preview, do
|
riot.mount this.preview, do
|
||||||
url: t.content
|
url: t.content
|
||||||
|
|
||||||
// Get likes
|
// Get likes
|
||||||
this.api 'posts/likes' do
|
this.api 'posts/likes' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
limit: 8
|
limit: 8
|
||||||
.then (likes) =>
|
.then (likes) =>
|
||||||
this.likes = likes
|
this.likes = likes
|
||||||
|
@ -377,7 +377,7 @@
|
||||||
|
|
||||||
// Get reposts
|
// Get reposts
|
||||||
this.api 'posts/reposts' do
|
this.api 'posts/reposts' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
limit: 8
|
limit: 8
|
||||||
.then (reposts) =>
|
.then (reposts) =>
|
||||||
this.reposts = reposts
|
this.reposts = reposts
|
||||||
|
@ -385,7 +385,7 @@
|
||||||
|
|
||||||
// Get replies
|
// Get replies
|
||||||
this.api 'posts/replies' do
|
this.api 'posts/replies' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
limit: 8
|
limit: 8
|
||||||
.then (replies) =>
|
.then (replies) =>
|
||||||
this.replies = replies
|
this.replies = replies
|
||||||
|
@ -393,27 +393,27 @@
|
||||||
|
|
||||||
this.reply = () => {
|
this.reply = () => {
|
||||||
@open-post-form do
|
@open-post-form do
|
||||||
reply: @p
|
reply: this.p
|
||||||
|
|
||||||
this.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: this.p.id
|
||||||
text: if text == '' then undefined else text
|
text: if text == '' then undefined else text
|
||||||
|
|
||||||
this.like = () => {
|
this.like = () => {
|
||||||
if @p.is_liked
|
if this.p.is_liked
|
||||||
this.api 'posts/likes/delete' do
|
this.api 'posts/likes/delete' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
.then =>
|
.then =>
|
||||||
@p.is_liked = false
|
this.p.is_liked = false
|
||||||
this.update();
|
this.update();
|
||||||
else
|
else
|
||||||
this.api 'posts/likes/create' do
|
this.api 'posts/likes/create' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
.then =>
|
.then =>
|
||||||
@p.is_liked = true
|
this.p.is_liked = true
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.load-context = () => {
|
this.load-context = () => {
|
||||||
|
@ -421,7 +421,7 @@
|
||||||
|
|
||||||
// Get context
|
// Get context
|
||||||
this.api 'posts/context' do
|
this.api 'posts/context' do
|
||||||
post_id: @p.reply_to_id
|
post_id: this.p.reply_to_id
|
||||||
.then (context) =>
|
.then (context) =>
|
||||||
this.context = context.reverse!
|
this.context = context.reverse!
|
||||||
this.loading-context = false
|
this.loading-context = false
|
||||||
|
|
|
@ -202,7 +202,7 @@
|
||||||
|
|
||||||
this.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!
|
this.post!
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@
|
||||||
return true
|
return true
|
||||||
|
|
||||||
this.select-file = () => {
|
this.select-file = () => {
|
||||||
this.refs.file.click!
|
this.refs.file.click();
|
||||||
|
|
||||||
this.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'
|
||||||
|
@ -225,7 +225,7 @@
|
||||||
multiple: true
|
multiple: true
|
||||||
.0
|
.0
|
||||||
browser.on('selected', (files) => {
|
browser.on('selected', (files) => {
|
||||||
files.for-each @add-file
|
files.forEach @add-file
|
||||||
|
|
||||||
this.change-file = () => {
|
this.change-file = () => {
|
||||||
files = this.refs.file.files
|
files = this.refs.file.files
|
||||||
|
@ -264,7 +264,7 @@
|
||||||
text: this.refs.text.value
|
text: this.refs.text.value
|
||||||
media_ids: files
|
media_ids: files
|
||||||
reply_to_id: if this.opts.reply? then this.opts.reply.id else undefined
|
reply_to_id: if this.opts.reply? then this.opts.reply.id else undefined
|
||||||
poll: if @poll then this.refs.poll.get! else undefined
|
poll: if this.poll then this.refs.poll.get! else undefined
|
||||||
.then (data) =>
|
.then (data) =>
|
||||||
this.trigger('post');
|
this.trigger('post');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
if @state == 'connected'
|
if @state == 'connected'
|
||||||
this.root.style.opacity = 0
|
this.root.style.opacity = 0
|
||||||
|
|
||||||
@stream-state-ev.on('connected', () => {
|
this.stream-state-ev.on('connected', () => {
|
||||||
this.state = @get-stream-state!
|
this.state = @get-stream-state!
|
||||||
this.update();
|
this.update();
|
||||||
setTimeout =>
|
setTimeout =>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
} 200ms 'linear'
|
} 200ms 'linear'
|
||||||
, 1000ms
|
, 1000ms
|
||||||
|
|
||||||
@stream-state-ev.on('closed', () => {
|
this.stream-state-ev.on('closed', () => {
|
||||||
this.state = @get-stream-state!
|
this.state = @get-stream-state!
|
||||||
this.update();
|
this.update();
|
||||||
Velocity this.root, {
|
Velocity this.root, {
|
||||||
|
|
|
@ -33,11 +33,11 @@
|
||||||
this.post = this.opts.post
|
this.post = this.opts.post
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
if @post.text?
|
if this.post.text?
|
||||||
tokens = @analyze @post.text
|
tokens = @analyze this.post.text
|
||||||
this.refs.text.innerHTML = @compile tokens, false
|
this.refs.text.innerHTML = @compile tokens, false
|
||||||
|
|
||||||
this.refs.text.children.for-each (e) =>
|
this.refs.text.children.forEach (e) =>
|
||||||
if e.tag-name == 'MK-URL'
|
if e.tag-name == 'MK-URL'
|
||||||
riot.mount e
|
riot.mount e
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -292,22 +292,22 @@
|
||||||
this.mixin('open-post-form');
|
this.mixin('open-post-form');
|
||||||
|
|
||||||
this.post = this.opts.post
|
this.post = this.opts.post
|
||||||
this.is-repost = @post.repost? and !@post.text?
|
this.is-repost = this.post.repost? and !this.post.text?
|
||||||
this.p = if @is-repost then @post.repost else @post
|
this.p = if @is-repost then this.post.repost else this.post
|
||||||
this.summary = @get-post-summary @p
|
this.summary = @get-post-summary this.p
|
||||||
this.url = CONFIG.url + '/' + @p.user.username + '/' + @p.id
|
this.url = CONFIG.url + '/' + this.p.user.username + '/' + this.p.id
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
if @p.text?
|
if this.p.text?
|
||||||
tokens = if @p._highlight?
|
tokens = if this.p._highlight?
|
||||||
then @analyze @p._highlight
|
then @analyze this.p._highlight
|
||||||
else @analyze @p.text
|
else @analyze this.p.text
|
||||||
|
|
||||||
this.refs.text.innerHTML = this.refs.text.innerHTML.replace '<p class="dummy"></p>' if @p._highlight?
|
this.refs.text.innerHTML = this.refs.text.innerHTML.replace '<p class="dummy"></p>' if this.p._highlight?
|
||||||
then @compile tokens, true, false
|
then @compile tokens, true, false
|
||||||
else @compile tokens
|
else @compile tokens
|
||||||
|
|
||||||
this.refs.text.children.for-each (e) =>
|
this.refs.text.children.forEach (e) =>
|
||||||
if e.tag-name == 'MK-URL'
|
if e.tag-name == 'MK-URL'
|
||||||
riot.mount e
|
riot.mount e
|
||||||
|
|
||||||
|
@ -316,32 +316,32 @@
|
||||||
.filter (t) -> t.type == 'link'
|
.filter (t) -> t.type == 'link'
|
||||||
.map (t) =>
|
.map (t) =>
|
||||||
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
|
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
|
||||||
riot.mount @preview, do
|
riot.mount this.preview, do
|
||||||
url: t.content
|
url: t.content
|
||||||
|
|
||||||
this.reply = () => {
|
this.reply = () => {
|
||||||
@open-post-form do
|
@open-post-form do
|
||||||
reply: @p
|
reply: this.p
|
||||||
|
|
||||||
this.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: this.p.id
|
||||||
text: if text == '' then undefined else text
|
text: if text == '' then undefined else text
|
||||||
|
|
||||||
this.like = () => {
|
this.like = () => {
|
||||||
if @p.is_liked
|
if this.p.is_liked
|
||||||
this.api 'posts/likes/delete' do
|
this.api 'posts/likes/delete' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
.then =>
|
.then =>
|
||||||
@p.is_liked = false
|
this.p.is_liked = false
|
||||||
this.update();
|
this.update();
|
||||||
else
|
else
|
||||||
this.api 'posts/likes/create' do
|
this.api 'posts/likes/create' do
|
||||||
post_id: @p.id
|
post_id: this.p.id
|
||||||
.then =>
|
.then =>
|
||||||
@p.is_liked = true
|
this.p.is_liked = true
|
||||||
this.update();
|
this.update();
|
||||||
</script>
|
</script>
|
||||||
</mk-timeline-post>
|
</mk-timeline-post>
|
||||||
|
|
|
@ -85,34 +85,34 @@
|
||||||
@set-posts posts
|
@set-posts posts
|
||||||
|
|
||||||
this.on('update', () => {
|
this.on('update', () => {
|
||||||
@posts.for-each (post) =>
|
this.posts.forEach (post) =>
|
||||||
date = (new Date post.created_at).get-date!
|
date = (new Date post.created_at).getDate()
|
||||||
month = (new Date post.created_at).get-month! + 1
|
month = (new Date post.created_at).getMonth() + 1
|
||||||
post._date = date
|
post._date = date
|
||||||
post._datetext = month + '月 ' + date + '日'
|
post._datetext = month + '月 ' + date + '日'
|
||||||
|
|
||||||
this.more = () => {
|
this.more = () => {
|
||||||
if @init or @fetching or @posts.length == 0 then return
|
if @init or @fetching or this.posts.length == 0 then return
|
||||||
this.fetching = true
|
this.fetching = true
|
||||||
this.update();
|
this.update();
|
||||||
this.opts.more!.then (posts) =>
|
this.opts.more!.then (posts) =>
|
||||||
this.fetching = false
|
this.fetching = false
|
||||||
@prepend-posts posts
|
this.prepend-posts posts
|
||||||
|
|
||||||
this.set-posts = (posts) => {
|
this.set-posts = (posts) => {
|
||||||
this.posts = posts
|
this.posts = posts
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.prepend-posts = (posts) => {
|
this.prepend-posts = (posts) => {
|
||||||
posts.for-each (post) =>
|
posts.forEach (post) =>
|
||||||
@posts.push post
|
this.posts.push post
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.add-post = (post) => {
|
this.add-post = (post) => {
|
||||||
@posts.unshift post
|
this.posts.unshift post
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.tail = () => {
|
this.tail = () => {
|
||||||
@posts[@posts.length - 1]
|
this.posts[this.posts.length - 1]
|
||||||
</script>
|
</script>
|
||||||
</mk-timeline>
|
</mk-timeline>
|
||||||
|
|
|
@ -126,6 +126,6 @@
|
||||||
this.search = () => {
|
this.search = () => {
|
||||||
query = window.prompt '検索'
|
query = window.prompt '検索'
|
||||||
if query? and query != ''
|
if query? and query != ''
|
||||||
@page '/search:' + query
|
this.page '/search:' + query
|
||||||
</script>
|
</script>
|
||||||
</mk-ui-nav>
|
</mk-ui-nav>
|
||||||
|
|
|
@ -23,11 +23,11 @@
|
||||||
// alert text
|
// alert text
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
@stream.on 'notification' this.on-stream-notification
|
this.stream.on 'notification' this.on-stream-notification
|
||||||
@ready!
|
@ready!
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
@stream.off 'notification' this.on-stream-notification
|
this.stream.off 'notification' this.on-stream-notification
|
||||||
|
|
||||||
this.ready = () => {
|
this.ready = () => {
|
||||||
@ready-count++
|
@ready-count++
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
this.fetching = true
|
this.fetching = true
|
||||||
this.update();
|
this.update();
|
||||||
obj <~ this.opts.fetch do
|
obj <~ this.opts.fetch do
|
||||||
@mode == 'iknow'
|
this.mode == 'iknow'
|
||||||
@limit
|
@limit
|
||||||
null
|
null
|
||||||
this.users = obj.users
|
this.users = obj.users
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
this.more-fetching = true
|
this.more-fetching = true
|
||||||
this.update();
|
this.update();
|
||||||
obj <~ this.opts.fetch do
|
obj <~ this.opts.fetch do
|
||||||
@mode == 'iknow'
|
this.mode == 'iknow'
|
||||||
@limit
|
@limit
|
||||||
@cursor
|
@cursor
|
||||||
this.users = @users.concat obj.users
|
this.users = @users.concat obj.users
|
||||||
|
|
Loading…
Reference in a new issue