Skip to content

Commit

Permalink
Upgrade Node.js requirements and modernise just a bit the frontend code
Browse files Browse the repository at this point in the history
  • Loading branch information
paazmaya committed May 23, 2023
1 parent 96bd4ab commit 1dbfe51
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
2 changes: 0 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export default [
globals: {
...globals.browser,
...globals.jasmine,
jQuery: false,
$: false,
location: false,
process: false,
ga: false
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"terser": "5.17.6"
},
"engines": {
"node": ">=14.15.0"
"node": ">=18.12.1",
"npm": ">=8.19.2"
},
"repository": {
"type": "git",
Expand Down
27 changes: 11 additions & 16 deletions src/js/sendanmaki.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
* License: Attribution-ShareAlike 4.0 Unported
* http://creativecommons.org/licenses/by-sa/4.0/
*/
/* eslint-disable no-var */

'use strict';

var sendanmaki = window.sendanmaki = {
const sendanmaki = {

/**
* Image notes for the given key image.
Expand Down Expand Up @@ -105,13 +102,13 @@ var sendanmaki = window.sendanmaki = {
* @returns {void}
*/
buildImageNotes: function buildImageNotes(items) {
var key = '/img/naginata-bogu-chudan-artwork-lecklin.png';
const key = '/img/naginata-bogu-chudan-artwork-lecklin.png';

var images = document.querySelectorAll('img[src="' + key + '"]');
const images = document.querySelectorAll('img[src="' + key + '"]');
if (images.length === 0) {
return;
}
var parent = images[0].parentNode;
const parent = images[0].parentNode;
parent.classList.add('relative');
items.forEach(function forItems(data) {
sendanmaki.createImgNote(data, images[0]);
Expand All @@ -132,10 +129,10 @@ var sendanmaki = window.sendanmaki = {
* @returns {void}
*/
createImgNote: function createImgNote(data, image) {
var elements = document.querySelectorAll('span.note[rel="' + data.note + '"]');
const elements = document.querySelectorAll('span.note[rel="' + data.note + '"]');

if (image && elements.length === 0) {
var cont = '<span class="note" rel="' + data.note + '" style="left:' + data.x + 'px; top: ' + data.y + 'px">' +
const cont = '<span class="note" rel="' + data.note + '" style="left:' + data.x + 'px; top: ' + data.y + 'px">' +
'<span class="notearea" style="width:' + data.width + 'px; height: ' + data.height + 'px"></span>' +
'<span class="notetext">' + data.note + '</span>' +
'</span>';
Expand All @@ -146,7 +143,7 @@ var sendanmaki = window.sendanmaki = {

externalClick: function externalClick(event) {
event.preventDefault();
var href = event.currentTarget.getAttribute('href');
const href = event.currentTarget.getAttribute('href');
window.open(href, Date.now());
},

Expand All @@ -159,15 +156,13 @@ var sendanmaki = window.sendanmaki = {
domReady: function domReady() {
this.buildImageNotes(this.boguNotes);

var external = document.querySelectorAll('a[href^="http://"], a[href^="https://"]');
var result;
for (var i = 0; i < external.length; ++i) {
const external = document.querySelectorAll('a[href^="http://"], a[href^="https://"]');
let result;
for (let i = 0; i < external.length; ++i) {
result = external[i];
result.addEventListener('click', sendanmaki.externalClick);
}
}
};

(function jsLoaded() {
sendanmaki.domReady();
})();
sendanmaki.domReady();

0 comments on commit 1dbfe51

Please sign in to comment.