From e6ffb20911a55e8d61e949d017c9004538835573 Mon Sep 17 00:00:00 2001 From: Shane Tomlinson <stomlinson@mozilla.com> Date: Tue, 1 Nov 2011 12:55:33 +0000 Subject: [PATCH] Using class names to specifically say which elements to show after the authentication check. No longer depend on id's, class names work better for this case and reduce the JS logic. issue #510 --- resources/static/js/browserid.js | 14 +++++--------- resources/views/about.ejs | 2 +- resources/views/forgot.ejs | 2 +- resources/views/index.ejs | 4 ++-- resources/views/layout.ejs | 2 +- resources/views/privacy.ejs | 2 +- resources/views/signin.ejs | 2 +- resources/views/signup.ejs | 2 +- resources/views/tos.ejs | 2 +- resources/views/verifyemail.ejs | 2 +- resources/views/verifyuser.ejs | 2 +- 11 files changed, 16 insertions(+), 20 deletions(-) diff --git a/resources/static/js/browserid.js b/resources/static/js/browserid.js index 217e7cd03..0e6981865 100644 --- a/resources/static/js/browserid.js +++ b/resources/static/js/browserid.js @@ -78,24 +78,20 @@ $(function() { }); }); - $("#vAlign,#content").hide(); + $(".display_always,.display_auth,.display_nonauth").hide(); var ANIMATION_TIME = 500; user.checkAuthentication(function(authenticated) { + $(".display_always").fadeIn(ANIMATION_TIME); + if (authenticated) { - $("#content").fadeIn(ANIMATION_TIME); + $(".display_auth").fadeIn(ANIMATION_TIME); if ($('#emailList').length) { bid.manageAccount(); } } else { - // If vAlign exists (main page), it takes precedence over content. - if( $("#vAlign").length) { - $("#vAlign").fadeIn(ANIMATION_TIME); - } - else { - $("#content").fadeIn(ANIMATION_TIME); - } + $(".display_nonauth").fadeIn(ANIMATION_TIME); } }); diff --git a/resources/views/about.ejs b/resources/views/about.ejs index f8bd46c0a..3bfe7009d 100644 --- a/resources/views/about.ejs +++ b/resources/views/about.ejs @@ -1,4 +1,4 @@ -<div id="content"> +<div id="content" class="display_always"> <div id="about"> <div class="video"> diff --git a/resources/views/forgot.ejs b/resources/views/forgot.ejs index b280f3f46..7772a13f2 100644 --- a/resources/views/forgot.ejs +++ b/resources/views/forgot.ejs @@ -1,4 +1,4 @@ -<div id="vAlign"> +<div id="vAlign" class="display_always"> <div id="signUpFormWrap"> <!-- XXX this form submits to nowhere --> <form id="signUpForm" class="cf authform"> diff --git a/resources/views/index.ejs b/resources/views/index.ejs index 74922b301..6873159af 100644 --- a/resources/views/index.ejs +++ b/resources/views/index.ejs @@ -1,4 +1,4 @@ - <div id="content" style="display:none"> + <div id="content" style="display:none" class="display_auth"> <div id="manage"> <h1 class="serif">Account Manager</h1> <div class="edit cf"> @@ -13,7 +13,7 @@ </div> </div> - <div id="vAlign"> + <div id="vAlign" class="display_nonauth"> <div id="signUp"> <div id="card"><img src="/i/slit.png"></div> <div id="hint"></div> diff --git a/resources/views/layout.ejs b/resources/views/layout.ejs index 57f5a92fa..c8009278c 100644 --- a/resources/views/layout.ejs +++ b/resources/views/layout.ejs @@ -8,7 +8,7 @@ <![endif]--> <link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,400italic,700,700italic' rel='stylesheet' type='text/css'> <script src="/vepbundle" type="text/javascript"></script> - <% if (true || production) { %> + <% if (production) { %> <link rel="stylesheet" type="text/css" href="/css/browserid.min.css"> <script src="/js/lib.min.js" type="text/javascript"></script> <% } else { %> diff --git a/resources/views/privacy.ejs b/resources/views/privacy.ejs index 8d7188a2a..07b662d19 100644 --- a/resources/views/privacy.ejs +++ b/resources/views/privacy.ejs @@ -1,4 +1,4 @@ -<div id="content"> +<div id="content" class="display_always"> <div id="legal"> <h2>Privacy & BrowserID</h2> diff --git a/resources/views/signin.ejs b/resources/views/signin.ejs index 0f37b0935..bb742f992 100644 --- a/resources/views/signin.ejs +++ b/resources/views/signin.ejs @@ -1,4 +1,4 @@ -<div id="vAlign"> +<div id="vAlign" class="disply_always"> <div id="signUpFormWrap"> <!-- XXX this form submits to nowhere --> <form id="signUpForm" class="cf authform" novalidate> diff --git a/resources/views/signup.ejs b/resources/views/signup.ejs index 4b9d7efd1..6a21ae41a 100644 --- a/resources/views/signup.ejs +++ b/resources/views/signup.ejs @@ -1,4 +1,4 @@ -<div id="vAlign"> +<div id="vAlign" class="display_always"> <div id="signUpFormWrap"> <!-- XXX this form submits to nowhere --> <form id="signUpForm" class="cf authform" novalidate> diff --git a/resources/views/tos.ejs b/resources/views/tos.ejs index 53bae5ecb..fe33bca8d 100644 --- a/resources/views/tos.ejs +++ b/resources/views/tos.ejs @@ -1,4 +1,4 @@ -<div id="content"> +<div id="content" class="display_always"> <div id="legal"> <h2>Terms of Service — Overview</h2> diff --git a/resources/views/verifyemail.ejs b/resources/views/verifyemail.ejs index b4f4e0eb0..d9ee49385 100644 --- a/resources/views/verifyemail.ejs +++ b/resources/views/verifyemail.ejs @@ -1,4 +1,4 @@ -<div id="vAlign"> +<div id="vAlign" class="display_always"> <div id="signUpFormWrap"> <div id="signUpForm" class="cf"> <h1 class="serif">Email Verification</h1> diff --git a/resources/views/verifyuser.ejs b/resources/views/verifyuser.ejs index 3cca2c528..d3881d1d2 100644 --- a/resources/views/verifyuser.ejs +++ b/resources/views/verifyuser.ejs @@ -1,4 +1,4 @@ -<div id="vAlign"> +<div id="vAlign" class="display_always"> <div id="signUpFormWrap"> <ul class="notifications"> <li class="notification error" id="badtoken">There was a problem with your signup link. Has this address already been registered?</li> -- GitLab