Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Functions related to controlling the modal UI state of the app. UI states | 7 * Functions related to controlling the modal UI state of the app. UI states |
| 8 * are expressed as HTML attributes with a dotted hierarchy. For example, the | 8 * are expressed as HTML attributes with a dotted hierarchy. For example, the |
| 9 * string 'host.shared' will match any elements with an associated attribute | 9 * string 'host.shared' will match any elements with an associated attribute |
| 10 * of 'host' or 'host.shared', showing those elements and hiding all others. | 10 * of 'host' or 'host.shared', showing those elements and hiding all others. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 } | 112 } |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 /** | 115 /** |
| 116 * Get the major mode that the app is running in. | 116 * Get the major mode that the app is running in. |
| 117 * @return {string} The app's current major mode. | 117 * @return {string} The app's current major mode. |
| 118 */ | 118 */ |
| 119 remoting.getMajorMode = function() { | 119 remoting.getMajorMode = function() { |
| 120 return remoting.currentMode.split('.')[0]; | 120 return remoting.currentMode.split('.')[0]; |
| 121 }; | 121 }; |
| 122 | |
| 123 remoting.showOrHideIt2MeUi = function() { | |
| 124 var show = !!window.localStorage.getItem('it2me-visited'); | |
|
simonmorris
2012/03/29 16:34:38
It would be better to have constants for the names
simonmorris
2012/03/29 16:34:38
I think 'visited' is a clearer name for this varia
Jamie
2012/03/29 18:01:47
Done.
Jamie
2012/03/29 18:01:47
Yes, I didn't bother because all the uses are so c
| |
| 125 document.getElementById('it2me-first-run').hidden = show; | |
| 126 document.getElementById('it2me-content').hidden = !show; | |
| 127 }; | |
| 128 | |
| 129 remoting.showOrHideMe2MeUi = function() { | |
| 130 var show = !!window.localStorage.getItem('me2me-visited'); | |
| 131 document.getElementById('me2me-first-run').hidden = show; | |
| 132 document.getElementById('me2me-content').hidden = !show; | |
| 133 }; | |
| 134 | |
| 135 remoting.showIt2MeUiAndSave = function() { | |
| 136 window.localStorage.setItem('it2me-visited', true); | |
| 137 remoting.showOrHideIt2MeUi(); | |
| 138 }; | |
| 139 | |
| 140 remoting.showMe2MeUiAndSave = function() { | |
| 141 window.localStorage.setItem('me2me-visited', true); | |
| 142 remoting.showOrHideMe2MeUi(); | |
| 143 }; | |
| 144 | |
| 145 remoting.resetInfographics = function() { | |
| 146 window.localStorage.removeItem('it2me-visited'); | |
| 147 window.localStorage.removeItem('me2me-visited'); | |
| 148 remoting.showOrHideIt2MeUi(); | |
| 149 remoting.showOrHideMe2MeUi(); | |
| 150 } | |
| OLD | NEW |