Skip to content

Commit eb10168

Browse files
committed
Fix semistandard errors
1 parent 8b9b8ec commit eb10168

File tree

201 files changed

+1392
-1351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+1392
-1351
lines changed

auth/login.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ module.exports = () => ({
44
config: {
55
auth: false
66
},
7-
handler: (request, reply) => reply.view('login', null, {layout: 'auth'})
7+
handler: (request, reply) => reply.view('login', null, { layout: 'auth' })
88
});

bin/cache.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
const Catbox = require('@hapi/catbox');
22
const CatboxRedis = require('@hapi/catbox-redis');
3-
var elasticacheHost = '127.0.0.1';
4-
var elasticachePort = '6379';
3+
let elasticacheHost = '127.0.0.1';
4+
let elasticachePort = '6379';
55

66
if (process.env.ELASTICACHE_EP) {
7-
var config = process.env.ELASTICACHE_EP.split(':');
7+
const config = process.env.ELASTICACHE_EP.split(':');
88
elasticacheHost = config[0];
99
elasticachePort = config[1];
1010
}
1111

12-
module.exports = new Catbox.Client(CatboxRedis, {host: elasticacheHost, port: elasticachePort});
12+
module.exports = new Catbox.Client(CatboxRedis, { host: elasticacheHost, port: elasticachePort });

client/lib/filter-results.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/**
22
* Collect the filter values, build and call the new url with the filter query parameters
33
*/
4-
var Querystring = require('querystring');
5-
var getQueryString = require('./get-qs');
6-
var findCategory = require('./find-category.js');
4+
const Querystring = require('querystring');
5+
const getQueryString = require('./get-qs');
6+
const findCategory = require('./find-category.js');
77

88
module.exports = function (ctx, page) {
9-
var searchCategory = findCategory(ctx.pathname);
10-
var currentQueryString = Querystring.parse(ctx.querystring);
11-
var pageType = currentQueryString['page[type]'] ? currentQueryString['page[type]'] : 'search';
12-
var url = '/search' + (searchCategory ? '/' + searchCategory : '') + getQueryString(pageType, searchCategory);
9+
const searchCategory = findCategory(ctx.pathname);
10+
const currentQueryString = Querystring.parse(ctx.querystring);
11+
const pageType = currentQueryString['page[type]'] ? currentQueryString['page[type]'] : 'search';
12+
const url = '/search' + (searchCategory ? '/' + searchCategory : '') + getQueryString(pageType, searchCategory);
1313
page.show(url);
1414
};

client/lib/filter-state.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = {isFilterOpen: true};
1+
module.exports = { isFilterOpen: true };

