mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-07 00:48:55 +00:00
jappixmini: include jappix source
This commit is contained in:
parent
61eb1f0d18
commit
302b2820d1
231 changed files with 96082 additions and 2 deletions
94
jappixmini/jappix/js/receipts.js
Normal file
94
jappixmini/jappix/js/receipts.js
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
|
||||
Jappix - An open social platform
|
||||
These are the receipts JS scripts for Jappix
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
License: AGPL
|
||||
Author: Vanaryon
|
||||
Last revision: 26/12/10
|
||||
|
||||
*/
|
||||
|
||||
// Checks if we can send a receipt request
|
||||
function receiptRequest(hash) {
|
||||
// Entity have support for receipt?
|
||||
if($('#' + hash + ' .message-area').attr('data-receipts') == 'true')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Checks if there is a receipt request
|
||||
function hasReceipt(packet) {
|
||||
// Any receipt request?
|
||||
if(packet.getChild('request', NS_URN_RECEIPTS))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Checks if there is a received reply
|
||||
function hasReceived(packet) {
|
||||
// Any received reply?
|
||||
if(packet.getChild('received', NS_URN_RECEIPTS))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Sends a received notification
|
||||
function sendReceived(type, to, id) {
|
||||
var aMsg = new JSJaCMessage();
|
||||
aMsg.setTo(to);
|
||||
aMsg.setID(id);
|
||||
|
||||
// Any type?
|
||||
if(type)
|
||||
aMsg.setType(type);
|
||||
|
||||
// Append the received node
|
||||
aMsg.appendNode('received', {'xmlns': NS_URN_RECEIPTS, 'id': id});
|
||||
|
||||
con.send(aMsg);
|
||||
|
||||
logThis('Sent received to: ' + to);
|
||||
}
|
||||
|
||||
// Tells the message has been received
|
||||
function messageReceived(hash, id) {
|
||||
// Line selector
|
||||
var path = $('#' + hash + ' .one-line[data-id=' + id + ']');
|
||||
|
||||
// Add a received marker
|
||||
path.attr('data-received', 'true')
|
||||
.removeAttr('data-lost');
|
||||
|
||||
// Group selector
|
||||
var group = path.parent();
|
||||
|
||||
// Remove the group marker
|
||||
if(!group.find('.one-line[data-lost]').size()) {
|
||||
group.find('b.name').removeClass('talk-images')
|
||||
.removeAttr('title');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Checks if the message has been received
|
||||
function checkReceived(hash, id) {
|
||||
// Fire a check 10 seconds later
|
||||
$('#' + hash + ' .one-line[data-id=' + id + ']').oneTime('10s', function() {
|
||||
// Not received?
|
||||
if($(this).attr('data-received') != 'true') {
|
||||
// Add a "lost" marker
|
||||
$(this).attr('data-lost', 'true');
|
||||
|
||||
// Add a warn on the buddy-name
|
||||
$(this).parent().find('b.name').addClass('talk-images')
|
||||
.attr('title', _e("Your friend seems not to have received your message(s)!"));
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue