
| Current Path : /var/www/html/rocksensor1/web/modules/contrib/visitors/js/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/modules/contrib/visitors/js/visitors.admin.js |
/**
* @file
* Visitors admin behaviors.
*/
(function visitorAdminForm(Drupal, $) {
/**
* Provide the summary information for the tracking settings vertical tabs.
*/
Drupal.behaviors.visitorsSettingsSummary = {
attach() {
// Make sure this behavior is processed only if drupalSetSummary is defined.
if (typeof jQuery.fn.drupalSetSummary === 'undefined') {
return;
}
$('#edit-page-visibility-settings').drupalSetSummary(
function pageVisibilitySummary(context) {
const $radio = $(
'input[name="visitors_visibility_request_path_mode"]:checked',
context,
);
if ($radio.val === '0') {
if (
!$(
'textarea[name="visitors_visibility_request_path_pages"]',
context,
).val
) {
return Drupal.t('Not restricted');
}
return Drupal.t('All pages with exceptions');
}
return Drupal.t('Restricted to certain pages');
},
);
$('#edit-role-visibility-settings').drupalSetSummary(
function roleVisibilitySummary(context) {
const vals = [];
$('input[type="checkbox"]:checked', context).each(
function roleCheckboxVisibility() {
const label = $(this).next('label');
vals.push(label.text());
},
);
if (!vals.length) {
return Drupal.t('Not restricted');
}
if (
$(
'input[name="visitors_visibility_user_role_mode"]:checked',
context,
).val === '1'
) {
return Drupal.t('Excepted: @roles', { '@roles': vals.join(', ') });
}
return vals.join(', ');
},
);
$('#edit-user-visibility-settings').drupalSetSummary(
function userVisibilitySummary(context) {
const radio = $(
'input[name="visitors_visibility_user_account_mode"]:checked',
context,
);
if (radio.val() === '0') {
return Drupal.t('Not customizable');
}
if (radio.val() === '1') {
return Drupal.t('On by default with opt out');
}
return Drupal.t('Off by default with opt in');
},
);
$('#edit-entity').drupalSetSummary(function entitySummary(context) {
const vals = [];
const counter = $('input#edit-counter-enabled', context);
if (!counter.is(':checked')) {
vals.push(Drupal.t('Disabled'));
}
if (!vals.length) {
return Drupal.t('Default');
}
return Drupal.t('@items', { '@items': vals.join(', ') });
});
$('#edit-retention').drupalSetSummary(function retentionSummary(context) {
const vals = [];
const logs = $('select[name="flush_log_timer"]', context);
// Get the text of the selected option.
const logText = logs.find('option:selected').text();
vals.push(Drupal.t('Logs: @log', { '@log': logText }));
const bots = $('select[name="bot_retention_log"]', context);
// Get the text of the selected option.
const botText = bots.find('option:selected').text();
vals.push(Drupal.t('Bots: @bot', { '@bot': botText }));
return Drupal.t('@items', { '@items': vals.join(', ') });
});
$('#edit-miscellaneous').drupalSetSummary(
function miscellaneousSummary(context) {
const vals = [];
const scriptType = $('input[name="script_type"]:checked', context);
if (scriptType.val() === 'full') {
vals.push(Drupal.t('Full'));
} else {
vals.push(Drupal.t('Minified'));
}
const items = $('select[name="items_per_page"]', context);
vals.push(Drupal.t('@count items', { '@count': items.val() }));
return Drupal.t('@items', { '@items': vals.join(', ') });
},
);
},
};
})(Drupal, jQuery);