This commit is contained in:
parent
6bf5a4edff
commit
1a015457fa
|
@ -1,104 +0,0 @@
|
||||||
<mk-images-viewer>
|
|
||||||
<virtual each={ image in images }>
|
|
||||||
<mk-images-viewer-image image={ image } images={ images }/>
|
|
||||||
</virtual>
|
|
||||||
<style>
|
|
||||||
:scope
|
|
||||||
display grid
|
|
||||||
grid-gap .25em
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
this.images = this.opts.images;
|
|
||||||
|
|
||||||
this.on('mount', () => {
|
|
||||||
if (this.images.length == 1) {
|
|
||||||
this.root.style.gridTemplateRows = '256px';
|
|
||||||
|
|
||||||
this.tags['mk-images-viewer-image'].root.style.gridColumn = '1 / 2';
|
|
||||||
this.tags['mk-images-viewer-image'].root.style.gridRow = '1 / 2';
|
|
||||||
} else if (this.images.length == 2) {
|
|
||||||
this.root.style.gridTemplateColumns = '50% 50%';
|
|
||||||
this.root.style.gridTemplateRows = '256px';
|
|
||||||
|
|
||||||
this.tags['mk-images-viewer-image'][0].root.style.gridColumn = '1 / 2';
|
|
||||||
this.tags['mk-images-viewer-image'][0].root.style.gridRow = '1 / 2';
|
|
||||||
this.tags['mk-images-viewer-image'][1].root.style.gridColumn = '2 / 3';
|
|
||||||
this.tags['mk-images-viewer-image'][1].root.style.gridRow = '1 / 2';
|
|
||||||
} else if (this.images.length == 3) {
|
|
||||||
this.root.style.gridTemplateColumns = '70% 30%';
|
|
||||||
this.root.style.gridTemplateRows = '128px 128px';
|
|
||||||
|
|
||||||
this.tags['mk-images-viewer-image'][0].root.style.gridColumn = '1 / 2';
|
|
||||||
this.tags['mk-images-viewer-image'][0].root.style.gridRow = '1 / 3';
|
|
||||||
this.tags['mk-images-viewer-image'][1].root.style.gridColumn = '2 / 3';
|
|
||||||
this.tags['mk-images-viewer-image'][1].root.style.gridRow = '1 / 2';
|
|
||||||
this.tags['mk-images-viewer-image'][2].root.style.gridColumn = '2 / 3';
|
|
||||||
this.tags['mk-images-viewer-image'][2].root.style.gridRow = '2 / 3';
|
|
||||||
} else if (this.images.length == 4) {
|
|
||||||
this.root.style.gridTemplateColumns = '50% 50%';
|
|
||||||
this.root.style.gridTemplateRows = '128px 128px';
|
|
||||||
|
|
||||||
this.tags['mk-images-viewer-image'][0].root.style.gridColumn = '1 / 2';
|
|
||||||
this.tags['mk-images-viewer-image'][0].root.style.gridRow = '1 / 2';
|
|
||||||
this.tags['mk-images-viewer-image'][1].root.style.gridColumn = '2 / 3';
|
|
||||||
this.tags['mk-images-viewer-image'][1].root.style.gridRow = '1 / 2';
|
|
||||||
this.tags['mk-images-viewer-image'][2].root.style.gridColumn = '1 / 2';
|
|
||||||
this.tags['mk-images-viewer-image'][2].root.style.gridRow = '2 / 3';
|
|
||||||
this.tags['mk-images-viewer-image'][3].root.style.gridColumn = '2 / 3';
|
|
||||||
this.tags['mk-images-viewer-image'][3].root.style.gridRow = '2 / 3';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</mk-images-viewer>
|
|
||||||
|
|
||||||
<mk-images-viewer-image>
|
|
||||||
<div ref="view" onmousemove={ mousemove } onmouseleave={ mouseleave } style={ 'background-image: url(' + image.url + '?thumbnail&size=512' } onclick={ click }>
|
|
||||||
<img ref="image" src={ image.url + '?thumbnail&size=512' } alt={ image.name } title={ image.name }/>
|
|
||||||
</div>
|
|
||||||
<style>
|
|
||||||
:scope
|
|
||||||
display block
|
|
||||||
overflow hidden
|
|
||||||
border-radius 4px
|
|
||||||
|
|
||||||
> div
|
|
||||||
cursor zoom-in
|
|
||||||
overflow hidden
|
|
||||||
width 100%
|
|
||||||
height 100%
|
|
||||||
background-position center
|
|
||||||
|
|
||||||
> img
|
|
||||||
display block
|
|
||||||
visibility hidden
|
|
||||||
max-width: 100%
|
|
||||||
max-height: 256px
|
|
||||||
|
|
||||||
&:not(:hover)
|
|
||||||
background-size cover
|
|
||||||
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
this.mousemove = e => {
|
|
||||||
const rect = this.refs.view.getBoundingClientRect();
|
|
||||||
const mouseX = e.clientX - rect.left;
|
|
||||||
const mouseY = e.clientY - rect.top;
|
|
||||||
const xp = mouseX / this.refs.view.offsetWidth * 100;
|
|
||||||
const yp = mouseY / this.refs.view.offsetHeight * 100;
|
|
||||||
this.refs.view.style.backgroundPosition = xp + '% ' + yp + '%';
|
|
||||||
this.refs.view.style.backgroundImage = 'url("' + this.image.url + '?thumbnail")';
|
|
||||||
};
|
|
||||||
|
|
||||||
this.mouseleave = () => {
|
|
||||||
this.refs.view.style.backgroundPosition = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
this.click = () => {
|
|
||||||
riot.mount(document.body.appendChild(document.createElement('mk-image-dialog')), {
|
|
||||||
image: this.image
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
this.image = this.opts.image;
|
|
||||||
</script>
|
|
||||||
</mk-images-viewer-image>
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
<mk-images>
|
||||||
|
<virtual each={ image in images }>
|
||||||
|
<mk-images-image image={ image }/>
|
||||||
|
</virtual>
|
||||||
|
<style>
|
||||||
|
:scope
|
||||||
|
display grid
|
||||||
|
grid-gap 4px
|
||||||
|
height 256px
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
this.images = this.opts.images;
|
||||||
|
|
||||||
|
this.on('mount', () => {
|
||||||
|
if (this.images.length == 1) {
|
||||||
|
this.root.style.gridTemplateRows = '1fr';
|
||||||
|
|
||||||
|
this.tags['mk-images-image'].root.style.gridColumn = '1 / 2';
|
||||||
|
this.tags['mk-images-image'].root.style.gridRow = '1 / 2';
|
||||||
|
} else if (this.images.length == 2) {
|
||||||
|
this.root.style.gridTemplateColumns = '1fr 1fr';
|
||||||
|
this.root.style.gridTemplateRows = '1fr';
|
||||||
|
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridColumn = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridRow = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridColumn = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridRow = '1 / 2';
|
||||||
|
} else if (this.images.length == 3) {
|
||||||
|
this.root.style.gridTemplateColumns = '1fr 0.5fr';
|
||||||
|
this.root.style.gridTemplateRows = '1fr 1fr';
|
||||||
|
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridColumn = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridRow = '1 / 3';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridColumn = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridRow = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][2].root.style.gridColumn = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][2].root.style.gridRow = '2 / 3';
|
||||||
|
} else if (this.images.length == 4) {
|
||||||
|
this.root.style.gridTemplateColumns = '1fr 1fr';
|
||||||
|
this.root.style.gridTemplateRows = '1fr 1fr';
|
||||||
|
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridColumn = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridRow = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridColumn = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridRow = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][2].root.style.gridColumn = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][2].root.style.gridRow = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][3].root.style.gridColumn = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][3].root.style.gridRow = '2 / 3';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</mk-images>
|
||||||
|
|
||||||
|
<mk-images-image>
|
||||||
|
<a ref="view" href={ image.url } onmousemove={ mousemove } onmouseleave={ mouseleave } style={ 'background-image: url(' + image.url + '?thumbnail&size=512' } onclick={ click } title={ image.name }></a>
|
||||||
|
<style>
|
||||||
|
:scope
|
||||||
|
display block
|
||||||
|
overflow hidden
|
||||||
|
border-radius 4px
|
||||||
|
|
||||||
|
> a
|
||||||
|
display block
|
||||||
|
cursor zoom-in
|
||||||
|
overflow hidden
|
||||||
|
width 100%
|
||||||
|
height 100%
|
||||||
|
background-position center
|
||||||
|
|
||||||
|
&:not(:hover)
|
||||||
|
background-size cover
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
this.image = this.opts.image;
|
||||||
|
|
||||||
|
this.mousemove = e => {
|
||||||
|
const rect = this.refs.view.getBoundingClientRect();
|
||||||
|
const mouseX = e.clientX - rect.left;
|
||||||
|
const mouseY = e.clientY - rect.top;
|
||||||
|
const xp = mouseX / this.refs.view.offsetWidth * 100;
|
||||||
|
const yp = mouseY / this.refs.view.offsetHeight * 100;
|
||||||
|
this.refs.view.style.backgroundPosition = xp + '% ' + yp + '%';
|
||||||
|
this.refs.view.style.backgroundImage = 'url("' + this.image.url + '?thumbnail")';
|
||||||
|
};
|
||||||
|
|
||||||
|
this.mouseleave = () => {
|
||||||
|
this.refs.view.style.backgroundPosition = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
this.click = ev => {
|
||||||
|
ev.preventDefault();
|
||||||
|
riot.mount(document.body.appendChild(document.createElement('mk-image-dialog')), {
|
||||||
|
image: this.image
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</mk-images-image>
|
|
@ -76,7 +76,7 @@ require('./set-avatar-suggestion.tag');
|
||||||
require('./set-banner-suggestion.tag');
|
require('./set-banner-suggestion.tag');
|
||||||
require('./repost-form.tag');
|
require('./repost-form.tag');
|
||||||
require('./sub-post-content.tag');
|
require('./sub-post-content.tag');
|
||||||
require('./images-viewer.tag');
|
require('./images.tag');
|
||||||
require('./image-dialog.tag');
|
require('./image-dialog.tag');
|
||||||
require('./donation.tag');
|
require('./donation.tag');
|
||||||
require('./users-list.tag');
|
require('./users-list.tag');
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="text" ref="text"></div>
|
<div class="text" ref="text"></div>
|
||||||
<div class="media" if={ post.media }>
|
<div class="media" if={ post.media }>
|
||||||
<mk-images-viewer images={ post.media }/>
|
<mk-images images={ post.media }/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="text" ref="text"></div>
|
<div class="text" ref="text"></div>
|
||||||
<div class="media" if={ p.media }>
|
<div class="media" if={ p.media }>
|
||||||
<mk-images-viewer images={ p.media }/>
|
<mk-images images={ p.media }/>
|
||||||
</div>
|
</div>
|
||||||
<mk-poll if={ p.poll } post={ p }/>
|
<mk-poll if={ p.poll } post={ p }/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</div>
|
</div>
|
||||||
<details if={ post.media }>
|
<details if={ post.media }>
|
||||||
<summary>({ post.media.length }つのメディア)</summary>
|
<summary>({ post.media.length }つのメディア)</summary>
|
||||||
<mk-images-viewer images={ post.media }/>
|
<mk-images images={ post.media }/>
|
||||||
</details>
|
</details>
|
||||||
<details if={ post.poll }>
|
<details if={ post.poll }>
|
||||||
<summary>投票</summary>
|
<summary>投票</summary>
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
<a class="quote" if={ p.repost != null }>RP:</a>
|
<a class="quote" if={ p.repost != null }>RP:</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="media" if={ p.media }>
|
<div class="media" if={ p.media }>
|
||||||
<mk-images-viewer images={ p.media }/>
|
<mk-images images={ p.media }/>
|
||||||
</div>
|
</div>
|
||||||
<mk-poll if={ p.poll } post={ p } ref="pollViewer"/>
|
<mk-poll if={ p.poll } post={ p } ref="pollViewer"/>
|
||||||
<div class="repost" if={ p.repost }>%fa:quote-right -flip-h%
|
<div class="repost" if={ p.repost }>%fa:quote-right -flip-h%
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
<mk-images-viewer>
|
|
||||||
<div class="image" ref="view" onclick={ click }><img ref="img" src={ image.url + '?thumbnail&size=512' } alt={ image.name } title={ image.name }/></div>
|
|
||||||
<style>
|
|
||||||
:scope
|
|
||||||
display block
|
|
||||||
overflow hidden
|
|
||||||
border-radius 4px
|
|
||||||
|
|
||||||
> .image
|
|
||||||
|
|
||||||
> img
|
|
||||||
display block
|
|
||||||
max-height 256px
|
|
||||||
max-width 100%
|
|
||||||
margin 0 auto
|
|
||||||
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
this.images = this.opts.images;
|
|
||||||
this.image = this.images[0];
|
|
||||||
|
|
||||||
this.click = () => {
|
|
||||||
window.open(this.image.url);
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
</mk-images-viewer>
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
<mk-images>
|
||||||
|
<virtual each={ image in images }>
|
||||||
|
<mk-images-image image={ image }/>
|
||||||
|
</virtual>
|
||||||
|
<style>
|
||||||
|
:scope
|
||||||
|
display grid
|
||||||
|
grid-gap 4px
|
||||||
|
height 256px
|
||||||
|
|
||||||
|
@media (max-width 500px)
|
||||||
|
height 192px
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
this.images = this.opts.images;
|
||||||
|
|
||||||
|
this.on('mount', () => {
|
||||||
|
if (this.images.length == 1) {
|
||||||
|
this.root.style.gridTemplateRows = '1fr';
|
||||||
|
|
||||||
|
this.tags['mk-images-image'].root.style.gridColumn = '1 / 2';
|
||||||
|
this.tags['mk-images-image'].root.style.gridRow = '1 / 2';
|
||||||
|
} else if (this.images.length == 2) {
|
||||||
|
this.root.style.gridTemplateColumns = '1fr 1fr';
|
||||||
|
this.root.style.gridTemplateRows = '1fr';
|
||||||
|
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridColumn = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridRow = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridColumn = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridRow = '1 / 2';
|
||||||
|
} else if (this.images.length == 3) {
|
||||||
|
this.root.style.gridTemplateColumns = '1fr 0.5fr';
|
||||||
|
this.root.style.gridTemplateRows = '1fr 1fr';
|
||||||
|
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridColumn = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridRow = '1 / 3';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridColumn = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridRow = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][2].root.style.gridColumn = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][2].root.style.gridRow = '2 / 3';
|
||||||
|
} else if (this.images.length == 4) {
|
||||||
|
this.root.style.gridTemplateColumns = '1fr 1fr';
|
||||||
|
this.root.style.gridTemplateRows = '1fr 1fr';
|
||||||
|
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridColumn = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][0].root.style.gridRow = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridColumn = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][1].root.style.gridRow = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][2].root.style.gridColumn = '1 / 2';
|
||||||
|
this.tags['mk-images-image'][2].root.style.gridRow = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][3].root.style.gridColumn = '2 / 3';
|
||||||
|
this.tags['mk-images-image'][3].root.style.gridRow = '2 / 3';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</mk-images>
|
||||||
|
|
||||||
|
<mk-images-image>
|
||||||
|
<a ref="view" href={ image.url } target="_blank" style={ 'background-image: url(' + image.url + '?thumbnail&size=512' } title={ image.name }></a>
|
||||||
|
<style>
|
||||||
|
:scope
|
||||||
|
display block
|
||||||
|
overflow hidden
|
||||||
|
border-radius 4px
|
||||||
|
|
||||||
|
> a
|
||||||
|
display block
|
||||||
|
overflow hidden
|
||||||
|
width 100%
|
||||||
|
height 100%
|
||||||
|
background-position center
|
||||||
|
background-size cover
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
this.image = this.opts.image;
|
||||||
|
</script>
|
||||||
|
</mk-images-image>
|
|
@ -25,7 +25,7 @@ require('./home-timeline.tag');
|
||||||
require('./timeline.tag');
|
require('./timeline.tag');
|
||||||
require('./post-preview.tag');
|
require('./post-preview.tag');
|
||||||
require('./sub-post-content.tag');
|
require('./sub-post-content.tag');
|
||||||
require('./images-viewer.tag');
|
require('./images.tag');
|
||||||
require('./drive.tag');
|
require('./drive.tag');
|
||||||
require('./drive-selector.tag');
|
require('./drive-selector.tag');
|
||||||
require('./drive-folder-selector.tag');
|
require('./drive-folder-selector.tag');
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="text" ref="text"></div>
|
<div class="text" ref="text"></div>
|
||||||
<div class="media" if={ p.media }>
|
<div class="media" if={ p.media }>
|
||||||
<virtual each={ file in p.media }><img src={ file.url + '?thumbnail&size=512' } alt={ file.name } title={ file.name }/></virtual>
|
<mk-images images={ p.media }/>
|
||||||
</div>
|
</div>
|
||||||
<mk-poll if={ p.poll } post={ p }/>
|
<mk-poll if={ p.poll } post={ p }/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="body"><a class="reply" if={ post.reply_id }>%fa:reply%</a><span ref="text"></span><a class="quote" if={ post.repost_id } href={ '/post:' + post.repost_id }>RP: ...</a></div>
|
<div class="body"><a class="reply" if={ post.reply_id }>%fa:reply%</a><span ref="text"></span><a class="quote" if={ post.repost_id } href={ '/post:' + post.repost_id }>RP: ...</a></div>
|
||||||
<details if={ post.media }>
|
<details if={ post.media }>
|
||||||
<summary>({ post.media.length }個のメディア)</summary>
|
<summary>({ post.media.length }個のメディア)</summary>
|
||||||
<mk-images-viewer images={ post.media }/>
|
<mk-images images={ post.media }/>
|
||||||
</details>
|
</details>
|
||||||
<details if={ post.poll }>
|
<details if={ post.poll }>
|
||||||
<summary>%i18n:mobile.tags.mk-sub-post-content.poll%</summary>
|
<summary>%i18n:mobile.tags.mk-sub-post-content.poll%</summary>
|
||||||
|
|
|
@ -172,7 +172,7 @@
|
||||||
<a class="quote" if={ p.repost != null }>RP:</a>
|
<a class="quote" if={ p.repost != null }>RP:</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="media" if={ p.media }>
|
<div class="media" if={ p.media }>
|
||||||
<mk-images-viewer images={ p.media }/>
|
<mk-images images={ p.media }/>
|
||||||
</div>
|
</div>
|
||||||
<mk-poll if={ p.poll } post={ p } ref="pollViewer"/>
|
<mk-poll if={ p.poll } post={ p } ref="pollViewer"/>
|
||||||
<span class="app" if={ p.app }>via <b>{ p.app.name }</b></span>
|
<span class="app" if={ p.app }>via <b>{ p.app.name }</b></span>
|
||||||
|
|
Loading…
Reference in New Issue