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