forked from mirror/misskey
wip
This commit is contained in:
parent
3c3040783f
commit
7791431717
@ -19,16 +19,15 @@
|
|||||||
<script>
|
<script>
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
|
|
||||||
this.apps = []
|
this.apps = [];
|
||||||
this.fetching = true
|
this.fetching = true;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.api 'i/authorized_apps'
|
this.api('i/authorized_apps').then(apps => {
|
||||||
.then (apps) =>
|
this.apps = apps;
|
||||||
this.apps = apps
|
this.fetching = false;
|
||||||
this.fetching = false
|
|
||||||
this.update();
|
this.update();
|
||||||
.catch (err) =>
|
});
|
||||||
console.error err
|
});
|
||||||
</script>
|
</script>
|
||||||
</mk-authorized-apps>
|
</mk-authorized-apps>
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
<mk-copyright><span>(c) syuilo 2014-2017</span>
|
<mk-copyright>
|
||||||
|
<span>(c) syuilo 2014-2017</span>
|
||||||
<style>
|
<style>
|
||||||
:scope
|
:scope
|
||||||
display block
|
display block
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</mk-copyright>
|
</mk-copyright>
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
<script>
|
<script>
|
||||||
retry() {
|
retry() {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
this.opts.retry!
|
this.opts.retry();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</mk-core-error>
|
</mk-core-error>
|
||||||
|
@ -20,10 +20,5 @@
|
|||||||
opacity 1
|
opacity 1
|
||||||
40%
|
40%
|
||||||
opacity 0
|
opacity 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</mk-ellipsis>
|
</mk-ellipsis>
|
||||||
|
@ -21,9 +21,5 @@
|
|||||||
margin 0
|
margin 0
|
||||||
text-align center
|
text-align center
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</mk-introduction>
|
</mk-introduction>
|
||||||
|
@ -327,29 +327,29 @@
|
|||||||
key = e.which
|
key = e.which
|
||||||
switch (key)
|
switch (key)
|
||||||
| 9, 40 => // Key[TAB] or Key[↓]
|
| 9, 40 => // Key[TAB] or Key[↓]
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
this.refs.search-result.child-nodes[0].focus();
|
this.refs.search-result.childNodes[0].focus();
|
||||||
|
|
||||||
on-search-result-keydown(i, e) {
|
on-search-result-keydown(i, e) {
|
||||||
key = e.which
|
key = e.which
|
||||||
switch (key)
|
switch (key)
|
||||||
| 10, 13 => // Key[ENTER]
|
| 10, 13 => // Key[ENTER]
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
@search-result[i]._click!
|
@search-result[i]._click!
|
||||||
| 27 => // Key[ESC]
|
| 27 => // Key[ESC]
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
this.refs.search.focus();
|
this.refs.search.focus();
|
||||||
| 38 => // Key[↑]
|
| 38 => // Key[↑]
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
(this.refs.search-result.child-nodes[i].previous-element-sibling || this.refs.search-result.child-nodes[@search-result.length - 1]).focus();
|
(this.refs.search-result.childNodes[i].previous-element-sibling || this.refs.search-result.childNodes[@search-result.length - 1]).focus();
|
||||||
| 9, 40 => // Key[TAB] or Key[↓]
|
| 9, 40 => // Key[TAB] or Key[↓]
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
(this.refs.search-result.child-nodes[i].next-element-sibling || this.refs.search-result.child-nodes[0]).focus();
|
(this.refs.search-result.childNodes[i].next-element-sibling || this.refs.search-result.childNodes[0]).focus();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</mk-messaging>
|
</mk-messaging>
|
||||||
|
@ -203,13 +203,13 @@
|
|||||||
n.inner-HTML = '<i class="fa fa-arrow-circle-down"></i>' + message
|
n.inner-HTML = '<i class="fa fa-arrow-circle-down"></i>' + message
|
||||||
n.onclick = =>
|
n.onclick = =>
|
||||||
@scroll-to-bottom!
|
@scroll-to-bottom!
|
||||||
n.parent-node.remove-child n
|
n.parentNode.removeChild n
|
||||||
this.refs.notifications.appendChild n
|
this.refs.notifications.appendChild n
|
||||||
|
|
||||||
setTimeout =>
|
setTimeout =>
|
||||||
n.style.opacity = 0
|
n.style.opacity = 0
|
||||||
setTimeout =>
|
setTimeout =>
|
||||||
n.parent-node.remove-child n
|
n.parentNode.removeChild n
|
||||||
, 1000ms
|
, 1000ms
|
||||||
, 4000ms
|
, 4000ms
|
||||||
|
|
||||||
|
@ -6,13 +6,14 @@
|
|||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
// バグ? https://github.com/riot/riot/issues/2103
|
// https://github.com/riot/riot/issues/2103
|
||||||
#value = this.opts.value
|
//value = this.opts.value
|
||||||
value = this.opts.riot-value
|
const value = this.opts.riotValue;
|
||||||
max = this.opts.max
|
const max = this.opts.max;
|
||||||
|
|
||||||
if max? then if value > max then value = max
|
if (max != null && value > max) value = max;
|
||||||
|
|
||||||
this.root.innerHTML = value.to-locale-string!
|
this.root.innerHTML = value.toLocaleString();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</mk-number>
|
</mk-number>
|
||||||
|
@ -86,26 +86,31 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.choices = ['', '']
|
this.choices = ['', ''];
|
||||||
|
|
||||||
oninput(i, e) {
|
oninput(i, e) {
|
||||||
@choices[i] = e.target.value
|
this.choices[i] = e.target.value;
|
||||||
|
}
|
||||||
|
|
||||||
add() {
|
add() {
|
||||||
@choices.push ''
|
this.choices.push('');
|
||||||
this.update();
|
this.update();
|
||||||
this.refs.choices.child-nodes[@choices.length - 1].child-nodes[0].focus();
|
this.refs.choices.childNodes[this.choices.length - 1].childNodes[0].focus();
|
||||||
|
}
|
||||||
|
|
||||||
remove(i) {
|
remove(i) {
|
||||||
this.choices = @choices.filter((_, _i) -> _i != i)
|
this.choices = this.choices.filter((_, _i) => _i != i);
|
||||||
this.update();
|
this.update();
|
||||||
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
this.opts.ondestroy!
|
this.opts.ondestroy();
|
||||||
|
}
|
||||||
|
|
||||||
get() {
|
get() {
|
||||||
return {
|
return {
|
||||||
choices: @choices.filter (choice) -> choice != ''
|
choices: this.choices.filter(choice => choice != '')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</mk-poll-editor>
|
</mk-poll-editor>
|
||||||
|
@ -70,30 +70,35 @@
|
|||||||
<script>
|
<script>
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
|
|
||||||
this.post = this.opts.post
|
this.post = this.opts.post;
|
||||||
this.poll = @post.poll
|
this.poll = this.post.poll;
|
||||||
this.total = @poll.choices.reduce ((a, b) -> a + b.votes), 0
|
this.total = this.poll.choices.reduce((a, b) => a + b.votes, 0);
|
||||||
this.is-voted = @poll.choices.some (c) -> c.is_voted
|
this.isVoted = this.poll.choices.some(c => c.is_voted);
|
||||||
this.result = @is-voted
|
this.result = this.isVoted;
|
||||||
|
|
||||||
toggle-result() {
|
toggleResult() {
|
||||||
this.result = !@result
|
this.result = !this.result;
|
||||||
|
}
|
||||||
|
|
||||||
vote(id) {
|
vote(id) {
|
||||||
if (@poll.choices.some (c) -> c.is_voted) then return
|
if (this.poll.choices.some(c => c.is_voted)) return;
|
||||||
this.api 'posts/polls/vote' do
|
this.api('posts/polls/vote', {
|
||||||
post_id: @post.id
|
post_id: this.post.id,
|
||||||
choice: id
|
choice: id
|
||||||
.then =>
|
}).then(() => {
|
||||||
@poll.choices.for-each (c) ->
|
this.poll.choices.forEach(c => {
|
||||||
if c.id == id
|
if (c.id == id) {
|
||||||
c.votes++
|
c.votes++;
|
||||||
c.is_voted = true
|
c.is_voted = true;
|
||||||
@update do
|
}
|
||||||
poll: @poll
|
});
|
||||||
is-voted: true
|
this.update({
|
||||||
result: true
|
poll: this.poll,
|
||||||
total: @total + 1
|
isVoted: true,
|
||||||
|
result: true,
|
||||||
|
total: this.total + 1
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</mk-poll>
|
</mk-poll>
|
||||||
|
@ -51,8 +51,8 @@
|
|||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
this.mixin('stream');
|
this.mixin('stream');
|
||||||
|
|
||||||
this.history = []
|
this.history = [];
|
||||||
this.fetching = true
|
this.fetching = true;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.api 'i/signin_history'
|
this.api 'i/signin_history'
|
||||||
|
@ -99,8 +99,8 @@
|
|||||||
<script>
|
<script>
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
|
|
||||||
this.user = null
|
this.user = null;
|
||||||
this.signing = false
|
this.signing = false;
|
||||||
|
|
||||||
oninput() {
|
oninput() {
|
||||||
this.api 'users/show' do
|
this.api 'users/show' do
|
||||||
@ -111,7 +111,7 @@
|
|||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
onsubmit(e) {
|
onsubmit(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
|
|
||||||
if this.refs.username.value == ''
|
if this.refs.username.value == ''
|
||||||
this.refs.username.focus();
|
this.refs.username.focus();
|
||||||
|
@ -177,24 +177,27 @@
|
|||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
this.mixin('get-password-strength');
|
this.mixin('get-password-strength');
|
||||||
|
|
||||||
this.username-state = null
|
this.usernameState = null;
|
||||||
this.password-strength = ''
|
this.passwordStrength = '';
|
||||||
this.password-retype-state = null
|
this.passwordRetypeState = null;
|
||||||
this.recaptchaed = false
|
this.recaptchaed = false;
|
||||||
|
|
||||||
window.on-recaptchaed = =>
|
window.onEecaptchaed = () => {
|
||||||
this.recaptchaed = true
|
this.recaptchaed = true;
|
||||||
this.update();
|
this.update();
|
||||||
|
}
|
||||||
|
|
||||||
window.on-recaptcha-expired = =>
|
window.onRecaptchaExpired = () => {
|
||||||
this.recaptchaed = false
|
this.recaptchaed = false;
|
||||||
this.update();
|
this.update();
|
||||||
|
}
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
head = (document.get-elements-by-tag-name 'head).0'
|
const head = (document.getElementsByTagName('head'))[0];
|
||||||
script = document.createElement 'script'
|
script = document.createElement 'script'
|
||||||
..set-attribute 'src' \https://www.google.com/recaptcha/api.js
|
..setAttribute 'src' \https://www.google.com/recaptcha/api.js
|
||||||
head.appendChild script
|
head.appendChild script
|
||||||
|
});
|
||||||
|
|
||||||
on-change-username() {
|
on-change-username() {
|
||||||
username = this.refs.username.value
|
username = this.refs.username.value
|
||||||
@ -263,7 +266,7 @@
|
|||||||
this.password-retype-state = 'not-match'
|
this.password-retype-state = 'not-match'
|
||||||
|
|
||||||
onsubmit(e) {
|
onsubmit(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
|
|
||||||
username = this.refs.username.value
|
username = this.refs.username.value
|
||||||
password = this.refs.password.value
|
password = this.refs.password.value
|
||||||
@ -286,7 +289,7 @@
|
|||||||
grecaptcha.reset!
|
grecaptcha.reset!
|
||||||
this.recaptchaed = false
|
this.recaptchaed = false
|
||||||
|
|
||||||
locker.parent-node.remove-child locker
|
locker.parentNode.removeChild locker
|
||||||
|
|
||||||
false
|
false
|
||||||
</script>
|
</script>
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
now = new Date!
|
const now = new Date();
|
||||||
this.d = now.get-date!
|
this.d = now.getDate();
|
||||||
this.m = now.get-month! + 1
|
this.m = now.getMonth() + 1;
|
||||||
</script>
|
</script>
|
||||||
</mk-special-message>
|
</mk-special-message>
|
||||||
|
@ -93,20 +93,22 @@
|
|||||||
<script>
|
<script>
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
|
|
||||||
this.url = this.opts.url
|
this.url = this.opts.url;
|
||||||
this.loading = true
|
this.loading = true;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
fetch CONFIG.url + '/api:url?url=' + @url
|
fetch(CONFIG.url + '/api:url?url=' + this.url).then(res => {
|
||||||
.then (res) =>
|
res.json().then(info => {
|
||||||
info <~ res.json!.then
|
this.title = info.title;
|
||||||
this.title = info.title
|
this.description = info.description;
|
||||||
this.description = info.description
|
this.thumbnail = info.thumbnail;
|
||||||
this.thumbnail = info.thumbnail
|
this.icon = info.icon;
|
||||||
this.icon = info.icon
|
this.sitename = info.sitename;
|
||||||
this.sitename = info.sitename
|
|
||||||
|
|
||||||
this.loading = false
|
this.loading = false;
|
||||||
this.update();
|
this.update();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</mk-url-preview>
|
</mk-url-preview>
|
||||||
|
@ -30,19 +30,20 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.url = this.opts.href
|
this.url = this.opts.href;
|
||||||
|
|
||||||
this.on('before-mount', () => {
|
this.on('before-mount', () => {
|
||||||
parser = document.createElement 'a'
|
parser = document.createElement('a');
|
||||||
parser.href = @url
|
parser.href = this.url;
|
||||||
|
|
||||||
this.schema = parser.protocol
|
this.schema = parser.protocol;
|
||||||
this.hostname = parser.hostname
|
this.hostname = parser.hostname;
|
||||||
this.port = parser.port
|
this.port = parser.port;
|
||||||
this.pathname = parser.pathname
|
this.pathname = parser.pathname;
|
||||||
this.query = parser.search
|
this.query = parser.search;
|
||||||
this.hash = parser.hash
|
this.hash = parser.hash;
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</mk-url>
|
</mk-url>
|
||||||
|
@ -124,25 +124,25 @@
|
|||||||
switch (key)
|
switch (key)
|
||||||
| 10, 13 => // Key[ENTER]
|
| 10, 13 => // Key[ENTER]
|
||||||
if @select != -1
|
if @select != -1
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
@complete @users[@select]
|
@complete @users[@select]
|
||||||
else
|
else
|
||||||
@close!
|
@close!
|
||||||
| 27 => // Key[ESC]
|
| 27 => // Key[ESC]
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
@close!
|
@close!
|
||||||
| 38 => // Key[↑]
|
| 38 => // Key[↑]
|
||||||
if @select != -1
|
if @select != -1
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
@select-prev!
|
@select-prev!
|
||||||
else
|
else
|
||||||
@close!
|
@close!
|
||||||
| 9, 40 => // Key[TAB] or Key[↓]
|
| 9, 40 => // Key[TAB] or Key[↓]
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
@select-next!
|
@select-next!
|
||||||
| _ =>
|
| _ =>
|
||||||
@close!
|
@close!
|
||||||
@ -167,7 +167,7 @@
|
|||||||
this.refs.users.children.for-each (el) =>
|
this.refs.users.children.for-each (el) =>
|
||||||
el.remove-attribute 'data-selected'
|
el.remove-attribute 'data-selected'
|
||||||
|
|
||||||
this.refs.users.children[@select].set-attribute 'data-selected' \true
|
this.refs.users.children[@select].setAttribute 'data-selected' \true
|
||||||
this.refs.users.children[@select].focus();
|
this.refs.users.children[@select].focus();
|
||||||
|
|
||||||
complete(user) {
|
complete(user) {
|
||||||
@ -177,11 +177,11 @@
|
|||||||
this.opts.close!
|
this.opts.close!
|
||||||
|
|
||||||
function contains(parent, child)
|
function contains(parent, child)
|
||||||
node = child.parent-node
|
node = child.parentNode
|
||||||
while node?
|
while node?
|
||||||
if node == parent
|
if node == parent
|
||||||
return true
|
return true
|
||||||
node = node.parent-node
|
node = node.parentNode
|
||||||
return false
|
return false
|
||||||
</script>
|
</script>
|
||||||
</mk-autocomplete-suggestion>
|
</mk-autocomplete-suggestion>
|
||||||
|
@ -95,10 +95,10 @@
|
|||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.root.add-event-listener 'contextmenu' (e) =>
|
this.root.add-event-listener 'contextmenu' (e) =>
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
|
|
||||||
mousedown(e) {
|
mousedown(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
if (!contains this.root, e.target) and (this.root != e.target)
|
if (!contains this.root, e.target) and (this.root != e.target)
|
||||||
@close!
|
@close!
|
||||||
return false
|
return false
|
||||||
@ -129,11 +129,11 @@
|
|||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
function contains(parent, child)
|
function contains(parent, child)
|
||||||
node = child.parent-node
|
node = child.parentNode
|
||||||
while (node != null)
|
while (node != null)
|
||||||
if (node == parent)
|
if (node == parent)
|
||||||
return true
|
return true
|
||||||
node = node.parent-node
|
node = node.parentNode
|
||||||
return false
|
return false
|
||||||
</script>
|
</script>
|
||||||
</mk-contextmenu>
|
</mk-contextmenu>
|
||||||
|
@ -51,8 +51,8 @@
|
|||||||
this.mixin('i');
|
this.mixin('i');
|
||||||
|
|
||||||
close(e) {
|
close(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
|
|
||||||
this.I.data.no_donation = true
|
this.I.data.no_donation = true
|
||||||
this.I.update!
|
this.I.update!
|
||||||
|
@ -24,15 +24,15 @@
|
|||||||
this.refs.ctx.open pos
|
this.refs.ctx.open pos
|
||||||
|
|
||||||
create-folder() {
|
create-folder() {
|
||||||
@browser.create-folder!
|
this.browser.create-folder!
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
upload() {
|
upload() {
|
||||||
@browser.select-local-file!
|
this.browser.select-local-file!
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
url-upload() {
|
url-upload() {
|
||||||
@browser.url-upload!
|
this.browser.url-upload!
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-browser-base-contextmenu>
|
</mk-drive-browser-base-contextmenu>
|
||||||
|
@ -293,7 +293,7 @@
|
|||||||
@add-file file, true
|
@add-file file, true
|
||||||
|
|
||||||
on-stream-drive-file-updated(file) {
|
on-stream-drive-file-updated(file) {
|
||||||
current = if @folder? then @folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != file.folder_id
|
if current != file.folder_id
|
||||||
@remove-file file
|
@remove-file file
|
||||||
else
|
else
|
||||||
@ -303,7 +303,7 @@
|
|||||||
@add-folder folder, true
|
@add-folder folder, true
|
||||||
|
|
||||||
on-stream-drive-folder-updated(folder) {
|
on-stream-drive-folder-updated(folder) {
|
||||||
current = if @folder? then @folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != folder.parent_id
|
if current != folder.parent_id
|
||||||
@remove-folder folder
|
@remove-folder folder
|
||||||
else
|
else
|
||||||
@ -350,29 +350,29 @@
|
|||||||
document.document-element.add-event-listener 'mouseup' up
|
document.document-element.add-event-listener 'mouseup' up
|
||||||
|
|
||||||
path-oncontextmenu(e) {
|
path-oncontextmenu(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stop-immediate-propagation!
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragover(e) {
|
ondragover(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
|
|
||||||
// ドラッグ元が自分自身の所有するアイテムかどうか
|
// ドラッグ元が自分自身の所有するアイテムかどうか
|
||||||
if !@is-drag-source
|
if !@is-drag-source
|
||||||
// ドラッグされてきたものがファイルだったら
|
// ドラッグされてきたものがファイルだったら
|
||||||
if e.data-transfer.effect-allowed == 'all'
|
if e.dataTransfer.effect-allowed == 'all'
|
||||||
e.data-transfer.drop-effect = 'copy'
|
e.dataTransfer.dropEffect = 'copy'
|
||||||
else
|
else
|
||||||
e.data-transfer.drop-effect = 'move'
|
e.dataTransfer.dropEffect = 'move'
|
||||||
this.draghover = true
|
this.draghover = true
|
||||||
else
|
else
|
||||||
// 自分自身にはドロップさせない
|
// 自分自身にはドロップさせない
|
||||||
e.data-transfer.drop-effect = 'none'
|
e.dataTransfer.dropEffect = 'none'
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragenter(e) {
|
ondragenter(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
if !@is-drag-source
|
if !@is-drag-source
|
||||||
this.draghover = true
|
this.draghover = true
|
||||||
|
|
||||||
@ -380,19 +380,19 @@
|
|||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
ondrop(e) {
|
ondrop(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
|
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
// ドロップされてきたものがファイルだったら
|
// ドロップされてきたものがファイルだったら
|
||||||
if e.data-transfer.files.length > 0
|
if e.dataTransfer.files.length > 0
|
||||||
Array.prototype.for-each.call e.data-transfer.files, (file) =>
|
Array.prototype.for-each.call e.dataTransfer.files, (file) =>
|
||||||
@upload file, @folder
|
@upload file, this.folder
|
||||||
return false
|
return false
|
||||||
|
|
||||||
// データ取得
|
// データ取得
|
||||||
data = e.data-transfer.get-data 'text'
|
data = e.dataTransfer.get-data 'text'
|
||||||
if !data?
|
if !data?
|
||||||
return false
|
return false
|
||||||
|
|
||||||
@ -402,12 +402,12 @@
|
|||||||
// (ドライブの)ファイルだったら
|
// (ドライブの)ファイルだったら
|
||||||
if obj.type == 'file'
|
if obj.type == 'file'
|
||||||
file = obj.id
|
file = obj.id
|
||||||
if (@files.some (f) => f.id == file)
|
if (this.files.some (f) => f.id == file)
|
||||||
return false
|
return false
|
||||||
@remove-file file
|
@remove-file file
|
||||||
this.api 'drive/files/update' do
|
this.api 'drive/files/update' do
|
||||||
file_id: file
|
file_id: file
|
||||||
folder_id: if @folder? then @folder.id else null
|
folder_id: if this.folder? then this.folder.id else null
|
||||||
.then =>
|
.then =>
|
||||||
// something
|
// something
|
||||||
.catch (err, text-status) =>
|
.catch (err, text-status) =>
|
||||||
@ -417,14 +417,14 @@
|
|||||||
else if obj.type == 'folder'
|
else if obj.type == 'folder'
|
||||||
folder = obj.id
|
folder = obj.id
|
||||||
// 移動先が自分自身ならreject
|
// 移動先が自分自身ならreject
|
||||||
if @folder? and folder == @folder.id
|
if this.folder? and folder == this.folder.id
|
||||||
return false
|
return false
|
||||||
if (@folders.some (f) => f.id == folder)
|
if (this.folders.some (f) => f.id == folder)
|
||||||
return false
|
return false
|
||||||
@remove-folder folder
|
@remove-folder folder
|
||||||
this.api 'drive/folders/update' do
|
this.api 'drive/folders/update' do
|
||||||
folder_id: folder
|
folder_id: folder
|
||||||
parent_id: if @folder? then @folder.id else null
|
parent_id: if this.folder? then this.folder.id else null
|
||||||
.then =>
|
.then =>
|
||||||
// something
|
// something
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
@ -439,7 +439,7 @@
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
oncontextmenu(e) {
|
oncontextmenu(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stop-immediate-propagation!
|
||||||
|
|
||||||
ctx = document.body.appendChild document.createElement 'mk-drive-browser-base-contextmenu'
|
ctx = document.body.appendChild document.createElement 'mk-drive-browser-base-contextmenu'
|
||||||
@ -464,7 +464,7 @@
|
|||||||
if url? and url != ''
|
if url? and url != ''
|
||||||
this.api 'drive/files/upload_from_url' do
|
this.api 'drive/files/upload_from_url' do
|
||||||
url: url
|
url: url
|
||||||
folder_id: if @folder? then @folder.id else undefined
|
folder_id: if this.folder? then this.folder.id else undefined
|
||||||
|
|
||||||
@dialog do
|
@dialog do
|
||||||
'<i class="fa fa-check"></i>アップロードをリクエストしました'
|
'<i class="fa fa-check"></i>アップロードをリクエストしました'
|
||||||
@ -481,7 +481,7 @@
|
|||||||
|
|
||||||
this.api 'drive/folders/create' do
|
this.api 'drive/folders/create' do
|
||||||
name: name
|
name: name
|
||||||
folder_id: if @folder? then @folder.id else undefined
|
folder_id: if this.folder? then this.folder.id else undefined
|
||||||
.then (folder) =>
|
.then (folder) =>
|
||||||
@add-folder folder, true
|
@add-folder folder, true
|
||||||
this.update();
|
this.update();
|
||||||
@ -492,7 +492,7 @@
|
|||||||
files = this.refs.file-input.files
|
files = this.refs.file-input.files
|
||||||
for i from 0 to files.length - 1
|
for i from 0 to files.length - 1
|
||||||
file = files.item i
|
file = files.item i
|
||||||
@upload file, @folder
|
@upload file, this.folder
|
||||||
|
|
||||||
upload(file, folder) {
|
upload(file, folder) {
|
||||||
if folder? and typeof folder == 'object'
|
if folder? and typeof folder == 'object'
|
||||||
@ -500,7 +500,7 @@
|
|||||||
this.refs.uploader.upload file, folder
|
this.refs.uploader.upload file, folder
|
||||||
|
|
||||||
get-selection() {
|
get-selection() {
|
||||||
@files.filter (file) -> file._selected
|
this.files.filter (file) -> file._selected
|
||||||
|
|
||||||
new-window(folder-id) {
|
new-window(folder-id) {
|
||||||
browser = document.body.appendChild document.createElement 'mk-drive-browser-window'
|
browser = document.body.appendChild document.createElement 'mk-drive-browser-window'
|
||||||
@ -538,55 +538,55 @@
|
|||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
add-folder(folder, unshift = false) {
|
add-folder(folder, unshift = false) {
|
||||||
current = if @folder? then @folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != folder.parent_id
|
if current != folder.parent_id
|
||||||
return
|
return
|
||||||
|
|
||||||
if (@folders.some (f) => f.id == folder.id)
|
if (this.folders.some (f) => f.id == folder.id)
|
||||||
exist = (@folders.map (f) -> f.id).index-of folder.id
|
exist = (this.folders.map (f) -> f.id).index-of folder.id
|
||||||
@folders[exist] = folder
|
this.folders[exist] = folder
|
||||||
this.update();
|
this.update();
|
||||||
return
|
return
|
||||||
|
|
||||||
if unshift
|
if unshift
|
||||||
@folders.unshift folder
|
this.folders.unshift folder
|
||||||
else
|
else
|
||||||
@folders.push folder
|
this.folders.push folder
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
add-file(file, unshift = false) {
|
add-file(file, unshift = false) {
|
||||||
current = if @folder? then @folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != file.folder_id
|
if current != file.folder_id
|
||||||
return
|
return
|
||||||
|
|
||||||
if (@files.some (f) => f.id == file.id)
|
if (this.files.some (f) => f.id == file.id)
|
||||||
exist = (@files.map (f) -> f.id).index-of file.id
|
exist = (this.files.map (f) -> f.id).index-of file.id
|
||||||
@files[exist] = file
|
this.files[exist] = file
|
||||||
this.update();
|
this.update();
|
||||||
return
|
return
|
||||||
|
|
||||||
if unshift
|
if unshift
|
||||||
@files.unshift file
|
this.files.unshift file
|
||||||
else
|
else
|
||||||
@files.push file
|
this.files.push file
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
remove-folder(folder) {
|
remove-folder(folder) {
|
||||||
if typeof folder == 'object'
|
if typeof folder == 'object'
|
||||||
folder = folder.id
|
folder = folder.id
|
||||||
this.folders = @folders.filter (f) -> f.id != folder
|
this.folders = this.folders.filter (f) -> f.id != folder
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
remove-file(file) {
|
remove-file(file) {
|
||||||
if typeof file == 'object'
|
if typeof file == 'object'
|
||||||
file = file.id
|
file = file.id
|
||||||
this.files = @files.filter (f) -> f.id != file
|
this.files = this.files.filter (f) -> f.id != file
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
go-root() {
|
go-root() {
|
||||||
if @folder != null
|
if this.folder != null
|
||||||
this.folder = null
|
this.folder = null
|
||||||
this.hierarchy-folders = []
|
this.hierarchy-folders = []
|
||||||
this.update();
|
this.update();
|
||||||
@ -608,7 +608,7 @@
|
|||||||
|
|
||||||
// フォルダ一覧取得
|
// フォルダ一覧取得
|
||||||
this.api 'drive/folders' do
|
this.api 'drive/folders' do
|
||||||
folder_id: if @folder? then @folder.id else null
|
folder_id: if this.folder? then this.folder.id else null
|
||||||
limit: folders-max + 1
|
limit: folders-max + 1
|
||||||
.then (folders) =>
|
.then (folders) =>
|
||||||
if folders.length == folders-max + 1
|
if folders.length == folders-max + 1
|
||||||
@ -621,7 +621,7 @@
|
|||||||
|
|
||||||
// ファイル一覧取得
|
// ファイル一覧取得
|
||||||
this.api 'drive/files' do
|
this.api 'drive/files' do
|
||||||
folder_id: if @folder? then @folder.id else null
|
folder_id: if this.folder? then this.folder.id else null
|
||||||
limit: files-max + 1
|
limit: files-max + 1
|
||||||
.then (files) =>
|
.then (files) =>
|
||||||
if files.length == files-max + 1
|
if files.length == files-max + 1
|
||||||
@ -645,11 +645,11 @@
|
|||||||
flag := true
|
flag := true
|
||||||
|
|
||||||
function contains(parent, child)
|
function contains(parent, child)
|
||||||
node = child.parent-node
|
node = child.parentNode
|
||||||
while node?
|
while node?
|
||||||
if node == parent
|
if node == parent
|
||||||
return true
|
return true
|
||||||
node = node.parent-node
|
node = node.parentNode
|
||||||
return false
|
return false
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-browser>
|
</mk-drive-browser>
|
||||||
|
@ -63,10 +63,10 @@
|
|||||||
name <~ @input-dialog do
|
name <~ @input-dialog do
|
||||||
'ファイル名の変更'
|
'ファイル名の変更'
|
||||||
'新しいファイル名を入力してください'
|
'新しいファイル名を入力してください'
|
||||||
@file.name
|
this.file.name
|
||||||
|
|
||||||
this.api 'drive/files/update' do
|
this.api 'drive/files/update' do
|
||||||
file_id: @file.id
|
file_id: this.file.id
|
||||||
name: name
|
name: name
|
||||||
.then =>
|
.then =>
|
||||||
// something
|
// something
|
||||||
@ -81,15 +81,15 @@
|
|||||||
|
|
||||||
set-avatar() {
|
set-avatar() {
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
@update-avatar this.I, null, @file
|
@update-avatar this.I, null, this.file
|
||||||
|
|
||||||
set-banner() {
|
set-banner() {
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
@update-banner this.I, null, @file
|
@update-banner this.I, null, this.file
|
||||||
|
|
||||||
set-wallpaper() {
|
set-wallpaper() {
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
@update-wallpaper this.I, null, @file
|
@update-wallpaper this.I, null, this.file
|
||||||
|
|
||||||
add-app() {
|
add-app() {
|
||||||
@NotImplementedException!
|
@NotImplementedException!
|
||||||
|
@ -144,43 +144,43 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.bytes-to-size = require('../../../common/scripts/bytes-to-size.js');
|
this.bytesToSize = require('../../../common/scripts/bytesToSize.js');
|
||||||
|
|
||||||
this.mixin('i');
|
this.mixin('i');
|
||||||
|
|
||||||
this.file = this.opts.file
|
this.file = this.opts.file
|
||||||
this.browser = this.parent
|
this.browser = this.parent
|
||||||
|
|
||||||
this.title = @file.name + '\n' + @file.type + ' ' + (@bytes-to-size @file.datasize)
|
this.title = this.file.name + '\n' + this.file.type + ' ' + (@bytesToSize this.file.datasize)
|
||||||
|
|
||||||
this.is-contextmenu-showing = false
|
this.is-contextmenu-showing = false
|
||||||
|
|
||||||
onclick() {
|
onclick() {
|
||||||
if @browser.multiple
|
if this.browser.multiple
|
||||||
if @file._selected?
|
if this.file._selected?
|
||||||
@file._selected = !@file._selected
|
this.file._selected = !this.file._selected
|
||||||
else
|
else
|
||||||
@file._selected = true
|
this.file._selected = true
|
||||||
@browser.trigger 'change-selection' @browser.get-selection!
|
this.browser.trigger 'change-selection' this.browser.get-selection!
|
||||||
else
|
else
|
||||||
if @file._selected
|
if this.file._selected
|
||||||
@browser.trigger 'selected' @file
|
this.browser.trigger 'selected' this.file
|
||||||
else
|
else
|
||||||
@browser.files.for-each (file) =>
|
this.browser.files.for-each (file) =>
|
||||||
file._selected = false
|
file._selected = false
|
||||||
@file._selected = true
|
this.file._selected = true
|
||||||
@browser.trigger 'change-selection' @file
|
this.browser.trigger 'change-selection' this.file
|
||||||
|
|
||||||
oncontextmenu(e) {
|
oncontextmenu(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stop-immediate-propagation!
|
||||||
|
|
||||||
this.is-contextmenu-showing = true
|
this.is-contextmenu-showing = true
|
||||||
this.update();
|
this.update();
|
||||||
ctx = document.body.appendChild document.createElement 'mk-drive-browser-file-contextmenu'
|
ctx = document.body.appendChild document.createElement 'mk-drive-browser-file-contextmenu'
|
||||||
ctx = riot.mount ctx, do
|
ctx = riot.mount ctx, do
|
||||||
browser: @browser
|
browser: this.browser
|
||||||
file: @file
|
file: this.file
|
||||||
ctx = ctx.0
|
ctx = ctx.0
|
||||||
ctx.open do
|
ctx.open do
|
||||||
x: e.page-x - window.page-x-offset
|
x: e.page-x - window.page-x-offset
|
||||||
@ -191,19 +191,19 @@
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
ondragstart(e) {
|
ondragstart(e) {
|
||||||
e.data-transfer.effect-allowed = 'move'
|
e.dataTransfer.effect-allowed = 'move'
|
||||||
e.data-transfer.set-data 'text' JSON.stringify do
|
e.dataTransfer.set-data 'text' JSON.stringify do
|
||||||
type: 'file'
|
type: 'file'
|
||||||
id: @file.id
|
id: this.file.id
|
||||||
file: @file
|
file: this.file
|
||||||
this.is-dragging = true
|
this.is-dragging = true
|
||||||
|
|
||||||
// 親ブラウザに対して、ドラッグが開始されたフラグを立てる
|
// 親ブラウザに対して、ドラッグが開始されたフラグを立てる
|
||||||
// (=あなたの子供が、ドラッグを開始しましたよ)
|
// (=あなたの子供が、ドラッグを開始しましたよ)
|
||||||
@browser.is-drag-source = true
|
this.browser.is-drag-source = true
|
||||||
|
|
||||||
ondragend(e) {
|
ondragend(e) {
|
||||||
this.is-dragging = false
|
this.is-dragging = false
|
||||||
@browser.is-drag-source = false
|
this.browser.is-drag-source = false
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-browser-file>
|
</mk-drive-browser-file>
|
||||||
|
@ -32,19 +32,19 @@
|
|||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
move() {
|
move() {
|
||||||
@browser.move @folder.id
|
this.browser.move this.folder.id
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
new-window() {
|
new-window() {
|
||||||
@browser.new-window @folder.id
|
this.browser.new-window this.folder.id
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
create-folder() {
|
create-folder() {
|
||||||
@browser.create-folder!
|
this.browser.create-folder!
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
upload() {
|
upload() {
|
||||||
@browser.select-lcoal-file!
|
this.browser.select-lcoal-file!
|
||||||
this.refs.ctx.close!
|
this.refs.ctx.close!
|
||||||
|
|
||||||
rename() {
|
rename() {
|
||||||
@ -53,10 +53,10 @@
|
|||||||
name <~ @input-dialog do
|
name <~ @input-dialog do
|
||||||
'フォルダ名の変更'
|
'フォルダ名の変更'
|
||||||
'新しいフォルダ名を入力してください'
|
'新しいフォルダ名を入力してください'
|
||||||
@folder.name
|
this.folder.name
|
||||||
|
|
||||||
this.api 'drive/folders/update' do
|
this.api 'drive/folders/update' do
|
||||||
folder_id: @folder.id
|
folder_id: this.folder.id
|
||||||
name: name
|
name: name
|
||||||
.then =>
|
.then =>
|
||||||
// something
|
// something
|
||||||
|
@ -56,13 +56,13 @@
|
|||||||
this.folder = this.opts.folder
|
this.folder = this.opts.folder
|
||||||
this.browser = this.parent
|
this.browser = this.parent
|
||||||
|
|
||||||
this.title = @folder.name
|
this.title = this.folder.name
|
||||||
this.hover = false
|
this.hover = false
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
this.is-contextmenu-showing = false
|
this.is-contextmenu-showing = false
|
||||||
|
|
||||||
onclick() {
|
onclick() {
|
||||||
@browser.move @folder
|
this.browser.move this.folder
|
||||||
|
|
||||||
onmouseover() {
|
onmouseover() {
|
||||||
this.hover = true
|
this.hover = true
|
||||||
@ -71,19 +71,19 @@
|
|||||||
this.hover = false
|
this.hover = false
|
||||||
|
|
||||||
ondragover(e) {
|
ondragover(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
|
|
||||||
// 自分自身がドラッグされていない場合
|
// 自分自身がドラッグされていない場合
|
||||||
if !@is-dragging
|
if !@is-dragging
|
||||||
// ドラッグされてきたものがファイルだったら
|
// ドラッグされてきたものがファイルだったら
|
||||||
if e.data-transfer.effect-allowed == 'all'
|
if e.dataTransfer.effect-allowed == 'all'
|
||||||
e.data-transfer.drop-effect = 'copy'
|
e.dataTransfer.dropEffect = 'copy'
|
||||||
else
|
else
|
||||||
e.data-transfer.drop-effect = 'move'
|
e.dataTransfer.dropEffect = 'move'
|
||||||
else
|
else
|
||||||
// 自分自身にはドロップさせない
|
// 自分自身にはドロップさせない
|
||||||
e.data-transfer.drop-effect = 'none'
|
e.dataTransfer.dropEffect = 'none'
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragenter() {
|
ondragenter() {
|
||||||
@ -94,17 +94,17 @@
|
|||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
ondrop(e) {
|
ondrop(e) {
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
// ファイルだったら
|
// ファイルだったら
|
||||||
if e.data-transfer.files.length > 0
|
if e.dataTransfer.files.length > 0
|
||||||
Array.prototype.for-each.call e.data-transfer.files, (file) =>
|
Array.prototype.for-each.call e.dataTransfer.files, (file) =>
|
||||||
@browser.upload file, @folder
|
this.browser.upload file, this.folder
|
||||||
return false
|
return false
|
||||||
|
|
||||||
// データ取得
|
// データ取得
|
||||||
data = e.data-transfer.get-data 'text'
|
data = e.dataTransfer.get-data 'text'
|
||||||
if !data?
|
if !data?
|
||||||
return false
|
return false
|
||||||
|
|
||||||
@ -114,10 +114,10 @@
|
|||||||
// (ドライブの)ファイルだったら
|
// (ドライブの)ファイルだったら
|
||||||
if obj.type == 'file'
|
if obj.type == 'file'
|
||||||
file = obj.id
|
file = obj.id
|
||||||
@browser.remove-file file
|
this.browser.remove-file file
|
||||||
this.api 'drive/files/update' do
|
this.api 'drive/files/update' do
|
||||||
file_id: file
|
file_id: file
|
||||||
folder_id: @folder.id
|
folder_id: this.folder.id
|
||||||
.then =>
|
.then =>
|
||||||
// something
|
// something
|
||||||
.catch (err, text-status) =>
|
.catch (err, text-status) =>
|
||||||
@ -127,12 +127,12 @@
|
|||||||
else if obj.type == 'folder'
|
else if obj.type == 'folder'
|
||||||
folder = obj.id
|
folder = obj.id
|
||||||
// 移動先が自分自身ならreject
|
// 移動先が自分自身ならreject
|
||||||
if folder == @folder.id
|
if folder == this.folder.id
|
||||||
return false
|
return false
|
||||||
@browser.remove-folder folder
|
this.browser.remove-folder folder
|
||||||
this.api 'drive/folders/update' do
|
this.api 'drive/folders/update' do
|
||||||
folder_id: folder
|
folder_id: folder
|
||||||
parent_id: @folder.id
|
parent_id: this.folder.id
|
||||||
.then =>
|
.then =>
|
||||||
// something
|
// something
|
||||||
.catch (err) =>
|
.catch (err) =>
|
||||||
@ -147,30 +147,30 @@
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
ondragstart(e) {
|
ondragstart(e) {
|
||||||
e.data-transfer.effect-allowed = 'move'
|
e.dataTransfer.effect-allowed = 'move'
|
||||||
e.data-transfer.set-data 'text' JSON.stringify do
|
e.dataTransfer.set-data 'text' JSON.stringify do
|
||||||
type: 'folder'
|
type: 'folder'
|
||||||
id: @folder.id
|
id: this.folder.id
|
||||||
this.is-dragging = true
|
this.is-dragging = true
|
||||||
|
|
||||||
// 親ブラウザに対して、ドラッグが開始されたフラグを立てる
|
// 親ブラウザに対して、ドラッグが開始されたフラグを立てる
|
||||||
// (=あなたの子供が、ドラッグを開始しましたよ)
|
// (=あなたの子供が、ドラッグを開始しましたよ)
|
||||||
@browser.is-drag-source = true
|
this.browser.is-drag-source = true
|
||||||
|
|
||||||
ondragend(e) {
|
ondragend(e) {
|
||||||
this.is-dragging = false
|
this.is-dragging = false
|
||||||
@browser.is-drag-source = false
|
this.browser.is-drag-source = false
|
||||||
|
|
||||||
oncontextmenu(e) {
|
oncontextmenu(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-immediate-propagation!
|
e.stop-immediate-propagation!
|
||||||
|
|
||||||
this.is-contextmenu-showing = true
|
this.is-contextmenu-showing = true
|
||||||
this.update();
|
this.update();
|
||||||
ctx = document.body.appendChild document.createElement 'mk-drive-browser-folder-contextmenu'
|
ctx = document.body.appendChild document.createElement 'mk-drive-browser-folder-contextmenu'
|
||||||
ctx = riot.mount ctx, do
|
ctx = riot.mount ctx, do
|
||||||
browser: @browser
|
browser: this.browser
|
||||||
folder: @folder
|
folder: this.folder
|
||||||
ctx = ctx.0
|
ctx = ctx.0
|
||||||
ctx.open do
|
ctx.open do
|
||||||
x: e.page-x - window.page-x-offset
|
x: e.page-x - window.page-x-offset
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
this.hover = false
|
this.hover = false
|
||||||
|
|
||||||
onclick() {
|
onclick() {
|
||||||
@browser.move @folder
|
this.browser.move this.folder
|
||||||
|
|
||||||
onmouseover() {
|
onmouseover() {
|
||||||
this.hover = true
|
this.hover = true
|
||||||
@ -26,39 +26,39 @@
|
|||||||
this.hover = false
|
this.hover = false
|
||||||
|
|
||||||
ondragover(e) {
|
ondragover(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
|
|
||||||
// このフォルダがルートかつカレントディレクトリならドロップ禁止
|
// このフォルダがルートかつカレントディレクトリならドロップ禁止
|
||||||
if @folder == null and @browser.folder == null
|
if this.folder == null and this.browser.folder == null
|
||||||
e.data-transfer.drop-effect = 'none'
|
e.dataTransfer.dropEffect = 'none'
|
||||||
// ドラッグされてきたものがファイルだったら
|
// ドラッグされてきたものがファイルだったら
|
||||||
else if e.data-transfer.effect-allowed == 'all'
|
else if e.dataTransfer.effect-allowed == 'all'
|
||||||
e.data-transfer.drop-effect = 'copy'
|
e.dataTransfer.dropEffect = 'copy'
|
||||||
else
|
else
|
||||||
e.data-transfer.drop-effect = 'move'
|
e.dataTransfer.dropEffect = 'move'
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragenter() {
|
ondragenter() {
|
||||||
if @folder != null or @browser.folder != null
|
if this.folder != null or this.browser.folder != null
|
||||||
this.draghover = true
|
this.draghover = true
|
||||||
|
|
||||||
ondragleave() {
|
ondragleave() {
|
||||||
if @folder != null or @browser.folder != null
|
if this.folder != null or this.browser.folder != null
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
ondrop(e) {
|
ondrop(e) {
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
// ファイルだったら
|
// ファイルだったら
|
||||||
if e.data-transfer.files.length > 0
|
if e.dataTransfer.files.length > 0
|
||||||
Array.prototype.for-each.call e.data-transfer.files, (file) =>
|
Array.prototype.for-each.call e.dataTransfer.files, (file) =>
|
||||||
@browser.upload file, @folder
|
this.browser.upload file, this.folder
|
||||||
return false
|
return false
|
||||||
|
|
||||||
// データ取得
|
// データ取得
|
||||||
data = e.data-transfer.get-data 'text'
|
data = e.dataTransfer.get-data 'text'
|
||||||
if !data?
|
if !data?
|
||||||
return false
|
return false
|
||||||
|
|
||||||
@ -68,10 +68,10 @@
|
|||||||
// (ドライブの)ファイルだったら
|
// (ドライブの)ファイルだったら
|
||||||
if obj.type == 'file'
|
if obj.type == 'file'
|
||||||
file = obj.id
|
file = obj.id
|
||||||
@browser.remove-file file
|
this.browser.remove-file file
|
||||||
this.api 'drive/files/update' do
|
this.api 'drive/files/update' do
|
||||||
file_id: file
|
file_id: file
|
||||||
folder_id: if @folder? then @folder.id else null
|
folder_id: if this.folder? then this.folder.id else null
|
||||||
.then =>
|
.then =>
|
||||||
// something
|
// something
|
||||||
.catch (err, text-status) =>
|
.catch (err, text-status) =>
|
||||||
@ -81,12 +81,12 @@
|
|||||||
else if obj.type == 'folder'
|
else if obj.type == 'folder'
|
||||||
folder = obj.id
|
folder = obj.id
|
||||||
// 移動先が自分自身ならreject
|
// 移動先が自分自身ならreject
|
||||||
if @folder? and folder == @folder.id
|
if this.folder? and folder == this.folder.id
|
||||||
return false
|
return false
|
||||||
@browser.remove-folder folder
|
this.browser.remove-folder folder
|
||||||
this.api 'drive/folders/update' do
|
this.api 'drive/folders/update' do
|
||||||
folder_id: folder
|
folder_id: folder
|
||||||
parent_id: if @folder? then @folder.id else null
|
parent_id: if this.folder? then this.folder.id else null
|
||||||
.then =>
|
.then =>
|
||||||
// something
|
// something
|
||||||
.catch (err, text-status) =>
|
.catch (err, text-status) =>
|
||||||
|
@ -150,8 +150,8 @@
|
|||||||
|
|
||||||
on-keydown(e) {
|
on-keydown(e) {
|
||||||
if e.which == 13 // Enter
|
if e.which == 13 // Enter
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
@ok!
|
@ok!
|
||||||
</script>
|
</script>
|
||||||
</mk-input-dialog>
|
</mk-input-dialog>
|
||||||
|
@ -345,13 +345,13 @@
|
|||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
ondragover(e) {
|
ondragover(e) {
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
this.draghover = true
|
this.draghover = true
|
||||||
// ドラッグされてきたものがファイルだったら
|
// ドラッグされてきたものがファイルだったら
|
||||||
if e.data-transfer.effect-allowed == 'all'
|
if e.dataTransfer.effect-allowed == 'all'
|
||||||
e.data-transfer.drop-effect = 'copy'
|
e.dataTransfer.dropEffect = 'copy'
|
||||||
else
|
else
|
||||||
e.data-transfer.drop-effect = 'move'
|
e.dataTransfer.dropEffect = 'move'
|
||||||
return false
|
return false
|
||||||
|
|
||||||
ondragenter(e) {
|
ondragenter(e) {
|
||||||
@ -361,18 +361,18 @@
|
|||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
ondrop(e) {
|
ondrop(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
this.draghover = false
|
this.draghover = false
|
||||||
|
|
||||||
// ファイルだったら
|
// ファイルだったら
|
||||||
if e.data-transfer.files.length > 0
|
if e.dataTransfer.files.length > 0
|
||||||
Array.prototype.for-each.call e.data-transfer.files, (file) =>
|
Array.prototype.for-each.call e.dataTransfer.files, (file) =>
|
||||||
@upload file
|
@upload file
|
||||||
return false
|
return false
|
||||||
|
|
||||||
// データ取得
|
// データ取得
|
||||||
data = e.data-transfer.get-data 'text'
|
data = e.dataTransfer.get-data 'text'
|
||||||
if !data?
|
if !data?
|
||||||
return false
|
return false
|
||||||
|
|
||||||
@ -422,12 +422,12 @@
|
|||||||
|
|
||||||
add-file(file) {
|
add-file(file) {
|
||||||
file._remove = =>
|
file._remove = =>
|
||||||
this.files = @files.filter (x) -> x.id != file.id
|
this.files = this.files.filter (x) -> x.id != file.id
|
||||||
this.trigger 'change-files' @files
|
this.trigger 'change-files' this.files
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
@files.push file
|
this.files.push file
|
||||||
this.trigger 'change-files' @files
|
this.trigger 'change-files' this.files
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
add-poll() {
|
add-poll() {
|
||||||
@ -440,8 +440,8 @@
|
|||||||
post(e) {
|
post(e) {
|
||||||
this.wait = true
|
this.wait = true
|
||||||
|
|
||||||
files = if @files? and @files.length > 0
|
files = if this.files? and this.files.length > 0
|
||||||
then @files.map (f) -> f.id
|
then this.files.map (f) -> f.id
|
||||||
else undefined
|
else undefined
|
||||||
|
|
||||||
this.api 'posts/create' do
|
this.api 'posts/create' do
|
||||||
|
@ -155,7 +155,7 @@
|
|||||||
this.refs.window.refs.browser.select-local-file!
|
this.refs.window.refs.browser.select-local-file!
|
||||||
|
|
||||||
ok() {
|
ok() {
|
||||||
this.trigger 'selected' @file
|
this.trigger 'selected' this.file
|
||||||
this.refs.window.close!
|
this.refs.window.close!
|
||||||
</script>
|
</script>
|
||||||
</mk-select-file-from-drive-window>
|
</mk-select-file-from-drive-window>
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
@update-avatar this.I
|
@update-avatar this.I
|
||||||
|
|
||||||
close(e) {
|
close(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
this.unmount();
|
this.unmount();
|
||||||
</script>
|
</script>
|
||||||
</mk-set-avatar-suggestion>
|
</mk-set-avatar-suggestion>
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
@update-banner this.I
|
@update-banner this.I
|
||||||
|
|
||||||
close(e) {
|
close(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
this.unmount();
|
this.unmount();
|
||||||
</script>
|
</script>
|
||||||
</mk-set-banner-suggestion>
|
</mk-set-banner-suggestion>
|
||||||
|
@ -394,7 +394,7 @@
|
|||||||
should-be-cancel = false
|
should-be-cancel = false
|
||||||
|
|
||||||
if should-be-cancel
|
if should-be-cancel
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
|
|
||||||
function focus(el, fn)
|
function focus(el, fn)
|
||||||
target = fn el
|
target = fn el
|
||||||
|
@ -188,7 +188,7 @@
|
|||||||
el.remove-event-listener 'mousedown' @mousedown
|
el.remove-event-listener 'mousedown' @mousedown
|
||||||
|
|
||||||
mousedown(e) {
|
mousedown(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
if (!contains this.root, e.target) and (this.root != e.target)
|
if (!contains this.root, e.target) and (this.root != e.target)
|
||||||
@close!
|
@close!
|
||||||
return false
|
return false
|
||||||
@ -202,11 +202,11 @@
|
|||||||
riot.mount document.body.appendChild document.createElement 'mk-settings-window'
|
riot.mount document.body.appendChild document.createElement 'mk-settings-window'
|
||||||
|
|
||||||
function contains(parent, child)
|
function contains(parent, child)
|
||||||
node = child.parent-node
|
node = child.parentNode
|
||||||
while node?
|
while node?
|
||||||
if node == parent
|
if node == parent
|
||||||
return true
|
return true
|
||||||
node = node.parent-node
|
node = node.parentNode
|
||||||
return false
|
return false
|
||||||
</script>
|
</script>
|
||||||
</mk-ui-header-account>
|
</mk-ui-header-account>
|
||||||
|
@ -98,17 +98,17 @@
|
|||||||
el.remove-event-listener 'mousedown' @mousedown
|
el.remove-event-listener 'mousedown' @mousedown
|
||||||
|
|
||||||
mousedown(e) {
|
mousedown(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
if (!contains this.root, e.target) and (this.root != e.target)
|
if (!contains this.root, e.target) and (this.root != e.target)
|
||||||
@close!
|
@close!
|
||||||
return false
|
return false
|
||||||
|
|
||||||
function contains(parent, child)
|
function contains(parent, child)
|
||||||
node = child.parent-node
|
node = child.parentNode
|
||||||
while node?
|
while node?
|
||||||
if node == parent
|
if node == parent
|
||||||
return true
|
return true
|
||||||
node = node.parent-node
|
node = node.parentNode
|
||||||
return false
|
return false
|
||||||
</script>
|
</script>
|
||||||
</mk-ui-header-notifications>
|
</mk-ui-header-notifications>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
this.mixin('page');
|
this.mixin('page');
|
||||||
|
|
||||||
onsubmit(e) {
|
onsubmit(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
@page '/search:' + this.refs.q.value
|
@page '/search:' + this.refs.q.value
|
||||||
</script>
|
</script>
|
||||||
</mk-ui-header-search>
|
</mk-ui-header-search>
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
tag = e.target.tag-name.to-lower-case!
|
tag = e.target.tag-name.to-lower-case!
|
||||||
if tag != 'input' and tag != 'textarea'
|
if tag != 'input' and tag != 'textarea'
|
||||||
if e.which == 80 or e.which == 78 // p or n
|
if e.which == 80 or e.which == 78 // p or n
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
@open-post-form!
|
@open-post-form!
|
||||||
</script>
|
</script>
|
||||||
</mk-ui>
|
</mk-ui>
|
||||||
|
@ -208,7 +208,7 @@
|
|||||||
this.refs.main.style.left = (window.inner-width / 2) - (this.refs.main.offset-width / 2) + 'px'
|
this.refs.main.style.left = (window.inner-width / 2) - (this.refs.main.offset-width / 2) + 'px'
|
||||||
|
|
||||||
this.refs.header.add-event-listener 'contextmenu' (e) =>
|
this.refs.header.add-event-listener 'contextmenu' (e) =>
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
|
|
||||||
window.add-event-listener 'resize' this.on-browser-resize
|
window.add-event-listener 'resize' this.on-browser-resize
|
||||||
|
|
||||||
@ -315,7 +315,7 @@
|
|||||||
if @is-modal then this.refs.bg.style.z-index = z + 1
|
if @is-modal then this.refs.bg.style.z-index = z + 1
|
||||||
|
|
||||||
repel-move(e) {
|
repel-move(e) {
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
return true
|
return true
|
||||||
|
|
||||||
bg-click() {
|
bg-click() {
|
||||||
@ -328,7 +328,7 @@
|
|||||||
|
|
||||||
// ヘッダー掴み時
|
// ヘッダー掴み時
|
||||||
on-header-mousedown(e) {
|
on-header-mousedown(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
|
|
||||||
if not contains this.refs.main, document.active-element
|
if not contains this.refs.main, document.active-element
|
||||||
this.refs.main.focus();
|
this.refs.main.focus();
|
||||||
@ -370,7 +370,7 @@
|
|||||||
|
|
||||||
// 上ハンドル掴み時
|
// 上ハンドル掴み時
|
||||||
on-top-handle-mousedown(e) {
|
on-top-handle-mousedown(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
|
|
||||||
base = e.client-y
|
base = e.client-y
|
||||||
height = parse-int((get-computed-style this.refs.main, '').height, 10)
|
height = parse-int((get-computed-style this.refs.main, '').height, 10)
|
||||||
@ -392,7 +392,7 @@
|
|||||||
|
|
||||||
// 右ハンドル掴み時
|
// 右ハンドル掴み時
|
||||||
on-right-handle-mousedown(e) {
|
on-right-handle-mousedown(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
|
|
||||||
base = e.client-x
|
base = e.client-x
|
||||||
width = parse-int((get-computed-style this.refs.main, '').width, 10)
|
width = parse-int((get-computed-style this.refs.main, '').width, 10)
|
||||||
@ -412,7 +412,7 @@
|
|||||||
|
|
||||||
// 下ハンドル掴み時
|
// 下ハンドル掴み時
|
||||||
on-bottom-handle-mousedown(e) {
|
on-bottom-handle-mousedown(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
|
|
||||||
base = e.client-y
|
base = e.client-y
|
||||||
height = parse-int((get-computed-style this.refs.main, '').height, 10)
|
height = parse-int((get-computed-style this.refs.main, '').height, 10)
|
||||||
@ -432,7 +432,7 @@
|
|||||||
|
|
||||||
// 左ハンドル掴み時
|
// 左ハンドル掴み時
|
||||||
on-left-handle-mousedown(e) {
|
on-left-handle-mousedown(e) {
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
|
|
||||||
base = e.client-x
|
base = e.client-x
|
||||||
width = parse-int((get-computed-style this.refs.main, '').width, 10)
|
width = parse-int((get-computed-style this.refs.main, '').width, 10)
|
||||||
@ -499,21 +499,21 @@
|
|||||||
window.remove-event-listener 'mouseup' drag-clear
|
window.remove-event-listener 'mouseup' drag-clear
|
||||||
|
|
||||||
ondragover(e) {
|
ondragover(e) {
|
||||||
e.data-transfer.drop-effect = 'none'
|
e.dataTransfer.dropEffect = 'none'
|
||||||
|
|
||||||
on-keydown(e) {
|
on-keydown(e) {
|
||||||
if e.which == 27 // Esc
|
if e.which == 27 // Esc
|
||||||
if @can-close
|
if @can-close
|
||||||
e.prevent-default!
|
e.preventDefault();
|
||||||
e.stop-propagation!
|
e.stopPropagation();
|
||||||
@close!
|
@close!
|
||||||
|
|
||||||
function contains(parent, child)
|
function contains(parent, child)
|
||||||
node = child.parent-node
|
node = child.parentNode
|
||||||
while node?
|
while node?
|
||||||
if node == parent
|
if node == parent
|
||||||
return true
|
return true
|
||||||
node = node.parent-node
|
node = node.parentNode
|
||||||
return false
|
return false
|
||||||
</script>
|
</script>
|
||||||
</mk-window>
|
</mk-window>
|
||||||
|
@ -238,6 +238,6 @@
|
|||||||
.catch =>
|
.catch =>
|
||||||
alert 'アプリの作成に失敗しました。再度お試しください。'
|
alert 'アプリの作成に失敗しました。再度お試しください。'
|
||||||
|
|
||||||
locker.parent-node.remove-child locker
|
locker.parentNode.removeChild locker
|
||||||
</script>
|
</script>
|
||||||
</mk-new-app-form>
|
</mk-new-app-form>
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
this.unmount();
|
this.unmount();
|
||||||
|
|
||||||
ok() {
|
ok() {
|
||||||
this.trigger 'selected' @files
|
this.trigger 'selected' this.files
|
||||||
this.unmount();
|
this.unmount();
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-selector>
|
</mk-drive-selector>
|
||||||
|
@ -171,7 +171,7 @@
|
|||||||
@add-file file, true
|
@add-file file, true
|
||||||
|
|
||||||
on-stream-drive-file-updated(file) {
|
on-stream-drive-file-updated(file) {
|
||||||
current = if @folder? then @folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != file.folder_id
|
if current != file.folder_id
|
||||||
@remove-file file
|
@remove-file file
|
||||||
else
|
else
|
||||||
@ -181,7 +181,7 @@
|
|||||||
@add-folder folder, true
|
@add-folder folder, true
|
||||||
|
|
||||||
on-stream-drive-folder-updated(folder) {
|
on-stream-drive-folder-updated(folder) {
|
||||||
current = if @folder? then @folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != folder.parent_id
|
if current != folder.parent_id
|
||||||
@remove-folder folder
|
@remove-folder folder
|
||||||
else
|
else
|
||||||
@ -221,58 +221,58 @@
|
|||||||
x folder.parent
|
x folder.parent
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
this.trigger 'open-folder' @folder, silent
|
this.trigger 'open-folder' this.folder, silent
|
||||||
@load!
|
@load!
|
||||||
.catch (err, text-status) ->
|
.catch (err, text-status) ->
|
||||||
console.error err
|
console.error err
|
||||||
|
|
||||||
add-folder(folder, unshift = false) {
|
add-folder(folder, unshift = false) {
|
||||||
current = if @folder? then @folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != folder.parent_id
|
if current != folder.parent_id
|
||||||
return
|
return
|
||||||
|
|
||||||
if (@folders.some (f) => f.id == folder.id)
|
if (this.folders.some (f) => f.id == folder.id)
|
||||||
return
|
return
|
||||||
|
|
||||||
if unshift
|
if unshift
|
||||||
@folders.unshift folder
|
this.folders.unshift folder
|
||||||
else
|
else
|
||||||
@folders.push folder
|
this.folders.push folder
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
add-file(file, unshift = false) {
|
add-file(file, unshift = false) {
|
||||||
current = if @folder? then @folder.id else null
|
current = if this.folder? then this.folder.id else null
|
||||||
if current != file.folder_id
|
if current != file.folder_id
|
||||||
return
|
return
|
||||||
|
|
||||||
if (@files.some (f) => f.id == file.id)
|
if (this.files.some (f) => f.id == file.id)
|
||||||
exist = (@files.map (f) -> f.id).index-of file.id
|
exist = (this.files.map (f) -> f.id).index-of file.id
|
||||||
@files[exist] = file
|
this.files[exist] = file
|
||||||
this.update();
|
this.update();
|
||||||
return
|
return
|
||||||
|
|
||||||
if unshift
|
if unshift
|
||||||
@files.unshift file
|
this.files.unshift file
|
||||||
else
|
else
|
||||||
@files.push file
|
this.files.push file
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
remove-folder(folder) {
|
remove-folder(folder) {
|
||||||
if typeof folder == 'object'
|
if typeof folder == 'object'
|
||||||
folder = folder.id
|
folder = folder.id
|
||||||
this.folders = @folders.filter (f) -> f.id != folder
|
this.folders = this.folders.filter (f) -> f.id != folder
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
remove-file(file) {
|
remove-file(file) {
|
||||||
if typeof file == 'object'
|
if typeof file == 'object'
|
||||||
file = file.id
|
file = file.id
|
||||||
this.files = @files.filter (f) -> f.id != file
|
this.files = this.files.filter (f) -> f.id != file
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
go-root() {
|
go-root() {
|
||||||
if @folder != null or @file != null
|
if this.folder != null or this.file != null
|
||||||
this.file = null
|
this.file = null
|
||||||
this.folder = null
|
this.folder = null
|
||||||
this.hierarchy-folders = []
|
this.hierarchy-folders = []
|
||||||
@ -298,7 +298,7 @@
|
|||||||
|
|
||||||
// フォルダ一覧取得
|
// フォルダ一覧取得
|
||||||
this.api 'drive/folders' do
|
this.api 'drive/folders' do
|
||||||
folder_id: if @folder? then @folder.id else null
|
folder_id: if this.folder? then this.folder.id else null
|
||||||
limit: folders-max + 1
|
limit: folders-max + 1
|
||||||
.then (folders) =>
|
.then (folders) =>
|
||||||
if folders.length == folders-max + 1
|
if folders.length == folders-max + 1
|
||||||
@ -311,7 +311,7 @@
|
|||||||
|
|
||||||
// ファイル一覧取得
|
// ファイル一覧取得
|
||||||
this.api 'drive/files' do
|
this.api 'drive/files' do
|
||||||
folder_id: if @folder? then @folder.id else null
|
folder_id: if this.folder? then this.folder.id else null
|
||||||
limit: files-max + 1
|
limit: files-max + 1
|
||||||
.then (files) =>
|
.then (files) =>
|
||||||
if files.length == files-max + 1
|
if files.length == files-max + 1
|
||||||
@ -372,6 +372,6 @@
|
|||||||
x file.folder
|
x file.folder
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
this.trigger 'open-file' @file, silent
|
this.trigger 'open-file' this.file, silent
|
||||||
</script>
|
</script>
|
||||||
</mk-drive>
|
</mk-drive>
|
||||||
|
@ -180,22 +180,22 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.bytes-to-size = require('../../../common/scripts/bytes-to-size.js');
|
this.bytesToSize = require('../../../common/scripts/bytes-to-size.js');
|
||||||
this.get-gcd = require('../../../common/scripts/gcd.js');
|
this.getGcd = require('../../../common/scripts/gcd.js');
|
||||||
|
|
||||||
this.mixin('api');
|
this.mixin('api');
|
||||||
|
|
||||||
this.file = this.opts.file
|
this.file = this.opts.file
|
||||||
this.kind = @file.type.split '/' .0
|
this.kind = this.file.type.split '/' .0
|
||||||
|
|
||||||
rename() {
|
rename() {
|
||||||
name = window.prompt '名前を変更' @file.name
|
name = window.prompt '名前を変更' this.file.name
|
||||||
if name? and name != '' and name != @file.name
|
if name? and name != '' and name != this.file.name
|
||||||
this.api 'drive/files/update' do
|
this.api 'drive/files/update' do
|
||||||
file_id: @file.id
|
file_id: this.file.id
|
||||||
name: name
|
name: name
|
||||||
.then =>
|
.then =>
|
||||||
this.parent.cf @file, true
|
this.parent.cf this.file, true
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-file-viewer>
|
</mk-drive-file-viewer>
|
||||||
|
@ -122,16 +122,16 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
this.bytes-to-size = require('../../../common/scripts/bytes-to-size.js');
|
this.bytesToSize = require('../../../common/scripts/bytesToSize.js');
|
||||||
|
|
||||||
this.browser = this.parent
|
this.browser = this.parent
|
||||||
this.file = this.opts.file
|
this.file = this.opts.file
|
||||||
this.is-selected = @browser.selected-files.some (f) => f.id == @file.id
|
this.is-selected = this.browser.selected-files.some (f) => f.id == this.file.id
|
||||||
|
|
||||||
@browser.on('change-selected', (selects) => {
|
this.browser.on('change-selected', (selects) => {
|
||||||
this.is-selected = selects.some (f) => f.id == @file.id
|
this.is-selected = selects.some (f) => f.id == this.file.id
|
||||||
|
|
||||||
onclick() {
|
onclick() {
|
||||||
@browser.choose-file @file
|
this.browser.choose-file this.file
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-file>
|
</mk-drive-file>
|
||||||
|
@ -41,6 +41,6 @@
|
|||||||
this.folder = this.opts.folder
|
this.folder = this.opts.folder
|
||||||
|
|
||||||
onclick() {
|
onclick() {
|
||||||
@browser.move @folder
|
this.browser.move this.folder
|
||||||
</script>
|
</script>
|
||||||
</mk-drive-folder>
|
</mk-drive-folder>
|
||||||
|
@ -238,12 +238,12 @@
|
|||||||
|
|
||||||
add-file(file) {
|
add-file(file) {
|
||||||
file._remove = =>
|
file._remove = =>
|
||||||
this.files = @files.filter (x) -> x.id != file.id
|
this.files = this.files.filter (x) -> x.id != file.id
|
||||||
this.trigger 'change-files' @files
|
this.trigger 'change-files' this.files
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
@files.push file
|
this.files.push file
|
||||||
this.trigger 'change-files' @files
|
this.trigger 'change-files' this.files
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
add-poll() {
|
add-poll() {
|
||||||
@ -256,8 +256,8 @@
|
|||||||
post() {
|
post() {
|
||||||
this.wait = true
|
this.wait = true
|
||||||
|
|
||||||
files = if @files? and @files.length > 0
|
files = if this.files? and this.files.length > 0
|
||||||
then @files.map (f) -> f.id
|
then this.files.map (f) -> f.id
|
||||||
else undefined
|
else undefined
|
||||||
|
|
||||||
this.api 'posts/create' do
|
this.api 'posts/create' do
|
||||||
|
Loading…
Reference in New Issue
Block a user