5 * Provide the summary information for the tracking settings vertical tabs.
7 Drupal.behaviors.trackingSettingsSummary = {
8 attach: function (context) {
9 // Make sure this behavior is processed only if drupalSetSummary is defined.
10 if (typeof jQuery.fn.drupalSetSummary == 'undefined') {
14 $('fieldset#edit-page-vis-settings', context).drupalSetSummary(function (context) {
15 if (!$('textarea[name="googleanalytics_pages"]', context).val()) {
16 return Drupal.t('Not restricted');
19 return Drupal.t('Restricted to certain pages');
23 $('fieldset#edit-role-vis-settings', context).drupalSetSummary(function (context) {
25 $('input[type="checkbox"]:checked', context).each(function () {
26 vals.push($.trim($(this).next('label').text()));
29 vals.push(Drupal.t('Not restricted'));
31 return vals.join(', ');
34 $('fieldset#edit-user-vis-settings', context).drupalSetSummary(function (context) {
35 var $radio = $('input[name="googleanalytics_custom"]:checked', context);
36 if ($radio.val() == 0) {
37 return Drupal.t('Not customizable');
39 else if ($radio.val() == 1) {
40 return Drupal.t('On by default with opt out');
43 return Drupal.t('Off by default with opt in');
47 $('fieldset#edit-linktracking', context).drupalSetSummary(function (context) {
49 if ($('input#edit-googleanalytics-trackoutgoing', context).is(':checked')) {
50 vals.push('Outgoing links');
52 if ($('input#edit-googleanalytics-trackmailto', context).is(':checked')) {
53 vals.push('Mailto links');
55 if ($('input#edit-googleanalytics-trackfiles', context).is(':checked')) {
56 vals.push('Downloads');
59 return Drupal.t('Not tracked');
61 return Drupal.t('@items tracked', {'@items' : vals.join(', ')});
64 $('fieldset#edit-search-and-adsense', context).drupalSetSummary(function (context) {
66 if ($('input#edit-googleanalytics-site-search', context).is(':checked')) {
67 vals.push('Site search');
69 if ($('input#edit-googleanalytics-trackadsense', context).is(':checked')) {
70 vals.push('AdSense ads');
73 return Drupal.t('Not tracked');
75 return Drupal.t('@items tracked', {'@items' : vals.join(', ')});