Skip to content

Commit 6f64978

Browse files
committed
Fix an issue with Hypo Grades
Hypo Grades may not be properly visible sometimes. This change helps to make the Hypo Grades feature more reliable. Signed-off-by: Gary Kim <[email protected]>
1 parent a68651e commit 6f64978

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/css/spse.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,15 @@ div.hypo-grade-div-fixed {
7777
right: 0;
7878
top: 20px;
7979
background: transparent;
80+
pointer-events: none;
81+
}
82+
.hypo-grade-div-fixed * {
83+
pointer-events: initial;
8084
}
8185
.tooltip.saspe .tooltiptext.saspe {
8286
visibility: hidden;
8387
background-color: black;
84-
width: 120px;
88+
width: 120px;
8589
color: #fff;
8690
text-align: center;
8791
padding: 5px 0;

src/js/saspowerschoolff.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,24 @@ function main_page() {
133133
hypo_grade_panel += `</table><br /><h3>With the above grades, semester GPA would be: <text id="hypo-gpa-number">${calculate_gpa(course_names,hypo_grades)}</text>.</h3></div>`;
134134
$(hypo_grade_div).appendTo('body');
135135
let hypo_grade_div_dom = $('div.hypo-grade-div');
136-
let hypo_grade_panel_dom = $(hypo_grade_panel).appendTo(hypo_grade_div_dom);
137-
let hypo_grade_panel_dom_width = hypo_grade_panel_dom.width() + 1;
136+
$(hypo_grade_panel).appendTo(hypo_grade_div_dom);
137+
138+
// TODO: Having a setTimeout is not elegant for this situation.
139+
let hypo_grade_panel_dom_width = 1000;
140+
setTimeout(() => {
141+
hypo_grade_panel_dom_width = document.querySelector('.hypo-grade-panel').offsetWidth + 1;
142+
hypo_grade_div_dom.css('left', hypo_grade_panel_dom_width);
143+
}, 500);
144+
145+
138146
let hypo_grade_open_dom = $('div.hypo-grade-open');
139-
hypo_grade_div_dom.css('left',hypo_grade_panel_dom_width);
140147
$('.hypo-grade-select').on('change', function( event ) {
141148
hypo_grades[$(event.currentTarget).attr('id')] = this.value;
142149
$('#hypo-gpa-number').html(calculate_gpa(course_names,hypo_grades));
143150
});
144151

145-
hypo_grade_open_dom.on('click', function(event) {
146-
if(currently_open) {
152+
hypo_grade_open_dom.on('click', function() {
153+
if(currently_open) {
147154
let hypo_grade_panel_dom = $('div.hypo-grade-panel');
148155

149156
hypo_grade_div_dom.css('left', hypo_grade_panel_dom_width);

0 commit comments

Comments
 (0)