detect finger touch javascript canvas

I have this:

<canvas id="canvas" width="400" height="400" style="border:2px solid; background-color: #2c2c2c;"></canvas>
              <input type="button" value="Clear" class="canvas-clear" />
              <button onclick="toDataUrlForCanvas()">Submit</button>
          <script>
            $(document).ready(function() {
            var flag, dot_flag = false,
              prevX, prevY, currX, currY = 0,
              color = 'black', thickness = 2;
            var $canvas = $('#canvas');
            var ctx = $canvas[0].getContext('2d');
          
            $canvas.on('mousemove mousedown mouseup mouseout', function(e) {
              prevX = currX;
              prevY = currY;
              currX = e.clientX - $canvas.offset().left;
              currY = e.clientY - $canvas.offset().top;
              if (e.type == 'mousedown') {
                flag = true;
              }
              if (e.type == 'mouseup' || e.type == 'mouseout') {
                flag = false;
              }
              if (e.type == 'mousemove') {
                if (flag) {
                  ctx.beginPath();
                  ctx.moveTo(prevX, prevY);
                  ctx.lineTo(currX, currY);
                  ctx.strokeStyle = color;
                  ctx.lineWidth = thickness;
                  ctx.stroke();
                  ctx.closePath();
                }
              }
            });
          
            $('.canvas-clear').on('click', function(e) {
              c_width = $canvas.width();
              c_height = $canvas.height();
              ctx.clearRect(0, 0, c_width, c_height);
              $('#canvasimg').hide();
            });
          });
          
          function toDataUrlForCanvas() {
            var imgData = document.getElementById('canvas')
            imgData = imgData.toDataURL(); 
            console.log(imgData)
          }
          </script>

and right now it detects the mouse being pushed down, but when I use it on mobile, it doesn’t work because it doesn’t detect my finger on the canvas. I have tried to find some solutions online but nothing for this case. How can i fix this?

How to verify assertion updated for each address with only one user but have 3 addresses

I am trying to verify assertion for success case but I got stuck when using scenario outline for one user with the same address but a different type. each url update with be different address id to update so I have to use address id
I have code like this

Scenario Outline: Driver address is updated successfully with <testcase>
        And api request from file "/sharedConfigs/oauth2Token.json" is performed
        When api request from file "${apiConfigFolder}/requests/updateDriverAddress.json" is performed
        Then item "lastRun.status" is equal to 200
        And set "addressQuery" to file "${apiConfigFolder}/inputData/addressQuery.txt"
        And set "expectedAddressInfo" to file "${apiConfigFolder}/inputData/addressUpdate.json"
        And set "directory" to "${directory}/sharedConfigs/"
        And mysql query from string "${addressQuery}" is run
        # Run failed from this line, because lastRun[0] is only correct with addressId_0 not for 1 and 2 how can I verify for 1, 2 addressId 
        And "${lastRun[0]}" is equal to "${expectedAddressInfo}"

        Examples:
            | userId    | addressId      | city            | country            | county            | houseNameOrNumber            | line1            | line2            | postcode            | state            | subPostcode            | type         | testcase             |
            | ${userId} | ${addressId_1} | "${cityUpdate}" | "${countryUpdate}" | "${countyUpdate}" | "${houseNameOrNumberUpdate}" | "${line1Update}" | "${line2Update}" | "${postcodeUpdate}" | "${stateUpdate}" | "${subPostcodeUpdate}" | ${typeHome}  | type is DRIVER_HOME  |
            | ${userId} | ${addressId_2} | "${cityUpdate}" | "${countryUpdate}" | "${countyUpdate}" | "${houseNameOrNumberUpdate}" | "${line1Update}" | "${line2Update}" | "${postcodeUpdate}" | "${stateUpdate}" | "${subPostcodeUpdate}" | ${typeOther} | type is DRIVER_OTHER |
            | ${userId} | ${addressId_3} | "${cityUpdate}" | "${countryUpdate}" | "${countyUpdate}" | "${houseNameOrNumberUpdate}" | "${line1Update}" | "${line2Update}" | "${postcodeUpdate}" | "${stateUpdate}" | "${subPostcodeUpdate}" | ${typeWork}  | type is DRIVER_WORK  |

As you can see above in this line I have verified assertion for each row And "${lastRun[0]}" is equal to "${expectedAddressInfo}"
But with that in the scenario from lines 2 and 3 will be run failed. How can I verify for all rows that, all information is already updated as I expected? Please help me with this problem
Thank you so much

