]> git.mxchange.org Git - friendica.git/blob - view/theme/frio/js/mod_contacts.js
Merge remote-tracking branch 'upstream/develop' into aria
[friendica.git] / view / theme / frio / js / mod_contacts.js
1
2 var batchConfirmed = false;
3
4 $(document).ready(function() {
5         // Initiale autosize for the textareas.
6         autosize($("textarea.text-autosize"));
7
8
9         // Replace the drop contact link of the photo menu
10         // with a confirmation modal.
11         $("body").on("click", ".contact-photo-menu a", function(e) {
12                 var photoMenuLink = $(this).attr('href');
13                 if (typeof photoMenuLink !== "undefined" && photoMenuLink.indexOf("/drop?confirm=1") !== -1) {
14                         e.preventDefault();
15                         addToModal(photoMenuLink);
16                         return false;
17                 }
18         });
19
20 });
21
22 /**
23  * @brief This function submits the form with the batch action values.
24  *
25  * @param {string} name The name of the batch action.
26  * @param {string} value If it isn't empty the action will be posted.
27  * 
28  * @return {void}
29  */
30 function batch_submit_handler(name, value) {
31         if (confirm(value + " ?")) {
32                 // Set the value of the hidden input element with the name batch_submit.
33                 document.batch_actions_submit.batch_submit.value = value;
34                 // Change the name of the input element from batch_submit according to the
35                 // name which is transmitted to this function.
36                 document.batch_actions_submit.batch_submit.name = name;
37                 // Transmit the form.
38                 document.batch_actions_submit.submit();
39
40                 return true;
41         } else {
42                 return false;
43         }
44 }