diff --git a/src/web/app/auth/tags/form.tag b/src/web/app/auth/tags/form.tag
index bb424d98c2..21a9a74048 100644
--- a/src/web/app/auth/tags/form.tag
+++ b/src/web/app/auth/tags/form.tag
@@ -112,13 +112,13 @@
this.app = @session.app
this.cancel = () => {
- this.api 'auth/deny' do
+ this.api('auth/deny', {
token: @session.token
.then =>
this.trigger('denied');
this.accept = () => {
- this.api 'auth/accept' do
+ this.api('auth/accept', {
token: @session.token
.then =>
this.trigger('accepted');
diff --git a/src/web/app/auth/tags/index.tag b/src/web/app/auth/tags/index.tag
index e64fedb261..13abf07905 100644
--- a/src/web/app/auth/tags/index.tag
+++ b/src/web/app/auth/tags/index.tag
@@ -100,15 +100,15 @@
if not this.SIGNIN then return
// Fetch session
- this.api 'auth/session/show' do
+ this.api('auth/session/show', {
token: @token
- .then (session) =>
+ }).then((session) => {
this.session = session
this.fetching = false
// 既に連携していた場合
if @session.app.is_authorized
- this.api 'auth/accept' do
+ this.api('auth/accept', {
token: @session.token
.then =>
@accepted!
diff --git a/src/web/app/common/tags/messaging/index.tag b/src/web/app/common/tags/messaging/index.tag
index ca1adaaa70..6ba6cb7d94 100644
--- a/src/web/app/common/tags/messaging/index.tag
+++ b/src/web/app/common/tags/messaging/index.tag
@@ -310,10 +310,10 @@
if (q == '') {
this.searchResult = [];
} else {
- this.api 'users/search' do
+ this.api('users/search', {
query: q
max: 5
- .then (users) =>
+ }).then((users) => {
users.forEach (user) =>
user._click = =>
this.trigger 'navigate-user' user
diff --git a/src/web/app/common/tags/signin-history.tag b/src/web/app/common/tags/signin-history.tag
index 6b2ca1e6c9..47bf68c283 100644
--- a/src/web/app/common/tags/signin-history.tag
+++ b/src/web/app/common/tags/signin-history.tag
@@ -56,7 +56,7 @@
this.on('mount', () => {
this.api 'i/signin_history'
- .then (history) =>
+ }).then((history) => {
this.history = history
this.fetching = false
this.update();
diff --git a/src/web/app/common/tags/signin.tag b/src/web/app/common/tags/signin.tag
index 204ed83269..7b297b7b8e 100644
--- a/src/web/app/common/tags/signin.tag
+++ b/src/web/app/common/tags/signin.tag
@@ -103,9 +103,9 @@
this.signing = false;
this.oninput = () => {
- this.api 'users/show' do
+ this.api('users/show', {
username: this.refs.username.value
- .then (user) =>
+ }).then((user) => {
this.user = user
this.trigger 'user' user
this.update();
@@ -123,7 +123,7 @@
this.signing = true
this.update();
- this.api 'signin' do
+ this.api('signin', {
username: this.refs.username.value
password: this.refs.password.value
.then =>
diff --git a/src/web/app/common/tags/signup.tag b/src/web/app/common/tags/signup.tag
index 06e044a411..7646f8c861 100644
--- a/src/web/app/common/tags/signup.tag
+++ b/src/web/app/common/tags/signup.tag
@@ -220,9 +220,9 @@
this.username-state = 'wait'
this.update();
- this.api 'username/available' do
+ this.api('username/available', {
username: username
- .then (result) =>
+ }).then((result) => {
if result.available
this.username-state = 'ok'
else
@@ -271,14 +271,14 @@
const username = this.refs.username.value;
const password = this.refs.password.value;
- locker = document.body.appendChild document.createElement 'mk-locker'
-
- this.api 'signup' do
+ locker = document.body.appendChild(document.createElement('mk-locker'));
+
+ this.api('signup', {
username: username,
password: password,
'g-recaptcha-response': grecaptcha.getResponse()
.then =>
- this.api 'signin' do
+ this.api('signin', {
username: username
password: password
.then =>
diff --git a/src/web/app/desktop/tags/autocomplete-suggestion.tag b/src/web/app/desktop/tags/autocomplete-suggestion.tag
index 29212fb059..40f5f57591 100644
--- a/src/web/app/desktop/tags/autocomplete-suggestion.tag
+++ b/src/web/app/desktop/tags/autocomplete-suggestion.tag
@@ -95,10 +95,10 @@
Array.prototype.forEach.call all, (el) =>
el.addEventListener 'mousedown' @mousedown
- this.api 'users/search_by_username' do
+ this.api('users/search_by_username', {
query: @q
limit: 30users
- .then (users) =>
+ }).then((users) => {
this.users = users
this.loading = false
this.update();
@@ -114,7 +114,7 @@
this.mousedown = (e) => {
if (!contains this.root, e.target) and (this.root != e.target)
- @close!
+ @close();
this.on-click = (e) => {
@complete e.item
@@ -128,24 +128,24 @@
e.stopPropagation();
@complete this.users[@select]
else
- @close!
+ @close();
| 27 => // Key[ESC]
e.preventDefault();
e.stopPropagation();
- @close!
+ @close();
| 38 => // Key[↑]
if @select != -1
e.preventDefault();
e.stopPropagation();
@select-prev!
else
- @close!
+ @close();
| 9, 40 => // Key[TAB] or Key[↓]
e.preventDefault();
e.stopPropagation();
@select-next!
| _ =>
- @close!
+ @close();
this.select-next = () => {
@select++
@@ -174,7 +174,7 @@
this.opts.complete user
this.close = () => {
- this.opts.close!
+ this.opts.close();
function contains(parent, child)
node = child.parentNode
diff --git a/src/web/app/desktop/tags/big-follow-button.tag b/src/web/app/desktop/tags/big-follow-button.tag
index f8676669f2..ba607c8372 100644
--- a/src/web/app/desktop/tags/big-follow-button.tag
+++ b/src/web/app/desktop/tags/big-follow-button.tag
@@ -80,7 +80,7 @@
this.wait = false
this.on('mount', () => {
- this.user-promise.then (user) =>
+ this.user-promise}).then((user) => {
this.user = user
this.init = false
this.update();
@@ -104,7 +104,7 @@
this.onclick = () => {
this.wait = true
if this.user.is_following
- this.api 'following/delete' do
+ this.api('following/delete', {
user_id: this.user.id
.then =>
this.user.is_following = false
@@ -114,7 +114,7 @@
this.wait = false
this.update();
else
- this.api 'following/create' do
+ this.api('following/create', {
user_id: this.user.id
.then =>
this.user.is_following = true
diff --git a/src/web/app/desktop/tags/contextmenu.tag b/src/web/app/desktop/tags/contextmenu.tag
index a16e7d2d02..92c8b71a2e 100644
--- a/src/web/app/desktop/tags/contextmenu.tag
+++ b/src/web/app/desktop/tags/contextmenu.tag
@@ -100,7 +100,7 @@
this.mousedown = (e) => {
e.preventDefault();
if (!contains this.root, e.target) and (this.root != e.target)
- @close!
+ @close();
return false
this.open = (pos) => {
diff --git a/src/web/app/desktop/tags/crop-window.tag b/src/web/app/desktop/tags/crop-window.tag
index 45704a4b58..56845f24a8 100644
--- a/src/web/app/desktop/tags/crop-window.tag
+++ b/src/web/app/desktop/tags/crop-window.tag
@@ -175,14 +175,14 @@
this.ok = () => {
@cropper.get-cropped-canvas!.to-blob (blob) =>
this.trigger 'cropped' blob
- this.refs.window.close!
+ this.refs.window.close();
this.skip = () => {
this.trigger('skiped');
- this.refs.window.close!
+ this.refs.window.close();
this.cancel = () => {
this.trigger('canceled');
- this.refs.window.close!
+ this.refs.window.close();
diff --git a/src/web/app/desktop/tags/dialog.tag b/src/web/app/desktop/tags/dialog.tag
index affa2a88da..61a40e7b39 100644
--- a/src/web/app/desktop/tags/dialog.tag
+++ b/src/web/app/desktop/tags/dialog.tag
@@ -84,7 +84,7 @@
button._onclick = =>
if button.onclick?
button.onclick();
- @close!
+ @close();
this.on('mount', () => {
this.refs.header.innerHTML = this.opts.title
@@ -142,6 +142,6 @@
if @can-through
if this.opts.on-through?
this.opts.on-through!
- @close!
+ @close();
diff --git a/src/web/app/desktop/tags/donation.tag b/src/web/app/desktop/tags/donation.tag
index 57b36a3054..e313188f24 100644
--- a/src/web/app/desktop/tags/donation.tag
+++ b/src/web/app/desktop/tags/donation.tag
@@ -54,11 +54,13 @@
e.preventDefault();
e.stopPropagation();
- this.I.data.no_donation = true
- this.I.update!
- this.api 'i/appdata/set' do
- data: JSON.stringify do
+ this.I.data.no_donation = true;
+ this.I.update();
+ this.api('i/appdata/set', {
+ data: JSON.stringify({
no_donation: this.I.data.no_donation
+ })
+ });
this.unmount();
};
diff --git a/src/web/app/desktop/tags/drive/base-contextmenu.tag b/src/web/app/desktop/tags/drive/base-contextmenu.tag
index 9503e639d6..06ccba6a29 100644
--- a/src/web/app/desktop/tags/drive/base-contextmenu.tag
+++ b/src/web/app/desktop/tags/drive/base-contextmenu.tag
@@ -23,16 +23,16 @@
this.open = (pos) => {
this.refs.ctx.open pos
- this.create-folder = () => {
- this.browser.create-folder!
- this.refs.ctx.close!
+ this.createFolder = () => {
+ this.browser.createFolder!
+ this.refs.ctx.close();
this.upload = () => {
this.browser.select-local-file!
- this.refs.ctx.close!
+ this.refs.ctx.close();
this.url-upload = () => {
this.browser.url-upload!
- this.refs.ctx.close!
+ this.refs.ctx.close();
diff --git a/src/web/app/desktop/tags/drive/browser-window.tag b/src/web/app/desktop/tags/drive/browser-window.tag
index b5b2572d45..f558b3d846 100644
--- a/src/web/app/desktop/tags/drive/browser-window.tag
+++ b/src/web/app/desktop/tags/drive/browser-window.tag
@@ -36,11 +36,11 @@
this.refs.window.on('closed', () => {
this.unmount();
- this.api 'drive' .then (info) =>
+ this.api 'drive' }).then((info) => {
@update do
usage: info.usage / info.capacity * 100
this.close = () => {
- this.refs.window.close!
+ this.refs.window.close();
diff --git a/src/web/app/desktop/tags/drive/browser.tag b/src/web/app/desktop/tags/drive/browser.tag
index c138325238..13019dd160 100644
--- a/src/web/app/desktop/tags/drive/browser.tag
+++ b/src/web/app/desktop/tags/drive/browser.tag
@@ -405,7 +405,7 @@
if (this.files.some (f) => f.id == file)
return false
@remove-file file
- this.api 'drive/files/update' do
+ this.api('drive/files/update', {
file_id: file
folder_id: if this.folder? then this.folder.id else null
.then =>
@@ -422,7 +422,7 @@
if (this.folders.some (f) => f.id == folder)
return false
@remove-folder folder
- this.api 'drive/folders/update' do
+ this.api('drive/folders/update', {
folder_id: folder
parent_id: if this.folder? then this.folder.id else null
.then =>
@@ -442,8 +442,8 @@
e.preventDefault();
e.stopImmediatePropagation();
- ctx = document.body.appendChild document.createElement 'mk-drive-browser-base-contextmenu'
- ctx = riot.mount ctx, do
+ ctx = document.body.appendChild(document.createElement('mk-drive-browser-base-contextmenu'));
+ ctx = riot.mount ctx, do
browser: this
ctx = ctx.0
ctx.open do
@@ -462,7 +462,7 @@
null
if url? and url != ''
- this.api 'drive/files/upload_from_url' do
+ this.api('drive/files/upload_from_url', {
url: url
folder_id: if this.folder? then this.folder.id else undefined
@@ -473,16 +473,16 @@
text: 'OK'
]
- this.create-folder = () => {
+ this.createFolder = () => {
name <~ @input-dialog do
'フォルダー作成'
'フォルダー名'
null
- this.api 'drive/folders/create' do
+ this.api('drive/folders/create', {
name: name
folder_id: if this.folder? then this.folder.id else undefined
- .then (folder) =>
+ }).then((folder) => {
@add-folder folder, true
this.update();
.catch (err) =>
@@ -502,9 +502,9 @@
this.get-selection = () => {
this.files.filter (file) -> file._selected
- this.new-window = (folder-id) => {
- browser = document.body.appendChild document.createElement 'mk-drive-browser-window'
- riot.mount browser, do
+ this.newWindow = (folder-id) => {
+ browser = document.body.appendChild(document.createElement('mk-drive-browser-window'));
+ riot.mount browser, do
folder: folder-id
this.move = (target-folder) => {
@@ -518,9 +518,9 @@
this.loading = true
this.update();
- this.api 'drive/folders/show' do
+ this.api('drive/folders/show', {
folder_id: target-folder
- .then (folder) =>
+ }).then((folder) => {
this.folder = folder
this.hierarchyFolders = []
@@ -607,10 +607,10 @@
files-max = 30
// フォルダ一覧取得
- this.api 'drive/folders' do
+ this.api('drive/folders', {
folder_id: if this.folder? then this.folder.id else null
limit: folders-max + 1
- .then (folders) =>
+ }).then((folders) => {
if folders.length == folders-max + 1
this.more-folders = true
folders.pop!
@@ -620,10 +620,10 @@
console.error err
// ファイル一覧取得
- this.api 'drive/files' do
+ this.api('drive/files', {
folder_id: if this.folder? then this.folder.id else null
limit: files-max + 1
- .then (files) =>
+ }).then((files) => {
if files.length == files-max + 1
this.more-files = true
files.pop!
diff --git a/src/web/app/desktop/tags/drive/file-contextmenu.tag b/src/web/app/desktop/tags/drive/file-contextmenu.tag
index e8d75ccd4d..9a615a9022 100644
--- a/src/web/app/desktop/tags/drive/file-contextmenu.tag
+++ b/src/web/app/desktop/tags/drive/file-contextmenu.tag
@@ -58,14 +58,14 @@
this.refs.ctx.open pos
this.rename = () => {
- this.refs.ctx.close!
+ this.refs.ctx.close();
name <~ @input-dialog do
'ファイル名の変更'
'新しいファイル名を入力してください'
this.file.name
- this.api 'drive/files/update' do
+ this.api('drive/files/update', {
file_id: this.file.id
name: name
.then =>
@@ -77,18 +77,18 @@
@NotImplementedException!
this.download = () => {
- this.refs.ctx.close!
+ this.refs.ctx.close();
this.set-avatar = () => {
- this.refs.ctx.close!
+ this.refs.ctx.close();
@update-avatar this.I, null, this.file
this.set-banner = () => {
- this.refs.ctx.close!
+ this.refs.ctx.close();
@update-banner this.I, null, this.file
this.set-wallpaper = () => {
- this.refs.ctx.close!
+ this.refs.ctx.close();
@update-wallpaper this.I, null, this.file
this.add-app = () => {
diff --git a/src/web/app/desktop/tags/drive/file.tag b/src/web/app/desktop/tags/drive/file.tag
index 7016f74291..58c6b40a41 100644
--- a/src/web/app/desktop/tags/drive/file.tag
+++ b/src/web/app/desktop/tags/drive/file.tag
@@ -177,8 +177,8 @@
this.is-contextmenu-showing = true
this.update();
- ctx = document.body.appendChild document.createElement 'mk-drive-browser-file-contextmenu'
- ctx = riot.mount ctx, do
+ ctx = document.body.appendChild(document.createElement('mk-drive-browser-file-contextmenu'));
+ ctx = riot.mount ctx, do
browser: this.browser
file: this.file
ctx = ctx.0
diff --git a/src/web/app/desktop/tags/drive/folder-contextmenu.tag b/src/web/app/desktop/tags/drive/folder-contextmenu.tag
index 92fb5457c2..833eff42e2 100644
--- a/src/web/app/desktop/tags/drive/folder-contextmenu.tag
+++ b/src/web/app/desktop/tags/drive/folder-contextmenu.tag
@@ -21,11 +21,11 @@
this.mixin('api');
this.mixin('input-dialog');
- this.browser = this.opts.browser
- this.folder = this.opts.folder
+ this.browser = this.opts.browser;
+ this.folder = this.opts.folder;
- this.open = (pos) => {
- this.refs.ctx.open pos
+ this.open = pos => {
+ this.refs.ctx.open(pos);
this.refs.ctx.on('closed', () => {
this.trigger('closed');
@@ -33,29 +33,25 @@
this.move = () => {
this.browser.move this.folder.id
- this.refs.ctx.close!
+ this.refs.ctx.close();
- this.new-window = () => {
- this.browser.new-window this.folder.id
- this.refs.ctx.close!
+ this.newWindow = () => {
+ this.browser.newWindow this.folder.id
+ this.refs.ctx.close();
- this.create-folder = () => {
- this.browser.create-folder!
- this.refs.ctx.close!
-
- this.upload = () => {
- this.browser.select-lcoal-file!
- this.refs.ctx.close!
+ this.createFolder = () => {
+ this.browser.createFolder();
+ this.refs.ctx.close();
this.rename = () => {
- this.refs.ctx.close!
+ this.refs.ctx.close();
name <~ @input-dialog do
'フォルダ名の変更'
'新しいフォルダ名を入力してください'
this.folder.name
- this.api 'drive/folders/update' do
+ this.api('drive/folders/update', {
folder_id: this.folder.id
name: name
.then =>
diff --git a/src/web/app/desktop/tags/drive/folder.tag b/src/web/app/desktop/tags/drive/folder.tag
index 02215dac37..fff3c13ebe 100644
--- a/src/web/app/desktop/tags/drive/folder.tag
+++ b/src/web/app/desktop/tags/drive/folder.tag
@@ -115,7 +115,7 @@
if obj.type == 'file'
file = obj.id
this.browser.remove-file file
- this.api 'drive/files/update' do
+ this.api('drive/files/update', {
file_id: file
folder_id: this.folder.id
.then =>
@@ -130,7 +130,7 @@
if folder == this.folder.id
return false
this.browser.remove-folder folder
- this.api 'drive/folders/update' do
+ this.api('drive/folders/update', {
folder_id: folder
parent_id: this.folder.id
.then =>
@@ -167,8 +167,8 @@
this.is-contextmenu-showing = true
this.update();
- ctx = document.body.appendChild document.createElement 'mk-drive-browser-folder-contextmenu'
- ctx = riot.mount ctx, do
+ ctx = document.body.appendChild(document.createElement('mk-drive-browser-folder-contextmenu'));
+ ctx = riot.mount ctx, do
browser: this.browser
folder: this.folder
ctx = ctx.0
diff --git a/src/web/app/desktop/tags/drive/nav-folder.tag b/src/web/app/desktop/tags/drive/nav-folder.tag
index f0dab487e8..3f57fc1293 100644
--- a/src/web/app/desktop/tags/drive/nav-folder.tag
+++ b/src/web/app/desktop/tags/drive/nav-folder.tag
@@ -69,7 +69,7 @@
if obj.type == 'file'
file = obj.id
this.browser.remove-file file
- this.api 'drive/files/update' do
+ this.api('drive/files/update', {
file_id: file
folder_id: if this.folder? then this.folder.id else null
.then =>
@@ -84,7 +84,7 @@
if this.folder? and folder == this.folder.id
return false
this.browser.remove-folder folder
- this.api 'drive/folders/update' do
+ this.api('drive/folders/update', {
folder_id: folder
parent_id: if this.folder? then this.folder.id else null
.then =>
diff --git a/src/web/app/desktop/tags/follow-button.tag b/src/web/app/desktop/tags/follow-button.tag
index 09ef984224..7b5ab7d0e4 100644
--- a/src/web/app/desktop/tags/follow-button.tag
+++ b/src/web/app/desktop/tags/follow-button.tag
@@ -77,7 +77,7 @@
this.wait = false
this.on('mount', () => {
- this.user-promise.then (user) =>
+ this.user-promise}).then((user) => {
this.user = user
this.init = false
this.update();
@@ -101,7 +101,7 @@
this.onclick = () => {
this.wait = true
if this.user.is_following
- this.api 'following/delete' do
+ this.api('following/delete', {
user_id: this.user.id
.then =>
this.user.is_following = false
@@ -111,7 +111,7 @@
this.wait = false
this.update();
else
- this.api 'following/create' do
+ this.api('following/create', {
user_id: this.user.id
.then =>
this.user.is_following = true
diff --git a/src/web/app/desktop/tags/following-setuper.tag b/src/web/app/desktop/tags/following-setuper.tag
index c4adfbd868..6381e4d8d9 100644
--- a/src/web/app/desktop/tags/following-setuper.tag
+++ b/src/web/app/desktop/tags/following-setuper.tag
@@ -140,10 +140,10 @@
this.users = null
this.update();
- this.api 'users/recommendation' do
+ this.api('users/recommendation', {
limit: @limit
offset: @limit * this.page
- .then (users) =>
+ }).then((users) => {
this.loading = false
this.users = users
this.update();
diff --git a/src/web/app/desktop/tags/home-widgets/mentions.tag b/src/web/app/desktop/tags/home-widgets/mentions.tag
index d3f9eac3ab..4ae17647f7 100644
--- a/src/web/app/desktop/tags/home-widgets/mentions.tag
+++ b/src/web/app/desktop/tags/home-widgets/mentions.tag
@@ -72,9 +72,9 @@
this.refs.timeline.focus();
this.fetch = (cb) => {
- this.api 'posts/mentions' do
+ this.api('posts/mentions', {
following: this.mode == 'following'
- .then (posts) =>
+ }).then((posts) => {
this.is-loading = false
this.is-empty = posts.length == 0
this.update();
@@ -89,10 +89,10 @@
return
this.more-loading = true
this.update();
- this.api 'posts/mentions' do
+ this.api('posts/mentions', {
following: this.mode == 'following'
max_id: this.refs.timeline.tail!.id
- .then (posts) =>
+ }).then((posts) => {
this.more-loading = false
this.update();
this.refs.timeline.prepend-posts posts
diff --git a/src/web/app/desktop/tags/home-widgets/photo-stream.tag b/src/web/app/desktop/tags/home-widgets/photo-stream.tag
index c606fac640..042e3ea209 100644
--- a/src/web/app/desktop/tags/home-widgets/photo-stream.tag
+++ b/src/web/app/desktop/tags/home-widgets/photo-stream.tag
@@ -66,10 +66,10 @@
this.on('mount', () => {
this.stream.on 'drive_file_created' this.on-stream-drive-file-created
- this.api 'drive/stream' do
+ this.api('drive/stream', {
type: 'image/*'
limit: 9images
- .then (images) =>
+ }).then((images) => {
this.initializing = false
this.images = images
this.update();
diff --git a/src/web/app/desktop/tags/home-widgets/rss-reader.tag b/src/web/app/desktop/tags/home-widgets/rss-reader.tag
index d44f76b169..98af55cb55 100644
--- a/src/web/app/desktop/tags/home-widgets/rss-reader.tag
+++ b/src/web/app/desktop/tags/home-widgets/rss-reader.tag
@@ -81,7 +81,7 @@
this.fetch = () => {
this.api CONFIG.url + '/api:rss' do
url: @url
- .then (feed) =>
+ }).then((feed) => {
this.items = feed.rss.channel.item
this.initializing = false
this.update();
diff --git a/src/web/app/desktop/tags/home-widgets/timeline.tag b/src/web/app/desktop/tags/home-widgets/timeline.tag
index 6e3e867e5e..30acc75acd 100644
--- a/src/web/app/desktop/tags/home-widgets/timeline.tag
+++ b/src/web/app/desktop/tags/home-widgets/timeline.tag
@@ -68,7 +68,7 @@
this.load = (cb) => {
this.api 'posts/timeline'
- .then (posts) =>
+ }).then((posts) => {
this.is-loading = false
this.is-empty = posts.length == 0
this.update();
@@ -83,9 +83,9 @@
return
this.more-loading = true
this.update();
- this.api 'posts/timeline' do
+ this.api('posts/timeline', {
max_id: this.refs.timeline.tail!.id
- .then (posts) =>
+ }).then((posts) => {
this.more-loading = false
this.update();
this.refs.timeline.prepend-posts posts
diff --git a/src/web/app/desktop/tags/home-widgets/user-recommendation.tag b/src/web/app/desktop/tags/home-widgets/user-recommendation.tag
index 64c9c04e9a..63a8d1571e 100644
--- a/src/web/app/desktop/tags/home-widgets/user-recommendation.tag
+++ b/src/web/app/desktop/tags/home-widgets/user-recommendation.tag
@@ -132,10 +132,10 @@
this.loading = true
this.users = null
if not quiet then this.update();
- this.api 'users/recommendation' do
+ this.api('users/recommendation', {
limit: @limit
offset: @limit * this.page
- .then (users) =>
+ }).then((users) => {
this.loading = false
this.users = users
this.update();
diff --git a/src/web/app/desktop/tags/images-viewer.tag b/src/web/app/desktop/tags/images-viewer.tag
index 84190d34db..986debab4f 100644
--- a/src/web/app/desktop/tags/images-viewer.tag
+++ b/src/web/app/desktop/tags/images-viewer.tag
@@ -38,8 +38,8 @@
this.refs.view.style.background-position = xp + '% ' + yp + '%'
this.click = () => {
- dialog = document.body.appendChild document.createElement 'mk-image-dialog'
- riot.mount dialog, do
+ dialog = document.body.appendChild(document.createElement('mk-image-dialog'));
+ riot.mount dialog, do
image: @image
diff --git a/src/web/app/desktop/tags/input-dialog.tag b/src/web/app/desktop/tags/input-dialog.tag
index b5aefcd164..dbfd1cfc70 100644
--- a/src/web/app/desktop/tags/input-dialog.tag
+++ b/src/web/app/desktop/tags/input-dialog.tag
@@ -141,12 +141,12 @@
this.cancel = () => {
this.done = false
- this.refs.window.close!
+ this.refs.window.close();
this.ok = () => {
if not @allow-empty and @text.value == '' then return
this.done = true
- this.refs.window.close!
+ this.refs.window.close();
this.on-keydown = (e) => {
if e.which == 13 // Enter
diff --git a/src/web/app/desktop/tags/messaging/window.tag b/src/web/app/desktop/tags/messaging/window.tag
index 2d9a060d6b..208404d154 100644
--- a/src/web/app/desktop/tags/messaging/window.tag
+++ b/src/web/app/desktop/tags/messaging/window.tag
@@ -24,8 +24,8 @@
this.unmount();
this.refs.window.refs.index.on('navigate-user', user => {
- w = document.body.appendChild document.createElement 'mk-messaging-room-window'
- riot.mount w, do
+ w = document.body.appendChild(document.createElement('mk-messaging-room-window'));
+ riot.mount w, do
user: user
diff --git a/src/web/app/desktop/tags/notifications.tag b/src/web/app/desktop/tags/notifications.tag
index 39d86c5e20..2db27a4fc3 100644
--- a/src/web/app/desktop/tags/notifications.tag
+++ b/src/web/app/desktop/tags/notifications.tag
@@ -187,7 +187,7 @@
this.on('mount', () => {
this.api 'i/notifications'
- .then (notifications) =>
+ }).then((notifications) => {
this.notifications = notifications
this.loading = false
this.update();
diff --git a/src/web/app/desktop/tags/post-detail-sub.tag b/src/web/app/desktop/tags/post-detail-sub.tag
index b61898f675..f5fec6f6a5 100644
--- a/src/web/app/desktop/tags/post-detail-sub.tag
+++ b/src/web/app/desktop/tags/post-detail-sub.tag
@@ -125,13 +125,13 @@
this.like = () => {
if this.post.is_liked
- this.api 'posts/likes/delete' do
+ this.api('posts/likes/delete', {
post_id: this.post.id
.then =>
this.post.is_liked = false
this.update();
else
- this.api 'posts/likes/create' do
+ this.api('posts/likes/create', {
post_id: this.post.id
.then =>
this.post.is_liked = true
diff --git a/src/web/app/desktop/tags/post-detail.tag b/src/web/app/desktop/tags/post-detail.tag
index 958b0c681b..3b5671452a 100644
--- a/src/web/app/desktop/tags/post-detail.tag
+++ b/src/web/app/desktop/tags/post-detail.tag
@@ -342,9 +342,9 @@
this.on('mount', () => {
- this.api 'posts/show' do
+ this.api('posts/show', {
post_id: this.opts.post
- .then (post) =>
+ }).then((post) => {
this.fetching = false
this.post = post
this.trigger('loaded');
@@ -368,55 +368,55 @@
tokens
.filter (t) -> t.type == 'link'
.map (t) =>
- this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
- riot.mount this.preview, do
+ this.preview = this.refs.text.appendChild(document.createElement('mk-url-preview'));
+ riot.mount this.preview, do
url: t.content
// Get likes
- this.api 'posts/likes' do
+ this.api('posts/likes', {
post_id: this.p.id
limit: 8
- .then (likes) =>
+ }).then((likes) => {
this.likes = likes
this.update();
// Get reposts
- this.api 'posts/reposts' do
+ this.api('posts/reposts', {
post_id: this.p.id
limit: 8
- .then (reposts) =>
+ }).then((reposts) => {
this.reposts = reposts
this.update();
// Get replies
- this.api 'posts/replies' do
+ this.api('posts/replies', {
post_id: this.p.id
limit: 8
- .then (replies) =>
+ }).then((replies) => {
this.replies = replies
this.update();
this.update();
this.reply = () => {
- form = document.body.appendChild document.createElement 'mk-post-form-window'
- riot.mount form, do
+ form = document.body.appendChild(document.createElement('mk-post-form-window'));
+ riot.mount form, do
reply: this.p
this.repost = () => {
- form = document.body.appendChild document.createElement 'mk-repost-form-window'
- riot.mount form, do
+ form = document.body.appendChild(document.createElement('mk-repost-form-window'));
+ riot.mount form, do
post: this.p
this.like = () => {
if this.p.is_liked
- this.api 'posts/likes/delete' do
+ this.api('posts/likes/delete', {
post_id: this.p.id
.then =>
this.p.is_liked = false
this.update();
else
- this.api 'posts/likes/create' do
+ this.api('posts/likes/create', {
post_id: this.p.id
.then =>
this.p.is_liked = true
@@ -426,9 +426,9 @@
this.loading-context = true
// Get context
- this.api 'posts/context' do
+ this.api('posts/context', {
post_id: this.p.reply_to_id
- .then (context) =>
+ }).then((context) => {
this.context = context.reverse!
this.loading-context = false
this.update();
diff --git a/src/web/app/desktop/tags/post-form-window.tag b/src/web/app/desktop/tags/post-form-window.tag
index bb68de5f06..8f5bf1a519 100644
--- a/src/web/app/desktop/tags/post-form-window.tag
+++ b/src/web/app/desktop/tags/post-form-window.tag
@@ -42,7 +42,7 @@
this.unmount();
this.refs.window.refs.form.on('post', () => {
- this.refs.window.close!
+ this.refs.window.close();
this.refs.window.refs.form.on('change-uploading-files', (files) => {
this.uploading-files = files
diff --git a/src/web/app/desktop/tags/post-form.tag b/src/web/app/desktop/tags/post-form.tag
index ed56e2a117..fe435c4e4f 100644
--- a/src/web/app/desktop/tags/post-form.tag
+++ b/src/web/app/desktop/tags/post-form.tag
@@ -405,8 +405,8 @@
this.refs.file.click();
this.select-file-from-drive = () => {
- browser = document.body.appendChild document.createElement 'mk-select-file-from-drive-window'
- i = riot.mount browser, do
+ browser = document.body.appendChild(document.createElement('mk-select-file-from-drive-window'));
+ i = riot.mount browser, do
multiple: true
i[0].one 'selected' (files) =>
files.forEach @add-file
@@ -444,12 +444,12 @@
then this.files.map (f) -> f.id
else undefined
- this.api 'posts/create' do
+ this.api('posts/create', {
text: this.refs.text.value
media_ids: files
reply_to_id: if @in-reply-to-post? then @in-reply-to-post.id else undefined
poll: if this.poll then this.refs.poll.get! else undefined
- .then (data) =>
+ }).then((data) => {
this.trigger('post');
@notify if @in-reply-to-post? then '返信しました!' else '投稿しました!'
.catch (err) =>
diff --git a/src/web/app/desktop/tags/post-status-graph.tag b/src/web/app/desktop/tags/post-status-graph.tag
index f4a890a0c9..5f6a667eb7 100644
--- a/src/web/app/desktop/tags/post-status-graph.tag
+++ b/src/web/app/desktop/tags/post-status-graph.tag
@@ -20,22 +20,22 @@
this.post = post
this.update();
- this.api 'aggregation/posts/like' do
+ this.api('aggregation/posts/like', {
post_id: this.post.id
limit: 30days
- .then (likes) =>
+ }).then((likes) => {
likes = likes.reverse!
- this.api 'aggregation/posts/repost' do
+ this.api('aggregation/posts/repost', {
post_id: this.post.id
limit: 30days
- .then (repost) =>
+ }).then((repost) => {
repost = repost.reverse!
- this.api 'aggregation/posts/reply' do
+ this.api('aggregation/posts/reply', {
post_id: this.post.id
limit: 30days
- .then (replies) =>
+ }).then((replies) => {
replies = replies.reverse!
new Chart this.refs.canv, do
diff --git a/src/web/app/desktop/tags/progress-dialog.tag b/src/web/app/desktop/tags/progress-dialog.tag
index da0ed16d78..cba4e34041 100644
--- a/src/web/app/desktop/tags/progress-dialog.tag
+++ b/src/web/app/desktop/tags/progress-dialog.tag
@@ -89,6 +89,6 @@
this.update();
this.close = () => {
- this.refs.window.close!
+ this.refs.window.close();
diff --git a/src/web/app/desktop/tags/repost-form-window.tag b/src/web/app/desktop/tags/repost-form-window.tag
index 7af67094b0..d7521caab2 100644
--- a/src/web/app/desktop/tags/repost-form-window.tag
+++ b/src/web/app/desktop/tags/repost-form-window.tag
@@ -16,14 +16,14 @@
tag = e.target.tag-name.to-lower-case!
if tag != 'input' and tag != 'textarea'
if e.which == 27 // Esc
- this.refs.window.close!
+ this.refs.window.close();
this.on('mount', () => {
this.refs.window.refs.form.on('cancel', () => {
- this.refs.window.close!
+ this.refs.window.close();
this.refs.window.refs.form.on('posted', () => {
- this.refs.window.close!
+ this.refs.window.close();
document.addEventListener 'keydown' this.on-document-keydown
diff --git a/src/web/app/desktop/tags/repost-form.tag b/src/web/app/desktop/tags/repost-form.tag
index 319b42dd01..c3e3e02dfe 100644
--- a/src/web/app/desktop/tags/repost-form.tag
+++ b/src/web/app/desktop/tags/repost-form.tag
@@ -125,10 +125,10 @@
this.ok = () => {
this.wait = true
- this.api 'posts/create' do
+ this.api('posts/create', {
repost_id: this.opts.post.id
text: if @quote then this.refs.text.value else undefined
- .then (data) =>
+ }).then((data) => {
this.trigger('posted');
@notify 'Repostしました!'
.catch (err) =>
diff --git a/src/web/app/desktop/tags/search-posts.tag b/src/web/app/desktop/tags/search-posts.tag
index dd3b8e66e4..bad055eb04 100644
--- a/src/web/app/desktop/tags/search-posts.tag
+++ b/src/web/app/desktop/tags/search-posts.tag
@@ -41,9 +41,9 @@
document.addEventListener 'keydown' this.on-document-keydown
window.addEventListener 'scroll' this.on-scroll
- this.api 'posts/search' do
+ this.api('posts/search', {
query: @query
- .then (posts) =>
+ }).then((posts) => {
this.is-loading = false
this.is-empty = posts.length == 0
this.update();
@@ -67,10 +67,10 @@
return
this.more-loading = true
this.update();
- this.api 'posts/search' do
+ this.api('posts/search', {
query: @query
page: this.page + 1
- .then (posts) =>
+ }).then((posts) => {
this.more-loading = false
this.page++
this.update();
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 6979a55211..45ece233f2 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
@@ -149,13 +149,13 @@
this.unmount();
this.close = () => {
- this.refs.window.close!
+ this.refs.window.close();
this.upload = () => {
this.refs.window.refs.browser.select-local-file!
this.ok = () => {
this.trigger 'selected' this.file
- this.refs.window.close!
+ this.refs.window.close();
diff --git a/src/web/app/desktop/tags/settings-window.tag b/src/web/app/desktop/tags/settings-window.tag
index 89219fccf8..b3f0bb4579 100644
--- a/src/web/app/desktop/tags/settings-window.tag
+++ b/src/web/app/desktop/tags/settings-window.tag
@@ -20,6 +20,6 @@
this.unmount();
this.close = () => {
- this.refs.window.close!
+ this.refs.window.close();
diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag
index e4a83738e6..e43a512af3 100644
--- a/src/web/app/desktop/tags/settings.tag
+++ b/src/web/app/desktop/tags/settings.tag
@@ -212,31 +212,31 @@
@update-avatar this.I
this.update-account = () => {
- this.api 'i/update' do
+ this.api('i/update', {
name: this.refs.account-name.value
location: this.refs.account-location.value
bio: this.refs.account-bio.value
birthday: this.refs.account-birthday.value
- .then (i) =>
+ }).then((i) => {
alert 'ok'
.catch (err) =>
console.error err
this.update-cache = () => {
this.I.data.cache = !this.I.data.cache
- this.api 'i/appdata/set' do
+ this.api('i/appdata/set', {
data: JSON.stringify do
cache: this.I.data.cache
this.update-debug = () => {
this.I.data.debug = !this.I.data.debug
- this.api 'i/appdata/set' do
+ this.api('i/appdata/set', {
data: JSON.stringify do
debug: this.I.data.debug
this.update-nya = () => {
this.I.data.nya = !this.I.data.nya
- this.api 'i/appdata/set' do
+ this.api('i/appdata/set', {
data: JSON.stringify do
nya: this.I.data.nya
diff --git a/src/web/app/desktop/tags/timeline-post.tag b/src/web/app/desktop/tags/timeline-post.tag
index 0d572981cb..5b656f812d 100644
--- a/src/web/app/desktop/tags/timeline-post.tag
+++ b/src/web/app/desktop/tags/timeline-post.tag
@@ -55,8 +55,13 @@
-
-
+
+
@@ -328,46 +333,45 @@
this.isDetailOpened = false;
this.on('mount', () => {
- if this.p.text?
- tokens = if this.p._highlight?
- then @analyze this.p._highlight
- else @analyze this.p.text
+ if (this.p.text) {
+ const tokens = this.analyze(this.p.text);
- this.refs.text.innerHTML = this.refs.text.innerHTML.replace '
' if this.p._highlight?
- then @compile tokens, true, false
- else @compile tokens
+ this.refs.text.innerHTML = this.refs.text.innerHTML.replace('', this.compile(tokens));
- this.refs.text.children.forEach (e) =>
- if e.tag-name == 'MK-URL'
- riot.mount e
+ this.refs.text.children.forEach(e => {
+ if (e.tagName == 'MK-URL') riot.mount(e);
+ });
// URLをプレビュー
tokens
- .filter (t) -> t.type == 'link'
- .map (t) =>
- this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
- riot.mount this.preview, do
- url: t.content
+ .filter(t => t.type == 'link')
+ .map(t => {
+ riot.mount(this.refs.text.appendChild(document.createElement('mk-url-preview')), {
+ url: t.content
+ });
+ });
+ }
+ });
this.reply = () => {
- form = document.body.appendChild document.createElement 'mk-post-form-window'
- riot.mount form, do
+ form = document.body.appendChild(document.createElement('mk-post-form-window'));
+ riot.mount form, do
reply: this.p
this.repost = () => {
- form = document.body.appendChild document.createElement 'mk-repost-form-window'
- riot.mount form, do
+ form = document.body.appendChild(document.createElement('mk-repost-form-window'));
+ riot.mount form, do
post: this.p
this.like = () => {
if this.p.is_liked
- this.api 'posts/likes/delete' do
+ this.api('posts/likes/delete', {
post_id: this.p.id
.then =>
this.p.is_liked = false
this.update();
else
- this.api 'posts/likes/create' do
+ this.api('posts/likes/create', {
post_id: this.p.id
.then =>
this.p.is_liked = true
diff --git a/src/web/app/desktop/tags/ui-header-account.tag b/src/web/app/desktop/tags/ui-header-account.tag
index 21382bc532..334b69e210 100644
--- a/src/web/app/desktop/tags/ui-header-account.tag
+++ b/src/web/app/desktop/tags/ui-header-account.tag
@@ -165,11 +165,11 @@
this.is-open = false
this.on('before-unmount', () => {
- @close!
+ @close();
this.toggle = () => {
if @is-open
- @close!
+ @close();
else
@open!
@@ -190,17 +190,17 @@
this.mousedown = (e) => {
e.preventDefault();
if (!contains this.root, e.target) and (this.root != e.target)
- @close!
+ @close();
return false
this.drive = () => {
- @close!
- riot.mount document.body.appendChild document.createElement 'mk-drive-browser-window'
-
+ @close();
+ riot.mount document.body.appendChild(document.createElement('mk-drive-browser-window'));
+
this.settings = () => {
- @close!
- riot.mount document.body.appendChild document.createElement 'mk-settings-window'
-
+ @close();
+ riot.mount document.body.appendChild(document.createElement('mk-settings-window'));
+
function contains(parent, child)
node = child.parentNode
while node?
diff --git a/src/web/app/desktop/tags/ui-header-nav.tag b/src/web/app/desktop/tags/ui-header-nav.tag
index a884aa0b28..93819963e6 100644
--- a/src/web/app/desktop/tags/ui-header-nav.tag
+++ b/src/web/app/desktop/tags/ui-header-nav.tag
@@ -89,7 +89,7 @@
// Fetch count of unread messaging messages
this.api 'messaging/unread'
- .then (count) =>
+ }).then((count) => {
if count.count > 0
this.has-unread-messaging-messages = true
this.update();
@@ -107,7 +107,7 @@
this.update();
this.messaging = () => {
- riot.mount document.body.appendChild document.createElement 'mk-messaging-window'
-
+ riot.mount document.body.appendChild(document.createElement('mk-messaging-window'));
+
diff --git a/src/web/app/desktop/tags/ui-header-notifications.tag b/src/web/app/desktop/tags/ui-header-notifications.tag
index fac90bb83c..31dc45d0de 100644
--- a/src/web/app/desktop/tags/ui-header-notifications.tag
+++ b/src/web/app/desktop/tags/ui-header-notifications.tag
@@ -79,7 +79,7 @@
this.toggle = () => {
if @is-open
- @close!
+ @close();
else
@open!
@@ -100,7 +100,7 @@
this.mousedown = (e) => {
e.preventDefault();
if (!contains this.root, e.target) and (this.root != e.target)
- @close!
+ @close();
return false
function contains(parent, child)
diff --git a/src/web/app/desktop/tags/ui-header-post-button.tag b/src/web/app/desktop/tags/ui-header-post-button.tag
index 3f339beb63..ca380b06ea 100644
--- a/src/web/app/desktop/tags/ui-header-post-button.tag
+++ b/src/web/app/desktop/tags/ui-header-post-button.tag
@@ -35,7 +35,8 @@
diff --git a/src/web/app/desktop/tags/ui-header.tag b/src/web/app/desktop/tags/ui-header.tag
index 9dd1ace6b9..4ab1789309 100644
--- a/src/web/app/desktop/tags/ui-header.tag
+++ b/src/web/app/desktop/tags/ui-header.tag
@@ -80,6 +80,5 @@
display none
-
diff --git a/src/web/app/desktop/tags/user-friends-graph.tag b/src/web/app/desktop/tags/user-friends-graph.tag
index 76827fbdaa..8932d596fc 100644
--- a/src/web/app/desktop/tags/user-friends-graph.tag
+++ b/src/web/app/desktop/tags/user-friends-graph.tag
@@ -19,16 +19,16 @@
this.user = user
this.update();
- this.api 'aggregation/users/followers' do
+ this.api('aggregation/users/followers', {
user_id: this.user.id
limit: 30days
- .then (followers) =>
+ }).then((followers) => {
followers = followers.reverse!
- this.api 'aggregation/users/following' do
+ this.api('aggregation/users/following', {
user_id: this.user.id
limit: 30days
- .then (following) =>
+ }).then((following) => {
following = following.reverse!
new Chart this.refs.canv, do
diff --git a/src/web/app/desktop/tags/user-likes-graph.tag b/src/web/app/desktop/tags/user-likes-graph.tag
index 6030efdafa..5639ee36e4 100644
--- a/src/web/app/desktop/tags/user-likes-graph.tag
+++ b/src/web/app/desktop/tags/user-likes-graph.tag
@@ -19,10 +19,10 @@
this.user = user
this.update();
- this.api 'aggregation/users/like' do
+ this.api('aggregation/users/like', {
user_id: this.user.id
limit: 30days
- .then (likes) =>
+ }).then((likes) => {
likes = likes.reverse!
new Chart this.refs.canv, do
diff --git a/src/web/app/desktop/tags/user-photos.tag b/src/web/app/desktop/tags/user-photos.tag
index 58ba1b73dd..9cde9b8c4c 100644
--- a/src/web/app/desktop/tags/user-photos.tag
+++ b/src/web/app/desktop/tags/user-photos.tag
@@ -67,15 +67,15 @@
this.user-promise = if @is-promise this.opts.user then this.opts.user else Promise.resolve this.opts.user
this.on('mount', () => {
- this.user-promise.then (user) =>
+ this.user-promise}).then((user) => {
this.user = user
this.update();
- this.api 'users/posts' do
+ this.api('users/posts', {
user_id: this.user.id
with_media: true
limit: 9posts
- .then (posts) =>
+ }).then((posts) => {
this.initializing = false
posts.forEach (post) =>
post.media.forEach (image) =>
diff --git a/src/web/app/desktop/tags/user-posts-graph.tag b/src/web/app/desktop/tags/user-posts-graph.tag
index 0be3abb4e4..d1760c6b37 100644
--- a/src/web/app/desktop/tags/user-posts-graph.tag
+++ b/src/web/app/desktop/tags/user-posts-graph.tag
@@ -19,10 +19,10 @@
this.user = user
this.update();
- this.api 'aggregation/users/post' do
+ this.api('aggregation/users/post', {
user_id: this.user.id
limit: 30days
- .then (data) =>
+ }).then((data) => {
data = data.reverse!
new Chart this.refs.canv, do
type: 'line'
diff --git a/src/web/app/desktop/tags/user-preview.tag b/src/web/app/desktop/tags/user-preview.tag
index 6d4f0b2b04..8dd6551c41 100644
--- a/src/web/app/desktop/tags/user-preview.tag
+++ b/src/web/app/desktop/tags/user-preview.tag
@@ -105,16 +105,16 @@
this.user-promise =
if typeof @u == 'string'
new Promise (resolve, reject) =>
- this.api 'users/show' do
+ this.api('users/show', {
user_id: if @u.0 == '@' then undefined else @u
username: if @u.0 == '@' then @u.substr 1 else undefined
- .then (user) =>
+ }).then((user) => {
resolve user
else
Promise.resolve @u
this.on('mount', () => {
- this.user-promise.then (user) =>
+ this.user-promise}).then((user) => {
this.user = user
this.update();
diff --git a/src/web/app/desktop/tags/user-profile.tag b/src/web/app/desktop/tags/user-profile.tag
index 8df631ade0..36c9f7f950 100644
--- a/src/web/app/desktop/tags/user-profile.tag
+++ b/src/web/app/desktop/tags/user-profile.tag
@@ -87,13 +87,13 @@
this.user = this.opts.user
this.show-following = () => {
- window = document.body.appendChild document.createElement 'mk-user-following-window'
- riot.mount window, do
+ window = document.body.appendChild(document.createElement('mk-user-following-window'));
+ riot.mount window, do
user: this.user
this.show-followers = () => {
- window = document.body.appendChild document.createElement 'mk-user-followers-window'
- riot.mount window, do
+ window = document.body.appendChild(document.createElement('mk-user-followers-window'));
+ riot.mount window, do
user: this.user
diff --git a/src/web/app/desktop/tags/user-timeline.tag b/src/web/app/desktop/tags/user-timeline.tag
index 405097e061..acced7fc3d 100644
--- a/src/web/app/desktop/tags/user-timeline.tag
+++ b/src/web/app/desktop/tags/user-timeline.tag
@@ -63,7 +63,7 @@
document.addEventListener 'keydown' this.on-document-keydown
window.addEventListener 'scroll' this.on-scroll
- this.user-promise.then (user) =>
+ this.user-promise}).then((user) => {
this.user = user
this.update();
@@ -82,10 +82,10 @@
this.refs.timeline.focus();
this.fetch = (cb) => {
- this.api 'users/posts' do
+ this.api('users/posts', {
user_id: this.user.id
with_replies: this.mode == 'with-replies'
- .then (posts) =>
+ }).then((posts) => {
this.is-loading = false
this.is-empty = posts.length == 0
this.update();
@@ -100,11 +100,11 @@
return
this.more-loading = true
this.update();
- this.api 'users/posts' do
+ this.api('users/posts', {
user_id: this.user.id
with_replies: this.mode == 'with-replies'
max_id: this.refs.timeline.tail!.id
- .then (posts) =>
+ }).then((posts) => {
this.more-loading = false
this.update();
this.refs.timeline.prepend-posts posts
diff --git a/src/web/app/desktop/tags/user.tag b/src/web/app/desktop/tags/user.tag
index a088d97db7..9b64cf08ea 100644
--- a/src/web/app/desktop/tags/user.tag
+++ b/src/web/app/desktop/tags/user.tag
@@ -40,9 +40,9 @@
this.user = null
this.on('mount', () => {
- this.api 'users/show' do
+ this.api('users/show', {
username: this.username
- .then (user) =>
+ }).then((user) => {
this.fetching = false
this.user = user
this.update();
diff --git a/src/web/app/desktop/tags/window.tag b/src/web/app/desktop/tags/window.tag
index f83ccf3f8b..33bb244fa7 100644
--- a/src/web/app/desktop/tags/window.tag
+++ b/src/web/app/desktop/tags/window.tag
@@ -320,7 +320,7 @@
this.bg-click = () => {
if @can-close
- @close!
+ @close();
this.on-body-mousedown = (e) => {
@top!
@@ -506,7 +506,7 @@
if @can-close
e.preventDefault();
e.stopPropagation();
- @close!
+ @close();
function contains(parent, child)
node = child.parentNode
diff --git a/src/web/app/dev/tags/new-app-form.tag b/src/web/app/dev/tags/new-app-form.tag
index d0906d6381..6be1c54487 100644
--- a/src/web/app/dev/tags/new-app-form.tag
+++ b/src/web/app/dev/tags/new-app-form.tag
@@ -203,9 +203,9 @@
this.nid-state = 'wait'
this.update();
- this.api 'app/name_id/available' do
+ this.api('app/name_id/available', {
name_id: nid
- .then (result) =>
+ }).then((result) => {
if result.available
this.nid-state = 'ok'
else
@@ -225,9 +225,9 @@
this.refs.permission.query-selector-all 'input' .forEach (el) =>
if el.checked then permission.push el.value
- locker = document.body.appendChild document.createElement 'mk-locker'
-
- this.api 'app/create' do
+ locker = document.body.appendChild(document.createElement('mk-locker'));
+
+ this.api('app/create', {
name: name
name_id: nid
description: description
diff --git a/src/web/app/dev/tags/pages/app.tag b/src/web/app/dev/tags/pages/app.tag
index 3512dd7477..e6cadab1bc 100644
--- a/src/web/app/dev/tags/pages/app.tag
+++ b/src/web/app/dev/tags/pages/app.tag
@@ -20,9 +20,9 @@
this.fetching = true
this.on('mount', () => {
- this.api 'app/show' do
+ this.api('app/show', {
app_id: this.opts.app
- .then (app) =>
+ }).then((app) => {
this.app = app
this.fetching = false
this.update();
diff --git a/src/web/app/dev/tags/pages/apps.tag b/src/web/app/dev/tags/pages/apps.tag
index 58e09e24e0..c87141711f 100644
--- a/src/web/app/dev/tags/pages/apps.tag
+++ b/src/web/app/dev/tags/pages/apps.tag
@@ -22,7 +22,7 @@
this.on('mount', () => {
this.api 'my/apps'
- .then (apps) =>
+ }).then((apps) => {
this.fetching = false
this.apps = apps
this.update();
diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag
index d0c9b87b99..8d4383f6ef 100644
--- a/src/web/app/mobile/tags/drive.tag
+++ b/src/web/app/mobile/tags/drive.tag
@@ -206,9 +206,9 @@
this.loading = true
this.update();
- this.api 'drive/folders/show' do
+ this.api('drive/folders/show', {
folder_id: target-folder
- .then (folder) =>
+ }).then((folder) => {
this.folder = folder
this.hierarchyFolders = []
@@ -297,10 +297,10 @@
files-max = 20
// フォルダ一覧取得
- this.api 'drive/folders' do
+ this.api('drive/folders', {
folder_id: if this.folder? then this.folder.id else null
limit: folders-max + 1
- .then (folders) =>
+ }).then((folders) => {
if folders.length == folders-max + 1
this.more-folders = true
folders.pop!
@@ -310,10 +310,10 @@
console.error err
// ファイル一覧取得
- this.api 'drive/files' do
+ this.api('drive/files', {
folder_id: if this.folder? then this.folder.id else null
limit: files-max + 1
- .then (files) =>
+ }).then((files) => {
if files.length == files-max + 1
this.more-files = true
files.pop!
@@ -356,9 +356,9 @@
this.loading = true
this.update();
- this.api 'drive/files/show' do
+ this.api('drive/files/show', {
file_id: file
- .then (file) =>
+ }).then((file) => {
this.file = file
this.folder = null
this.hierarchyFolders = []
diff --git a/src/web/app/mobile/tags/drive/file-viewer.tag b/src/web/app/mobile/tags/drive/file-viewer.tag
index 5f1380ae80..5f2c5f61fb 100644
--- a/src/web/app/mobile/tags/drive/file-viewer.tag
+++ b/src/web/app/mobile/tags/drive/file-viewer.tag
@@ -191,7 +191,7 @@
this.rename = () => {
name = window.prompt '名前を変更' this.file.name
if name? and name != '' and name != this.file.name
- this.api 'drive/files/update' do
+ this.api('drive/files/update', {
file_id: this.file.id
name: name
.then =>
diff --git a/src/web/app/mobile/tags/follow-button.tag b/src/web/app/mobile/tags/follow-button.tag
index ff4c6586d0..ecd0dc594d 100644
--- a/src/web/app/mobile/tags/follow-button.tag
+++ b/src/web/app/mobile/tags/follow-button.tag
@@ -58,7 +58,7 @@
this.wait = false
this.on('mount', () => {
- this.user-promise.then (user) =>
+ this.user-promise}).then((user) => {
this.user = user
this.init = false
this.update();
@@ -82,7 +82,7 @@
this.onclick = () => {
this.wait = true
if this.user.is_following
- this.api 'following/delete' do
+ this.api('following/delete', {
user_id: this.user.id
.then =>
this.user.is_following = false
@@ -92,7 +92,7 @@
this.wait = false
this.update();
else
- this.api 'following/create' do
+ this.api('following/create', {
user_id: this.user.id
.then =>
this.user.is_following = true
diff --git a/src/web/app/mobile/tags/home-timeline.tag b/src/web/app/mobile/tags/home-timeline.tag
index b308c4168c..0d617c841b 100644
--- a/src/web/app/mobile/tags/home-timeline.tag
+++ b/src/web/app/mobile/tags/home-timeline.tag
@@ -11,7 +11,7 @@
this.init = new Promise (res, rej) =>
this.api 'posts/timeline'
- .then (posts) =>
+ }).then((posts) => {
res posts
this.trigger('loaded');
@@ -26,7 +26,7 @@
this.stream.off 'unfollow' this.on-stream-unfollow
this.more = () => {
- this.api 'posts/timeline' do
+ this.api('posts/timeline', {
max_id: this.refs.timeline.tail!.id
this.on-stream-post = (post) => {
diff --git a/src/web/app/mobile/tags/notifications.tag b/src/web/app/mobile/tags/notifications.tag
index ef53c025e3..9fb695a434 100644
--- a/src/web/app/mobile/tags/notifications.tag
+++ b/src/web/app/mobile/tags/notifications.tag
@@ -66,7 +66,7 @@
this.on('mount', () => {
this.api 'i/notifications'
- .then (notifications) =>
+ }).then((notifications) => {
this.notifications = notifications
this.loading = false
this.update();
diff --git a/src/web/app/mobile/tags/page/messaging-room.tag b/src/web/app/mobile/tags/page/messaging-room.tag
index 6b699143ce..934a7f8771 100644
--- a/src/web/app/mobile/tags/page/messaging-room.tag
+++ b/src/web/app/mobile/tags/page/messaging-room.tag
@@ -13,9 +13,9 @@
this.fetching = true
this.on('mount', () => {
- this.api 'users/show' do
+ this.api('users/show', {
username: this.opts.username
- .then (user) =>
+ }).then(user => {
this.fetching = false
this.user = user
this.update();
diff --git a/src/web/app/mobile/tags/page/user-followers.tag b/src/web/app/mobile/tags/page/user-followers.tag
index 12338e7967..75a2c5d279 100644
--- a/src/web/app/mobile/tags/page/user-followers.tag
+++ b/src/web/app/mobile/tags/page/user-followers.tag
@@ -18,9 +18,9 @@
this.on('mount', () => {
this.Progress.start();
- this.api 'users/show' do
+ this.api('users/show', {
username: this.opts.user
- .then (user) =>
+ }).then(user => {
this.user = user
this.fetching = false
diff --git a/src/web/app/mobile/tags/page/user-following.tag b/src/web/app/mobile/tags/page/user-following.tag
index 088c458328..44a054e822 100644
--- a/src/web/app/mobile/tags/page/user-following.tag
+++ b/src/web/app/mobile/tags/page/user-following.tag
@@ -18,9 +18,9 @@
this.on('mount', () => {
this.Progress.start();
- this.api 'users/show' do
+ this.api('users/show', {
username: this.opts.user
- .then (user) =>
+ }).then(user => {
this.user = user
this.fetching = false
diff --git a/src/web/app/mobile/tags/post-detail.tag b/src/web/app/mobile/tags/post-detail.tag
index fee132d7df..61983a1592 100644
--- a/src/web/app/mobile/tags/post-detail.tag
+++ b/src/web/app/mobile/tags/post-detail.tag
@@ -334,15 +334,15 @@
this.mixin('get-post-summary');
this.mixin('open-post-form');
- this.fetching = true
- this.loading-context = false
- this.content = null
- this.post = null
+ this.fetching = true;
+ this.loadingContext = false;
+ this.content = null;
+ this.post = null;
this.on('mount', () => {
- this.api 'posts/show' do
+ this.api('posts/show', {
post_id: this.opts.post
- .then (post) =>
+ }).then((post) => {
this.post = post
this.is-repost = this.post.repost?
this.p = if @is-repost then this.post.repost else this.post
@@ -363,54 +363,54 @@
tokens
.filter (t) -> t.type == 'link'
.map (t) =>
- this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
- riot.mount this.preview, do
+ this.preview = this.refs.text.appendChild(document.createElement('mk-url-preview'));
+ riot.mount this.preview, do
url: t.content
// Get likes
- this.api 'posts/likes' do
+ this.api('posts/likes', {
post_id: this.p.id
limit: 8
- .then (likes) =>
+ }).then((likes) => {
this.likes = likes
this.update();
// Get reposts
- this.api 'posts/reposts' do
+ this.api('posts/reposts', {
post_id: this.p.id
limit: 8
- .then (reposts) =>
+ }).then((reposts) => {
this.reposts = reposts
this.update();
// Get replies
- this.api 'posts/replies' do
+ this.api('posts/replies', {
post_id: this.p.id
limit: 8
- .then (replies) =>
+ }).then((replies) => {
this.replies = replies
this.update();
this.reply = () => {
- @open-post-form do
+ this.openPostForm do
reply: this.p
this.repost = () => {
text = window.prompt '「' + @summary + '」をRepost'
if text?
- this.api 'posts/create' do
+ this.api('posts/create', {
repost_id: this.p.id
text: if text == '' then undefined else text
this.like = () => {
if this.p.is_liked
- this.api 'posts/likes/delete' do
+ this.api('posts/likes/delete', {
post_id: this.p.id
.then =>
this.p.is_liked = false
this.update();
else
- this.api 'posts/likes/create' do
+ this.api('posts/likes/create', {
post_id: this.p.id
.then =>
this.p.is_liked = true
@@ -420,9 +420,9 @@
this.loading-context = true
// Get context
- this.api 'posts/context' do
+ this.api('posts/context', {
post_id: this.p.reply_to_id
- .then (context) =>
+ }).then((context) => {
this.context = context.reverse!
this.loading-context = false
this.update();
diff --git a/src/web/app/mobile/tags/post-form.tag b/src/web/app/mobile/tags/post-form.tag
index 05cb1c5657..43643f88c6 100644
--- a/src/web/app/mobile/tags/post-form.tag
+++ b/src/web/app/mobile/tags/post-form.tag
@@ -220,8 +220,8 @@
this.refs.file.click();
this.select-file-from-drive = () => {
- browser = document.body.appendChild document.createElement 'mk-drive-selector'
- browser = riot.mount browser, do
+ browser = document.body.appendChild(document.createElement('mk-drive-selector'));
+ browser = riot.mount browser, do
multiple: true
.0
browser.on('selected', (files) => {
@@ -260,12 +260,12 @@
then this.files.map (f) -> f.id
else undefined
- this.api 'posts/create' do
+ this.api('posts/create', {
text: this.refs.text.value
media_ids: files
reply_to_id: if this.opts.reply? then this.opts.reply.id else undefined
poll: if this.poll then this.refs.poll.get! else undefined
- .then (data) =>
+ }).then((data) => {
this.trigger('post');
this.unmount();
.catch (err) =>
diff --git a/src/web/app/mobile/tags/search-posts.tag b/src/web/app/mobile/tags/search-posts.tag
index caa0af4be3..83c4b9cfb4 100644
--- a/src/web/app/mobile/tags/search-posts.tag
+++ b/src/web/app/mobile/tags/search-posts.tag
@@ -16,15 +16,15 @@
this.with-media = this.opts.with-media
this.init = new Promise (res, rej) =>
- this.api 'posts/search' do
+ this.api('posts/search', {
query: @query
- .then (posts) =>
+ }).then((posts) => {
res posts
this.trigger('loaded');
this.more = () => {
@offset += @max
- this.api 'posts/search' do
+ this.api('posts/search', {
query: @query
max: @max
offset: @offset
diff --git a/src/web/app/mobile/tags/timeline-post.tag b/src/web/app/mobile/tags/timeline-post.tag
index 2d6a6a1fa4..a19fca7fcd 100644
--- a/src/web/app/mobile/tags/timeline-post.tag
+++ b/src/web/app/mobile/tags/timeline-post.tag
@@ -3,10 +3,19 @@
-
+
+
+
+
{ p.user.name }
@@ -289,59 +298,67 @@
this.mixin('api');
this.mixin('text');
this.mixin('get-post-summary');
- this.mixin('open-post-form');
+ this.mixin('openPostForm');
- this.post = this.opts.post
- this.is-repost = this.post.repost? and !this.post.text?
- this.p = if @is-repost then this.post.repost else this.post
- this.summary = @get-post-summary this.p
+ this.post = this.opts.post;
+ this.isRepost = this.post.repost != null && this.post.text == null;
+ this.p = this.isRepost ? this.post.repost : this.post;
+ this.summary = this.getPostSummary(this.p);
this.url = CONFIG.url + '/' + this.p.user.username + '/' + this.p.id
this.on('mount', () => {
- if this.p.text?
- tokens = if this.p._highlight?
- then @analyze this.p._highlight
- else @analyze this.p.text
+ if (this.p.text) {
+ const tokens = this.analyze(this.p.text);
- this.refs.text.innerHTML = this.refs.text.innerHTML.replace '' if this.p._highlight?
- then @compile tokens, true, false
- else @compile tokens
+ this.refs.text.innerHTML = this.refs.text.innerHTML.replace('', this.compile(tokens));
- this.refs.text.children.forEach (e) =>
- if e.tag-name == 'MK-URL'
- riot.mount e
+ this.refs.text.children.forEach(e => {
+ if (e.tagName == 'MK-URL') riot.mount(e);
+ });
// URLをプレビュー
tokens
- .filter (t) -> t.type == 'link'
- .map (t) =>
- this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
- riot.mount this.preview, do
- url: t.content
+ .filter(t => t.type == 'link')
+ .map(t => {
+ riot.mount(this.refs.text.appendChild(document.createElement('mk-url-preview')), {
+ url: t.content
+ });
+ });
+ }
+ });
this.reply = () => {
- @open-post-form do
+ this.openPostForm({
reply: this.p
+ });
+ };
this.repost = () => {
- text = window.prompt '「' + @summary + '」をRepost'
- if text?
- this.api 'posts/create' do
- repost_id: this.p.id
- text: if text == '' then undefined else text
+ const text = window.prompt(`「${this.summary}」をRepost`);
+ if (text) {
+ this.api('posts/create', {
+ repost_id: this.p.id,
+ text: text == '' ? undefined : text
+ });
+ }
+ };
this.like = () => {
- if this.p.is_liked
- this.api 'posts/likes/delete' do
+ if (this.p.is_liked)
+ this.api('posts/likes/delete', {
post_id: this.p.id
- .then =>
- this.p.is_liked = false
+ }).then(() => {
+ this.p.is_liked = false;
this.update();
- else
- this.api 'posts/likes/create' do
+ });
+ } else {
+ this.api('posts/likes/create', {
post_id: this.p.id
- .then =>
- this.p.is_liked = true
+ }).then(() => {
+ this.p.is_liked = true;
this.update();
+ });
+ }
+ };
diff --git a/src/web/app/mobile/tags/timeline.tag b/src/web/app/mobile/tags/timeline.tag
index 3887045e84..06571e40e5 100644
--- a/src/web/app/mobile/tags/timeline.tag
+++ b/src/web/app/mobile/tags/timeline.tag
@@ -80,7 +80,7 @@
this.can-fetch-more = true
this.on('mount', () => {
- this.opts.init.then (posts) =>
+ this.opts.init}).then((posts) => {
this.init = false
@set-posts posts
@@ -95,7 +95,7 @@
if @init or @fetching or this.posts.length == 0 then return
this.fetching = true
this.update();
- this.opts.more!.then (posts) =>
+ this.opts.more!}).then((posts) => {
this.fetching = false
this.prepend-posts posts
diff --git a/src/web/app/mobile/tags/ui-header.tag b/src/web/app/mobile/tags/ui-header.tag
index 6a7ec8ec54..5cf2560d54 100644
--- a/src/web/app/mobile/tags/ui-header.tag
+++ b/src/web/app/mobile/tags/ui-header.tag
@@ -89,7 +89,7 @@
diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag
index 348c88b77a..ca6ac3f55c 100644
--- a/src/web/app/mobile/tags/ui.tag
+++ b/src/web/app/mobile/tags/ui.tag
@@ -44,8 +44,8 @@
this.refs.nav.root.style.display = if @is-drawer-opening then 'block' else 'none'
this.on-stream-notification = (notification) => {
- el = document.body.appendChild document.createElement 'mk-notify'
- riot.mount el, do
+ el = document.body.appendChild(document.createElement('mk-notify'));
+ riot.mount el, do
notification: notification
diff --git a/src/web/app/mobile/tags/user-followers.tag b/src/web/app/mobile/tags/user-followers.tag
index cdde081dc7..eecf09cab8 100644
--- a/src/web/app/mobile/tags/user-followers.tag
+++ b/src/web/app/mobile/tags/user-followers.tag
@@ -11,7 +11,7 @@
this.user = this.opts.user
this.fetch = (iknow, limit, cursor, cb) => {
- this.api 'users/followers' do
+ this.api('users/followers', {
user_id: this.user.id
iknow: iknow
limit: limit
diff --git a/src/web/app/mobile/tags/user-following.tag b/src/web/app/mobile/tags/user-following.tag
index 37ee0ee390..b214789aa9 100644
--- a/src/web/app/mobile/tags/user-following.tag
+++ b/src/web/app/mobile/tags/user-following.tag
@@ -11,7 +11,7 @@
this.user = this.opts.user
this.fetch = (iknow, limit, cursor, cb) => {
- this.api 'users/following' do
+ this.api('users/following', {
user_id: this.user.id
iknow: iknow
limit: limit
diff --git a/src/web/app/mobile/tags/user-timeline.tag b/src/web/app/mobile/tags/user-timeline.tag
index 80311924fa..2d3716b848 100644
--- a/src/web/app/mobile/tags/user-timeline.tag
+++ b/src/web/app/mobile/tags/user-timeline.tag
@@ -15,15 +15,15 @@
this.with-media = this.opts.with-media
this.init = new Promise (res, rej) =>
- this.api 'users/posts' do
+ this.api('users/posts', {
user_id: this.user.id
with_media: @with-media
- .then (posts) =>
+ }).then((posts) => {
res posts
this.trigger('loaded');
this.more = () => {
- this.api 'users/posts' do
+ this.api('users/posts', {
user_id: this.user.id
with_media: @with-media
max_id: this.refs.timeline.tail!.id
diff --git a/src/web/app/mobile/tags/user.tag b/src/web/app/mobile/tags/user.tag
index 660b08879d..9d95e99144 100644
--- a/src/web/app/mobile/tags/user.tag
+++ b/src/web/app/mobile/tags/user.tag
@@ -3,20 +3,43 @@
-
+
-
{ user.name }
@{ user.username }フォローされています
+ { user.name }
+ @{ user.username }
+ フォローされています
{ user.bio }
-
{ user.location }
-
{ user.birthday.replace('-', '年').replace('-', '月') + '日' } ({ age(user.birthday) }歳)
+
+ { user.location }
+
+
+ { user.birthday.replace('-', '年').replace('-', '月') + '日' } ({ age(user.birthday) }歳)
+
+
+
-
-
+
@@ -154,38 +177,30 @@