Commit a02defc8 authored by Robert Knight's avatar Robert Knight

Enable Prettier for code other than PDF.js in dev-server/static/scripts/

We only want to exclude the vendored PDF.js code from Prettier formatting. The
other small scripts in dev-server/static/scripts/ should be formatted.
parent 5f239b1f
**/vendor/*
.*/**
build/
coverage/
docs/
dev-server/static/*
lib/
dev-server/static/scripts/pdfjs/*
/**
/**
* Because the code in this file is not transpiled by Babel, it must be compatible
* with all the supported browsers version (see `browserlist` in `package.json`)
* without transpilation. Do not include latest EcmaScript features as these
......@@ -24,11 +24,18 @@
};
// Set up links whose URLs should have a randomly generated suffix.
const randomizedLinks = Array.from(document.querySelectorAll('.js-randomize-url'));
const randomizedLinks = Array.from(
document.querySelectorAll('.js-randomize-url')
);
for (let link of randomizedLinks) {
const randomizeUrl = () => {
const randomHexString = Math.random().toString().slice(2 /* strip "0." prefix */, 6);
link.href = link.href.replace(/(\/rand-.*)?$/, `/rand-${randomHexString}`);
const randomHexString = Math.random()
.toString()
.slice(2 /* strip "0." prefix */, 6);
link.href = link.href.replace(
/(\/rand-.*)?$/,
`/rand-${randomHexString}`
);
};
randomizeUrl();
link.addEventListener('click', randomizeUrl);
......
/**
/**
* Because the code in this file is not transpiled by Babel, it must be compatible
* with all the supported browsers version (see `browserlist` in `package.json`)
* without transpilation. Do not include latest EcmaScript features as these
......@@ -27,7 +27,9 @@ function loadClient(clientUrl) {
* This uses the same method as the browser extension does to deactivate the client.
*/
function unloadClient() {
let annotatorLink = document.querySelector('link[type="application/annotator+html"]');
let annotatorLink = document.querySelector(
'link[type="application/annotator+html"]'
);
if (annotatorLink) {
annotatorLink.dispatchEvent(new Event('destroy'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment