From 77914317171b55e5861cc6dd50d41e5bb3b4df38 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 20 Feb 2017 10:27:44 +0900 Subject: [PATCH] wip --- src/web/app/common/tags/authorized-apps.tag | 15 ++-- src/web/app/common/tags/copyright.tag | 8 +- src/web/app/common/tags/core-error.tag | 3 +- src/web/app/common/tags/ellipsis.tag | 5 -- src/web/app/common/tags/introduction.tag | 4 - src/web/app/common/tags/messaging/index.tag | 26 +++--- src/web/app/common/tags/messaging/room.tag | 4 +- src/web/app/common/tags/number.tag | 13 +-- src/web/app/common/tags/poll-editor.tag | 19 ++-- src/web/app/common/tags/poll.tag | 47 +++++----- src/web/app/common/tags/signin-history.tag | 4 +- src/web/app/common/tags/signin.tag | 6 +- src/web/app/common/tags/signup.tag | 27 +++--- src/web/app/common/tags/special-message.tag | 6 +- src/web/app/common/tags/url-preview.tag | 26 +++--- src/web/app/common/tags/url.tag | 19 ++-- .../desktop/tags/autocomplete-suggestion.tag | 22 ++--- src/web/app/desktop/tags/contextmenu.tag | 8 +- src/web/app/desktop/tags/donation.tag | 4 +- .../desktop/tags/drive/base-contextmenu.tag | 6 +- src/web/app/desktop/tags/drive/browser.tag | 90 +++++++++---------- .../desktop/tags/drive/file-contextmenu.tag | 10 +-- src/web/app/desktop/tags/drive/file.tag | 42 ++++----- .../desktop/tags/drive/folder-contextmenu.tag | 12 +-- src/web/app/desktop/tags/drive/folder.tag | 52 +++++------ src/web/app/desktop/tags/drive/nav-folder.tag | 40 ++++----- src/web/app/desktop/tags/input-dialog.tag | 4 +- src/web/app/desktop/tags/post-form.tag | 30 +++---- .../tags/select-file-from-drive-window.tag | 2 +- .../desktop/tags/set-avatar-suggestion.tag | 4 +- .../desktop/tags/set-banner-suggestion.tag | 4 +- src/web/app/desktop/tags/timeline-post.tag | 2 +- .../app/desktop/tags/ui-header-account.tag | 6 +- .../desktop/tags/ui-header-notifications.tag | 6 +- src/web/app/desktop/tags/ui-header-search.tag | 2 +- src/web/app/desktop/tags/ui.tag | 2 +- src/web/app/desktop/tags/window.tag | 24 ++--- src/web/app/dev/tags/new-app-form.tag | 2 +- src/web/app/mobile/tags/drive-selector.tag | 2 +- src/web/app/mobile/tags/drive.tag | 38 ++++---- src/web/app/mobile/tags/drive/file-viewer.tag | 14 +-- src/web/app/mobile/tags/drive/file.tag | 10 +-- src/web/app/mobile/tags/drive/folder.tag | 2 +- src/web/app/mobile/tags/post-form.tag | 12 +-- 44 files changed, 344 insertions(+), 340 deletions(-) diff --git a/src/web/app/common/tags/authorized-apps.tag b/src/web/app/common/tags/authorized-apps.tag index 918e8b956..14795e49d 100644 --- a/src/web/app/common/tags/authorized-apps.tag +++ b/src/web/app/common/tags/authorized-apps.tag @@ -19,16 +19,15 @@ diff --git a/src/web/app/common/tags/copyright.tag b/src/web/app/common/tags/copyright.tag index 368c4e319..9c3f1f648 100644 --- a/src/web/app/common/tags/copyright.tag +++ b/src/web/app/common/tags/copyright.tag @@ -1,11 +1,7 @@ -(c) syuilo 2014-2017 + + (c) syuilo 2014-2017 diff --git a/src/web/app/common/tags/core-error.tag b/src/web/app/common/tags/core-error.tag index 07f41e403..b424c8abb 100644 --- a/src/web/app/common/tags/core-error.tag +++ b/src/web/app/common/tags/core-error.tag @@ -59,6 +59,7 @@ diff --git a/src/web/app/common/tags/ellipsis.tag b/src/web/app/common/tags/ellipsis.tag index 58f108395..97ef745d0 100644 --- a/src/web/app/common/tags/ellipsis.tag +++ b/src/web/app/common/tags/ellipsis.tag @@ -20,10 +20,5 @@ opacity 1 40% opacity 0 - - - - - diff --git a/src/web/app/common/tags/introduction.tag b/src/web/app/common/tags/introduction.tag index 24fe86e99..fda011eff 100644 --- a/src/web/app/common/tags/introduction.tag +++ b/src/web/app/common/tags/introduction.tag @@ -21,9 +21,5 @@ margin 0 text-align center - - - - diff --git a/src/web/app/common/tags/messaging/index.tag b/src/web/app/common/tags/messaging/index.tag index d49596c87..e9a031a2b 100644 --- a/src/web/app/common/tags/messaging/index.tag +++ b/src/web/app/common/tags/messaging/index.tag @@ -327,29 +327,29 @@ key = e.which switch (key) | 9, 40 => // Key[TAB] or Key[↓] - e.prevent-default! - e.stop-propagation! - this.refs.search-result.child-nodes[0].focus(); + e.preventDefault(); + e.stopPropagation(); + this.refs.search-result.childNodes[0].focus(); on-search-result-keydown(i, e) { key = e.which switch (key) | 10, 13 => // Key[ENTER] - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); @search-result[i]._click! | 27 => // Key[ESC] - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); this.refs.search.focus(); | 38 => // Key[↑] - e.prevent-default! - e.stop-propagation! - (this.refs.search-result.child-nodes[i].previous-element-sibling || this.refs.search-result.child-nodes[@search-result.length - 1]).focus(); + e.preventDefault(); + e.stopPropagation(); + (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[↓] - e.prevent-default! - e.stop-propagation! - (this.refs.search-result.child-nodes[i].next-element-sibling || this.refs.search-result.child-nodes[0]).focus(); + e.preventDefault(); + e.stopPropagation(); + (this.refs.search-result.childNodes[i].next-element-sibling || this.refs.search-result.childNodes[0]).focus(); diff --git a/src/web/app/common/tags/messaging/room.tag b/src/web/app/common/tags/messaging/room.tag index 320af8a8b..a40258569 100644 --- a/src/web/app/common/tags/messaging/room.tag +++ b/src/web/app/common/tags/messaging/room.tag @@ -203,13 +203,13 @@ n.inner-HTML = '' + message n.onclick = => @scroll-to-bottom! - n.parent-node.remove-child n + n.parentNode.removeChild n this.refs.notifications.appendChild n setTimeout => n.style.opacity = 0 setTimeout => - n.parent-node.remove-child n + n.parentNode.removeChild n , 1000ms , 4000ms diff --git a/src/web/app/common/tags/number.tag b/src/web/app/common/tags/number.tag index 626b184fc..212a80b73 100644 --- a/src/web/app/common/tags/number.tag +++ b/src/web/app/common/tags/number.tag @@ -6,13 +6,14 @@ diff --git a/src/web/app/common/tags/poll-editor.tag b/src/web/app/common/tags/poll-editor.tag index 46975bbe2..e35d8e136 100644 --- a/src/web/app/common/tags/poll-editor.tag +++ b/src/web/app/common/tags/poll-editor.tag @@ -86,26 +86,31 @@ diff --git a/src/web/app/common/tags/poll.tag b/src/web/app/common/tags/poll.tag index d0ee1fad7..c9209c3a3 100644 --- a/src/web/app/common/tags/poll.tag +++ b/src/web/app/common/tags/poll.tag @@ -70,30 +70,35 @@ diff --git a/src/web/app/common/tags/signin-history.tag b/src/web/app/common/tags/signin-history.tag index 2b8bddd26..4b5c844b7 100644 --- a/src/web/app/common/tags/signin-history.tag +++ b/src/web/app/common/tags/signin-history.tag @@ -51,8 +51,8 @@ this.mixin('api'); this.mixin('stream'); - this.history = [] - this.fetching = true + this.history = []; + this.fetching = true; this.on('mount', () => { this.api 'i/signin_history' diff --git a/src/web/app/common/tags/signin.tag b/src/web/app/common/tags/signin.tag index 75fa51afa..5cb63685f 100644 --- a/src/web/app/common/tags/signin.tag +++ b/src/web/app/common/tags/signin.tag @@ -99,8 +99,8 @@ diff --git a/src/web/app/common/tags/special-message.tag b/src/web/app/common/tags/special-message.tag index 8304f87ec..41bd5fe32 100644 --- a/src/web/app/common/tags/special-message.tag +++ b/src/web/app/common/tags/special-message.tag @@ -20,8 +20,8 @@ diff --git a/src/web/app/common/tags/url-preview.tag b/src/web/app/common/tags/url-preview.tag index 74f952016..6daed4dbd 100644 --- a/src/web/app/common/tags/url-preview.tag +++ b/src/web/app/common/tags/url-preview.tag @@ -93,20 +93,22 @@ diff --git a/src/web/app/common/tags/url.tag b/src/web/app/common/tags/url.tag index 596d2914c..0ad9e72b5 100644 --- a/src/web/app/common/tags/url.tag +++ b/src/web/app/common/tags/url.tag @@ -30,19 +30,20 @@ diff --git a/src/web/app/desktop/tags/autocomplete-suggestion.tag b/src/web/app/desktop/tags/autocomplete-suggestion.tag index 073352b19..cf735255b 100644 --- a/src/web/app/desktop/tags/autocomplete-suggestion.tag +++ b/src/web/app/desktop/tags/autocomplete-suggestion.tag @@ -124,25 +124,25 @@ switch (key) | 10, 13 => // Key[ENTER] if @select != -1 - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); @complete @users[@select] else @close! | 27 => // Key[ESC] - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); @close! | 38 => // Key[↑] if @select != -1 - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); @select-prev! else @close! | 9, 40 => // Key[TAB] or Key[↓] - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); @select-next! | _ => @close! @@ -167,7 +167,7 @@ this.refs.users.children.for-each (el) => 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(); complete(user) { @@ -177,11 +177,11 @@ this.opts.close! function contains(parent, child) - node = child.parent-node + node = child.parentNode while node? if node == parent return true - node = node.parent-node + node = node.parentNode return false diff --git a/src/web/app/desktop/tags/contextmenu.tag b/src/web/app/desktop/tags/contextmenu.tag index 114d48cf3..0d8cb313a 100644 --- a/src/web/app/desktop/tags/contextmenu.tag +++ b/src/web/app/desktop/tags/contextmenu.tag @@ -95,10 +95,10 @@ diff --git a/src/web/app/desktop/tags/donation.tag b/src/web/app/desktop/tags/donation.tag index b01c0a44d..9ce2ed819 100644 --- a/src/web/app/desktop/tags/donation.tag +++ b/src/web/app/desktop/tags/donation.tag @@ -51,8 +51,8 @@ this.mixin('i'); close(e) { - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); this.I.data.no_donation = true this.I.update! diff --git a/src/web/app/desktop/tags/drive/base-contextmenu.tag b/src/web/app/desktop/tags/drive/base-contextmenu.tag index 39e01558d..7eb5fd3b9 100644 --- a/src/web/app/desktop/tags/drive/base-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/base-contextmenu.tag @@ -24,15 +24,15 @@ this.refs.ctx.open pos create-folder() { - @browser.create-folder! + this.browser.create-folder! this.refs.ctx.close! upload() { - @browser.select-local-file! + this.browser.select-local-file! this.refs.ctx.close! url-upload() { - @browser.url-upload! + this.browser.url-upload! this.refs.ctx.close! diff --git a/src/web/app/desktop/tags/drive/browser.tag b/src/web/app/desktop/tags/drive/browser.tag index 02c886d14..2a93afbb2 100644 --- a/src/web/app/desktop/tags/drive/browser.tag +++ b/src/web/app/desktop/tags/drive/browser.tag @@ -293,7 +293,7 @@ @add-file file, true 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 @remove-file file else @@ -303,7 +303,7 @@ @add-folder folder, true 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 @remove-folder folder else @@ -350,29 +350,29 @@ document.document-element.add-event-listener 'mouseup' up path-oncontextmenu(e) { - e.prevent-default! + e.preventDefault(); e.stop-immediate-propagation! return false ondragover(e) { - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); // ドラッグ元が自分自身の所有するアイテムかどうか if !@is-drag-source // ドラッグされてきたものがファイルだったら - if e.data-transfer.effect-allowed == 'all' - e.data-transfer.drop-effect = 'copy' + if e.dataTransfer.effect-allowed == 'all' + e.dataTransfer.dropEffect = 'copy' else - e.data-transfer.drop-effect = 'move' + e.dataTransfer.dropEffect = 'move' this.draghover = true else // 自分自身にはドロップさせない - e.data-transfer.drop-effect = 'none' + e.dataTransfer.dropEffect = 'none' return false ondragenter(e) { - e.prevent-default! + e.preventDefault(); if !@is-drag-source this.draghover = true @@ -380,19 +380,19 @@ this.draghover = false ondrop(e) { - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); this.draghover = false // ドロップされてきたものがファイルだったら - if e.data-transfer.files.length > 0 - Array.prototype.for-each.call e.data-transfer.files, (file) => - @upload file, @folder + if e.dataTransfer.files.length > 0 + Array.prototype.for-each.call e.dataTransfer.files, (file) => + @upload file, this.folder return false // データ取得 - data = e.data-transfer.get-data 'text' + data = e.dataTransfer.get-data 'text' if !data? return false @@ -402,12 +402,12 @@ // (ドライブの)ファイルだったら if obj.type == 'file' file = obj.id - if (@files.some (f) => f.id == file) + if (this.files.some (f) => f.id == file) return false @remove-file file this.api 'drive/files/update' do file_id: file - folder_id: if @folder? then @folder.id else null + folder_id: if this.folder? then this.folder.id else null .then => // something .catch (err, text-status) => @@ -417,14 +417,14 @@ else if obj.type == 'folder' folder = obj.id // 移動先が自分自身ならreject - if @folder? and folder == @folder.id + if this.folder? and folder == this.folder.id return false - if (@folders.some (f) => f.id == folder) + if (this.folders.some (f) => f.id == folder) return false @remove-folder folder this.api 'drive/folders/update' do folder_id: folder - parent_id: if @folder? then @folder.id else null + parent_id: if this.folder? then this.folder.id else null .then => // something .catch (err) => @@ -439,7 +439,7 @@ return false oncontextmenu(e) { - e.prevent-default! + e.preventDefault(); e.stop-immediate-propagation! ctx = document.body.appendChild document.createElement 'mk-drive-browser-base-contextmenu' @@ -464,7 +464,7 @@ if url? and url != '' this.api 'drive/files/upload_from_url' do url: url - folder_id: if @folder? then @folder.id else undefined + folder_id: if this.folder? then this.folder.id else undefined @dialog do 'アップロードをリクエストしました' @@ -481,7 +481,7 @@ this.api 'drive/folders/create' do name: name - folder_id: if @folder? then @folder.id else undefined + folder_id: if this.folder? then this.folder.id else undefined .then (folder) => @add-folder folder, true this.update(); @@ -492,7 +492,7 @@ files = this.refs.file-input.files for i from 0 to files.length - 1 file = files.item i - @upload file, @folder + @upload file, this.folder upload(file, folder) { if folder? and typeof folder == 'object' @@ -500,7 +500,7 @@ this.refs.uploader.upload file, folder get-selection() { - @files.filter (file) -> file._selected + this.files.filter (file) -> file._selected new-window(folder-id) { browser = document.body.appendChild document.createElement 'mk-drive-browser-window' @@ -538,55 +538,55 @@ console.error err 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 return - if (@folders.some (f) => f.id == folder.id) - exist = (@folders.map (f) -> f.id).index-of folder.id - @folders[exist] = folder + if (this.folders.some (f) => f.id == folder.id) + exist = (this.folders.map (f) -> f.id).index-of folder.id + this.folders[exist] = folder this.update(); return if unshift - @folders.unshift folder + this.folders.unshift folder else - @folders.push folder + this.folders.push folder this.update(); 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 return - if (@files.some (f) => f.id == file.id) - exist = (@files.map (f) -> f.id).index-of file.id - @files[exist] = file + if (this.files.some (f) => f.id == file.id) + exist = (this.files.map (f) -> f.id).index-of file.id + this.files[exist] = file this.update(); return if unshift - @files.unshift file + this.files.unshift file else - @files.push file + this.files.push file this.update(); remove-folder(folder) { if typeof folder == 'object' folder = folder.id - this.folders = @folders.filter (f) -> f.id != folder + this.folders = this.folders.filter (f) -> f.id != folder this.update(); remove-file(file) { if typeof file == 'object' file = file.id - this.files = @files.filter (f) -> f.id != file + this.files = this.files.filter (f) -> f.id != file this.update(); go-root() { - if @folder != null + if this.folder != null this.folder = null this.hierarchy-folders = [] this.update(); @@ -608,7 +608,7 @@ // フォルダ一覧取得 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 .then (folders) => if folders.length == folders-max + 1 @@ -621,7 +621,7 @@ // ファイル一覧取得 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 .then (files) => if files.length == files-max + 1 @@ -645,11 +645,11 @@ flag := true function contains(parent, child) - node = child.parent-node + node = child.parentNode while node? if node == parent return true - node = node.parent-node + node = node.parentNode return false diff --git a/src/web/app/desktop/tags/drive/file-contextmenu.tag b/src/web/app/desktop/tags/drive/file-contextmenu.tag index 5919599be..06e708562 100644 --- a/src/web/app/desktop/tags/drive/file-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/file-contextmenu.tag @@ -63,10 +63,10 @@ name <~ @input-dialog do 'ファイル名の変更' '新しいファイル名を入力してください' - @file.name + this.file.name this.api 'drive/files/update' do - file_id: @file.id + file_id: this.file.id name: name .then => // something @@ -81,15 +81,15 @@ set-avatar() { this.refs.ctx.close! - @update-avatar this.I, null, @file + @update-avatar this.I, null, this.file set-banner() { this.refs.ctx.close! - @update-banner this.I, null, @file + @update-banner this.I, null, this.file set-wallpaper() { this.refs.ctx.close! - @update-wallpaper this.I, null, @file + @update-wallpaper this.I, null, this.file add-app() { @NotImplementedException! diff --git a/src/web/app/desktop/tags/drive/file.tag b/src/web/app/desktop/tags/drive/file.tag index e86948aee..d41c5279f 100644 --- a/src/web/app/desktop/tags/drive/file.tag +++ b/src/web/app/desktop/tags/drive/file.tag @@ -144,43 +144,43 @@ diff --git a/src/web/app/desktop/tags/drive/folder-contextmenu.tag b/src/web/app/desktop/tags/drive/folder-contextmenu.tag index 20cb264e5..df094d0bc 100644 --- a/src/web/app/desktop/tags/drive/folder-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/folder-contextmenu.tag @@ -32,19 +32,19 @@ this.unmount(); move() { - @browser.move @folder.id + this.browser.move this.folder.id this.refs.ctx.close! new-window() { - @browser.new-window @folder.id + this.browser.new-window this.folder.id this.refs.ctx.close! create-folder() { - @browser.create-folder! + this.browser.create-folder! this.refs.ctx.close! upload() { - @browser.select-lcoal-file! + this.browser.select-lcoal-file! this.refs.ctx.close! rename() { @@ -53,10 +53,10 @@ name <~ @input-dialog do 'フォルダ名の変更' '新しいフォルダ名を入力してください' - @folder.name + this.folder.name this.api 'drive/folders/update' do - folder_id: @folder.id + folder_id: this.folder.id name: name .then => // something diff --git a/src/web/app/desktop/tags/drive/folder.tag b/src/web/app/desktop/tags/drive/folder.tag index e14f70f41..2d58ddefc 100644 --- a/src/web/app/desktop/tags/drive/folder.tag +++ b/src/web/app/desktop/tags/drive/folder.tag @@ -56,13 +56,13 @@ this.folder = this.opts.folder this.browser = this.parent - this.title = @folder.name + this.title = this.folder.name this.hover = false this.draghover = false this.is-contextmenu-showing = false onclick() { - @browser.move @folder + this.browser.move this.folder onmouseover() { this.hover = true @@ -71,19 +71,19 @@ this.hover = false ondragover(e) { - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); // 自分自身がドラッグされていない場合 if !@is-dragging // ドラッグされてきたものがファイルだったら - if e.data-transfer.effect-allowed == 'all' - e.data-transfer.drop-effect = 'copy' + if e.dataTransfer.effect-allowed == 'all' + e.dataTransfer.dropEffect = 'copy' else - e.data-transfer.drop-effect = 'move' + e.dataTransfer.dropEffect = 'move' else // 自分自身にはドロップさせない - e.data-transfer.drop-effect = 'none' + e.dataTransfer.dropEffect = 'none' return false ondragenter() { @@ -94,17 +94,17 @@ this.draghover = false ondrop(e) { - e.stop-propagation! + e.stopPropagation(); this.draghover = false // ファイルだったら - if e.data-transfer.files.length > 0 - Array.prototype.for-each.call e.data-transfer.files, (file) => - @browser.upload file, @folder + if e.dataTransfer.files.length > 0 + Array.prototype.for-each.call e.dataTransfer.files, (file) => + this.browser.upload file, this.folder return false // データ取得 - data = e.data-transfer.get-data 'text' + data = e.dataTransfer.get-data 'text' if !data? return false @@ -114,10 +114,10 @@ // (ドライブの)ファイルだったら if obj.type == 'file' file = obj.id - @browser.remove-file file + this.browser.remove-file file this.api 'drive/files/update' do file_id: file - folder_id: @folder.id + folder_id: this.folder.id .then => // something .catch (err, text-status) => @@ -127,12 +127,12 @@ else if obj.type == 'folder' folder = obj.id // 移動先が自分自身ならreject - if folder == @folder.id + if folder == this.folder.id return false - @browser.remove-folder folder + this.browser.remove-folder folder this.api 'drive/folders/update' do folder_id: folder - parent_id: @folder.id + parent_id: this.folder.id .then => // something .catch (err) => @@ -147,30 +147,30 @@ return false ondragstart(e) { - e.data-transfer.effect-allowed = 'move' - e.data-transfer.set-data 'text' JSON.stringify do + e.dataTransfer.effect-allowed = 'move' + e.dataTransfer.set-data 'text' JSON.stringify do type: 'folder' - id: @folder.id + id: this.folder.id this.is-dragging = true // 親ブラウザに対して、ドラッグが開始されたフラグを立てる // (=あなたの子供が、ドラッグを開始しましたよ) - @browser.is-drag-source = true + this.browser.is-drag-source = true ondragend(e) { this.is-dragging = false - @browser.is-drag-source = false + this.browser.is-drag-source = false oncontextmenu(e) { - e.prevent-default! + e.preventDefault(); e.stop-immediate-propagation! this.is-contextmenu-showing = true this.update(); ctx = document.body.appendChild document.createElement 'mk-drive-browser-folder-contextmenu' ctx = riot.mount ctx, do - browser: @browser - folder: @folder + browser: this.browser + folder: this.folder ctx = ctx.0 ctx.open do x: e.page-x - window.page-x-offset diff --git a/src/web/app/desktop/tags/drive/nav-folder.tag b/src/web/app/desktop/tags/drive/nav-folder.tag index afa628775..8f8f00783 100644 --- a/src/web/app/desktop/tags/drive/nav-folder.tag +++ b/src/web/app/desktop/tags/drive/nav-folder.tag @@ -17,7 +17,7 @@ this.hover = false onclick() { - @browser.move @folder + this.browser.move this.folder onmouseover() { this.hover = true @@ -26,39 +26,39 @@ this.hover = false ondragover(e) { - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); // このフォルダがルートかつカレントディレクトリならドロップ禁止 - if @folder == null and @browser.folder == null - e.data-transfer.drop-effect = 'none' + if this.folder == null and this.browser.folder == null + e.dataTransfer.dropEffect = 'none' // ドラッグされてきたものがファイルだったら - else if e.data-transfer.effect-allowed == 'all' - e.data-transfer.drop-effect = 'copy' + else if e.dataTransfer.effect-allowed == 'all' + e.dataTransfer.dropEffect = 'copy' else - e.data-transfer.drop-effect = 'move' + e.dataTransfer.dropEffect = 'move' return false ondragenter() { - if @folder != null or @browser.folder != null + if this.folder != null or this.browser.folder != null this.draghover = true ondragleave() { - if @folder != null or @browser.folder != null + if this.folder != null or this.browser.folder != null this.draghover = false ondrop(e) { - e.stop-propagation! + e.stopPropagation(); this.draghover = false // ファイルだったら - if e.data-transfer.files.length > 0 - Array.prototype.for-each.call e.data-transfer.files, (file) => - @browser.upload file, @folder + if e.dataTransfer.files.length > 0 + Array.prototype.for-each.call e.dataTransfer.files, (file) => + this.browser.upload file, this.folder return false // データ取得 - data = e.data-transfer.get-data 'text' + data = e.dataTransfer.get-data 'text' if !data? return false @@ -68,10 +68,10 @@ // (ドライブの)ファイルだったら if obj.type == 'file' file = obj.id - @browser.remove-file file + this.browser.remove-file file this.api 'drive/files/update' do file_id: file - folder_id: if @folder? then @folder.id else null + folder_id: if this.folder? then this.folder.id else null .then => // something .catch (err, text-status) => @@ -81,12 +81,12 @@ else if obj.type == 'folder' folder = obj.id // 移動先が自分自身ならreject - if @folder? and folder == @folder.id + if this.folder? and folder == this.folder.id return false - @browser.remove-folder folder + this.browser.remove-folder folder this.api 'drive/folders/update' do folder_id: folder - parent_id: if @folder? then @folder.id else null + parent_id: if this.folder? then this.folder.id else null .then => // something .catch (err, text-status) => diff --git a/src/web/app/desktop/tags/input-dialog.tag b/src/web/app/desktop/tags/input-dialog.tag index a7dfdb807..c2cf09330 100644 --- a/src/web/app/desktop/tags/input-dialog.tag +++ b/src/web/app/desktop/tags/input-dialog.tag @@ -150,8 +150,8 @@ on-keydown(e) { if e.which == 13 // Enter - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); @ok! diff --git a/src/web/app/desktop/tags/post-form.tag b/src/web/app/desktop/tags/post-form.tag index 760a585ce..b1c06143b 100644 --- a/src/web/app/desktop/tags/post-form.tag +++ b/src/web/app/desktop/tags/post-form.tag @@ -345,13 +345,13 @@ this.update(); ondragover(e) { - e.stop-propagation! + e.stopPropagation(); this.draghover = true // ドラッグされてきたものがファイルだったら - if e.data-transfer.effect-allowed == 'all' - e.data-transfer.drop-effect = 'copy' + if e.dataTransfer.effect-allowed == 'all' + e.dataTransfer.dropEffect = 'copy' else - e.data-transfer.drop-effect = 'move' + e.dataTransfer.dropEffect = 'move' return false ondragenter(e) { @@ -361,18 +361,18 @@ this.draghover = false ondrop(e) { - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); this.draghover = false // ファイルだったら - if e.data-transfer.files.length > 0 - Array.prototype.for-each.call e.data-transfer.files, (file) => + if e.dataTransfer.files.length > 0 + Array.prototype.for-each.call e.dataTransfer.files, (file) => @upload file return false // データ取得 - data = e.data-transfer.get-data 'text' + data = e.dataTransfer.get-data 'text' if !data? return false @@ -422,12 +422,12 @@ add-file(file) { file._remove = => - this.files = @files.filter (x) -> x.id != file.id - this.trigger 'change-files' @files + this.files = this.files.filter (x) -> x.id != file.id + this.trigger 'change-files' this.files this.update(); - @files.push file - this.trigger 'change-files' @files + this.files.push file + this.trigger 'change-files' this.files this.update(); add-poll() { @@ -440,8 +440,8 @@ post(e) { this.wait = true - files = if @files? and @files.length > 0 - then @files.map (f) -> f.id + files = if this.files? and this.files.length > 0 + then this.files.map (f) -> f.id else undefined this.api 'posts/create' do diff --git a/src/web/app/desktop/tags/select-file-from-drive-window.tag b/src/web/app/desktop/tags/select-file-from-drive-window.tag index f4cfd5503..c8fc02d22 100644 --- a/src/web/app/desktop/tags/select-file-from-drive-window.tag +++ b/src/web/app/desktop/tags/select-file-from-drive-window.tag @@ -155,7 +155,7 @@ this.refs.window.refs.browser.select-local-file! ok() { - this.trigger 'selected' @file + this.trigger 'selected' this.file this.refs.window.close! diff --git a/src/web/app/desktop/tags/set-avatar-suggestion.tag b/src/web/app/desktop/tags/set-avatar-suggestion.tag index 149144edf..e398a6ed2 100644 --- a/src/web/app/desktop/tags/set-avatar-suggestion.tag +++ b/src/web/app/desktop/tags/set-avatar-suggestion.tag @@ -38,8 +38,8 @@ @update-avatar this.I close(e) { - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); this.unmount(); diff --git a/src/web/app/desktop/tags/set-banner-suggestion.tag b/src/web/app/desktop/tags/set-banner-suggestion.tag index a1e9eb4ed..73c67a02b 100644 --- a/src/web/app/desktop/tags/set-banner-suggestion.tag +++ b/src/web/app/desktop/tags/set-banner-suggestion.tag @@ -38,8 +38,8 @@ @update-banner this.I close(e) { - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); this.unmount(); diff --git a/src/web/app/desktop/tags/timeline-post.tag b/src/web/app/desktop/tags/timeline-post.tag index 8ccf2b57c..ea1bed257 100644 --- a/src/web/app/desktop/tags/timeline-post.tag +++ b/src/web/app/desktop/tags/timeline-post.tag @@ -394,7 +394,7 @@ should-be-cancel = false if should-be-cancel - e.prevent-default! + e.preventDefault(); function focus(el, fn) target = fn el diff --git a/src/web/app/desktop/tags/ui-header-account.tag b/src/web/app/desktop/tags/ui-header-account.tag index a5308b014..fa3f60a61 100644 --- a/src/web/app/desktop/tags/ui-header-account.tag +++ b/src/web/app/desktop/tags/ui-header-account.tag @@ -188,7 +188,7 @@ el.remove-event-listener 'mousedown' @mousedown mousedown(e) { - e.prevent-default! + e.preventDefault(); if (!contains this.root, e.target) and (this.root != e.target) @close! return false @@ -202,11 +202,11 @@ riot.mount document.body.appendChild document.createElement 'mk-settings-window' function contains(parent, child) - node = child.parent-node + node = child.parentNode while node? if node == parent return true - node = node.parent-node + node = node.parentNode return false diff --git a/src/web/app/desktop/tags/ui-header-notifications.tag b/src/web/app/desktop/tags/ui-header-notifications.tag index d166df36e..1768f915e 100644 --- a/src/web/app/desktop/tags/ui-header-notifications.tag +++ b/src/web/app/desktop/tags/ui-header-notifications.tag @@ -98,17 +98,17 @@ el.remove-event-listener 'mousedown' @mousedown mousedown(e) { - e.prevent-default! + e.preventDefault(); if (!contains this.root, e.target) and (this.root != e.target) @close! return false function contains(parent, child) - node = child.parent-node + node = child.parentNode while node? if node == parent return true - node = node.parent-node + node = node.parentNode return false diff --git a/src/web/app/desktop/tags/ui-header-search.tag b/src/web/app/desktop/tags/ui-header-search.tag index 702c70efc..69d2dd732 100644 --- a/src/web/app/desktop/tags/ui-header-search.tag +++ b/src/web/app/desktop/tags/ui-header-search.tag @@ -35,7 +35,7 @@ this.mixin('page'); onsubmit(e) { - e.prevent-default! + e.preventDefault(); @page '/search:' + this.refs.q.value diff --git a/src/web/app/desktop/tags/ui.tag b/src/web/app/desktop/tags/ui.tag index 78bf6117c..1ecb0f570 100644 --- a/src/web/app/desktop/tags/ui.tag +++ b/src/web/app/desktop/tags/ui.tag @@ -31,7 +31,7 @@ tag = e.target.tag-name.to-lower-case! if tag != 'input' and tag != 'textarea' if e.which == 80 or e.which == 78 // p or n - e.prevent-default! + e.preventDefault(); @open-post-form! diff --git a/src/web/app/desktop/tags/window.tag b/src/web/app/desktop/tags/window.tag index f3d8ff7be..71084f8b5 100644 --- a/src/web/app/desktop/tags/window.tag +++ b/src/web/app/desktop/tags/window.tag @@ -208,7 +208,7 @@ this.refs.main.style.left = (window.inner-width / 2) - (this.refs.main.offset-width / 2) + 'px' this.refs.header.add-event-listener 'contextmenu' (e) => - e.prevent-default! + e.preventDefault(); 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 repel-move(e) { - e.stop-propagation! + e.stopPropagation(); return true bg-click() { @@ -328,7 +328,7 @@ // ヘッダー掴み時 on-header-mousedown(e) { - e.prevent-default! + e.preventDefault(); if not contains this.refs.main, document.active-element this.refs.main.focus(); @@ -370,7 +370,7 @@ // 上ハンドル掴み時 on-top-handle-mousedown(e) { - e.prevent-default! + e.preventDefault(); base = e.client-y height = parse-int((get-computed-style this.refs.main, '').height, 10) @@ -392,7 +392,7 @@ // 右ハンドル掴み時 on-right-handle-mousedown(e) { - e.prevent-default! + e.preventDefault(); base = e.client-x width = parse-int((get-computed-style this.refs.main, '').width, 10) @@ -412,7 +412,7 @@ // 下ハンドル掴み時 on-bottom-handle-mousedown(e) { - e.prevent-default! + e.preventDefault(); base = e.client-y height = parse-int((get-computed-style this.refs.main, '').height, 10) @@ -432,7 +432,7 @@ // 左ハンドル掴み時 on-left-handle-mousedown(e) { - e.prevent-default! + e.preventDefault(); base = e.client-x width = parse-int((get-computed-style this.refs.main, '').width, 10) @@ -499,21 +499,21 @@ window.remove-event-listener 'mouseup' drag-clear ondragover(e) { - e.data-transfer.drop-effect = 'none' + e.dataTransfer.dropEffect = 'none' on-keydown(e) { if e.which == 27 // Esc if @can-close - e.prevent-default! - e.stop-propagation! + e.preventDefault(); + e.stopPropagation(); @close! function contains(parent, child) - node = child.parent-node + node = child.parentNode while node? if node == parent return true - node = node.parent-node + node = node.parentNode return false diff --git a/src/web/app/dev/tags/new-app-form.tag b/src/web/app/dev/tags/new-app-form.tag index a298d5ce0..84e099612 100644 --- a/src/web/app/dev/tags/new-app-form.tag +++ b/src/web/app/dev/tags/new-app-form.tag @@ -238,6 +238,6 @@ .catch => alert 'アプリの作成に失敗しました。再度お試しください。' - locker.parent-node.remove-child locker + locker.parentNode.removeChild locker diff --git a/src/web/app/mobile/tags/drive-selector.tag b/src/web/app/mobile/tags/drive-selector.tag index d1ecc29b5..ce9bdd2b5 100644 --- a/src/web/app/mobile/tags/drive-selector.tag +++ b/src/web/app/mobile/tags/drive-selector.tag @@ -68,7 +68,7 @@ this.unmount(); ok() { - this.trigger 'selected' @files + this.trigger 'selected' this.files this.unmount(); diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag index f7fc07f00..ddaf60061 100644 --- a/src/web/app/mobile/tags/drive.tag +++ b/src/web/app/mobile/tags/drive.tag @@ -171,7 +171,7 @@ @add-file file, true 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 @remove-file file else @@ -181,7 +181,7 @@ @add-folder folder, true 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 @remove-folder folder else @@ -221,58 +221,58 @@ x folder.parent this.update(); - this.trigger 'open-folder' @folder, silent + this.trigger 'open-folder' this.folder, silent @load! .catch (err, text-status) -> console.error err 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 return - if (@folders.some (f) => f.id == folder.id) + if (this.folders.some (f) => f.id == folder.id) return if unshift - @folders.unshift folder + this.folders.unshift folder else - @folders.push folder + this.folders.push folder this.update(); 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 return - if (@files.some (f) => f.id == file.id) - exist = (@files.map (f) -> f.id).index-of file.id - @files[exist] = file + if (this.files.some (f) => f.id == file.id) + exist = (this.files.map (f) -> f.id).index-of file.id + this.files[exist] = file this.update(); return if unshift - @files.unshift file + this.files.unshift file else - @files.push file + this.files.push file this.update(); remove-folder(folder) { if typeof folder == 'object' folder = folder.id - this.folders = @folders.filter (f) -> f.id != folder + this.folders = this.folders.filter (f) -> f.id != folder this.update(); remove-file(file) { if typeof file == 'object' file = file.id - this.files = @files.filter (f) -> f.id != file + this.files = this.files.filter (f) -> f.id != file this.update(); go-root() { - if @folder != null or @file != null + if this.folder != null or this.file != null this.file = null this.folder = null this.hierarchy-folders = [] @@ -298,7 +298,7 @@ // フォルダ一覧取得 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 .then (folders) => if folders.length == folders-max + 1 @@ -311,7 +311,7 @@ // ファイル一覧取得 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 .then (files) => if files.length == files-max + 1 @@ -372,6 +372,6 @@ x file.folder this.update(); - this.trigger 'open-file' @file, silent + this.trigger 'open-file' this.file, silent diff --git a/src/web/app/mobile/tags/drive/file-viewer.tag b/src/web/app/mobile/tags/drive/file-viewer.tag index 86f6ca0c5..eff41ab85 100644 --- a/src/web/app/mobile/tags/drive/file-viewer.tag +++ b/src/web/app/mobile/tags/drive/file-viewer.tag @@ -180,22 +180,22 @@ diff --git a/src/web/app/mobile/tags/drive/file.tag b/src/web/app/mobile/tags/drive/file.tag index 16fa74b4b..c83134919 100644 --- a/src/web/app/mobile/tags/drive/file.tag +++ b/src/web/app/mobile/tags/drive/file.tag @@ -122,16 +122,16 @@ diff --git a/src/web/app/mobile/tags/drive/folder.tag b/src/web/app/mobile/tags/drive/folder.tag index aeb1601a6..c536fed9d 100644 --- a/src/web/app/mobile/tags/drive/folder.tag +++ b/src/web/app/mobile/tags/drive/folder.tag @@ -41,6 +41,6 @@ this.folder = this.opts.folder onclick() { - @browser.move @folder + this.browser.move this.folder diff --git a/src/web/app/mobile/tags/post-form.tag b/src/web/app/mobile/tags/post-form.tag index e53339dd4..72778f3b4 100644 --- a/src/web/app/mobile/tags/post-form.tag +++ b/src/web/app/mobile/tags/post-form.tag @@ -238,12 +238,12 @@ add-file(file) { file._remove = => - this.files = @files.filter (x) -> x.id != file.id - this.trigger 'change-files' @files + this.files = this.files.filter (x) -> x.id != file.id + this.trigger 'change-files' this.files this.update(); - @files.push file - this.trigger 'change-files' @files + this.files.push file + this.trigger 'change-files' this.files this.update(); add-poll() { @@ -256,8 +256,8 @@ post() { this.wait = true - files = if @files? and @files.length > 0 - then @files.map (f) -> f.id + files = if this.files? and this.files.length > 0 + then this.files.map (f) -> f.id else undefined this.api 'posts/create' do