How to make conditional props in Bootstrap Button Group in ReactJS

I have useState as below:

 const [orderStandard, setOrderStandard] = useState("total");

And according to the value of orderStandard, I want to give props.

This below code is ButtonGroup of BootStrap with ReactJS.

https://react-bootstrap.github.io/components/button-group/#button-toolbar-props

   <ButtonGroup
            style={{
              height: 35,
              display: "flex",
              justifyContent: "center",
              alignItems: "center",
            }}
          >
            <Button
              id="order-button"
              variant="light"
              style={{ width: 80 }}
              active
              onClick={() => setOrderStandard("total")}
            >

above, among props of Button, active make button being selected.

So I make it conditional as below.

enter image description here

However it throws error. Error says: '...' expected.ts(1005)

So I make with ...

 <Button
                  id="order-button"
                  variant="light"
                  style={{ width: 80 }}
                  {...(orderStandard == "total" ? active : null)}
                  onClick={() => setOrderStandard("total")}
                >

But when I wrote code above, It says active props is not defined.

enter image description here

How can I make it?

How to prevent hiding elements by X in highcharts?

The problem is that when the screen is reduced, the icons under the graphs will be removed, but this would not be desirable. I also tried to set zoomEnabled: false, having previously registered in zoomType: 'xy', it did not help. I also tried to change labels: overflow: "allow", padding: 1, also without changes. Only reducing the size of the icons helped, but in order for them not to disappear, you need to reduce them very much.

How to make sure that the icons do not disappear on a small screen, or at least only those missing from the chart are hidden (cancellation of adaptation for the X axis)?

Example code for initialization. (Commented out my assumptions):

chart1 = new Highcharts.Chart({
     chart: {
        type: 'column',
        //zoomType: 'xy',
     },
     title: {
        text: 'Title'
     },
     xAxis: {
           categories: $.map(months, function (item) {
               return item;
           }),
           labels: {
               useHTML: true,
               //overflow: "allow",
               //padding: 1,
               fotmatter: function() {
                 let icons = $.map(months, function (item) {
                     let icon = counter;
                     arrayIcon[item] = '<img src="icon_' + item + '.png" height="20">'
                 });

                 let objIcons = Object.assign({}, arrayIcon);
                 return objIcons[this.value];
                },
           },
           //zoomEnabled: false
       },
     yAxis: {
        title: {
           text: 'Sub-title'
        }
     },
     plotOptions: {
            column: {
              states: {
                inactive: {
                    enabled: false
                }
              }
            }
         },
     series: [{
        name: 'Dev #1',
        data: [5, 10, 20, 22, 25, 28, 30, 40, 80, 90]
     }, {
        name: 'Dev #2',
        data: [15, 15, 18, 40, 30, 25, 60, 60, 80, 70]
     }]
    });

In the image, what happens when the screen is reduced
image

Module not found after being just installed

Sorry I am not fluent with node.js. Below is what is happening to me, which I interpret as package not found although it was just installed.

It is probably wrong, so what happened and how to fix?

>:~/personal/schematosis# npm install --save-dev javro

up to date, audited 73 packages in 1s

13 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
>:~/personal/schematosis# node convert.js             
node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module 'javro'
Require stack:
- <HOME>/personal/schematosis/convert.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (<HOME>/personal/schematosis/convert.js:1:45)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'HOME/schematosis/convert.js' ]
}

Node.js v18.11.0

convert.js is copypasted from here https://github.com/ExpediaGroup/javro#use-javro-in-your-build

How can I get my Javascript function to listen to events and show in my HTML markup?

I wanted to practice vanilla Javascript fundamentals, and I can’t see why my startGame() function isn’t defined. Probably missing something basic.

      <button
        id="start-btn"
        class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"
        onclick="startGame()"
      >
        Start
      </button>
    
    

Here’s the script and markup:

// Get references to the form inputs and start button
const usernameInput = document.getElementById("username");
const roundsInput = document.getElementById("rounds");
const puzzlesPerRoundInput = document.getElementById("puzzles-per-round");
const maxDigitsInput = document.getElementById("max-digits");
const timeBetweenChallengesInput = document.getElementById("time-between-challenges");
const additionCheckbox = document.getElementById("addition-checkbox");
const subtractionCheckbox = document.getElementById("subtraction-checkbox");
const multiplicationCheckbox = document.getElementById("multiplication-checkbox");
const divisionCheckbox = document.getElementById("division-checkbox");
const startBtn = document.getElementById("start-btn");

