Index: remoting/webapp/me2mom/remoting.js |
diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js |
index 5ade16ecea3c97588bb7fed0147ef590056ea0e0..823686373b7344e0b1121d55be8dab8f31c8689f 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(/*i18n-content*/'TOOLTIP_SCALING'); |
// Create global objects. |
remoting.oauth2 = new remoting.OAuth2(); |
remoting.debug = |
@@ -597,11 +602,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); |
} |
/** |
@@ -640,4 +651,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; |