]> git.mxchange.org Git - friendica-addons.git/blob - jappixmini/jappix/js/adhoc.js
Update strings
[friendica-addons.git] / jappixmini / jappix / js / adhoc.js
1 /*
2
3 Jappix - An open social platform
4 These are the Ad-Hoc JS scripts for Jappix
5
6 -------------------------------------------------
7
8 License: AGPL
9 Author: Vanaryon
10 Last revision: 11/07/11
11
12 */
13
14 // Opens the adhoc popup
15 function openAdHoc() {
16         // Popup HTML content
17         var html = 
18         '<div class="top">' + _e("Commands") + '</div>' + 
19         
20         '<div class="content">' + 
21                 '<div class="adhoc-head"></div>' + 
22                 
23                 '<div class="results adhoc-results"></div>' + 
24         '</div>' + 
25         
26         '<div class="bottom">' + 
27                 '<div class="wait wait-medium"></div>' + 
28                 
29                 '<a href="#" class="finish">' + _e("Close") + '</a>' + 
30         '</div>';
31         
32         // Create the popup
33         createPopup('adhoc', html);
34         
35         // Associate the events
36         launchAdHoc();
37         
38         return false;
39 }
40
41 // Quits the adhoc popup
42 function closeAdHoc() {
43         // Destroy the popup
44         destroyPopup('adhoc');
45         
46         return false;
47 }
48
49 // Retrieves an entity adhoc command
50 function retrieveAdHoc(xid) {
51         // Open the popup
52         openAdHoc();
53         
54         // Add a XID marker
55         $('#adhoc .adhoc-head').html('<b>' + getBuddyName(xid).htmlEnc() + '</b> (' + xid.htmlEnc() + ')');
56         
57         // Get the highest entity resource
58         var highest = getHighestResource(xid);
59         
60         if(highest)
61                 xid = highest;
62         
63         // Start a new adhoc command
64         dataForm(xid, 'command', '', '', 'adhoc');
65         
66         return false;
67 }
68
69 // Starts an adhoc command on the user server
70 function serverAdHoc(server) {
71         // Open the popup
72         openAdHoc();
73         
74         // Add a XID marker
75         $('#adhoc .adhoc-head').html('<b>' + server.htmlEnc() + '</b>');
76         
77         // Start a new adhoc command
78         dataForm(server, 'command', '', '', 'adhoc');
79 }
80
81 // Addon launcher
82 function launchAdHoc() {
83         // Click event
84         $('#adhoc .bottom .finish').click(closeAdHoc);
85 }