Bug 346292 Keyboard navigation issues in view/minimonth after switching to different view, r=dmose

This commit is contained in:
jminta%gmail.com 2006-08-01 03:09:48 +00:00
Родитель a84439d09d
Коммит a16910c41b
3 изменённых файлов: 49 добавлений и 80 удалений

Просмотреть файл

@ -266,3 +266,51 @@ function updateStyleSheetForObject(aObject, aSheet) {
ruleUpdaterFunc(rule);
}
/**
* Sets the selected day in the minimonth to the currently selected day
* in the embedded view.
*/
function observeViewDaySelect(event) {
var date = event.detail;
var jsDate = new Date(date.year, date.month, date.day);
// for the month and multiweek view find the main month,
// which is the month with the most visible days in the view;
// note, that the main date is the first day of the main month
var jsMainDate;
if (!event.originalTarget.supportsDisjointDates) {
var mainDate = null;
var maxVisibleDays = 0;
var startDay = currentView().startDay;
var endDay = currentView().endDay;
var firstMonth = startDay.startOfMonth;
var lastMonth = endDay.startOfMonth;
for (var month = firstMonth.clone(); month.compare(lastMonth) <= 0; month.month += 1, month.normalize()) {
var visibleDays = 0;
if (month.compare(firstMonth) == 0) {
visibleDays = startDay.endOfMonth.day - startDay.day + 1;
} else if (month.compare(lastMonth) == 0) {
visibleDays = endDay.day;
} else {
visibleDays = month.endOfMonth.day;
}
if (visibleDays > maxVisibleDays) {
mainDate = month.clone();
maxVisibleDays = visibleDays;
}
}
jsMainDate = new Date(mainDate.year, mainDate.month, mainDate.day);
}
getMinimonth().selectDate(jsDate, jsMainDate);
currentView().focus();
}
/** Provides a neutral way to get the minimonth, regardless of whether we're in
* Sunbird or Lightning.
*/
function getMinimonth() {
var sbMinimonth = document.getElementById("lefthandcalendar");
return sbMinimonth || document.getElementById("ltnMinimonth");
}

Просмотреть файл

@ -93,45 +93,6 @@ function ltnMinimonthPick(minimonth)
currentView().goToDay(cdt);
}
/** Sets the selected day in the minimonth to the currently selected day
in the embedded view.
*/
function ltnObserveViewDaySelect(event) {
var date = event.detail;
var jsDate = new Date(date.year, date.month, date.day);
// for the month and multiweek view find the main month,
// which is the month with the most visible days in the view;
// note, that the main date is the first day of the main month
var jsMainDate;
if (!event.originalTarget.supportsDisjointDates) {
var mainDate = null;
var maxVisibleDays = 0;
var startDay = currentView().startDay;
var endDay = currentView().endDay;
var firstMonth = startDay.startOfMonth;
var lastMonth = endDay.startOfMonth;
for (var month = firstMonth.clone(); month.compare(lastMonth) <= 0; month.month += 1, month.normalize()) {
var visibleDays = 0;
if (month.compare(firstMonth) == 0) {
visibleDays = startDay.endOfMonth.day - startDay.day + 1;
} else if (month.compare(lastMonth) == 0) {
visibleDays = endDay.day;
} else {
visibleDays = month.endOfMonth.day;
}
if (visibleDays > maxVisibleDays) {
mainDate = month.clone();
maxVisibleDays = visibleDays;
}
}
jsMainDate = new Date(mainDate.year, mainDate.month, mainDate.day);
}
document.getElementById("ltnMinimonth").selectDate(jsDate, jsMainDate);
}
function ltnOnLoad(event)
{
gMiniMonthLoading = true;
@ -171,7 +132,7 @@ function ltnOnLoad(event)
.addEventListener("unload", ltnFinish, false);
document.getElementById("displayDeck")
.addEventListener("dayselect", ltnObserveViewDaySelect, false);
.addEventListener("dayselect", observeViewDaySelect, false);
// Make sure we update ourselves if the program stays open over midnight
scheduleMidnightUpdate(refreshUIBits);

Просмотреть файл

@ -568,43 +568,3 @@ function openLocalCalendar() {
openCalendar.name = name;
}
/** Sets the selected day in the minimonth to the currently selected day
in the embedded view.
*/
function observeViewDaySelect(event) {
var date = event.detail;
var jsDate = new Date(date.year, date.month, date.day);
// for the month and multiweek view find the main month,
// which is the month with the most visible days in the view;
// note, that the main date is the first day of the main month
var jsMainDate;
if (!event.originalTarget.supportsDisjointDates) {
var mainDate = null;
var maxVisibleDays = 0;
var currentView = document.getElementById("view-deck").selectedPanel;
var startDay = currentView.startDay;
var endDay = currentView.endDay;
var firstMonth = startDay.startOfMonth;
var lastMonth = endDay.startOfMonth;
for (var month = firstMonth.clone(); month.compare(lastMonth) <= 0; month.month += 1, month.normalize()) {
var visibleDays = 0;
if (month.compare(firstMonth) == 0) {
visibleDays = startDay.endOfMonth.day - startDay.day + 1;
} else if (month.compare(lastMonth) == 0) {
visibleDays = endDay.day;
} else {
visibleDays = month.endOfMonth.day;
}
if (visibleDays > maxVisibleDays) {
mainDate = month.clone();
maxVisibleDays = visibleDays;
}
}
jsMainDate = new Date(mainDate.year, mainDate.month, mainDate.day);
}
document.getElementById("lefthandcalendar").selectDate(jsDate, jsMainDate);
}