New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposed fix for bug 873574 #10336

Closed
wants to merge 3 commits into
base: master
from
Jump to file or symbol
Failed to load files and symbols.
+82 −0
Diff settings

Always

Just for now

@@ -7,6 +7,8 @@ var AlarmList = {
alarmList: [],
refreshingAlarms: [],
_previousAlarmCount: 0,
_scrollTimeoutID: 0,
_scrollThreshold: 0,
get alarms() {
delete this.alarms;
@@ -23,6 +25,48 @@ var AlarmList = {
return this.newAlarmButton = document.getElementById('alarm-new');
},
showHideScrollIndicators: function al_showHideScrollIndicators() {
this._scrollTimeoutID = 0;
var element = this.alarms;
var hasTop = element.classList.contains('scroll-up');
var hasDown = element.classList.contains('scroll-down');
if (!this._scrollThreshold) {
var alarmCell = document.querySelector('.alarm-cell');
if (alarmCell) {
this._scrollThreshold =
alarmCell.getBoundingClientRect().height * 3 / 5;
}
}
if (element.scrollTop < this._scrollThreshold) {
if (hasTop) {
element.classList.remove('scroll-up');
}
} else {
if (!hasTop) {
element.classList.add('scroll-up');
}
}
if (element.scrollTop > element.scrollTopMax - this._scrollThreshold) {
if (hasDown) {
element.classList.remove('scroll-down');
}
} else {
if (!hasDown) {
element.classList.add('scroll-down');
}
}
},
handleScrollEvent: function al_handleScrollEvent() {
if (!this._scrollTimeoutID) {
this._scrollTimeoutID = setTimeout(
this.showHideScrollIndicators.bind(this), 150);
}
},
handleEvent: function al_handleEvent(evt) {
var link = evt.target;
@@ -59,6 +103,8 @@ var AlarmList = {
init: function al_init() {
this.newAlarmButton.addEventListener('click', this);
this.alarms.addEventListener('click', this);
this.alarms.addEventListener('scroll',
this.handleScrollEvent.bind(this));
this.refresh();
AlarmManager.regUpdateAlarmEnableState(this.refreshItem.bind(this));
},
@@ -123,6 +169,7 @@ var AlarmList = {
ClockView.resizeAnalogClock();
}
this.showHideScrollIndicators();
},
getAlarmFromList: function al_getAlarmFromList(id) {
View
@@ -93,6 +93,7 @@ body.hidden #alarm-view {
}
/* ----------- Alarm List ---------- */
#alarms {
width: 90%;
height: auto;
@@ -105,6 +106,40 @@ body.hidden #alarm-view {
background-image: none;
}
ul#alarms:before {
content: '';
pointer-events: none;
background: -moz-linear-gradient(bottom, rgba(16, 17, 17, 0) 0%, rgba(16, 17, 17, 1) 100%);
position: fixed;
width: 100%;
margin-left: -1.5em;
z-index: 10;
height: 6em;
margin-left: -1.5em;
opacity: 0;
}
ul#alarms.scroll-up:before {
opacity: 1;
}
ul#alarms:after {
content: '';
pointer-events: none;
background: -moz-linear-gradient(top, rgba(16, 17, 17, 0) 0%, rgba(16, 17, 17, 1) 100%);
position: fixed;
width: 100%;
height: 6em;
top: 100%;
margin-top: -6em;
margin-left: -1.5em;
opacity: 0;
}
ul#alarms.scroll-down:after {
opacity: 1;
}
ul#alarms li.alarm-cell { /* 6rem, including a 0.13rem border */
border-top: 1px solid rgba(115, 125, 128, 0.2);
position: relative;
ProTip! Use n and p to navigate between commits in a pull request.