summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-01-21 21:08:40 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-01-21 21:08:40 +0900
commit5da436a285b37af7a7bd34a5230f1e5e579f8a46 (patch)
tree0877353361f3b6b5320f4ca54bc273d63dd3964e /src/web
parent[API] Implement disconnect/twitter (diff)
downloadsharkey-5da436a285b37af7a7bd34a5230f1e5e579f8a46.tar.gz
sharkey-5da436a285b37af7a7bd34a5230f1e5e579f8a46.tar.bz2
sharkey-5da436a285b37af7a7bd34a5230f1e5e579f8a46.zip
なんかもうめっちゃ変えた
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/boot.js5
-rw-r--r--src/web/app/common/scripts/i.ls7
-rw-r--r--src/web/app/common/scripts/stream.ls4
-rw-r--r--src/web/app/desktop/tags/donation.tag3
-rw-r--r--src/web/app/desktop/tags/drive/file-contextmenu.tag12
-rw-r--r--src/web/app/desktop/tags/home-widgets/profile.tag6
-rw-r--r--src/web/app/desktop/tags/set-avatar-suggestion.tag3
-rw-r--r--src/web/app/desktop/tags/set-banner-suggestion.tag3
-rw-r--r--src/web/app/desktop/tags/settings.tag13
9 files changed, 16 insertions, 40 deletions
diff --git a/src/web/app/boot.js b/src/web/app/boot.js
index 5f4dc79af8..14cec68704 100644
--- a/src/web/app/boot.js
+++ b/src/web/app/boot.js
@@ -67,6 +67,11 @@ module.exports = callback => {
if (me != null) {
riot.observable(me);
+ me.update = data => {
+ if (data) Object.assign(me, data);
+ me.trigger('updated');
+ };
+
if (me.data.cache) {
localStorage.setItem('me', JSON.stringify(me));
diff --git a/src/web/app/common/scripts/i.ls b/src/web/app/common/scripts/i.ls
index 888ef194d0..e05a7459ff 100644
--- a/src/web/app/common/scripts/i.ls
+++ b/src/web/app/common/scripts/i.ls
@@ -9,10 +9,3 @@ module.exports = (me) ->
if @SIGNIN
@on \mount ~> me.on \updated @update
@on \unmount ~> me.off \updated @update
-
- update-i: (data) ->
- if data?
- Object.assign me, data
- me.trigger \updated
-
- me: me
diff --git a/src/web/app/common/scripts/stream.ls b/src/web/app/common/scripts/stream.ls
index 64ae03817a..c2c061603e 100644
--- a/src/web/app/common/scripts/stream.ls
+++ b/src/web/app/common/scripts/stream.ls
@@ -30,9 +30,7 @@ module.exports = (me) ~>
get-state = ~> state
- event.on \i_updated (data) ~>
- Object.assign me, data
- me.trigger \updated
+ event.on \i_updated me.update
{
state-ev
diff --git a/src/web/app/desktop/tags/donation.tag b/src/web/app/desktop/tags/donation.tag
index cd80e53572..c9d88b85b0 100644
--- a/src/web/app/desktop/tags/donation.tag
+++ b/src/web/app/desktop/tags/donation.tag
@@ -55,11 +55,10 @@
e.stop-propagation!
@I.data.no_donation = true
+ @I.update!
@api \i/appdata/set do
data: JSON.stringify do
no_donation: @I.data.no_donation
- .then ~>
- @update-i!
@unmount!
diff --git a/src/web/app/desktop/tags/drive/file-contextmenu.tag b/src/web/app/desktop/tags/drive/file-contextmenu.tag
index 400fd7b015..a2c9eb3f4e 100644
--- a/src/web/app/desktop/tags/drive/file-contextmenu.tag
+++ b/src/web/app/desktop/tags/drive/file-contextmenu.tag
@@ -81,21 +81,15 @@
@set-avatar = ~>
@refs.ctx.close!
- @update-avatar @I, (i) ~>
- @update-i i
- , @file
+ @update-avatar @I, null, @file
@set-banner = ~>
@refs.ctx.close!
- @update-banner @I, (i) ~>
- @update-i i
- , @file
+ @update-banner @I, null, @file
@set-wallpaper = ~>
@refs.ctx.close!
- @update-wallpaper @I, (i) ~>
- @update-i i
- , @file
+ @update-wallpaper @I, null, @file
@add-app = ~>
@NotImplementedException!
diff --git a/src/web/app/desktop/tags/home-widgets/profile.tag b/src/web/app/desktop/tags/home-widgets/profile.tag
index ddf1eae523..19b0fad056 100644
--- a/src/web/app/desktop/tags/home-widgets/profile.tag
+++ b/src/web/app/desktop/tags/home-widgets/profile.tag
@@ -46,11 +46,9 @@
@mixin \update-banner
@set-avatar = ~>
- @update-avatar @I, (i) ~>
- @update-i i
+ @update-avatar @I
@set-banner = ~>
- @update-banner @I, (i) ~>
- @update-i i
+ @update-banner @I
</script>
</mk-profile-home-widget>
diff --git a/src/web/app/desktop/tags/set-avatar-suggestion.tag b/src/web/app/desktop/tags/set-avatar-suggestion.tag
index 74462f9e9d..77cba97c33 100644
--- a/src/web/app/desktop/tags/set-avatar-suggestion.tag
+++ b/src/web/app/desktop/tags/set-avatar-suggestion.tag
@@ -35,8 +35,7 @@
@mixin \update-avatar
@set = ~>
- @update-avatar @I, (i) ~>
- @update-i i
+ @update-avatar @I
@close = (e) ~>
e.prevent-default!
diff --git a/src/web/app/desktop/tags/set-banner-suggestion.tag b/src/web/app/desktop/tags/set-banner-suggestion.tag
index 0b628e7610..0af7319f68 100644
--- a/src/web/app/desktop/tags/set-banner-suggestion.tag
+++ b/src/web/app/desktop/tags/set-banner-suggestion.tag
@@ -35,8 +35,7 @@
@mixin \update-banner
@set = ~>
- @update-banner @I, (i) ~>
- @update-i i
+ @update-banner @I
@close = (e) ~>
e.prevent-default!
diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag
index 0e0ebe7693..a9135dcd69 100644
--- a/src/web/app/desktop/tags/settings.tag
+++ b/src/web/app/desktop/tags/settings.tag
@@ -250,12 +250,10 @@
@page = page
@avatar = ~>
- @update-avatar @I, (i) ~>
- @update-i i
+ @update-avatar @I
@wallpaper = ~>
- @update-wallpaper @I, (i) ~>
- @update-i i
+ @update-wallpaper @I
@update-account = ~>
@api \i/update do
@@ -264,7 +262,6 @@
bio: @refs.account-bio.value
birthday: @refs.account-birthday.value
.then (i) ~>
- @update-i i
alert \ok
.catch (err) ~>
console.error err
@@ -274,23 +271,17 @@
@api \i/appdata/set do
data: JSON.stringify do
cache: @I.data.cache
- .then ~>
- @update-i!
@update-debug = ~>
@I.data.debug = !@I.data.debug
@api \i/appdata/set do
data: JSON.stringify do
debug: @I.data.debug
- .then ~>
- @update-i!
@update-nya = ~>
@I.data.nya = !@I.data.nya
@api \i/appdata/set do
data: JSON.stringify do
nya: @I.data.nya
- .then ~>
- @update-i!
</script>
</mk-settings>