]> git.mxchange.org Git - friendica.git/blob - view/theme/frio/js/mod_contacts.js
Merge pull request #10819 from MrPetovan/task/refactor-notifications
[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         // 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  * This function submits the form with the batch action values.
23  *
24  * @param {string} name The name of the batch action.
25  * @param {string} value If it isn't empty the action will be posted.
26  *
27  * @return {void}
28  */
29 function batch_submit_handler(name, value) {
30         if (confirm(value + " ?")) {
31                 // Set the value of the hidden input element with the name batch_submit.
32                 document.batch_actions_submit.batch_submit.value = value;
33                 // Change the name of the input element from batch_submit according to the
34                 // name which is transmitted to this function.
35                 document.batch_actions_submit.batch_submit.name = name;
36                 // Transmit the form.
37                 document.batch_actions_submit.submit();
38
39                 return true;
40         } else {
41                 return false;
42         }
43 }
44 // @license-end