| OLD | NEW |
| 1 "use strict"; | 1 "use strict"; |
| 2 /* | 2 /* |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 Friday: 5, | 42 Friday: 5, |
| 43 Saturday: 6 | 43 Saturday: 6 |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * @type {Object} | 47 * @type {Object} |
| 48 */ | 48 */ |
| 49 var global = { | 49 var global = { |
| 50 picker: null, | 50 picker: null, |
| 51 params: { | 51 params: { |
| 52 locale: "en_US", | 52 locale: "en-US", |
| 53 weekStartDay: WeekDay.Sunday, | 53 weekStartDay: WeekDay.Sunday, |
| 54 dayLabels: ["S", "M", "T", "W", "T", "F", "S"], | 54 dayLabels: ["S", "M", "T", "W", "T", "F", "S"], |
| 55 shortMonthLabels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug
", "Sept", "Oct", "Nov", "Dec"], | 55 shortMonthLabels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug
", "Sept", "Oct", "Nov", "Dec"], |
| 56 isLocaleRTL: false, | 56 isLocaleRTL: false, |
| 57 mode: "date", | 57 mode: "date", |
| 58 weekLabel: "Week", | 58 weekLabel: "Week", |
| 59 anchorRectInScreen: new Rectangle(0, 0, 0, 0), | 59 anchorRectInScreen: new Rectangle(0, 0, 0, 0), |
| 60 currentValue: null | 60 currentValue: null |
| 61 } | 61 } |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // ---------------------------------------------------------------- | 64 // ---------------------------------------------------------------- |
| 65 // Utility functions | 65 // Utility functions |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * @return {!boolean} | 68 * @return {!boolean} |
| 69 */ | 69 */ |
| 70 function hasInaccuratePointingDevice() { | 70 function hasInaccuratePointingDevice() { |
| 71 return matchMedia("(pointer: coarse)").matches; | 71 return matchMedia("(pointer: coarse)").matches; |
| 72 } | 72 } |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * @return {!string} lowercase locale name. e.g. "en-us" | 75 * @return {!string} lowercase locale name. e.g. "en-us" |
| 76 */ | 76 */ |
| 77 function getLocale() { | 77 function getLocale() { |
| 78 return (global.params.locale || "en-us").toLowerCase().replace(/_/g, '-'); | 78 return global.params.locale || "en-us"; |
| 79 } | 79 } |
| 80 | 80 |
| 81 /** | 81 /** |
| 82 * @return {!string} lowercase language code. e.g. "en" | 82 * @return {!string} lowercase language code. e.g. "en" |
| 83 */ | 83 */ |
| 84 function getLanguage() { | 84 function getLanguage() { |
| 85 var locale = getLocale(); | 85 var locale = getLocale(); |
| 86 var result = locale.match(/^([a-z]+)/); | 86 var result = locale.match(/^([a-z]+)/); |
| 87 if (!result) | 87 if (!result) |
| 88 return "en"; | 88 return "en"; |
| (...skipping 4012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4101 event.stopPropagation(); | 4101 event.stopPropagation(); |
| 4102 event.preventDefault(); | 4102 event.preventDefault(); |
| 4103 } | 4103 } |
| 4104 }; | 4104 }; |
| 4105 | 4105 |
| 4106 if (window.dialogArguments) { | 4106 if (window.dialogArguments) { |
| 4107 initialize(dialogArguments); | 4107 initialize(dialogArguments); |
| 4108 } else { | 4108 } else { |
| 4109 window.addEventListener("message", handleMessage, false); | 4109 window.addEventListener("message", handleMessage, false); |
| 4110 } | 4110 } |
| OLD | NEW |