Chromium Code Reviews| Index: remoting/webapp/me2mom/remoting.js |
| diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js |
| index acd1d1327eb2368a7be41cc799657ea62aa8249f..c348681fc8695e2563b43916a0966e32be8df182 100644 |
| --- a/remoting/webapp/me2mom/remoting.js |
| +++ b/remoting/webapp/me2mom/remoting.js |
| @@ -68,13 +68,16 @@ function hasClass(classes, cls) { |
| } |
| function addClass(element, cls) { |
| - if (!hasClass(element.className, cls)) |
| - element.className = element.className + ' ' + cls; |
| + if (!hasClass(element.className, cls)) { |
| + var padded = element.className == '' ? '' : element.className + ' '; |
| + element.className = padded + cls; |
| + } |
| } |
| function removeClass(element, cls) { |
| element.className = |
| - element.className.replace(new RegExp('\\b' + cls + '\\b', 'g'), ''); |
| + element.className.replace(new RegExp('\\b' + cls + '\\b', 'g'), '') |
| + .replace(' ', ' '); |
| } |
| function retrieveEmail_(access_token) { |
| @@ -143,6 +146,8 @@ remoting.toggleDebugLog = function() { |
| remoting.init = function() { |
| l10n.localize(); |
| + var button = document.getElementById('toggle-scaling'); |
| + button.title = chrome.i18n.getMessage(/*i18-content*/'TOOLTIP_SCALING'); |
|
garykac
2011/08/26 00:43:17
/*i18n-content*/
|
| // Create global objects. |
| remoting.oauth2 = new remoting.OAuth2(); |
| remoting.debug = |
| @@ -593,11 +598,17 @@ function isHostModeSupported() { |
| /** |
| * Enable or disable scale-to-fit. |
| * |
| + * @param {boolean} scale True to enable scaling. |
| * @return {void} Nothing. |
| */ |
| -remoting.toggleScaleToFit = function() { |
| +remoting.toggleScaleToFit = function(button) { |
| remoting.scaleToFit = !remoting.scaleToFit; |
| - remoting.session.toggleScaleToFit(remoting.scaleToFit); |
| + if (remoting.scaleToFit) { |
| + addClass(button, 'toggle-button-active'); |
| + } else { |
| + removeClass(button, 'toggle-button-active'); |
| + } |
| + remoting.session.setScaleToFit(remoting.scaleToFit); |
| } |
| /** |
| @@ -636,4 +647,4 @@ remoting.promptClose = function() { |
| }()); |
| // Shortcut to save typing now that this is the only way to show the debug log. |
| -var tdl = remoting.toggleDebugLog; |
| +var tdl = remoting.toggleDebugLog; |