Skip to content

Commit 00fe62f

Browse files
committed
rebuild assets
1 parent a02be03 commit 00fe62f

21 files changed

+686
-675
lines changed

public/dist/assets/js/comments.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ __webpack_require__.r(__webpack_exports__);
99
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1010
/* harmony export */ "translate": () => (/* binding */ translate)
1111
/* harmony export */ });
12-
const translate = {
12+
var translate = {
1313
'translations': {
1414
//microcopy translations
1515
'ar': {
@@ -188,8 +188,8 @@ const translate = {
188188
//languageCode = code of the target language
189189
//injection = object of values to inject into the string if interpolation is required, object keys should match references in the translations snippets,
190190
// e.g. 'Slide {x} of {y} requires an object with keys x and y.
191-
'translate': function (snippetReference, languageCode) {
192-
let injections = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
191+
'translate': function translate(snippetReference, languageCode) {
192+
var injections = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
193193
//without a snippet reference, we don't know what to translate
194194
if (snippetReference === undefined || snippetReference === null || snippetReference.length < 1) {
195195
return;
@@ -279,17 +279,17 @@ __webpack_require__.r(__webpack_exports__);
279279
/**
280280
* Replaces comment dates with their equivalent time difference (xx hours/days ago)
281281
*/
282-
let commentsTimeDiff = function () {
282+
var commentsTimeDiff = function () {
283283
document.querySelectorAll(".comment__author time").forEach(function (time) {
284284
time.setAttribute('title', time.innerHTML.trim());
285-
const date = new Date(time.getAttribute("datetime"));
286-
const deltaSeconds = Math.round((date.getTime() - Date.now()) / 1000);
287-
const deltaMinutes = Math.round(deltaSeconds / 60);
288-
const deltaHours = Math.round(deltaSeconds / (60 * 60));
289-
const deltaDays = Math.round(deltaSeconds / (60 * 60 * 24));
290-
const deltaMonths = Math.round(deltaSeconds / (60 * 60 * 24 * 30));
291-
const deltaYears = Math.round(deltaSeconds / (60 * 60 * 24 * 365));
292-
const formatter = new Intl.RelativeTimeFormat(document.documentElement.lang, {
285+
var date = new Date(time.getAttribute("datetime"));
286+
var deltaSeconds = Math.round((date.getTime() - Date.now()) / 1000);
287+
var deltaMinutes = Math.round(deltaSeconds / 60);
288+
var deltaHours = Math.round(deltaSeconds / (60 * 60));
289+
var deltaDays = Math.round(deltaSeconds / (60 * 60 * 24));
290+
var deltaMonths = Math.round(deltaSeconds / (60 * 60 * 24 * 30));
291+
var deltaYears = Math.round(deltaSeconds / (60 * 60 * 24 * 365));
292+
var formatter = new Intl.RelativeTimeFormat(document.documentElement.lang, {
293293
numeric: "auto"
294294
});
295295
if (deltaYears != 0) {
@@ -314,32 +314,32 @@ let commentsTimeDiff = function () {
314314

315315
window.addComment = function (window) {
316316
// Avoid scope lookups on commonly used variables.
317-
let document = window.document;
318-
let commentReplyTitle = document.querySelector('[data-title="reply"]');
317+
var document = window.document;
318+
var commentReplyTitle = document.querySelector('[data-title="reply"]');
319319
if (!commentReplyTitle) {
320320
return;
321321
}
322-
let origReplyTitle = commentReplyTitle.textContent;
323-
let commentForm = document.getElementById('comment-form');
322+
var origReplyTitle = commentReplyTitle.textContent;
323+
var commentForm = document.getElementById('comment-form');
324324

325325
// I18N
326-
let cancelText = _main_translations__WEBPACK_IMPORTED_MODULE_0__.translate.translate('cancelReply', document.documentElement.lang);
326+
var cancelText = _main_translations__WEBPACK_IMPORTED_MODULE_0__.translate.translate('cancelReply', document.documentElement.lang);
327327
function changeLinksToBtns() {
328-
let linksArray = Array.prototype.slice.call(document.querySelectorAll('[data-replylink]'));
328+
var linksArray = Array.prototype.slice.call(document.querySelectorAll('[data-replylink]'));
329329
linksArray.forEach(function (link) {
330-
let attributes = link.dataset;
331-
let btn = document.createElement('button');
330+
var attributes = link.dataset;
331+
var btn = document.createElement('button');
332332
btn.setAttribute('class', 'button button--ghost');
333333
btn.innerHTML = link.innerHTML;
334-
for (let key in attributes) {
334+
for (var key in attributes) {
335335
btn.setAttribute('data-' + key, attributes[key]);
336336
}
337337
link.parentNode.replaceChild(btn, link);
338338
});
339339
}
340340
function addPlaceHolder(respondElement) {
341-
let temporaryFormId = 'js-temp-form-div';
342-
let temporaryElement = document.getElementById(temporaryFormId);
341+
var temporaryFormId = 'js-temp-form-div';
342+
var temporaryElement = document.getElementById(temporaryFormId);
343343
if (temporaryElement) {
344344
// The element already exists, no need to recreate.
345345
return;
@@ -350,25 +350,25 @@ window.addComment = function (window) {
350350
respondElement.parentNode.insertBefore(temporaryElement, respondElement);
351351
}
352352
function addCancelBtn(respondElement) {
353-
let cancelBtnId = 'js-cancel-reply';
354-
let cancelBtn = document.getElementById(cancelBtnId);
353+
var cancelBtnId = 'js-cancel-reply';
354+
var cancelBtn = document.getElementById(cancelBtnId);
355355
if (cancelBtn) {
356356
cancelBtn.style.display = '';
357357
return;
358358
}
359-
let targetDiv = respondElement.querySelector('div');
359+
var targetDiv = respondElement.querySelector('div');
360360
cancelBtn = document.createElement('button');
361361
cancelBtn.setAttribute('id', cancelBtnId);
362362
cancelBtn.setAttribute('class', 'button button--ghost');
363363
cancelBtn.textContent = cancelText;
364364
targetDiv.appendChild(cancelBtn);
365365
}
366366
function moveForm(addBelowId, commentId) {
367-
let addBelowElement = document.getElementById(addBelowId);
368-
let respondElement = document.querySelector('[data-respondelement]');
367+
var addBelowElement = document.getElementById(addBelowId);
368+
var respondElement = document.querySelector('[data-respondelement]');
369369

370370
// Get the hidden fields
371-
let parentIdField = commentForm.querySelector('input[name="parent"]');
371+
var parentIdField = commentForm.querySelector('input[name="parent"]');
372372
parentIdField.value = commentId;
373373
addPlaceHolder(respondElement);
374374
addCancelBtn(respondElement);
@@ -383,19 +383,19 @@ window.addComment = function (window) {
383383
commentForm.querySelector('[type="submit"]').nextElementSibling.style.display = 'none';
384384
document.addEventListener('click', function (event) {
385385
if (event.target.matches('[data-replylink]')) {
386-
let replyLink = event.target;
387-
let newReplyTitle = replyLink.getAttribute('data-replyto');
388-
let commentId = replyLink.getAttribute('data-belowelement');
389-
let parentId = replyLink.getAttribute('data-commentid');
390-
let postId = replyLink.getAttribute('data-postid');
386+
var replyLink = event.target;
387+
var newReplyTitle = replyLink.getAttribute('data-replyto');
388+
var commentId = replyLink.getAttribute('data-belowelement');
389+
var parentId = replyLink.getAttribute('data-commentid');
390+
var postId = replyLink.getAttribute('data-postid');
391391
if (!commentId || !parentId || !postId) return;
392392
event.preventDefault();
393393
commentReplyTitle.textContent = newReplyTitle;
394394
moveForm(commentId, parentId, postId);
395395
}
396396
if (event.target.matches('#js-cancel-reply')) {
397-
let temporaryElement = document.getElementById('js-temp-form-div');
398-
let respondElement = document.querySelector('[data-respondelement]');
397+
var temporaryElement = document.getElementById('js-temp-form-div');
398+
var respondElement = document.querySelector('[data-respondelement]');
399399
commentReplyTitle.textContent = origReplyTitle;
400400
temporaryElement.parentNode.replaceChild(respondElement, temporaryElement);
401401
respondElement.querySelector('input[name="parent"]').value = '';

0 commit comments

Comments
 (0)