mirror of
https://github.com/YunoHost-Apps/webtrees_ynh.git
synced 2024-09-03 18:26:37 +02:00
1 line
No EOL
2.1 KiB
JavaScript
1 line
No EOL
2.1 KiB
JavaScript
function setPrivacyFeedback(e,d,f){e=jQuery(e).closest(".form-group");f?(jQuery("."+d,e).addClass("label-success").removeClass("label-default"),jQuery("."+d+" i",e).addClass("fa-check").removeClass("fa-times")):(jQuery("."+d,e).addClass("label-default").removeClass("label-success"),jQuery("."+d+" i",e).addClass("fa-times").removeClass("fa-check"))}function updatePrivacyFeedback(){var g=parseInt(jQuery("[name=REQUIRE_AUTHENTICATION]").val(),10),f=parseInt(jQuery("[name=SHOW_DEAD_PEOPLE]").val(),10),j=parseInt(jQuery("[name=HIDE_LIVE_PEOPLE]").val(),10),i=parseInt(jQuery("[name=SHOW_LIVING_NAMES]").val(),10),h=parseInt(jQuery("[name=SHOW_PRIVATE_RELATIONSHIPS]").val(),10);setPrivacyFeedback("[name=REQUIRE_AUTHENTICATION]","visitors",0===g);setPrivacyFeedback("[name=REQUIRE_AUTHENTICATION]","members",!0);setPrivacyFeedback("[name=SHOW_DEAD_PEOPLE]","visitors",0===g&&(2<=f||0===j));setPrivacyFeedback("[name=SHOW_DEAD_PEOPLE]","members",1<=f||0===j);setPrivacyFeedback("[name=HIDE_LIVE_PEOPLE]","visitors",0===g&&0===j);setPrivacyFeedback("[name=HIDE_LIVE_PEOPLE]","members",!0);setPrivacyFeedback("[name=SHOW_LIVING_NAMES]","visitors",0===g&&2<=i);setPrivacyFeedback("[name=SHOW_LIVING_NAMES]","members",1<=i);setPrivacyFeedback("[name=SHOW_LIVING_NAMES]","managers",0<=i);setPrivacyFeedback("[name=SHOW_PRIVATE_RELATIONSHIPS]","visitors",0===g&&1<=h);setPrivacyFeedback("[name=SHOW_PRIVATE_RELATIONSHIPS]","members",1<=h)}function checkGedcomImportForm(e){var d=jQuery("#gedcom_filename").val(),f="replace_import"===jQuery("input[name=action]:checked").val()?jQuery("#import-server-file").val():jQuery("#import-computer-file").val(),f=f.replace(/.*[\/\\]/,"");return f!==d&&""!==d?confirm(e):!0}jQuery(document).ready(function(){updatePrivacyFeedback();jQuery("[name=REQUIRE_AUTHENTICATION], [name=HIDE_LIVE_PEOPLE], [name=SHOW_DEAD_PEOPLE], [name=SHOW_LIVING_NAMES], [name=SHOW_PRIVATE_RELATIONSHIPS]").on("change",function(){updatePrivacyFeedback()});jQuery("#import-server-file").on("focus",function(){jQuery("#import-server").prop("checked",!0)});jQuery("#import-computer-file").on("focus",function(){jQuery("#import-computer").prop("checked",!0)})}); |