1 function currentMonth() {
2 return popupWindow.global.picker.currentMonth().toString();
5 function availableDayCells() {
7 return Array.prototype.map.call(popupWindow.document.querySelectorAll(".day-cell:not(.disabled):not(.hidden)"), function(element) {
8 return element.$view.day.toString();
12 function highlightedDayCells() {
14 return Array.prototype.map.call(popupWindow.document.querySelectorAll(".day-cell.highlighted:not(.hidden)"), function(element) {
15 return element.$view.day.toString();
19 function selectedDayCells() {
21 return Array.prototype.map.call(popupWindow.document.querySelectorAll(".day-cell.selected:not(.hidden)"), function(element) {
22 return element.$view.day.toString();
26 function availableWeekNumberCells() {
28 return Array.prototype.map.call(popupWindow.document.querySelectorAll(".week-number-cell.highlighted:not(.hidden)"), function(element) {
29 return element.$view.day.toString();
33 function highlightedWeekNumberCells() {
35 return Array.prototype.map.call(popupWindow.document.querySelectorAll(".week-number-cell.highlighted:not(.hidden)"), function(element) {
36 return element.$view.day.toString();
40 function selectedWeekNumberCells() {
42 return Array.prototype.map.call(popupWindow.document.querySelectorAll(".week-number-cell.selected:not(.hidden)"), function(element) {
43 return element.$view.day.toString();
47 function highlightedValue() {
48 var highlight = popupWindow.global.picker.highlight();
50 return highlight.toString();
54 function selectedValue() {
55 var selection = popupWindow.global.picker.selection();
57 return selection.toString();
61 function skipAnimation() {
62 popupWindow.AnimationManager.shared._animationFrameCallback(Infinity);
65 function hoverOverDayCellAt(column, row) {
67 var offset = cumulativeOffset(popupWindow.global.picker.calendarTableView.element);
70 if (popupWindow.global.picker.calendarTableView.hasWeekNumberColumn)
71 x += popupWindow.WeekNumberCell.Width;
72 x += (column + 0.5) * popupWindow.DayCell.Width;
73 y += (row + 0.5) * popupWindow.DayCell.Height + popupWindow.CalendarTableHeaderView.Height;
74 eventSender.mouseMoveTo(x, y);
77 function clickDayCellAt(column, row) {
78 hoverOverDayCellAt(column, row);
79 eventSender.mouseDown();
80 eventSender.mouseUp();
83 function highlightedMonthButton() {
85 var year = popupWindow.global.picker.monthPopupView.yearListView.selectedRow + 1;
86 return Array.prototype.map.call(popupWindow.document.querySelectorAll(".month-button.highlighted"), function(element) {
87 return new popupWindow.Month(year, Number(element.dataset.month)).toString();
91 function skipAnimationAndGetPositionOfMonthPopupButton() {
93 var buttonElement = popupWindow.global.picker.calendarHeaderView.monthPopupButton.element;
94 var offset = cumulativeOffset(buttonElement);
95 return {x: offset[0] + buttonElement.offsetWidth / 2, y: offset[1] + buttonElement.offsetHeight / 2};
98 function hoverOverMonthPopupButton() {
99 var position = skipAnimationAndGetPositionOfMonthPopupButton();
100 eventSender.mouseMoveTo(position.x, position.y);
103 function clickMonthPopupButton() {
104 hoverOverMonthPopupButton();
105 eventSender.mouseDown();
106 eventSender.mouseUp();
109 function clickYearListCell(year) {
112 var rowCell = popupWindow.global.picker.monthPopupView.yearListView.cellAtRow(row);
114 var rowScrollOffset = popupWindow.global.picker.monthPopupView.yearListView.scrollOffsetForRow(row);
115 var scrollOffset = popupWindow.global.picker.monthPopupView.yearListView.scrollView.contentOffset();
116 var rowOffsetFromViewportTop = rowScrollOffset - scrollOffset;
118 var scrollViewOffset = cumulativeOffset(popupWindow.global.picker.monthPopupView.yearListView.scrollView.element);
119 var rowCellCenterX = scrollViewOffset[0] + rowCell.element.offsetWidth / 2;
120 var rowCellCenterY = scrollViewOffset[1] + rowOffsetFromViewportTop + rowCell.element.offsetHeight / 2;
121 eventSender.mouseMoveTo(rowCellCenterX, rowCellCenterY);
122 eventSender.mouseDown();
123 eventSender.mouseUp();
126 function skipAnimationAndGetPositionOfMonthButton(year, month) {
129 var rowCell = popupWindow.global.picker.monthPopupView.yearListView.cellAtRow(row);
131 var rowScrollOffset = popupWindow.global.picker.monthPopupView.yearListView.scrollOffsetForRow(row);
132 var scrollOffset = popupWindow.global.picker.monthPopupView.yearListView.scrollView.contentOffset();
133 var rowOffsetFromViewportTop = rowScrollOffset - scrollOffset;
135 var button = popupWindow.global.picker.monthPopupView.yearListView.buttonForMonth(new popupWindow.Month(year, month));
136 var buttonOffset = cumulativeOffset(button);
137 var rowCellOffset = cumulativeOffset(rowCell.element);
138 var buttonOffsetRelativeToRowCell = [buttonOffset[0] - rowCellOffset[0], buttonOffset[1] - rowCellOffset[1]];
140 var scrollViewOffset = cumulativeOffset(popupWindow.global.picker.monthPopupView.yearListView.scrollView.element);
141 var buttonCenterX = scrollViewOffset[0] + buttonOffsetRelativeToRowCell[0] + button.offsetWidth / 2;
142 var buttonCenterY = scrollViewOffset[1] + buttonOffsetRelativeToRowCell[1] + rowOffsetFromViewportTop + button.offsetHeight / 2;
143 return {x: buttonCenterX, y: buttonCenterY};
146 function hoverOverMonthButton(year, month) {
147 var position = skipAnimationAndGetPositionOfMonthButton(year, month);
148 eventSender.mouseMoveTo(position.x, position.y);
151 function clickMonthButton(year, month) {
152 hoverOverMonthButton(year, month);
153 eventSender.mouseDown();
154 eventSender.mouseUp();
157 var lastYearListViewScrollOffset = NaN;
158 function checkYearListViewScrollOffset() {
160 var scrollOffset = popupWindow.global.picker.monthPopupView.yearListView.scrollView.contentOffset();
161 var change = lastYearListViewScrollOffset - scrollOffset;
162 lastYearListViewScrollOffset = scrollOffset;
166 function isCalendarTableScrollingWithAnimation() {
167 var animator = popupWindow.global.picker.calendarTableView.scrollView.scrollAnimator();
170 return animator.isRunning();
173 function removeCommitDelay() {
174 popupWindow.CalendarPicker.commitDelayMs = 0;
177 function setNoCloseOnCommit() {
178 popupWindow.CalendarPicker.commitDelayMs = -1;