Firefox scrolling sometimes linked to previous scroll position

I have a website where there is a link at the footer to a particular page state, e.g. the Rules. I say page state since the site is a single HTML page and individual “pages” are simply states of that one HTML page with certain content displayed and other content hidden. The footer content is the same and visible on all page states.

Regardless of what page state one is on, the link from the footer ought to navigate one to the top of the Rules page. And it does this except when the footer link is clicked from one particular page, in which case it goes to the end of the Rules page.

This anomaly is not experienced in either Chrome or Edge, in either desktop or mobile versions of such browsers.

The code script associated with the link to the Rules page is:

/** Moves browser to the Governance page and scrolls to the top of the page
*/
const switchToRulesPage = () => 
{
    if ('scrollRestoration' in history)         
    {
        history.scrollRestoration = 'manual';                                                                           
    }   

    window.scrollTo(0,0);                                                                                               

    switchPage('about-link', 'governance-cont', false);                                                                                     
}

I have tried re-ordering the above code so that the page state switch is done first and then the scroll to the top. But there is no change in browser behaviour.

For what it’s worth, I’ve removed all errors from the HTML page via W3C Validator.

Slick slider – smooth scroll with different slide widths

I’d like to build a smooth scroll slider (Slick slider) when I have different slide widths (variableWidth: true).

Is there a way that my 2nd slider will have the same speed all time (as the first slider with equal slide widths).

$('.gallery').slick({
  arrows: false,
  variableWidth: true,
  autoplay: true,
  autoplaySpeed: 0,
  speed: 3000,
  pauseOnHover: false,
  cssEase: 'linear',
  infinite: true
});
.gallery {
margin-bottom: 20px;
}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.min.js"></script>
<div class="gallery">
  <img src="http://placehold.it/100x100">
  <img src="https://placehold.co/100x100/00ff00/FFF">
  <img src="https://placehold.co/100x100/0000ff/FFF">
  <img src="https://placehold.co/100x100/ff0000/FFF">
  <img src="http://placehold.it/100x100">
  <img src="https://placehold.co/100x100/00ff00/FFF">
  <img src="https://placehold.co/100x100/0000ff/FFF">
  <img src="https://placehold.co/100x100/ff0000/FFF">
</div>
<div class="gallery">
  <img src="http://placehold.it/100x100">
  <img src="https://placehold.co/100x100/00ff00/FFF">
  <img src="https://placehold.co/100x100/0000ff/FFF">
  <img src="https://placehold.co/600x100/00ff00/FFF">
  <img src="https://placehold.co/1600x100/0000ff/FFF">
  <img src="https://placehold.co/50x100/ff0000/FFF">
  <img src="http://placehold.it/100x100">
  <img src="https://placehold.co/600x100/00ff00/FFF">
  <img src="https://placehold.co/1600x100/0000ff/FFF">
  <img src="https://placehold.co/50x100/ff0000/FFF">
</div>

How can I prevent items from being duplicated? Javascript

I have this code that customizes a json, but returns duplicate items, which will be necessary, so that duplicate items are not returned

I think that with the value of nid you could prevent items from being duplicated
any solution

Is there any easy way to do this.

Please have a look

Thanks for the help

let result = {};

   for (let item of data) {
     for (let subItem of item.itemsSlider) {
       if (!result[subItem.language]) {
         result[subItem.language] = [];
       }
       result[subItem.language].push(subItem);
     }
   }
   return result

this is the json
DATA:

const data = [
 {
    "itemsSlider": [
      {
        "nid": "61626",
        "status": "1",
        "titleNode": "01Additional Suitcase - EN",
        "language": "en_US"
      },
      {
        "nid": "61234",
        "status": "1",
        "titleNode": "01Additional Suitcase - EN",
        "language": "en_US"
      }
    ]
  },
  {
    "nid": "61567",
    "title": "K02 - Kiosk Slider - EN",
    "itemsSlider": [
      {
        "nid": "616098",
        "status": "1",
        "titleNode": "01Additional Suitcase - EN",
        "language": "es_MX"
      },
      {
        "nid": "616321",
        "status": "1",
        "titleNode": "01Additional Suitcase - EN",
        "language": "es_MX"
      }
    ]
  },
  {
    "nid": "61629",
    "title": "K02 - Kiosk Slider - EN",
    "itemsSlider": [
      {
        "nid": "616347",
        "status": "1",
        "titleNode": "01Additional Suitcase - EN",
        "language": "fr_FR"
      },
      {
        "nid": "61555",
        "status": "1",
        "titleNode": "01Additional Suitcase - EN",
        "language": "fr_FR"
      }
    ]
  },
  {
    "nid": "61629",
    "title": "K02 - Kiosk Slider - Mix",
    "itemsSlider": [
      {
        "nid": "616567",
        "status": "1",
        "titleNode": "01Additional Suitcase - EN",
        "language": "es_MX"
      },
      {
        "nid": "61626",
        "status": "1",
        "titleNode": "01Additional Suitcase - EN",
        "language": "en_US"
      }
    ]
  }
]

