283
var notification_node = null;
285
* Display privacy notifications
287
* This should be called after the page has loaded e.g. on 'domready'.
289
function setup_privacy_notification(config) {
290
if (notification_node !== null) {
293
var notification_text = 'The information on this page is private';
295
var target_id = "loggerheadCont";
296
if (config !== undefined) {
297
if (config.notification_text !== undefined) {
298
notification_text = config.notification_text;
300
if (config.hidden !== undefined) {
301
hidden = config.hidden;
303
if (config.target_id !== undefined) {
304
target_id = config.target_id;
307
var id_selector = "#" + target_id;
308
var main = Y.get(id_selector);
309
notification_node = Y.Node.create('<div></div>')
310
.addClass('global-notification');
312
notification_node.addClass('hidden');
314
var notification_span = Y.Node.create('<span></span>')
316
.addClass('notification-private');
317
notification_node.set('innerHTML', notification_text);
318
main.appendChild(notification_node);
319
notification_node.appendChild(notification_span);
322
function display_privacy_notification() {
323
/* Set a temporary class on the body for the feature flag,
324
this is because we have no way to use feature flags in
325
css directly. This should be removed if the feature
327
var body = Y.get('body');
328
body.addClass('feature-flag-bugs-private-notification-enabled');
329
// Set the visible flag so that the content moves down.
330
body.addClass('global-notification-visible');
332
setup_privacy_notification();
333
var global_notification = Y.get('.global-notification');
334
if (global_notification.hasClass('hidden')) {
335
global_notification.addClass('transparent');
336
global_notification.removeClass('hidden');
338
var fade_in = new Y.Anim({
339
node: global_notification,
343
var body_space = new Y.Anim({
345
to: {'paddingTop': '40px'},
347
easing: Y.Easing.easeOut
349
var black_link_space = new Y.Anim({
353
easing: Y.Easing.easeOut
358
black_link_space.run();
362
Y.on('domready', function() {
363
var body = Y.get('body');
364
if (body.hasClass('private')) {
365
setup_privacy_notification();
366
display_privacy_notification();