// Add a click event listener to the start button
startBtn.addEventListener("click", function() {
  // Get the values from the form inputs
  const username = usernameInput.value;
  const rounds = parseInt(roundsInput.value);
  const puzzlesPerRound = parseInt(puzzlesPerRoundInput.value);
  const maxDigits = parseInt(maxDigitsInput.value);
  const timeBetweenChallenges = parseFloat(timeBetweenChallengesInput.value);
  const additionChecked = additionCheckbox.checked;
  const subtractionChecked = subtractionCheckbox.checked;
  const multiplicationChecked = multiplicationCheckbox.checked;
  const divisionChecked = divisionCheckbox.checked;

  // Validate the form inputs
  if (isNaN(rounds) || isNaN(puzzlesPerRound) || isNaN(maxDigits) || isNaN(timeBetweenChallenges)) {
    alert("Please enter valid values for all fields");
    return;
  }


  // Initialize the game state
  let puzzlesSolved = 0;
  let puzzlesTried = 0;
  let roundsComplete = 0;
  let roundDifficulty = maxDigits / timeBetweenChallenges;
  let timePerRound = puzzlesPerRound * timeBetweenChallenges + 60;
  let timeLeftover = 200 - timePerRound;

  // Start the game loop
function startGame() {  
  for (let round = 1; round <= rounds; round++) {
    for (let i = 1; i <= puzzlesPerRound; i++) {
      // Start the countdown timer for the current puzzle
      let timeLeft = timePerRound;
      let countdownInterval = setInterval(function() {
        timeLeft -= 1;
        if (timeLeft <= 0) {
          clearInterval(countdownInterval);
          // Handle time's up
          console.log('Time for round is up!')
          window.removeEventListener("keydown", inputHandler);
        } else {
          // Update the countdown display
          // TODO: display timeLeft
          timeLeftSpan.textContent = timeLeft;
        }
      }, 1000);

      // Generate a random pair of numbers and pick an operation
      let num1 = Math.floor(Math.random() * (10 ** maxDigits - 1) + 1);
      let num2 = Math.floor(Math.random() * (10 ** maxDigits - 1) + 1);
      
        let operation;
  if (additionChecked) {
    operation = "+";
  } else if (subtractionChecked) {
    operation = "-";
    // Make sure result is non-negative
    if (num2 > num1) {
      [num1, num2] = [num2, num1];
    }
  } else if (multiplicationChecked) {
    operation = "*";
  } else if (divisionChecked) {
    operation = "/";
    // Make sure quotient is an integer
    if (num2 > num1) {
        num1 = num2 * Math.floor(Math.random() * (10 ** (maxDigits - 1) - 1) + 1);
    }
  }

  // Calculate the expected result
  let result = eval(num1 + operation + num2);

  // Flash the numbers to the user
  notification.textContent = `${num1} ${operation} ${num2}`;
  setTimeout(() => {
    notification.textContent = "";
  }, timeBetweenChallenges * 1000);

  // Listen for the user's input
  let userInput = "";
  let inputHandler = (e) => {
    userInput += e.key;
    notification.textContent = userInput;
  };
  window.addEventListener("keydown", inputHandler);

  // Wait for the user to input their answer or for the time to run out
  let timer = setInterval(() => {
    timeLeft -= 1;
    timeLeftSpan.textContent = timeLeft;
    if (timeLeft === 0) {
      clearInterval(timer);
      notification.textContent = "";
      window.removeEventListener("keydown", inputHandler);
      puzzlesTried += 1;
      displayResults();
    }
    if (userInput === result.toString()) {
      clearInterval(timer);
      window.removeEventListener("keydown", inputHandler);
      puzzlesSolved += 1;
      puzzlesTried += 1;
      displayResults();
    }
  }, 1000);
}

  }
}

// Function to display results in the bottom area
function displayResults() {
puzzlesSolvedSpan.textContent = puzzlesSolved;
puzzlesTriedSpan.textContent = puzzlesTried;
timeLeftSpan.textContent = timeLeft;
roundDifficultySpan.textContent = roundDifficulty.toFixed(2);
}


//
//
// Save data to JSON file using Node
// const fs = require('fs');

// const data = {
//   timestamp: new Date(),
//   username,
//   timeLeftover,
//   puzzlesSolved,
//   puzzlesTried,
//   roundDifficulty,
// };
// const jsonData = JSON.stringify(data);

// fs.appendFile('anzanHistory.json', jsonData, (err) => {
//   if (err) throw err;
//   console.log('Data saved to file!');
// });



// Save data to JSON file using localstorage
// const data = {
//     timestamp: new Date(),
//     username,
//     timeLeftover,
//     puzzlesSolved,
//     puzzlesTried,
//     roundDifficulty,
//   };
//   localStorage.setItem('anzanHistory', JSON.stringify(data));
  
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Anzan Flash</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.1.2/tailwind.min.css">
  <script src="flashAnzan.js"></script>
</head>
<body class="bg-gray-100">

  <div class="container mx-auto my-8">
    <!-- Top notifications area -->
    <div class="flex justify-center mb-8">
      <div id="notification" class="w-1/2 bg-gray-300 p-2 rounded-md"></div>
    </div>

    <!-- Middle input area -->
    <div class="flex justify-center mb-8">
      <form class="w-1/2 bg-white p-4 rounded-md shadow-md">
        <div class="mb-4">
          <label class="block text-gray-700 font-bold mb-2" for="username">
            Username
          </label>
          <input
            class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
            id="username"
            type="text"
            placeholder="Enter your username">
        </div>
        <div class="mb-4">
          <label class="block text-gray-700 font-bold mb-2" for="rounds">
            Rounds
          </label>
          <input
            class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
            id="rounds"
            type="number"
            min="1"
            max="10"
            placeholder="Enter number of rounds">
        </div>
        <div class="mb-4">
          <label class="block text-gray-700 font-bold mb-2" for="puzzles-per-round">
            Puzzles per Round
          </label>
          <input
            class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
            id="puzzles-per-round"
            type="number"
            min="1"
            max="10"
            placeholder="Enter number of puzzles per round">
        </div>
        <div class="mb-4">
          <label class="block text-gray-700 font-bold mb-2" for="max-digits">
            Max Digits
          </label>
          <input
            class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
            id="max-digits"
            type="number"
            min="1"
            max="4"
            placeholder="Enter max digits for puzzles">
        </div>
        <div class="mb-4">
          <label class="block text-gray-700 font-bold mb-2" for="time-between-challenges">
            Time Between Challenges (seconds)
          </label>
          <input
            class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
            id="time-between-challenges"
            type="number"
            min="0.5"
            max="10"
            onchange="maxDigits = this.value"
          >
      </div>
      <div class="my-4">
        <label class="flex items-center">
          <input
            id="addition-checkbox"
            type="checkbox"
            class="form-checkbox h-5 w-5 text-gray-600"
            name="addition"
            value="addition"
            checked
            onchange="addition = this.checked"
          >
          <span class="ml-2 text-gray-700">Addition</span>
        </label>
        <label class="flex items-center">
          <input
            id="subtraction-checkbox"
            type="checkbox"
            class="form-checkbox h-5 w-5 text-gray-600"
            name="subtraction"
            value="subtraction"
            onchange="subtraction = this.checked"
          >
          <span class="ml-2 text-gray-700">Subtraction</span>
        </label>
        <label class="flex items-center">
          <input
            id="multiplication-checkbox"
            type="checkbox"
            class="form-checkbox h-5 w-5 text-gray-600"
            name="multiplication"
            value="multiplication"
            onchange="multiplication = this.checked"
          >
          <span class="ml-2 text-gray-700">Multiplication</span>
        </label>
        <label class="flex items-center">
          <input
            id="division-checkbox"
            type="checkbox"
            class="form-checkbox h-5 w-5 text-gray-600"
            name="division"
            value="division"
            onchange="division = this.checked"
          >
          <span class="ml-2 text-gray-700">Division</span>
        </label>
      </div>
      <button
        id="start-btn"
        class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"
        onclick="startGame()"
      >
        Start
      </button>
    
    
    
    <div id="game-container" class="hidden">
      <div class="text-center text-xl font-bold my-4" id="challenge-timer">
        Time: <span id="time"></span>
      </div>
      <div class="flex justify-center my-4">
        <div class="mx-4">
          <span class="text-gray-700 font-bold text-xl" id="num1"></span>
        </div>
        <div class="mx-4">
          <span class="text-gray-700 font-bold text-xl" id="operator"></span>
        </div>
        <div class="mx-4">
          <span class="text-gray-700 font-bold text-xl" id="num2"></span>
        </div>
        <div class="mx-4">
          <span class="text-gray-700 font-bold text-xl">=</span>
        </div>
        <div class="mx-4">
          <input
            class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
            id="user-answer"
            type="number"
            onkeydown="if (event.keyCode == 13) checkAnswer()"
          >
        </div>
      </div>
      <!-- <div class="flex items-center justify-center mt-4">
        <button
          id="start-btn"
          class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline"
        >
          Starting
        </button>
      </div> -->
      
    </div>

    <!-- Bottom results area -->
    <div class="flex justify-between items-center bg-gray-200 py-4 px-6">
        <div class="flex-1 text-sm text-gray-600">
          Time Left: <span id="time-left"></span>
        </div>
        <div class="flex-1 text-sm text-gray-600 text-center">
          Difficulty: <span id="round-difficulty"></span>
        </div>
        <div class="flex-1 text-sm text-gray-600 text-right">
          Solved/Tried: <span id="puzzles-solved"></span>/<span id="puzzles-tried"></span>
        </div>
    </div>
    
   

How to save Invoice Header and invoice rows on single page submit form with .net core razor pages?

1.Explaination

I want to open the “Create” page, fill the invoice header data, fill the invoice dynamic rows data and save everything on one single submit.

2.Question

How can this be done?

3. The frontend code:

<form method="post">
                <div asp-validation-summary="ModelOnly" class="text-danger"></div>

// This is the header table

                <table class="table table-striped border-0"
                       style="width: 100%; text-align: left;">
                    <thead class="border-0">
                        <tr class="border-0">
                            <td class="border-0" style="min-width:100%;">
                                <div class="border border-secondary p-4">
                                    <div class="row ">
                                        <div style="float:left;width:25%;">
                                            <div class="form-group m-1">
                                                <label asp-for="InvHeader.CliId" class="control-label" style="font-size:80%;">Client</label>
                                                <select asp-for="InvHeader.CliId" class="form-control font-weight-bold text-primary" asp-items="ViewBag.FurId"></select>
                                            </div>
                                        </div>

                                        <div style="float:left;width:25%;">
                                            <div class="form-group m-1">
                                                <input asp-for="InvHeader.InvDate" class="form-control" type="date" value="@(DateTime.UtcNow.Date.ToString("yyyy-MM-dd"))" />
                                                <span asp-validation-for="InvHeader.InvDate" class="text-danger"></span>
                                            </div>

                                        </div>
                                        <div style="float:left;width:25%;">
                                            <div class="form-group m-1">
                                                <input asp-for="InvHeader.InvNr" class="form-control" value=""/>
                                                <span asp-validation-for="InvHeader.InvNr" class="text-danger"></span>
                                            </div>
                                        </div>
                                </div>
                            </td>
                        </tr>
                    </thead>
                </table>

//This is the dynamic rows table

 <table id="table1" border="0">
            <tr style="font-size:80%;">                  
                <th style="width:50%;">Product</th>
                <th style="width:5%;">qty</th>
                <th style="width:5%;">price</th>
            </tr>
                        foreach (var item in Model.PL)
                {
                    <tr class="border-bottom">                           
                        <td>
                            <select id="Products" asp-for="@Model.PL[@i].ProdId" class="form-control" type="text" name="data[@i][ProdId]" style="width:100%;"    >
                              
                                @foreach (var item in Model.PL)
                                {
                                    <option    value="@item.ProdId"    
                                            qty="@qty"
                                        price="@Convert.ToInt32(item.price)">@item.name,   @Convert.ToInt32(item.price)</option>
                                }
                            </select>
                        </td>
                        <td><input asp-for="@Model.MR[@i].qty" class="form-control" type="text" name="qty[@i]" style="width:100%;" /></td>
                                <td><input asp-for="@Model.MR[@i].price" class="form-control" type="text" name="price[@i]" style="width:100%;" /></td>
                     </tr>
                     </table>
                     
                     </form>

4.The backend code

//The data binding part

[BindProperty]
    public InvHeaders InvHeader { get; set; } = default!;
    [BindProperty]
    public InvRows InvRow { get; set; } = default!;
    public IList <InvRows> MR { get; set; } = default!;

//The Onpost method

 public async Task<IActionResult> OnPostAsync(List<InvRows> addrows)
    {
        if (!ModelState.IsValid)
        {
            return Page();
        }

        _context.InvHeaders.Add(InvHeader);

        _context.InvRows.AddRange(addrows);

        await _context.SaveChangesAsync();

        return RedirectToPage("./Index");
    }

Getting value value from textbox inside loop with c#

I have a table in my project, I loop the trs in this table. There are textboxes in the table. When I make changes and want to save, it takes action based on the first record. I share the image

enter image description here

The second record in the picture above “toptan” I changed it to. but the record that came to me “Perakendee”
So my code always gets the value of the first record. Is there a way to solve this? Or a more Logical coding

HTML codes

  <table id="kullanicilistesi" class="table mb-3 table-center">
     <thead>
    <tr>
  <th class="border-bottom text-start py-3">Şirket Adı</th>
       <th class="border-bottom text-start py-3">Database (Veri Tabanı)</th>
          <th class="border-bottom text-center py-3">Şube</th>
                 <th class="border-bottom text-center py-3">Diğer</th>
              </tr>
            </thead>

           <tbody>
                @foreach (var item in AdminStatic.GetIsletme())
        {
               <tr>
                      <td class="">
     <input type="text"  id="isletmeadi" class="form-control" value="@item.IsletmeAdi" />
                                              
     </td>
       <td class=""> <input type="text" id="veritabani" class="form-control" value="@item.VeriTabani" /></td>
   <td class=""> <input type="text" id="sube" class="form-control" value="@item.Sube" /></td>

     <td class="">
   <a style="color:limegreen;" href`your text`="javascript:void(0)"  data-idd="@item.ID"  onclick="IsletmeDuzenle(this)">
       <i class="uil uil-check"></i>
     </a>

      <a style="color: rgb(217, 37, 37); " href="javascript:void(0)" onclick="IsletmeSil(@item.ID)">
       <i class="uil uil-trash"></i>
       </a>
     </td>

                  </tr>
    }

   </tbody>
      </table>

Javascript Codes

function IsletmeDuzenle(t) {
    var id = $(t).data('idd');
    alert($("#isletmeadi").val());
    getValue($baseUrl + "/B2BAdmin/IsletmeDuzenle",
        { id: id, isletmeAdi: $("#isletmeadi").val(), veritabani: $("#veritabani").val(), sube: $("#sube").val() },
        function (data, err) {
            if (data=="Basarili") {
                Swal.fire({
                    title: 'Başarılı',
                    html: 'İşletme Başarıyla Güncellenmiştir',
                    icon: 'success'
                }).then(function (result) {
                    window.location.reload();
                });
            }
        })
}

Reading, writing and creating a CSS file with pure Javascript

I’ve a project that uses CSS-variables to set the colors. With Vanilla JS I can create a front-end method to change the CSS-variables so you can see the color changes on-the-go. Now I want to save this changes in a CSS file on the server and inject it in the head tag.

Search results tells me how to inject a CSS file that already exists. In my case I want to create the CSS file itself with javascript. I was thinking about the following:

  • Beside the global css of the project I add a CSS file named ‘theme-default.css’ consisting of all the default theme variables. For example:
     ::root {
        --color1:  red;
        --color2:  blue;
     }
  • A Javascript code reads the file. It gets all the variables and list them somewhere in the front-end. For each variable it adds a <input type="color" /> to change the variable input.
  • There’s a save button that if gets triggered, the code will read all the new variables and add them to a new css file named ‘theme-custom.css’. This file gets injected in the <head> so it will override the thema-defaults.

Adding and remove to favorites button in popup html

enter image description here

I want to perform the following functions, can anyone give me keywords or how to do it?

  1. create a SAVE button for all headlines in the news site
  2. save that news in the popup, you can review it if you have a need or you can delete it
  3. If the information has already been saved, it will be saved, the information cannot be duplicated
  4. delete all the news that in the popup

Importing JavaScript Class causing and Uncaught Reference Error

I’m coding a few JavaScript classes for my school project and need to make some circuit breaker components. I’m following the standard for importing and exporting JavaScript classes, but when I test the code using XAMPP and the website being built for these JavaScript classes, I’m getting this error “CircuitBreaker.js:12 Uncaught ReferenceError: Cannot access ‘Component’ before initialization at CircuitBreaker.js:12:37”

Here are the Classes Connected to this Component.

Component.js

import {Drag_Event, Zoom_Event} from "./CADDIEngine.js";

export class Component {
    constructor(name, color="black", iconPath=null) {
        // Functionality 
        this.children = [];
        this.current_rating = 0         // component current rating
        this.errors = [];
        this.frequency = 0;             // if Component has a frequency rating it should be 60hz
        this.id = 0;                    // RBDC team will implement a UUID system later
        this.icon_path = " ";                // this should be a hard coded path using in the 
                                        //    child class contructor
        this.name = name;
        this.parent = null;             // start the parent as null
        this.pass_up_map = {};          // Used for passing information up & down the tree
        this.personal_current_draw = 1; // This will not be used for most components
        this.phase = 0;                 // 1 = single-phase, 3 = three-phase, 0 = N/A
        this.sccr = 0;                  // "short circuit current rating"
        this.type_array = [];           // list of function types component fulfils
        this.volt_rating = {            //Component voltage rating range
          min: 0,
          max: 0
        };
        this.waveForm = 0;              // AC or DC (1 = AC, 2 = DC, 0 = N/A)

        // Attributes for the GUI interface.
        // These keep track of coordinate information
        // The RBDC team should be the only people using
        // or modifying these variables

        // Coordinate and location attributes
        this.absX = 200;
        this.absY = 200;
        this.relativeX = this.absX;
        this.relativeY = this.absY;
        this.offsetX = 0; // offset based on user position
        this.offsetY = 0; // offset based on user position

        // Location attributes for the middle
        this.absMiddleX = this.absX + (this.width / 2);
        this.absMiddleY = this.absY + (this.height / 2);
        this.relativeMiddleX = this.relativeX + (this.width / 2);
        this.relativeMiddleY = this.relativeY + (this.height / 2);

        // Configures image

        if (iconPath == null){            
            iconPath = "../assets/component_icons/icon_missing.svg";
        }

        this.hasIcon = false;
        this.img;
        if (iconPath != null){
            this.hasIcon = true;
            this.img = new Image();
            this.img.src = iconPath;
        }


        // Misc attributes
        this.width = 80;
        this.height = 80;
        this.stacking_height = this.height * 1.5; // Defines how much space this components wants between it and its children
        this.color = color;
        this.canvasContext;
        this.selected = false;
        this.engine;


        // Call the first update
        this._update_middle_coords();
        
    }

    drag(deltaX, deltaY){
        this.relativeX += deltaX;
        this.relativeY += deltaY;

        this._update_middle_coords();
        
    }

    set_coords(newX=this.absX, newY=this.absY){
        // // Calculate how far off the relative Coordinates are so we can account for them
        // let relativeOffsetX = this.absX - this.relativeX; 
        // let relativeOffsetY = this.absY - this.relativeY; 

        
        let relativeOffsetX =  this.relativeX - this.absX; 
        let relativeOffsetY =  this.relativeY - this.absY; 

        // Update the absolute coords
        this.absX = newX;
        this.absY = newY;

        // Update relative coords with new abs coords and relativeOffset
        this.relativeX = this.absX + relativeOffsetX;
        this.relativeY = this.absY + relativeOffsetY;

        // Reset relativeX, relativeY, then  apply all the events from engine
        // this.absX = newX;
        // this.absY = newY;

        // this.relativeX = this.absX;
        // this.relativeY = this.absY;

        // if (this.engine != null){
        //     // Apply all the apst movement events
        //     console.log("Applying everything to " , this.name);
        //     console.log(this.engine);
        //     for (let movement of this.engine.movement_record){

        //         if (movement instanceof Drag_Event){
        //             // this.drag(movement.totalMoveX, movement.totalMoveY);
        //         } else if (movement instanceof Zoom_Event){
        //             this.change_zoom(movement.curMouseX, movement.curMouseY, movement.scaleDelta, movement.scale);
        //         }

        //     }
        // }


        // Make middle coords update
        this._update_middle_coords();
    }

    update_tree(){

        // Finds the top most parent
        if (this.parent == null){
            // this is the parent. Start recursing all the way down.
            this._update_recursive_down();

        } else {
            // this is not the grandparent. 
            this.parent.update_tree();
        }

        this.organize_children();
    }

    click(){
        console.log("" , this.name, " Component click");

        if (this.selected){
            this.selected = false;
        } else {
            this.selected = true;
        }
    }

    deselect(clientX, clientY){

        /*

            Deselects the Component. This primarily
            acts as an interface for child classes.

        */

        this.selected = false;
    }

    _update_recursive_down(){

        // this.total_current_draw = this.personal_current_draw;

        // Gets pass_up_map
        this.pass_up_map['total_current_draw'] = this.personal_current_draw;
        this.pass_up_map['widest_root'] = 0;
        this.pass_up_map['longest_root'] = 0;

        // Null map to hold data when looping
        let this_child_map = {};

        for (let child of this.children) {

            // Send update down & get updated result
            this_child_map = child._update_recursive_down();

            // Updates total current draw
            this.pass_up_map['total_current_draw'] += this_child_map['total_current_draw'];

            // Updates the widest root
            this.pass_up_map['widest_root'] += (this_child_map['widest_root'] - 1) <= 0 ? 0 : this_child_map['widest_root'] - 1; // ternary makes sure it isn't below 0
            this.pass_up_map['widest_root'] += 1; // increment for this child

            // Updates the deepest root

            if (this_child_map['longest_root'] + 1 > this.pass_up_map['longest_root']){
                this.pass_up_map['longest_root'] = this_child_map['longest_root'] + 1;
            }

        }

        // Add self to the longest_root value
        // this.pass_up_map['longest_root']++;

        this.update_self();
        // return this.total_current_draw;
        return this.pass_up_map;
    }

    organize_children(){
        let thisMaxRoot = this.pass_up_map['widest_root'];

        // Verifies that the max root is not 0
        // This can happen to components without descendants
        // since those components interpret no descendants as 
        // 0 wide
        if (thisMaxRoot < 1){
            thisMaxRoot = 1;
        }


        // Variables that control positioning of component children
        let childWidth = 100;
        let childGap = 70;
        let totalChildWidth = childWidth + childGap + 100;
        let leftOffset = (childWidth * thisMaxRoot) / 2;
        
        // Variables for the loop
        let thisChildIndex = 0;
        let childMaxRoot;
        let childAbsX;


        // Organizes the children
        if (this.children.length == 1){
            // There shouldn't be any offset if there's only one child. 
            // Thus, this is a special case for that

            let thisChild = this.children[0];

            // Calculates the offset to make sure it is centered on x axis

            thisChild.set_coords(this.absX, this.absY + this.stacking_height); 
            thisChild.organize_children();

        } else if (this.children.length > 1) {

            // Since there is more than one child we need to do this loop
            for (var child of this.children){

                // Gets the wideness of this child
                childMaxRoot = child.pass_up_map['widest_root'];
                
                // Calculates the new absolute coordinates and sets them
                childAbsX =  this.absX - leftOffset + (thisChildIndex * totalChildWidth);
                child.set_coords(childAbsX, this.absY + this.stacking_height);

                // Update the index in regards to the total length of this child
                thisChildIndex += (childMaxRoot > 0) ? childMaxRoot : 1;

                // Recurse
                child.organize_children();

            }
        }
    }

    change_zoom(mouseX, mouseY, scaleDelta, scale){
        this.offsetX -= (this.relativeMiddleX - mouseX) * scaleDelta ;
        this.offsetY -= (this.relativeMiddleY - mouseY) * scaleDelta ;

        // this.engine.scale = scale;
        
        this._update_middle_coords();
    }

    _update_middle_coords(){   
        this.absMiddleX = this.absX + (this.width / 2);
        this.absMiddleY = this.absY + (this.height / 2);


        // Make sure we aren't multiplying by undefined. If engine isn't 
        // set yet then just use 1 as our multiplyer
        let this_scale;
        if (typeof this.engine != 'undefined') {
            this_scale = this.engine.scale;
        } else {
            this_scale = 1;
        }

        this.relativeMiddleX = this.relativeX + (this.width / 2) * this_scale;
        this.relativeMiddleY = this.relativeY + (this.height / 2) * this_scale;

    }

    draw(canvasContext, scale){
        let thisFrameX = this.relativeX + this.offsetX;
        let thisFrameY = this.relativeY + this.offsetY;
        let thisFrameMidX = this.relativeMiddleX + this.offsetX;
        let thisFrameMidY = this.relativeMiddleY + this.offsetY;
        let thisFrameWidth = this.width;
        let thisFrameHeight = this.height;
        
        // Always restart the path before drawing
        canvasContext.beginPath();

        if (this.hasIcon){
            canvasContext.drawImage(this.img, thisFrameX, thisFrameY, thisFrameWidth * scale, thisFrameHeight * scale);
        } else {
            // set color
            canvasContext.fillStyle = this.color;

            // Draw the rectangle, as well as a red dot to indicate the center
            canvasContext.fillRect(thisFrameX, thisFrameY, thisFrameWidth * scale, thisFrameHeight * scale);
        }

        
    
        if (this.selected){
            canvasContext.strokeStyle = "white";
            canvasContext.strokeRect(thisFrameX, thisFrameY, thisFrameWidth * scale, thisFrameHeight * scale);
        }

        canvasContext.arc(thisFrameMidX, thisFrameMidY, 1, 0, 2 * Math.PI, false);
        canvasContext.fillStyle = "red";
        canvasContext.fill();
        canvasContext.fillStyle = "black";

        // Draws line to the parent
        if (this.parent != null){
            // Update parents middle coords 
            this.parent._update_middle_coords();

            canvasContext.strokeStyle = "black";
            canvasContext.lineWidth = 2;
            canvasContext.beginPath();
            canvasContext.moveTo(this.relativeMiddleX + this.offsetX, this.relativeY + this.offsetY);
            canvasContext.lineTo(this.parent.relativeMiddleX + this.parent.offsetX, this.parent.relativeY + (this.parent.height * this.parent.engine.scale) + this.parent.offsetY);
            canvasContext.stroke();
        }
        
    }
  
    update_self() {
      // must be implemented by child classes
      //   throw new Error("update_self() must be implemented by child classes");
    }
  
    update_server() {
        // to be implemented by RBDC
        // This will send updated data back to the server for storage
        return false;
    }
  
    add_child(newComponent, perpetuate=true) {
        // Adds a child to the component
        // This will be used by the frontend to connect components together

        this.children.push(newComponent);
        if (perpetuate){
            newComponent.set_parent(this, false);
        }

        // Make sure everything updates to prevent visual bugs
        this.update_tree();
        this.organize_children();
    }
  
    set_parent(newComponent, perpetuate=true) {
        // Adds a parent to the component
        // This will be used by the frontend to connect components together

        this.parent = newComponent
        if (perpetuate){
            newComponent.add_child(this, false);
        }

        // Make sure everything updates to prevent visual bugs
        this.update_tree();
        this.organize_children();
    }

    get_data(){
        // Get ID of all children
        let childIDArr = [];
        for (let child in this.children){
            childIDArr.push(child.id);
        }

        // Get the ID of parent, or use null if this is a top parent
        let parentId = null;
        if (this.parent != null){
            parentId = this.parent.id;
        }

        return {
            id: this.id,
            errors: this.errors,
            children: childIDArr,
            parent: parentId,
            personal_current: this.personal_current_draw,
            total_current: this.total_current_draw
        }
    }
  
    get_errors() {
      return this.errors;
    }

    get_total_current_draw() {
        return this.total_current_draw;
    }

    get_personal_current_draw() {
        return this.personal_current_draw;
    }

    get_children() {
        return this.children;
    }

    get_parent() {
        return this.parent;
    }
}
  

CircuitBreaker.js

import { Component } from "./Component.js";

export class CircuitBreaker extends Component {
  constructor (children, current_rating, errors, id, icon_path, name, parent, pass_up_map,
    phase, sccr, type_array, waveform, volt_rating) {
      //this.CircuitBreaker = new Component();
      // passing in parent class
      super(children, current_rating, errors, id, icon_path, name, parent, pass_up_map,
        phase, sccr, type_array, waveform, volt_rating);
      
      // constructing Circuit Breaker specific properties
      this.name = "Circuit Breaker";
      this.triptype = "";
      this.protection_multiplier = 0.0;
  }

InstantMCCB.js

import { CircuitBreaker } from "./CircuitBreaker.js";

export class InstantMCCB extends CircuitBreaker {
    constructor (children, current_rating, errors, id, icon_path, name, parent, pass_up_map,
        phase, sccr, type_array, waveform, volt_rating) {
          // passing in parent class
          super(children, current_rating, errors, id, icon_path, name, parent, pass_up_map,
            phase, sccr, type_array, waveform, volt_rating);
          
          // constructing Instant MCCB Circuit Breaker specific properties
          this.name = "InstantMCCB";
          this.triptype = "InstantMCCB";
          this.protection_multiplier = 8.0;
    }

// Methods

    // validates the UL 508A rules for Instant MCCB Circuit Breakers
    update_self() {
        i = 0;
        while (this.children[i] != 'null') {
            i++;
            if (this.children[i] == 'null') {
                fulloadamps = this.children[i].Load.getFullLoadAmps();
            }
        }
        if (fulloadamps < (current_rating * 0.8)) {
            this.errors = "Full Load Current of Load is to low";
        } else if ( fullloadamps < (this.volt_rating['max'] * this.protection_multiplier)) {
            this.errors = "% Branch Circuit Protection Multiplier is to low"
        } else {
            return true;
        }
    }
    
    // creates a JSON array for the interfaces of the UI and the database.
    get_data() {
        JSON_InstantMCCB = JSON.stringify(this)
        return JSON_InstantMCCB;
    }
    
    // takes in a JSON array to set the Instant MCCB Circuit Breaker attributes
    set_data() {
        return 0;
    }
}

Obviously The Code isnt finished for most of these classes, but I am unable to even start bug testing the code since I am unable to initlaize these functions even though I can initilaze Add_Component.js and Component.js which are using the same important and export code.

I’m currently Using CADDIEEngine to add the Components to the GUI another class member is building for the project, and I am unable to get the website to add any of the other Components built besides Add_Component and Component.

CADDIEEngine.js

import { Add_Component } from "./Add_Component.js";
import { Component } from "./Component.js";
import { CircuitBreaker } from "./CircuitBreaker.js";
import { InstantMCCB } from "./InstantMCCB.js";
import { InverseMCCB } from "./InverseMCCB.js";
import { MPCB } from "./MPCB.js";

export class CADDIEngine {

    // CAD Drafting Interface Engine (CADDIE)
    // CAD Design and Display Interface ENgine

    constructor (targetFPS) {

        // Set up canvas
        this.canvas = document.querySelector('.test-canvas');
        this.c = this.canvas.getContext('2d');
        this.canvas.width = window.innerWidth;
        this.canvas.height = window.innerHeight;

        // Set up mouse tracking attributes
        this.middleClickPressed = false;
        this.curMouseX = 0;
        this.curMouseY = 0;
        this.lastMouseX = 0;
        this.lastMouseY = 0;
        this.mouseDX = 0;
        this.mouseDY = 0;

        // Performance attributes
        this.rollingFPS = 0;
        this.fps_target = targetFPS;
        this.fps = 0;

        // Zooming attributes        
        this.scale = 1;
        this.zoomOffsetX = 1;
        this.zoomOffsetY = 1;   
        this.mouseLastZoomX = 0;   
        this.mouseLastZoomY = 0;
        this.pauseForScroll = false;

        // Miscellenious attributes
        this.components = [];    
        this.pushed_buttons = {};  
        this.movement_record = [];
        this.supported_components = { // List of supported components
            "Add Button": Add_Component,
            "Generic Component": Component,
            "Instant MCCB": InstantMCCB,
            "Inverse MCCB": InverseMCCB,
            "MPCB": MPCB,
            // "Ad Button": Add_Component, // extra bogus components to demo the interface
            // "Geeric Componnt": Component,
            // "Add utton": Add_Component,
            // "Generic Coponent": Component,
            // "Add Butto": Add_Component,
            // "Generic Cmponent": Component,
            // "Add utton": Add_Component,
            // "Generic Cmponent": Component,
            // "Ad Button": Add_Component,
            // "Generic Coponent": Component,
            // "Add Buon": Add_Component,
            // "Genericomponent": Component,
        };

I’ve tried Commenting out all the code currently in the classes besides the constructor and super functions, making all the exports a default export, and tried initializing the Component class before the CircuitBreaker class is initialized with a

let Component = new Component("CircuitBreaker");

or

const Component = new Component("CircuitBreaker");

I’m not sure what exactly is causing the unexplained reference error where Component is not intialized before CircuitBreaker that is not an issue with the Component and Add_Component classes.

I’m getting an error in “id” and “value” values ​while making a ToDo List application

I am making a ToDo List application using React. As far as I know, I tried to write my code without making any mistakes, but I am getting an error about the id and value values ​​from my code. I leave my code below so you can see it. What could be the reason for this and where am I going wrong?

My Code:

import React, {useState} from "react"

export default function HomeTemplate() {

  const [newItem, setNewItem] = useState("");
  const [items, setItems] = useState([]);

  function addItem() {

    if(!newItem) {
      alert("Enter a value!")
      return
    }

    const ıtem = {
      id: Math.floor(Math.random()*1000),
      value: newItem
    }

    setItems(oldItems => [...oldItems, items])
    setNewItem("");
  }

  function deleteItem(id) {
    const newArray = items.filter(item => item.id !== id);
    setItems(newArray)
  }

  return (
    <div className="">
      
      <div>
        <h1>ToDo List</h1>
      </div>

      <div>
        <input type="text" placeholder="" value={newItem} onChange={e => setNewItem(e.target.value)}></input>

        <button onClick={() => addItem()}>Add</button>
      </div>

      <div>
        <ul>
          {items.map(item => {
            return(
              <li key={item.id}>{item.value} <button onClick={() => deleteItem(item.id)}>X</button></li>
            )
          })}
        </ul>
      </div>

    </div>
  )
}

Errors I get:
enter image description here

Flatpickr with allowInput, how to navigate with keyboard?

I have a date picker which has this config:

  const rangePickerConfig = {
    allowInput: true,
    mode: 'range',
  }

When allowInput is set to true, it is not possible to navigate in the modal with just the keyboard and when using Tab, modal is closed and next tabbable element is focused. Documentation has no information regarding accessability. Is it possible to tab into the modal when allowInput is set to true by some specific modification?

How to get and save by code the responseBody or data from some or the selected requests already made and captured by the browser in DevT Network tab?

How to get and save by code the responseBody or data from some or the selected requests already made and captured by the browser in DevTools Network tab?

By following the steps listed on this question to open devtools on devtools and end up with 2 detached devtools windows, in the 2nd one now it is posible to get access to the UI object.

The goal here would be to be able, by pasting a script in JS console, to download or save or at least get a print in console the responseBody or content of the currently selected request despite if it is a JSON (which usually displays in not so many lines), a text file (of may lines, that requires a scroll), an image or media..
Which then could be used to do it with many request at a time probably.. But lets focus on the first step.

inspect

So, in order to get the responseBody, that is inside the Preview or specially in the Response tab of the sidebar that appears when selecting a request in the ones listed in the Network tab of a Devtools window,
I have tried to use this code line:
UI.panels.network.networkLogView.dataGrid.selectedNode.dataGrid.selectedNode.request()

but no matter what I add to it, even if it is .response .responseBody .getContent .content .data or it’s method versions like .response() .getContent(), etc. I get an error, of course, because those attributes or methods doesn’t exist or aren’t available (which BTW reminds me that they are not available also when exporting a HAR).

Unlike the previous questions where the main goal was to list the URLs from all the requests, here I used selectedNode instead of rootNode() which I have tried some things in too but since I maybe got lost with too many attributes in the objects and accepted to pass quickly to .selectedNode, it’s worth mentioning that I may have missed something with rootNode().
It’s worth to mention that looking at the comments I am not the only one who would like to see the challenge of getting the responseBody solved.

Meanwhile, trying another approach, a visual approach to get the lines of the text file in Response, using this following codeblock allowed me to get the lines of the file, but since it has many lines and requires a scroll, the window opts to make visible only a certain range of lines depending on the scrolling position (so, when I scroll to the top I get the 58 first lines. In the middle, I get 72 middle lines. At the bottom, I got 78 lines), and, thus, this following codeblock requires an improvement to get all the lines:

var el = document.getElementsByClassName("vbox flex-auto")[18].shadowRoot.children[4].children[0].children[0].children[0].shadowRoot.children[0]


var dataVarInStringFormat = '';
for(let i_el=0;i_el<el.getElementsByClassName("cm-line").length;i_el++){
    dataVarInStringFormat += 'n' + el.getElementsByClassName("cm-line")[i_el].innerText;
}
console.log(dataVarInStringFormat);
//TO DO: check if the type responseBody or content is JSON, text file or imag or media, maybe by checking their attribute in HAR
if(dataVarInStringFormat[0]=='{'){
    eval('let temp0 = ' + dataVarInStringFormat + ';');
    eval('console.log(temp0);');
}

And I don’t know why but this codeblock for scrolling that element didn’t work here:

//var elementToScroll = el;
//var elementToScroll = el.children[0];
//var elementToScroll = el.children[0].children[0];
var elementToScroll = el.children[0].children[1];
var scrollingElement = (document.scrollingElement || elementToScroll);
scrollingElement.scrollTop = scrollingElement.scrollHeight;

Anyway, I know that my central question is the one I mentioned at the top, but I would like to also hear any opinion on either of the approaches I mentioned or another approach, maybe using devtools API(?) for chrome extensions(?) as I am not so familiar with it… Thanks in advance.

Web library to represent a Minecraft item (image + name + lore + all data) [closed]

I’m looking for a web library able to represent a Minecraft item like in-game (small image for the icon, and hover text with all the information such as name, lore, enchantments, …).

To give a little more context, I’m doing a web application for my server’s moderators and administrators to allow them to see and modify (at least remove illegal items) from player’s inventory / enderchest / any other storage source. I have all the needed data (NBT-serialized items) and I’m trying to display them.

Ideally, a React library would be awesome, but obviously I can accommodate with any JS/HTML/CSS library to build my app with.

My researches gave me the following results:

  1. https://www.gamergeeks.net/apps/minecraft/web-developer-tools/css-blocks-and-entities
  2. https://github.com/1e4/minecraft-items-css
  3. https://codepen(DOT)io/devbobcorn/pen/wvzxxLv (please copy-paste it and replace the (DOT) by an actual dot, otherwise SO won’t let me post the question without the code itself, which would be a bit irrelevant here)
  4. https://www.npmjs.com/package/@sfirew/mc-motd-parser/v/1.0.3

Both 1. and 2. are only about item icons (inserting the image from the ID), the first one seems to have a bit less images (no potion color variants) but has a JSON “database” to lookup CSS classes from Minecraft IDs, and the second one seems to have more images, but no real mapping. The 3. is a showcase of a hover bubble that looks like in-game ones. The 4. seems to deals with JSON text format but is a bit weird.

That’s quite a lot of things to bring together to get a kind of workaround. Moreover, some items has a texture that depends on their NBT tags (like the aforementioned potion color) so only relying on item IDs seems insufficient. This confirms my question about a library being able to handle full item NBT data (maybe in a JSON format because it would be easier to manipulate in JS) to generate the display.

While I could develop my own library to do this, I would like to know if something already exist before reinventing the wheel. It would makes me save a lot of time.

Javascript automatic prompt choice

This is a code from the prompt which appears when trying to send and e-mail to specific people, and I wonder if it’s possible to make “Continue anyway” run automoticaly when this prompt is opened without having to click it. Been trying to achieve it myself, but my Javascript knowledge doesn’t allow me to do it.

Prompt example

JC = "PriceProposalContactConfirmDialog/createPPLButton"
      , eI = "PriceProposalContactConfirmDialog/confirmButton"
      , tI = "PriceProposalContactConfirmDialog/abortButton"
      , PriceProposalContactConfirmDialog = V=>{
        let {onConfirm: $, onClose: Z, onClickOpenPriceProposalDialog: ee, showCreatePriceProposalButton: te} = V;
        const re = useIntl()
          , onClickCreatePriceProposal = ()=>{
            Z(),
            ee()
        }
        ;
        return (0,
        ya.jsx)(ConfirmDialog, {
            headline: re.formatMessage({
                id: "i18n.tco.ng.priceproposals.DIALOG_COMMUNICATION_HEADER"
            }),
            message: (0,
            ya.jsx)("div", {
                children: re.formatMessage({
                    id: "i18n.tco.ng.priceproposals.DIALOG_COMMUNICATION_INFO"
                })
            }),
            onClose: Z,
            customFooter: te ? (0,
            ya.jsxs)(ya.Fragment, {
                children: [(0,
                ya.jsx)(Kn, {
                    buttonStyle: "primary",
                    autoFocus: !0,
                    onClick: onClickCreatePriceProposal,
                    "data-testid": JC,
                    children: re.formatMessage({
                        id: "i18n.tco.ng.priceproposals.SUBMIT_DIALOG_HEADER"
                    })
                }), (0,
                ya.jsx)(Kn, {
                    onClick: $,
                    "data-testid": eI,
                    children: re.formatMessage({
                        id: "i18n.tco.ng.priceproposals.DIALOG_COMMUNICATION_SUBMIT"
                    })
                }), (0,
                ya.jsx)(Kn, {
                    onClick: Z,
                    buttonStyle: "text",
                    "data-testid": tI,
                    children: re.formatMessage({
                        id: "i18n.tco.ng.ABORT"
                    })
                })]
            }) : (0,
            ya.jsxs)(ya.Fragment, {
                children: [(0,
                ya.jsx)(Kn, {
                    **onClick: $,
                    buttonStyle: "primary",
                    autoFocus: !0,
                    "data-testid": eI,
                    children: re.formatMessage({**
                        id: "i18n.tco.ng.priceproposals.DIALOG_COMMUNICATION_SUBMIT"
                    })
                }), (0,
                ya.jsx)(Kn, {
                    onClick: Z,
                    buttonStyle: "text",
                    "data-testid": tI,
                    children: re.formatMessage({
                        id: "i18n.tco.ng.ABORT"
                    })
                })]
            })
        })
    }

So this part of the code is responsible for “continue anyway” part, but I can’t come up with a way to make it so that it’s automatically pressed

ya.jsx)(Kn, {
                    onClick: $,
                    "data-testid": eI,
                    children: re.formatMessage({
                        id: "i18n.tco.ng.priceproposals.DIALOG_COMMUNICATION_SUBMIT"
                    })

I tried creating a javascript code that would be implemented in Violentmonkey, but I can’t find a way to do it..