use hook keep calling the async function recursively

the getStudentData keeps getting called recursively for no reason

const studentDataPromise = useMemo(() => { return getStudentData(reviews); }, []);

const studentData = use(studentDataPromise);

async function getStudentData(reviews) {

if (!(reviews instanceof Array)) return {};

if (!reviews.length) return {};

const studentData = {};

const unDuplicatedStudentIds = [ ...new Set(reviews?.map(({ ownerId }) => ownerId)), ];

console.log({ unDuplicatedStudentIds });

const studentDataArray = [];

for (let i = 0; i < unDuplicatedStudentIds.length; i++) { const studentId = unDuplicatedStudentIds[i]; const studentDoc = getDoc(doc(db, "students", studentId)).catch((error) => { console.log({ StudentsData: error }); }); studentDataArray.push(studentDoc); }

console.log({ studentDataArray });

const resolvedStudentsData = await Promise.all(studentDataArray);

for (let j = 0; j < resolvedStudentsData.length; j++) { const studentDoc = resolvedStudentsData[j]; if (!(studentDoc instanceof DocumentSnapshot)) continue; if (!studentDoc.exists()) continue; const photoURL = await getPhotoUrl(studentDoc.id); studentData[studentDoc.id] = { id: studentDocyour text.id, ...studentDoc.data(), photoURL, }; }

return studentData; }

get the studentDataPromise resolved and display the data in the ui

How to align two html tables with same headers

