wip
This commit is contained in:
@@ -314,11 +314,11 @@
|
||||
query: q
|
||||
max: 5
|
||||
.then (users) =>
|
||||
users.for-each (user) =>
|
||||
users.forEach (user) =>
|
||||
user._click = =>
|
||||
this.trigger 'navigate-user' user
|
||||
this.search-result = []
|
||||
this.search-result = users
|
||||
this.searchResult = []
|
||||
this.searchResult = users
|
||||
this.update();
|
||||
.catch (err) =>
|
||||
console.error err
|
||||
@@ -330,16 +330,16 @@
|
||||
| 9, 40 => // Key[TAB] or Key[↓]
|
||||
e.preventDefault();
|
||||
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
|
||||
switch (key)
|
||||
| 10, 13 => // Key[ENTER]
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@search-result[i]._click!
|
||||
this.searchResult[i]._click();
|
||||
| 27 => // Key[ESC]
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@@ -347,11 +347,11 @@
|
||||
| 38 => // Key[↑]
|
||||
e.preventDefault();
|
||||
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[↓]
|
||||
e.preventDefault();
|
||||
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>
|
||||
|
||||
@@ -159,9 +159,9 @@
|
||||
document.removeEventListener 'visibilitychange' this.on-visibilitychange
|
||||
|
||||
this.on('update', () => {
|
||||
@messages.for-each (message) =>
|
||||
date = (new Date message.created_at).get-date!
|
||||
month = (new Date message.created_at).get-month! + 1
|
||||
@messages.forEach (message) =>
|
||||
date = (new Date message.created_at).getDate()
|
||||
month = (new Date message.created_at).getMonth() + 1
|
||||
message._date = date
|
||||
message._datetext = month + '月 ' + date + '日'
|
||||
|
||||
@@ -184,7 +184,7 @@
|
||||
|
||||
this.on-read = (ids) => {
|
||||
if not Array.isArray ids then ids = [ids]
|
||||
ids.for-each (id) =>
|
||||
ids.forEach (id) =>
|
||||
if (@messages.some (x) => x.id == id)
|
||||
exist = (@messages.map (x) -> x.id).index-of id
|
||||
@messages[exist].is_read = true
|
||||
@@ -215,7 +215,7 @@
|
||||
|
||||
this.on-visibilitychange = () => {
|
||||
if document.hidden then return
|
||||
@messages.for-each (message) =>
|
||||
@messages.forEach (message) =>
|
||||
if message.user_id != this.I.id and not message.is_read
|
||||
@connection.socket.send JSON.stringify do
|
||||
type: 'read'
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
this.on('mount', () => {
|
||||
text = this.root.innerHTML
|
||||
this.root.innerHTML = ''
|
||||
(text.split '').for-each (c, i) =>
|
||||
(text.split '').forEach (c, i) =>
|
||||
ce = document.createElement 'span'
|
||||
ce.innerHTML = c
|
||||
ce.style.animationDelay = (i / 10) + 's'
|
||||
|
||||
@@ -63,10 +63,10 @@
|
||||
.catch (err) =>
|
||||
console.error err
|
||||
|
||||
@stream.on 'signin' this.on-signin
|
||||
this.stream.on 'signin' this.on-signin
|
||||
|
||||
this.on('unmount', () => {
|
||||
@stream.off 'signin' this.on-signin
|
||||
this.stream.off 'signin' this.on-signin
|
||||
|
||||
this.on-signin = (signin) => {
|
||||
@history.unshift signin
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
username: this.refs.username.value
|
||||
password: this.refs.password.value
|
||||
.then =>
|
||||
location.reload!
|
||||
location.reload();
|
||||
.catch =>
|
||||
alert 'something happened'
|
||||
this.signing = false
|
||||
|
||||
@@ -268,15 +268,15 @@
|
||||
this.onsubmit = (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
username = this.refs.username.value
|
||||
password = this.refs.password.value
|
||||
const username = this.refs.username.value;
|
||||
const password = this.refs.password.value;
|
||||
|
||||
locker = document.body.appendChild document.createElement 'mk-locker'
|
||||
|
||||
this.api 'signup' do
|
||||
username: username
|
||||
password: password
|
||||
'g-recaptcha-response': grecaptcha.get-response!
|
||||
username: username,
|
||||
password: password,
|
||||
'g-recaptcha-response': grecaptcha.getResponse()
|
||||
.then =>
|
||||
this.api 'signin' do
|
||||
username: username
|
||||
|
||||
@@ -6,25 +6,25 @@
|
||||
this.tickid = null
|
||||
|
||||
this.absolute =
|
||||
@time.get-full-year! + '年' +
|
||||
@time.get-month! + 1 + '月' +
|
||||
@time.get-date! + '日' +
|
||||
this.time.getFullYear() + '年' +
|
||||
this.time.getMonth() + 1 + '月' +
|
||||
this.time.getDate() + '日' +
|
||||
' ' +
|
||||
@time.get-hours! + '時' +
|
||||
@time.get-minutes! + '分'
|
||||
this.time.getHours() + '時' +
|
||||
this.time.getMinutes() + '分'
|
||||
|
||||
this.on('mount', () => {
|
||||
if @mode == 'relative' or @mode == 'detail'
|
||||
@tick!
|
||||
this.tickid = set-interval @tick, 1000ms
|
||||
if this.mode == 'relative' or this.mode == 'detail'
|
||||
this.tick!
|
||||
this.tickid = setInterval this.tick, 1000ms
|
||||
|
||||
this.on('unmount', () => {
|
||||
if @mode == 'relative' or @mode == 'detail'
|
||||
clear-interval @tickid
|
||||
if this.mode == 'relative' or this.mode == 'detail'
|
||||
clearInterval this.tickid
|
||||
|
||||
this.tick = () => {
|
||||
now = new Date!
|
||||
ago = (now - @time) / 1000ms
|
||||
const now = new Date();
|
||||
ago = (now - this.time) / 1000ms
|
||||
this.relative = switch
|
||||
| ago >= 31536000s => ~~(ago / 31536000s) + '年前'
|
||||
| ago >= 2592000s => ~~(ago / 2592000s) + 'ヶ月前'
|
||||
|
||||
Reference in New Issue
Block a user