How to add class to only selected div based on hover

I am trying to add class to mainmenu div, but for some reason it add class to both the div, the div has same class, i only wanted to add class to selected div.

<div class="main-coloumn">
    <div id="col1">
      <div class="hidden">hidden text</div>
</div>
<div id="col2" class="class">
      <div class="menubox">
        <a class="toggleClass">toggleClass</a>
        <a class="toggleClass">toggleClass</a>
        <a class="toggleClass">toggleClass</a>
      </div>
      <div class="menubox">
        <a class="toggleClass">toggleClass</a>
        <a class="toggleClass">toggleClass</a>
        <a class="toggleClass">toggleClass</a>
      </div>
</div>
<div id="col3" class="class">
      <div class="mainmenu">
      <div class="menubox">
        <a class="toggleClass">toggleClass</a>
        <a class="toggleClass">toggleClass</a>
        <a class="toggleClass">toggleClass</a>
      </div>
      </div>
      <div class="mainmenu">
      <div class="menubox">
        <a class="toggleClass">toggleClass</a>
        <a class="toggleClass">toggleClass</a>
        <a class="toggleClass">toggleClass</a>
      </div>
      </div>
</div>
</div>

This is my JQUERY code.

(function($) {
$( document ).ready( function() {
    $('.menubox .toggleClass').hover(function () {
      // fade in the div in this object.
      $(this).closest('.main-coloumn').find('.class .mainmenu').toggleClass('class_name');
});
});
}(jQuery));

Lodash bracket syntax

Was looking through some source code and kept coming across this weird function creating bracket notation using lodash. I suspect that it is some lodash construct, but I don’t know what to search to read some docs on it.

Does any one know what this is called/have links to docs?

Thanks!

function findMessageInTree(desiredName, rootNode) {
  return rootNode.name === desiredName ? rootNode : (0, _lodash.find)(rootNode.replies.map((0, _lodash.partial)(findMessageInTree, desiredName)));
}

When Console Logging a Specific String, Extra Characters are Added

I am experiencing an issue that makes it so I am getting unnecessary characters that I do not want added into my console.log statement. Here’s whats happening:

I have a page in which I type something in a text box.

Heres how the text page looks like and how I am typing

And whatever I type into the text box printed out in the console.

When I use the characters n, it is replaced with n (without the space in between) for some reason. I am trying to get just n so I can go to the text line.

Here is what is logged into the console

If somebody could tell me how to not make this happen or at least why this is happening it would be much appriciated! I looked this up a lot online and could not find anything.

Thanks in advance

every time i try to write in search bar i have this error and table disappear

$("#search-name").keyup(function () {
        $('#employee-table tbody').html('');
        let nameKeyword = $("#search-name").val();
        employeeRef.orderBy('name', 'asc').startAt(nameKeyword).endAt(nameKeyword + "uf8ff").get()
        .then(function (documentSnapshots) {
            documentSnapshots.docs.forEach(doc => {
                renderEmployee(doc); });
            });
    });

[enter image description here][1]

–> Uncaught (in promise) ReferenceError: renderEmployee is not defined

Filter one array by type, depending other

I need to create two results from body_Task depending on the Header_Tasks.type

Header_Tasks

[
  {"_id":"AAA54" "title":"task 1" "type":1},
  {"_id":"bbb45" "title":"task 2" "type":2},
  {"_id":"ccc56" "title":"task 3" "type":1},
  {"_id":"xxx98" "title":"task 4" "type":2},
]

I have been created it depending on Header_Tasks,
its name is body_taks, I save the data (header, body) in my database because it has other functions on my project

body_taks

{
  "AAA54":10,
  "AAA54|max":10,
  "bbb45":07,
  "bbb45|max":20,
  "ccc56":05,
  "ccc56|max":30,
  "xxx98":03,
  "xxx98|max":15,
}

I wish it, two results depending on Header_Tasks.type

type 1

{
  "AAA54":10,
  "AAA54|max":10,
  "ccc56":05,
  "ccc56|max":30,
}

type 2

{
  "bbb45":07,
  "bbb45|max":20,
  "xxx98":03,
  "xxx98|max":15,
}

simple problem with basic js event that i cant solve because im a newbie [duplicate]

im working on a personal project to train javascript. However, I got an Uncaught ReferenceError: generateButton is not defined
at HTMLButtonElement.onclick (index.html:15)
message in console when i click the button.

This is my html line 15 code

<button onclick="generateButton()">Generate</button>

This is my js code