I have two html tables, first one is two rows 1 for headers and one for buttons to hide columns in table 2.

    <table id="buttons" style="width: 100%;">
        <tbody>
            <tr>
                <td>Header 1</td>
                <td>Header 2</td>
                <td style="text-align:center"><strong>Header 3</strong></td>
                <td style="text-align:center"><strong>Header 4</strong></td>
                <td style="text-align:center"><strong>Header 5</strong></td>
                <td style="text-align:center"><strong>Header 6</strong></td>
                <td style="text-align:center"><strong>Header 7</strong></td>
                <td style="text-align:center"><strong>Header 8</strong></td>
                <td style="text-align:center"><strong>Header 9</strong></td>
                <td style="text-align:center"><strong>Header 10</strong></td>
                <td style="text-align:center"><strong>Header 11</strong></td>
                <td style="text-align:center"><strong>Header 12</strong></td>
                <td style="text-align:center"><strong>Header 13</strong></td>
                <td style="text-align:center"><strong>Header 14</strong></td>
                <td style="text-align:center"><strong>Header 15</strong></td>
                <td style="text-align:center"><strong>Header 16</strong></td>
                <td style="text-align:center"><strong>Header 17</strong></td>
                <td style="text-align:center"><strong>Header 18</strong></td>
                <td style="text-align:center"><strong>Header 19</strong></td>
                <td>Header 20</td>
                <td style="text-align:center"><strong>Header 21</strong></td>
                <td>Header 22</td>
                <td>Header 23</td>
            </tr>
            <tr>
                <td></td>
                <td></td>

                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(2);" class="">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(3);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(4);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(5);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(6);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(7);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(8);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(9);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(10);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(11);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(12);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(13);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(14);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(15);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(16);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(17);">

                        <span class="slider round"></span>

                    </label>
                </td>


                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(18);">

                        <span class="slider round"></span>

                    </label>
                </td>

                <td></td>

                <td style="text-align:center">

                    <label>

                        <input type="checkbox" checked="" onchange="javascript:show_hide_column(20);">

                        <span class="slider round"></span>

                    </label>
                </td>

                <td></td>
                <td></td>
            </tr>
        </tbody>
    </table>
    <table class="relative-table wrapped confluenceTable" style="width: 100%;">
        <tbody>
            <tr>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 1</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 2</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" data-highlight-colour="#b3d4ff" style=""><strong>Header
                        3</strong>
                </td>
                <td class="highlight-#b3d4ff confluenceTd" data-highlight-colour="#b3d4ff"><strong>Header 4</strong>
                </td>
                <td class="highlight-#b3d4ff confluenceTd" data-highlight-colour="#b3d4ff"><strong>Header 5</strong>
                </td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 6</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 7</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 8</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 9</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 10</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 11</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 12</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 13</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 14</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" data-highlight-colour="#b3d4ff"><strong>Header 15</strong>
                </td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 16</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" data-highlight-colour="#b3d4ff"><strong>Header 17</strong>
                </td>
                <td class="highlight-#b3d4ff confluenceTd" data-highlight-colour="#b3d4ff"><strong>Header 18</strong>
                </td>
                <td class="highlight-#b3d4ff confluenceTd" data-highlight-colour="#b3d4ff"><strong>Header 19</strong>
                </td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 20</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 21</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 22</strong></td>
                <td class="highlight-#b3d4ff confluenceTd" title="Background color : Light blue 100%"
                    data-highlight-colour="#b3d4ff"><strong>Header 23</strong></td>
            </tr>
            <tr>
                <td>23</td>
                <td>45</td>
                <td>12</td>
                <td>67</td>
                <td>89</td>
                <td>34</td>
                <td>56</td>
                <td>78</td>
                <td>90</td>
                <td>32</td>
                <td>43</td>
                <td>21</td>
                <td>76</td>
                <td>88</td>
                <td>35</td>
                <td>54</td>
                <td>78</td>
                <td>45</td>
                <td>67</td>
                <td>23</td>
                <td>12</td>
                <td>56</td>
                <td>89</td>
            </tr>
            <tr>
                <td>23</td>
                <td>45</td>
                <td>12</td>
                <td>67</td>
                <td>89</td>
                <td>34</td>
                <td>56</td>
                <td>78</td>
                <td>90</td>
                <td>32</td>
                <td>43</td>
                <td>21</td>
                <td>76</td>
                <td>88</td>
                <td>35</td>
                <td>54</td>
                <td>78</td>
                <td>45</td>
                <td>67</td>
                <td>23</td>
                <td>12</td>
                <td>56</td>
                <td>89</td>
            </tr>
            <tr>
                <td>This_is_a_very_long_text_to_display_what_my_real_table_looks_like</td>
                <td>45</td>
                <td>12</td>
                <td>67</td>
                <td>89</td>
                <td>34</td>
                <td>56</td>
                <td>78</td>
                <td>90</td>
                <td>32</td>
                <td>43</td>
                <td>21</td>
                <td>76</td>
                <td>88</td>
                <td>35</td>
                <td>54</td>
                <td>78</td>
                <td>45</td>
                <td>67</td>
                <td>23</td>
                <td>12</td>
                <td>56</td>
                <td>89</td>
            </tr>
        </tbody>
    </table>

This is what it looks like
output_of_html_code

I want the columns to align with each other so each column in table 1 is equal to its respective column in table 2
I tried setting column groups to be equal to each other using the following JS code:

document.getElementById('buttons').style.width = document.getElementsByClassName('relative-table wrapped confluenceTable')[0].style.width
    colgroup = document.getElementsByClassName('relative-table wrapped confluenceTable')[0].getElementsByTagName('colgroup')[0]   
    document.getElementById('buttons').getElementsByTagName('colgroup')[0].innerHTML = colgroup.innerHTML

yet no luck.

I also hard coded the column groups, using both pixels and percentages, into both tables and still no luck:

     <colgroup>
            <col style="width: 8.10965%;">
            <col style="width: 4.71625%;">
            <col style="width: 2.70322%;">
            <col style="width: 2.70322%;">
            <col style="width: 2.93328%;">
            <col style="width: 3.04831%;">
            <col style="width: 3.04831%;">
            <col style="width: 3.04831%;">
            <col style="width: 3.04831%;">
            <col style="width: 3.04831%;">
            <col style="width: 3.04831%;">
            <col style="width: 3.04831%;">
            <col style="width: 3.04831%;">
            <col style="width: 3.27837%;">
            <col style="width: 3.3934%;">
            <col style="width: 3.3934%;">
            <col style="width: 3.22085%;">
            <col style="width: 3.16334%;">
            <col style="width: 4.1411%;">
            <col style="width: 7.24692%;">
            <col style="width: 14.7814%;">
            <col style="width: 5.11886%;">
            <col style="width: 8.22468%;">
        </colgroup>

