diff options
Diffstat (limited to 'webAO')
| -rw-r--r-- | webAO/dom/toggleEffect.js | 3 | ||||
| -rw-r--r-- | webAO/dom/toggleElement.js | 7 | ||||
| -rw-r--r-- | webAO/ui.js | 4 | ||||
| -rw-r--r-- | webAO/utils/calculateApngLength.js | 6 | ||||
| -rw-r--r-- | webAO/utils/calculateGifLength.js | 2 | ||||
| -rw-r--r-- | webAO/utils/calculateWebpLength.js | 2 | ||||
| -rw-r--r-- | webAO/utils/fileExists.js | 6 | ||||
| -rw-r--r-- | webAO/utils/getAnimLength.js | 4 |
8 files changed, 23 insertions, 11 deletions
diff --git a/webAO/dom/toggleEffect.js b/webAO/dom/toggleEffect.js index 3d19c9c..699937b 100644 --- a/webAO/dom/toggleEffect.js +++ b/webAO/dom/toggleEffect.js @@ -1,3 +1,5 @@ +/* eslint no-param-reassign: ["error", +{ "props": true, "ignorePropertyModificationsFor": ["button"] }] */ /** * Highlights and selects an effect for in-character chat. * If the same effect button is selected, then the effect is canceled. @@ -11,3 +13,4 @@ export function toggleEffect(button) { } } window.toggleEffect = toggleEffect; +export default toggleEffect; diff --git a/webAO/dom/toggleElement.js b/webAO/dom/toggleElement.js index b5481e8..6d4c194 100644 --- a/webAO/dom/toggleElement.js +++ b/webAO/dom/toggleElement.js @@ -1,9 +1,9 @@ /** * Hides and shows any html element - * @param {string} element_id the id of the element to toggle + * @param {string} elementId the id of the element to toggle */ -export function toggleElement(element_id) { - const element = document.getElementById(element_id); +export function toggleElement(elementId) { + const element = document.getElementById(elementId); if (element.style.display !== 'none') { element.style.display = 'none'; } else { @@ -11,3 +11,4 @@ export function toggleElement(element_id) { } } window.toggleElement = toggleElement; +export default toggleElement; diff --git a/webAO/ui.js b/webAO/ui.js index 69d4905..dc3c342 100644 --- a/webAO/ui.js +++ b/webAO/ui.js @@ -1,3 +1,5 @@ +/* eslint no-param-reassign: ["error", +{ "props": true, "ignorePropertyModificationsFor": ["container"] }] */ import { GoldenLayout } from 'golden-layout'; const config = { @@ -68,7 +70,5 @@ const golden = new GoldenLayout(); golden.registerComponentFactoryFunction('template', (container, componentState) => { const template = document.querySelector(`#${componentState.id}`); container.element.innerHTML = template.innerHTML; - // TODO: support multiple locales - // container.setTitle(document.querySelector(`#${componentState.id} meta[name='frame-title']`).getAttribute("content")); }); golden.loadLayout(config); 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'; |
