1
1
YUI.add('lp.app.privacy', function(Y) {
3
3
var namespace = Y.namespace('lp.app.privacy');
5
var notification_node = null;
7
5
* Display privacy notifications
30
25
var id_selector = "#" + target_id;
31
26
var main = Y.one(id_selector);
32
notification_node = Y.Node.create('<div></div>')
27
var notification = Y.Node.create('<div></div>')
33
28
.addClass('global-notification');
35
notification_node.addClass('hidden');
30
notification.addClass('hidden');
37
32
var notification_span = Y.Node.create('<span></span>')
38
33
.addClass('sprite')
39
34
.addClass('notification-private');
40
notification_node.set('text', notification_text);
42
main.appendChild(notification_node);
43
notification_node.appendChild(notification_span);
35
var close_link = Y.Node.create('<a></a>')
36
.addClass('global-notification-close')
38
var close_span = Y.Node.create('<span></span>')
40
.addClass('notification-close');
42
notification.set('text', notification_text);
43
close_link.set('text', "Hide");
45
main.appendChild(notification);
46
notification.appendChild(notification_span);
47
notification.appendChild(close_link);
48
close_link.appendChild(close_span);
45
51
namespace.setup_privacy_notification = setup_privacy_notification;
48
* For unit tests - we need to reset the notification setup.
50
namespace._reset_privacy_notification = function () {
51
notification_node = null;
54
53
function display_privacy_notification() {
55
54
/* Set a temporary class on the body for the feature flag,
56
55
this is because we have no way to use feature flags in
61
60
/* Set the visible flag so that the content moves down. */
62
61
body.addClass('global-notification-visible');
64
setup_privacy_notification();
65
63
var global_notification = Y.one('.global-notification');
66
64
if (global_notification.hasClass('hidden')) {
67
65
global_notification.addClass('transparent');
98
101
* This should be called after the page has loaded e.g. on 'domready'.
100
103
function hide_privacy_notification() {
101
setup_privacy_notification();
102
104
if (!Y.one('.global-notification').hasClass('hidden')) {
103
105
var fade_out = new Y.Anim({
104
106
node: '.global-notification',