How can I do this using vanilla html, css and js?
Note: the second table is a confluence page

Is it possiable to get source of a HTML element of a partiulcar area/part of a web page?

Is it possible to get the source of an HTML element of a particular area/part of a web page? Like sometimes we open our browser open a website hover over a button or element and inspect it and we can see all the code for example <div class="fs-body2 bb bc-black-225 bg-black-100 p12"> Introduce the proble </div> and we can see that particular element code in my case I hover over ‘ Introduce the problem’ and just inspect it and I get that source.

Currently, my code doesn’t work on every HTML code it return null in most cases if the HTML code is too large.

import fs from "fs";
import { JSDOM } from "jsdom";

function findTextInHTML(filePath, targetText) {
  const htmlCode = fs.readFileSync(filePath, "utf8");
  const dom = new JSDOM(htmlCode);
  const document = dom.window.document;

  function searchText(element) {
    if (element.textContent.includes(targetText)) {
      return element;
    }

    if (element.outerHTML.includes(targetText)) {
      for (const child of element.children) {
        const result = searchText(child);
        if (result) {
          return result;
        }
      }

      return element;
    }

    return null;
  }

  const foundElement = searchText(document.body);

  return foundElement ? foundElement.tagName.toLowerCase() : null;
}

const htmlFilePath = "index.html";
const searchText = "Get Started";
const result = findTextInHTML(htmlFilePath, searchText);
console.log(result);

How do I create a 3d array in JavaScript initialised to be full of zeroes, with XYZ dimensions 5x5x64

I’ve written what i thought would create an array of 5 arrays each containing 5 arrays of 64 zeroes, but when i write the resulting array to the console, i do not get what i expected to see, yet the code makes sense to me.

Here is my code:

    const C = new Array(5);

    for (let x = 0; x < 5; x++) {
        for (let y = 0; y < 5; y++) {
            for (let z = 0; z < 64; z++) {
                C[x,y,z] = 0;
            }
        }
    }

    console.log(C);

logging C presents me with one array of 64 zeroes. What is wrong?

how to handle click event inside html from js and external js function

i have external file for templates i want to adding the templates in it but when i adding the onclick functoin its show error massage the handleClickCard not defind

import { handleClickCard } from "../../../script.mjs";

function templateCard(item, condition, idUpdate, id, title, tags) {
  const card = `
<div class="card" >
    <div class="card-header">                 
        <span onclick="showuserinfo('${encodeURIComponent(JSON.stringify(item),
    )}')" style="cursor: pointer;"><strong>${item.author.username
    }</strong>
        </span>
        ${condition
      ? `<button class="btn btn-danger mx-2" style="float: right;" onclick={handleclickdeletebutton('${idUpdate}')}>delete</button>`
      : ""
    }
        ${condition ? `<button class="btn btn-primary" style="float: right;" onclick="handleclickeditbutton('${encodeURIComponent(JSON.stringify(item),)}')">edit</button>`
      : ""}
    </div>

     <!-- the problem in here and there is another problem in the file but its the same solution for this problem -->
    <div class="card-body" onclick="handleClickCard(${id})">

        </div>
    </div>
</div>
  `;
  return card;
}
export { templateCard };

and handleClickCard in another file i export it

export const handleClickCard = () => {
    console.log("handle click")
}

and the error massage that show :

Uncaught ReferenceError: handleClickCard is not defined

so how to perform the function from the external templates file ????

In a RESTful API how should you handle optional query parameters

I’m currently dealing with a .net API that aims to be RESTful. One of the endpoints I’m working with has two optional query parameters. The following usage is allowed:

/endpoint/search
/endpoint/search?from=01/02/23
/endpoint/search?from=01/02/23&to=01/03/23

This endpoint however returns a 400 when you do not provide a value for these optional query params but the keys still exist. Since I primarily work in JS, having the query params either not exist or have a value of undefined are realistically the same thing this seems odd to me that it would return a 400.

I.e.