function generateButton() {
let displayWish = listWishes(Math.random() * listWishes.length);
document.getElementById("textarea").textContent = displayWish;
}

I cant find the mistake. Help me

How can I call a javascript function in a module from HTML when the module has been bundled by webpack?

This is probably a basic question but for some reason Google won’t give me the answer.

I have a file called dropzone.stub.js in my src/ folder

import { Dropzone } from "dropzone";
Dropzone.autoDiscover = true;

// Callback takes one argument and that is the file that was 
// added.
export default function createDropZone(selector, url, callback) {
  const myDropzone = new Dropzone(selector, { url: url });
  myDropzone.on("addedfile", callback);
}

Basically I am just trying to call it from with script tags within my HTML file.

My webpack bundler is configured as follows:

const path = require('path');

module.exports = {
  mode: 'development',
  entry: './src/dropzone.stub.js',
  output: {
    filename: 'dropzone.bundle.js',
    path: path.resolve(__dirname, 'dist'),
  },
  module: {
    rules: [
      {
        test: /.m?js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader',
          options: {
      //      presets: ['@babel/preset-env', {targets: 'defaults'}]
          }
        }
      },
//      {
//        test: /.css$/i,
//        use: ['style-loader', 'css-loader'],
//      },
      {
        test: /.(png|svg|jpg|jpeg|gif)$/i,
        type: 'asset/resource',
      },
    ],
    // resolve: {
    //  extensions: [ '.js', '.jsx', '.css' ],
    //}
  },
};

The script section in my HTML browser at the moment just looks like this:

<script type="module">
  import { createDropZone } from '/static/dist/dropzone.bundle.js';

</script>

The browser reports the following error:

Uncaught SyntaxError: The requested module '/static/dist/dropzone.bundle.js' does not provide an export named 'createDropZone'

Any ideas anyone?

Will this Minecraft minelayer / prismarines bot work?

I know that my title is very helpful but I think you can be helpful by helping me find a better one. Also if you could try to help with this code? I use to be a pro but I haven’t used this language in a while.

const ChatMessage = require('prismarine-chat')('1.16')

var options = {
  host: 'LFSowx.aternos.me',
  //port: 19132,// (must be an integer),
  username: 'NotchBot',
};

var bot = mineflayer.createBot(options);

bot.on('spawn', () => { console.log("- Spawned -")
  console.log("- Listening for messages -")
  for (const player of Object.values(bot.players)) {
    console.log("- Player " + player.displayName + " connected -")
  }
});

const msg = new ChatMessage({"text":"If you can see this then this works!"})

console.log(msg.toString()) // Example chat message

Multiple groups of tabs on the same page with CSS and Javascript

so, i know there are a few other such questions around, but basically all of them revolve around jQuery, which i haven’t used for my code and am not comfortable trying to implement as i used JS from a tutorial and am not really familiar with it. if this is all best implemented with jQuery i’m open to using it but i’d need very clear steps to do so.

what i want is to have what are currently buttons at the bottom of my page function like tabs (though have a similar design). so the first tab would be what’s visible under the first three buttons (butt1/2/3), with the other tabs being similar, and the round buttons also being able to tab between content (if that’s possible).

if making them buttons is simpler then i’m down for that, whatever works best for what i’m trying to implement.

//top tabs functionality
function openStory(evt, storyName) {
  var i, storycontent, storylinks;
  storycontent = document.getElementsByClassName("storycontent");

  for (i = 0; i < storycontent.length; i++) {
    storycontent[i].style.display = "none";
  }
  storylinks = document.getElementsByClassName("storylinks");

  for (i = 0; i < storylinks.length; i++) {
    storylinks[i].className = storylinks[i].className.replace(" active", "");
  }
  document.getElementById(storyName).style.display = "block";
  evt.currentTarget.className += " active";
}

document.getElementById("storyActive").click();

//accordion functionality
var acc = document.getElementsByClassName("accordionHeader");
var panel = document.getElementsByClassName('accPanel');

for (var i = 0; i < acc.length; i++) {
  acc[i].onclick = function() {
    var setClasses = !this.classList.contains('open');
    var isOpen = !!this.classList.contains('open');
    if (!isOpen) {
      setClass(acc, 'open', 'remove');
      setClass(panel, 'open', 'remove');
    }
    if (setClasses) {
      this.classList.toggle("open");
      this.nextElementSibling.classList.toggle("open");
    }
  }
}

function setClass(els, className, fnName) {
  for (var i = 0; i < els.length; i++) {
    els[i].classList[fnName](className);
  }
}

