1
|
(function ($) {
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
Drupal.behaviors.trackingSettingsSummary = {
|
7
|
attach: function (context) {
|
8
|
|
9
|
if (typeof jQuery.fn.drupalSetSummary == 'undefined') {
|
10
|
return;
|
11
|
}
|
12
|
|
13
|
$('fieldset#edit-domain-tracking', context).drupalSetSummary(function (context) {
|
14
|
var $radio = $('input[name="piwik_domain_mode"]:checked', context);
|
15
|
if ($radio.val() == 0) {
|
16
|
return Drupal.t('A single domain');
|
17
|
}
|
18
|
else if ($radio.val() == 1) {
|
19
|
return Drupal.t('One domain with multiple subdomains');
|
20
|
}
|
21
|
});
|
22
|
|
23
|
$('fieldset#edit-page-vis-settings', context).drupalSetSummary(function (context) {
|
24
|
var $radio = $('input[name="piwik_visibility_pages"]:checked', context);
|
25
|
if ($radio.val() == 0) {
|
26
|
if (!$('textarea[name="piwik_pages"]', context).val()) {
|
27
|
return Drupal.t('Not restricted');
|
28
|
}
|
29
|
else {
|
30
|
return Drupal.t('All pages with exceptions');
|
31
|
}
|
32
|
}
|
33
|
else {
|
34
|
return Drupal.t('Restricted to certain pages');
|
35
|
}
|
36
|
});
|
37
|
|
38
|
$('fieldset#edit-role-vis-settings', context).drupalSetSummary(function (context) {
|
39
|
var vals = [];
|
40
|
$('input[type="checkbox"]:checked', context).each(function () {
|
41
|
vals.push($.trim($(this).next('label').text()));
|
42
|
});
|
43
|
if (!vals.length) {
|
44
|
return Drupal.t('Not restricted');
|
45
|
}
|
46
|
else if ($('input[name="piwik_visibility_roles"]:checked', context).val() == 1) {
|
47
|
return Drupal.t('Excepted: @roles', {'@roles' : vals.join(', ')});
|
48
|
}
|
49
|
else {
|
50
|
return vals.join(', ');
|
51
|
}
|
52
|
});
|
53
|
|
54
|
$('fieldset#edit-user-vis-settings', context).drupalSetSummary(function (context) {
|
55
|
var $radio = $('input[name="piwik_custom"]:checked', context);
|
56
|
if ($radio.val() == 0) {
|
57
|
return Drupal.t('Not customizable');
|
58
|
}
|
59
|
else if ($radio.val() == 1) {
|
60
|
return Drupal.t('On by default with opt out');
|
61
|
}
|
62
|
else {
|
63
|
return Drupal.t('Off by default with opt in');
|
64
|
}
|
65
|
});
|
66
|
|
67
|
$('fieldset#edit-linktracking', context).drupalSetSummary(function (context) {
|
68
|
var vals = [];
|
69
|
if ($('input#edit-piwik-track', context).is(':checked')) {
|
70
|
vals.push(Drupal.t('Outbound links'));
|
71
|
vals.push(Drupal.t('Downloads'));
|
72
|
}
|
73
|
if (!vals.length) {
|
74
|
return Drupal.t('Not tracked');
|
75
|
}
|
76
|
return Drupal.t('@items enabled', {'@items' : vals.join(', ')});
|
77
|
});
|
78
|
|
79
|
$('fieldset#edit-search', context).drupalSetSummary(function (context) {
|
80
|
var vals = [];
|
81
|
if ($('input#edit-piwik-site-search', context).is(':checked')) {
|
82
|
vals.push(Drupal.t('Site search'));
|
83
|
}
|
84
|
if (!vals.length) {
|
85
|
return Drupal.t('Not tracked');
|
86
|
}
|
87
|
return Drupal.t('@items enabled', {'@items' : vals.join(', ')});
|
88
|
});
|
89
|
|
90
|
$('fieldset#edit-privacy', context).drupalSetSummary(function (context) {
|
91
|
var vals = [];
|
92
|
if ($('input#edit-piwik-privacy-donottrack', context).is(':checked')) {
|
93
|
vals.push(Drupal.t('Universal web tracking opt-out'));
|
94
|
}
|
95
|
if (!vals.length) {
|
96
|
return Drupal.t('No privacy');
|
97
|
}
|
98
|
return Drupal.t('@items enabled', {'@items' : vals.join(', ')});
|
99
|
});
|
100
|
}
|
101
|
};
|
102
|
|
103
|
})(jQuery);
|