summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorjamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-11 19:21:21 +0000
committerjamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-11 19:21:21 +0000
commit8445ced57bf8ec7de24558aa077d9c7f54a51f92 (patch)
treedc61b9f2f98b4c3ed3ca6253eb53c7310749b045 /remoting
parentba0f458131b5eb671087d964f4cf159503fabb81 (diff)
downloadchromium_src-8445ced57bf8ec7de24558aa077d9c7f54a51f92.zip
chromium_src-8445ced57bf8ec7de24558aa077d9c7f54a51f92.tar.gz
chromium_src-8445ced57bf8ec7de24558aa077d9c7f54a51f92.tar.bz2
Fixed mode header display bug and made our methods for hiding elements more consistent.
BUG= TEST= Review URL: http://codereview.chromium.org/7324034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92035 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/webapp/me2mom/choice.css4
-rw-r--r--remoting/webapp/me2mom/remoting.js49
2 files changed, 13 insertions, 40 deletions
diff --git a/remoting/webapp/me2mom/choice.css b/remoting/webapp/me2mom/choice.css
index 7efe829..eef223b 100644
--- a/remoting/webapp/me2mom/choice.css
+++ b/remoting/webapp/me2mom/choice.css
@@ -121,8 +121,8 @@ label {
*/
}
-.hidden {
- display: none;
+[hidden] {
+ display: none !important;
}
diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js
index 0b60575..f099a26 100644
--- a/remoting/webapp/me2mom/remoting.js
+++ b/remoting/webapp/me2mom/remoting.js
@@ -43,10 +43,6 @@ var kHostSecretLen = 5;
var kAccessCodeLen = kSupportIdLen + kHostSecretLen;
var kDigitsPerGroup = 4;
-function hasClass(element, cls) {
- return element.className.match(new RegExp('\\b' + cls + '\\b'));
-}
-
function retrieveEmail_(access_token) {
var headers = {
'Authorization': 'OAuth ' + remoting.oauth2.getAccessToken()
@@ -74,29 +70,6 @@ function refreshEmail_() {
}
}
-function addClass(element, cls) {
- if (!hasClass(element, cls))
- element.className = element.className + ' ' + cls;
-}
-
-function removeClass(element, cls) {
- element.className =
- element.className.replace(new RegExp('\\b' + cls + '\\b', 'g'), '');
-}
-
-function showElement(element, visible) {
- if (visible) {
- // Reset to default visibility.
- removeClass(element, 'hidden');
- } else {
- addClass(element, 'hidden');
- }
-}
-
-function showElementById(id, visible) {
- showElement(document.getElementById(id), visible);
-}
-
// This code moved into this subroutine (instead of being inlined in
// updateAuthStatus_() because of bug in V8.
// http://code.google.com/p/v8/issues/detail?id=1423
@@ -110,8 +83,8 @@ function updateControls_(disable) {
function updateAuthStatus_() {
var oauthValid = remoting.oauth2.isAuthenticated();
- showElementById('oauth2-token-button', !oauthValid);
- showElementById('oauth2-clear-button', oauthValid);
+ document.getElementById('oauth2-token-button').hidden = oauthValid;
+ document.getElementById('oauth2-clear-button').hidden = !oauthValid;
var loginName = getEmail();
if (loginName) {
@@ -160,7 +133,7 @@ remoting.clearOAuth2 = function() {
// Show the div with id |mode| and hide those with other ids in |modes|.
function setMode_(mode, modes) {
for (var i = 0; i < modes.length; ++i) {
- showElement(modes[i], mode == modes[i].id);
+ modes[i].hidden = (mode != modes[i].id);
}
}
@@ -187,8 +160,8 @@ remoting.init = function() {
remoting.setHostMode('unshared');
remoting.setClientMode('unconnected');
setGlobalMode(getAppStartupMode());
- addClass(document.getElementById('loading-mode'), 'hidden');
- removeClass(document.getElementById('choice-mode'), 'hidden');
+ document.getElementById('loading-mode').hidden = true;
+ document.getElementById('choice-mode').hidden = false;
}
function setGlobalMode(mode) {
@@ -214,12 +187,12 @@ function setGlobalMode(mode) {
// Hide first and then show since an element may be in both lists.
for (var i = 0; i < elementsToHide.length; ++i) {
- showElement(elementsToHide[i], false);
+ elementsToHide[i].hidden = true;
}
for (var i = 0; i < elementsToShow.length; ++i) {
- showElement(elementsToShow[i], true);
+ elementsToShow[i].hidden = false;
}
- showElement(document.getElementById('waiting-footer', false));
+ document.getElementById('waiting-footer').hidden = true;
remoting.currentMode = mode;
}
@@ -249,9 +222,9 @@ remoting.setClientMode = function(mode) {
}
function showWaiting_() {
- showElement(document.getElementById('client-footer-text'), false);
- showElement(document.getElementById('host-footer-text'), false);
- showElement(document.getElementById('waiting-footer'), true);
+ document.getElementById('client-footer-text').hidden = true;
+ document.getElementById('host-footer-text').hidden = true;
+ document.getElementById('waiting-footer').hidden = false;
document.getElementById('cancel-button').disabled = false;
}