document.getElementById("defaultOpen").click();

//details buttons
const imageSlot = document.getElementById('imageSlot');
const buttons = document.querySelectorAll('.butt');

const images = [{
    id: 'b1',
    url: 'https://i.imgur.com/88RXBjW.jpg'
  },
  {
    id: 'b2',
    url: 'https://i.imgur.com/HRDdfho.jpg'
  },
  {
    id: 'b3',
    url: 'https://i.imgur.com/VM9Nsjd.jpg'
  },
  {
    id: 'b4',
    url: 'https://i.imgur.com/788MQOl.jpg'
  },
];

buttons.forEach((button) => {
  button.addEventListener('click', changeImage);
});

function changeImage(e) {
  const target = e.target.textContent;
  imageSlot.src = images.find((img) => img.id === target).url;
}
* {
  box-sizing: border-box;
}

body {
  font-family: Roboto, sans-serif;
  font-size: 16px;
  background-color: navajowhite;
  margin: auto;
}

h1 {
  font-family: Vollkorn SC, serif;
  font-size: 75px;
  text-align: center;
  margin: auto;
}

h2 {
  font-family: Roboto Slab, serif;
  font-size: 25px;
}

h3 {
  font-family: Roboto Slab, serif;
  font-size: 20px;
  padding: 0;
  margin: 0;
}

ul {
  list-style: circle inside;
  padding-left: 20px;
  margin: 0;
}


/* all the grid stuff */

.content {
  position: absolute;
}

.top-grid {
  display: grid;
  grid-template-columns: 250px 250px 1.5fr;
  gap: 2px;
  background-color: violet;
  grid-auto-flow: row;
  grid-template-areas: "banner banner name" "banner banner basics"
}

.top-grid>div {
  margin: 3px;
}

.item1 {
  grid-area: name;
  padding: 5px;
  background-color: azure;
}

.item2 {
  grid-area: banner;
  padding: 5px;
  background-color: azure;
}

.item3 {
  grid-area: basics;
  padding: 5px;
  background-color: azure;
}

.middle-grid {
  display: grid;
  grid-template-columns: 50% 1.5fr;
  grid-template-rows: auto auto;
  gap: 2px;
  margin-top: 3px;
  margin-bottom: 3px;
  background-color: blueviolet;
  grid-auto-flow: row;
  grid-template-areas: "stuff1 stuff2" "details details"
}

.middle-grid>div {
  margin: 3px;
}

.stuff1 {
  grid-area: stuff1;
  padding: 5px;
  background-color: cornflowerblue;
}

.stuff2 {
  grid-area: stuff2;
  padding: 5px;
  background-color: cornflowerblue;
}

.stuff3 {
  grid-area: details;
  padding: 5px;
  background-color: cornflowerblue;
}

.bottom-grid {
  display: grid;
  grid-template-columns: 50px 75% 1.5fr;
  grid-template-rows: auto auto;
  gap: 2px;
  background-color: mediumorchid;
  grid-auto-flow: row;
  grid-template-areas: "buttons design extras" "relationships relationships relationships"
}

.bottom-grid>div {
  margin: 3px;
}

.buttons {
  grid-area: buttons;
  padding: 5px;
  background-color: paleturquoise;
}

.design {
  grid-area: design;
  padding: 5px;
  background-color: paleturquoise;
}

.extras {
  grid-area: extras;
  padding: 5px;
  background-color: paleturquoise;
}

.relationships {
  grid-area: relationships;
  padding: 5px;
  background-color: paleturquoise;
}


/* top tabs style */

.allstory {
  background-color: rgba(255, 255, 255, 0);
}

.story {
  overflow: hidden;
  border: none;
  background-color: rgba(255, 255, 255, 0);
}

.story button {
  background-color: rgb(211, 194, 174);
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0 15px 0 5px;
  font-size: 17px;
  transition: 0.3s;
}

.story button:hover {
  background-color: #ddd;
}

.story button.active {
  background-color: rgb(243, 234, 223);
  border-bottom: 1px solid rgb(243, 234, 223);
}

.storywrapper {
  background-color: rgb(243, 234, 223);
  padding: 5px;
}

.storycontent {
  display: none;
  padding: 5px;
  background-color: darksalmon;
  border: 1px solid #ccc;
  border-top: none;
  animation: fadeEffect 0.8s;
}

@keyframes fadeEffect {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}


/* accordion */

