forked from cory/tildefriends
Redo sharing apps so that they can be mentioned from regular posts.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3723 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@@ -11,7 +11,7 @@ var g_data = {
|
||||
pubs: [],
|
||||
votes: {},
|
||||
apps: {},
|
||||
share_app: null,
|
||||
mentions: {},
|
||||
unread: 0,
|
||||
};
|
||||
|
||||
@@ -117,16 +117,16 @@ window.addEventListener('load', function() {
|
||||
data: g_data,
|
||||
methods: {
|
||||
post_message: function() {
|
||||
if (g_data.share_app) {
|
||||
window.parent.postMessage({share_app: {
|
||||
app: g_data.apps[g_data.share_app],
|
||||
name: g_data.share_app,
|
||||
text: document.getElementById('post_text').value,
|
||||
}}, '*');
|
||||
} else {
|
||||
window.parent.postMessage({post: document.getElementById('post_text').value}, '*');
|
||||
var message = {
|
||||
type: 'post',
|
||||
text: document.getElementById('post_text').value,
|
||||
};
|
||||
if (Object.keys(g_data.mentions).length) {
|
||||
message.mentions = Object.values(g_data.mentions);
|
||||
}
|
||||
window.parent.postMessage({appendMessage: message}, '*');
|
||||
document.getElementById('post_text').value = '';
|
||||
Vue.set(g_data, mentions, {});
|
||||
},
|
||||
ssb_connect: function(connection) {
|
||||
window.parent.postMessage({connect: connection}, '*');
|
||||
@@ -141,6 +141,16 @@ window.addEventListener('load', function() {
|
||||
refresh: function() {
|
||||
window.parent.postMessage({refresh: true}, '*');
|
||||
},
|
||||
add_app_to_mentions: function(app) {
|
||||
Vue.set(g_data.mentions, g_data.apps[app], {
|
||||
link: g_data.apps[app],
|
||||
name: app,
|
||||
type: 'application/tildefriends',
|
||||
});
|
||||
},
|
||||
remove_from_mentions: function(link) {
|
||||
Vue.delete(g_data.mentions, link);
|
||||
},
|
||||
}
|
||||
});
|
||||
window.parent.postMessage('ready', '*');
|
||||
|
Reference in New Issue
Block a user