Fix *most* linting/formatting issues in the test/resources/ folder

These changes were done automatically, by using the `gulp lint --fix` command.
This commit is contained in:
Jonas Jenwald 2021-08-04 13:59:21 +02:00
parent 99aa747a1d
commit 92300965a4
2 changed files with 226 additions and 139 deletions

View File

@ -35,7 +35,7 @@ Original author: L. David Baron <dbaron@dbaron.org>
} }
html { html {
background-color: #FFF; background-color: #fff;
font: message-box; font: message-box;
font-size: 14px; font-size: 14px;
} }
@ -48,7 +48,8 @@ a {
color: #000; color: #000;
} }
#loading, #viewer { #loading,
#viewer {
display: none; display: none;
} }
@ -88,8 +89,10 @@ a {
display: block; display: block;
} }
#itemtable, #itemtable td, #itemtable th { #itemtable,
border: 1px solid #CCC; #itemtable td,
#itemtable th {
border: 1px solid #ccc;
padding: 0; padding: 0;
} }
@ -108,7 +111,7 @@ a {
} }
#itemtable td.selected { #itemtable td.selected {
background-color: #DDD; background-color: #ddd;
} }
#magnification > svg { #magnification > svg {
@ -172,6 +175,7 @@ a {
margin-top: 1em; margin-top: 1em;
} }
#referenceImage, #differences { #referenceImage,
#differences {
margin: 0 0 10px 20px; margin: 0 0 10px 20px;
} }

View File

