forked from FoundKeyGang/FoundKey
wip
This commit is contained in:
parent
ea70350dcc
commit
07efc8e150
90 changed files with 427 additions and 425 deletions
|
@ -114,13 +114,13 @@
|
||||||
state: 'waiting'
|
state: 'waiting'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.form.on('denied', () => {
|
this.$refs.form.on('denied', () => {
|
||||||
this.update({
|
this.update({
|
||||||
state: 'denied'
|
state: 'denied'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.form.on('accepted', this.accepted);
|
this.$refs.form.on('accepted', this.accepted);
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.update({
|
this.update({
|
||||||
|
|
|
@ -289,7 +289,7 @@
|
||||||
this.files = null;
|
this.files = null;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.uploader.on('uploaded', file => {
|
this.$refs.uploader.on('uploaded', file => {
|
||||||
this.update({
|
this.update({
|
||||||
files: [file]
|
files: [file]
|
||||||
});
|
});
|
||||||
|
@ -297,7 +297,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.upload = file => {
|
this.upload = file => {
|
||||||
this.refs.uploader.upload(file);
|
this.$refs.uploader.upload(file);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.clearReply = () => {
|
this.clearReply = () => {
|
||||||
|
@ -311,7 +311,7 @@
|
||||||
this.update({
|
this.update({
|
||||||
files: null
|
files: null
|
||||||
});
|
});
|
||||||
this.refs.text.value = '';
|
this.$refs.text.value = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
this.post = () => {
|
this.post = () => {
|
||||||
|
@ -324,7 +324,7 @@
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
this.api('posts/create', {
|
this.api('posts/create', {
|
||||||
text: this.refs.text.value == '' ? undefined : this.refs.text.value,
|
text: this.$refs.text.value == '' ? undefined : this.$refs.text.value,
|
||||||
media_ids: files,
|
media_ids: files,
|
||||||
reply_id: this.reply ? this.reply.id : undefined,
|
reply_id: this.reply ? this.reply.id : undefined,
|
||||||
channel_id: this.channel.id
|
channel_id: this.channel.id
|
||||||
|
@ -340,11 +340,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.changeFile = () => {
|
this.changeFile = () => {
|
||||||
Array.from(this.refs.file.files).forEach(this.upload);
|
Array.from(this.$refs.file.files).forEach(this.upload);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectFile = () => {
|
this.selectFile = () => {
|
||||||
this.refs.file.click();
|
this.$refs.file.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.drive = () => {
|
this.drive = () => {
|
||||||
|
|
|
@ -136,7 +136,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectFile = () => {
|
this.selectFile = () => {
|
||||||
this.refs.file.click();
|
this.$refs.file.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectFileFromDrive = () => {
|
this.selectFileFromDrive = () => {
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
this.sending = true;
|
this.sending = true;
|
||||||
this.api('messaging/messages/create', {
|
this.api('messaging/messages/create', {
|
||||||
user_id: this.opts.user.id,
|
user_id: this.opts.user.id,
|
||||||
text: this.refs.text.value
|
text: this.$refs.text.value
|
||||||
}).then(message => {
|
}).then(message => {
|
||||||
this.clear();
|
this.clear();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
@ -167,7 +167,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.clear = () => {
|
this.clear = () => {
|
||||||
this.refs.text.value = '';
|
this.$refs.text.value = '';
|
||||||
this.files = [];
|
this.files = [];
|
||||||
this.update();
|
this.update();
|
||||||
};
|
};
|
||||||
|
|
|
@ -389,7 +389,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.search = () => {
|
this.search = () => {
|
||||||
const q = this.refs.search.value;
|
const q = this.$refs.search.value;
|
||||||
if (q == '') {
|
if (q == '') {
|
||||||
this.searchResult = [];
|
this.searchResult = [];
|
||||||
return;
|
return;
|
||||||
|
@ -416,7 +416,7 @@
|
||||||
case 40: // [↓]
|
case 40: // [↓]
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.refs.searchResult.childNodes[0].focus();
|
this.$refs.searchResult.childNodes[0].focus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -435,19 +435,19 @@
|
||||||
|
|
||||||
case e.which == 27: // [ESC]
|
case e.which == 27: // [ESC]
|
||||||
cancel();
|
cancel();
|
||||||
this.refs.search.focus();
|
this.$refs.search.focus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case e.which == 9 && e.shiftKey: // [TAB] + [Shift]
|
case e.which == 9 && e.shiftKey: // [TAB] + [Shift]
|
||||||
case e.which == 38: // [↑]
|
case e.which == 38: // [↑]
|
||||||
cancel();
|
cancel();
|
||||||
(this.refs.searchResult.childNodes[i].previousElementSibling || this.refs.searchResult.childNodes[this.searchResult.length - 1]).focus();
|
(this.$refs.searchResult.childNodes[i].previousElementSibling || this.$refs.searchResult.childNodes[this.searchResult.length - 1]).focus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case e.which == 9: // [TAB]
|
case e.which == 9: // [TAB]
|
||||||
case e.which == 40: // [↓]
|
case e.which == 40: // [↓]
|
||||||
cancel();
|
cancel();
|
||||||
(this.refs.searchResult.childNodes[i].nextElementSibling || this.refs.searchResult.childNodes[0]).focus();
|
(this.$refs.searchResult.childNodes[i].nextElementSibling || this.$refs.searchResult.childNodes[0]).focus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -217,9 +217,9 @@
|
||||||
if (this.message.text) {
|
if (this.message.text) {
|
||||||
const tokens = this.message.ast;
|
const tokens = this.message.ast;
|
||||||
|
|
||||||
this.refs.text.innerHTML = compile(tokens);
|
this.$refs.text.innerHTML = compile(tokens);
|
||||||
|
|
||||||
Array.from(this.refs.text.children).forEach(e => {
|
Array.from(this.$refs.text.children).forEach(e => {
|
||||||
if (e.tagName == 'MK-URL') riot.mount(e);
|
if (e.tagName == 'MK-URL') riot.mount(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@
|
||||||
tokens
|
tokens
|
||||||
.filter(t => t.type == 'link')
|
.filter(t => t.type == 'link')
|
||||||
.map(t => {
|
.map(t => {
|
||||||
const el = this.refs.text.appendChild(document.createElement('mk-url-preview'));
|
const el = this.$refs.text.appendChild(document.createElement('mk-url-preview'));
|
||||||
riot.mount(el, {
|
riot.mount(el, {
|
||||||
url: t.content
|
url: t.content
|
||||||
});
|
});
|
||||||
|
|
|
@ -296,7 +296,7 @@
|
||||||
this.scrollToBottom();
|
this.scrollToBottom();
|
||||||
n.parentNode.removeChild(n);
|
n.parentNode.removeChild(n);
|
||||||
};
|
};
|
||||||
this.refs.notifications.appendChild(n);
|
this.$refs.notifications.appendChild(n);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
n.style.opacity = 0;
|
n.style.opacity = 0;
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
this.add = () => {
|
this.add = () => {
|
||||||
this.choices.push('');
|
this.choices.push('');
|
||||||
this.update();
|
this.update();
|
||||||
this.refs.choices.childNodes[this.choices.length - 1].childNodes[0].focus();
|
this.$refs.choices.childNodes[this.choices.length - 1].childNodes[0].focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.remove = (i) => {
|
this.remove = (i) => {
|
||||||
|
|
|
@ -85,29 +85,29 @@
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
const rect = this.source.getBoundingClientRect();
|
const rect = this.source.getBoundingClientRect();
|
||||||
const width = this.refs.popover.offsetWidth;
|
const width = this.$refs.popover.offsetWidth;
|
||||||
const height = this.refs.popover.offsetHeight;
|
const height = this.$refs.popover.offsetHeight;
|
||||||
if (this.opts.compact) {
|
if (this.opts.compact) {
|
||||||
const x = rect.left + window.pageXOffset + (this.source.offsetWidth / 2);
|
const x = rect.left + window.pageXOffset + (this.source.offsetWidth / 2);
|
||||||
const y = rect.top + window.pageYOffset + (this.source.offsetHeight / 2);
|
const y = rect.top + window.pageYOffset + (this.source.offsetHeight / 2);
|
||||||
this.refs.popover.style.left = (x - (width / 2)) + 'px';
|
this.$refs.popover.style.left = (x - (width / 2)) + 'px';
|
||||||
this.refs.popover.style.top = (y - (height / 2)) + 'px';
|
this.$refs.popover.style.top = (y - (height / 2)) + 'px';
|
||||||
} else {
|
} else {
|
||||||
const x = rect.left + window.pageXOffset + (this.source.offsetWidth / 2);
|
const x = rect.left + window.pageXOffset + (this.source.offsetWidth / 2);
|
||||||
const y = rect.top + window.pageYOffset + this.source.offsetHeight;
|
const y = rect.top + window.pageYOffset + this.source.offsetHeight;
|
||||||
this.refs.popover.style.left = (x - (width / 2)) + 'px';
|
this.$refs.popover.style.left = (x - (width / 2)) + 'px';
|
||||||
this.refs.popover.style.top = y + 'px';
|
this.$refs.popover.style.top = y + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.backdrop,
|
targets: this.$refs.backdrop,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
duration: 100,
|
duration: 100,
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
});
|
});
|
||||||
|
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.popover,
|
targets: this.$refs.popover,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
scale: [0.5, 1],
|
scale: [0.5, 1],
|
||||||
duration: 500
|
duration: 500
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.categorize = () => {
|
this.categorize = () => {
|
||||||
const category = this.refs.categorySelect.options[this.refs.categorySelect.selectedIndex].value;
|
const category = this.$refs.categorySelect.options[this.$refs.categorySelect.selectedIndex].value;
|
||||||
this.api('posts/categorize', {
|
this.api('posts/categorize', {
|
||||||
post_id: this.post.id,
|
post_id: this.post.id,
|
||||||
category: category
|
category: category
|
||||||
|
@ -135,17 +135,17 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
this.refs.backdrop.style.pointerEvents = 'none';
|
this.$refs.backdrop.style.pointerEvents = 'none';
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.backdrop,
|
targets: this.$refs.backdrop,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
duration: 200,
|
duration: 200,
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.popover.style.pointerEvents = 'none';
|
this.$refs.popover.style.pointerEvents = 'none';
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.popover,
|
targets: this.$refs.popover,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
duration: 200,
|
duration: 200,
|
||||||
|
|
|
@ -25,10 +25,40 @@
|
||||||
const placeholder = '%i18n:common.tags.mk-reaction-picker.choose-reaction%';
|
const placeholder = '%i18n:common.tags.mk-reaction-picker.choose-reaction%';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['post', 'cb'],
|
props: ['post', 'source', 'compact', 'cb'],
|
||||||
data: {
|
data: {
|
||||||
title: placeholder
|
title: placeholder
|
||||||
},
|
},
|
||||||
|
created: function() {
|
||||||
|
const rect = this.source.getBoundingClientRect();
|
||||||
|
const width = this.$refs.popover.offsetWidth;
|
||||||
|
const height = this.$refs.popover.offsetHeight;
|
||||||
|
if (this.compact) {
|
||||||
|
const x = rect.left + window.pageXOffset + (this.source.offsetWidth / 2);
|
||||||
|
const y = rect.top + window.pageYOffset + (this.source.offsetHeight / 2);
|
||||||
|
this.$refs.popover.style.left = (x - (width / 2)) + 'px';
|
||||||
|
this.$refs.popover.style.top = (y - (height / 2)) + 'px';
|
||||||
|
} else {
|
||||||
|
const x = rect.left + window.pageXOffset + (this.source.offsetWidth / 2);
|
||||||
|
const y = rect.top + window.pageYOffset + this.source.offsetHeight;
|
||||||
|
this.$refs.popover.style.left = (x - (width / 2)) + 'px';
|
||||||
|
this.$refs.popover.style.top = y + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
anime({
|
||||||
|
targets: this.$refs.backdrop,
|
||||||
|
opacity: 1,
|
||||||
|
duration: 100,
|
||||||
|
easing: 'linear'
|
||||||
|
});
|
||||||
|
|
||||||
|
anime({
|
||||||
|
targets: this.$refs.popover,
|
||||||
|
opacity: 1,
|
||||||
|
scale: [0.5, 1],
|
||||||
|
duration: 500
|
||||||
|
});
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
react: function(reaction) {
|
react: function(reaction) {
|
||||||
api('posts/reactions/create', {
|
api('posts/reactions/create', {
|
||||||
|
@ -54,34 +84,6 @@
|
||||||
this.source = this.opts.source;
|
this.source = this.opts.source;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
const rect = this.source.getBoundingClientRect();
|
|
||||||
const width = this.refs.popover.offsetWidth;
|
|
||||||
const height = this.refs.popover.offsetHeight;
|
|
||||||
if (this.opts.compact) {
|
|
||||||
const x = rect.left + window.pageXOffset + (this.source.offsetWidth / 2);
|
|
||||||
const y = rect.top + window.pageYOffset + (this.source.offsetHeight / 2);
|
|
||||||
this.refs.popover.style.left = (x - (width / 2)) + 'px';
|
|
||||||
this.refs.popover.style.top = (y - (height / 2)) + 'px';
|
|
||||||
} else {
|
|
||||||
const x = rect.left + window.pageXOffset + (this.source.offsetWidth / 2);
|
|
||||||
const y = rect.top + window.pageYOffset + this.source.offsetHeight;
|
|
||||||
this.refs.popover.style.left = (x - (width / 2)) + 'px';
|
|
||||||
this.refs.popover.style.top = y + 'px';
|
|
||||||
}
|
|
||||||
|
|
||||||
anime({
|
|
||||||
targets: this.refs.backdrop,
|
|
||||||
opacity: 1,
|
|
||||||
duration: 100,
|
|
||||||
easing: 'linear'
|
|
||||||
});
|
|
||||||
|
|
||||||
anime({
|
|
||||||
targets: this.refs.popover,
|
|
||||||
opacity: 1,
|
|
||||||
scale: [0.5, 1],
|
|
||||||
duration: 500
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.react = reaction => {
|
this.react = reaction => {
|
||||||
|
@ -89,17 +91,17 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
this.refs.backdrop.style.pointerEvents = 'none';
|
this.$refs.backdrop.style.pointerEvents = 'none';
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.backdrop,
|
targets: this.$refs.backdrop,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
duration: 200,
|
duration: 200,
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.popover.style.pointerEvents = 'none';
|
this.$refs.popover.style.pointerEvents = 'none';
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.popover,
|
targets: this.$refs.popover,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
duration: 200,
|
duration: 200,
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
this.show = false;
|
this.show = false;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
hljs.highlightBlock(this.refs.headers);
|
hljs.highlightBlock(this.$refs.headers);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.toggle = () => {
|
this.toggle = () => {
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
|
|
||||||
this.oninput = () => {
|
this.oninput = () => {
|
||||||
this.api('users/show', {
|
this.api('users/show', {
|
||||||
username: this.refs.username.value
|
username: this.$refs.username.value
|
||||||
}).then(user => {
|
}).then(user => {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.trigger('user', user);
|
this.trigger('user', user);
|
||||||
|
@ -119,16 +119,16 @@
|
||||||
this.onsubmit = e => {
|
this.onsubmit = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (this.refs.username.value == '') {
|
if (this.$refs.username.value == '') {
|
||||||
this.refs.username.focus();
|
this.$refs.username.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.refs.password.value == '') {
|
if (this.$refs.password.value == '') {
|
||||||
this.refs.password.focus();
|
this.$refs.password.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.user && this.user.two_factor_enabled && this.refs.token.value == '') {
|
if (this.user && this.user.two_factor_enabled && this.$refs.token.value == '') {
|
||||||
this.refs.token.focus();
|
this.$refs.token.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +137,9 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.api('signin', {
|
this.api('signin', {
|
||||||
username: this.refs.username.value,
|
username: this.$refs.username.value,
|
||||||
password: this.refs.password.value,
|
password: this.$refs.password.value,
|
||||||
token: this.user && this.user.two_factor_enabled ? this.refs.token.value : undefined
|
token: this.user && this.user.two_factor_enabled ? this.$refs.token.value : undefined
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
location.reload();
|
location.reload();
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|
|
@ -208,7 +208,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onChangeUsername = () => {
|
this.onChangeUsername = () => {
|
||||||
const username = this.refs.username.value;
|
const username = this.$refs.username.value;
|
||||||
|
|
||||||
if (username == '') {
|
if (username == '') {
|
||||||
this.update({
|
this.update({
|
||||||
|
@ -248,7 +248,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onChangePassword = () => {
|
this.onChangePassword = () => {
|
||||||
const password = this.refs.password.value;
|
const password = this.$refs.password.value;
|
||||||
|
|
||||||
if (password == '') {
|
if (password == '') {
|
||||||
this.passwordStrength = '';
|
this.passwordStrength = '';
|
||||||
|
@ -258,12 +258,12 @@
|
||||||
const strength = getPasswordStrength(password);
|
const strength = getPasswordStrength(password);
|
||||||
this.passwordStrength = strength > 0.7 ? 'high' : strength > 0.3 ? 'medium' : 'low';
|
this.passwordStrength = strength > 0.7 ? 'high' : strength > 0.3 ? 'medium' : 'low';
|
||||||
this.update();
|
this.update();
|
||||||
this.refs.passwordMetar.style.width = `${strength * 100}%`;
|
this.$refs.passwordMetar.style.width = `${strength * 100}%`;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onChangePasswordRetype = () => {
|
this.onChangePasswordRetype = () => {
|
||||||
const password = this.refs.password.value;
|
const password = this.$refs.password.value;
|
||||||
const retypedPassword = this.refs.passwordRetype.value;
|
const retypedPassword = this.$refs.passwordRetype.value;
|
||||||
|
|
||||||
if (retypedPassword == '') {
|
if (retypedPassword == '') {
|
||||||
this.passwordRetypeState = null;
|
this.passwordRetypeState = null;
|
||||||
|
@ -276,8 +276,8 @@
|
||||||
this.onsubmit = e => {
|
this.onsubmit = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const username = this.refs.username.value;
|
const username = this.$refs.username.value;
|
||||||
const password = this.refs.password.value;
|
const password = this.$refs.password.value;
|
||||||
|
|
||||||
const locker = document.body.appendChild(document.createElement('mk-locker'));
|
const locker = document.body.appendChild(document.createElement('mk-locker'));
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
const m = now.getMinutes();
|
const m = now.getMinutes();
|
||||||
const h = now.getHours();
|
const h = now.getHours();
|
||||||
|
|
||||||
const ctx = this.refs.canvas.getContext('2d');
|
const ctx = this.$refs.canvas.getContext('2d');
|
||||||
const canvW = this.refs.canvas.width;
|
const canvW = this.$refs.canvas.width;
|
||||||
const canvH = this.refs.canvas.height;
|
const canvH = this.$refs.canvas.height;
|
||||||
ctx.clearRect(0, 0, canvW, canvH);
|
ctx.clearRect(0, 0, canvW, canvH);
|
||||||
|
|
||||||
{ // 背景
|
{ // 背景
|
||||||
|
|
|
@ -177,12 +177,12 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.applySelect = () => {
|
this.applySelect = () => {
|
||||||
Array.from(this.refs.users.children).forEach(el => {
|
Array.from(this.$refs.users.children).forEach(el => {
|
||||||
el.removeAttribute('data-selected');
|
el.removeAttribute('data-selected');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.users.children[this.select].setAttribute('data-selected', 'true');
|
this.$refs.users.children[this.select].setAttribute('data-selected', 'true');
|
||||||
this.refs.users.children[this.select].focus();
|
this.$refs.users.children[this.select].focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.complete = user => {
|
this.complete = user => {
|
||||||
|
|
|
@ -168,7 +168,7 @@
|
||||||
this.cropper = null;
|
this.cropper = null;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.img = this.refs.window.refs.img;
|
this.img = this.$refs.window.refs.img;
|
||||||
this.cropper = new Cropper(this.img, {
|
this.cropper = new Cropper(this.img, {
|
||||||
aspectRatio: this.aspectRatio,
|
aspectRatio: this.aspectRatio,
|
||||||
highlight: false,
|
highlight: false,
|
||||||
|
@ -179,18 +179,18 @@
|
||||||
this.ok = () => {
|
this.ok = () => {
|
||||||
this.cropper.getCroppedCanvas().toBlob(blob => {
|
this.cropper.getCroppedCanvas().toBlob(blob => {
|
||||||
this.trigger('cropped', blob);
|
this.trigger('cropped', blob);
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.skip = () => {
|
this.skip = () => {
|
||||||
this.trigger('skipped');
|
this.trigger('skipped');
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.cancel = () => {
|
this.cancel = () => {
|
||||||
this.trigger('canceled');
|
this.trigger('canceled');
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-crop-window>
|
</mk-crop-window>
|
||||||
|
|
|
@ -62,8 +62,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
this.refs.bg.style.pointerEvents = 'none';
|
this.$refs.bg.style.pointerEvents = 'none';
|
||||||
this.refs.main.style.pointerEvents = 'none';
|
this.$refs.main.style.pointerEvents = 'none';
|
||||||
anime({
|
anime({
|
||||||
targets: this.root,
|
targets: this.root,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
|
|
|
@ -94,19 +94,19 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.header.innerHTML = this.opts.title;
|
this.$refs.header.innerHTML = this.opts.title;
|
||||||
this.refs.body.innerHTML = this.opts.text;
|
this.$refs.body.innerHTML = this.opts.text;
|
||||||
|
|
||||||
this.refs.bg.style.pointerEvents = 'auto';
|
this.$refs.bg.style.pointerEvents = 'auto';
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.bg,
|
targets: this.$refs.bg,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
duration: 100,
|
duration: 100,
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
});
|
});
|
||||||
|
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.main,
|
targets: this.$refs.main,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
scale: [1.2, 1],
|
scale: [1.2, 1],
|
||||||
duration: 300,
|
duration: 300,
|
||||||
|
@ -115,17 +115,17 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
this.refs.bg.style.pointerEvents = 'none';
|
this.$refs.bg.style.pointerEvents = 'none';
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.bg,
|
targets: this.$refs.bg,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
duration: 300,
|
duration: 300,
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.main.style.pointerEvents = 'none';
|
this.$refs.main.style.pointerEvents = 'none';
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.main,
|
targets: this.$refs.main,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
scale: 0.8,
|
scale: 0.8,
|
||||||
duration: 300,
|
duration: 300,
|
||||||
|
|
|
@ -16,29 +16,29 @@
|
||||||
this.browser = this.opts.browser;
|
this.browser = this.opts.browser;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.ctx.on('closed', () => {
|
this.$refs.ctx.on('closed', () => {
|
||||||
this.trigger('closed');
|
this.trigger('closed');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.open = pos => {
|
this.open = pos => {
|
||||||
this.refs.ctx.open(pos);
|
this.$refs.ctx.open(pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createFolder = () => {
|
this.createFolder = () => {
|
||||||
this.browser.createFolder();
|
this.browser.createFolder();
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.upload = () => {
|
this.upload = () => {
|
||||||
this.browser.selectLocalFile();
|
this.browser.selectLocalFile();
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.urlUpload = () => {
|
this.urlUpload = () => {
|
||||||
this.browser.urlUpload();
|
this.browser.urlUpload();
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-browser-base-contextmenu>
|
</mk-drive-browser-base-contextmenu>
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
this.folder = this.opts.folder ? this.opts.folder : null;
|
this.folder = this.opts.folder ? this.opts.folder : null;
|
||||||
|
|
||||||
this.popout = () => {
|
this.popout = () => {
|
||||||
const folder = this.refs.window.refs.browser.folder;
|
const folder = this.$refs.window.refs.browser.folder;
|
||||||
if (folder) {
|
if (folder) {
|
||||||
return `${_URL_}/i/drive/folder/${folder.id}`;
|
return `${_URL_}/i/drive/folder/${folder.id}`;
|
||||||
} else {
|
} else {
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.window.on('closed', () => {
|
this.$refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-browser-window>
|
</mk-drive-browser-window>
|
||||||
|
|
|
@ -275,11 +275,11 @@
|
||||||
this.isDragSource = false;
|
this.isDragSource = false;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.uploader.on('uploaded', file => {
|
this.$refs.uploader.on('uploaded', file => {
|
||||||
this.addFile(file, true);
|
this.addFile(file, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.uploader.on('change-uploads', uploads => {
|
this.$refs.uploader.on('change-uploads', uploads => {
|
||||||
this.update({
|
this.update({
|
||||||
uploads: uploads
|
uploads: uploads
|
||||||
});
|
});
|
||||||
|
@ -332,35 +332,35 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onmousedown = e => {
|
this.onmousedown = e => {
|
||||||
if (contains(this.refs.foldersContainer, e.target) || contains(this.refs.filesContainer, e.target)) return true;
|
if (contains(this.$refs.foldersContainer, e.target) || contains(this.$refs.filesContainer, e.target)) return true;
|
||||||
|
|
||||||
const rect = this.refs.main.getBoundingClientRect();
|
const rect = this.$refs.main.getBoundingClientRect();
|
||||||
|
|
||||||
const left = e.pageX + this.refs.main.scrollLeft - rect.left - window.pageXOffset
|
const left = e.pageX + this.$refs.main.scrollLeft - rect.left - window.pageXOffset
|
||||||
const top = e.pageY + this.refs.main.scrollTop - rect.top - window.pageYOffset
|
const top = e.pageY + this.$refs.main.scrollTop - rect.top - window.pageYOffset
|
||||||
|
|
||||||
const move = e => {
|
const move = e => {
|
||||||
this.refs.selection.style.display = 'block';
|
this.$refs.selection.style.display = 'block';
|
||||||
|
|
||||||
const cursorX = e.pageX + this.refs.main.scrollLeft - rect.left - window.pageXOffset;
|
const cursorX = e.pageX + this.$refs.main.scrollLeft - rect.left - window.pageXOffset;
|
||||||
const cursorY = e.pageY + this.refs.main.scrollTop - rect.top - window.pageYOffset;
|
const cursorY = e.pageY + this.$refs.main.scrollTop - rect.top - window.pageYOffset;
|
||||||
const w = cursorX - left;
|
const w = cursorX - left;
|
||||||
const h = cursorY - top;
|
const 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 = cursorX + '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 = cursorY + 'px';
|
this.$refs.selection.style.top = cursorY + 'px';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@
|
||||||
document.documentElement.removeEventListener('mousemove', move);
|
document.documentElement.removeEventListener('mousemove', move);
|
||||||
document.documentElement.removeEventListener('mouseup', up);
|
document.documentElement.removeEventListener('mouseup', up);
|
||||||
|
|
||||||
this.refs.selection.style.display = 'none';
|
this.$refs.selection.style.display = 'none';
|
||||||
};
|
};
|
||||||
|
|
||||||
document.documentElement.addEventListener('mousemove', move);
|
document.documentElement.addEventListener('mousemove', move);
|
||||||
|
@ -482,7 +482,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectLocalFile = () => {
|
this.selectLocalFile = () => {
|
||||||
this.refs.fileInput.click();
|
this.$refs.fileInput.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.urlUpload = () => {
|
this.urlUpload = () => {
|
||||||
|
@ -516,14 +516,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.changeFileInput = () => {
|
this.changeFileInput = () => {
|
||||||
Array.from(this.refs.fileInput.files).forEach(file => {
|
Array.from(this.$refs.fileInput.files).forEach(file => {
|
||||||
this.upload(file, this.folder);
|
this.upload(file, this.folder);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.upload = (file, folder) => {
|
this.upload = (file, folder) => {
|
||||||
if (folder && typeof folder == 'object') folder = folder.id;
|
if (folder && typeof folder == 'object') folder = folder.id;
|
||||||
this.refs.uploader.upload(file, folder);
|
this.$refs.uploader.upload(file, folder);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.chooseFile = file => {
|
this.chooseFile = file => {
|
||||||
|
|
|
@ -48,18 +48,18 @@
|
||||||
this.file = this.opts.file;
|
this.file = this.opts.file;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.ctx.on('closed', () => {
|
this.$refs.ctx.on('closed', () => {
|
||||||
this.trigger('closed');
|
this.trigger('closed');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.open = pos => {
|
this.open = pos => {
|
||||||
this.refs.ctx.open(pos);
|
this.$refs.ctx.open(pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.rename = () => {
|
this.rename = () => {
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
|
|
||||||
inputDialog('%i18n:desktop.tags.mk-drive-browser-file-contextmenu.rename-file%', '%i18n:desktop.tags.mk-drive-browser-file-contextmenu.input-new-file-name%', this.file.name, name => {
|
inputDialog('%i18n:desktop.tags.mk-drive-browser-file-contextmenu.rename-file%', '%i18n:desktop.tags.mk-drive-browser-file-contextmenu.input-new-file-name%', this.file.name, name => {
|
||||||
this.api('drive/files/update', {
|
this.api('drive/files/update', {
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
this.copyUrl = () => {
|
this.copyUrl = () => {
|
||||||
copyToClipboard(this.file.url);
|
copyToClipboard(this.file.url);
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
dialog('%fa:check%%i18n:desktop.tags.mk-drive-browser-file-contextmenu.copied%',
|
dialog('%fa:check%%i18n:desktop.tags.mk-drive-browser-file-contextmenu.copied%',
|
||||||
'%i18n:desktop.tags.mk-drive-browser-file-contextmenu.copied-url-to-clipboard%', [{
|
'%i18n:desktop.tags.mk-drive-browser-file-contextmenu.copied-url-to-clipboard%', [{
|
||||||
text: '%i18n:common.ok%'
|
text: '%i18n:common.ok%'
|
||||||
|
@ -79,16 +79,16 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.download = () => {
|
this.download = () => {
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setAvatar = () => {
|
this.setAvatar = () => {
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
updateAvatar(this.I, null, this.file);
|
updateAvatar(this.I, null, this.file);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setBanner = () => {
|
this.setBanner = () => {
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
updateBanner(this.I, null, this.file);
|
updateBanner(this.I, null, this.file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@
|
||||||
this.onload = () => {
|
this.onload = () => {
|
||||||
if (this.file.properties.average_color) {
|
if (this.file.properties.average_color) {
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.thumbnail,
|
targets: this.$refs.thumbnail,
|
||||||
backgroundColor: `rgba(${this.file.properties.average_color.join(',')}, 0)`,
|
backgroundColor: `rgba(${this.file.properties.average_color.join(',')}, 0)`,
|
||||||
duration: 100,
|
duration: 100,
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
this.folder = this.opts.folder;
|
this.folder = this.opts.folder;
|
||||||
|
|
||||||
this.open = pos => {
|
this.open = pos => {
|
||||||
this.refs.ctx.open(pos);
|
this.$refs.ctx.open(pos);
|
||||||
|
|
||||||
this.refs.ctx.on('closed', () => {
|
this.$refs.ctx.on('closed', () => {
|
||||||
this.trigger('closed');
|
this.trigger('closed');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
|
@ -36,21 +36,21 @@
|
||||||
|
|
||||||
this.move = () => {
|
this.move = () => {
|
||||||
this.browser.move(this.folder.id);
|
this.browser.move(this.folder.id);
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.newWindow = () => {
|
this.newWindow = () => {
|
||||||
this.browser.newWindow(this.folder.id);
|
this.browser.newWindow(this.folder.id);
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createFolder = () => {
|
this.createFolder = () => {
|
||||||
this.browser.createFolder();
|
this.browser.createFolder();
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.rename = () => {
|
this.rename = () => {
|
||||||
this.refs.ctx.close();
|
this.$refs.ctx.close();
|
||||||
|
|
||||||
inputDialog('%i18n:desktop.tags.mk-drive-browser-folder-contextmenu.rename-folder%', '%i18n:desktop.tags.mk-drive-browser-folder-contextmenu.input-new-folder-name%', this.folder.name, name => {
|
inputDialog('%i18n:desktop.tags.mk-drive-browser-folder-contextmenu.rename-folder%', '%i18n:desktop.tags.mk-drive-browser-folder-contextmenu.input-new-folder-name%', this.folder.name, name => {
|
||||||
this.api('drive/folders/update', {
|
this.api('drive/folders/update', {
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
if (this.requests.length > 30) this.requests.shift();
|
if (this.requests.length > 30) this.requests.shift();
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
this.refs.log.scrollTop = this.refs.log.scrollHeight;
|
this.$refs.log.scrollTop = this.$refs.log.scrollHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.func = () => {
|
this.func = () => {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
this.initializing = true;
|
this.initializing = true;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.activity.on('view-changed', view => {
|
this.$refs.activity.on('view-changed', view => {
|
||||||
this.data.view = view;
|
this.data.view = view;
|
||||||
this.save();
|
this.save();
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
this.func = () => {
|
this.func = () => {
|
||||||
if (++this.data.design == 3) this.data.design = 0;
|
if (++this.data.design == 3) this.data.design = 0;
|
||||||
this.refs.activity.update({
|
this.$refs.activity.update({
|
||||||
design: this.data.design
|
design: this.data.design
|
||||||
});
|
});
|
||||||
this.save();
|
this.save();
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
channel: channel
|
channel: channel
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.channel.zap(channel);
|
this.$refs.channel.zap(channel);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.scrollToBottom = () => {
|
this.scrollToBottom = () => {
|
||||||
this.refs.posts.scrollTop = this.refs.posts.scrollHeight;
|
this.$refs.posts.scrollTop = this.$refs.posts.scrollHeight;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-channel>
|
</mk-channel>
|
||||||
|
@ -279,7 +279,7 @@
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
|
|
||||||
this.clear = () => {
|
this.clear = () => {
|
||||||
this.refs.text.value = '';
|
this.$refs.text.value = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onkeydown = e => {
|
this.onkeydown = e => {
|
||||||
|
@ -291,7 +291,7 @@
|
||||||
wait: true
|
wait: true
|
||||||
});
|
});
|
||||||
|
|
||||||
let text = this.refs.text.value;
|
let text = this.$refs.text.value;
|
||||||
let reply = null;
|
let reply = null;
|
||||||
|
|
||||||
if (/^>>([0-9]+) /.test(text)) {
|
if (/^>>([0-9]+) /.test(text)) {
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
this.onDocumentKeydown = e => {
|
this.onDocumentKeydown = e => {
|
||||||
if (e.target.tagName != 'INPUT' && tag != 'TEXTAREA') {
|
if (e.target.tagName != 'INPUT' && tag != 'TEXTAREA') {
|
||||||
if (e.which == 84) { // t
|
if (e.which == 84) { // t
|
||||||
this.refs.timeline.focus();
|
this.$refs.timeline.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -89,24 +89,24 @@
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isEmpty: posts.length == 0
|
isEmpty: posts.length == 0
|
||||||
});
|
});
|
||||||
this.refs.timeline.setPosts(posts);
|
this.$refs.timeline.setPosts(posts);
|
||||||
if (cb) cb();
|
if (cb) cb();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.more = () => {
|
this.more = () => {
|
||||||
if (this.moreLoading || this.isLoading || this.refs.timeline.posts.length == 0) return;
|
if (this.moreLoading || this.isLoading || this.$refs.timeline.posts.length == 0) return;
|
||||||
this.update({
|
this.update({
|
||||||
moreLoading: true
|
moreLoading: true
|
||||||
});
|
});
|
||||||
this.api('posts/mentions', {
|
this.api('posts/mentions', {
|
||||||
following: this.mode == 'following',
|
following: this.mode == 'following',
|
||||||
until_id: this.refs.timeline.tail().id
|
until_id: this.$refs.timeline.tail().id
|
||||||
}).then(posts => {
|
}).then(posts => {
|
||||||
this.update({
|
this.update({
|
||||||
moreLoading: false
|
moreLoading: false
|
||||||
});
|
});
|
||||||
this.refs.timeline.prependPosts(posts);
|
this.$refs.timeline.prependPosts(posts);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
this.mixin('widget');
|
this.mixin('widget');
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.index.on('navigate-user', user => {
|
this.$refs.index.on('navigate-user', user => {
|
||||||
riot.mount(document.body.appendChild(document.createElement('mk-messaging-room-window')), {
|
riot.mount(document.body.appendChild(document.createElement('mk-messaging-room-window')), {
|
||||||
user: user
|
user: user
|
||||||
});
|
});
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.api('posts/create', {
|
this.api('posts/create', {
|
||||||
text: this.refs.text.value
|
text: this.$refs.text.value
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
this.clear();
|
this.clear();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.clear = () => {
|
this.clear = () => {
|
||||||
this.refs.text.value = '';
|
this.$refs.text.value = '';
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-post-form-home-widget>
|
</mk-post-form-home-widget>
|
||||||
|
|
|
@ -284,7 +284,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onStats = stats => {
|
this.onStats = stats => {
|
||||||
this.refs.pie.render(stats.cpu_usage);
|
this.$refs.pie.render(stats.cpu_usage);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-server-home-widget-cpu>
|
</mk-server-home-widget-cpu>
|
||||||
|
@ -344,7 +344,7 @@
|
||||||
|
|
||||||
this.onStats = stats => {
|
this.onStats = stats => {
|
||||||
stats.mem.used = stats.mem.total - stats.mem.free;
|
stats.mem.used = stats.mem.total - stats.mem.free;
|
||||||
this.refs.pie.render(stats.mem.used / stats.mem.total);
|
this.$refs.pie.render(stats.mem.used / stats.mem.total);
|
||||||
|
|
||||||
this.update({
|
this.update({
|
||||||
total: stats.mem.total,
|
total: stats.mem.total,
|
||||||
|
@ -411,7 +411,7 @@
|
||||||
this.onStats = stats => {
|
this.onStats = stats => {
|
||||||
stats.disk.used = stats.disk.total - stats.disk.free;
|
stats.disk.used = stats.disk.total - stats.disk.free;
|
||||||
|
|
||||||
this.refs.pie.render(stats.disk.used / stats.disk.total);
|
this.$refs.pie.render(stats.disk.used / stats.disk.total);
|
||||||
|
|
||||||
this.update({
|
this.update({
|
||||||
total: stats.disk.total,
|
total: stats.disk.total,
|
||||||
|
|
|
@ -101,17 +101,17 @@
|
||||||
const index = Math.floor(Math.random() * this.images.length);
|
const index = Math.floor(Math.random() * this.images.length);
|
||||||
const img = `url(${ this.images[index].url }?thumbnail&size=1024)`;
|
const img = `url(${ this.images[index].url }?thumbnail&size=1024)`;
|
||||||
|
|
||||||
this.refs.slideB.style.backgroundImage = img;
|
this.$refs.slideB.style.backgroundImage = img;
|
||||||
|
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.slideB,
|
targets: this.$refs.slideB,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
duration: 1000,
|
duration: 1000,
|
||||||
easing: 'linear',
|
easing: 'linear',
|
||||||
complete: () => {
|
complete: () => {
|
||||||
this.refs.slideA.style.backgroundImage = img;
|
this.$refs.slideA.style.backgroundImage = img;
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.slideB,
|
targets: this.$refs.slideB,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
duration: 0
|
duration: 0
|
||||||
});
|
});
|
||||||
|
@ -133,8 +133,8 @@
|
||||||
fetching: false,
|
fetching: false,
|
||||||
images: images
|
images: images
|
||||||
});
|
});
|
||||||
this.refs.slideA.style.backgroundImage = '';
|
this.$refs.slideA.style.backgroundImage = '';
|
||||||
this.refs.slideB.style.backgroundImage = '';
|
this.$refs.slideB.style.backgroundImage = '';
|
||||||
this.change();
|
this.change();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
this.onDocumentKeydown = e => {
|
this.onDocumentKeydown = e => {
|
||||||
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
|
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
|
||||||
if (e.which == 84) { // t
|
if (e.which == 84) { // t
|
||||||
this.refs.timeline.focus();
|
this.$refs.timeline.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -92,23 +92,23 @@
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isEmpty: posts.length == 0
|
isEmpty: posts.length == 0
|
||||||
});
|
});
|
||||||
this.refs.timeline.setPosts(posts);
|
this.$refs.timeline.setPosts(posts);
|
||||||
if (cb) cb();
|
if (cb) cb();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.more = () => {
|
this.more = () => {
|
||||||
if (this.moreLoading || this.isLoading || this.refs.timeline.posts.length == 0) return;
|
if (this.moreLoading || this.isLoading || this.$refs.timeline.posts.length == 0) return;
|
||||||
this.update({
|
this.update({
|
||||||
moreLoading: true
|
moreLoading: true
|
||||||
});
|
});
|
||||||
this.api('posts/timeline', {
|
this.api('posts/timeline', {
|
||||||
until_id: this.refs.timeline.tail().id
|
until_id: this.$refs.timeline.tail().id
|
||||||
}).then(posts => {
|
}).then(posts => {
|
||||||
this.update({
|
this.update({
|
||||||
moreLoading: false
|
moreLoading: false
|
||||||
});
|
});
|
||||||
this.refs.timeline.prependPosts(posts);
|
this.$refs.timeline.prependPosts(posts);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
this.update({
|
this.update({
|
||||||
isEmpty: false
|
isEmpty: false
|
||||||
});
|
});
|
||||||
this.refs.timeline.addPost(post);
|
this.$refs.timeline.addPost(post);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onStreamFollow = () => {
|
this.onStreamFollow = () => {
|
||||||
|
|
|
@ -69,12 +69,12 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.set = () => {
|
this.set = () => {
|
||||||
this.refs.text.innerHTML = this.tips[Math.floor(Math.random() * this.tips.length)];
|
this.$refs.text.innerHTML = this.tips[Math.floor(Math.random() * this.tips.length)];
|
||||||
};
|
};
|
||||||
|
|
||||||
this.change = () => {
|
this.change = () => {
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.tip,
|
targets: this.$refs.tip,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
duration: 500,
|
duration: 500,
|
||||||
easing: 'linear',
|
easing: 'linear',
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.tip,
|
targets: this.$refs.tip,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
duration: 500,
|
duration: 500,
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
this.bakedHomeData = this.bakeHomeData();
|
this.bakedHomeData = this.bakeHomeData();
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.tl.on('loaded', () => {
|
this.$refs.tl.on('loaded', () => {
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -212,11 +212,11 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.opts.customize) {
|
if (!this.opts.customize) {
|
||||||
if (this.refs.left.children.length == 0) {
|
if (this.$refs.left.children.length == 0) {
|
||||||
this.refs.left.parentNode.removeChild(this.refs.left);
|
this.$refs.left.parentNode.removeChild(this.$refs.left);
|
||||||
}
|
}
|
||||||
if (this.refs.right.children.length == 0) {
|
if (this.$refs.right.children.length == 0) {
|
||||||
this.refs.right.parentNode.removeChild(this.refs.right);
|
this.$refs.right.parentNode.removeChild(this.$refs.right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,10 +242,10 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
new Sortable(this.refs.left, sortableOption);
|
new Sortable(this.$refs.left, sortableOption);
|
||||||
new Sortable(this.refs.right, sortableOption);
|
new Sortable(this.$refs.right, sortableOption);
|
||||||
new Sortable(this.refs.maintop, sortableOption);
|
new Sortable(this.$refs.maintop, sortableOption);
|
||||||
new Sortable(this.refs.trash, Object.assign({}, sortableOption, {
|
new Sortable(this.$refs.trash, Object.assign({}, sortableOption, {
|
||||||
onAdd: evt => {
|
onAdd: evt => {
|
||||||
const el = evt.item;
|
const el = evt.item;
|
||||||
const id = el.getAttribute('data-widget-id');
|
const id = el.getAttribute('data-widget-id');
|
||||||
|
@ -257,8 +257,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.opts.customize) {
|
if (!this.opts.customize) {
|
||||||
this.scrollFollowerLeft = this.refs.left.parentNode ? new ScrollFollower(this.refs.left, this.root.getBoundingClientRect().top) : null;
|
this.scrollFollowerLeft = this.$refs.left.parentNode ? new ScrollFollower(this.$refs.left, this.root.getBoundingClientRect().top) : null;
|
||||||
this.scrollFollowerRight = this.refs.right.parentNode ? new ScrollFollower(this.refs.right, this.root.getBoundingClientRect().top) : null;
|
this.scrollFollowerRight = this.$refs.right.parentNode ? new ScrollFollower(this.$refs.right, this.root.getBoundingClientRect().top) : null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -299,23 +299,23 @@
|
||||||
switch (widget.place) {
|
switch (widget.place) {
|
||||||
case 'left':
|
case 'left':
|
||||||
if (prepend) {
|
if (prepend) {
|
||||||
this.refs.left.insertBefore(actualEl, this.refs.left.firstChild);
|
this.$refs.left.insertBefore(actualEl, this.$refs.left.firstChild);
|
||||||
} else {
|
} else {
|
||||||
this.refs.left.appendChild(actualEl);
|
this.$refs.left.appendChild(actualEl);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'right':
|
case 'right':
|
||||||
if (prepend) {
|
if (prepend) {
|
||||||
this.refs.right.insertBefore(actualEl, this.refs.right.firstChild);
|
this.$refs.right.insertBefore(actualEl, this.$refs.right.firstChild);
|
||||||
} else {
|
} else {
|
||||||
this.refs.right.appendChild(actualEl);
|
this.$refs.right.appendChild(actualEl);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'main':
|
case 'main':
|
||||||
if (this.opts.customize) {
|
if (this.opts.customize) {
|
||||||
this.refs.maintop.appendChild(actualEl);
|
this.$refs.maintop.appendChild(actualEl);
|
||||||
} else {
|
} else {
|
||||||
this.refs.main.insertBefore(actualEl, this.refs.tl.root);
|
this.$refs.main.insertBefore(actualEl, this.$refs.tl.root);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@
|
||||||
id: widget.id,
|
id: widget.id,
|
||||||
data: widget.data,
|
data: widget.data,
|
||||||
place: widget.place,
|
place: widget.place,
|
||||||
tl: this.refs.tl
|
tl: this.$refs.tl
|
||||||
})[0];
|
})[0];
|
||||||
|
|
||||||
this.home.push(tag);
|
this.home.push(tag);
|
||||||
|
@ -341,7 +341,7 @@
|
||||||
|
|
||||||
this.addWidget = () => {
|
this.addWidget = () => {
|
||||||
const widget = {
|
const widget = {
|
||||||
name: this.refs.widgetSelector.options[this.refs.widgetSelector.selectedIndex].value,
|
name: this.$refs.widgetSelector.options[this.$refs.widgetSelector.selectedIndex].value,
|
||||||
id: uuid(),
|
id: uuid(),
|
||||||
place: 'left',
|
place: 'left',
|
||||||
data: {}
|
data: {}
|
||||||
|
@ -357,21 +357,21 @@
|
||||||
this.saveHome = () => {
|
this.saveHome = () => {
|
||||||
const data = [];
|
const data = [];
|
||||||
|
|
||||||
Array.from(this.refs.left.children).forEach(el => {
|
Array.from(this.$refs.left.children).forEach(el => {
|
||||||
const id = el.getAttribute('data-widget-id');
|
const id = el.getAttribute('data-widget-id');
|
||||||
const widget = this.I.client_settings.home.find(w => w.id == id);
|
const widget = this.I.client_settings.home.find(w => w.id == id);
|
||||||
widget.place = 'left';
|
widget.place = 'left';
|
||||||
data.push(widget);
|
data.push(widget);
|
||||||
});
|
});
|
||||||
|
|
||||||
Array.from(this.refs.right.children).forEach(el => {
|
Array.from(this.$refs.right.children).forEach(el => {
|
||||||
const id = el.getAttribute('data-widget-id');
|
const id = el.getAttribute('data-widget-id');
|
||||||
const widget = this.I.client_settings.home.find(w => w.id == id);
|
const widget = this.I.client_settings.home.find(w => w.id == id);
|
||||||
widget.place = 'right';
|
widget.place = 'right';
|
||||||
data.push(widget);
|
data.push(widget);
|
||||||
});
|
});
|
||||||
|
|
||||||
Array.from(this.refs.maintop.children).forEach(el => {
|
Array.from(this.$refs.maintop.children).forEach(el => {
|
||||||
const id = el.getAttribute('data-widget-id');
|
const id = el.getAttribute('data-widget-id');
|
||||||
const widget = this.I.client_settings.home.find(w => w.id == id);
|
const widget = this.I.client_settings.home.find(w => w.id == id);
|
||||||
widget.place = 'main';
|
widget.place = 'main';
|
||||||
|
|
|
@ -86,17 +86,17 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.mousemove = e => {
|
this.mousemove = e => {
|
||||||
const rect = this.refs.view.getBoundingClientRect();
|
const rect = this.$refs.view.getBoundingClientRect();
|
||||||
const mouseX = e.clientX - rect.left;
|
const mouseX = e.clientX - rect.left;
|
||||||
const mouseY = e.clientY - rect.top;
|
const mouseY = e.clientY - rect.top;
|
||||||
const xp = mouseX / this.refs.view.offsetWidth * 100;
|
const xp = mouseX / this.$refs.view.offsetWidth * 100;
|
||||||
const yp = mouseY / this.refs.view.offsetHeight * 100;
|
const yp = mouseY / this.$refs.view.offsetHeight * 100;
|
||||||
this.refs.view.style.backgroundPosition = xp + '% ' + yp + '%';
|
this.$refs.view.style.backgroundPosition = xp + '% ' + yp + '%';
|
||||||
this.refs.view.style.backgroundImage = 'url("' + this.image.url + '?thumbnail")';
|
this.$refs.view.style.backgroundImage = 'url("' + this.image.url + '?thumbnail")';
|
||||||
};
|
};
|
||||||
|
|
||||||
this.mouseleave = () => {
|
this.mouseleave = () => {
|
||||||
this.refs.view.style.backgroundPosition = '';
|
this.$refs.view.style.backgroundPosition = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
this.click = ev => {
|
this.click = ev => {
|
||||||
|
|
|
@ -129,11 +129,11 @@
|
||||||
this.type = this.opts.type ? this.opts.type : 'text';
|
this.type = this.opts.type ? this.opts.type : 'text';
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.text = this.refs.window.refs.text;
|
this.text = this.$refs.window.refs.text;
|
||||||
if (this.default) this.text.value = this.default;
|
if (this.default) this.text.value = this.default;
|
||||||
this.text.focus();
|
this.text.focus();
|
||||||
|
|
||||||
this.refs.window.on('closing', () => {
|
this.$refs.window.on('closing', () => {
|
||||||
if (this.done) {
|
if (this.done) {
|
||||||
this.opts.onOk(this.text.value);
|
this.opts.onOk(this.text.value);
|
||||||
} else {
|
} else {
|
||||||
|
@ -141,20 +141,20 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.window.on('closed', () => {
|
this.$refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.cancel = () => {
|
this.cancel = () => {
|
||||||
this.done = false;
|
this.done = false;
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.ok = () => {
|
this.ok = () => {
|
||||||
if (!this.allowEmpty && this.text.value == '') return;
|
if (!this.allowEmpty && this.text.value == '') return;
|
||||||
this.done = true;
|
this.done = true;
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onInput = () => {
|
this.onInput = () => {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
this.popout = `${_URL_}/i/messaging/${this.user.username}`;
|
this.popout = `${_URL_}/i/messaging/${this.user.username}`;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.window.on('closed', () => {
|
this.$refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.window.on('closed', () => {
|
this.$refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.window.refs.index.on('navigate-user', user => {
|
this.$refs.window.refs.index.on('navigate-user', user => {
|
||||||
riot.mount(document.body.appendChild(document.createElement('mk-messaging-room-window')), {
|
riot.mount(document.body.appendChild(document.createElement('mk-messaging-room-window')), {
|
||||||
user: user
|
user: user
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
document.title = 'Misskey Drive';
|
document.title = 'Misskey Drive';
|
||||||
|
|
||||||
this.refs.browser.on('move-root', () => {
|
this.$refs.browser.on('move-root', () => {
|
||||||
const title = 'Misskey Drive';
|
const title = 'Misskey Drive';
|
||||||
|
|
||||||
// Rewrite URL
|
// Rewrite URL
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
document.title = title;
|
document.title = title;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.browser.on('open-folder', folder => {
|
this.$refs.browser.on('open-folder', folder => {
|
||||||
const title = folder.name + ' | Misskey Drive';
|
const title = folder.name + ' | Misskey Drive';
|
||||||
|
|
||||||
// Rewrite URL
|
// Rewrite URL
|
||||||
|
|
|
@ -280,7 +280,7 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.signin.on('user', user => {
|
this.$refs.signin.on('user', user => {
|
||||||
this.update({
|
this.update({
|
||||||
user: user
|
user: user
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
this.page = this.opts.mode || 'timeline';
|
this.page = this.opts.mode || 'timeline';
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.ui.refs.home.on('loaded', () => {
|
this.$refs.ui.refs.home.on('loaded', () => {
|
||||||
Progress.done();
|
Progress.done();
|
||||||
});
|
});
|
||||||
document.title = 'Misskey';
|
document.title = 'Misskey';
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
Progress.start();
|
Progress.start();
|
||||||
|
|
||||||
this.refs.ui.refs.search.on('loaded', () => {
|
this.$refs.ui.refs.search.on('loaded', () => {
|
||||||
Progress.done();
|
Progress.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -133,12 +133,12 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
document.title = '%i18n:desktop.tags.mk-selectdrive-page.title%';
|
document.title = '%i18n:desktop.tags.mk-selectdrive-page.title%';
|
||||||
|
|
||||||
this.refs.browser.on('selected', file => {
|
this.$refs.browser.on('selected', file => {
|
||||||
this.files = [file];
|
this.files = [file];
|
||||||
this.ok();
|
this.ok();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.browser.on('change-selection', files => {
|
this.$refs.browser.on('change-selection', files => {
|
||||||
this.update({
|
this.update({
|
||||||
files: files
|
files: files
|
||||||
});
|
});
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.upload = () => {
|
this.upload = () => {
|
||||||
this.refs.browser.selectLocalFile();
|
this.$refs.browser.selectLocalFile();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
Progress.start();
|
Progress.start();
|
||||||
|
|
||||||
this.refs.ui.refs.user.on('user-fetched', user => {
|
this.$refs.ui.refs.user.on('user-fetched', user => {
|
||||||
Progress.set(0.5);
|
Progress.set(0.5);
|
||||||
document.title = user.name + ' | Misskey';
|
document.title = user.name + ' | Misskey';
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.ui.refs.user.on('loaded', () => {
|
this.$refs.ui.refs.user.on('loaded', () => {
|
||||||
Progress.done();
|
Progress.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -120,9 +120,9 @@
|
||||||
if (this.post.text) {
|
if (this.post.text) {
|
||||||
const tokens = this.post.ast;
|
const tokens = this.post.ast;
|
||||||
|
|
||||||
this.refs.text.innerHTML = compile(tokens);
|
this.$refs.text.innerHTML = compile(tokens);
|
||||||
|
|
||||||
Array.from(this.refs.text.children).forEach(e => {
|
Array.from(this.$refs.text.children).forEach(e => {
|
||||||
if (e.tagName == 'MK-URL') riot.mount(e);
|
if (e.tagName == 'MK-URL') riot.mount(e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,9 +256,9 @@
|
||||||
if (this.p.text) {
|
if (this.p.text) {
|
||||||
const tokens = this.p.ast;
|
const tokens = this.p.ast;
|
||||||
|
|
||||||
this.refs.text.innerHTML = compile(tokens);
|
this.$refs.text.innerHTML = compile(tokens);
|
||||||
|
|
||||||
Array.from(this.refs.text.children).forEach(e => {
|
Array.from(this.$refs.text.children).forEach(e => {
|
||||||
if (e.tagName == 'MK-URL') riot.mount(e);
|
if (e.tagName == 'MK-URL') riot.mount(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@
|
||||||
tokens
|
tokens
|
||||||
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
||||||
.map(t => {
|
.map(t => {
|
||||||
riot.mount(this.refs.text.appendChild(document.createElement('mk-url-preview')), {
|
riot.mount(this.$refs.text.appendChild(document.createElement('mk-url-preview')), {
|
||||||
url: t.url
|
url: t.url
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -299,14 +299,14 @@
|
||||||
|
|
||||||
this.react = () => {
|
this.react = () => {
|
||||||
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
|
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
|
||||||
source: this.refs.reactButton,
|
source: this.$refs.reactButton,
|
||||||
post: this.p
|
post: this.p
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.menu = () => {
|
this.menu = () => {
|
||||||
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
|
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
|
||||||
source: this.refs.menuButton,
|
source: this.$refs.menuButton,
|
||||||
post: this.p
|
post: this.p
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,23 +42,23 @@
|
||||||
this.files = [];
|
this.files = [];
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.window.refs.form.focus();
|
this.$refs.window.refs.form.focus();
|
||||||
|
|
||||||
this.refs.window.on('closed', () => {
|
this.$refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.window.refs.form.on('post', () => {
|
this.$refs.window.refs.form.on('post', () => {
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.window.refs.form.on('change-uploading-files', files => {
|
this.$refs.window.refs.form.on('change-uploading-files', files => {
|
||||||
this.update({
|
this.update({
|
||||||
uploadingFiles: files || []
|
uploadingFiles: files || []
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.window.refs.form.on('change-files', files => {
|
this.$refs.window.refs.form.on('change-files', files => {
|
||||||
this.update({
|
this.update({
|
||||||
files: files || []
|
files: files || []
|
||||||
});
|
});
|
||||||
|
|
|
@ -319,32 +319,32 @@
|
||||||
: 'post';
|
: 'post';
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.uploader.on('uploaded', file => {
|
this.$refs.uploader.on('uploaded', file => {
|
||||||
this.addFile(file);
|
this.addFile(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.uploader.on('change-uploads', uploads => {
|
this.$refs.uploader.on('change-uploads', uploads => {
|
||||||
this.trigger('change-uploading-files', uploads);
|
this.trigger('change-uploading-files', uploads);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.autocomplete = new Autocomplete(this.refs.text);
|
this.autocomplete = new Autocomplete(this.$refs.text);
|
||||||
this.autocomplete.attach();
|
this.autocomplete.attach();
|
||||||
|
|
||||||
// 書きかけの投稿を復元
|
// 書きかけの投稿を復元
|
||||||
const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftId];
|
const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftId];
|
||||||
if (draft) {
|
if (draft) {
|
||||||
this.refs.text.value = draft.data.text;
|
this.$refs.text.value = draft.data.text;
|
||||||
this.files = draft.data.files;
|
this.files = draft.data.files;
|
||||||
if (draft.data.poll) {
|
if (draft.data.poll) {
|
||||||
this.poll = true;
|
this.poll = true;
|
||||||
this.update();
|
this.update();
|
||||||
this.refs.poll.set(draft.data.poll);
|
this.$refs.poll.set(draft.data.poll);
|
||||||
}
|
}
|
||||||
this.trigger('change-files', this.files);
|
this.trigger('change-files', this.files);
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
new Sortable(this.refs.media, {
|
new Sortable(this.$refs.media, {
|
||||||
animation: 150
|
animation: 150
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -354,11 +354,11 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.focus = () => {
|
this.focus = () => {
|
||||||
this.refs.text.focus();
|
this.$refs.text.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.clear = () => {
|
this.clear = () => {
|
||||||
this.refs.text.value = '';
|
this.$refs.text.value = '';
|
||||||
this.files = [];
|
this.files = [];
|
||||||
this.poll = false;
|
this.poll = false;
|
||||||
this.trigger('change-files');
|
this.trigger('change-files');
|
||||||
|
@ -422,7 +422,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectFile = () => {
|
this.selectFile = () => {
|
||||||
this.refs.file.click();
|
this.$refs.file.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectFileFromDrive = () => {
|
this.selectFileFromDrive = () => {
|
||||||
|
@ -435,11 +435,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.changeFile = () => {
|
this.changeFile = () => {
|
||||||
Array.from(this.refs.file.files).forEach(this.upload);
|
Array.from(this.$refs.file.files).forEach(this.upload);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.upload = file => {
|
this.upload = file => {
|
||||||
this.refs.uploader.upload(file);
|
this.$refs.uploader.upload(file);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addFile = file => {
|
this.addFile = file => {
|
||||||
|
@ -471,7 +471,7 @@
|
||||||
const files = [];
|
const files = [];
|
||||||
|
|
||||||
if (this.files.length > 0) {
|
if (this.files.length > 0) {
|
||||||
Array.from(this.refs.media.children).forEach(el => {
|
Array.from(this.$refs.media.children).forEach(el => {
|
||||||
const id = el.getAttribute('data-id');
|
const id = el.getAttribute('data-id');
|
||||||
const file = this.files.find(f => f.id == id);
|
const file = this.files.find(f => f.id == id);
|
||||||
files.push(file);
|
files.push(file);
|
||||||
|
@ -479,11 +479,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.api('posts/create', {
|
this.api('posts/create', {
|
||||||
text: this.refs.text.value == '' ? undefined : this.refs.text.value,
|
text: this.$refs.text.value == '' ? undefined : this.$refs.text.value,
|
||||||
media_ids: this.files.length > 0 ? files.map(f => f.id) : undefined,
|
media_ids: this.files.length > 0 ? files.map(f => f.id) : undefined,
|
||||||
reply_id: this.inReplyToPost ? this.inReplyToPost.id : undefined,
|
reply_id: this.inReplyToPost ? this.inReplyToPost.id : undefined,
|
||||||
repost_id: this.repost ? this.repost.id : undefined,
|
repost_id: this.repost ? this.repost.id : undefined,
|
||||||
poll: this.poll ? this.refs.poll.get() : undefined
|
poll: this.poll ? this.$refs.poll.get() : undefined
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
this.clear();
|
this.clear();
|
||||||
this.removeDraft();
|
this.removeDraft();
|
||||||
|
@ -507,7 +507,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.kao = () => {
|
this.kao = () => {
|
||||||
this.refs.text.value += getKao();
|
this.$refs.text.value += getKao();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.on('update', () => {
|
this.on('update', () => {
|
||||||
|
@ -520,9 +520,9 @@
|
||||||
data[this.draftId] = {
|
data[this.draftId] = {
|
||||||
updated_at: new Date(),
|
updated_at: new Date(),
|
||||||
data: {
|
data: {
|
||||||
text: this.refs.text.value,
|
text: this.$refs.text.value,
|
||||||
files: this.files,
|
files: this.files,
|
||||||
poll: this.poll && this.refs.poll ? this.refs.poll.get() : undefined
|
poll: this.poll && this.$refs.poll ? this.$refs.poll.get() : undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
this.max = parseInt(this.opts.max, 10);
|
this.max = parseInt(this.opts.max, 10);
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.window.on('closed', () => {
|
this.$refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-progress-dialog>
|
</mk-progress-dialog>
|
||||||
|
|
|
@ -19,23 +19,23 @@
|
||||||
this.onDocumentKeydown = e => {
|
this.onDocumentKeydown = e => {
|
||||||
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
|
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
|
||||||
if (e.which == 27) { // Esc
|
if (e.which == 27) { // Esc
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.window.refs.form.on('cancel', () => {
|
this.$refs.window.refs.form.on('cancel', () => {
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.window.refs.form.on('posted', () => {
|
this.$refs.window.refs.form.on('posted', () => {
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('keydown', this.onDocumentKeydown);
|
document.addEventListener('keydown', this.onDocumentKeydown);
|
||||||
|
|
||||||
this.refs.window.on('closed', () => {
|
this.$refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -117,11 +117,11 @@
|
||||||
quote: true
|
quote: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.form.on('post', () => {
|
this.$refs.form.on('post', () => {
|
||||||
this.trigger('posted');
|
this.trigger('posted');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.form.focus();
|
this.$refs.form.focus();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-repost-form>
|
</mk-repost-form>
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isEmpty: posts.length == 0
|
isEmpty: posts.length == 0
|
||||||
});
|
});
|
||||||
this.refs.timeline.setPosts(posts);
|
this.$refs.timeline.setPosts(posts);
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
this.onDocumentKeydown = e => {
|
this.onDocumentKeydown = e => {
|
||||||
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
|
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
|
||||||
if (e.which == 84) { // t
|
if (e.which == 84) { // t
|
||||||
this.refs.timeline.focus();
|
this.$refs.timeline.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
this.update({
|
this.update({
|
||||||
moreLoading: false
|
moreLoading: false
|
||||||
});
|
});
|
||||||
this.refs.timeline.prependPosts(posts);
|
this.$refs.timeline.prependPosts(posts);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
this.query = this.opts.query;
|
this.query = this.opts.query;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.posts.on('loaded', () => {
|
this.$refs.posts.on('loaded', () => {
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -141,33 +141,33 @@
|
||||||
this.title = this.opts.title || '%fa:R file%ファイルを選択';
|
this.title = this.opts.title || '%fa:R file%ファイルを選択';
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.window.refs.browser.on('selected', file => {
|
this.$refs.window.refs.browser.on('selected', file => {
|
||||||
this.files = [file];
|
this.files = [file];
|
||||||
this.ok();
|
this.ok();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.window.refs.browser.on('change-selection', files => {
|
this.$refs.window.refs.browser.on('change-selection', files => {
|
||||||
this.update({
|
this.update({
|
||||||
files: files
|
files: files
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.window.on('closed', () => {
|
this.$refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.upload = () => {
|
this.upload = () => {
|
||||||
this.refs.window.refs.browser.selectLocalFile();
|
this.$refs.window.refs.browser.selectLocalFile();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.ok = () => {
|
this.ok = () => {
|
||||||
this.trigger('selected', this.multiple ? this.files : this.files[0]);
|
this.trigger('selected', this.multiple ? this.files : this.files[0]);
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-select-file-from-drive-window>
|
</mk-select-file-from-drive-window>
|
||||||
|
|
|
@ -95,18 +95,18 @@
|
||||||
this.title = this.opts.title || '%fa:R folder%フォルダを選択';
|
this.title = this.opts.title || '%fa:R folder%フォルダを選択';
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.window.on('closed', () => {
|
this.$refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.ok = () => {
|
this.ok = () => {
|
||||||
this.trigger('selected', this.refs.window.refs.browser.folder);
|
this.trigger('selected', this.$refs.window.refs.browser.folder);
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-select-folder-from-drive-window>
|
</mk-select-folder-from-drive-window>
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.window.on('closed', () => {
|
this.$refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
this.refs.window.close();
|
this.$refs.window.close();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-settings-window>
|
</mk-settings-window>
|
||||||
|
|
|
@ -179,10 +179,10 @@
|
||||||
|
|
||||||
this.updateAccount = () => {
|
this.updateAccount = () => {
|
||||||
this.api('i/update', {
|
this.api('i/update', {
|
||||||
name: this.refs.accountName.value,
|
name: this.$refs.accountName.value,
|
||||||
location: this.refs.accountLocation.value || null,
|
location: this.$refs.accountLocation.value || null,
|
||||||
description: this.refs.accountDescription.value || null,
|
description: this.$refs.accountDescription.value || null,
|
||||||
birthday: this.refs.accountBirthday.value || null
|
birthday: this.$refs.accountBirthday.value || null
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
notify('プロフィールを更新しました');
|
notify('プロフィールを更新しました');
|
||||||
});
|
});
|
||||||
|
@ -320,7 +320,7 @@
|
||||||
|
|
||||||
this.submit = () => {
|
this.submit = () => {
|
||||||
this.api('i/2fa/done', {
|
this.api('i/2fa/done', {
|
||||||
token: this.refs.token.value
|
token: this.$refs.token.value
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
notify('%i18n:desktop.tags.mk-2fa-setting.success%');
|
notify('%i18n:desktop.tags.mk-2fa-setting.success%');
|
||||||
this.I.two_factor_enabled = true;
|
this.I.two_factor_enabled = true;
|
||||||
|
|
|
@ -43,9 +43,9 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
if (this.post.text) {
|
if (this.post.text) {
|
||||||
const tokens = this.post.ast;
|
const tokens = this.post.ast;
|
||||||
this.refs.text.innerHTML = compile(tokens, false);
|
this.$refs.text.innerHTML = compile(tokens, false);
|
||||||
|
|
||||||
Array.from(this.refs.text.children).forEach(e => {
|
Array.from(this.$refs.text.children).forEach(e => {
|
||||||
if (e.tagName == 'MK-URL') riot.mount(e);
|
if (e.tagName == 'MK-URL') riot.mount(e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -437,10 +437,10 @@
|
||||||
this.refresh = post => {
|
this.refresh = post => {
|
||||||
this.set(post);
|
this.set(post);
|
||||||
this.update();
|
this.update();
|
||||||
if (this.refs.reactionsViewer) this.refs.reactionsViewer.update({
|
if (this.$refs.reactionsViewer) this.$refs.reactionsViewer.update({
|
||||||
post
|
post
|
||||||
});
|
});
|
||||||
if (this.refs.pollViewer) this.refs.pollViewer.init(post);
|
if (this.$refs.pollViewer) this.$refs.pollViewer.init(post);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onStreamPostUpdated = data => {
|
this.onStreamPostUpdated = data => {
|
||||||
|
@ -484,9 +484,9 @@
|
||||||
if (this.p.text) {
|
if (this.p.text) {
|
||||||
const tokens = this.p.ast;
|
const tokens = this.p.ast;
|
||||||
|
|
||||||
this.refs.text.innerHTML = this.refs.text.innerHTML.replace('<p class="dummy"></p>', compile(tokens));
|
this.$refs.text.innerHTML = this.$refs.text.innerHTML.replace('<p class="dummy"></p>', compile(tokens));
|
||||||
|
|
||||||
Array.from(this.refs.text.children).forEach(e => {
|
Array.from(this.$refs.text.children).forEach(e => {
|
||||||
if (e.tagName == 'MK-URL') riot.mount(e);
|
if (e.tagName == 'MK-URL') riot.mount(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@
|
||||||
tokens
|
tokens
|
||||||
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
||||||
.map(t => {
|
.map(t => {
|
||||||
riot.mount(this.refs.text.appendChild(document.createElement('mk-url-preview')), {
|
riot.mount(this.$refs.text.appendChild(document.createElement('mk-url-preview')), {
|
||||||
url: t.url
|
url: t.url
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -521,14 +521,14 @@
|
||||||
|
|
||||||
this.react = () => {
|
this.react = () => {
|
||||||
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
|
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
|
||||||
source: this.refs.reactButton,
|
source: this.$refs.reactButton,
|
||||||
post: this.p
|
post: this.p
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.menu = () => {
|
this.menu = () => {
|
||||||
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
|
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
|
||||||
source: this.refs.menuButton,
|
source: this.$refs.menuButton,
|
||||||
post: this.p
|
post: this.p
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -180,7 +180,7 @@
|
||||||
|
|
||||||
this.onsubmit = e => {
|
this.onsubmit = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.page('/search?q=' + encodeURIComponent(this.refs.q.value));
|
this.page('/search?q=' + encodeURIComponent(this.$refs.q.value));
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-ui-header-search>
|
</mk-ui-header-search>
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
this.onDocumentKeydown = e => {
|
this.onDocumentKeydown = e => {
|
||||||
if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA') {
|
if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA') {
|
||||||
if (e.which == 84) { // [t]
|
if (e.which == 84) { // [t]
|
||||||
this.refs.timeline.focus();
|
this.$refs.timeline.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -103,25 +103,25 @@
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isEmpty: posts.length == 0
|
isEmpty: posts.length == 0
|
||||||
});
|
});
|
||||||
this.refs.timeline.setPosts(posts);
|
this.$refs.timeline.setPosts(posts);
|
||||||
if (cb) cb();
|
if (cb) cb();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.more = () => {
|
this.more = () => {
|
||||||
if (this.moreLoading || this.isLoading || this.refs.timeline.posts.length == 0) return;
|
if (this.moreLoading || this.isLoading || this.$refs.timeline.posts.length == 0) return;
|
||||||
this.update({
|
this.update({
|
||||||
moreLoading: true
|
moreLoading: true
|
||||||
});
|
});
|
||||||
this.api('users/posts', {
|
this.api('users/posts', {
|
||||||
user_id: this.user.id,
|
user_id: this.user.id,
|
||||||
with_replies: this.mode == 'with-replies',
|
with_replies: this.mode == 'with-replies',
|
||||||
until_id: this.refs.timeline.tail().id
|
until_id: this.$refs.timeline.tail().id
|
||||||
}).then(posts => {
|
}).then(posts => {
|
||||||
this.update({
|
this.update({
|
||||||
moreLoading: false
|
moreLoading: false
|
||||||
});
|
});
|
||||||
this.refs.timeline.prependPosts(posts);
|
this.$refs.timeline.prependPosts(posts);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -206,10 +206,10 @@
|
||||||
|
|
||||||
const z = 1.25; // 奥行き(小さいほど奥)
|
const z = 1.25; // 奥行き(小さいほど奥)
|
||||||
const pos = -(top / z);
|
const pos = -(top / z);
|
||||||
this.refs.banner.style.backgroundPosition = `center calc(50% - ${pos}px)`;
|
this.$refs.banner.style.backgroundPosition = `center calc(50% - ${pos}px)`;
|
||||||
|
|
||||||
const blur = top / 32
|
const blur = top / 32
|
||||||
if (blur <= 10) this.refs.banner.style.filter = `blur(${blur}px)`;
|
if (blur <= 10) this.$refs.banner.style.filter = `blur(${blur}px)`;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onUpdateBanner = () => {
|
this.onUpdateBanner = () => {
|
||||||
|
@ -715,12 +715,12 @@
|
||||||
this.user = this.opts.user;
|
this.user = this.opts.user;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.tl.on('loaded', () => {
|
this.$refs.tl.on('loaded', () => {
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.scrollFollowerLeft = new ScrollFollower(this.refs.left, this.parent.root.getBoundingClientRect().top);
|
this.scrollFollowerLeft = new ScrollFollower(this.$refs.left, this.parent.root.getBoundingClientRect().top);
|
||||||
this.scrollFollowerRight = new ScrollFollower(this.refs.right, this.parent.root.getBoundingClientRect().top);
|
this.scrollFollowerRight = new ScrollFollower(this.$refs.right, this.parent.root.getBoundingClientRect().top);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('unmount', () => {
|
this.on('unmount', () => {
|
||||||
|
@ -729,7 +729,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.warp = date => {
|
this.warp = date => {
|
||||||
this.refs.tl.warp(date);
|
this.$refs.tl.warp(date);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-user-home>
|
</mk-user-home>
|
||||||
|
|
|
@ -199,13 +199,13 @@
|
||||||
this.canResize = !this.isFlexible;
|
this.canResize = !this.isFlexible;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.main.style.width = this.opts.width || '530px';
|
this.$refs.main.style.width = this.opts.width || '530px';
|
||||||
this.refs.main.style.height = this.opts.height || 'auto';
|
this.$refs.main.style.height = this.opts.height || 'auto';
|
||||||
|
|
||||||
this.refs.main.style.top = '15%';
|
this.$refs.main.style.top = '15%';
|
||||||
this.refs.main.style.left = (window.innerWidth / 2) - (this.refs.main.offsetWidth / 2) + 'px';
|
this.$refs.main.style.left = (window.innerWidth / 2) - (this.$refs.main.offsetWidth / 2) + 'px';
|
||||||
|
|
||||||
this.refs.header.addEventListener('contextmenu', e => {
|
this.$refs.header.addEventListener('contextmenu', e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -219,15 +219,15 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onBrowserResize = () => {
|
this.onBrowserResize = () => {
|
||||||
const position = this.refs.main.getBoundingClientRect();
|
const position = this.$refs.main.getBoundingClientRect();
|
||||||
const browserWidth = window.innerWidth;
|
const browserWidth = window.innerWidth;
|
||||||
const browserHeight = window.innerHeight;
|
const browserHeight = window.innerHeight;
|
||||||
const windowWidth = this.refs.main.offsetWidth;
|
const windowWidth = this.$refs.main.offsetWidth;
|
||||||
const windowHeight = this.refs.main.offsetHeight;
|
const windowHeight = this.$refs.main.offsetHeight;
|
||||||
if (position.left < 0) this.refs.main.style.left = 0;
|
if (position.left < 0) this.$refs.main.style.left = 0;
|
||||||
if (position.top < 0) this.refs.main.style.top = 0;
|
if (position.top < 0) this.$refs.main.style.top = 0;
|
||||||
if (position.left + windowWidth > browserWidth) this.refs.main.style.left = browserWidth - windowWidth + 'px';
|
if (position.left + windowWidth > browserWidth) this.$refs.main.style.left = browserWidth - windowWidth + 'px';
|
||||||
if (position.top + windowHeight > browserHeight) this.refs.main.style.top = browserHeight - windowHeight + 'px';
|
if (position.top + windowHeight > browserHeight) this.$refs.main.style.top = browserHeight - windowHeight + 'px';
|
||||||
};
|
};
|
||||||
|
|
||||||
this.open = () => {
|
this.open = () => {
|
||||||
|
@ -236,25 +236,25 @@
|
||||||
this.top();
|
this.top();
|
||||||
|
|
||||||
if (this.isModal) {
|
if (this.isModal) {
|
||||||
this.refs.bg.style.pointerEvents = 'auto';
|
this.$refs.bg.style.pointerEvents = 'auto';
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.bg,
|
targets: this.$refs.bg,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
duration: 100,
|
duration: 100,
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.refs.main.style.pointerEvents = 'auto';
|
this.$refs.main.style.pointerEvents = 'auto';
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.main,
|
targets: this.$refs.main,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
scale: [1.1, 1],
|
scale: [1.1, 1],
|
||||||
duration: 200,
|
duration: 200,
|
||||||
easing: 'easeOutQuad'
|
easing: 'easeOutQuad'
|
||||||
});
|
});
|
||||||
|
|
||||||
//this.refs.main.focus();
|
//this.$refs.main.focus();
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.trigger('opened');
|
this.trigger('opened');
|
||||||
|
@ -262,10 +262,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.popout = () => {
|
this.popout = () => {
|
||||||
const position = this.refs.main.getBoundingClientRect();
|
const position = this.$refs.main.getBoundingClientRect();
|
||||||
|
|
||||||
const width = parseInt(getComputedStyle(this.refs.main, '').width, 10);
|
const width = parseInt(getComputedStyle(this.$refs.main, '').width, 10);
|
||||||
const height = parseInt(getComputedStyle(this.refs.main, '').height, 10);
|
const height = parseInt(getComputedStyle(this.$refs.main, '').height, 10);
|
||||||
const x = window.screenX + position.left;
|
const x = window.screenX + position.left;
|
||||||
const y = window.screenY + position.top;
|
const y = window.screenY + position.top;
|
||||||
|
|
||||||
|
@ -281,19 +281,19 @@
|
||||||
this.trigger('closing');
|
this.trigger('closing');
|
||||||
|
|
||||||
if (this.isModal) {
|
if (this.isModal) {
|
||||||
this.refs.bg.style.pointerEvents = 'none';
|
this.$refs.bg.style.pointerEvents = 'none';
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.bg,
|
targets: this.$refs.bg,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
duration: 300,
|
duration: 300,
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.refs.main.style.pointerEvents = 'none';
|
this.$refs.main.style.pointerEvents = 'none';
|
||||||
|
|
||||||
anime({
|
anime({
|
||||||
targets: this.refs.main,
|
targets: this.$refs.main,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
scale: 0.8,
|
scale: 0.8,
|
||||||
duration: 300,
|
duration: 300,
|
||||||
|
@ -318,8 +318,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
if (z > 0) {
|
if (z > 0) {
|
||||||
this.refs.main.style.zIndex = z + 1;
|
this.$refs.main.style.zIndex = z + 1;
|
||||||
if (this.isModal) this.refs.bg.style.zIndex = z + 1;
|
if (this.isModal) this.$refs.bg.style.zIndex = z + 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -340,9 +340,9 @@
|
||||||
this.onHeaderMousedown = e => {
|
this.onHeaderMousedown = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (!contains(this.refs.main, document.activeElement)) this.refs.main.focus();
|
if (!contains(this.$refs.main, document.activeElement)) this.$refs.main.focus();
|
||||||
|
|
||||||
const position = this.refs.main.getBoundingClientRect();
|
const position = this.$refs.main.getBoundingClientRect();
|
||||||
|
|
||||||
const clickX = e.clientX;
|
const clickX = e.clientX;
|
||||||
const clickY = e.clientY;
|
const clickY = e.clientY;
|
||||||
|
@ -350,8 +350,8 @@
|
||||||
const moveBaseY = clickY - position.top;
|
const moveBaseY = clickY - position.top;
|
||||||
const browserWidth = window.innerWidth;
|
const browserWidth = window.innerWidth;
|
||||||
const browserHeight = window.innerHeight;
|
const browserHeight = window.innerHeight;
|
||||||
const windowWidth = this.refs.main.offsetWidth;
|
const windowWidth = this.$refs.main.offsetWidth;
|
||||||
const windowHeight = this.refs.main.offsetHeight;
|
const windowHeight = this.$refs.main.offsetHeight;
|
||||||
|
|
||||||
// 動かした時
|
// 動かした時
|
||||||
dragListen(me => {
|
dragListen(me => {
|
||||||
|
@ -370,8 +370,8 @@
|
||||||
// 右はみ出し
|
// 右はみ出し
|
||||||
if (moveLeft + windowWidth > browserWidth) moveLeft = browserWidth - windowWidth;
|
if (moveLeft + windowWidth > browserWidth) moveLeft = browserWidth - windowWidth;
|
||||||
|
|
||||||
this.refs.main.style.left = moveLeft + 'px';
|
this.$refs.main.style.left = moveLeft + 'px';
|
||||||
this.refs.main.style.top = moveTop + 'px';
|
this.$refs.main.style.top = moveTop + 'px';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -380,8 +380,8 @@
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const base = e.clientY;
|
const base = e.clientY;
|
||||||
const height = parseInt(getComputedStyle(this.refs.main, '').height, 10);
|
const height = parseInt(getComputedStyle(this.$refs.main, '').height, 10);
|
||||||
const top = parseInt(getComputedStyle(this.refs.main, '').top, 10);
|
const top = parseInt(getComputedStyle(this.$refs.main, '').top, 10);
|
||||||
|
|
||||||
// 動かした時
|
// 動かした時
|
||||||
dragListen(me => {
|
dragListen(me => {
|
||||||
|
@ -406,8 +406,8 @@
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const base = e.clientX;
|
const base = e.clientX;
|
||||||
const width = parseInt(getComputedStyle(this.refs.main, '').width, 10);
|
const width = parseInt(getComputedStyle(this.$refs.main, '').width, 10);
|
||||||
const left = parseInt(getComputedStyle(this.refs.main, '').left, 10);
|
const left = parseInt(getComputedStyle(this.$refs.main, '').left, 10);
|
||||||
const browserWidth = window.innerWidth;
|
const browserWidth = window.innerWidth;
|
||||||
|
|
||||||
// 動かした時
|
// 動かした時
|
||||||
|
@ -430,8 +430,8 @@
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const base = e.clientY;
|
const base = e.clientY;
|
||||||
const height = parseInt(getComputedStyle(this.refs.main, '').height, 10);
|
const height = parseInt(getComputedStyle(this.$refs.main, '').height, 10);
|
||||||
const top = parseInt(getComputedStyle(this.refs.main, '').top, 10);
|
const top = parseInt(getComputedStyle(this.$refs.main, '').top, 10);
|
||||||
const browserHeight = window.innerHeight;
|
const browserHeight = window.innerHeight;
|
||||||
|
|
||||||
// 動かした時
|
// 動かした時
|
||||||
|
@ -454,8 +454,8 @@
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const base = e.clientX;
|
const base = e.clientX;
|
||||||
const width = parseInt(getComputedStyle(this.refs.main, '').width, 10);
|
const width = parseInt(getComputedStyle(this.$refs.main, '').width, 10);
|
||||||
const left = parseInt(getComputedStyle(this.refs.main, '').left, 10);
|
const left = parseInt(getComputedStyle(this.$refs.main, '').left, 10);
|
||||||
|
|
||||||
// 動かした時
|
// 動かした時
|
||||||
dragListen(me => {
|
dragListen(me => {
|
||||||
|
@ -501,22 +501,22 @@
|
||||||
|
|
||||||
// 高さを適用
|
// 高さを適用
|
||||||
this.applyTransformHeight = height => {
|
this.applyTransformHeight = height => {
|
||||||
this.refs.main.style.height = height + 'px';
|
this.$refs.main.style.height = height + 'px';
|
||||||
};
|
};
|
||||||
|
|
||||||
// 幅を適用
|
// 幅を適用
|
||||||
this.applyTransformWidth = width => {
|
this.applyTransformWidth = width => {
|
||||||
this.refs.main.style.width = width + 'px';
|
this.$refs.main.style.width = width + 'px';
|
||||||
};
|
};
|
||||||
|
|
||||||
// Y座標を適用
|
// Y座標を適用
|
||||||
this.applyTransformTop = top => {
|
this.applyTransformTop = top => {
|
||||||
this.refs.main.style.top = top + 'px';
|
this.$refs.main.style.top = top + 'px';
|
||||||
};
|
};
|
||||||
|
|
||||||
// X座標を適用
|
// X座標を適用
|
||||||
this.applyTransformLeft = left => {
|
this.applyTransformLeft = left => {
|
||||||
this.refs.main.style.left = left + 'px';
|
this.$refs.main.style.left = left + 'px';
|
||||||
};
|
};
|
||||||
|
|
||||||
function dragListen(fn) {
|
function dragListen(fn) {
|
||||||
|
|
|
@ -183,7 +183,7 @@
|
||||||
this.nidState = null;
|
this.nidState = null;
|
||||||
|
|
||||||
this.onChangeNid = () => {
|
this.onChangeNid = () => {
|
||||||
const nid = this.refs.nid.value;
|
const nid = this.$refs.nid.value;
|
||||||
|
|
||||||
if (nid == '') {
|
if (nid == '') {
|
||||||
this.update({
|
this.update({
|
||||||
|
@ -223,13 +223,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onsubmit = () => {
|
this.onsubmit = () => {
|
||||||
const name = this.refs.name.value;
|
const name = this.$refs.name.value;
|
||||||
const nid = this.refs.nid.value;
|
const nid = this.$refs.nid.value;
|
||||||
const description = this.refs.description.value;
|
const description = this.$refs.description.value;
|
||||||
const cb = this.refs.cb.value;
|
const cb = this.$refs.cb.value;
|
||||||
const permission = [];
|
const permission = [];
|
||||||
|
|
||||||
this.refs.permission.querySelectorAll('input').forEach(el => {
|
this.$refs.permission.querySelectorAll('input').forEach(el => {
|
||||||
if (el.checked) permission.push(el.value);
|
if (el.checked) permission.push(el.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.ok = () => {
|
this.ok = () => {
|
||||||
this.trigger('selected', this.refs.browser.folder);
|
this.trigger('selected', this.$refs.browser.folder);
|
||||||
this.unmount();
|
this.unmount();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -63,13 +63,13 @@
|
||||||
this.files = [];
|
this.files = [];
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.browser.on('change-selection', files => {
|
this.$refs.browser.on('change-selection', files => {
|
||||||
this.update({
|
this.update({
|
||||||
files: files
|
files: files
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.browser.on('selected', file => {
|
this.$refs.browser.on('selected', file => {
|
||||||
this.trigger('selected', file);
|
this.trigger('selected', file);
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
|
|
|
@ -209,7 +209,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.opts.isNaked) {
|
if (this.opts.isNaked) {
|
||||||
this.refs.nav.style.top = `${this.opts.top}px`;
|
this.$refs.nav.style.top = `${this.opts.top}px`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectLocalFile = () => {
|
this.selectLocalFile = () => {
|
||||||
this.refs.file.click();
|
this.$refs.file.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createFolder = () => {
|
this.createFolder = () => {
|
||||||
|
@ -574,7 +574,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.changeLocalFile = () => {
|
this.changeLocalFile = () => {
|
||||||
Array.from(this.refs.file.files).forEach(f => this.refs.uploader.upload(f, this.folder));
|
Array.from(this.$refs.file.files).forEach(f => this.$refs.uploader.upload(f, this.folder));
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-drive>
|
</mk-drive>
|
||||||
|
|
|
@ -243,7 +243,7 @@
|
||||||
|
|
||||||
this.onImageLoaded = () => {
|
this.onImageLoaded = () => {
|
||||||
const self = this;
|
const self = this;
|
||||||
EXIF.getData(this.refs.img, function() {
|
EXIF.getData(this.$refs.img, function() {
|
||||||
const allMetaData = EXIF.getAllTags(this);
|
const allMetaData = EXIF.getAllTags(this);
|
||||||
self.update({
|
self.update({
|
||||||
exif: allMetaData
|
exif: allMetaData
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
this.fetch = () => {
|
this.fetch = () => {
|
||||||
this.api('posts/timeline').then(posts => {
|
this.api('posts/timeline').then(posts => {
|
||||||
this.refs.timeline.setPosts(posts);
|
this.$refs.timeline.setPosts(posts);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
this.more = () => {
|
this.more = () => {
|
||||||
return this.api('posts/timeline', {
|
return this.api('posts/timeline', {
|
||||||
until_id: this.refs.timeline.tail().id
|
until_id: this.$refs.timeline.tail().id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
this.update({
|
this.update({
|
||||||
isEmpty: false
|
isEmpty: false
|
||||||
});
|
});
|
||||||
this.refs.timeline.addPost(post);
|
this.$refs.timeline.addPost(post);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onStreamFollow = () => {
|
this.onStreamFollow = () => {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.tl.on('loaded', () => {
|
this.$refs.tl.on('loaded', () => {
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,22 +15,22 @@
|
||||||
ui.trigger('title', '%fa:cloud%%i18n:mobile.tags.mk-drive-page.drive%');
|
ui.trigger('title', '%fa:cloud%%i18n:mobile.tags.mk-drive-page.drive%');
|
||||||
|
|
||||||
ui.trigger('func', () => {
|
ui.trigger('func', () => {
|
||||||
this.refs.ui.refs.browser.openContextMenu();
|
this.$refs.ui.refs.browser.openContextMenu();
|
||||||
}, '%fa:ellipsis-h%');
|
}, '%fa:ellipsis-h%');
|
||||||
|
|
||||||
this.refs.ui.refs.browser.on('begin-fetch', () => {
|
this.$refs.ui.refs.browser.on('begin-fetch', () => {
|
||||||
Progress.start();
|
Progress.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.ui.refs.browser.on('fetched-mid', () => {
|
this.$refs.ui.refs.browser.on('fetched-mid', () => {
|
||||||
Progress.set(0.5);
|
Progress.set(0.5);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.ui.refs.browser.on('fetched', () => {
|
this.$refs.ui.refs.browser.on('fetched', () => {
|
||||||
Progress.done();
|
Progress.done();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.ui.refs.browser.on('move-root', () => {
|
this.$refs.ui.refs.browser.on('move-root', () => {
|
||||||
const title = 'Misskey Drive';
|
const title = 'Misskey Drive';
|
||||||
|
|
||||||
// Rewrite URL
|
// Rewrite URL
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
ui.trigger('title', '%fa:cloud%%i18n:mobile.tags.mk-drive-page.drive%');
|
ui.trigger('title', '%fa:cloud%%i18n:mobile.tags.mk-drive-page.drive%');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.ui.refs.browser.on('open-folder', (folder, silent) => {
|
this.$refs.ui.refs.browser.on('open-folder', (folder, silent) => {
|
||||||
const title = folder.name + ' | Misskey Drive';
|
const title = folder.name + ' | Misskey Drive';
|
||||||
|
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
ui.trigger('title', '%fa:R folder-open%' + folder.name);
|
ui.trigger('title', '%fa:R folder-open%' + folder.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.ui.refs.browser.on('open-file', (file, silent) => {
|
this.$refs.ui.refs.browser.on('open-file', (file, silent) => {
|
||||||
const title = file.name + ' | Misskey Drive';
|
const title = file.name + ' | Misskey Drive';
|
||||||
|
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
this.connection.on('post', this.onStreamPost);
|
this.connection.on('post', this.onStreamPost);
|
||||||
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
|
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
|
||||||
|
|
||||||
this.refs.ui.refs.home.on('loaded', () => {
|
this.$refs.ui.refs.home.on('loaded', () => {
|
||||||
Progress.done();
|
Progress.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
document.title = 'Misskey | %i18n:mobile.tags.mk-messaging-page.message%';
|
document.title = 'Misskey | %i18n:mobile.tags.mk-messaging-page.message%';
|
||||||
ui.trigger('title', '%fa:R comments%%i18n:mobile.tags.mk-messaging-page.message%');
|
ui.trigger('title', '%fa:R comments%%i18n:mobile.tags.mk-messaging-page.message%');
|
||||||
|
|
||||||
this.refs.ui.refs.index.on('navigate-user', user => {
|
this.$refs.ui.refs.index.on('navigate-user', user => {
|
||||||
this.page('/i/messaging/' + user.username);
|
this.page('/i/messaging/' + user.username);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
Progress.start();
|
Progress.start();
|
||||||
|
|
||||||
this.refs.ui.refs.notifications.on('fetched', () => {
|
this.$refs.ui.refs.notifications.on('fetched', () => {
|
||||||
Progress.done();
|
Progress.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
Progress.start();
|
Progress.start();
|
||||||
|
|
||||||
this.refs.ui.refs.search.on('loaded', () => {
|
this.$refs.ui.refs.search.on('loaded', () => {
|
||||||
Progress.done();
|
Progress.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -59,12 +59,12 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
document.documentElement.style.background = '#fff';
|
document.documentElement.style.background = '#fff';
|
||||||
|
|
||||||
this.refs.browser.on('selected', file => {
|
this.$refs.browser.on('selected', file => {
|
||||||
this.files = [file];
|
this.files = [file];
|
||||||
this.ok();
|
this.ok();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.browser.on('change-selection', files => {
|
this.$refs.browser.on('change-selection', files => {
|
||||||
this.update({
|
this.update({
|
||||||
files: files
|
files: files
|
||||||
});
|
});
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.upload = () => {
|
this.upload = () => {
|
||||||
this.refs.browser.selectLocalFile();
|
this.$refs.browser.selectLocalFile();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.close = () => {
|
this.close = () => {
|
||||||
|
|
|
@ -231,10 +231,10 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.api('i/update', {
|
this.api('i/update', {
|
||||||
name: this.refs.name.value,
|
name: this.$refs.name.value,
|
||||||
location: this.refs.location.value || null,
|
location: this.$refs.location.value || null,
|
||||||
description: this.refs.description.value || null,
|
description: this.$refs.description.value || null,
|
||||||
birthday: this.refs.birthday.value || null
|
birthday: this.$refs.birthday.value || null
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.update({
|
this.update({
|
||||||
saving: false
|
saving: false
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
ui.trigger('title', '<img src="' + user.avatar_url + '?thumbnail&size=64">' + '%i18n:mobile.tags.mk-user-followers-page.followers-of%'.replace('{}', user.name));
|
ui.trigger('title', '<img src="' + user.avatar_url + '?thumbnail&size=64">' + '%i18n:mobile.tags.mk-user-followers-page.followers-of%'.replace('{}', user.name));
|
||||||
document.documentElement.style.background = '#313a42';
|
document.documentElement.style.background = '#313a42';
|
||||||
|
|
||||||
this.refs.ui.refs.list.on('loaded', () => {
|
this.$refs.ui.refs.list.on('loaded', () => {
|
||||||
Progress.done();
|
Progress.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
ui.trigger('title', '<img src="' + user.avatar_url + '?thumbnail&size=64">' + '%i18n:mobile.tags.mk-user-following-page.following-of%'.replace('{}', user.name));
|
ui.trigger('title', '<img src="' + user.avatar_url + '?thumbnail&size=64">' + '%i18n:mobile.tags.mk-user-following-page.following-of%'.replace('{}', user.name));
|
||||||
document.documentElement.style.background = '#313a42';
|
document.documentElement.style.background = '#313a42';
|
||||||
|
|
||||||
this.refs.ui.refs.list.on('loaded', () => {
|
this.$refs.ui.refs.list.on('loaded', () => {
|
||||||
Progress.done();
|
Progress.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
document.documentElement.style.background = '#313a42';
|
document.documentElement.style.background = '#313a42';
|
||||||
Progress.start();
|
Progress.start();
|
||||||
|
|
||||||
this.refs.ui.refs.user.on('loaded', user => {
|
this.$refs.ui.refs.user.on('loaded', user => {
|
||||||
Progress.done();
|
Progress.done();
|
||||||
document.title = user.name + ' | Misskey';
|
document.title = user.name + ' | Misskey';
|
||||||
// TODO: ユーザー名をエスケープ
|
// TODO: ユーザー名をエスケープ
|
||||||
|
|
|
@ -273,9 +273,9 @@
|
||||||
if (this.p.text) {
|
if (this.p.text) {
|
||||||
const tokens = this.p.ast;
|
const tokens = this.p.ast;
|
||||||
|
|
||||||
this.refs.text.innerHTML = compile(tokens);
|
this.$refs.text.innerHTML = compile(tokens);
|
||||||
|
|
||||||
Array.from(this.refs.text.children).forEach(e => {
|
Array.from(this.$refs.text.children).forEach(e => {
|
||||||
if (e.tagName == 'MK-URL') riot.mount(e);
|
if (e.tagName == 'MK-URL') riot.mount(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@
|
||||||
tokens
|
tokens
|
||||||
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
||||||
.map(t => {
|
.map(t => {
|
||||||
riot.mount(this.refs.text.appendChild(document.createElement('mk-url-preview')), {
|
riot.mount(this.$refs.text.appendChild(document.createElement('mk-url-preview')), {
|
||||||
url: t.url
|
url: t.url
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -319,7 +319,7 @@
|
||||||
|
|
||||||
this.react = () => {
|
this.react = () => {
|
||||||
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
|
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
|
||||||
source: this.refs.reactButton,
|
source: this.$refs.reactButton,
|
||||||
post: this.p,
|
post: this.p,
|
||||||
compact: true
|
compact: true
|
||||||
});
|
});
|
||||||
|
@ -327,7 +327,7 @@
|
||||||
|
|
||||||
this.menu = () => {
|
this.menu = () => {
|
||||||
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
|
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
|
||||||
source: this.refs.menuButton,
|
source: this.$refs.menuButton,
|
||||||
post: this.p,
|
post: this.p,
|
||||||
compact: true
|
compact: true
|
||||||
});
|
});
|
||||||
|
|
|
@ -156,17 +156,17 @@
|
||||||
this.poll = false;
|
this.poll = false;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.uploader.on('uploaded', file => {
|
this.$refs.uploader.on('uploaded', file => {
|
||||||
this.addFile(file);
|
this.addFile(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.uploader.on('change-uploads', uploads => {
|
this.$refs.uploader.on('change-uploads', uploads => {
|
||||||
this.trigger('change-uploading-files', uploads);
|
this.trigger('change-uploading-files', uploads);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refs.text.focus();
|
this.$refs.text.focus();
|
||||||
|
|
||||||
new Sortable(this.refs.attaches, {
|
new Sortable(this.$refs.attaches, {
|
||||||
animation: 150
|
animation: 150
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -184,7 +184,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectFile = () => {
|
this.selectFile = () => {
|
||||||
this.refs.file.click();
|
this.$refs.file.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectFileFromDrive = () => {
|
this.selectFileFromDrive = () => {
|
||||||
|
@ -197,11 +197,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.changeFile = () => {
|
this.changeFile = () => {
|
||||||
Array.from(this.refs.file.files).forEach(this.upload);
|
Array.from(this.$refs.file.files).forEach(this.upload);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.upload = file => {
|
this.upload = file => {
|
||||||
this.refs.uploader.upload(file);
|
this.$refs.uploader.upload(file);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addFile = file => {
|
this.addFile = file => {
|
||||||
|
@ -241,7 +241,7 @@
|
||||||
const files = [];
|
const files = [];
|
||||||
|
|
||||||
if (this.files.length > 0) {
|
if (this.files.length > 0) {
|
||||||
Array.from(this.refs.attaches.children).forEach(el => {
|
Array.from(this.$refs.attaches.children).forEach(el => {
|
||||||
const id = el.getAttribute('data-id');
|
const id = el.getAttribute('data-id');
|
||||||
const file = this.files.find(f => f.id == id);
|
const file = this.files.find(f => f.id == id);
|
||||||
files.push(file);
|
files.push(file);
|
||||||
|
@ -249,10 +249,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.api('posts/create', {
|
this.api('posts/create', {
|
||||||
text: this.refs.text.value == '' ? undefined : this.refs.text.value,
|
text: this.$refs.text.value == '' ? undefined : this.$refs.text.value,
|
||||||
media_ids: this.files.length > 0 ? files.map(f => f.id) : undefined,
|
media_ids: this.files.length > 0 ? files.map(f => f.id) : undefined,
|
||||||
reply_id: opts.reply ? opts.reply.id : undefined,
|
reply_id: opts.reply ? opts.reply.id : undefined,
|
||||||
poll: this.poll ? this.refs.poll.get() : undefined
|
poll: this.poll ? this.$refs.poll.get() : undefined
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
this.trigger('post');
|
this.trigger('post');
|
||||||
this.unmount();
|
this.unmount();
|
||||||
|
@ -269,7 +269,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.kao = () => {
|
this.kao = () => {
|
||||||
this.refs.text.value += getKao();
|
this.$refs.text.value += getKao();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-post-form>
|
</mk-post-form>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
this.query = this.opts.query;
|
this.query = this.opts.query;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.posts.on('loaded', () => {
|
this.$refs.posts.on('loaded', () => {
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,9 +35,9 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
if (this.post.text) {
|
if (this.post.text) {
|
||||||
const tokens = this.post.ast;
|
const tokens = this.post.ast;
|
||||||
this.refs.text.innerHTML = compile(tokens, false);
|
this.$refs.text.innerHTML = compile(tokens, false);
|
||||||
|
|
||||||
Array.from(this.refs.text.children).forEach(e => {
|
Array.from(this.$refs.text.children).forEach(e => {
|
||||||
if (e.tagName == 'MK-URL') riot.mount(e);
|
if (e.tagName == 'MK-URL') riot.mount(e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -482,10 +482,10 @@
|
||||||
this.refresh = post => {
|
this.refresh = post => {
|
||||||
this.set(post);
|
this.set(post);
|
||||||
this.update();
|
this.update();
|
||||||
if (this.refs.reactionsViewer) this.refs.reactionsViewer.update({
|
if (this.$refs.reactionsViewer) this.$refs.reactionsViewer.update({
|
||||||
post
|
post
|
||||||
});
|
});
|
||||||
if (this.refs.pollViewer) this.refs.pollViewer.init(post);
|
if (this.$refs.pollViewer) this.$refs.pollViewer.init(post);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onStreamPostUpdated = data => {
|
this.onStreamPostUpdated = data => {
|
||||||
|
@ -529,9 +529,9 @@
|
||||||
if (this.p.text) {
|
if (this.p.text) {
|
||||||
const tokens = this.p.ast;
|
const tokens = this.p.ast;
|
||||||
|
|
||||||
this.refs.text.innerHTML = this.refs.text.innerHTML.replace('<p class="dummy"></p>', compile(tokens));
|
this.$refs.text.innerHTML = this.$refs.text.innerHTML.replace('<p class="dummy"></p>', compile(tokens));
|
||||||
|
|
||||||
Array.from(this.refs.text.children).forEach(e => {
|
Array.from(this.$refs.text.children).forEach(e => {
|
||||||
if (e.tagName == 'MK-URL') riot.mount(e);
|
if (e.tagName == 'MK-URL') riot.mount(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@
|
||||||
tokens
|
tokens
|
||||||
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
||||||
.map(t => {
|
.map(t => {
|
||||||
riot.mount(this.refs.text.appendChild(document.createElement('mk-url-preview')), {
|
riot.mount(this.$refs.text.appendChild(document.createElement('mk-url-preview')), {
|
||||||
url: t.url
|
url: t.url
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -569,7 +569,7 @@
|
||||||
|
|
||||||
this.react = () => {
|
this.react = () => {
|
||||||
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
|
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
|
||||||
source: this.refs.reactButton,
|
source: this.$refs.reactButton,
|
||||||
post: this.p,
|
post: this.p,
|
||||||
compact: true
|
compact: true
|
||||||
});
|
});
|
||||||
|
@ -577,7 +577,7 @@
|
||||||
|
|
||||||
this.menu = () => {
|
this.menu = () => {
|
||||||
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
|
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
|
||||||
source: this.refs.menuButton,
|
source: this.$refs.menuButton,
|
||||||
post: this.p,
|
post: this.p,
|
||||||
compact: true
|
compact: true
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
this.toggleDrawer = () => {
|
this.toggleDrawer = () => {
|
||||||
this.isDrawerOpening = !this.isDrawerOpening;
|
this.isDrawerOpening = !this.isDrawerOpening;
|
||||||
this.refs.nav.root.style.display = this.isDrawerOpening ? 'block' : 'none';
|
this.$refs.nav.root.style.display = this.isDrawerOpening ? 'block' : 'none';
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onStreamNotification = notification => {
|
this.onStreamNotification = notification => {
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setTitle = title => {
|
this.setTitle = title => {
|
||||||
this.refs.title.innerHTML = title;
|
this.$refs.title.innerHTML = title;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setFunc = (fn, icon) => {
|
this.setFunc = (fn, icon) => {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.list.on('loaded', () => {
|
this.$refs.list.on('loaded', () => {
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.list.on('loaded', () => {
|
this.$refs.list.on('loaded', () => {
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
return this.api('users/posts', {
|
return this.api('users/posts', {
|
||||||
user_id: this.user.id,
|
user_id: this.user.id,
|
||||||
with_media: this.withMedia,
|
with_media: this.withMedia,
|
||||||
until_id: this.refs.timeline.tail().id
|
until_id: this.$refs.timeline.tail().id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onStats = stats => {
|
this.onStats = stats => {
|
||||||
this.refs.chart.addData(1 - stats.cpu_usage);
|
this.$refs.chart.addData(1 - stats.cpu_usage);
|
||||||
|
|
||||||
const percentage = (stats.cpu_usage * 100).toFixed(0);
|
const percentage = (stats.cpu_usage * 100).toFixed(0);
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
|
|
||||||
this.onStats = stats => {
|
this.onStats = stats => {
|
||||||
stats.mem.used = stats.mem.total - stats.mem.free;
|
stats.mem.used = stats.mem.total - stats.mem.free;
|
||||||
this.refs.chart.addData(1 - (stats.mem.used / stats.mem.total));
|
this.$refs.chart.addData(1 - (stats.mem.used / stats.mem.total));
|
||||||
|
|
||||||
const percentage = (stats.mem.used / stats.mem.total * 100).toFixed(0);
|
const percentage = (stats.mem.used / stats.mem.total * 100).toFixed(0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue