aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-07-12 00:48:40 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-07-12 00:48:40 +0200
commit3f6ad3d86c21f53951f08e0c82803d9228bc279e (patch)
treed0ec586cc6bdabef1645852a2745a2580282a464
parentMinor whitespace change. (diff)
downloadcalp-3f6ad3d86c21f53951f08e0c82803d9228bc279e.tar.gz
calp-3f6ad3d86c21f53951f08e0c82803d9228bc279e.tar.xz
Realized javascript had the Math "library".
-rw-r--r--static/script.js20
1 files changed, 4 insertions, 16 deletions
diff --git a/static/script.js b/static/script.js
index 19c2d44b..330e3935 100644
--- a/static/script.js
+++ b/static/script.js
@@ -70,8 +70,8 @@ function create_event_move (e) {
/* Create event when we start moving the mouse. */
if (! event) {
/* Small deadzone so tiny click and drags aren't registered */
- if (abs(event_start.x - e.clientX) < 10
- && abs(event_start.y - e.clientY) < 5)
+ if (Math.abs(event_start.x - e.clientX) < 10
+ && Math.abs(event_start.y - e.clientY) < 5)
{ return; }
/* only allow start of dragging on background */
@@ -113,9 +113,9 @@ function create_event_move (e) {
time1 = event.dataset.time1;
event.properties.dtstart =
- decimal_time_to_date(min(Number(time1), Number(time2)));
+ decimal_time_to_date(Math.min(Number(time1), Number(time2)));
event.properties.dtend =
- decimal_time_to_date(max(Number(time1), Number(time2)));
+ decimal_time_to_date(Math.max(Number(time1), Number(time2)));
}
function create_event_finisher (callback) {
@@ -210,18 +210,6 @@ function update_current_time_bar () {
= time_to_date(new Date) + ".html";
}
-function min(a, b) {
- return a < b ? a : b;
-}
-
-function max(a, b) {
- return a > b ? a : b;
-}
-
-function abs(n) {
- return n < 0 ? - n : n;
-}
-
function setVar(str, val) {
document.documentElement.style.setProperty("--" + str, val);
}