3 Jappix - An open social platform
4 These are the roster JS scripts for Jappix
6 -------------------------------------------------
10 Last revision: 19/05/11
14 // Gets the roster items
15 function getRoster() {
16 var iq = new JSJaCIQ();
19 iq.setQuery(NS_ROSTER);
21 con.send(iq, handleRoster);
24 // Handles the roster items
25 function handleRoster(iq) {
26 // Define some variables
27 var handleXML = iq.getQuery();
28 var current, xid, dName, subscription, group, xidHash, getNick, nick;
30 // Parse the vcard xml
31 $(handleXML).find('item').each(function() {
32 parseRoster($(this), 'load');
35 // Update our avatar (if changed), and send our presence
36 getAvatar(getXID(), 'force', 'true', 'forget');
38 logThis('Roster received.');
41 // Parses the group XML and display the roster
42 function parseRoster(current, mode) {
44 xid = current.attr('jid');
45 dName = current.attr('name');
46 subscription = current.attr('subscription');
47 xidHash = hex_md5(xid);
49 // Create an array containing the groups
50 var groups = new Array();
52 current.find('group').each(function() {
53 var group_text = $(this).text();
56 groups.push(group_text);
61 groups.push(_e("Unclassified"));
63 // If no name is defined, we get the default nick of the buddy
65 dName = getXIDNick(xid);
67 displayRoster(xid, xidHash, dName, subscription, groups, mode);
70 // Updates the roster groups
71 function updateGroups() {
72 $('#buddy-list .one-group').each(function() {
74 var check = $(this).find('.buddy').size();
75 var hidden = $(this).find('.buddy:not(.hidden-buddy:hidden)').size();
77 // Special case: the filtering tool
79 hidden = $(this).find('.buddy:visible').size();
81 // If the group is empty
85 // If the group contains no online buddy (and is not just hidden)
86 if(!hidden && $(this).find('a.group').hasClass('minus'))
93 // Displays a defined roster item
94 function displayRoster(dXID, dXIDHash, dName, dSubscription, dGroup, dMode) {
95 // First remove the buddy
96 $('#buddy-list .' + dXIDHash).remove();
98 // Define some things around the groups
99 var is_gateway = isGateway(dXID);
103 gateway = ' gateway';
104 dGroup = new Array(_e("Gateways"));
107 // Remove request (empty his social channel)
108 if(dSubscription == 'remove')
109 $('#channel .mixed .one-update.update_' + dXIDHash).remove();
113 // Is this buddy blocked?
114 var privacy_class = '';
115 var privacy_state = statusPrivacy('block', dXID);
117 if(privacy_state == 'deny')
118 privacy_class = ' blocked';
120 // For each group this buddy has
122 var cGroup = dGroup[i];
126 var groupHash = 'group' + hex_md5(cGroup);
127 var groupContent = '#buddy-list .' + groupHash;
128 var groupBuddies = groupContent + ' .group-buddies';
130 // Is this group blocked?
131 if((statusPrivacy('block', cGroup) == 'deny') && (privacy_state != 'allow'))
132 privacy_class = ' blocked';
134 // Group not yet displayed
135 if(!exists(groupContent)) {
136 // Define some things
137 var groupCont = '#buddy-list .content';
138 var groupToggle = groupCont + ' .' + groupHash + ' a.group';
140 // Create the HTML markup of the group
141 $(groupCont).prepend(
142 '<div class="' + groupHash + ' one-group" data-group="' + escape(cGroup) + '">' +
143 '<a href="#" class="group talk-images minus">' + cGroup.htmlEnc() + '</a>' +
144 '<div class="group-buddies"></div>' +
148 // Create the click event which will hide and show the content
149 $(groupToggle).click(function() {
150 var group = $(groupBuddies);
151 var group_toggle = $(groupContent + ' a.group');
153 // We must hide the buddies
154 if(group_toggle.hasClass('minus')) {
156 group_toggle.removeClass('minus').addClass('plus');
158 // Remove the group opened buddy-info
162 // We must show the buddies
164 group_toggle.removeClass('plus').addClass('minus');
172 // Initialize the HTML code
173 var name_code = '<p class="buddy-name">' + dName.htmlEnc() + '</p>';
174 var presence_code = '<p class="buddy-presence talk-images unavailable">' + _e("Unavailable") + '</p>';
176 var html = '<div class="hidden-buddy buddy ibubble ' + dXIDHash + gateway + privacy_class + '" data-xid="' + escape(dXID) + '">' +
177 '<div class="buddy-click">';
179 // Display avatar if not gateway
181 html += '<div class="avatar-container">' +
182 '<img class="avatar" src="' + './img/others/default-avatar.png' + '" alt="" />' +
185 html += '<div class="name">';
187 // Special gateway code
189 html += presence_code +
196 html += '</div></div></div>';
198 // Create the DOM element for this buddy
199 $(groupBuddies).append(html);
201 // Apply the hover event
202 applyBuddyHover(dXID, dXIDHash, dName, dSubscription, dGroup, groupHash);
206 // Click event on this buddy
207 $('#buddy-list .' + dXIDHash + ' .buddy-click').click(function() {
208 return checkChatCreate(dXID, 'chat');
211 // We get the user presence if necessary
212 if(dMode == 'presence')
213 presenceFunnel(dXID, dXIDHash);
215 // If the buddy must be shown
217 $('#buddy-list .' + dXIDHash).show();
220 // We update our groups
224 funnelFilterBuddySearch();
227 // Applies the buddy editing input events
228 function applyBuddyInput(xid) {
230 var path = '#buddy-list .buddy[data-xid=' + escape(xid) + ']';
231 var rename = path + ' .bm-rename input';
232 var group = path + ' .bm-group input';
233 var manage_infos = path + ' .manage-infos';
234 var bm_choose = manage_infos + ' div.bm-choose';
237 $(rename).keyup(function(e) {
238 if(e.keyCode == 13) {
240 sendRoster(xid, '', trim($(rename).val()), thisBuddyGroups(xid));
242 // Remove the buddy editor
249 $(group).keyup(function(e) {
250 if(e.keyCode == 13) {
252 if(!trim($(this).val())) {
254 sendRoster(xid, '', trim($(rename).val()), thisBuddyGroups(xid));
256 // Remove the buddy editor
263 var this_value = trim($(this).val());
264 var escaped_value = escape(this_value);
266 // Check if the group yet exists
267 var group_exists = false;
269 $(bm_choose + ' label span').each(function() {
270 if($(this).text() == this_value)
274 // Create a new checked checkbox
276 $(bm_choose).prepend('<label><input type="checkbox" data-group="' + escaped_value + '" /><span>' + this_value.htmlEnc() + '</span></label>');
278 // Check the checkbox
279 $(bm_choose + ' input[data-group=' + escaped_value + ']').attr('checked', true);
281 // Reset the value of this input
289 $(manage_infos + ' p.bm-authorize a.to').click(function() {
291 sendSubscribe(xid, 'subscribed');
296 $(manage_infos + ' p.bm-authorize a.from').click(function() {
298 sendSubscribe(xid, 'subscribe');
303 $(manage_infos + ' p.bm-authorize a.unblock').click(function() {
306 // Update privacy settings
307 pushPrivacy('block', ['jid'], [xid], ['allow'], ['1'], [false], [true], [true], [true], '', 'roster');
308 $(path).removeClass('blocked');
310 // Enable the "block" list
311 changePrivacy('block', 'active');
312 changePrivacy('block', 'default');
314 // Send an available presence
315 sendPresence(xid, 'available', getUserShow(), getUserStatus());
320 $(manage_infos + ' p.bm-remove a.remove').click(function() {
322 sendRoster(xid, 'remove');
327 $(manage_infos + ' p.bm-remove a.prohibit').click(function() {
329 sendSubscribe(xid, 'unsubscribed');
334 $(manage_infos + ' p.bm-remove a.block').click(function() {
337 // Update privacy settings
338 pushPrivacy('block', ['jid'], [xid], ['deny'], ['1'], [false], [true], [true], [true], '', 'roster');
339 $(path).addClass('blocked');
341 // Enable the "block" list
342 changePrivacy('block', 'active');
343 changePrivacy('block', 'default');
345 // Send an unavailable presence
346 sendPresence(xid, 'unavailable');
348 // Remove the user presence
349 for(var i = 0; i < sessionStorage.length; i++) {
350 // Get the pointer values
351 var current = sessionStorage.key(i);
353 // If the pointer is on a stored presence
354 if((explodeThis('_', current, 0) == 'presence') && (bareXID(explodeThis('_', current, 1)) == xid))
355 sessionStorage.removeItem(current);
358 // Manage his new presence
359 presenceFunnel(xid, hex_md5(xid));
364 $(manage_infos + ' a.save').click(function() {
366 sendRoster(xid, '', trim($(rename).val()), thisBuddyGroups(xid));
368 // Remove the buddy editor
375 // Applies the buddy editing hover events
376 function applyBuddyHover(xid, hash, nick, subscription, groups, group_hash) {
377 // Generate the values
378 var bPath = '#buddy-list .' + group_hash + ' .buddy[data-xid=' + escape(xid) + ']';
379 var iPath = bPath + ' .buddy-infos';
381 // Apply the hover event
382 $(bPath).hover(function() {
383 // Another bubble exist
384 if(exists('#buddy-list .buddy-infos'))
387 $(bPath).oneTime(200, function() {
388 // Another bubble exist
389 if(exists('#buddy-list .buddy-infos'))
395 // Create the buddy infos DOM element
397 '<div class="buddy-infos bubble removable">' +
398 '<div class="buddy-infos-subarrow talk-images"></div>' +
399 '<div class="buddy-infos-subitem">' +
400 '<div class="pep-infos">' +
401 '<p class="bi-status talk-images unavailable">' + _e("unknown") + '</p>' +
402 '<p class="bi-mood talk-images mood-four">' + _e("unknown") + '</p>' +
403 '<p class="bi-activity talk-images activity-exercising">' + _e("unknown") + '</p>' +
404 '<p class="bi-tune talk-images tune-note">' + _e("unknown") + '</p>' +
405 '<p class="bi-geoloc talk-images location-world">' + _e("unknown") + '</p>' +
406 '<p class="bi-view talk-images view-individual"><a href="#" class="profile">' + _e("Profile") + '</a> / <a href="#" class="channel">' + _e("Channel") + '</a> / <a href="#" class="commands">' + _e("Commands") + '</a></p>' +
407 '<p class="bi-edit talk-images edit-buddy"><a href="#">' + _e("Edit") + '</a></p>' +
413 // Sets the good position
414 buddyInfosPosition(xid, group_hash);
417 presenceFunnel(xid, hash);
423 $(bPath + ' .bi-view a').click(function() {
424 // Renitialize the buddy infos
428 if($(this).is('.profile'))
432 else if($(this).is('.channel'))
433 fromInfosMicroblog(xid, hash);
436 else if($(this).is('.commands'))
442 $(bPath + ' .bi-edit a').click(function() {
443 buddyEdit(xid, nick, subscription, groups);
449 if(!exists(iPath + ' .manage-infos'))
456 // Sets the good buddy-infos position
457 function buddyInfosPosition(xid, group_hash) {
459 var group = '#buddy-list .' + group_hash;
460 var buddy = group + ' .buddy[data-xid=' + escape(xid) + ']';
461 var buddy_infos = buddy + ' .buddy-infos';
463 // Get the offset to define
469 // Process the position
470 var top = $(buddy).position().top + offset;
471 var left = $(buddy).width() - 10;
473 // Apply the top position
474 $(buddy_infos).css('top', top)
478 // Generates an array of the current groups of a buddy
479 function thisBuddyGroups(xid) {
480 var path = '#buddy-list .buddy[data-xid=' + escape(xid) + '] ';
481 var array = new Array();
483 // Each checked checkboxes
484 $(path + 'div.bm-choose input[type=checkbox]').filter(':checked').each(function() {
485 array.push(unescape($(this).attr('data-group')));
488 // Entered input value (and not yet in the array)
489 var value = trim($(path + 'p.bm-group input').val());
491 if(value && !existArrayValue(array, value))
497 // Adds a given contact to our roster
498 function addThisContact(xid, name) {
499 logThis('Add this contact: ' + xid + ', as ' + name, 3);
501 // Cut the resource of this XID
504 // If the form is complete
506 // We send the subscription
507 sendSubscribe(xid, 'subscribe');
508 sendRoster(xid, '', name);
510 // We hide the bubble
515 // Gets an array of all the groups in the roster
516 function getAllGroups() {
517 var groups = new Array();
519 $('#buddy-list .one-group').each(function() {
520 var current = unescape($(this).attr('data-group'));
522 if((current != _e("Unclassified")) && (current != _e("Gateways")))
523 groups.push(current);
526 return groups.sort();
529 // Edits buddy informations
530 function buddyEdit(xid, nick, subscription, groups) {
531 logThis('Buddy edit: ' + xid, 3);
534 var path = '#buddy-list .buddy[data-xid=' + escape(xid) + '] .';
535 var html = '<div class="manage-infos">';
537 // Get the privacy state
538 var privacy_state = statusPrivacy('block', xid);
539 var privacy_active = getDB('privacy-marker', 'available');
541 // Get the group privacy state
543 if((statusPrivacy('block', groups[g]) == 'deny') && (privacy_state != 'allow'))
544 privacy_state = 'deny';
547 // The subscription with this buddy is not full
548 if((subscription != 'both') || ((privacy_state == 'deny') && privacy_active)) {
549 var authorize_links = '';
550 html += '<p class="bm-authorize talk-images">';
552 // Link to allow to see our status
553 if((subscription == 'to') || (subscription == 'none'))
554 authorize_links += '<a href="#" class="to">' + _e("Authorize") + '</a>';
556 // Link to ask to see his/her status
557 if((subscription == 'from') || (subscription == 'none')) {
559 authorize_links += ' / ';
561 authorize_links += '<a href="#" class="from">' + _e("Ask for authorization") + '</a>';
564 // Link to unblock this buddy
565 if((privacy_state == 'deny') && privacy_active) {
567 authorize_links += ' / ';
569 html += '<a href="#" class="unblock">' + _e("Unblock") + '</a>';
572 html += authorize_links + '</p>';
575 // Complete the HTML code
576 var remove_links = '';
577 html += '<p class="bm-remove talk-images">';
578 remove_links = '<a href="#" class="remove">' + _e("Remove") + '</a>';
580 // This buddy is allowed to see our presence, we can show a "prohibit" link
581 if((subscription == 'both') || (subscription == 'from'))
582 remove_links += ' / <a href="#" class="prohibit">' + _e("Prohibit") + '</a>';
584 // Complete the HTML code
585 if((privacy_state != 'deny') && privacy_active) {
587 remove_links += ' / ';
589 remove_links += '<a href="#" class="block">' + _e("Block") + '</a>';
592 // Complete the HTML code
593 html += remove_links +
595 '<p class="bm-rename talk-images"><label>' + _e("Rename") + '</label> <input type="text" value="' + encodeQuotes(nick) + '" /></p>';
597 // Only show group tool if not a gateway
599 html += '<p class="bm-group talk-images"><label>' + _e("Groups") + '</label> <input type="text" /></p>' +
600 '<div class="bm-choose">' +
604 // Close the DOM element
605 html += '<a href="#" class="save">' + _e("Save") + '</a>' +
608 // We update the DOM elements
609 $(path + 'pep-infos').replaceWith(html);
611 // Gets all the existing groups
612 var all_groups = getAllGroups();
613 var all_groups_dom = '';
615 for(a in all_groups) {
617 var all_groups_current = all_groups[a];
619 // Is the current group checked?
622 if(existArrayValue(groups, all_groups_current))
623 checked = ' checked="true"';
625 // Add the current group HTML
626 all_groups_dom += '<label><input type="checkbox" data-group="' + escape(all_groups_current) + '"' + checked + ' /><span>' + all_groups_current.htmlEnc() + '</span></label>';
629 // Prepend this in the DOM
630 var bm_choose = path + 'manage-infos div.bm-choose';
632 $(bm_choose).prepend(all_groups_dom);
634 // Apply the editing input events
635 applyBuddyInput(xid);
638 // Updates the roster items
639 function sendRoster(xid, subscription, name, group) {
640 // We send the new buddy name
641 var iq = new JSJaCIQ();
644 var iqQuery = iq.setQuery(NS_ROSTER);
645 var item = iqQuery.appendChild(iq.buildNode('item', {'xmlns': NS_ROSTER, 'jid': xid}));
649 item.setAttribute('subscription', subscription);
653 item.setAttribute('name', name);
656 if(group && group.length) {
658 item.appendChild(iq.buildNode('group', {'xmlns': NS_ROSTER}, group[i]));
663 logThis('Roster item sent: ' + xid, 3);
666 // Adapts the roster height, depending of the window size
667 function adaptRoster() {
668 // Process the new height
669 var new_height = $('#left-content').height() - $('#my-infos').height() - 97;
671 // New height too small
675 // Apply the new height
676 $('#buddy-list .content').css('height', new_height);
679 // Gets all the buddies in our roster
680 function getAllBuddies() {
681 var buddies = new Array();
683 $('#buddy-list .buddy').each(function() {
684 var xid = unescape($(this).attr('data-xid'));
693 // Gets the user gateways
694 function getGateways() {
696 var gateways = new Array();
697 var buddies = getAllBuddies();
701 if(isGateway(buddies[c]))
702 gateways.push(buddies[c]);
708 // Define a global var for buddy list all buddies displayed
709 var BLIST_ALL = false;
712 function launchRoster() {
714 var iFilter = $('#buddy-list .filter input');
715 var aFilter = $('#buddy-list .filter a');
717 iFilter.placeholder()
720 // Nothing is entered, put the placeholder instead
721 if(!trim($(this).val()))
728 funnelFilterBuddySearch(e.keyCode);
731 aFilter.click(function() {
735 iFilter.placeholder();
737 // Security: show all the groups, empty or not
738 $('#buddy-list .one-group').show();
740 // Reset the filtering tool
741 resetFilterBuddySearch();
746 // When the user click on the add button, show the contact adding tool
747 $('#buddy-list .foot .add').click(function() {
749 if(exists('#buddy-conf-add'))
750 return closeBubbles();
753 showBubble('#buddy-conf-add');
755 // Append the content
756 $('#buddy-list .buddy-list-add').append(
757 '<div id="buddy-conf-add" class="buddy-conf-item bubble removable">' +
758 '<div class="buddy-conf-subarrow talk-images"></div>' +
760 '<div class="buddy-conf-subitem">' +
761 '<p class="buddy-conf-p">' + _e("Add a friend") + '</p>' +
763 '<label><span>' + _e("Address") + '</span><input type="text" class="buddy-conf-input add-contact-jid" required="" /></label>' +
764 '<label><span>' + _e("Name") + '</span><input type="text" class="buddy-conf-input add-contact-name" /></label>' +
766 '<span>' + _e("Gateway") + '</span>' +
767 '<select class="buddy-conf-select add-contact-gateway">' +
768 '<option value="none" selected="">' + _e("None") + '</option>' +
771 '<span class="add-contact-name-get">' + _e("Getting the name...") + '</span>' +
773 '<p class="buddy-conf-text">' +
774 '<a href="#" class="buddy-conf-add-search">' + _e("Search a friend") + '</a>' +
781 var gateways = getGateways();
784 if(gateways.length) {
785 // Append the gateways
787 $('.add-contact-gateway').append('<option value="' + escape(gateways[i]) + '">' + gateways[i].htmlEnc() + '</option>');
789 // Show the gateway selector
790 $('.add-contact-gateway').parent().show();
795 $('.add-contact-gateway').parent().hide();
797 // Blur event on the add contact input
798 $('.add-contact-jid').blur(function() {
800 var value = trim($(this).val());
802 // Try to catch the buddy name
803 if(value && !trim($('.add-contact-name').val()) && ($('.add-contact-gateway').val() == 'none')) {
805 var xid = generateXID(value, 'chat');
807 // Notice for the user
808 $('.add-contact-name-get').attr('data-for', escape(xid)).show();
810 // Request the user vCard
815 // When a key is pressed...
816 $('#buddy-conf-add input, #buddy-conf-add select').keyup(function(e) {
818 if(e.keyCode == 13) {
820 var xid = trim($('.add-contact-jid').val());
821 var name = trim($('.add-contact-name').val());
822 var gateway = unescape($('.add-contact-gateway').val());
824 // Generate the XID to add
825 if((gateway != 'none') && xid)
826 xid = xid.replace(/@/g, '%') + '@' + gateway;
828 xid = generateXID(xid, 'chat');
831 if(xid && (xid != getXID()))
832 addThisContact(xid, name);
834 $(document).oneTime(10, function() {
835 $('.add-contact-jid').addClass('please-complete').focus();
846 // Click event on search link
847 $('.buddy-conf-add-search').click(function() {
849 return openDirectory();
852 // Focus on the input
853 $(document).oneTime(10, function() {
854 $('.add-contact-jid').focus();
860 // When the user click on the join button, show the chat joining tool
861 $('#buddy-list .foot .join').click(function() {
863 if(exists('#buddy-conf-join'))
864 return closeBubbles();
867 showBubble('#buddy-conf-join');
869 // Append the content
870 $('#buddy-list .buddy-list-join').append(
871 '<div id="buddy-conf-join" class="buddy-conf-item bubble removable">' +
872 '<div class="buddy-conf-subarrow talk-images"></div>' +
874 '<div class="buddy-conf-subitem search">' +
875 '<p class="buddy-conf-p" style="margin-bottom: 0;">' + _e("Join a chat") + '</p>' +
877 '<input type="text" class="buddy-conf-input join-jid" required="" />' +
878 '<select class="buddy-conf-select buddy-conf-join-select join-type">' +
879 '<option value="chat" selected="">' + _e("Chat") + '</option>' +
880 '<option value="groupchat">' + _e("Groupchat") + '</option>' +
887 var destination = '#buddy-conf-join .search';
888 var dHovered = destination + ' ul li.hovered:first';
890 // When a key is pressed...
891 $('#buddy-conf-join input, #buddy-conf-join select').keyup(function(e) {
893 if(e.keyCode == 13) {
894 // Select something from the search
896 addBuddySearch(destination, $(dHovered).attr('data-xid'));
900 var xid = trim($('.join-jid').val());
901 var type = $('.buddy-conf-join-select').val();
904 // Generate a correct XID
905 xid = generateXID(xid, type);
908 if(xid != getXID()) {
909 // Update some things
910 $('.join-jid').removeClass('please-complete');
914 checkChatCreate(xid, type);
918 $('.join-jid').addClass('please-complete');
922 $('.join-jid').addClass('please-complete');
929 else if(e.keyCode == 27)
933 else if($('.buddy-conf-join-select').val() == 'chat') {
935 if((e.keyCode != 40) && (e.keyCode != 38))
936 createBuddySearch(destination);
938 // Navigating with keyboard in the results
939 arrowsBuddySearch(e, destination);
943 // Buddy search lost focus
944 $('#buddy-conf-join input').blur(function() {
945 if(!$(destination + ' ul').attr('mouse-hover'))
946 resetBuddySearch(destination);
949 // Re-focus on the text input
950 $('#buddy-conf-join select').change(function() {
951 $(document).oneTime(10, function() {
952 $('#buddy-conf-join input').focus();
956 // We focus on the input
957 $(document).oneTime(10, function() {
958 $('#buddy-conf-join .join-jid').focus();
964 // When the user click on the groupchat button, show the groupchat menu
965 $('#buddy-list .foot .groupchat').click(function() {
967 if(exists('#buddy-conf-groupchat'))
968 return closeBubbles();
971 showBubble('#buddy-conf-groupchat');
973 // Append the content
974 $('#buddy-list .buddy-list-groupchat').append(
975 '<div id="buddy-conf-groupchat" class="buddy-conf-item bubble removable">' +
976 '<div class="buddy-conf-subarrow talk-images"></div>' +
978 '<div class="buddy-conf-subitem">' +
979 '<p class="buddy-conf-p">' + _e("Your groupchats") + '</p>' +
981 '<select name="groupchat-join" class="buddy-conf-select buddy-conf-groupchat-select"></select>' +
983 '<p class="buddy-conf-text">' +
984 '- <a href="#" class="buddy-conf-groupchat-edit">' + _e("Manage your favorite groupchats") + '</a>' +
990 // When the user wants to edit his groupchat favorites
991 $('.buddy-conf-groupchat-edit').click(function() {
999 $('.buddy-conf-groupchat-select').change(function() {
1000 var groupchat = trim($(this).val());
1002 if(groupchat != 'none') {
1003 // We hide the bubble
1007 checkChatCreate(groupchat, 'groupchat');
1009 // We reset the select value
1010 $(this).val('none');
1014 // Load the favorites
1020 // When the user click on the more button, show the more menu
1021 $('#buddy-list .foot .more').click(function() {
1023 if(exists('#buddy-conf-more'))
1024 return closeBubbles();
1027 showBubble('#buddy-conf-more');
1029 // Append the content
1030 $('#buddy-list .buddy-list-more').append(
1031 '<div id="buddy-conf-more" class="buddy-conf-item bubble removable">' +
1032 '<div class="buddy-conf-subarrow talk-images"></div>' +
1034 '<div class="buddy-conf-subitem">' +
1035 '<p class="buddy-conf-p">' + _e("More stuff") + '</p>' +
1037 '<p class="buddy-conf-text">' +
1038 '- <a href="#" class="buddy-conf-more-display-unavailable">' + _e("Show all friends") + '</a>' +
1039 '<a href="#" class="buddy-conf-more-display-available">' + _e("Only show connected friends") + '</a>' +
1042 '<p class="buddy-conf-text archives-hidable">' +
1043 '- <a href="#" class="buddy-conf-more-archives">' + _e("Message archives") + '</a>' +
1046 '<p class="buddy-conf-text privacy-hidable">' +
1047 '- <a href="#" class="buddy-conf-more-privacy">' + _e("Privacy") + '</a>' +
1050 '<p class="buddy-conf-text">' +
1051 '- <a href="#" class="buddy-conf-more-service-disco">' + _e("Service discovery") + '</a>' +
1054 '<p class="buddy-conf-text commands-hidable"">' +
1055 '- <a href="#" class="buddy-conf-more-commands">' + _e("Commands") + '</a>' +
1061 // Close bubble when link clicked
1062 $('#buddy-conf-more a').click(function() {
1066 // When the user wants to display all his buddies
1067 $('.buddy-conf-more-display-unavailable').click(function() {
1068 showAllBuddies('roster');
1073 // When the user wants to display only online buddies
1074 $('.buddy-conf-more-display-available').click(function() {
1075 showOnlineBuddies('roster');
1080 // When the user click on the archives link
1081 $('.buddy-conf-more-archives').click(openArchives);
1083 // When the user click on the privacy link
1084 $('.buddy-conf-more-privacy').click(openPrivacy);
1086 // When the user click on the service discovery link
1087 $('.buddy-conf-more-service-disco').click(openDiscovery);
1089 // When the user click on the command link
1090 $('.buddy-conf-more-commands').click(function() {
1091 serverAdHoc(con.domain);
1096 // Manage the displayed links
1098 $('.buddy-conf-more-display-unavailable').hide();
1099 $('.buddy-conf-more-display-available').show();
1102 if(enabledArchives() || enabledArchives('auto') || enabledArchives('manual') || enabledArchives('manage'))
1103 $('.buddy-conf-more-archives').parent().show();
1105 if(enabledCommands())
1106 $('.buddy-conf-more-commands').parent().show();
1108 if(getDB('privacy-marker', 'available'))
1109 $('.buddy-conf-more-privacy').parent().show();
1114 // When the user scrolls the buddy list
1115 $('#buddy-list .content').scroll(function() {
1116 // Close the opened buddy infos bubble
1121 // Window resize event handler
1122 $(window).resize(adaptRoster);