client/lib/find-category.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = function findCategory (path) {
2-
var categoryRegex = /(objects|people|documents)/g;
3-
var match = categoryRegex.exec(path);
2+
const categoryRegex = /(objects|people|documents)/g;
3+
const match = categoryRegex.exec(path);
44
if (match) {
55
return match[1];
66
}

client/lib/get-data.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var fetch = require('fetch-ponyfill')().fetch;
1+
const fetch = require('fetch-ponyfill')().fetch;
22

33
module.exports = function (url, opts, cb) {
44
fetch(url, opts)

client/lib/get-qs.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
var paramify = require('../../lib/helpers/paramify.js');
2-
var querify = require('../../lib/helpers/querify.js');
1+
const paramify = require('../../lib/helpers/paramify.js');
2+
const querify = require('../../lib/helpers/querify.js');
33

44
module.exports = function (pageType) {
55
/**
66
* select all the input checkbox checked, all the other input but not the checkbox (already selected) and not fields[type] already on url
77
*/
8-
var queryParamsValues = document.querySelectorAll('#search-form input:checked, #search-form input:not([type="checkbox"]):not([name="fields[type]"]):not([name="page[type]"])');
9-
var params = {};
10-
for (var i = 0; i < queryParamsValues.length; i++) {
8+
const queryParamsValues = document.querySelectorAll('#search-form input:checked, #search-form input:not([type="checkbox"]):not([name="fields[type]"]):not([name="page[type]"])');
9+
const params = {};
10+
for (let i = 0; i < queryParamsValues.length; i++) {
1111
if (queryParamsValues[i].value && !params[queryParamsValues[i].name]) {
1212
params[queryParamsValues[i].name] = [queryParamsValues[i].value];
1313
} else if (params[queryParamsValues[i].name]) {
1414
params[queryParamsValues[i].name].push(queryParamsValues[i].value);
1515
}
1616
}
1717
// select result per page
18-
var rpp = document.querySelector('.control--rpp select') ? document.querySelector('.control--rpp select').value : 50;
18+
const rpp = document.querySelector('.control--rpp select') ? document.querySelector('.control--rpp select').value : 50;
1919

2020
if (parseInt(rpp) !== 50) {
2121
params['page[size]'] = rpp;

client/lib/get-query-obj.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var splitOnUnescapedCommas = require('./split-commas.js');
1+
const splitOnUnescapedCommas = require('./split-commas.js');
22

33
module.exports = (queryString) => {
4-
var qObj = {};
4+
const qObj = {};
55
Object.keys(queryString).forEach(key => {
66
qObj[key] = splitOnUnescapedCommas(queryString[key]);
77
});

client/lib/listeners/archive-listeners.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
var page = require('page');
2-
var QueryString = require('querystring');
1+
const page = require('page');
2+
const QueryString = require('querystring');
33

44
module.exports = () => {
55
// 'Search this Archive' Listener
6-
var archiveSearch = document.querySelector('#archive-search');
6+
const archiveSearch = document.querySelector('#archive-search');
77
if (archiveSearch) {
88
archiveSearch.addEventListener('submit', function (e) {
99
e.preventDefault();
10-
var q = document.getElementById('archive-q').value;
11-
var qs = { q };
12-
var archive = document.getElementById('archive-title').value;
13-
var url = '/search/documents/archive/' + archive.toLowerCase().split(' ').join('-') + '?' + QueryString.stringify(qs);
10+
const q = document.getElementById('archive-q').value;
11+
const qs = { q };
12+
const archive = document.getElementById('archive-title').value;
13+
const url = '/search/documents/archive/' + archive.toLowerCase().split(' ').join('-') + '?' + QueryString.stringify(qs);
1414
page.show(url);
1515
});
1616
}

client/lib/listeners/carousel.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
var Flickity = require('flickity');
1+
const Flickity = require('flickity');
22
require('flickity-imagesloaded');
33

44
module.exports = ctx => {
5-
var carousel = document.querySelector('.carousel');
5+
const carousel = document.querySelector('.carousel');
66
if (carousel) {
7-
var thumbnails = document.getElementsByClassName('record-imgpanel__thumb');
8-
var captions = Array.prototype.slice.call(
7+
const thumbnails = document.getElementsByClassName('record-imgpanel__thumb');
8+
const captions = Array.prototype.slice.call(
99
document.getElementsByClassName('record-imgpanel__caption')
1010
);
11-
var rights = Array.prototype.slice.call(
11+
const rights = Array.prototype.slice.call(
1212
document.getElementsByClassName('cite__menu__methods')
1313
);
14-
var zooms = Array.prototype.slice.call(
14+
const zooms = Array.prototype.slice.call(
1515
document.getElementsByClassName('osd__toolbar-container')
1616
);
17-
var useImage = Array.prototype.slice.call(
17+
const useImage = Array.prototype.slice.call(
1818
document.getElementsByClassName('cite__button')
1919
);
2020

@@ -28,7 +28,7 @@ module.exports = ctx => {
2828
'M 0,50 L 45.67,4.33 L 52.5,11.16 L 18.49,45.17 L 100,45.17 L 100,54.83 L 18.49,54.83 L 52.5,88.84 45.67,95.67 Z'
2929
});
3030

31-
var flkty = Flickity.data(carousel);
31+
const flkty = Flickity.data(carousel);
3232
ctx.carousel.on('select', function () {
3333
if (navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform)) {
3434
document.querySelector('#openseadragon').style.width = '100%';
@@ -46,7 +46,7 @@ module.exports = ctx => {
4646
useImage.forEach(el => showHide('cite__button', flkty, el));
4747
}
4848

49-
let carouselImage = document.querySelectorAll('.carousel__image.is-selected');
49+
const carouselImage = document.querySelectorAll('.carousel__image.is-selected');
5050

5151
if (carouselImage.length) {
5252
ctx.imgUrl = carouselImage[0].dataset.osd;
@@ -60,7 +60,7 @@ module.exports = ctx => {
6060
);
6161
}
6262

63-
var citeButton = document.getElementsByClassName('cite__button');
63+
const citeButton = document.getElementsByClassName('cite__button');
6464

6565
if (citeButton) {
6666
Array.prototype.slice.call(citeButton).forEach((el, i) =>
@@ -75,9 +75,9 @@ module.exports = ctx => {
7575
);
7676
}
7777

78-
var homeCarousel = document.querySelector('.home-carousel__flickity');
78+
const homeCarousel = document.querySelector('.home-carousel__flickity');
7979
if (homeCarousel) {
80-
var homeCarouselFlkty = new Flickity(homeCarousel, {
80+
const homeCarouselFlkty = new Flickity(homeCarousel, {
8181
wrapAround: true,
8282
pageDots: false,
8383
imagesLoaded: true,
@@ -92,10 +92,10 @@ module.exports = ctx => {
9292
offsetContainer();
9393
this.select(0);
9494
// move buttons to before the main carousel
95-
let buttons = homeCarousel.querySelectorAll(
95+
const buttons = homeCarousel.querySelectorAll(
9696
'.flickity-prev-next-button'
9797
);
98-
let before = document.querySelector(
98+
const before = document.querySelector(
9999
'.home-carousel .flickity-buttonholder'
100100
);
101101
buttons.forEach(b => {
@@ -110,9 +110,9 @@ module.exports = ctx => {
110110
}
111111
function offsetContainer () {
112112
// to mirror main site carousels, we want to bust out of column container on right side only.
113-
var windowWidth = document.body.offsetWidth;
114-
var containerWidth = document.querySelector('.row').offsetWidth; // any row will do!
115-
var offsetWidth = (windowWidth - containerWidth) / 2 + 8;
113+
const windowWidth = document.body.offsetWidth;
114+
const containerWidth = document.querySelector('.row').offsetWidth; // any row will do!
115+
const offsetWidth = (windowWidth - containerWidth) / 2 + 8;
116116
document.querySelector(
117117
'.home-carousel__flickity .flickity-viewport'
118118
).style.marginLeft =

client/lib/listeners/clipboard.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
var Clipboard = require('clipboard');
1+
const Clipboard = require('clipboard');
22

33
module.exports = function () {
44
// using bower / Clipboard for copying cite text. not really neceesary?
55
// https://clipboardjs.com/
6-
var clipboard = new Clipboard('.clipboard__button');
6+
const clipboard = new Clipboard('.clipboard__button');
77

88
clipboard.on('success', function (e) {
99
e.trigger.parentNode.classList.add('clipboard--copied');

client/lib/listeners/close-description-box.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module.exports = function () {
22
function select (elem) { return document.querySelector(elem); }
33

4-
var closeDescriptionButton = select('button[name=close-description-box]');
4+
const closeDescriptionButton = select('button[name=close-description-box]');
55

66
if (closeDescriptionButton) {
77
closeDescriptionButton.addEventListener('click', function (e) {
8-
var descriptionBox = select('.description-box');
8+
const descriptionBox = select('.description-box');
99
descriptionBox.classList.add('hidden');
1010
});
1111
}

client/lib/listeners/delete-filters-facets.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module.exports = function (facetsStates, typeSearch) {
2-
var type = typeSearch || 'all';
3-
var facets = Array.prototype.slice.call(document.querySelectorAll('.filter--active:not(.filter--uncollapsible)'));
2+
const type = typeSearch || 'all';
3+
const facets = Array.prototype.slice.call(document.querySelectorAll('.filter--active:not(.filter--uncollapsible)'));
44
facets.forEach(function (facet) {
5-
var link = facet.querySelector('a');
5+
const link = facet.querySelector('a');
66
link.addEventListener('click', function (e) {
7-
var facetName = facet.getAttribute('data-filter');
7+
const facetName = facet.getAttribute('data-filter');
88
facetsStates[type][facetName] = 'open';
99
});
1010
});

client/lib/listeners/display-facet.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module.exports = function (facetsStates, typeSearch) {
2-
var type = typeSearch || 'all';
3-
var facets = Array.prototype.slice.call(document.querySelectorAll('.filter'));
2+
const type = typeSearch || 'all';
3+
const facets = Array.prototype.slice.call(document.querySelectorAll('.filter'));
44
facets.forEach(function (facet) {
5-
var facetName = facet.getAttribute('data-filter');
5+
const facetName = facet.getAttribute('data-filter');
66
if (facetName) {
7-
var state = facetsStates[type][facetName];
7+
const state = facetsStates[type][facetName];
88
if (state === 'close') {
99
facet.classList.remove('filter--open');
1010
facet.classList.remove('filter--active');

client/lib/listeners/display-filters.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* toggle classes for the filter
33
*/
44
module.exports = function (display) {
5-
var searchresults = document.querySelector('.searchresults');
6-
var filtercolumn = document.querySelector('.filtercolumn');
7-
var controlFilters = document.querySelector('.control--filters');
5+
const searchresults = document.querySelector('.searchresults');
6+
const filtercolumn = document.querySelector('.filtercolumn');
7+
const controlFilters = document.querySelector('.control--filters');
88

99
if (searchresults && filtercolumn && controlFilters) {
1010
if (display) {

client/lib/listeners/download-image.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module.exports = () => {
2-
var download = document.querySelectorAll('.download-image');
3-
var a = document.createElement('a');
2+
const download = document.querySelectorAll('.download-image');
3+
const a = document.createElement('a');
44
if (download) {
55
Array.prototype.slice.call(download).forEach(e => {
66
e.addEventListener('submit', event => {
7-
if (typeof a.download !== undefined) {
7+
if (typeof a.download !== 'undefined') {
88
event.preventDefault();
99
a.href = e.action;
1010
a.download = 'image.jpeg';

client/lib/listeners/expand-details-button.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

33
function toggle (e) {
4-
var button = e.target;
5-
var detailElem = button.parentElement.querySelector('dd.toggle-detail');
4+
const button = e.target;
5+
const detailElem = button.parentElement.querySelector('dd.toggle-detail');
66

77
if (detailElem.className.indexOf('hidden') === -1) {
88
detailElem.classList.add('hidden');
@@ -16,7 +16,7 @@ function toggle (e) {
1616
}
1717

1818
module.exports = function () {
19-
var hideThis = document.querySelectorAll('.record-details__toggler');
19+
const hideThis = document.querySelectorAll('.record-details__toggler');
2020
[].forEach.call(hideThis, function (el) {
2121
el.addEventListener('click', toggle);
2222
});

client/lib/listeners/get-articles.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
var getData = require('../get-data');
2-
var Templates = require('../../templates');
1+
const getData = require('../get-data');
2+
const Templates = require('../../templates');
33

44
module.exports = function (ctx) {
5-
var url = '/articles/' + ctx.params.id;
6-
var opts = {
5+
const url = '/articles/' + ctx.params.id;
6+
const opts = {
77
headers: { Accept: 'application/vnd.api+json' }
88
};
99

1010
getData(url, opts, function (err, data) {
1111
if (err) {
1212
console.error(err);
1313
} else if (data.data.length >= 1) {
14-
var articles = document.getElementById('articles');
15-
articles.innerHTML = Templates['articles'](data);
14+
const articles = document.getElementById('articles');
15+
articles.innerHTML = Templates.articles(data);
1616
}
1717
});
1818
};

client/lib/listeners/get-wiki-data.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
var getData = require('../get-data');
2-
var Templates = require('../../templates');
1+
const getData = require('../get-data');
2+
const Templates = require('../../templates');
33

44
module.exports = function (ctx) {
5-
var wikiImage = document.getElementById('wikiImage');
6-
var wikiSummary = document.getElementById('wikiInfo');
5+
const wikiImage = document.getElementById('wikiImage');
6+
const wikiSummary = document.getElementById('wikiInfo');
77

88
if (wikiImage) {
9-
var url = '/wiki/' + wikiImage.dataset.name;
10-
var opts = {
9+
const url = '/wiki/' + wikiImage.dataset.name;
10+
const opts = {
1111
headers: { Accept: 'application/vnd.api+json' }
1212
};
1313

1414
getData(url, opts, function (_err, data) {
1515
if (data && data.mainImage) {
16-
wikiImage.innerHTML = Templates['wikiImage'](data);
17-
wikiSummary.innerHTML = Templates['wikiSummary'](data);
16+
wikiImage.innerHTML = Templates.wikiImage(data);
17+
wikiSummary.innerHTML = Templates.wikiSummary(data);
1818
}
1919
});
2020
}

0 commit comments

Comments
 (0)