|
CalendarPicker.prototype.handleClear = function() {
a/Source/WebCore/Resources/pagepopups/calendarPicker.js_sec1
|
| 760 |
CalendarPicker.prototype.fixWindowSize = function() { |
760 |
CalendarPicker.prototype.fixWindowSize = function() { |
| 761 |
var yearMonthRightElement = this._element.getElementsByClassName(ClassNames.YearMonthButtonRight)[0]; |
761 |
var yearMonthRightElement = this._element.getElementsByClassName(ClassNames.YearMonthButtonRight)[0]; |
| 762 |
var daysAreaElement = this._element.getElementsByClassName(ClassNames.DaysArea)[0]; |
762 |
var daysAreaElement = this._element.getElementsByClassName(ClassNames.DaysArea)[0]; |
|
|
763 |
var clearButton = this._element.getElementsByClassName(ClassNames.ClearButton)[0]; |
| 763 |
var headers = daysAreaElement.getElementsByClassName(ClassNames.DayLabel); |
764 |
var headers = daysAreaElement.getElementsByClassName(ClassNames.DayLabel); |
| 764 |
var maxCellWidth = 0; |
765 |
var maxCellWidth = 0; |
| 765 |
for (var i = 1; i < headers.length; ++i) { |
766 |
for (var i = 1; i < headers.length; ++i) { |
|
CalendarPicker.prototype.fixWindowSize = function() {
a/Source/WebCore/Resources/pagepopups/calendarPicker.js_sec2
|
| 773 |
var DaysAreaContainerBorder = 1; |
774 |
var DaysAreaContainerBorder = 1; |
| 774 |
var yearMonthEnd; |
775 |
var yearMonthEnd; |
| 775 |
var daysAreaEnd; |
776 |
var daysAreaEnd; |
|
|
777 |
var todayClearAreaEnd; |
| 776 |
if (global.params.isLocaleRTL) { |
778 |
if (global.params.isLocaleRTL) { |
| 777 |
var startOffset = this._element.offsetLeft + this._element.offsetWidth; |
779 |
var startOffset = this._element.offsetLeft + this._element.offsetWidth; |
| 778 |
yearMonthEnd = startOffset - yearMonthRightElement.offsetLeft; |
780 |
yearMonthEnd = startOffset - yearMonthRightElement.offsetLeft; |
| 779 |
daysAreaEnd = startOffset - (daysAreaElement.offsetLeft + daysAreaElement.offsetWidth) + weekColumnWidth + maxCellWidth * 7 + DaysAreaContainerBorder; |
781 |
daysAreaEnd = startOffset - (daysAreaElement.offsetLeft + daysAreaElement.offsetWidth) + weekColumnWidth + maxCellWidth * 7 + DaysAreaContainerBorder; |
|
|
782 |
todayClearAreaEnd = startOffset - clearButton.offsetLeft; |
| 780 |
} else { |
783 |
} else { |
| 781 |
yearMonthEnd = yearMonthRightElement.offsetLeft + yearMonthRightElement.offsetWidth; |
784 |
yearMonthEnd = yearMonthRightElement.offsetLeft + yearMonthRightElement.offsetWidth; |
| 782 |
daysAreaEnd = daysAreaElement.offsetLeft + weekColumnWidth + maxCellWidth * 7 + DaysAreaContainerBorder; |
785 |
daysAreaEnd = daysAreaElement.offsetLeft + weekColumnWidth + maxCellWidth * 7 + DaysAreaContainerBorder; |
|
|
786 |
todayClearAreaEnd = clearButton.offsetLeft + clearButton.offsetWidth; |
| 783 |
} |
787 |
} |
| 784 |
var maxEnd = Math.max(yearMonthEnd, daysAreaEnd); |
788 |
var maxEnd = Math.max(yearMonthEnd, daysAreaEnd, todayClearAreaEnd); |
| 785 |
var MainPadding = 6; // FIXME: Fix name. |
789 |
var MainPadding = 10; // FIXME: Fix name. |
| 786 |
var MainBorder = 1; |
790 |
var MainBorder = 1; |
| 787 |
var desiredBodyWidth = maxEnd + MainPadding + MainBorder; |
791 |
var desiredBodyWidth = maxEnd + MainPadding + MainBorder * 2; |
| 788 |
|
792 |
|
| 789 |
var elementHeight = this._element.offsetHeight; |
793 |
var elementHeight = this._element.offsetHeight; |
| 790 |
this._element.style.width = "auto"; |
794 |
this._element.style.width = "auto"; |
|
YearMonthController.prototype.attachTo = function(element) {
a/Source/WebCore/Resources/pagepopups/calendarPicker.js_sec3
|
| 881 |
this._monthPopup.appendChild(this._monthPopupContents); |
885 |
this._monthPopup.appendChild(this._monthPopupContents); |
| 882 |
box.appendChild(this._monthPopup); |
886 |
box.appendChild(this._monthPopup); |
| 883 |
this._month = createElement("div", ClassNames.MonthSelector); |
887 |
this._month = createElement("div", ClassNames.MonthSelector); |
|
|
888 |
this._monthLabel = createElement("span"); |
| 889 |
this._month.appendChild(this._monthLabel); |
| 890 |
var disclosureTriangle = createElement("span"); |
| 891 |
disclosureTriangle.innerHTML = "<svg width='7' height='5'><polygon points='0,1 7,1 3.5,5' style='fill:#000000;' /></svg>"; |
| 892 |
this._month.appendChild(disclosureTriangle); |
| 884 |
this._month.addEventListener("click", this._showPopup.bind(this), false); |
893 |
this._month.addEventListener("click", this._showPopup.bind(this), false); |
| 885 |
box.appendChild(this._month); |
894 |
box.appendChild(this._month); |
| 886 |
|
895 |
|
|
YearMonthController.prototype.attachTo = function(element) {
a/Source/WebCore/Resources/pagepopups/calendarPicker.js_sec4
|
| 894 |
var month = this.picker.maximumMonth; |
903 |
var month = this.picker.maximumMonth; |
| 895 |
var maxWidth = 0; |
904 |
var maxWidth = 0; |
| 896 |
for (var m = 0; m < 12; ++m) { |
905 |
for (var m = 0; m < 12; ++m) { |
| 897 |
this._month.textContent = month.toLocaleString(); |
906 |
this._monthLabel.textContent = month.toLocaleString(); |
| 898 |
maxWidth = Math.max(maxWidth, this._month.offsetWidth); |
907 |
maxWidth = Math.max(maxWidth, this._month.offsetWidth); |
| 899 |
month = month.previous(); |
908 |
month = month.previous(); |
| 900 |
} |
909 |
} |
| 901 |
if (getLanguage() == "ja" && ImperialEraLimit < this.picker.maximumMonth.year) { |
910 |
if (getLanguage() == "ja" && ImperialEraLimit < this.picker.maximumMonth.year) { |
| 902 |
for (var m = 0; m < 12; ++m) { |
911 |
for (var m = 0; m < 12; ++m) { |
| 903 |
this._month.textContent = new Month(ImperialEraLimit, m).toLocaleString(); |
912 |
this._monthLabel.textContent = new Month(ImperialEraLimit, m).toLocaleString(); |
| 904 |
maxWidth = Math.max(maxWidth, this._month.offsetWidth); |
913 |
maxWidth = Math.max(maxWidth, this._month.offsetWidth); |
| 905 |
} |
914 |
} |
| 906 |
} |
915 |
} |
|
YearMonthController.prototype._attachLeftButtonsTo = function(parent) {
a/Source/WebCore/Resources/pagepopups/calendarPicker.js_sec5
|
| 919 |
parent.appendChild(container); |
928 |
parent.appendChild(container); |
| 920 |
|
929 |
|
| 921 |
if (YearMonthController.addTenYearsButtons) { |
930 |
if (YearMonthController.addTenYearsButtons) { |
| 922 |
this._left3 = createElement("input", ClassNames.YearMonthButton); |
931 |
this._left3 = createElement("button", ClassNames.YearMonthButton); |
| 923 |
this._left3.type = "button"; |
932 |
this._left3.textContent = "<<<"; |
| 924 |
this._left3.value = "<<<"; |
|
|
| 925 |
this._left3.addEventListener("click", this._handleButtonClick.bind(this), false); |
933 |
this._left3.addEventListener("click", this._handleButtonClick.bind(this), false); |
| 926 |
container.appendChild(this._left3); |
934 |
container.appendChild(this._left3); |
| 927 |
} |
935 |
} |
| 928 |
|
936 |
|
| 929 |
this._left2 = createElement("input", ClassNames.YearMonthButton); |
937 |
this._left2 = createElement("button", ClassNames.YearMonthButton); |
| 930 |
this._left2.type = "button"; |
938 |
this._left2.innerHTML = "<svg width='9' height='7'><polygon points='0,3.5 4,7 4,0' style='fill:#6e6e6e;' /><polygon points='5,3.5 9,7 9,0' style='fill:#6e6e6e;' /></svg>"; |
| 931 |
this._left2.value = "<<"; |
|
|
| 932 |
this._left2.addEventListener("click", this._handleButtonClick.bind(this), false); |
939 |
this._left2.addEventListener("click", this._handleButtonClick.bind(this), false); |
| 933 |
container.appendChild(this._left2); |
940 |
container.appendChild(this._left2); |
| 934 |
|
941 |
|
| 935 |
this._left1 = createElement("input", ClassNames.YearMonthButton); |
942 |
this._left1 = createElement("button", ClassNames.YearMonthButton); |
| 936 |
this._left1.type = "button"; |
943 |
this._left1.innerHTML = "<svg width='4' height='7'><polygon points='0,3.5 4,7 4,0' style='fill:#6e6e6e;' /></svg>"; |
| 937 |
this._left1.value = "<"; |
|
|
| 938 |
this._left1.addEventListener("click", this._handleButtonClick.bind(this), false); |
944 |
this._left1.addEventListener("click", this._handleButtonClick.bind(this), false); |
| 939 |
container.appendChild(this._left1); |
945 |
container.appendChild(this._left1); |
| 940 |
}; |
946 |
}; |
|
YearMonthController.prototype._attachLeftButtonsTo = function(parent) {
a/Source/WebCore/Resources/pagepopups/calendarPicker.js_sec6
|
| 945 |
YearMonthController.prototype._attachRightButtonsTo = function(parent) { |
951 |
YearMonthController.prototype._attachRightButtonsTo = function(parent) { |
| 946 |
var container = createElement("div", ClassNames.YearMonthButtonRight); |
952 |
var container = createElement("div", ClassNames.YearMonthButtonRight); |
| 947 |
parent.appendChild(container); |
953 |
parent.appendChild(container); |
| 948 |
this._right1 = createElement("input", ClassNames.YearMonthButton); |
954 |
this._right1 = createElement("button", ClassNames.YearMonthButton); |
| 949 |
this._right1.type = "button"; |
955 |
this._right1.innerHTML = "<svg width='4' height='7'><polygon points='0,7 0,0, 4,3.5' style='fill:#6e6e6e;' /></svg>"; |
| 950 |
this._right1.value = ">"; |
|
|
| 951 |
this._right1.addEventListener("click", this._handleButtonClick.bind(this), false); |
956 |
this._right1.addEventListener("click", this._handleButtonClick.bind(this), false); |
| 952 |
container.appendChild(this._right1); |
957 |
container.appendChild(this._right1); |
| 953 |
|
958 |
|
| 954 |
this._right2 = createElement("input", ClassNames.YearMonthButton); |
959 |
this._right2 = createElement("button", ClassNames.YearMonthButton); |
| 955 |
this._right2.type = "button"; |
960 |
this._right2.innerHTML = "<svg width='9' height='7'><polygon points='4,3.5 0,7 0,0' style='fill:#6e6e6e;' /><polygon points='9,3.5 5,7 5,0' style='fill:#6e6e6e;' /></svg>"; |
| 956 |
this._right2.value = ">>"; |
|
|
| 957 |
this._right2.addEventListener("click", this._handleButtonClick.bind(this), false); |
961 |
this._right2.addEventListener("click", this._handleButtonClick.bind(this), false); |
| 958 |
container.appendChild(this._right2); |
962 |
container.appendChild(this._right2); |
| 959 |
|
963 |
|
| 960 |
if (YearMonthController.addTenYearsButtons) { |
964 |
if (YearMonthController.addTenYearsButtons) { |
| 961 |
this._right3 = createElement("input", ClassNames.YearMonthButton); |
965 |
this._right3 = createElement("button", ClassNames.YearMonthButton); |
| 962 |
this._right3.type = "button"; |
966 |
this._right3.textContent = ">>>"; |
| 963 |
this._right3.value = ">>>"; |
|
|
| 964 |
this._right3.addEventListener("click", this._handleButtonClick.bind(this), false); |
967 |
this._right3.addEventListener("click", this._handleButtonClick.bind(this), false); |
| 965 |
container.appendChild(this._right3); |
968 |
container.appendChild(this._right3); |
| 966 |
} |
969 |
} |
|
YearMonthController.prototype.setMonth = function(month) {
a/Source/WebCore/Resources/pagepopups/calendarPicker.js_sec7
|
| 979 |
this._right2.disabled = !this.picker.shouldShowMonth(new Month(monthValue + 2)); |
982 |
this._right2.disabled = !this.picker.shouldShowMonth(new Month(monthValue + 2)); |
| 980 |
if (this._right3) |
983 |
if (this._right3) |
| 981 |
this._left3.disabled = !this.picker.shouldShowMonth(new Month(monthValue + 13)); |
984 |
this._left3.disabled = !this.picker.shouldShowMonth(new Month(monthValue + 13)); |
| 982 |
this._month.innerText = month.toLocaleString(); |
985 |
this._monthLabel.innerText = month.toLocaleString(); |
| 983 |
while (this._monthPopupContents.hasChildNodes()) |
986 |
while (this._monthPopupContents.hasChildNodes()) |
| 984 |
this._monthPopupContents.removeChild(this._monthPopupContents.firstChild); |
987 |
this._monthPopupContents.removeChild(this._monthPopupContents.firstChild); |
| 985 |
|
988 |
|
|
YearMonthController.NextTenYears = 120;
a/Source/WebCore/Resources/pagepopups/calendarPicker.js_sec8
|
| 1149 |
* @param {Event} event |
1152 |
* @param {Event} event |
| 1150 |
*/ |
1153 |
*/ |
| 1151 |
YearMonthController.prototype._handleButtonClick = function(event) { |
1154 |
YearMonthController.prototype._handleButtonClick = function(event) { |
| 1152 |
if (event.target == this._left3) |
1155 |
var button = enclosingNodeOrSelfWithClass(event.target, ClassNames.YearMonthButton); |
|
|
1156 |
if (button == this._left3) |
| 1153 |
this.moveRelatively(YearMonthController.PreviousTenYears); |
1157 |
this.moveRelatively(YearMonthController.PreviousTenYears); |
| 1154 |
else if (event.target == this._left2) { |
1158 |
else if (button == this._left2) { |
| 1155 |
this.picker.recordAction(CalendarPicker.Action.ClickedBackwardYearButton); |
1159 |
this.picker.recordAction(CalendarPicker.Action.ClickedBackwardYearButton); |
| 1156 |
this.moveRelatively(YearMonthController.PreviousYear); |
1160 |
this.moveRelatively(YearMonthController.PreviousYear); |
| 1157 |
} else if (event.target == this._left1) { |
1161 |
} else if (button == this._left1) { |
| 1158 |
this.picker.recordAction(CalendarPicker.Action.ClickedBackwardMonthButton); |
1162 |
this.picker.recordAction(CalendarPicker.Action.ClickedBackwardMonthButton); |
| 1159 |
this.moveRelatively(YearMonthController.PreviousMonth); |
1163 |
this.moveRelatively(YearMonthController.PreviousMonth); |
| 1160 |
} else if (event.target == this._right1) { |
1164 |
} else if (button == this._right1) { |
| 1161 |
this.picker.recordAction(CalendarPicker.Action.ClickedForwardMonthButton); |
1165 |
this.picker.recordAction(CalendarPicker.Action.ClickedForwardMonthButton); |
| 1162 |
this.moveRelatively(YearMonthController.NextMonth) |
1166 |
this.moveRelatively(YearMonthController.NextMonth) |
| 1163 |
} else if (event.target == this._right2) { |
1167 |
} else if (button == this._right2) { |
| 1164 |
this.picker.recordAction(CalendarPicker.Action.ClickedForwardYearButton); |
1168 |
this.picker.recordAction(CalendarPicker.Action.ClickedForwardYearButton); |
| 1165 |
this.moveRelatively(YearMonthController.NextYear); |
1169 |
this.moveRelatively(YearMonthController.NextYear); |
| 1166 |
} else if (event.target == this._right3) |
1170 |
} else if (button == this._right3) |
| 1167 |
this.moveRelatively(YearMonthController.NextTenYears); |
1171 |
this.moveRelatively(YearMonthController.NextTenYears); |
| 1168 |
else |
1172 |
else |
| 1169 |
return; |
1173 |
return; |