forked from cory/tildefriends
This lets me post a 'tildefriends-app' message.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3634 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -21,6 +21,8 @@
|
||||
connect: null,
|
||||
pubs: [],
|
||||
votes: [],
|
||||
apps: {},
|
||||
share_app: null,
|
||||
};
|
||||
var g_data_initial = JSON.parse(JSON.stringify(g_data));
|
||||
window.addEventListener('message', function(event) {
|
||||
@ -43,6 +45,8 @@
|
||||
g_data.broadcasts = event.data.broadcasts;
|
||||
} else if (key == 'pubs') {
|
||||
g_data.pubs = event.data.pubs;
|
||||
} else if (key == 'apps') {
|
||||
g_data.apps = event.data.apps;
|
||||
} else if (key == 'clear') {
|
||||
Object.keys(g_data_initial).forEach(function(key) {
|
||||
Vue.set(g_data, key, JSON.parse(JSON.stringify(g_data_initial[key])));
|
||||
@ -196,7 +200,15 @@
|
||||
data: g_data,
|
||||
methods: {
|
||||
post_message: function() {
|
||||
window.parent.postMessage({post: document.getElementById('post_text').value}, '*');
|
||||
if (g_data.share_app) {
|
||||
window.parent.postMessage({share_app: {
|
||||
app: g_data.apps[g_data.share_app],
|
||||
text: document.getElementById('post_text').value,
|
||||
}}, '*');
|
||||
} else {
|
||||
window.parent.postMessage({post: document.getElementById('post_text').value}, '*');
|
||||
}
|
||||
document.getElementById('post_text').value = '';
|
||||
},
|
||||
ssb_connect: function(connection) {
|
||||
window.parent.postMessage({connect: connection}, '*');
|
||||
@ -264,12 +276,23 @@
|
||||
<div class="md-title">What's up?</div>
|
||||
</md-card-header>
|
||||
<md-card-content>
|
||||
<md-chip v-if="share_app" md-deletable @md-delete="share_app = null">
|
||||
{{share_app}}: {{apps[share_app]}}
|
||||
</md-chip>
|
||||
<md-field>
|
||||
<label>Post a message</label>
|
||||
<md-textarea id="post_text"></md-textarea>
|
||||
</md-field>
|
||||
</md-card-content>
|
||||
<md-card-actions>
|
||||
<md-menu>
|
||||
<md-button md-menu-trigger>Share App</md-button>
|
||||
<md-menu-content>
|
||||
<md-menu-item v-for="app in Object.keys(apps)" @click="share_app = app">
|
||||
{{app}}
|
||||
</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
<md-button class="md-raised md-primary" v-on:click="post_message()">Submit Post</md-button>
|
||||
</md-card-actions>
|
||||
</md-card>
|
||||
|
Reference in New Issue
Block a user