]> git.mxchange.org Git - friendica-addons.git/blob - jappixmini/jappix/js/directory.js
GContact moved to src
[friendica-addons.git] / jappixmini / jappix / js / directory.js
1 /*
2
3 Jappix - An open social platform
4 These are the directory JS scripts for Jappix
5
6 -------------------------------------------------
7
8 License: AGPL
9 Author: Vanaryon
10 Last revision: 03/03/11
11
12 */
13
14 // Opens the directory popup
15 function openDirectory() {
16         // Popup HTML content
17         var html = 
18         '<div class="top">' + _e("User directory") + '</div>' + 
19         
20         '<div class="content">' + 
21                 '<div class="directory-head">' + 
22                         '<div class="directory-server-text">' + _e("Server to query") + '</div>' + 
23                         
24                         '<input name="directory-server-input" class="directory-server-input" value="' + encodeQuotes(HOST_VJUD) + '" />' + 
25                 '</div>' + 
26                 
27                 '<div class="results directory-results"></div>' + 
28         '</div>' + 
29         
30         '<div class="bottom">' + 
31                 '<div class="wait wait-medium"></div>' + 
32                 
33                 '<a href="#" class="finish">' + _e("Close") + '</a>' + 
34         '</div>';
35         
36         // Create the popup
37         createPopup('directory', html);
38         
39         // Associate the events
40         launchDirectory();
41         
42         // Start a search!
43         startDirectory();
44         
45         return false;
46 }
47
48 // Quits the directory popup
49 function closeDirectory() {
50         // Destroy the popup
51         destroyPopup('directory');
52         
53         return false;
54 }
55
56 // Launches a directory search
57 function startDirectory() {
58         // Get the server to query
59         var server = $('#directory .directory-server-input').val();
60         
61         // Launch the search!
62         dataForm($('#directory .directory-server-input').val(), 'search', '', '', 'directory');
63         
64         logThis('Directory search launched: ' + server);
65         
66         return false;
67 }
68
69 // Plugin launcher
70 function launchDirectory() {
71         // Click event
72         $('#directory .bottom .finish').click(closeDirectory);
73         
74         // Keyboard event
75         $('#directory .directory-server-input').keyup(function(e) {
76                 if(e.keyCode == 13) {
77                         // No value?
78                         if(!$(this).val())
79                                 $(this).val(HOST_VJUD);
80                         
81                         // Start the directory search
82                         startDirectory();
83                         
84                         return false;
85                 }
86         });
87 }