1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-15 07:08:56 +09:00
This commit is contained in:
こぴなたみぽ 2018-02-07 18:17:59 +09:00
parent ea70350dcc
commit 07efc8e150
90 changed files with 427 additions and 425 deletions

View File

@ -114,13 +114,13 @@
state: 'waiting'
});
this.refs.form.on('denied', () => {
this.$refs.form.on('denied', () => {
this.update({
state: 'denied'
});
});
this.refs.form.on('accepted', this.accepted);
this.$refs.form.on('accepted', this.accepted);
}
}).catch(error => {
this.update({

View File

@ -289,7 +289,7 @@
this.files = null;
this.on('mount', () => {
this.refs.uploader.on('uploaded', file => {
this.$refs.uploader.on('uploaded', file => {
this.update({
files: [file]
});
@ -297,7 +297,7 @@
});
this.upload = file => {
this.refs.uploader.upload(file);
this.$refs.uploader.upload(file);
};
this.clearReply = () => {
@ -311,7 +311,7 @@
this.update({
files: null
});
this.refs.text.value = '';
this.$refs.text.value = '';
};
this.post = () => {
@ -324,7 +324,7 @@
: undefined;
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,
reply_id: this.reply ? this.reply.id : undefined,
channel_id: this.channel.id
@ -340,11 +340,11 @@
};
this.changeFile = () => {
Array.from(this.refs.file.files).forEach(this.upload);
Array.from(this.$refs.file.files).forEach(this.upload);
};
this.selectFile = () => {
this.refs.file.click();
this.$refs.file.click();
};
this.drive = () => {

View File

@ -136,7 +136,7 @@
};
this.selectFile = () => {
this.refs.file.click();
this.$refs.file.click();
};
this.selectFileFromDrive = () => {
@ -155,7 +155,7 @@
this.sending = true;
this.api('messaging/messages/create', {
user_id: this.opts.user.id,
text: this.refs.text.value
text: this.$refs.text.value
}).then(message => {
this.clear();
}).catch(err => {
@ -167,7 +167,7 @@
};
this.clear = () => {
this.refs.text.value = '';
this.$refs.text.value = '';
this.files = [];
this.update();
};

View File

@ -389,7 +389,7 @@
};
this.search = () => {
const q = this.refs.search.value;
const q = this.$refs.search.value;
if (q == '') {
this.searchResult = [];
return;
@ -416,7 +416,7 @@
case 40: // [↓]
e.preventDefault();
e.stopPropagation();
this.refs.searchResult.childNodes[0].focus();
this.$refs.searchResult.childNodes[0].focus();
break;
}
};
@ -435,19 +435,19 @@
case e.which == 27: // [ESC]
cancel();
this.refs.search.focus();
this.$refs.search.focus();
break;
case e.which == 9 && e.shiftKey: // [TAB] + [Shift]
case e.which == 38: // [↑]
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;
case e.which == 9: // [TAB]
case e.which == 40: // [↓]
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;
}
};

View File

@ -217,9 +217,9 @@
if (this.message.text) {
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);
});
@ -227,7 +227,7 @@
tokens
.filter(t => t.type == 'link')
.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, {
url: t.content
});

View File

@ -296,7 +296,7 @@
this.scrollToBottom();
n.parentNode.removeChild(n);
};
this.refs.notifications.appendChild(n);
this.$refs.notifications.appendChild(n);
setTimeout(() => {
n.style.opacity = 0;

View File

@ -95,7 +95,7 @@
this.add = () => {
this.choices.push('');
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) => {

View File

@ -85,29 +85,29 @@
this.on('mount', () => {
const rect = this.source.getBoundingClientRect();
const width = this.refs.popover.offsetWidth;
const height = this.refs.popover.offsetHeight;
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';
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';
this.$refs.popover.style.left = (x - (width / 2)) + 'px';
this.$refs.popover.style.top = y + 'px';
}
anime({
targets: this.refs.backdrop,
targets: this.$refs.backdrop,
opacity: 1,
duration: 100,
easing: 'linear'
});
anime({
targets: this.refs.popover,
targets: this.$refs.popover,
opacity: 1,
scale: [0.5, 1],
duration: 500
@ -124,7 +124,7 @@
};
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', {
post_id: this.post.id,
category: category
@ -135,17 +135,17 @@
};
this.close = () => {
this.refs.backdrop.style.pointerEvents = 'none';
this.$refs.backdrop.style.pointerEvents = 'none';
anime({
targets: this.refs.backdrop,
targets: this.$refs.backdrop,
opacity: 0,
duration: 200,
easing: 'linear'
});
this.refs.popover.style.pointerEvents = 'none';
this.$refs.popover.style.pointerEvents = 'none';
anime({
targets: this.refs.popover,
targets: this.$refs.popover,
opacity: 0,
scale: 0.5,
duration: 200,

View File

@ -25,10 +25,40 @@
const placeholder = '%i18n:common.tags.mk-reaction-picker.choose-reaction%';
export default {
props: ['post', 'cb'],
props: ['post', 'source', 'compact', 'cb'],
data: {
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: {
react: function(reaction) {
api('posts/reactions/create', {
@ -54,34 +84,6 @@
this.source = this.opts.source;
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 => {
@ -89,17 +91,17 @@
};
this.close = () => {
this.refs.backdrop.style.pointerEvents = 'none';
this.$refs.backdrop.style.pointerEvents = 'none';
anime({
targets: this.refs.backdrop,
targets: this.$refs.backdrop,
opacity: 0,
duration: 200,
easing: 'linear'
});
this.refs.popover.style.pointerEvents = 'none';
this.$refs.popover.style.pointerEvents = 'none';
anime({
targets: this.refs.popover,
targets: this.$refs.popover,
opacity: 0,
scale: 0.5,
duration: 200,

View File

@ -104,7 +104,7 @@
this.show = false;
this.on('mount', () => {
hljs.highlightBlock(this.refs.headers);
hljs.highlightBlock(this.$refs.headers);
});
this.toggle = () => {

View File

@ -108,7 +108,7 @@
this.oninput = () => {
this.api('users/show', {
username: this.refs.username.value
username: this.$refs.username.value
}).then(user => {
this.user = user;
this.trigger('user', user);
@ -119,16 +119,16 @@
this.onsubmit = e => {
e.preventDefault();
if (this.refs.username.value == '') {
this.refs.username.focus();
if (this.$refs.username.value == '') {
this.$refs.username.focus();
return false;
}
if (this.refs.password.value == '') {
this.refs.password.focus();
if (this.$refs.password.value == '') {
this.$refs.password.focus();
return false;
}
if (this.user && this.user.two_factor_enabled && this.refs.token.value == '') {
this.refs.token.focus();
if (this.user && this.user.two_factor_enabled && this.$refs.token.value == '') {
this.$refs.token.focus();
return false;
}
@ -137,9 +137,9 @@
});
this.api('signin', {
username: this.refs.username.value,
password: this.refs.password.value,
token: this.user && this.user.two_factor_enabled ? this.refs.token.value : undefined
username: this.$refs.username.value,
password: this.$refs.password.value,
token: this.user && this.user.two_factor_enabled ? this.$refs.token.value : undefined
}).then(() => {
location.reload();
}).catch(() => {

View File

@ -208,7 +208,7 @@
});
this.onChangeUsername = () => {
const username = this.refs.username.value;
const username = this.$refs.username.value;
if (username == '') {
this.update({
@ -248,7 +248,7 @@
};
this.onChangePassword = () => {
const password = this.refs.password.value;
const password = this.$refs.password.value;
if (password == '') {
this.passwordStrength = '';
@ -258,12 +258,12 @@
const strength = getPasswordStrength(password);
this.passwordStrength = strength > 0.7 ? 'high' : strength > 0.3 ? 'medium' : 'low';
this.update();
this.refs.passwordMetar.style.width = `${strength * 100}%`;
this.$refs.passwordMetar.style.width = `${strength * 100}%`;
};
this.onChangePasswordRetype = () => {
const password = this.refs.password.value;
const retypedPassword = this.refs.passwordRetype.value;
const password = this.$refs.password.value;
const retypedPassword = this.$refs.passwordRetype.value;
if (retypedPassword == '') {
this.passwordRetypeState = null;
@ -276,8 +276,8 @@
this.onsubmit = e => {
e.preventDefault();
const username = this.refs.username.value;
const password = this.refs.password.value;
const username = this.$refs.username.value;
const password = this.$refs.password.value;
const locker = document.body.appendChild(document.createElement('mk-locker'));

View File

@ -28,9 +28,9 @@
const m = now.getMinutes();
const h = now.getHours();
const ctx = this.refs.canvas.getContext('2d');
const canvW = this.refs.canvas.width;
const canvH = this.refs.canvas.height;
const ctx = this.$refs.canvas.getContext('2d');
const canvW = this.$refs.canvas.width;
const canvH = this.$refs.canvas.height;
ctx.clearRect(0, 0, canvW, canvH);
{ // 背景

View File

@ -177,12 +177,12 @@
};
this.applySelect = () => {
Array.from(this.refs.users.children).forEach(el => {
Array.from(this.$refs.users.children).forEach(el => {
el.removeAttribute('data-selected');
});
this.refs.users.children[this.select].setAttribute('data-selected', 'true');
this.refs.users.children[this.select].focus();
this.$refs.users.children[this.select].setAttribute('data-selected', 'true');
this.$refs.users.children[this.select].focus();
};
this.complete = user => {

View File

@ -168,7 +168,7 @@
this.cropper = null;
this.on('mount', () => {
this.img = this.refs.window.refs.img;
this.img = this.$refs.window.refs.img;
this.cropper = new Cropper(this.img, {
aspectRatio: this.aspectRatio,
highlight: false,
@ -179,18 +179,18 @@
this.ok = () => {
this.cropper.getCroppedCanvas().toBlob(blob => {
this.trigger('cropped', blob);
this.refs.window.close();
this.$refs.window.close();
});
};
this.skip = () => {
this.trigger('skipped');
this.refs.window.close();
this.$refs.window.close();
};
this.cancel = () => {
this.trigger('canceled');
this.refs.window.close();
this.$refs.window.close();
};
</script>
</mk-crop-window>

View File

@ -62,8 +62,8 @@
});
this.close = () => {
this.refs.bg.style.pointerEvents = 'none';
this.refs.main.style.pointerEvents = 'none';
this.$refs.bg.style.pointerEvents = 'none';
this.$refs.main.style.pointerEvents = 'none';
anime({
targets: this.root,
opacity: 0,

View File

@ -94,19 +94,19 @@
});
this.on('mount', () => {
this.refs.header.innerHTML = this.opts.title;
this.refs.body.innerHTML = this.opts.text;
this.$refs.header.innerHTML = this.opts.title;
this.$refs.body.innerHTML = this.opts.text;
this.refs.bg.style.pointerEvents = 'auto';
this.$refs.bg.style.pointerEvents = 'auto';
anime({
targets: this.refs.bg,
targets: this.$refs.bg,
opacity: 1,
duration: 100,
easing: 'linear'
});
anime({
targets: this.refs.main,
targets: this.$refs.main,
opacity: 1,
scale: [1.2, 1],
duration: 300,
@ -115,17 +115,17 @@
});
this.close = () => {
this.refs.bg.style.pointerEvents = 'none';
this.$refs.bg.style.pointerEvents = 'none';
anime({
targets: this.refs.bg,
targets: this.$refs.bg,
opacity: 0,
duration: 300,
easing: 'linear'
});
this.refs.main.style.pointerEvents = 'none';
this.$refs.main.style.pointerEvents = 'none';
anime({
targets: this.refs.main,
targets: this.$refs.main,
opacity: 0,
scale: 0.8,
duration: 300,

View File

@ -16,29 +16,29 @@
this.browser = this.opts.browser;
this.on('mount', () => {
this.refs.ctx.on('closed', () => {
this.$refs.ctx.on('closed', () => {
this.trigger('closed');
this.unmount();
});
});
this.open = pos => {
this.refs.ctx.open(pos);
this.$refs.ctx.open(pos);
};
this.createFolder = () => {
this.browser.createFolder();
this.refs.ctx.close();
this.$refs.ctx.close();
};
this.upload = () => {
this.browser.selectLocalFile();
this.refs.ctx.close();
this.$refs.ctx.close();
};
this.urlUpload = () => {
this.browser.urlUpload();
this.refs.ctx.close();
this.$refs.ctx.close();
};
</script>
</mk-drive-browser-base-contextmenu>

View File

@ -33,7 +33,7 @@
this.folder = this.opts.folder ? this.opts.folder : null;
this.popout = () => {
const folder = this.refs.window.refs.browser.folder;
const folder = this.$refs.window.refs.browser.folder;
if (folder) {
return `${_URL_}/i/drive/folder/${folder.id}`;
} else {
@ -42,7 +42,7 @@
};
this.on('mount', () => {
this.refs.window.on('closed', () => {
this.$refs.window.on('closed', () => {
this.unmount();
});
@ -54,7 +54,7 @@
});
this.close = () => {
this.refs.window.close();
this.$refs.window.close();
};
</script>
</mk-drive-browser-window>

View File

@ -275,11 +275,11 @@
this.isDragSource = false;
this.on('mount', () => {
this.refs.uploader.on('uploaded', file => {
this.$refs.uploader.on('uploaded', file => {
this.addFile(file, true);
});
this.refs.uploader.on('change-uploads', uploads => {
this.$refs.uploader.on('change-uploads', uploads => {
this.update({
uploads: uploads
});
@ -332,35 +332,35 @@
};
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 top = e.pageY + this.refs.main.scrollTop - rect.top - window.pageYOffset
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 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 cursorY = e.pageY + this.refs.main.scrollTop - rect.top - window.pageYOffset;
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 w = cursorX - left;
const h = cursorY - top;
if (w > 0) {
this.refs.selection.style.width = w + 'px';
this.refs.selection.style.left = left + 'px';
this.$refs.selection.style.width = w + 'px';
this.$refs.selection.style.left = left + 'px';
} else {
this.refs.selection.style.width = -w + 'px';
this.refs.selection.style.left = cursorX + 'px';
this.$refs.selection.style.width = -w + 'px';
this.$refs.selection.style.left = cursorX + 'px';
}
if (h > 0) {
this.refs.selection.style.height = h + 'px';
this.refs.selection.style.top = top + 'px';
this.$refs.selection.style.height = h + 'px';
this.$refs.selection.style.top = top + 'px';
} else {
this.refs.selection.style.height = -h + 'px';
this.refs.selection.style.top = cursorY + 'px';
this.$refs.selection.style.height = -h + 'px';
this.$refs.selection.style.top = cursorY + 'px';
}
};
@ -368,7 +368,7 @@
document.documentElement.removeEventListener('mousemove', move);
document.documentElement.removeEventListener('mouseup', up);
this.refs.selection.style.display = 'none';
this.$refs.selection.style.display = 'none';
};
document.documentElement.addEventListener('mousemove', move);
@ -482,7 +482,7 @@
};
this.selectLocalFile = () => {
this.refs.fileInput.click();
this.$refs.fileInput.click();
};
this.urlUpload = () => {
@ -516,14 +516,14 @@
};
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, folder) => {
if (folder && typeof folder == 'object') folder = folder.id;
this.refs.uploader.upload(file, folder);
this.$refs.uploader.upload(file, folder);
};
this.chooseFile = file => {

View File

@ -48,18 +48,18 @@
this.file = this.opts.file;
this.on('mount', () => {
this.refs.ctx.on('closed', () => {
this.$refs.ctx.on('closed', () => {
this.trigger('closed');
this.unmount();
});
});
this.open = pos => {
this.refs.ctx.open(pos);
this.$refs.ctx.open(pos);
};
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 => {
this.api('drive/files/update', {
@ -71,7 +71,7 @@
this.copyUrl = () => {
copyToClipboard(this.file.url);
this.refs.ctx.close();
this.$refs.ctx.close();
dialog('%fa:check%%i18n:desktop.tags.mk-drive-browser-file-contextmenu.copied%',
'%i18n:desktop.tags.mk-drive-browser-file-contextmenu.copied-url-to-clipboard%', [{
text: '%i18n:common.ok%'
@ -79,16 +79,16 @@
};
this.download = () => {
this.refs.ctx.close();
this.$refs.ctx.close();
};
this.setAvatar = () => {
this.refs.ctx.close();
this.$refs.ctx.close();
updateAvatar(this.I, null, this.file);
};
this.setBanner = () => {
this.refs.ctx.close();
this.$refs.ctx.close();
updateBanner(this.I, null, this.file);
};

View File

@ -206,7 +206,7 @@
this.onload = () => {
if (this.file.properties.average_color) {
anime({
targets: this.refs.thumbnail,
targets: this.$refs.thumbnail,
backgroundColor: `rgba(${this.file.properties.average_color.join(',')}, 0)`,
duration: 100,
easing: 'linear'

View File

@ -26,9 +26,9 @@
this.folder = this.opts.folder;
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.unmount();
});
@ -36,21 +36,21 @@
this.move = () => {
this.browser.move(this.folder.id);
this.refs.ctx.close();
this.$refs.ctx.close();
};
this.newWindow = () => {
this.browser.newWindow(this.folder.id);
this.refs.ctx.close();
this.$refs.ctx.close();
};
this.createFolder = () => {
this.browser.createFolder();
this.refs.ctx.close();
this.$refs.ctx.close();
};
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 => {
this.api('drive/folders/update', {

View File

@ -84,7 +84,7 @@
if (this.requests.length > 30) this.requests.shift();
this.update();
this.refs.log.scrollTop = this.refs.log.scrollHeight;
this.$refs.log.scrollTop = this.$refs.log.scrollHeight;
};
this.func = () => {

View File

@ -15,7 +15,7 @@
this.initializing = true;
this.on('mount', () => {
this.refs.activity.on('view-changed', view => {
this.$refs.activity.on('view-changed', view => {
this.data.view = view;
this.save();
});
@ -23,7 +23,7 @@
this.func = () => {
if (++this.data.design == 3) this.data.design = 0;
this.refs.activity.update({
this.$refs.activity.update({
design: this.data.design
});
this.save();

View File

@ -82,7 +82,7 @@
channel: channel
});
this.refs.channel.zap(channel);
this.$refs.channel.zap(channel);
});
};
@ -185,7 +185,7 @@
};
this.scrollToBottom = () => {
this.refs.posts.scrollTop = this.refs.posts.scrollHeight;
this.$refs.posts.scrollTop = this.$refs.posts.scrollHeight;
};
</script>
</mk-channel>
@ -279,7 +279,7 @@
this.mixin('api');
this.clear = () => {
this.refs.text.value = '';
this.$refs.text.value = '';
};
this.onkeydown = e => {
@ -291,7 +291,7 @@
wait: true
});
let text = this.refs.text.value;
let text = this.$refs.text.value;
let reply = null;
if (/^>>([0-9]+) /.test(text)) {

View File

@ -76,7 +76,7 @@
this.onDocumentKeydown = e => {
if (e.target.tagName != 'INPUT' && tag != 'TEXTAREA') {
if (e.which == 84) { // t
this.refs.timeline.focus();
this.$refs.timeline.focus();
}
}
};
@ -89,24 +89,24 @@
isLoading: false,
isEmpty: posts.length == 0
});
this.refs.timeline.setPosts(posts);
this.$refs.timeline.setPosts(posts);
if (cb) cb();
});
};
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({
moreLoading: true
});
this.api('posts/mentions', {
following: this.mode == 'following',
until_id: this.refs.timeline.tail().id
until_id: this.$refs.timeline.tail().id
}).then(posts => {
this.update({
moreLoading: false
});
this.refs.timeline.prependPosts(posts);
this.$refs.timeline.prependPosts(posts);
});
};

View File

@ -37,7 +37,7 @@
this.mixin('widget');
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')), {
user: user
});

View File

@ -84,7 +84,7 @@
});
this.api('posts/create', {
text: this.refs.text.value
text: this.$refs.text.value
}).then(data => {
this.clear();
}).catch(err => {
@ -97,7 +97,7 @@
};
this.clear = () => {
this.refs.text.value = '';
this.$refs.text.value = '';
};
</script>
</mk-post-form-home-widget>

View File

@ -284,7 +284,7 @@
});
this.onStats = stats => {
this.refs.pie.render(stats.cpu_usage);
this.$refs.pie.render(stats.cpu_usage);
};
</script>
</mk-server-home-widget-cpu>
@ -344,7 +344,7 @@
this.onStats = stats => {
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({
total: stats.mem.total,
@ -411,7 +411,7 @@
this.onStats = stats => {
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({
total: stats.disk.total,

View File

@ -101,17 +101,17 @@
const index = Math.floor(Math.random() * this.images.length);
const img = `url(${ this.images[index].url }?thumbnail&size=1024)`;
this.refs.slideB.style.backgroundImage = img;
this.$refs.slideB.style.backgroundImage = img;
anime({
targets: this.refs.slideB,
targets: this.$refs.slideB,
opacity: 1,
duration: 1000,
easing: 'linear',
complete: () => {
this.refs.slideA.style.backgroundImage = img;
this.$refs.slideA.style.backgroundImage = img;
anime({
targets: this.refs.slideB,
targets: this.$refs.slideB,
opacity: 0,
duration: 0
});
@ -133,8 +133,8 @@
fetching: false,
images: images
});
this.refs.slideA.style.backgroundImage = '';
this.refs.slideB.style.backgroundImage = '';
this.$refs.slideA.style.backgroundImage = '';
this.$refs.slideB.style.backgroundImage = '';
this.change();
});
};

View File

@ -75,7 +75,7 @@
this.onDocumentKeydown = e => {
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
if (e.which == 84) { // t
this.refs.timeline.focus();
this.$refs.timeline.focus();
}
}
};
@ -92,23 +92,23 @@
isLoading: false,
isEmpty: posts.length == 0
});
this.refs.timeline.setPosts(posts);
this.$refs.timeline.setPosts(posts);
if (cb) cb();
});
};
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({
moreLoading: true
});
this.api('posts/timeline', {
until_id: this.refs.timeline.tail().id
until_id: this.$refs.timeline.tail().id
}).then(posts => {
this.update({
moreLoading: false
});
this.refs.timeline.prependPosts(posts);
this.$refs.timeline.prependPosts(posts);
});
};
@ -116,7 +116,7 @@
this.update({
isEmpty: false
});
this.refs.timeline.addPost(post);
this.$refs.timeline.addPost(post);
};
this.onStreamFollow = () => {

View File

@ -69,12 +69,12 @@
});
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 = () => {
anime({
targets: this.refs.tip,
targets: this.$refs.tip,
opacity: 0,
duration: 500,
easing: 'linear',
@ -83,7 +83,7 @@
setTimeout(() => {
anime({
targets: this.refs.tip,
targets: this.$refs.tip,
opacity: 1,
duration: 500,
easing: 'linear'

View File

@ -197,7 +197,7 @@
this.bakedHomeData = this.bakeHomeData();
this.on('mount', () => {
this.refs.tl.on('loaded', () => {
this.$refs.tl.on('loaded', () => {
this.trigger('loaded');
});
@ -212,11 +212,11 @@
});
if (!this.opts.customize) {
if (this.refs.left.children.length == 0) {
this.refs.left.parentNode.removeChild(this.refs.left);
if (this.$refs.left.children.length == 0) {
this.$refs.left.parentNode.removeChild(this.$refs.left);
}
if (this.refs.right.children.length == 0) {
this.refs.right.parentNode.removeChild(this.refs.right);
if (this.$refs.right.children.length == 0) {
this.$refs.right.parentNode.removeChild(this.$refs.right);
}
}
@ -242,10 +242,10 @@
}
};
new Sortable(this.refs.left, sortableOption);
new Sortable(this.refs.right, sortableOption);
new Sortable(this.refs.maintop, sortableOption);
new Sortable(this.refs.trash, Object.assign({}, sortableOption, {
new Sortable(this.$refs.left, sortableOption);
new Sortable(this.$refs.right, sortableOption);
new Sortable(this.$refs.maintop, sortableOption);
new Sortable(this.$refs.trash, Object.assign({}, sortableOption, {
onAdd: evt => {
const el = evt.item;
const id = el.getAttribute('data-widget-id');
@ -257,8 +257,8 @@
}
if (!this.opts.customize) {
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.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;
}
});
@ -299,23 +299,23 @@
switch (widget.place) {
case 'left':
if (prepend) {
this.refs.left.insertBefore(actualEl, this.refs.left.firstChild);
this.$refs.left.insertBefore(actualEl, this.$refs.left.firstChild);
} else {
this.refs.left.appendChild(actualEl);
this.$refs.left.appendChild(actualEl);
}
break;
case 'right':
if (prepend) {
this.refs.right.insertBefore(actualEl, this.refs.right.firstChild);
this.$refs.right.insertBefore(actualEl, this.$refs.right.firstChild);
} else {
this.refs.right.appendChild(actualEl);
this.$refs.right.appendChild(actualEl);
}
break;
case 'main':
if (this.opts.customize) {
this.refs.maintop.appendChild(actualEl);
this.$refs.maintop.appendChild(actualEl);
} else {
this.refs.main.insertBefore(actualEl, this.refs.tl.root);
this.$refs.main.insertBefore(actualEl, this.$refs.tl.root);
}
break;
}
@ -324,7 +324,7 @@
id: widget.id,
data: widget.data,
place: widget.place,
tl: this.refs.tl
tl: this.$refs.tl
})[0];
this.home.push(tag);
@ -341,7 +341,7 @@
this.addWidget = () => {
const widget = {
name: this.refs.widgetSelector.options[this.refs.widgetSelector.selectedIndex].value,
name: this.$refs.widgetSelector.options[this.$refs.widgetSelector.selectedIndex].value,
id: uuid(),
place: 'left',
data: {}
@ -357,21 +357,21 @@
this.saveHome = () => {
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 widget = this.I.client_settings.home.find(w => w.id == id);
widget.place = 'left';
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 widget = this.I.client_settings.home.find(w => w.id == id);
widget.place = 'right';
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 widget = this.I.client_settings.home.find(w => w.id == id);
widget.place = 'main';

View File

@ -86,17 +86,17 @@
};
this.mousemove = e => {
const rect = this.refs.view.getBoundingClientRect();
const rect = this.$refs.view.getBoundingClientRect();
const mouseX = e.clientX - rect.left;
const mouseY = e.clientY - rect.top;
const xp = mouseX / this.refs.view.offsetWidth * 100;
const yp = mouseY / this.refs.view.offsetHeight * 100;
this.refs.view.style.backgroundPosition = xp + '% ' + yp + '%';
this.refs.view.style.backgroundImage = 'url("' + this.image.url + '?thumbnail")';
const xp = mouseX / this.$refs.view.offsetWidth * 100;
const yp = mouseY / this.$refs.view.offsetHeight * 100;
this.$refs.view.style.backgroundPosition = xp + '% ' + yp + '%';
this.$refs.view.style.backgroundImage = 'url("' + this.image.url + '?thumbnail")';
};
this.mouseleave = () => {
this.refs.view.style.backgroundPosition = '';
this.$refs.view.style.backgroundPosition = '';
};
this.click = ev => {

View File

@ -129,11 +129,11 @@
this.type = this.opts.type ? this.opts.type : 'text';
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;
this.text.focus();
this.refs.window.on('closing', () => {
this.$refs.window.on('closing', () => {
if (this.done) {
this.opts.onOk(this.text.value);
} else {
@ -141,20 +141,20 @@
}
});
this.refs.window.on('closed', () => {
this.$refs.window.on('closed', () => {
this.unmount();
});
});
this.cancel = () => {
this.done = false;
this.refs.window.close();
this.$refs.window.close();
};
this.ok = () => {
if (!this.allowEmpty && this.text.value == '') return;
this.done = true;
this.refs.window.close();
this.$refs.window.close();
};
this.onInput = () => {

View File

@ -24,7 +24,7 @@
this.popout = `${_URL_}/i/messaging/${this.user.username}`;
this.on('mount', () => {
this.refs.window.on('closed', () => {
this.$refs.window.on('closed', () => {
this.unmount();
});
});

View File

@ -20,11 +20,11 @@
</style>
<script>
this.on('mount', () => {
this.refs.window.on('closed', () => {
this.$refs.window.on('closed', () => {
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')), {
user: user
});

View File

@ -15,7 +15,7 @@
this.on('mount', () => {
document.title = 'Misskey Drive';
this.refs.browser.on('move-root', () => {
this.$refs.browser.on('move-root', () => {
const title = 'Misskey Drive';
// Rewrite URL
@ -24,7 +24,7 @@
document.title = title;
});
this.refs.browser.on('open-folder', folder => {
this.$refs.browser.on('open-folder', folder => {
const title = folder.name + ' | Misskey Drive';
// Rewrite URL

View File

@ -280,7 +280,7 @@
</style>
<script>
this.on('mount', () => {
this.refs.signin.on('user', user => {
this.$refs.signin.on('user', user => {
this.update({
user: user
});

View File

@ -21,7 +21,7 @@
this.page = this.opts.mode || 'timeline';
this.on('mount', () => {
this.refs.ui.refs.home.on('loaded', () => {
this.$refs.ui.refs.home.on('loaded', () => {
Progress.done();
});
document.title = 'Misskey';

View File

@ -12,7 +12,7 @@
this.on('mount', () => {
Progress.start();
this.refs.ui.refs.search.on('loaded', () => {
this.$refs.ui.refs.search.on('loaded', () => {
Progress.done();
});
});

View File

@ -133,12 +133,12 @@
this.on('mount', () => {
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.ok();
});
this.refs.browser.on('change-selection', files => {
this.$refs.browser.on('change-selection', files => {
this.update({
files: files
});
@ -146,7 +146,7 @@
});
this.upload = () => {
this.refs.browser.selectLocalFile();
this.$refs.browser.selectLocalFile();
};
this.close = () => {

View File

@ -14,12 +14,12 @@
this.on('mount', () => {
Progress.start();
this.refs.ui.refs.user.on('user-fetched', user => {
this.$refs.ui.refs.user.on('user-fetched', user => {
Progress.set(0.5);
document.title = user.name + ' | Misskey';
});
this.refs.ui.refs.user.on('loaded', () => {
this.$refs.ui.refs.user.on('loaded', () => {
Progress.done();
});
});

View File

@ -120,9 +120,9 @@
if (this.post.text) {
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);
});
}

View File

@ -256,9 +256,9 @@
if (this.p.text) {
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);
});
@ -266,7 +266,7 @@
tokens
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
.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
});
});
@ -299,14 +299,14 @@
this.react = () => {
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
source: this.refs.reactButton,
source: this.$refs.reactButton,
post: this.p
});
};
this.menu = () => {
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
source: this.refs.menuButton,
source: this.$refs.menuButton,
post: this.p
});
};

View File

@ -42,23 +42,23 @@
this.files = [];
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.refs.window.refs.form.on('post', () => {
this.refs.window.close();
this.$refs.window.refs.form.on('post', () => {
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({
uploadingFiles: files || []
});
});
this.refs.window.refs.form.on('change-files', files => {
this.$refs.window.refs.form.on('change-files', files => {
this.update({
files: files || []
});

View File

@ -319,32 +319,32 @@
: 'post';
this.on('mount', () => {
this.refs.uploader.on('uploaded', file => {
this.$refs.uploader.on('uploaded', 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.autocomplete = new Autocomplete(this.refs.text);
this.autocomplete = new Autocomplete(this.$refs.text);
this.autocomplete.attach();
// 書きかけの投稿を復元
const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftId];
if (draft) {
this.refs.text.value = draft.data.text;
this.$refs.text.value = draft.data.text;
this.files = draft.data.files;
if (draft.data.poll) {
this.poll = true;
this.update();
this.refs.poll.set(draft.data.poll);
this.$refs.poll.set(draft.data.poll);
}
this.trigger('change-files', this.files);
this.update();
}
new Sortable(this.refs.media, {
new Sortable(this.$refs.media, {
animation: 150
});
});
@ -354,11 +354,11 @@
});
this.focus = () => {
this.refs.text.focus();
this.$refs.text.focus();
};
this.clear = () => {
this.refs.text.value = '';
this.$refs.text.value = '';
this.files = [];
this.poll = false;
this.trigger('change-files');
@ -422,7 +422,7 @@
};
this.selectFile = () => {
this.refs.file.click();
this.$refs.file.click();
};
this.selectFileFromDrive = () => {
@ -435,11 +435,11 @@
};
this.changeFile = () => {
Array.from(this.refs.file.files).forEach(this.upload);
Array.from(this.$refs.file.files).forEach(this.upload);
};
this.upload = file => {
this.refs.uploader.upload(file);
this.$refs.uploader.upload(file);
};
this.addFile = file => {
@ -471,7 +471,7 @@
const files = [];
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 file = this.files.find(f => f.id == id);
files.push(file);
@ -479,11 +479,11 @@
}
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,
reply_id: this.inReplyToPost ? this.inReplyToPost.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 => {
this.clear();
this.removeDraft();
@ -507,7 +507,7 @@
};
this.kao = () => {
this.refs.text.value += getKao();
this.$refs.text.value += getKao();
};
this.on('update', () => {
@ -520,9 +520,9 @@
data[this.draftId] = {
updated_at: new Date(),
data: {
text: this.refs.text.value,
text: this.$refs.text.value,
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
}
}

View File

@ -78,7 +78,7 @@
this.max = parseInt(this.opts.max, 10);
this.on('mount', () => {
this.refs.window.on('closed', () => {
this.$refs.window.on('closed', () => {
this.unmount();
});
});
@ -91,7 +91,7 @@
};
this.close = () => {
this.refs.window.close();
this.$refs.window.close();
};
</script>
</mk-progress-dialog>

View File

@ -19,23 +19,23 @@
this.onDocumentKeydown = e => {
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
if (e.which == 27) { // Esc
this.refs.window.close();
this.$refs.window.close();
}
}
};
this.on('mount', () => {
this.refs.window.refs.form.on('cancel', () => {
this.refs.window.close();
this.$refs.window.refs.form.on('cancel', () => {
this.$refs.window.close();
});
this.refs.window.refs.form.on('posted', () => {
this.refs.window.close();
this.$refs.window.refs.form.on('posted', () => {
this.$refs.window.close();
});
document.addEventListener('keydown', this.onDocumentKeydown);
this.refs.window.on('closed', () => {
this.$refs.window.on('closed', () => {
this.unmount();
});
});

View File

@ -117,11 +117,11 @@
quote: true
});
this.refs.form.on('post', () => {
this.$refs.form.on('post', () => {
this.trigger('posted');
});
this.refs.form.focus();
this.$refs.form.focus();
};
</script>
</mk-repost-form>

View File

@ -53,7 +53,7 @@
isLoading: false,
isEmpty: posts.length == 0
});
this.refs.timeline.setPosts(posts);
this.$refs.timeline.setPosts(posts);
this.trigger('loaded');
});
});
@ -66,7 +66,7 @@
this.onDocumentKeydown = e => {
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
if (e.which == 84) { // t
this.refs.timeline.focus();
this.$refs.timeline.focus();
}
}
};
@ -84,7 +84,7 @@
this.update({
moreLoading: false
});
this.refs.timeline.prependPosts(posts);
this.$refs.timeline.prependPosts(posts);
});
};

View File

@ -26,7 +26,7 @@
this.query = this.opts.query;
this.on('mount', () => {
this.refs.posts.on('loaded', () => {
this.$refs.posts.on('loaded', () => {
this.trigger('loaded');
});
});

View File

@ -141,33 +141,33 @@
this.title = this.opts.title || '%fa:R file%ファイルを選択';
this.on('mount', () => {
this.refs.window.refs.browser.on('selected', file => {
this.$refs.window.refs.browser.on('selected', file => {
this.files = [file];
this.ok();
});
this.refs.window.refs.browser.on('change-selection', files => {
this.$refs.window.refs.browser.on('change-selection', files => {
this.update({
files: files
});
});
this.refs.window.on('closed', () => {
this.$refs.window.on('closed', () => {
this.unmount();
});
});
this.close = () => {
this.refs.window.close();
this.$refs.window.close();
};
this.upload = () => {
this.refs.window.refs.browser.selectLocalFile();
this.$refs.window.refs.browser.selectLocalFile();
};
this.ok = () => {
this.trigger('selected', this.multiple ? this.files : this.files[0]);
this.refs.window.close();
this.$refs.window.close();
};
</script>
</mk-select-file-from-drive-window>

View File

@ -95,18 +95,18 @@
this.title = this.opts.title || '%fa:R folder%フォルダを選択';
this.on('mount', () => {
this.refs.window.on('closed', () => {
this.$refs.window.on('closed', () => {
this.unmount();
});
});
this.close = () => {
this.refs.window.close();
this.$refs.window.close();
};
this.ok = () => {
this.trigger('selected', this.refs.window.refs.browser.folder);
this.refs.window.close();
this.trigger('selected', this.$refs.window.refs.browser.folder);
this.$refs.window.close();
};
</script>
</mk-select-folder-from-drive-window>

View File

@ -18,13 +18,13 @@
</style>
<script>
this.on('mount', () => {
this.refs.window.on('closed', () => {
this.$refs.window.on('closed', () => {
this.unmount();
});
});
this.close = () => {
this.refs.window.close();
this.$refs.window.close();
};
</script>
</mk-settings-window>

View File

@ -179,10 +179,10 @@
this.updateAccount = () => {
this.api('i/update', {
name: this.refs.accountName.value,
location: this.refs.accountLocation.value || null,
description: this.refs.accountDescription.value || null,
birthday: this.refs.accountBirthday.value || null
name: this.$refs.accountName.value,
location: this.$refs.accountLocation.value || null,
description: this.$refs.accountDescription.value || null,
birthday: this.$refs.accountBirthday.value || null
}).then(() => {
notify('プロフィールを更新しました');
});
@ -320,7 +320,7 @@
this.submit = () => {
this.api('i/2fa/done', {
token: this.refs.token.value
token: this.$refs.token.value
}).then(() => {
notify('%i18n:desktop.tags.mk-2fa-setting.success%');
this.I.two_factor_enabled = true;

View File

@ -43,9 +43,9 @@
this.on('mount', () => {
if (this.post.text) {
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);
});
}

View File

@ -437,10 +437,10 @@
this.refresh = post => {
this.set(post);
this.update();
if (this.refs.reactionsViewer) this.refs.reactionsViewer.update({
if (this.$refs.reactionsViewer) this.$refs.reactionsViewer.update({
post
});
if (this.refs.pollViewer) this.refs.pollViewer.init(post);
if (this.$refs.pollViewer) this.$refs.pollViewer.init(post);
};
this.onStreamPostUpdated = data => {
@ -484,9 +484,9 @@
if (this.p.text) {
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);
});
@ -494,7 +494,7 @@
tokens
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
.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
});
});
@ -521,14 +521,14 @@
this.react = () => {
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
source: this.refs.reactButton,
source: this.$refs.reactButton,
post: this.p
});
};
this.menu = () => {
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
source: this.refs.menuButton,
source: this.$refs.menuButton,
post: this.p
});
};

View File

@ -180,7 +180,7 @@
this.onsubmit = e => {
e.preventDefault();
this.page('/search?q=' + encodeURIComponent(this.refs.q.value));
this.page('/search?q=' + encodeURIComponent(this.$refs.q.value));
};
</script>
</mk-ui-header-search>

View File

@ -88,7 +88,7 @@
this.onDocumentKeydown = e => {
if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA') {
if (e.which == 84) { // [t]
this.refs.timeline.focus();
this.$refs.timeline.focus();
}
}
};
@ -103,25 +103,25 @@
isLoading: false,
isEmpty: posts.length == 0
});
this.refs.timeline.setPosts(posts);
this.$refs.timeline.setPosts(posts);
if (cb) cb();
});
};
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({
moreLoading: true
});
this.api('users/posts', {
user_id: this.user.id,
with_replies: this.mode == 'with-replies',
until_id: this.refs.timeline.tail().id
until_id: this.$refs.timeline.tail().id
}).then(posts => {
this.update({
moreLoading: false
});
this.refs.timeline.prependPosts(posts);
this.$refs.timeline.prependPosts(posts);
});
};

View File

@ -206,10 +206,10 @@
const z = 1.25; // 奥行き(小さいほど奥)
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
if (blur <= 10) this.refs.banner.style.filter = `blur(${blur}px)`;
if (blur <= 10) this.$refs.banner.style.filter = `blur(${blur}px)`;
};
this.onUpdateBanner = () => {
@ -715,12 +715,12 @@
this.user = this.opts.user;
this.on('mount', () => {
this.refs.tl.on('loaded', () => {
this.$refs.tl.on('loaded', () => {
this.trigger('loaded');
});
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.scrollFollowerLeft = new ScrollFollower(this.$refs.left, this.parent.root.getBoundingClientRect().top);
this.scrollFollowerRight = new ScrollFollower(this.$refs.right, this.parent.root.getBoundingClientRect().top);
});
this.on('unmount', () => {
@ -729,7 +729,7 @@
});
this.warp = date => {
this.refs.tl.warp(date);
this.$refs.tl.warp(date);
};
</script>
</mk-user-home>

View File

@ -199,13 +199,13 @@
this.canResize = !this.isFlexible;
this.on('mount', () => {
this.refs.main.style.width = this.opts.width || '530px';
this.refs.main.style.height = this.opts.height || 'auto';
this.$refs.main.style.width = this.opts.width || '530px';
this.$refs.main.style.height = this.opts.height || 'auto';
this.refs.main.style.top = '15%';
this.refs.main.style.left = (window.innerWidth / 2) - (this.refs.main.offsetWidth / 2) + 'px';
this.$refs.main.style.top = '15%';
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();
});
@ -219,15 +219,15 @@
});
this.onBrowserResize = () => {
const position = this.refs.main.getBoundingClientRect();
const position = this.$refs.main.getBoundingClientRect();
const browserWidth = window.innerWidth;
const browserHeight = window.innerHeight;
const windowWidth = this.refs.main.offsetWidth;
const windowHeight = this.refs.main.offsetHeight;
if (position.left < 0) this.refs.main.style.left = 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.top + windowHeight > browserHeight) this.refs.main.style.top = browserHeight - windowHeight + 'px';
const windowWidth = this.$refs.main.offsetWidth;
const windowHeight = this.$refs.main.offsetHeight;
if (position.left < 0) this.$refs.main.style.left = 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.top + windowHeight > browserHeight) this.$refs.main.style.top = browserHeight - windowHeight + 'px';
};
this.open = () => {
@ -236,25 +236,25 @@
this.top();
if (this.isModal) {
this.refs.bg.style.pointerEvents = 'auto';
this.$refs.bg.style.pointerEvents = 'auto';
anime({
targets: this.refs.bg,
targets: this.$refs.bg,
opacity: 1,
duration: 100,
easing: 'linear'
});
}
this.refs.main.style.pointerEvents = 'auto';
this.$refs.main.style.pointerEvents = 'auto';
anime({
targets: this.refs.main,
targets: this.$refs.main,
opacity: 1,
scale: [1.1, 1],
duration: 200,
easing: 'easeOutQuad'
});
//this.refs.main.focus();
//this.$refs.main.focus();
setTimeout(() => {
this.trigger('opened');
@ -262,10 +262,10 @@
};
this.popout = () => {
const position = this.refs.main.getBoundingClientRect();
const position = this.$refs.main.getBoundingClientRect();
const width = parseInt(getComputedStyle(this.refs.main, '').width, 10);
const height = parseInt(getComputedStyle(this.refs.main, '').height, 10);
const width = parseInt(getComputedStyle(this.$refs.main, '').width, 10);
const height = parseInt(getComputedStyle(this.$refs.main, '').height, 10);
const x = window.screenX + position.left;
const y = window.screenY + position.top;
@ -281,19 +281,19 @@
this.trigger('closing');
if (this.isModal) {
this.refs.bg.style.pointerEvents = 'none';
this.$refs.bg.style.pointerEvents = 'none';
anime({
targets: this.refs.bg,
targets: this.$refs.bg,
opacity: 0,
duration: 300,
easing: 'linear'
});
}
this.refs.main.style.pointerEvents = 'none';
this.$refs.main.style.pointerEvents = 'none';
anime({
targets: this.refs.main,
targets: this.$refs.main,
opacity: 0,
scale: 0.8,
duration: 300,
@ -318,8 +318,8 @@
});
if (z > 0) {
this.refs.main.style.zIndex = z + 1;
if (this.isModal) this.refs.bg.style.zIndex = z + 1;
this.$refs.main.style.zIndex = z + 1;
if (this.isModal) this.$refs.bg.style.zIndex = z + 1;
}
};
@ -340,9 +340,9 @@
this.onHeaderMousedown = e => {
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 clickY = e.clientY;
@ -350,8 +350,8 @@
const moveBaseY = clickY - position.top;
const browserWidth = window.innerWidth;
const browserHeight = window.innerHeight;
const windowWidth = this.refs.main.offsetWidth;
const windowHeight = this.refs.main.offsetHeight;
const windowWidth = this.$refs.main.offsetWidth;
const windowHeight = this.$refs.main.offsetHeight;
// 動かした時
dragListen(me => {
@ -370,8 +370,8 @@
// 右はみ出し
if (moveLeft + windowWidth > browserWidth) moveLeft = browserWidth - windowWidth;
this.refs.main.style.left = moveLeft + 'px';
this.refs.main.style.top = moveTop + 'px';
this.$refs.main.style.left = moveLeft + 'px';
this.$refs.main.style.top = moveTop + 'px';
});
};
@ -380,8 +380,8 @@
e.preventDefault();
const base = e.clientY;
const height = parseInt(getComputedStyle(this.refs.main, '').height, 10);
const top = parseInt(getComputedStyle(this.refs.main, '').top, 10);
const height = parseInt(getComputedStyle(this.$refs.main, '').height, 10);
const top = parseInt(getComputedStyle(this.$refs.main, '').top, 10);
// 動かした時
dragListen(me => {
@ -406,8 +406,8 @@
e.preventDefault();
const base = e.clientX;
const width = parseInt(getComputedStyle(this.refs.main, '').width, 10);
const left = parseInt(getComputedStyle(this.refs.main, '').left, 10);
const width = parseInt(getComputedStyle(this.$refs.main, '').width, 10);
const left = parseInt(getComputedStyle(this.$refs.main, '').left, 10);
const browserWidth = window.innerWidth;
// 動かした時
@ -430,8 +430,8 @@
e.preventDefault();
const base = e.clientY;
const height = parseInt(getComputedStyle(this.refs.main, '').height, 10);
const top = parseInt(getComputedStyle(this.refs.main, '').top, 10);
const height = parseInt(getComputedStyle(this.$refs.main, '').height, 10);
const top = parseInt(getComputedStyle(this.$refs.main, '').top, 10);
const browserHeight = window.innerHeight;
// 動かした時
@ -454,8 +454,8 @@
e.preventDefault();
const base = e.clientX;
const width = parseInt(getComputedStyle(this.refs.main, '').width, 10);
const left = parseInt(getComputedStyle(this.refs.main, '').left, 10);
const width = parseInt(getComputedStyle(this.$refs.main, '').width, 10);
const left = parseInt(getComputedStyle(this.$refs.main, '').left, 10);
// 動かした時
dragListen(me => {
@ -501,22 +501,22 @@
// 高さを適用
this.applyTransformHeight = height => {
this.refs.main.style.height = height + 'px';
this.$refs.main.style.height = height + 'px';
};
// 幅を適用
this.applyTransformWidth = width => {
this.refs.main.style.width = width + 'px';
this.$refs.main.style.width = width + 'px';
};
// Y座標を適用
this.applyTransformTop = top => {
this.refs.main.style.top = top + 'px';
this.$refs.main.style.top = top + 'px';
};
// X座標を適用
this.applyTransformLeft = left => {
this.refs.main.style.left = left + 'px';
this.$refs.main.style.left = left + 'px';
};
function dragListen(fn) {

View File

@ -183,7 +183,7 @@
this.nidState = null;
this.onChangeNid = () => {
const nid = this.refs.nid.value;
const nid = this.$refs.nid.value;
if (nid == '') {
this.update({
@ -223,13 +223,13 @@
};
this.onsubmit = () => {
const name = this.refs.name.value;
const nid = this.refs.nid.value;
const description = this.refs.description.value;
const cb = this.refs.cb.value;
const name = this.$refs.name.value;
const nid = this.$refs.nid.value;
const description = this.$refs.description.value;
const cb = this.$refs.cb.value;
const permission = [];
this.refs.permission.querySelectorAll('input').forEach(el => {
this.$refs.permission.querySelectorAll('input').forEach(el => {
if (el.checked) permission.push(el.value);
});

View File

@ -62,7 +62,7 @@
};
this.ok = () => {
this.trigger('selected', this.refs.browser.folder);
this.trigger('selected', this.$refs.browser.folder);
this.unmount();
};
</script>

View File

@ -63,13 +63,13 @@
this.files = [];
this.on('mount', () => {
this.refs.browser.on('change-selection', files => {
this.$refs.browser.on('change-selection', files => {
this.update({
files: files
});
});
this.refs.browser.on('selected', file => {
this.$refs.browser.on('selected', file => {
this.trigger('selected', file);
this.unmount();
});

View File

@ -209,7 +209,7 @@
}
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.refs.file.click();
this.$refs.file.click();
};
this.createFolder = () => {
@ -574,7 +574,7 @@
};
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>
</mk-drive>

View File

@ -243,7 +243,7 @@
this.onImageLoaded = () => {
const self = this;
EXIF.getData(this.refs.img, function() {
EXIF.getData(this.$refs.img, function() {
const allMetaData = EXIF.getAllTags(this);
self.update({
exif: allMetaData

View File

@ -28,7 +28,7 @@
this.fetch = () => {
this.api('posts/timeline').then(posts => {
this.refs.timeline.setPosts(posts);
this.$refs.timeline.setPosts(posts);
});
};
@ -47,7 +47,7 @@
this.more = () => {
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({
isEmpty: false
});
this.refs.timeline.addPost(post);
this.$refs.timeline.addPost(post);
};
this.onStreamFollow = () => {

View File

@ -15,7 +15,7 @@
</style>
<script>
this.on('mount', () => {
this.refs.tl.on('loaded', () => {
this.$refs.tl.on('loaded', () => {
this.trigger('loaded');
});
});

View File

@ -15,22 +15,22 @@
ui.trigger('title', '%fa:cloud%%i18n:mobile.tags.mk-drive-page.drive%');
ui.trigger('func', () => {
this.refs.ui.refs.browser.openContextMenu();
this.$refs.ui.refs.browser.openContextMenu();
}, '%fa:ellipsis-h%');
this.refs.ui.refs.browser.on('begin-fetch', () => {
this.$refs.ui.refs.browser.on('begin-fetch', () => {
Progress.start();
});
this.refs.ui.refs.browser.on('fetched-mid', () => {
this.$refs.ui.refs.browser.on('fetched-mid', () => {
Progress.set(0.5);
});
this.refs.ui.refs.browser.on('fetched', () => {
this.$refs.ui.refs.browser.on('fetched', () => {
Progress.done();
});
this.refs.ui.refs.browser.on('move-root', () => {
this.$refs.ui.refs.browser.on('move-root', () => {
const title = 'Misskey Drive';
// Rewrite URL
@ -40,7 +40,7 @@
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';
if (!silent) {
@ -53,7 +53,7 @@
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';
if (!silent) {

View File

@ -34,7 +34,7 @@
this.connection.on('post', this.onStreamPost);
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
this.refs.ui.refs.home.on('loaded', () => {
this.$refs.ui.refs.home.on('loaded', () => {
Progress.done();
});
});

View File

@ -15,7 +15,7 @@
document.title = 'Misskey | %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);
});
});

View File

@ -23,7 +23,7 @@
Progress.start();
this.refs.ui.refs.notifications.on('fetched', () => {
this.$refs.ui.refs.notifications.on('fetched', () => {
Progress.done();
});
});

View File

@ -18,7 +18,7 @@
Progress.start();
this.refs.ui.refs.search.on('loaded', () => {
this.$refs.ui.refs.search.on('loaded', () => {
Progress.done();
});
});

View File

@ -59,12 +59,12 @@
this.on('mount', () => {
document.documentElement.style.background = '#fff';
this.refs.browser.on('selected', file => {
this.$refs.browser.on('selected', file => {
this.files = [file];
this.ok();
});
this.refs.browser.on('change-selection', files => {
this.$refs.browser.on('change-selection', files => {
this.update({
files: files
});
@ -72,7 +72,7 @@
});
this.upload = () => {
this.refs.browser.selectLocalFile();
this.$refs.browser.selectLocalFile();
};
this.close = () => {

View File

@ -231,10 +231,10 @@
});
this.api('i/update', {
name: this.refs.name.value,
location: this.refs.location.value || null,
description: this.refs.description.value || null,
birthday: this.refs.birthday.value || null
name: this.$refs.name.value,
location: this.$refs.location.value || null,
description: this.$refs.description.value || null,
birthday: this.$refs.birthday.value || null
}).then(() => {
this.update({
saving: false

View File

@ -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));
document.documentElement.style.background = '#313a42';
this.refs.ui.refs.list.on('loaded', () => {
this.$refs.ui.refs.list.on('loaded', () => {
Progress.done();
});
});

View File

@ -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));
document.documentElement.style.background = '#313a42';
this.refs.ui.refs.list.on('loaded', () => {
this.$refs.ui.refs.list.on('loaded', () => {
Progress.done();
});
});

View File

@ -16,7 +16,7 @@
document.documentElement.style.background = '#313a42';
Progress.start();
this.refs.ui.refs.user.on('loaded', user => {
this.$refs.ui.refs.user.on('loaded', user => {
Progress.done();
document.title = user.name + ' | Misskey';
// TODO: ユーザー名をエスケープ

View File

@ -273,9 +273,9 @@
if (this.p.text) {
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);
});
@ -283,7 +283,7 @@
tokens
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
.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
});
});
@ -319,7 +319,7 @@
this.react = () => {
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
source: this.refs.reactButton,
source: this.$refs.reactButton,
post: this.p,
compact: true
});
@ -327,7 +327,7 @@
this.menu = () => {
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
source: this.refs.menuButton,
source: this.$refs.menuButton,
post: this.p,
compact: true
});

View File

@ -156,17 +156,17 @@
this.poll = false;
this.on('mount', () => {
this.refs.uploader.on('uploaded', file => {
this.$refs.uploader.on('uploaded', 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.refs.text.focus();
this.$refs.text.focus();
new Sortable(this.refs.attaches, {
new Sortable(this.$refs.attaches, {
animation: 150
});
});
@ -184,7 +184,7 @@
};
this.selectFile = () => {
this.refs.file.click();
this.$refs.file.click();
};
this.selectFileFromDrive = () => {
@ -197,11 +197,11 @@
};
this.changeFile = () => {
Array.from(this.refs.file.files).forEach(this.upload);
Array.from(this.$refs.file.files).forEach(this.upload);
};
this.upload = file => {
this.refs.uploader.upload(file);
this.$refs.uploader.upload(file);
};
this.addFile = file => {
@ -241,7 +241,7 @@
const files = [];
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 file = this.files.find(f => f.id == id);
files.push(file);
@ -249,10 +249,10 @@
}
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,
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 => {
this.trigger('post');
this.unmount();
@ -269,7 +269,7 @@
};
this.kao = () => {
this.refs.text.value += getKao();
this.$refs.text.value += getKao();
};
</script>
</mk-post-form>

View File

@ -8,7 +8,7 @@
this.query = this.opts.query;
this.on('mount', () => {
this.refs.posts.on('loaded', () => {
this.$refs.posts.on('loaded', () => {
this.trigger('loaded');
});
});

View File

@ -35,9 +35,9 @@
this.on('mount', () => {
if (this.post.text) {
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);
});
}

View File

@ -482,10 +482,10 @@
this.refresh = post => {
this.set(post);
this.update();
if (this.refs.reactionsViewer) this.refs.reactionsViewer.update({
if (this.$refs.reactionsViewer) this.$refs.reactionsViewer.update({
post
});
if (this.refs.pollViewer) this.refs.pollViewer.init(post);
if (this.$refs.pollViewer) this.$refs.pollViewer.init(post);
};
this.onStreamPostUpdated = data => {
@ -529,9 +529,9 @@
if (this.p.text) {
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);
});
@ -539,7 +539,7 @@
tokens
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
.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
});
});
@ -569,7 +569,7 @@
this.react = () => {
riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), {
source: this.refs.reactButton,
source: this.$refs.reactButton,
post: this.p,
compact: true
});
@ -577,7 +577,7 @@
this.menu = () => {
riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), {
source: this.refs.menuButton,
source: this.$refs.menuButton,
post: this.p,
compact: true
});

View File

@ -30,7 +30,7 @@
this.toggleDrawer = () => {
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 => {
@ -209,7 +209,7 @@
};
this.setTitle = title => {
this.refs.title.innerHTML = title;
this.$refs.title.innerHTML = title;
};
this.setFunc = (fn, icon) => {

View File

@ -20,7 +20,7 @@
};
this.on('mount', () => {
this.refs.list.on('loaded', () => {
this.$refs.list.on('loaded', () => {
this.trigger('loaded');
});
});

View File

@ -20,7 +20,7 @@
};
this.on('mount', () => {
this.refs.list.on('loaded', () => {
this.$refs.list.on('loaded', () => {
this.trigger('loaded');
});
});

View File

@ -26,7 +26,7 @@
return this.api('users/posts', {
user_id: this.user.id,
with_media: this.withMedia,
until_id: this.refs.timeline.tail().id
until_id: this.$refs.timeline.tail().id
});
};
</script>

View File

@ -93,7 +93,7 @@
});
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);
@ -124,7 +124,7 @@
this.onStats = stats => {
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);