/endpoint/search?from=undefined&to=undefined // 400 response

I’ve tried to scour the internet for an answer. I’ve looked into OpenAPI specification and the REST rfc but I can’t find any relevant passages. I’m of the opinion this is making an endpoint overly restrictive and it should handle undefined as a value. What is the correct approach as per spec if possible?

Transfer overflowing HTML element children inside another div

I’m currently developing a client-side javascript program that allows users to preview documents for printing in the browser via an API call.
The goal is to display the documents in A4 format, each containing a preview of HTML content extracted from a JSON file obtained through the API.
An example of the HTML structure i obtain:

<div class="a4" style="padding: 20px" size="A4" contenteditable="true" fileid="1">
    <div class="content" fileid="1" contentid="1">
        <p class="paragraph-wrapper" lang="it-IT" align="left">
            <span style="font-family: Arial, serif;">
                <span style="font-size: small;">
                    <span style="font-size: small;"> 
                        Some text here1
                    </span>
                    <span style="font-size: small;"> 
                        Some text here2
                    </span>
                    <span style="font-size: small;"> 
                        Some text here3
                    </span>
                </span>
            </span>
        </p>
        <p class="paragraph-wrapper" lang="it-IT" align="left">
            <span style="font-family: Arial, serif;">
                <span style="font-size: small;">
                    <span style="font-size: small;"> 
                        Other text here1
                    </span>
                    <span style="font-size: small;"> 
                        Other text here2
                    </span>
                    <span style="font-size: small;"> 
                        Other text here3
                    </span>
                </span>
            </span>
        </p>
    </div>
</div>

I uploaded an image to provide more context.
enter image description here

The main issue I’m encountering arises when the text within one of the HTML blocks exceeds the maximum height of the container (.content), as indicated by the current display with a blue border. Currently, I’m addressing this problem by managing the transfer of a node from one page to another.

My starting approach involves iterating through nodes with the .paragraph-wrapper class. When one of these nodes reaches the maximum height, I add it to a new dynamically created .a4 page. However, iterating the nodes in its entirety, I lose precision in the text positioning within the new block, especially if the text/child nodes inside the parent node is/are a lot.

So, I’m looking for a way to split a container node, such as .paragraph-wrapper, into two distinct nodes if one of its children exceeds the bottom border of the .content container. Each new node should retain the same parent divs as the original node and the associated inline styles.

An example of what I would like to achieve starting from the previous code:

<div class="a4" style="padding: 20px" size="A4" contenteditable="true" fileid="1">
    <div class="content" fileid="1" contentid="1">
        <p class="paragraph-wrapper" lang="it-IT" align="left">
            <span style="font-family: Arial, serif;">
                <span style="font-size: small;">
                    <span style="font-size: small;"> 
                        Some text here1
                    </span>
                    <span style="font-size: small;"> 
                        Some text here2
                    </span>
                    <span style="font-size: small;"> 
                        Some text here3
                    </span>
                </span>
            </span>
        </p>
        <p class="paragraph-wrapper" lang="it-IT" align="left">
            <span style="font-family: Arial, serif;">
                <span style="font-size: small;">
                    <span style="font-size: small;"> 
                        Other text here1
                    </span>
                    <span style="font-size: small;"> 
                        Other text here2
                    </span>
                </span>
            </span>
        </p>
    </div>
</div>
***Here finish the first A4 page***


***Here start the second A4 page***
<div class="a4" style="padding: 20px" size="A4" contenteditable="true" fileid="1">
    <div class="content" fileid="1" contentid="2">
        <p class="paragraph-wrapper" lang="it-IT" align="left">
            <span style="font-family: Arial, serif;">
                <span style="font-size: small;">
                    <span style="font-size: small;"> 
                        Other text here3
                    </span>
                </span>
            </span>
        </p>
    </div>
</div>

A portion of my current code:

const content = document.querySelectorAll('.content');
const a4HeightWithoutPadding = evaluateContentHeight();
const lastContent = content[content.length - 1];

staticNodeArray.forEach(node => {
    // Append node to last content element
    lastContent.appendChild(node);

    node.className = 'paragraph-wrapper';

    const nodeOffsetBottom = node.offsetTop + node.offsetHeight;

    // If the parent node reaches the bottom side of .content, make a new A4 page
    if (nodeOffsetBottom > a4HeightWithoutPadding) {
        // Increment contentId for new page
        contentId += 1;

        // Create a new A4
        const newPage = createNewPage(fileId, contentId);

        // Append the A4 to the container
        container.appendChild(newPage);

        // Moving the overflowed content to the new A4
        const newContent = newPage.querySelector('.content');
        newContent.appendChild(node);
    }
});

