Skip to content

Commit

Permalink
Add comments and fix/ignore a couple of issues
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Sep 24, 2021
1 parent 9d7c5a1 commit b0901d0
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/js/page/index.js
Expand Up @@ -2,4 +2,4 @@ import { trackFocusMethod } from './utils.js';
import MainController from './main-controller.js';

trackFocusMethod();
new MainController();
new MainController(); // eslint-disable-line no-new
2 changes: 1 addition & 1 deletion src/js/page/ui/code-output.js
Expand Up @@ -6,7 +6,7 @@ const prism = new Prism();
export default class CodeOutput {
constructor() {
this.container = strToEl(
'<div class="code-output">' + '<pre><code></code></pre>' + '</div>'
'<div class="code-output"><pre><code></code></pre></div>'
);
this._codeEl = this.container.querySelector('code');
}
Expand Down
3 changes: 2 additions & 1 deletion src/js/page/ui/file-drop.js
Expand Up @@ -27,7 +27,8 @@ export default class FileDrop {
}

_onDragEnter(event) {
// firefox double-fires on window enter, this works around it
// TODO: revisit this
// Firefox double-fires on window enter, this works around it
// https://bugzilla.mozilla.org/show_bug.cgi?id=1124645
if (this._currentEnteredElement === event.target) return;
this._currentEnteredElement = event.target;
Expand Down
1 change: 1 addition & 0 deletions src/js/page/ui/material-slider.js
Expand Up @@ -52,6 +52,7 @@ export default class MaterialSlider {
document.addEventListener('mouseup', upListener);
}

// eslint-disable-next-line accessor-pairs
set value(newValue) {
this.range.value = newValue;
this._update();
Expand Down
4 changes: 2 additions & 2 deletions src/js/page/ui/pan-zoom.js
Expand Up @@ -68,9 +68,9 @@ export default class PanZoom {
const boundingRect = this._target.getBoundingClientRect();
let delta = event.deltaY;

// 1 is "lines", 0 is "pixels"
// Firefox uses "lines" when mouse is connected
if (event.deltaMode === 1) {
// 1 is "lines", 0 is "pixels"
// Firefox uses "lines" when mouse is connected
delta *= 15;
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/page/ui/ripple.js
Expand Up @@ -7,7 +7,7 @@ export default class Ripple {

animate() {
this.container.classList.remove('animate');
this.container.offsetLeft;
this.container.offsetLeft; // eslint-disable-line no-unused-expressions
this.container.classList.add('animate');
}
}
2 changes: 1 addition & 1 deletion src/js/page/ui/settings.js
Expand Up @@ -53,8 +53,8 @@ export default class Settings {
_onMouseWheel(event) {
// Prevents bounce effect on desktop.
// Firefox uses DELTA_LINE on a mouse wheel, ignore it
// 0 is "pixels"
if (!event.deltaMode) {
// 0 is "pixels"
event.preventDefault();
event.currentTarget.scrollTop += event.deltaY;
}
Expand Down
2 changes: 2 additions & 0 deletions src/js/page/ui/svg-output.js
Expand Up @@ -8,6 +8,7 @@ export default class SvgOutput {
'<div class="svg-container">' +
'<iframe class="svg-frame" sandbox="allow-scripts" title="Loaded SVG file"></iframe>' +
'</div>' +
// TODO: revisit this
// Stop touches going into the iframe.
// pointer-events + touch + iframe doesn't work in Chrome :(
'<div class="svg-clickjacker"></div>' +
Expand All @@ -27,6 +28,7 @@ export default class SvgOutput {
}

setSvg(svgFile) {
// TODO: revisit this
// I would rather use blob urls, but they don't work in Firefox
// All the internal refs break.
// https://bugzilla.mozilla.org/show_bug.cgi?id=1125667
Expand Down
2 changes: 2 additions & 0 deletions src/js/prism-worker/index.js
@@ -1,5 +1,7 @@
// This needs to be an import so it executes before Prism
/* eslint-disable import/no-unassigned-import */
import './prism-config.js';
/* eslint-enable import/no-unassigned-import */
import Prism from 'prismjs';

self.onmessage = (event) => {
Expand Down
2 changes: 2 additions & 0 deletions src/js/sw/index.js
Expand Up @@ -45,6 +45,8 @@ addEventListener('activate', (event) => {
// remove caches beginning "svgomg-" that aren't in expectedCaches
for (const cacheName of await caches.keys()) {
if (!cacheName.startsWith(cachePrefix)) continue;
// TODO: switch to Promise.all
// eslint-disable-next-line no-await-in-loop
if (!expectedCaches.has(cacheName)) await caches.delete(cacheName);
}

Expand Down
2 changes: 2 additions & 0 deletions src/js/utils/storage.js
@@ -1,3 +1,4 @@
// eslint-disable-next-line import/no-mutable-exports
export let idbKeyval = (() => {
let db;

Expand Down Expand Up @@ -55,6 +56,7 @@ export let idbKeyval = (() => {
};
})();

// TODO: revisit this
// iOS add-to-homescreen is missing IDB, or at least it used to.
// I haven't tested this in a while.
if (!self.indexedDB) {
Expand Down

0 comments on commit b0901d0

Please sign in to comment.