1
YUI.add('lp.app.beta_features', function(Y) {
3
var namespace = Y.namespace('lp.app.beta_features');
5
var beta_notification_node = null;
8
* For unit tests - we need to reset the notification setup to run more than
11
namespace._reset_beta_notification = function () {
12
notification_node = null;
16
* Display beta feature notifications.
18
* This should be called after the page has loaded e.g. on 'domready'.
20
function display_beta_notification() {
21
if (LP.cache.beta_features.length === 0) {
25
var beta_features = LP.cache.beta_features;
26
var body = Y.one('body');
27
body.addClass('global-notification-visible');
28
var main = Y.one('#maincontent');
29
beta_notification_node = Y.Node.create('<div></div>')
30
.addClass('beta-banner');
31
main.appendChild(beta_notification_node);
32
var beta_warning = Y.Node.create(
33
'<span class="beta-warning">BETA</span>');
34
beta_notification_node.appendChild(beta_warning);
35
var close_box = Y.Node.create(
36
'<a href="#" class="global-notification-close">Hide' +
37
'<span class="notification-close sprite" /></a>');
38
beta_notification_node.appendChild(close_box);
39
beta_notification_node.append('Some parts of this page are in beta: ');
41
for (index = 0; index < beta_features.length; index++) {
42
var feature_name = beta_features[index][4];
43
var info_link = beta_features[index][5];
44
if (info_link.length > 0) {
46
' (<a href="' + info_link + '" class="info-link">' +
49
beta_notification_node.appendChild(Y.Node.create(
50
'<span class="beta-feature"> ' + feature_name + info_link +
53
close_box.on('click', function(e) {
55
var fade_out = new Y.Anim({
60
var body_space = new Y.Anim({
62
to: {'paddingTop': 0},
64
easing: Y.Easing.easeOut
66
var login_space = new Y.Anim({
67
node: '.login-logout',
70
easing: Y.Easing.easeOut
72
fade_out.on('end', function() {
73
fade_out.get('node').addClass('hidden');
75
body_space.on('end', function() {
76
Y.one('body').removeClass('global-notification-visible');
84
namespace.display_beta_notification = display_beta_notification;
86
}, "0.1", {"requires": ["base", "node", "anim"]});