aboutsummaryrefslogtreecommitdiff
path: root/webAO/utils
diff options
context:
space:
mode:
Diffstat (limited to 'webAO/utils')
-rw-r--r--webAO/utils/calculateApngLength.js6
-rw-r--r--webAO/utils/calculateGifLength.js2
-rw-r--r--webAO/utils/calculateWebpLength.js2
-rw-r--r--webAO/utils/fileExists.js6
-rw-r--r--webAO/utils/getAnimLength.js4
5 files changed, 14 insertions, 6 deletions
diff --git a/webAO/utils/calculateApngLength.js b/webAO/utils/calculateApngLength.js
index 6b9aed2..0a84d46 100644
--- a/webAO/utils/calculateApngLength.js
+++ b/webAO/utils/calculateApngLength.js
@@ -17,11 +17,11 @@ const calculateApngLength = (apngFile) => {
const delayDen = Number(d[i + 25]);
let delay;
// minimum is 100ms
- if (delayDen === 0)
+ if (delayDen === 0) {
delay = delayNum / 100;
- else
+ } else {
delay = delayNum / delayDen;
-
+ }
duration += delay;
}
}
diff --git a/webAO/utils/calculateGifLength.js b/webAO/utils/calculateGifLength.js
index ca0e1e1..3ed6aa4 100644
--- a/webAO/utils/calculateGifLength.js
+++ b/webAO/utils/calculateGifLength.js
@@ -1,3 +1,5 @@
+/* eslint no-bitwise: "off" */
+
/**
* Adds up the frame delays to find out how long a GIF is
* I totally didn't steal this
diff --git a/webAO/utils/calculateWebpLength.js b/webAO/utils/calculateWebpLength.js
index 1b422a0..ea7eb80 100644
--- a/webAO/utils/calculateWebpLength.js
+++ b/webAO/utils/calculateWebpLength.js
@@ -1,3 +1,5 @@
+/* eslint no-bitwise: "off" */
+
const calculateWebpLength = (webpFile) => {
const d = new Uint8Array(webpFile);
// https://developers.google.com/speed/webp/docs/riff_container#animation
diff --git a/webAO/utils/fileExists.js b/webAO/utils/fileExists.js
index 7978cbc..a4b3b80 100644
--- a/webAO/utils/fileExists.js
+++ b/webAO/utils/fileExists.js
@@ -1,7 +1,7 @@
-const fileExists = async (url) => new Promise((resolve, reject) => {
+const fileExists = async (url) => new Promise((resolve) => {
const xhr = new XMLHttpRequest();
xhr.open('HEAD', url);
- xhr.onload = function (e) {
+ xhr.onload = function checkLoad() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
resolve(true);
@@ -10,7 +10,7 @@ const fileExists = async (url) => new Promise((resolve, reject) => {
}
}
};
- xhr.onerror = function (e) {
+ xhr.onerror = function checkError() {
resolve(false);
};
xhr.send(null);
diff --git a/webAO/utils/getAnimLength.js b/webAO/utils/getAnimLength.js
index f9d793f..b33757a 100644
--- a/webAO/utils/getAnimLength.js
+++ b/webAO/utils/getAnimLength.js
@@ -1,3 +1,7 @@
+/* eslint no-await-in-loop: "warn" */
+/* eslint no-restricted-syntax: "off" */
+/* TODO: use promises for this */
+
import calculatorHandler from './calculatorHandler';
import fileExists from './fileExists';
import { requestBuffer } from '../services/request';