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

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