Make contest banner a bit better

This commit is contained in:
cuom1999 2022-11-22 19:57:43 -06:00
parent f21de0f1e1
commit c2716348f3

View file

@ -118,8 +118,8 @@
return false; return false;
}); });
if (localStorage.getItem("contest_timer_pos")) { if (localStorage.getItem("contest_timer_position")) {
data = localStorage.getItem("contest_timer_pos").split(":"); data = localStorage.getItem("contest_timer_position").split(":");
$("#contest-info").css({ $("#contest-info").css({
left: data[0], left: data[0],
top: data[1] top: data[1]
@ -137,14 +137,13 @@
$(document).mousemove(function (e) { $(document).mousemove(function (e) {
x_pos = e.screenX; x_pos = e.screenX;
y_pos = e.screenY; y_pos = e.screenY;
x_pos = Math.max(Math.min(x_pos, window.innerWidth), 0);
y_pos = Math.max(Math.min(y_pos, window.innerHeight), 0);
if (selected !== null) { if (selected !== null) {
left_px = (x_pos - x_elem) + 'px'; left_px = (x_pos - x_elem);
top_px = (y_pos - y_elem) + 'px'; top_px = (y_pos - y_elem);
left_px = Math.max(Math.min(left_px, window.innerWidth), 0) / window.innerWidth * 100 + '%';
localStorage.setItem("contest_timer_pos", left_px + ":" + top_px); top_px = Math.max(Math.min(top_px, window.innerHeight), 0) / window.innerHeight * 100 + '%';
localStorage.setItem("contest_timer_position", left_px + ":" + top_px);
selected.css({ selected.css({
left: left_px, left: left_px,