| OLD | NEW |
| 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. | 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. |
| 2 // limitations under the License. | 2 // limitations under the License. |
| 3 // See the License for the specific language governing permissions and | 3 // See the License for the specific language governing permissions and |
| 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 5 // distributed under the License is distributed on an "AS-IS" BASIS, | 5 // distributed under the License is distributed on an "AS-IS" BASIS, |
| 6 // Unless required by applicable law or agreed to in writing, software | 6 // Unless required by applicable law or agreed to in writing, software |
| 7 // | 7 // |
| 8 // http://www.apache.org/licenses/LICENSE-2.0 | 8 // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 // | 9 // |
| 10 // You may obtain a copy of the License at | 10 // You may obtain a copy of the License at |
| 11 // you may not use this file except in compliance with the License. | 11 // you may not use this file except in compliance with the License. |
| 12 // Licensed under the Apache License, Version 2.0 (the "License"); | 12 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 13 // | 13 // |
| 14 goog.provide('i18n.input.chrome.inputview.layouts.CompactSpaceRow'); | 14 goog.provide('i18n.input.chrome.inputview.layouts.CompactSpaceRow'); |
| 15 | 15 |
| 16 goog.require('i18n.input.chrome.inputview.ConditionName'); | 16 goog.require('i18n.input.chrome.inputview.ConditionName'); |
| 17 goog.require('i18n.input.chrome.inputview.layouts.util'); | 17 goog.require('i18n.input.chrome.inputview.layouts.util'); |
| 18 | 18 |
| 19 | 19 |
| 20 goog.scope(function() { |
| 21 var layouts = i18n.input.chrome.inputview.layouts; |
| 22 var util = layouts.util; |
| 23 |
| 24 |
| 20 /** | 25 /** |
| 21 * Creates the compact keyboard spaceKey row. | 26 * Creates the compact keyboard spaceKey row. |
| 22 * @param {boolean} isNordic True if the space key row is generated for compact | 27 * @param {boolean} isNordic True if the space key row is generated for compact |
| 23 * nordic layout. | 28 * nordic layout. |
| 24 * @return {!Object} The compact spaceKey row. | 29 * @return {!Object} The compact spaceKey row. |
| 25 */ | 30 */ |
| 26 i18n.input.chrome.inputview.layouts.CompactSpaceRow.create = function( | 31 layouts.CompactSpaceRow.create = function( |
| 27 isNordic) { | 32 isNordic) { |
| 28 var digitSwitcher = i18n.input.chrome.inputview.layouts.util.createKey({ | 33 var digitSwitcher = util.createKey({ |
| 29 'widthInWeight': 1.1 | 34 'widthInWeight': 1.078125 |
| 30 }); | 35 }); |
| 31 var globeOrSymbolKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 36 var globeOrSymbolKey = util.createKey({ |
| 32 'condition': i18n.input.chrome.inputview.ConditionName.SHOW_GLOBE_OR_SYMBOL, | 37 'condition': i18n.input.chrome.inputview.ConditionName.SHOW_GLOBE_OR_SYMBOL, |
| 33 'widthInWeight': 1 | 38 'widthInWeight': 1 |
| 34 }); | 39 }); |
| 35 var menuKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 40 var menuKey = util.createKey({ |
| 36 'condition': i18n.input.chrome.inputview.ConditionName.SHOW_MENU, | 41 'condition': i18n.input.chrome.inputview.ConditionName.SHOW_MENU, |
| 37 'widthInWeight': 1 | 42 'widthInWeight': 1 |
| 38 }); | 43 }); |
| 39 var slashKey = i18n.input.chrome.inputview.layouts.util.createKey({ | 44 var slashKey = util.createKey({ |
| 40 'widthInWeight': 1 | 45 'widthInWeight': 1 |
| 41 }); | 46 }); |
| 42 var space; | 47 var space = util.createKey({ |
| 43 if (isNordic) { | 48 'widthInWeight': 4 |
| 44 space = i18n.input.chrome.inputview.layouts.util.createKey({ | 49 }); |
| 45 'widthInWeight': 5 | 50 var comma = util.createKey({ |
| 46 }); | |
| 47 } else { | |
| 48 space = i18n.input.chrome.inputview.layouts.util.createKey({ | |
| 49 'widthInWeight': 4 | |
| 50 }); | |
| 51 } | |
| 52 var comma = i18n.input.chrome.inputview.layouts.util.createKey({ | |
| 53 'widthInWeight': 1 | 51 'widthInWeight': 1 |
| 54 }); | 52 }); |
| 55 var period = i18n.input.chrome.inputview.layouts.util.createKey({ | 53 var period = util.createKey({ |
| 56 'widthInWeight': 1 | 54 'widthInWeight': 1 |
| 57 }); | 55 }); |
| 58 var hide = i18n.input.chrome.inputview.layouts.util.createKey({ | 56 var hide = util.createKey({ |
| 59 'widthInWeight': 1.1 | 57 'widthInWeight': 1.078125 |
| 60 }); | 58 }); |
| 61 | 59 |
| 62 menuKey['spec']['giveWeightTo'] = space['spec']['id']; | 60 menuKey['spec']['giveWeightTo'] = space['spec']['id']; |
| 63 globeOrSymbolKey['spec']['giveWeightTo'] = space['spec']['id']; | 61 globeOrSymbolKey['spec']['giveWeightTo'] = space['spec']['id']; |
| 64 | 62 |
| 65 var spaceKeyRow = i18n.input.chrome.inputview.layouts.util. | 63 var spaceKeyRow = util.createLinearLayout({ |
| 66 createLinearLayout({ | 64 'id': 'spaceKeyrow', |
| 67 'id': 'spaceKeyrow', | 65 'children': [digitSwitcher, globeOrSymbolKey, menuKey, slashKey, space, |
| 68 'children': [digitSwitcher, globeOrSymbolKey, menuKey, slashKey, space, | 66 comma, period, hide] |
| 69 comma, period, hide] | 67 }); |
| 70 }); | |
| 71 return spaceKeyRow; | 68 return spaceKeyRow; |
| 72 }; | 69 }; |
| 70 |
| 71 }); // goog.scope |
| OLD | NEW |