.accordionHeader {
  background-color: rgba(255, 255, 255, 0);
  color: black;
  cursor: pointer;
  padding: 10px;
  width: 100%;
  text-align: left;
  font-size: 18px;
  border-top: none;
  border-left: none;
  border-right: none;
  border-bottom: 1px solid rgb(82, 82, 82);
  outline: none;
  transition: 0.4s;
}

.accPanel {
  padding: 0 10px;
  background-color: rgba(255, 255, 255, 0);
  display: none;
  overflow: hidden;
  transition: max-height 0.5s ease-out;
}

.open {
  display: block;
}


/* tables */

table {
  border: none;
  border-spacing: 25px 5px;
  border-collapse: separate;
}

.table-dad {
  display: flex;
  justify-content: center;
  align-items: center;
}

.table1 {
  display: inline-block;
  width: 0.75fr;
}

.table2 {
  display: inline-block;
  width: 0.75fr;
}

.table3 {
  border: none;
  border-spacing: 75px 5px;
  text-align: center;
  vertical-align: middle;
  margin-left: auto;
  margin-right: auto;
}

th {
  font-family: Roboto Slab, serif;
}


/* butts */

.btn-dad {
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-group .butt {
  background-color: coral;
  display: block;
  border-radius: 50%;
  border: 1px solid;
  padding: 5px;
  margin-top: 5px;
  text-align: center;
  font-size: 15px;
  cursor: pointer;
  width: 35px;
}

.btn-group .butt:hover {
  background-color: firebrick;
}

.btn-dad-2 {
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-group-2 .butt2 {
  background-color: blanchedalmond;
  display: inline-block;
  border-radius: 10%;
  border: 1px solid;
  padding: 5px;
  margin-left: 5px;
  text-align: center;
  font-size: 15px;
  cursor: pointer;
  width: 100px;
}

.btn-group-2 .butt2:hover {
  background-color: burlywood;
}

.btn-group-3 .butt3 {
  background-color: lemonchiffon;
  display: inline-block;
  border-radius: 50%;
  border: 1px solid;
  padding: 5px;
  margin-top: 5px;
  margin-left: 5px;
  cursor: pointer;
  width: 60px;
  height: 60px;
}

.btn-group-3 .butt3:hover {
  background-color: peru;
}
<!DOCTYPE html>
<html>

<head>
  <title>character page</title>
  <link rel="stylesheet" href="character page css.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Vollkorn+SC|Roboto|Roboto+Slab">
</head>

<body>
  <div class="content">
    <div class="top-grid">
      <div class="item1">
        <h1>Character Name</h1>
      </div>
      <div class="item2"><img src="https://i.imgur.com/TzDzHFY.png" style="max-width: 485px;"></div>

      <div class="item3">
        <div class="table-dad">
          <h2>basic details</h2>
          <!--top table left-->
          <table class="table1">
            <tr>
              <th style="text-align: left;">nickname(s)</th>
              <td style="width: 250px; table-layout: fixed;">stuff</td>
            </tr>
            <tr>
              <th style="text-align: left;">gender</th>
              <td style="width: 250px; table-layout: fixed;">stuff</td>
            </tr>
            <tr>
              <th style="text-align: left;">d.o.b.</th>
              <td style="width: 250px; table-layout: fixed;">stuff</td>
            </tr>
          </table>
          <!--top table right-->
          <table class="table2">
            <tr>
              <th style="text-align: left;">nationality</th>
              <td style="width: 250px; table-layout: fixed;">stuff</td>
            </tr>
            <tr>
              <th style="text-align: left;">birthplace</th>
              <td style="width: 250px; table-layout: fixed;">stuff</td>
            </tr>
            <tr>
              <th style="text-align: left;">species</th>
              <td style="width: 250px; table-layout: fixed;">stuff</td>
            </tr>
          </table>
        </div>
      </div>
    </div>

    <div class="middle-grid">
      <!--middle table left-->
      <div class="stuff1">
        <h3 style="text-align: center;">other details</h3>
        <table class="table3">
          <tr>
            <th>item</th>
            <td>stuff</td>
          </tr>
          <tr>
            <th>item</th>
            <td>stuff</td>
          </tr>
        </table>
      </div>
      <!--middle table right-->
      <div class="stuff2">
        <h3 style="text-align: center;">other details</h3>
        <table class="table3">
          <tr>
            <th>item</th>
            <td>stuff</td>
          </tr>
          <tr>
            <th>item</th>
            <td>stuff</td>
          </tr>
        </table>
      </div>

      <div class="stuff3">
        <div class="allstory">
          <!--tab buttons-->
          <div class="story">
            <button class="storylinks" onclick="openStory(event, 'story1')" id="storyActive">tab1</button>
            <button class="storylinks" onclick="openStory(event, 'story2')">tab2</button>
            <button class="storylinks" onclick="openStory(event, 'story3')">tab3</button>
          </div>
          <!--tabs content-->
          <div class="storywrapper">
            <div id="story1" class="storycontent">
              <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis
                aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
            </div>
            <div id="story2" class="storycontent">
              <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem
                quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non
                numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel
                eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
            </div>
            <div id="story3" class="storycontent">
              <!--accordion-->
              <button class="accordionHeader" id="defaultOpen">section 1</button>
              <div class="accPanel">
                <p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia
                  deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus,
                  omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur
                  a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.</p>
              </div>

              <button class="accordionHeader">section 2</button>
              <div class="accPanel">
                <p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia
                  deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus,
                  omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur
                  a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.</p>
              </div>
              <button class="accordionHeader">section 3</button>
              <div class="accPanel">
                <p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia
                  deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus,
                  omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur
                  a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="bottom-grid">
      <div class="buttons">
        <div class="btn-group">
          <div class="butt">b1</div>
          <div class="butt">b2</div>
          <div class="butt">b3</div>
          <div class="butt">b4</div>
        </div>
      </div>
      <div class="design">
        <img id="imageSlot" src="https://i.imgur.com/88RXBjW.jpg" style="max-width: 100%;">
      </div>
      <div class="extras">
        <h3>possessions</h3>
        <ul>
          <li>item1</li>
          <li>item2</li>
        </ul>
        <h3 style="margin-top: 10px;">design notes</h3>
        <ul>
          <li>item1</li>
          <li>item2</li>
        </ul>
      </div>
      <div class="relationships">
        <div class="btn-dad">
          <div class="btn-group-2">
            <div class="butt2">butt1</div>
            <div class="butt2">butt2</div>
            <div class="butt2">butt3</div>
            <div class="butt2">butt4</div>
          </div>
        </div>
        <div class="btn-dad-2">
          <div class="btn-group-3">
            <div class="butt3">oc1</div>
            <div class="butt3">oc2</div>
            <div class="butt3">oc3</div>
            <div class="butt3">oc4</div>
          </div>
        </div>
        <div>
          <h2>relationship</h2>
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
            irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
        </div>
      </div>
    </div>
  </div>

  <script src="character page js.js" type="text/javascript"></script>
</body>

</html>

i might also want to (later) have tabs that can affect the images in the middle section but since i’m still undecided on that i’d just like for the code to be flexible/easy to adapt.

any help is much appreciated! and hopefully after this i can stop asking so many questions.

How can i load data from text file into array [duplicate]

I have the need to load an array of objects that are stored in a text file to be used as an array in my code. The text file looks like this..

[{"ip":"195.54.160.149","date":"2021-12-30T18:47:06.570Z","url":"/"},
{"ip":"92.118.234.202","date":"2021-12-30T18:55:41.886Z","url":"http://azenv.net/"}]

when I read the file and then set my var to the data from the txt file

      readBlacklist: function() {
            fs.readFile(file, 'utf8' , (err, data) => {
                if (err) {
                  console.error(err);
                  return
                }
                this.accesslog = data
              });

        },

I get an error when i want to push any new objects into my this.accesslog. So my question is, is there a fast way to read from file and set the data of this.accesslog to the file data and still make it be recognized as an Array of objects or do i need to read the file and then loop thru it and push each object into the array ?
One of the issues is that I don’t know if the Object will always end with a n so i cant use a newline as a separator, I know it will always be an object which will start with a { and end with a }

JavaScript mapbox bounds – only get coordinates

I’m using mapbox and I’m trying to send my bounding box coordinates to an api using JavaScript. My existing code go do this is here:

    var ne = map.getBounds().getNorthEast();
    var sw = map.getBounds().getSouthWest();
    getGrid(ne, sw);

This is documented here:
https://docs.mapbox.com/mapbox.js/api/v3.3.1/l-latlng/

However this sends it as follows:

var ne = LngLat(-0.19424453896019145, 51.52165574100269)
var sw = LngLat(-0.19708728301148426, 51.52033324794837)

However I don’t want to be sending the brackets or LngLat to my api in the url, i instead want to send something more clean like this:

var sw = -0.19708728301148426, 51.52033324794837

How can I do that? Is there a way to clean this up in JS, or better yet just get only the coordinates returned in the first place?