@ -40,10 +40,10 @@ window.gMagZoom = 16; // size of the zoomed in pixels
window.gImage1Data; // ImageData object for the test output image window.gImage1Data; // ImageData object for the test output image
window.gImage2Data; // ImageData object for the reference image window.gImage2Data; // ImageData object for the reference image
window.gFlashingPixels = []; // array of <path> objects that should be flashed due to pixel color mismatch window.gFlashingPixels = []; // array of <path> objects that should be flashed due to pixel color mismatch
window.gPath = ''; // path taken from #web= and prepended to ref/snp urls window.gPath = ""; // path taken from #web= and prepended to ref/snp urls
window.gSelected = null; // currently selected comparison window.gSelected = null; // currently selected comparison
window.onload = function() { window.onload = function () {
load(); load();
function ID(id) { function ID(id) {
@ -51,19 +51,19 @@ window.onload = function() {
} }
function hashParameters() { function hashParameters() {
var result = { }; const result = {};
var params = window.location.hash.substring(1).split(/[&;]/); const params = window.location.hash.substring(1).split(/[&;]/);
for (var i = 0; i < params.length; i++) { for (let i = 0; i < params.length; i++) {
var parts = params[i].split("="); const parts = params[i].split("=");
result[parts[0]] = unescape(unescape(parts[1])); result[parts[0]] = unescape(unescape(parts[1]));
} }
return result; return result;
} }
function load() { function load() {
gPhases = [ ID("entry"), ID("loading"), ID("viewer") ]; gPhases = [ID("entry"), ID("loading"), ID("viewer")];
buildMag(); buildMag();
var params = hashParameters(); const params = hashParameters();
if (params.log) { if (params.log) {
ID("logEntry").value = params.log; ID("logEntry").value = params.log;
logPasted(); logPasted();
@ -74,26 +74,53 @@ window.onload = function() {
} }
function buildMag() { function buildMag() {
var mag = ID("mag"); const mag = ID("mag");
var r = document.createElementNS(SVG_NS, "rect"); const r = document.createElementNS(SVG_NS, "rect");
r.setAttribute("x", gMagZoom * -gMagWidth / 2); r.setAttribute("x", (gMagZoom * -gMagWidth) / 2);
r.setAttribute("y", gMagZoom * -gMagHeight / 2); r.setAttribute("y", (gMagZoom * -gMagHeight) / 2);
r.setAttribute("width", gMagZoom * gMagWidth); r.setAttribute("width", gMagZoom * gMagWidth);
r.setAttribute("height", gMagZoom * gMagHeight); r.setAttribute("height", gMagZoom * gMagHeight);
mag.appendChild(r); mag.appendChild(r);
mag.setAttribute("transform", "translate(" + (gMagZoom * (gMagWidth / 2) + 1) + "," + (gMagZoom * (gMagHeight / 2) + 1) + ")"); mag.setAttribute(
"transform",
"translate(" +
(gMagZoom * (gMagWidth / 2) + 1) +
"," +
(gMagZoom * (gMagHeight / 2) + 1) +
")"
);
for (var x = 0; x < gMagWidth; x++) { for (let x = 0; x < gMagWidth; x++) {
gMagPixPaths[x] = []; gMagPixPaths[x] = [];
for (var y = 0; y < gMagHeight; y++) { for (let y = 0; y < gMagHeight; y++) {
var p1 = document.createElementNS(SVG_NS, "path"); const p1 = document.createElementNS(SVG_NS, "path");
p1.setAttribute("d", "M" + ((x - gMagWidth / 2) + 1) * gMagZoom + "," + (y - gMagHeight / 2) * gMagZoom + "h" + -gMagZoom + "v" + gMagZoom); p1.setAttribute(
"d",
"M" +
(x - gMagWidth / 2 + 1) * gMagZoom +
"," +
(y - gMagHeight / 2) * gMagZoom +
"h" +
-gMagZoom +
"v" +
gMagZoom
);
p1.setAttribute("stroke", "#CCC"); p1.setAttribute("stroke", "#CCC");
p1.setAttribute("stroke-width", "1px"); p1.setAttribute("stroke-width", "1px");
p1.setAttribute("fill", "#aaa"); p1.setAttribute("fill", "#aaa");
var p2 = document.createElementNS(SVG_NS, "path"); const p2 = document.createElementNS(SVG_NS, "path");
p2.setAttribute("d", "M" + ((x - gMagWidth / 2) + 1) * gMagZoom + "," + (y - gMagHeight / 2) * gMagZoom + "v" + gMagZoom + "h" + -gMagZoom); p2.setAttribute(
"d",
"M" +
(x - gMagWidth / 2 + 1) * gMagZoom +
"," +
(y - gMagHeight / 2) * gMagZoom +
"v" +
gMagZoom +
"h" +
-gMagZoom
);
p2.setAttribute("stroke", "#CCC"); p2.setAttribute("stroke", "#CCC");
p2.setAttribute("stroke-width", "1px"); p2.setAttribute("stroke-width", "1px");
p2.setAttribute("fill", "#888"); p2.setAttribute("fill", "#888");
@ -104,17 +131,17 @@ window.onload = function() {
} }
} }
var flashedOn = false; let flashedOn = false;
setInterval(function() { setInterval(function () {
flashedOn = !flashedOn; flashedOn = !flashedOn;
flashPixels(flashedOn); flashPixels(flashedOn);
}, 500); }, 500);
} }
function showPhase(phaseId) { function showPhase(phaseId) {
for (var i in gPhases) { for (const i in gPhases) {
var phase = gPhases[i]; const phase = gPhases[i];
phase.style.display = (phase.id == phaseId) ? "block" : "none"; phase.style.display = phase.id == phaseId ? "block" : "none";
} }
if (phaseId == "viewer") { if (phaseId == "viewer") {
ID("images").style.display = "none"; ID("images").style.display = "none";
@ -122,39 +149,39 @@ window.onload = function() {
} }
function loadFromWeb(url) { function loadFromWeb(url) {
var lastSlash = url.lastIndexOf('/'); const lastSlash = url.lastIndexOf("/");
if (lastSlash) { if (lastSlash) {
gPath = url.substring(0, lastSlash + 1); gPath = url.substring(0, lastSlash + 1);
} }
var r = new XMLHttpRequest(); const r = new XMLHttpRequest();
r.open("GET", url); r.open("GET", url);
r.onreadystatechange = function() { r.onreadystatechange = function () {
if (r.readyState == 4) { if (r.readyState == 4) {
processLog(r.response); processLog(r.response);
} }
} };
r.send(null); r.send(null);
} }
function fileEntryChanged() { function fileEntryChanged() {
showPhase("loading"); showPhase("loading");
var input = ID("fileEntry"); const input = ID("fileEntry");
var files = input.files; const files = input.files;
if (files.length > 0) { if (files.length > 0) {
// Only handle the first file; don't handle multiple selection. // Only handle the first file; don't handle multiple selection.
// The parts of the log we care about are ASCII-only. Since we // The parts of the log we care about are ASCII-only. Since we
// can ignore lines we don't care about, best to read in as // can ignore lines we don't care about, best to read in as
// ISO-8859-1, which guarantees we don't get decoding errors. // ISO-8859-1, which guarantees we don't get decoding errors.
var fileReader = new FileReader(); const fileReader = new FileReader();
fileReader.onload = function(e) { fileReader.onload = function (e) {
var log = e.target.result; const log = e.target.result;
if (log) { if (log) {
processLog(log); processLog(log);
} else { } else {
showPhase("entry"); showPhase("entry");
} }
} };
fileReader.readAsText(files[0], "iso-8859-1"); fileReader.readAsText(files[0], "iso-8859-1");
} }
// So the user can process the same filename again (after // So the user can process the same filename again (after
@ -165,45 +192,47 @@ window.onload = function() {
function logPasted() { function logPasted() {
showPhase("loading"); showPhase("loading");
var entry = ID("logEntry"); const entry = ID("logEntry");
var log = entry.value; const log = entry.value;
entry.value = ""; entry.value = "";
processLog(log); processLog(log);
} }
var gTestItems; let gTestItems;
function processLog(contents) { function processLog(contents) {
var lines = contents.split(/[\r\n]+/); const lines = contents.split(/[\r\n]+/);
gTestItems = []; gTestItems = [];
for (var j in lines) { for (const j in lines) {
var line = lines[j]; let line = lines[j];
var match = line.match(/^(?:NEXT ERROR )?REFTEST (.*)$/); let match = line.match(/^(?:NEXT ERROR )?REFTEST (.*)$/);
if (!match) { if (!match) {
continue; continue;
} }
line = match[1]; line = match[1];
match = line.match(/^(TEST-PASS|TEST-UNEXPECTED-PASS|TEST-KNOWN-FAIL|TEST-UNEXPECTED-FAIL)(\(EXPECTED RANDOM\)|) \| ([^\|]+) \|(.*)/); match = line.match(
/^(TEST-PASS|TEST-UNEXPECTED-PASS|TEST-KNOWN-FAIL|TEST-UNEXPECTED-FAIL)(\(EXPECTED RANDOM\)|) \| ([^\|]+) \|(.*)/
);
if (match) { if (match) {
var state = match[1]; const state = match[1];
var random = match[2]; const random = match[2];
var url = match[3]; const url = match[3];
var extra = match[4]; const extra = match[4];
gTestItems.push({ gTestItems.push({
pass: !state.match(/FAIL$/), pass: !state.match(/FAIL$/),
// only one of the following three should ever be true // only one of the following three should ever be true
unexpected: !!state.match(/^TEST-UNEXPECTED/), unexpected: !!state.match(/^TEST-UNEXPECTED/),
random: (random == "(EXPECTED RANDOM)"), random: random == "(EXPECTED RANDOM)",
skip: (extra == " (SKIP)"), skip: extra == " (SKIP)",
url: url, url,
images: [] images: [],
}); });
continue; continue;
} }
match = line.match(/^ IMAGE[^:]*: (.*)$/); match = line.match(/^ {2}IMAGE[^:]*: (.*)$/);
if (match) { if (match) {
var item = gTestItems[gTestItems.length - 1]; const item = gTestItems[gTestItems.length - 1];
item.images.push(match[1]); item.images.push(match[1]);
} }
} }
@ -216,24 +245,24 @@ window.onload = function() {
return; return;
} }
var cell = ID("itemlist"); const cell = ID("itemlist");
var table = document.getElementById("itemtable"); const table = document.getElementById("itemtable");
while (table.childNodes.length > 0) { while (table.childNodes.length > 0) {
table.removeChild(table.childNodes[table.childNodes.length - 1]); table.removeChild(table.childNodes[table.childNodes.length - 1]);
} }
var tbody = document.createElement("tbody"); const tbody = document.createElement("tbody");
table.appendChild(tbody); table.appendChild(tbody);
for (var i in gTestItems) { for (var i in gTestItems) {
var item = gTestItems[i]; const item = gTestItems[i];
if (item.pass && !item.unexpected) { if (item.pass && !item.unexpected) {
continue; continue;
} }
var tr = document.createElement("tr"); const tr = document.createElement("tr");
var rowclass = item.pass ? "pass" : "fail"; let rowclass = item.pass ? "pass" : "fail";
var td = document.createElement("td"); let td = document.createElement("td");
var text = ""; let text = "";
if (item.unexpected) { if (item.unexpected) {
text += "!"; text += "!";
@ -254,10 +283,10 @@ window.onload = function() {
td.id = "url" + i; td.id = "url" + i;
td.className = "url"; td.className = "url";
var match = item.url.match(/\/mozilla\/(.*)/); const match = item.url.match(/\/mozilla\/(.*)/);
text = document.createTextNode(match ? match[1] : item.url); text = document.createTextNode(match ? match[1] : item.url);
if (item.images.length > 0) { if (item.images.length > 0) {
var a = document.createElement("a"); const a = document.createElement("a");
a.id = i; a.id = i;
a.className = "image"; a.className = "image";
a.href = "#"; a.href = "#";
@ -272,23 +301,27 @@ window.onload = function() {
} }
// Bind an event handler to each image link // Bind an event handler to each image link
var images = document.getElementsByClassName("image"); const images = document.getElementsByClassName("image");
for (var i = 0; i < images.length; i++) { for (var i = 0; i < images.length; i++) {
images[i].addEventListener("click", function(e) { images[i].addEventListener(
showImages(e.target.id); "click",
}, false); function (e) {
showImages(e.target.id);
},
false
);
} }
showPhase("viewer"); showPhase("viewer");
} }
function getImageData(src, whenReady) { function getImageData(src, whenReady) {
var img = new Image(); const img = new Image();
img.onload = function() { img.onload = function () {
var canvas = document.createElement("canvas"); const canvas = document.createElement("canvas");
canvas.width = img.naturalWidth; canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight; canvas.height = img.naturalHeight;
var ctx = canvas.getContext("2d"); const ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0); ctx.drawImage(img, 0, 0);
whenReady(ctx.getImageData(0, 0, img.naturalWidth, img.naturalHeight)); whenReady(ctx.getImageData(0, 0, img.naturalWidth, img.naturalHeight));
@ -298,12 +331,12 @@ window.onload = function() {
function showImages(i) { function showImages(i) {
if (gSelected !== null) { if (gSelected !== null) {
ID('url' + gSelected).classList.remove('selected'); ID("url" + gSelected).classList.remove("selected");
} }
gSelected = i; gSelected = i;
ID('url' + gSelected).classList.add('selected'); ID("url" + gSelected).classList.add("selected");
var item = gTestItems[i]; const item = gTestItems[i];
var cell = ID("images"); const cell = ID("images");
ID("image1").style.display = ""; ID("image1").style.display = "";
ID("image2").style.display = "none"; ID("image2").style.display = "none";
@ -312,22 +345,34 @@ window.onload = function() {
ID("image1").setAttributeNS(XLINK_NS, "xlink:href", gPath + item.images[0]); ID("image1").setAttributeNS(XLINK_NS, "xlink:href", gPath + item.images[0]);
// Making the href be #image1 doesn't seem to work // Making the href be #image1 doesn't seem to work
ID("feimage1").setAttributeNS(XLINK_NS, "xlink:href", gPath + item.images[0]); ID("feimage1").setAttributeNS(
XLINK_NS,
"xlink:href",
gPath + item.images[0]
);
if (item.images.length == 1) { if (item.images.length == 1) {
ID("imgcontrols").style.display = "none"; ID("imgcontrols").style.display = "none";
} else { } else {
ID("imgcontrols").style.display = ""; ID("imgcontrols").style.display = "";
ID("image2").setAttributeNS(XLINK_NS, "xlink:href", gPath + item.images[1]); ID("image2").setAttributeNS(
XLINK_NS,
"xlink:href",
gPath + item.images[1]
);
// Making the href be #image2 doesn't seem to work // Making the href be #image2 doesn't seem to work
ID("feimage2").setAttributeNS(XLINK_NS, "xlink:href", gPath + item.images[1]); ID("feimage2").setAttributeNS(
XLINK_NS,
"xlink:href",
gPath + item.images[1]
);
} }
cell.style.display = ""; cell.style.display = "";
getImageData(item.images[0], function(data) { getImageData(item.images[0], function (data) {
gImage1Data = data; gImage1Data = data;
syncSVGSize(gImage1Data); syncSVGSize(gImage1Data);
}); });
getImageData(item.images[1], function(data) { getImageData(item.images[1], function (data) {
gImage2Data = data gImage2Data = data;
}); });
} }
@ -351,17 +396,17 @@ window.onload = function() {
} }
function flashPixels(on) { function flashPixels(on) {
var stroke = on ? "#FF0000" : "#CCC"; const stroke = on ? "#FF0000" : "#CCC";
var strokeWidth = on ? "2px" : "1px"; const strokeWidth = on ? "2px" : "1px";
for (var i = 0; i < gFlashingPixels.length; i++) { for (let i = 0; i < gFlashingPixels.length; i++) {
gFlashingPixels[i].setAttribute("stroke", stroke); gFlashingPixels[i].setAttribute("stroke", stroke);
gFlashingPixels[i].setAttribute("stroke-width", strokeWidth); gFlashingPixels[i].setAttribute("stroke-width", strokeWidth);
} }
} }
function cursorPoint(evt) { function cursorPoint(evt) {
var m = evt.target.getScreenCTM().inverse(); const m = evt.target.getScreenCTM().inverse();
var p = ID("svg").createSVGPoint(); let p = ID("svg").createSVGPoint();
p.x = evt.clientX; p.x = evt.clientX;
p.y = evt.clientY; p.y = evt.clientY;
p = p.matrixTransform(m); p = p.matrixTransform(m);
@ -373,42 +418,55 @@ window.onload = function() {
} }
function canvasPixelAsHex(data, x, y) { function canvasPixelAsHex(data, x, y) {
var offset = (y * data.width + x) * 4; const offset = (y * data.width + x) * 4;
var r = data.data[offset]; const r = data.data[offset];
var g = data.data[offset + 1]; const g = data.data[offset + 1];
var b = data.data[offset + 2]; const b = data.data[offset + 2];
return "#" + hex2(r) + hex2(g) + hex2(b); return "#" + hex2(r) + hex2(g) + hex2(b);
} }
function hexAsRgb(hex) { function hexAsRgb(hex) {
return "rgb(" + [parseInt(hex.substring(1, 3), 16), parseInt(hex.substring(3, 5), 16), parseInt(hex.substring(5, 7), 16)] + ")"; return (
"rgb(" +
[
parseInt(hex.substring(1, 3), 16),
parseInt(hex.substring(3, 5), 16),
parseInt(hex.substring(5, 7), 16),
] +
")"
);
} }
function magnify(evt) { function magnify(evt) {
var cursor = cursorPoint(evt); const cursor = cursorPoint(evt);
var x = cursor.x; const x = cursor.x;
var y = cursor.y; const y = cursor.y;
var centerPixelColor1, centerPixelColor2; let centerPixelColor1, centerPixelColor2;
var dx_lo = -Math.floor(gMagWidth / 2); const dx_lo = -Math.floor(gMagWidth / 2);
var dx_hi = Math.floor(gMagWidth / 2); const dx_hi = Math.floor(gMagWidth / 2);
var dy_lo = -Math.floor(gMagHeight / 2); const dy_lo = -Math.floor(gMagHeight / 2);
var dy_hi = Math.floor(gMagHeight / 2); const dy_hi = Math.floor(gMagHeight / 2);
flashPixels(false); flashPixels(false);
gFlashingPixels = []; gFlashingPixels = [];
for (var j = dy_lo; j <= dy_hi; j++) { for (let j = dy_lo; j <= dy_hi; j++) {
for (var i = dx_lo; i <= dx_hi; i++) { for (let i = dx_lo; i <= dx_hi; i++) {
var px = x + i; const px = x + i;
var py = y + j; const py = y + j;
var p1 = gMagPixPaths[i + dx_hi][j + dy_hi][0]; const p1 = gMagPixPaths[i + dx_hi][j + dy_hi][0];
var p2 = gMagPixPaths[i + dx_hi][j + dy_hi][1]; const p2 = gMagPixPaths[i + dx_hi][j + dy_hi][1];
if (px < 0 || py < 0 || px >= gImage1Data.width || py >= gImage1Data.height) { if (
px < 0 ||
py < 0 ||
px >= gImage1Data.width ||
py >= gImage1Data.height
) {
p1.setAttribute("fill", "#aaa"); p1.setAttribute("fill", "#aaa");
p2.setAttribute("fill", "#888"); p2.setAttribute("fill", "#888");
} else { } else {
var color1 = canvasPixelAsHex(gImage1Data, x + i, y + j); const color1 = canvasPixelAsHex(gImage1Data, x + i, y + j);
var color2 = canvasPixelAsHex(gImage2Data, x + i, y + j); const color2 = canvasPixelAsHex(gImage2Data, x + i, y + j);
p1.setAttribute("fill", color1); p1.setAttribute("fill", color1);
p2.setAttribute("fill", color2); p2.setAttribute("fill", color2);
if (color1 != color2) { if (color1 != color2) {
@ -424,11 +482,18 @@ window.onload = function() {
} }
} }
flashPixels(true); flashPixels(true);
showPixelInfo(x, y, centerPixelColor1, hexAsRgb(centerPixelColor1), centerPixelColor2, hexAsRgb(centerPixelColor2)); showPixelInfo(
x,
y,
centerPixelColor1,
hexAsRgb(centerPixelColor1),
centerPixelColor2,
hexAsRgb(centerPixelColor2)
);
} }
function showPixelInfo(x, y, pix1rgb, pix1hex, pix2rgb, pix2hex) { function showPixelInfo(x, y, pix1rgb, pix1hex, pix2rgb, pix2hex) {
var pixelinfo = ID("pixelinfo"); const pixelinfo = ID("pixelinfo");
ID("coords").textContent = [x, y]; ID("coords").textContent = [x, y];
ID("pix1hex").textContent = pix1hex; ID("pix1hex").textContent = pix1hex;
ID("pix1rgb").textContent = pix1rgb; ID("pix1rgb").textContent = pix1rgb;
@ -436,46 +501,64 @@ window.onload = function() {
ID("pix2rgb").textContent = pix2rgb; ID("pix2rgb").textContent = pix2rgb;
} }
var logPastedButton = document.getElementById("logPasted"); const logPastedButton = document.getElementById("logPasted");
logPastedButton.addEventListener("click", logPasted, false); logPastedButton.addEventListener("click", logPasted, false);
var fileEntryButton = document.getElementById("fileEntry"); const fileEntryButton = document.getElementById("fileEntry");
fileEntryButton.addEventListener("change", fileEntryChanged, false); fileEntryButton.addEventListener("change", fileEntryChanged, false);
var testImage = document.getElementById("testImage"); const testImage = document.getElementById("testImage");
testImage.addEventListener("click", function() { testImage.addEventListener(
showImage(1); "click",
}, false); function () {
showImage(1);
},
false
);
var referenceImage = document.getElementById("referenceImage"); const referenceImage = document.getElementById("referenceImage");
referenceImage.addEventListener("click", function() { referenceImage.addEventListener(
showImage(2); "click",
}, false); function () {
showImage(2);
},
false
);
var differences = document.getElementById("differences"); const differences = document.getElementById("differences");
differences.addEventListener("click", function(e) { differences.addEventListener(
showDifferences(e.target); "click",
}, false); function (e) {
showDifferences(e.target);
},
false
);
var magnifyElement = document.getElementById("magnify"); const magnifyElement = document.getElementById("magnify");
magnifyElement.addEventListener("mousemove", function(e) { magnifyElement.addEventListener(
magnify(e); "mousemove",
}, false); function (e) {
magnify(e);
},
false
);
window.addEventListener('keydown', function keydown(event) { window.addEventListener("keydown", function keydown(event) {
if (event.which === 84) { if (event.which === 84) {
// 't' switch test/ref images // 't' switch test/ref images
var val = 0; let val = 0;
if (document.querySelector('input[name="which"][value="0"]:checked')) { if (document.querySelector('input[name="which"][value="0"]:checked')) {
val = 1; val = 1;
} }
document.querySelector('input[name="which"][value="' + val + '"]').click(); document
.querySelector('input[name="which"][value="' + val + '"]')
.click();
} else if (event.which === 68) { } else if (event.which === 68) {
// 'd' toggle differences // 'd' toggle differences
document.getElementById("differences").click(); document.getElementById("differences").click();
} else if (event.which === 78 || event.which === 80) { } else if (event.which === 78 || event.which === 80) {
// 'n' next image, 'p' previous image // 'n' next image, 'p' previous image
var select = gSelected; let select = gSelected;
if (gSelected === null) { if (gSelected === null) {
select = 0; select = 0;
} else if (event.which === 78) { } else if (event.which === 78) {
@ -483,9 +566,9 @@ window.onload = function() {
} else { } else {
select--; select--;
} }
var length = gTestItems.length; const length = gTestItems.length;
select = select < 0 ? length - 1 : select >= length ? 0 : select; select = select < 0 ? length - 1 : select >= length ? 0 : select;
showImages(select); showImages(select);
} }
}); });
} };