summaryrefslogtreecommitdiff
path: root/src/client/app/mobile
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-22 17:04:52 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-22 17:04:52 +0900
commitd2d3a7d52b78b7d7d1da4380b062ac2279948cae (patch)
tree5e17286dfe020c58ff4b8bfcd7c91fd9a3bab2b5 /src/client/app/mobile
parent[wip] #1455 (diff)
downloadmisskey-d2d3a7d52b78b7d7d1da4380b062ac2279948cae.tar.gz
misskey-d2d3a7d52b78b7d7d1da4380b062ac2279948cae.tar.bz2
misskey-d2d3a7d52b78b7d7d1da4380b062ac2279948cae.zip
CW
Diffstat (limited to 'src/client/app/mobile')
-rw-r--r--src/client/app/mobile/views/components/note.vue240
-rw-r--r--src/client/app/mobile/views/components/post-form.vue33
2 files changed, 169 insertions, 104 deletions
diff --git a/src/client/app/mobile/views/components/note.vue b/src/client/app/mobile/views/components/note.vue
index 0967edeec0..ea4f9cb648 100644
--- a/src/client/app/mobile/views/components/note.vue
+++ b/src/client/app/mobile/views/components/note.vue
@@ -31,27 +31,33 @@
</header>
<div class="body">
<p class="channel" v-if="p.channel != null"><a target="_blank">{{ p.channel.title }}</a>:</p>
- <div class="text">
- <a class="reply" v-if="p.reply">
- %fa:reply%
- </a>
- <mk-note-html v-if="p.text" :text="p.text" :i="os.i" :class="$style.text"/>
- <a class="rp" v-if="p.renote != null">RP:</a>
+ <p v-if="p.cw != null" class="cw">
+ <span class="text" v-if="p.cw != ''">{{ p.cw }}</span>
+ <span class="toggle" @click="showContent = !showContent">{{ showContent ? '隠す' : 'もっと見る' }}</span>
+ </p>
+ <div class="content" v-show="p.cw == null || showContent">
+ <div class="text">
+ <a class="reply" v-if="p.reply">
+ %fa:reply%
+ </a>
+ <mk-note-html v-if="p.text" :text="p.text" :i="os.i" :class="$style.text"/>
+ <a class="rp" v-if="p.renote != null">RP:</a>
+ </div>
+ <div class="media" v-if="p.media.length > 0">
+ <mk-media-list :media-list="p.media"/>
+ </div>
+ <mk-poll v-if="p.poll" :note="p" ref="pollViewer"/>
+ <div class="tags" v-if="p.tags && p.tags.length > 0">
+ <router-link v-for="tag in p.tags" :key="tag" :to="`/search?q=#${tag}`">{{ tag }}</router-link>
+ </div>
+ <mk-url-preview v-for="url in urls" :url="url" :key="url"/>
+ <a class="location" v-if="p.geo" :href="`http://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% 位置情報</a>
+ <div class="map" v-if="p.geo" ref="map"></div>
+ <div class="renote" v-if="p.renote">
+ <mk-note-preview :note="p.renote"/>
+ </div>
</div>
- <div class="media" v-if="p.media.length > 0">
- <mk-media-list :media-list="p.media"/>
- </div>
- <mk-poll v-if="p.poll" :note="p" ref="pollViewer"/>
- <div class="tags" v-if="p.tags && p.tags.length > 0">
- <router-link v-for="tag in p.tags" :key="tag" :to="`/search?q=#${tag}`">{{ tag }}</router-link>
- </div>
- <mk-url-preview v-for="url in urls" :url="url" :key="url"/>
- <a class="location" v-if="p.geo" :href="`http://maps.google.com/maps?q=${p.geo.coordinates[1]},${p.geo.coordinates[0]}`" target="_blank">%fa:map-marker-alt% 位置情報</a>
- <div class="map" v-if="p.geo" ref="map"></div>
<span class="app" v-if="p.app">via <b>{{ p.app.name }}</b></span>
- <div class="renote" v-if="p.renote">
- <mk-note-preview :note="p.renote"/>
- </div>
</div>
<footer>
<mk-reactions-viewer :note="p" ref="reactionsViewer"/>
@@ -92,6 +98,7 @@ export default Vue.extend({
data() {
return {
+ showContent: false,
connection: null,
connectionId: null
};
@@ -229,7 +236,7 @@ export default Vue.extend({
<style lang="stylus" scoped>
@import '~const.styl'
-.note
+root(isDark)
font-size 12px
border-bottom solid 1px #eaeaea
@@ -388,113 +395,140 @@ export default Vue.extend({
> .body
- > .text
+ > .cw
+ cursor default
display block
margin 0
padding 0
overflow-wrap break-word
font-size 1.1em
- color #717171
+ color isDark ? #fff : #717171
- >>> .title
- display block
- margin-bottom 4px
- padding 4px
- font-size 90%
- text-align center
- background #eef1f3
- border-radius 4px
+ > .text
+ margin-right 8px
- >>> .code
- margin 8px 0
+ > .toggle
+ display inline-block
+ padding 4px 8px
+ font-size 0.7em
+ color isDark ? #393f4f : #fff
+ background isDark ? #687390 : #b1b9c1
+ border-radius 2px
+ cursor pointer
+ user-select none
- >>> .quote
- margin 8px
- padding 6px 12px
- color #aaa
- border-left solid 3px #eee
+ &:hover
+ background isDark ? #707b97 : #bbc4ce
- > .reply
- margin-right 8px
+ > .content
+
+ > .text
+ display block
+ margin 0
+ padding 0
+ overflow-wrap break-word
+ font-size 1.1em
color #717171
- > .rp
- margin-left 4px
- font-style oblique
- color #a0bf46
+ >>> .title
+ display block
+ margin-bottom 4px
+ padding 4px
+ font-size 90%
+ text-align center
+ background #eef1f3
+ border-radius 4px
- [data-is-me]:after
- content "you"
- padding 0 4px
- margin-left 4px
- font-size 80%
- color $theme-color-foreground
- background $theme-color
- border-radius 4px
+ >>> .code
+ margin 8px 0
- .mk-url-preview
- margin-top 8px
+ >>> .quote
+ margin 8px
+ padding 6px 12px
+ color #aaa
+ border-left solid 3px #eee
- > .channel
- margin 0
+ > .reply
+ margin-right 8px
+ color #717171
- > .tags
- margin 4px 0 0 0
+ > .rp
+ margin-left 4px
+ font-style oblique
+ color #a0bf46
- > *
- display inline-block
- margin 0 8px 0 0
- padding 2px 8px 2px 16px
- font-size 90%
- color #8d969e
- background #edf0f3
- border-radius 4px
+ [data-is-me]:after
+ content "you"
+ padding 0 4px
+ margin-left 4px
+ font-size 80%
+ color $theme-color-foreground
+ background $theme-color
+ border-radius 4px
+
+ .mk-url-preview
+ margin-top 8px
+
+ > .channel
+ margin 0
- &:before
- content ""
+ > .tags
+ margin 4px 0 0 0
+
+ > *
+ display inline-block
+ margin 0 8px 0 0
+ padding 2px 8px 2px 16px
+ font-size 90%
+ color #8d969e
+ background #edf0f3
+ border-radius 4px
+
+ &:before
+ content ""
+ display block
+ position absolute
+ top 0
+ bottom 0
+ left 4px
+ width 8px
+ height 8px
+ margin auto 0
+ background #fff
+ border-radius 100%
+
+ > .media
+ > img
display block
- position absolute
- top 0
- bottom 0
- left 4px
- width 8px
- height 8px
- margin auto 0
- background #fff
- border-radius 100%
+ max-width 100%
- > .media
- > img
- display block
- max-width 100%
+ > .location
+ margin 4px 0
+ font-size 12px
+ color #ccc
- > .location
- margin 4px 0
- font-size 12px
- color #ccc
+ > .map
+ width 100%
+ height 200px
+
+ &:empty
+ display none
- > .map
- width 100%
- height 200px
+ > .mk-poll
+ font-size 80%
+
+ > .renote
+ margin 8px 0
- &:empty
- display none
+ > .mk-note-preview
+ padding 16px
+ border dashed 1px #c0dac6
+ border-radius 8px
> .app
font-size 12px
color #ccc
- > .mk-poll
- font-size 80%
-
- > .renote
- margin 8px 0
-
- > .mk-note-preview
- padding 16px
- border dashed 1px #c0dac6
- border-radius 8px
-
> footer
> button
margin 0
@@ -524,6 +558,12 @@ export default Vue.extend({
@media (max-width 350px)
display none
+.note[data-darkmode]
+ root(true)
+
+.note:not([data-darkmode])
+ root(false)
+
</style>
<style lang="stylus" module>
diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue
index 861e8653ba..957af3487b 100644
--- a/src/client/app/mobile/views/components/post-form.vue
+++ b/src/client/app/mobile/views/components/post-form.vue
@@ -10,6 +10,7 @@
</header>
<div class="form">
<mk-note-preview v-if="reply" :note="reply"/>
+ <input v-show="useCw" v-model="cw" placeholder="内容への注釈 (オプション)">
<textarea v-model="text" ref="text" :disabled="posting" :placeholder="reply ? '%i18n:!@reply-placeholder%' : '%i18n:!@note-placeholder%'"></textarea>
<div class="attaches" v-show="files.length != 0">
<x-draggable class="files" :list="files" :options="{ animation: 150 }">
@@ -24,6 +25,7 @@
<button class="drive" @click="chooseFileFromDrive">%fa:cloud%</button>
<button class="kao" @click="kao">%fa:R smile%</button>
<button class="poll" @click="poll = true">%fa:chart-pie%</button>
+ <button class="poll" @click="useCw = !useCw">%fa:eye-slash%</button>
<button class="geo" @click="geo ? removeGeo() : setGeo()">%fa:map-marker-alt%</button>
<input ref="file" class="file" type="file" accept="image/*" multiple="multiple" @change="onChangeFile"/>
</div>
@@ -39,7 +41,9 @@ export default Vue.extend({
components: {
XDraggable
},
+
props: ['reply'],
+
data() {
return {
posting: false,
@@ -47,21 +51,27 @@ export default Vue.extend({
uploadings: [],
files: [],
poll: false,
- geo: null
+ geo: null,
+ useCw: false,
+ cw: null
};
},
+
mounted() {
this.$nextTick(() => {
this.focus();
});
},
+
methods: {
focus() {
(this.$refs.text as any).focus();
},
+
chooseFile() {
(this.$refs.file as any).click();
},
+
chooseFileFromDrive() {
(this as any).apis.chooseDriveFile({
multiple: true
@@ -69,23 +79,29 @@ export default Vue.extend({
files.forEach(this.attachMedia);
});
},
+
attachMedia(driveFile) {
this.files.push(driveFile);
this.$emit('change-attached-media', this.files);
},
+
detachMedia(file) {
this.files = this.files.filter(x => x.id != file.id);
this.$emit('change-attached-media', this.files);
},
+
onChangeFile() {
Array.from((this.$refs.file as any).files).forEach(this.upload);
},
+
upload(file) {
(this.$refs.uploader as any).upload(file);
},
+
onChangeUploadings(uploads) {
this.$emit('change-uploadings', uploads);
},
+
setGeo() {
if (navigator.geolocation == null) {
alert('お使いの端末は位置情報に対応していません');
@@ -100,15 +116,18 @@ export default Vue.extend({
enableHighAccuracy: true
});
},
+
removeGeo() {
this.geo = null;
},
+
clear() {
this.text = '';
this.files = [];
this.poll = false;
this.$emit('change-attached-media');
},
+
post() {
this.posting = true;
const viaMobile = (this as any).os.i.clientSettings.disableViaMobile !== true;
@@ -117,6 +136,7 @@ export default Vue.extend({
mediaIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
replyId: this.reply ? this.reply.id : undefined,
poll: this.poll ? (this.$refs.poll as any).get() : undefined,
+ cw: this.useCw ? this.cw || '' : undefined,
geo: this.geo ? {
coordinates: [this.geo.longitude, this.geo.latitude],
altitude: this.geo.altitude,
@@ -133,10 +153,12 @@ export default Vue.extend({
this.posting = false;
});
},
+
cancel() {
this.$emit('cancel');
this.$destroy();
},
+
kao() {
this.text += getKao();
}
@@ -236,14 +258,12 @@ export default Vue.extend({
> .file
display none
+ > input
> textarea
display block
padding 12px
margin 0
width 100%
- max-width 100%
- min-width 100%
- min-height 80px
font-size 16px
color #333
border none
@@ -253,6 +273,11 @@ export default Vue.extend({
&:disabled
opacity 0.5
+ > textarea
+ max-width 100%
+ min-width 100%
+ min-height 80px
+
> .upload
> .drive
> .kao