forked from cory/tildefriends
Click to expand images. Long overdue.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3805 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -45,6 +45,29 @@ Vue.component('tf-message', {
|
||||
show_message: function() {
|
||||
window.parent.postMessage({action: 'setHash', hash: this.message.id}, '*');
|
||||
},
|
||||
expand_image: function(event) {
|
||||
var div = document.createElement('div');
|
||||
div.style.left = 0;
|
||||
div.style.top = 0;
|
||||
div.style.width = '100%';
|
||||
div.style.height = '100%';
|
||||
div.style.position = 'fixed';
|
||||
div.style.background = '#000';
|
||||
div.style.zIndex = 100;
|
||||
div.style.display = 'grid';
|
||||
var img = document.createElement('img');
|
||||
img.src = event.srcElement.src;
|
||||
img.style.maxWidth = '100%';
|
||||
img.style.maxHeight = '100%';
|
||||
img.style.display = 'block';
|
||||
img.style.margin = 'auto';
|
||||
img.style.objectFit = 'contain';
|
||||
img.style.width = '100%';
|
||||
div.appendChild(img);
|
||||
div.onclick = function() { document.body.removeChild(div); };
|
||||
document.body.appendChild(div);
|
||||
console.log(document.body.children);
|
||||
},
|
||||
},
|
||||
template: `<md-app class="md-elevation-8" style="margin: 1em" v-if="!content_json || ['pub', 'vote'].indexOf(content_json.type) == -1">
|
||||
<md-app-toolbar>
|
||||
@ -79,10 +102,10 @@ Vue.component('tf-message', {
|
||||
<div v-else>
|
||||
<div v-if="content_json && content_json.type == 'post'">
|
||||
<div v-html="this.markdown(content_json.text)"></div>
|
||||
<div v-for="mention in content_json.mentions" v-if="mention.link && typeof(mention.link) == 'string' && mention.link.startsWith('&')">
|
||||
<span v-for="mention in content_json.mentions" v-if="mention.link && typeof(mention.link) == 'string' && mention.link.startsWith('&')">
|
||||
<a v-if="mention.type == 'application/tildefriends'" :href="'/' + mention.link + '/'" target="_top">{{mention.name}}</a>
|
||||
<img v-else :src="'/' + mention.link + '/view'"></img>
|
||||
</div>
|
||||
<img v-else class="md-elevation-4" style="margin: 4px; max-width: 320px; max-height: 240px" :src="'/' + mention.link + '/view'" v-on:click="expand_image"></img>
|
||||
</span>
|
||||
</div>
|
||||
<div v-else-if="content_json && content_json.type == 'tildefriends-app'">
|
||||
<div v-html="this.markdown(content_json.text)"></div>
|
||||
|
Reference in New Issue
Block a user