yii2-netdisk/web/js/admin-system.js
Chenx221 96c60d7bad
系统设置页现已支持设置Google analysis、Microsoft Clarify
*这两个分析服务的实际应用会在后续加入
2024-04-01 14:08:01 +08:00

39 lines
1.4 KiB
JavaScript

$(document).ready(function () {
updateTableRowVisibility();
$('#siteconfig-verifyprovider').change(function () {
updateTableRowVisibility();
});
$('#siteconfig-enableipinfo').change(function () {
updateTableRowVisibility();
});
$('#siteconfig-clarityenabled').change(function () {
updateTableRowVisibility();
});
$('#siteconfig-gaenabled').change(function () {
updateTableRowVisibility();
});
});
function updateTableRowVisibility() {
let currentValue = $('#siteconfig-verifyprovider').val();
let ipinfoEnable = $('#siteconfig-enableipinfo').prop('checked');
let clarityEnable = $('#siteconfig-clarityenabled').prop('checked');
let gaEnable = $('#siteconfig-gaenabled').prop('checked');
$('#tr-recaptchaSiteKey, #tr-recaptchaSecret, #tr-hcaptchaSiteKey, #tr-hcaptchaSecret, #tr-turnstileSiteKey, #tr-turnstileSecret,#tr-ipinfoToken,#tr-clarityId,#tr-gaId').hide();
if (currentValue === 'reCAPTCHA') {
$('#tr-recaptchaSiteKey, #tr-recaptchaSecret').show();
} else if (currentValue === 'hCaptcha') {
$('#tr-hcaptchaSiteKey, #tr-hcaptchaSecret').show();
} else if (currentValue === 'Turnstile') {
$('#tr-turnstileSiteKey, #tr-turnstileSecret').show();
}
if (ipinfoEnable) {
$('#tr-ipinfoToken').show();
}
if (clarityEnable) {
$('#tr-clarityId').show();
}
if (gaEnable) {
$('#tr-gaId').show();
}
}