// Create a new A4 page
function createNewPage(fileId, contentId) {
    const newA4Page = document.createElement('div');
    newA4Page.className = 'a4';
    newA4Page.setAttribute('style', 'padding: 20px');
    newA4Page.setAttribute('size', 'A4');
    newA4Page.setAttribute('contenteditable', 'true');
    newA4Page.setAttribute('fileId', fileId);
    newA4Page.innerHTML = `<div class="content" fileId=${fileId} contentId=${contentId}></div>`;

    return newA4Page
} 

function evaluateContentHeight() {
    const a4NodeList = document.querySelectorAll('.a4');

    // The last A4 created
    const a4 = a4NodeList[a4NodeList.length - 1];    

    // Calculate the A4 height
    const a4Height = a4.clientHeight;

    // Calculate the value of top and bottom padding
    const style = window.getComputedStyle(a4);
    const paddingTop = parseFloat(style.paddingTop);
    const paddingBottom = parseFloat(style.paddingBottom);
    
    // Calculate the final value of A4 height without the padding of the A4 
    const a4HeightWithoutPadding = a4Height - paddingTop - paddingBottom;
    
    return a4HeightWithoutPadding
}

Goggle Apps Script integration with Zabbix

I made an item in zabbix that runs a local PS1 file on the host machine

This is the item, when I access the specific Host and use the execute now function it works perfectly and runs the ps1 file

I needed to make Apps Script carry out this process of executing the item on a specific host (I would pass the host to the code and it to Zabbix).

is it possible to do that?

I created a zabbix API token and tried to run this item but without success, I didn’t find any video or documentation that does something similar

How to redirect PWA to new server after being opened?

this is my first post here.
I’m working on a group school project and made a PWA which is hosted on an external Cloudflare server with a certificate. For the duration of testing, the PWA sent data to that server through NodeJS. Now, after installing the PWA on a mobile device, I would like it to communicate with another server instead, a Raspberry PI with a fixed IP acting as a Wifi hotspot in order for the PWA to send data in the database it’s hosting, and effectively only keep the original server as the server that permits downloading and installing the PWA on devices.

Now my issue is, when I change the NodeJS code in the PWA to indicate which server it’s supposed to establish a connection with, the PWA still communicates with the server hosting it instead of contacting the new server. I tried changing the ip address and port in the PWA’s NodeJS code to indicate the new server it’s supposed to send data to, but when testing, it still sends its data to the host server instead of establishing a new connection to the rpi server.

All help is appreciated.

Resolving MODULE_NOT_FOUND Error for Internal Modules with TypeScript Path Aliases in AWS CDK during synthesis/deploymentt

I’m working on an AWS CDK project using TypeScript and encountering an issue with module resolution when running cdk synth or cdk deploy (the build is successful). My project structure includes internal modules that I’m trying to import into my CDK stacks, but I receive a MODULE_NOT_FOUND error during synthesis/deployment.

project structure

tsconfig.json

stack.ts

constant.ts

error message

Attempts to Resolve:

  1. I’ve verified the file paths and made sure that constant.ts exists at the specified location.
  2. I’ve tried using both relative(../common/type/constant) and absolute import (common/model/constant) paths.
  3. Running tsc directly compiles without any issues, but cdk synth or cdk deploy throws the error.
  4. I’ve also tried clearing node_modules and reinstalling, with no success.

I suspect the issue might be related to how the CDK CLI handles TypeScript path aliases or possibly how my TypeScript project is configured. However, I’m not sure how to diagnose or fix the issue to allow my CDK application to correctly resolve and import these internal modules.

Questions:

  1. How can I adjust my TypeScript or CDK configuration to resolve this issue?
  2. Is there a step I’m missing in the process to ensure the CDK CLI can handle TypeScript path aliases correctly?
  3. Are there known limitations or considerations with the AWS CDK and TypeScript imports that I should be aware of?
  4. Any guidance, diagnostic tips, or insights into how the AWS CDK and TypeScript work together in this context would be greatly appreciated.