friendica-github/view/theme/frio/js/mod_contacts.js

49 lines
1.4 KiB
JavaScript
Raw Normal View History

// SPDX-FileCopyrightText: 2010-2024 the Friendica project
//
// SPDX-License-Identifier: AGPL-3.0-or-later
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
2017-12-15 17:09:04 +00:00
var batchConfirmed = false;
2021-01-22 13:38:44 +00:00
$(document).ready(function () {
2017-12-15 17:09:04 +00:00
// Initiale autosize for the textareas.
autosize($("textarea.text-autosize"));
// Replace the drop contact link of the photo menu
// with a confirmation modal.
2021-01-22 13:38:44 +00:00
$("body").on("click", ".contact-photo-menu a", function (e) {
var photoMenuLink = $(this).attr("href");
2017-12-15 17:09:04 +00:00
if (typeof photoMenuLink !== "undefined" && photoMenuLink.indexOf("/drop?confirm=1") !== -1) {
e.preventDefault();
addToModal(photoMenuLink);
return false;
}
});
});
/**
2020-01-19 06:05:23 +00:00
* This function submits the form with the batch action values.
2017-12-15 17:09:04 +00:00
*
* @param {string} name The name of the batch action.
* @param {string} value If it isn't empty the action will be posted.
2021-01-22 13:38:44 +00:00
*
2017-12-15 17:09:04 +00:00
* @return {void}
*/
function batch_submit_handler(name, value) {
if (confirm(value + " ?")) {
// Set the value of the hidden input element with the name batch_submit.
document.batch_actions_submit.batch_submit.value = value;
// Change the name of the input element from batch_submit according to the
// name which is transmitted to this function.
document.batch_actions_submit.batch_submit.name = name;
// Transmit the form.
document.batch_actions_submit.submit();
return true;
} else {
return false;
}
}
// @license-end