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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 * @param {!number} year | 107 * @param {!number} year |
108 * @param {!number} month | 108 * @param {!number} month |
109 * @return {!string} | 109 * @return {!string} |
110 */ | 110 */ |
111 function formatJapaneseImperialEra(year, month) { | 111 function formatJapaneseImperialEra(year, month) { |
112 // We don't show an imperial era if it is greater than 99 becase of space | 112 // We don't show an imperial era if it is greater than 99 becase of space |
113 // limitation. | 113 // limitation. |
114 if (year > ImperialEraLimit) | 114 if (year > ImperialEraLimit) |
115 return ""; | 115 return ""; |
116 if (year > 1989) | 116 if (year > 1989) |
117 return "(平成" + localizeNumber(year - 1988) + "年)"; | 117 return "(\u5e73\u6210" + localizeNumber(year - 1988) + "\u5e74)"; |
118 if (year == 1989) | 118 if (year == 1989) |
119 return "(平成元年)"; | 119 return "(\u5e73\u6210\u5143\u5e74)"; |
120 if (year >= 1927) | 120 if (year >= 1927) |
121 return "(昭和" + localizeNumber(year - 1925) + "年)"; | 121 return "(\u662d\u548c" + localizeNumber(year - 1925) + "\u5e74)"; |
122 if (year > 1912) | 122 if (year > 1912) |
123 return "(大正" + localizeNumber(year - 1911) + "年)"; | 123 return "(\u5927\u6b63" + localizeNumber(year - 1911) + "\u5e74)"; |
124 if (year == 1912 && month >= 7) | 124 if (year == 1912 && month >= 7) |
125 return "(大正元年)"; | 125 return "(\u5927\u6b63\u5143\u5e74)"; |
126 if (year > 1868) | 126 if (year > 1868) |
127 return "(明治" + localizeNumber(year - 1867) + "年)"; | 127 return "(\u660e\u6cbb" + localizeNumber(year - 1867) + "\u5e74)"; |
128 if (year == 1868) | 128 if (year == 1868) |
129 return "(明治元年)"; | 129 return "(\u660e\u6cbb\u5143\u5e74)"; |
130 return ""; | 130 return ""; |
131 } | 131 } |
132 | 132 |
133 function createUTCDate(year, month, date) { | 133 function createUTCDate(year, month, date) { |
134 var newDate = new Date(0); | 134 var newDate = new Date(0); |
135 newDate.setUTCFullYear(year); | 135 newDate.setUTCFullYear(year); |
136 newDate.setUTCMonth(month); | 136 newDate.setUTCMonth(month); |
137 newDate.setUTCDate(date); | 137 newDate.setUTCDate(date); |
138 return newDate; | 138 return newDate; |
139 } | 139 } |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 if (yearString.length < 4) | 762 if (yearString.length < 4) |
763 yearString = ("000" + yearString).substr(-4, 4); | 763 yearString = ("000" + yearString).substr(-4, 4); |
764 return yearString + "-" + ("0" + (this.month + 1)).substr(-2, 2); | 764 return yearString + "-" + ("0" + (this.month + 1)).substr(-2, 2); |
765 }; | 765 }; |
766 | 766 |
767 /** | 767 /** |
768 * @return {!string} | 768 * @return {!string} |
769 */ | 769 */ |
770 Month.prototype.toLocaleString = function() { | 770 Month.prototype.toLocaleString = function() { |
771 if (global.params.locale === "ja") | 771 if (global.params.locale === "ja") |
772 return "" + this.year + "年" + formatJapaneseImperialEra(this.year, this.
month) + " " + (this.month + 1) + "月"; | 772 return "" + this.year + "\u5e74" + formatJapaneseImperialEra(this.year,
this.month) + " " + (this.month + 1) + "\u6708"; |
773 return window.pagePopupController.formatMonth(this.year, this.month); | 773 return window.pagePopupController.formatMonth(this.year, this.month); |
774 }; | 774 }; |
775 | 775 |
776 /** | 776 /** |
777 * @return {!string} | 777 * @return {!string} |
778 */ | 778 */ |
779 Month.prototype.toShortLocaleString = function() { | 779 Month.prototype.toShortLocaleString = function() { |
780 return window.pagePopupController.formatShortMonth(this.year, this.month); | 780 return window.pagePopupController.formatShortMonth(this.year, this.month); |
781 }; | 781 }; |
782 | 782 |
(...skipping 3318 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 |