How to prevent StalePageException when using AbstractDefaultAjaxBehavior triggered from other javascript components

I have a page that is mostly wicket, but there’s a third party grid component on the page. It loads it’s data via a URL I give it to an AbstractDefaultAjaxBehavior. We also invoke a 2nd AbstractDefaultAjaxBehavior from an event listener tied to row selections on the grid. This url is placed in a hidden and invoked as they check that row.

Problem is that it’s not working. We’ve done similar things in other apps, and I’m failing to see what is different. What seems to be happening, is that when we click, Wicket is issuing a StalePageException, and sending a redirect to the client which then reloads the page, wiping out the selections. The following error is in the log:

org.apache.wicket.core.request.mapper.StalePageException: A request to page '[Page class = my.package.queue.modules.ReportQueue, id = 3, render count = 1]' has been made with stale 'renderCount'. The page will be re-rendered.

The problem being that I don’t see what I’m doing differently from other places where this strategy works. It seems like the URL I get from getCallbackUrl() has the render count in it, and I presume that when other ajax events are invoked, Wicket probably expects an updated one. Since I need to push these out at page load, and don’t know what order they’ll come back, it’s not really practical for me to keep asking for a new Url. How can I get it to ignore the render count on these ajax calls?

The behavior definition in java:

        behaviorDisable = new AbstractDefaultAjaxBehavior() {
            protected void respond(final AjaxRequestTarget target) {    
                //code redacted, but control never arrives here so it doesn't matter.
            }   
        };
        
        add(behaviorDisable);
        String callback = String.valueOf((behaviorDisable.getCallbackUrl()));
        hiddenfield = new HiddenField("callBackUrl", new Model(callback));
        add(hiddenfield);

And in the javascript, I’ve gone through many iterations with parameters and whatnot, but they all do the same. Here’s the current one:

        Wicket.Ajax.get({
            "u" :document.getElementById('callBackUrl').value
        });

We’re using jQuery 3.6.3 with wicket 6.

Before you recommend upgrading, yes, we know it’s old. Our client is governmental and doesn’t like to upgrade unless there’s a major security finding or some other external force compelling them. We can’t get permission to upgrade. There’s a ‘modernization’ effort scheduled, but it keeps getting pushed back as literally everything is a higher priority.

How do I make an animation of an outline being filled

I was trying to make something like the pre loading animation of this website. I have tried chat gpt, but he gave me something weird instead of the svg being filled it simply put a black square on top of it.
ideally the animation should last about 2 to 3 seconds I was quite close to getting it but stack overflow does not allow me to post my attempt, because I have a disproportional ammount of code.
I have a svg right here:

<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 1795 236" xmlns="http://www.w3.org/2000/svg" xmlns:v="https://svgstorm.com">
<g fill-opacity=".02" stroke="None">
<path d="m0 236h1795v-236h-66c17.64 6.18 37.7 16.29 42.71 37.3s5.06 62.29 4.29 91.7 2.17 57.49-11.71 76.3c-13.89 18.81-30.33 25.07-54.29 25.7-23.96 0.64-46.95-5.29-60.7-23.3-13.74-18.02-11.84-48.21-12.3-77.7s-0.29-70.4 4.21-92.23 25.06-30.97 42.79-37.77h-1085c8.1 5.64 21.88 7.56 30.08 19.92 8.21 12.36 9.6 14.93 11.85 31.16 2.26 16.23 2.07 43.88 2.07 62.92s0.11 46.61-1.78 63.22c-1.89 16.62-4.49 20.78-13.32 32.68-8.83 11.91-20.39 15.58-31.15 18.3-10.75 2.71-33.39 5.45-45 1.6s-22.66-7.16-31.85-18.7-12.27-16.21-14.22-33.78c-1.96-17.57-2.35-46.03-1.68-65.32s0.12-44.28 1.93-61.07c1.81-16.8 4.34-19.52 13.31-31.7 8.96-12.18 20-14.72 31.76-19.23h-551v236m119-125c15.64 8.05 22.82 15.33 22.78 37.22s2.13 56.75-1.78 78.78c-17.7-0.02-38.32-0.02-56 0-2.3-14.21-0.48-33.97-1-50s1.51-34.11-3-47c-2.61 0.55-5.35-1.27-9-2 0.02 32.53-0.03 66.19 0 98-19.63 1.67-43.47 1.64-63 0 0.24-24.05-0.3-49.18 0-74s-0.54-52.3 0-77-2.04-50.78 2-73c18.44 0.36 45.35-0.52 63.25 0.2 17.89 0.72 31.86 2.05 43.05 7.51 11.19 5.47 19.52 15.4 22.41 26.59 2.89 11.18 3.92 33.64 2.08 46.93s-7.41 24.54-21.79 27.77m98-109c4.1 9.42 1.51 21.75 2 34s-0.2 26.42 0 39-0.06 26.37 0 39 0.06 26.57 0 39 0.93 23.11 1 34c2.76 2.89 5.3 0.8 8 1 1.81-9.99 1.45-18.79 2-31s-0.34-27.35 0-40-0.35-26.25 0-39-0.59-27.42 0-40-2.18-26.19 2-36c11.57 1.7 23.99 1.16 36 1s26.81-3.62 25 11 0.89 24.64 0 38 0.52 24.41 0 37 0.51 26.08 0 38 0.84 27.24 0 38-0.97 17.39-2.2 25.25-5.41 10.1-9.04 16.52c-3.62 6.42-10.33 12.71-16.06 15.94-5.74 3.24-10.45 4.28-16.62 6.42s-17.19 1.77-26.08 1.87-16.72-0.73-24.7-3.31c-7.97-2.58-8.44-3.44-15.6-7.4-7.16-3.97-9.03-5.3-16-13.99s-10.68-25-9.7-41.3-0.27-23.58 0-38 0.26-24.29 0-38 1.01-23.22 0-37 2.35-23.34 0-38 10.4-11.05 23-11 24.93 0.78 37-1m169 0c4.92 12.85 5.33 26.69 7.66 40.68s3.39 25.96 5.34 40.32c5.7-27.99 5.78-54.54 12-81 25.07 1.33 55.51-2.64 79 2-0.67 73.41 1.34 149.34-1 223-17.05-0.06-36.97 0.01-54 0-3-32.67 1-67.74-2-100-4.49 34.03-7.52 68.31-14 100-12.05-0.04-26.96-0.04-39 0-7.05-35.2-8.76-65.57-16-101-0.66 33.58 1.33 67.87-1 101-17.33-0.67-38.06 1.29-55-1v-222c10.81-2.5 25.19-0.26 38-1s27.52 1.38 40-1m667 48c-10.49 4.76-26.95 0.62-40 2v36h35c1.63 15.14 1.63 31.85 0 47h-35c0.02 30.19-0.03 61.53 0 91-19.36 2.34-42.33 0.28-62 1-2.34-72.99-0.32-149.73-1-223 9.97-1.85 24.1-1.16 36-1s27.36-0.78 39 0 28.1-5.48 27 8 0 26.1 1 39m67-48c4.1 9.42 1.51 21.75 2 34s-0.2 26.42 0 39-0.06 26.37 0 39 0.06 26.57 0 39 0.93 23.11 1 34c2.76 2.89 5.3 0.8 8 1 1.81-9.99 1.45-18.79 2-31s-0.34-27.35 0-40-0.35-26.25 0-39-0.59-27.42 0-40-2.18-26.19 2-36c11.57 1.7 23.99 1.16 36 1s26.81-3.62 25 11 0.89 24.64 0 38 0.52 24.41 0 37 0.51 26.08 0 38 0.84 27.24 0 38-0.97 17.39-2.2 25.25-5.41 10.1-9.04 16.52c-3.62 6.42-10.33 12.71-16.06 15.94-5.74 3.24-10.45 4.28-16.62 6.42s-17.19 1.77-26.08 1.87-16.73-0.73-24.7-3.31-8.45-3.44-15.6-7.4c-7.16-3.97-9.03-5.31-16-13.99-6.97-8.69-10.68-25-9.7-41.3s-0.27-23.58 0-38 0.26-24.29 0-38 1.01-23.22 0-37 2.35-23.34 0-38 10.4-11.05 23-11 24.93 0.78 37-1m212 2c-0.03 14.71-0.03 32.31 0 47-10.83 2.3-22.75 0.36-34 1-0.66 58.13 1.32 117.89-1 175-19.38 0-41.61-0.05-61 0-0.01-57.5 0.01-116.81 0-175-10.59 0.64-21.86-1.29-32 1-3.01-6.01-3-18.79-2-27s-4.92-23.4 5.03-23.02c9.94 0.38 21.71-0.19 31.97 0.02 10.27 0.21 21.68-0.22 32 0s21.86-0.37 32 0 20.91-1.28 29 1m67-2c4.1 9.42 1.51 21.75 2 34s-0.2 26.42 0 39-0.05 26.37 0 39 0.06 26.57 0 39 0.93 23.11 1 34c2.76 2.89 5.3 0.8 8 1 1.81-9.99 1.45-18.79 2-31s-0.34-27.35 0-40-0.35-26.25 0-39-0.59-27.42 0-40-2.18-26.19 2-36c11.57 1.7 23.99 1.16 36 1s26.81-3.62 25 11 0.89 24.64 0 38 0.52 24.41 0 37 0.51 26.08 0 38 0.84 27.24 0 38-0.97 17.39-2.2 25.25-5.41 10.1-9.04 16.52c-3.62 6.42-10.33 12.71-16.06 15.94-5.74 3.24-10.45 4.28-16.62 6.42s-17.19 1.77-26.08 1.87-16.72-0.73-24.7-3.31c-7.97-2.58-8.44-3.44-15.6-7.4-7.16-3.97-9.03-5.3-16-13.99s-10.68-25-9.7-41.3-0.27-23.58 0-38 0.26-24.29 0-38 1.01-23.22 0-37 2.35-23.34 0-38 10.4-11.05 23-11 24.93 0.78 37-1m202 109c15.64 8.05 22.82 15.33 22.78 37.22s2.13 56.75-1.78 78.78c-17.7-0.02-38.32-0.02-56 0-2.3-14.21-0.48-33.97-1-50s1.51-34.11-3-47c-2.61 0.55-5.35-1.27-9-2 0.02 32.53-0.02 66.19 0 98-19.36 2.34-42.33 0.28-62 1-1.8-23.76-1.02-49.14-1-74s-0.41-52.19 0-77-1.95-51.61 2-74c18.44 0.36 45.35-0.53 63.25 0.2 17.89 0.72 31.86 2.05 43.05 7.51 11.19 5.47 19.52 15.4 22.41 26.59 2.89 11.18 3.92 33.64 2.08 46.93s-7.41 24.54-21.79 27.77m-694-106c2.19 16.35 0.63 35.55 1 54s-0.27 38.27 0 57-0.35 38.16 0 57-1.09 38.59 1 57c-13.03 3.16-31.53-1.1-46 2-2.18-13.41-0.67-29.47-1-45s0.17-32.13 0-48 0.13-33.02 0-49c-41.48 47.69-83.78 94.09-125 142-16.76-1.62-35.27-1.69-52 0-1.88-1.73-1.1-3.04-2-5 51.5-57.3 103.25-115.92 155-175-51.24 0.67-103.2-1.33-154 1-3.16-13.02 1.1-31.53-2-46 16.35-2.19 35.54-0.63 54-1s38.27 0.27 57 0 38.16 0.34 57 0 38.59 1.09 57-1z"/>
</g>
<g fill-opacity=".91" stroke="None">
<path d="m599 0h-48c-11.76 4.51-22.8 7.05-31.76 19.23-8.97 12.18-11.5 14.9-13.31 31.7-1.81 16.79-1.26 41.78-1.93 61.07s-0.28 47.75 1.68 65.32c1.95 17.57 5.03 22.24 14.22 33.78s20.24 14.85 31.85 18.7 34.25 1.11 45-1.6c10.76-2.72 22.32-6.39 31.15-18.3 8.83-11.9 11.43-16.06 13.32-32.68 1.89-16.61 1.78-44.18 1.78-63.22s0.19-46.69-2.07-62.92c-2.25-16.23-3.64-18.8-11.85-31.16-8.2-12.36-21.98-14.28-30.08-19.92m-18 3c15.33 2.75 25.05 4.25 35.1 12.91 10.05 8.65 16.49 16.23 18.7 30.34 2.2 14.11 1.73 40.22 2.2 58.75s-0.27 47.9-1.78 65.22c-1.5 17.33-1.63 23.1-10.81 34.53-9.17 11.43-18.52 15.66-30.66 19.05s-35.13 1.18-46.05-2.51c-10.93-3.7-22.81-10.02-29.4-21.59-6.59-11.58-6.43-24.82-8.23-43.77-1.79-18.96 1.13-49.75 0.93-67.93s0.07-38.18 4.26-50.75c4.2-12.57 12.7-20.47 23.49-25.64s24.73-11.75 42.25-8.61z"/>
</g>
<g fill-opacity=".91" stroke="None">
<path d="m1729 0h-45c-17.73 6.8-38.29 15.94-42.79 37.77s-4.67 62.74-4.21 92.23-1.44 59.68 12.3 77.7c13.75 18.01 36.74 23.94 60.7 23.3 23.96-0.63 40.4-6.89 54.29-25.7 13.88-18.81 10.94-46.89 11.71-76.3s0.72-70.69-4.29-91.7-25.07-31.12-42.71-37.3m-15 3c15.33 2.75 25.05 4.25 35.1 12.91 10.05 8.65 16.49 16.23 18.7 30.34 2.2 14.11 1.73 40.22 2.2 58.75s-0.28 47.89-1.78 65.22-1.63 23.1-10.81 34.53c-9.17 11.43-18.52 15.66-30.66 19.05s-35.13 1.18-46.05-2.51c-10.93-3.7-22.81-10.02-29.4-21.59-6.59-11.58-6.43-24.82-8.23-43.77-1.79-18.96 1.12-49.75 0.93-67.93s0.07-38.18 4.26-50.75c4.2-12.57 12.7-20.48 23.49-25.64 10.79-5.17 24.73-11.75 42.25-8.61z"/>
</g>
<g fill-opacity=".95" stroke="None">
<path d="m119 111c14.38-3.23 19.95-14.48 21.79-27.77s0.81-35.75-2.08-46.93c-2.89-11.19-11.22-21.12-22.41-26.59-11.19-5.46-25.16-6.79-43.05-7.51-17.9-0.72-44.81 0.16-63.25-0.2-4.04 22.22-1.46 48.3-2 73s0.3 52.18 0 77 0.24 49.95 0 74c19.53 1.64 43.37 1.67 63 0-0.03-31.81 0.02-65.47 0-98 3.65 0.73 6.39 2.55 9 2 4.51 12.89 2.48 30.97 3 47s-1.3 35.79 1 50c17.68-0.02 38.3-0.02 56 0 3.91-22.03 1.74-56.89 1.78-78.78s-7.14-29.17-22.78-37.22m17 110h-48c0.53-21.04-1.05-49.23 0.78-69.22 1.83-20-4.68-32.19-23.78-27.78 0.03 31.5-0.02 64.81 0 97h-51v-213c11.72-0.63 25.48 0.84 37 0s24.2 0.99 34.22 1.78 16.51 0.48 23.08 2.93c6.58 2.45 11.52 4.05 15.89 10.54s8.23 9.55 9.12 17.45 3.59 17.78 2.69 27.3-1.2 18.45-3.35 24.7-6.96 11.55-13.9 12.1-17.27 6.32-7.85 9.32c9.42 2.99 10.15 3.01 17.8 10.18 7.64 7.17 4.13 10.88 6.3 21.7 2.16 10.83 0.62 25.26 1 37s-0.29 25.11 0 37z"/>
</g>
<g fill-opacity=".96" stroke="None">
<path d="m217 2c-12.07 1.78-24.4 1.05-37 1s-25.35-3.66-23 11-1.01 24.22 0 38-0.26 23.29 0 37 0.27 23.58 0 38 0.98 21.7 0 38 2.73 32.61 9.7 41.3 8.84 10.02 16 13.99c7.16 3.96 7.63 4.82 15.6 7.4 7.98 2.58 15.81 3.41 24.7 3.31s19.91 0.27 26.08-1.87 10.88-3.18 16.62-6.42c5.73-3.23 12.44-9.52 16.06-15.94 3.63-6.42 7.81-8.66 9.04-16.52s1.36-14.49 2.2-25.25-0.51-26.08 0-38-0.52-25.41 0-38-0.89-23.64 0-37-1.81-23.38 0-38-12.99-11.16-25-11-24.43 0.7-36-1c-4.18 9.81-1.41 23.42-2 36s0.35 27.25 0 40 0.34 26.35 0 39 0.55 27.79 0 40-0.19 21.01-2 31c-2.7-0.2-5.24 1.89-8-1-0.07-10.89-1.06-21.57-1-34s0.06-26.37 0-39 0.2-26.42 0-39 0.49-26.75 0-39 2.1-24.58-2-34m-3 6v59c0 18.79 0.01 41.02 0 59s0.04 41.61-0.07 57.07c-0.11 15.47 20.37 15.7 20.47 0.18 0.09-15.53 0.97-38.08 0.6-56.25s0.19-40 0-59 0.14-40.75 0-60h52c-0.5 33.03 0.67 75.95 0 108s3.83 64.5-8.13 84.92-29.75 24.49-53.87 24.08-43.5-4.68-55.57-24.77-5.86-51.28-7.43-83.23 1.17-75.95 0-109h52z"/>
</g>
<g fill-opacity=".96" stroke="None">
<path d="m386 2c-12.48 2.38-27.19 0.26-40 1s-27.19-1.5-38 1v222c16.94 2.29 37.67 0.33 55 1 2.33-33.13 0.34-67.42 1-101 7.24 35.43 8.95 65.8 16 101 12.04-0.04 26.95-0.04 39 0 6.48-31.69 9.51-65.97 14-100 3 32.26-1 67.33 2 100 17.03 0.01 36.95-0.06 54 0 2.34-73.66 0.33-149.59 1-223-23.49-4.64-53.93-0.67-79-2-6.22 26.46-6.3 53.01-12 81-1.95-14.36-3.01-26.33-5.34-40.32s-2.74-27.83-7.66-40.68m-3 6c3.35 33.34 10.28 66.16 13 99 2.87 1.55 4.07 1.48 7 0 0.33-5.77 0.41-10.67 1.35-17.69 0.94-7.03 2.69-14.91 3.32-21.98 0.62-7.08 1.97-16.45 3.32-23.34 1.36-6.89-0.56-11.12 1.81-17.24s-2.61-18.72 7.2-18.75c9.81-0.02 21.78 0.01 32 0s21.67 0.01 32 0v213h-45c0.65-47.12-1.31-95.99 1-142-2.87-1.55-4.07-1.48-7 0-4.59 47.49-12.6 94.53-18 142h-31c-5.2-47.01-14.13-93.37-19-139-2.88-1.55-4.07-1.48-7 0 2.33 45.13 0.34 92.87 1 139h-45v-213h69z"/>
</g>
<g fill-opacity=".97" stroke="None">
<path d="m1053 50c-1-12.9-2.1-25.52-1-39s-15.36-7.22-27-8-27.1 0.16-39 0-26.03-0.85-36 1c0.68 73.27-1.34 150.01 1 223 19.67-0.72 42.64 1.34 62-1-0.03-29.47 0.02-60.81 0-91h35c1.63-15.15 1.63-31.86 0-47h-35v-36c13.05-1.38 29.51 2.76 40-2m-6-42v39c-13.21 0.19-27.59-0.27-40 0 0.05 14.43 0.04 31.56 0 46 11.09 0.32 24.12-0.23 36 0v37c-11.89 0.23-24.91-0.32-36 0 0.05 29.5-0.04 60.8 0 91h-51v-213h91z"/>
</g>
<g fill-opacity=".96" stroke="None">
<path d="m1120 2c-12.07 1.78-24.4 1.05-37 1s-25.35-3.66-23 11-1.01 24.22 0 38-0.26 23.29 0 37 0.27 23.58 0 38 0.98 21.7 0 38 2.73 32.61 9.7 41.3c6.97 8.68 8.84 10.02 16 13.99 7.15 3.96 7.63 4.82 15.6 7.4s15.81 3.41 24.7 3.31 19.91 0.27 26.08-1.87 10.88-3.18 16.62-6.42c5.73-3.23 12.44-9.52 16.06-15.94 3.63-6.42 7.81-8.66 9.04-16.52s1.36-14.49 2.2-25.25-0.51-26.08 0-38-0.52-25.41 0-38-0.89-23.64 0-37-1.81-23.38 0-38-12.99-11.16-25-11-24.43 0.7-36-1c-4.18 9.81-1.41 23.42-2 36s0.35 27.25 0 40 0.34 26.35 0 39 0.55 27.79 0 40-0.19 21.01-2 31c-2.7-0.2-5.24 1.89-8-1-0.07-10.89-1.06-21.57-1-34s0.06-26.37 0-39 0.2-26.42 0-39 0.49-26.75 0-39 2.1-24.58-2-34m-3 6v59c0 18.79 0.01 41.02 0 59s0.04 41.61-0.07 57.07c-0.11 15.47 20.37 15.7 20.47 0.18 0.1-15.53 0.97-38.08 0.6-56.25s0.19-40 0-59 0.14-40.75 0-60h52c-0.5 33.03 0.67 75.95 0 108s3.83 64.5-8.13 84.92-29.75 24.49-53.87 24.08-43.5-4.68-55.57-24.77-5.86-51.28-7.43-83.23 1.18-75.95 0-109h52z"/>
</g>
<g stroke="None">
<path d="m1332 4c-8.09-2.28-18.86-0.63-29-1s-21.68 0.22-32 0-21.73 0.21-32 0c-10.26-0.21-22.03 0.36-31.97-0.02-9.95-0.38-4.03 14.81-5.03 23.02s-1.01 20.99 2 27c10.14-2.29 21.41-0.36 32-1 0.01 58.19-0.01 117.5 0 175 19.39-0.05 41.62 0 61 0 2.32-57.11 0.34-116.87 1-175 11.25-0.64 23.17 1.3 34-1-0.03-14.69-0.03-32.29 0-47m-6 4v39c-11.23 0.25-23.56-0.35-34 0 0.01 57.16-0.01 116.14 0 174h-51c-0.67-58.24 1.33-117.2-1-175-10.5 2.29-22.08 0.36-33 1v-39h119z"/>
</g>
<g fill-opacity=".96" stroke="None">
<path d="m1399 2c-12.07 1.78-24.4 1.05-37 1s-25.35-3.66-23 11-1.01 24.22 0 38-0.26 23.29 0 37 0.27 23.58 0 38 0.98 21.7 0 38 2.73 32.61 9.7 41.3 8.84 10.02 16 13.99c7.16 3.96 7.63 4.82 15.6 7.4 7.98 2.58 15.81 3.41 24.7 3.31s19.91 0.27 26.08-1.87 10.88-3.18 16.62-6.42c5.73-3.23 12.44-9.52 16.06-15.94 3.63-6.42 7.81-8.66 9.04-16.52s1.36-14.49 2.2-25.25-0.51-26.08 0-38-0.52-25.41 0-38-0.89-23.64 0-37-1.81-23.38 0-38-12.99-11.16-25-11-24.43 0.7-36-1c-4.18 9.81-1.41 23.42-2 36s0.35 27.25 0 40 0.34 26.35 0 39 0.55 27.79 0 40-0.19 21.01-2 31c-2.7-0.2-5.24 1.89-8-1-0.07-10.89-1.06-21.57-1-34s0.05-26.37 0-39 0.2-26.42 0-39 0.49-26.75 0-39 2.1-24.58-2-34m-3 6v59c0 18.79 0.01 41.02 0 59s0.04 41.61-0.07 57.07c-0.11 15.47 20.37 15.7 20.47 0.18 0.09-15.53 0.97-38.08 0.6-56.25s0.19-40 0-59 0.14-40.75 0-60h52c-0.5 33.03 0.67 75.95 0 108s3.83 64.5-8.13 84.92-29.75 24.49-53.87 24.08-43.49-4.68-55.57-24.77-5.86-51.28-7.43-83.23 1.18-75.95 0-109h52z"/>
</g>
<g fill-opacity=".95" stroke="None">
<path d="m1601 111c14.38-3.23 19.95-14.48 21.79-27.77s0.81-35.75-2.08-46.93c-2.89-11.19-11.22-21.12-22.41-26.59-11.19-5.46-25.16-6.79-43.05-7.51-17.9-0.73-44.81 0.16-63.25-0.2-3.95 22.39-1.59 49.19-2 74s0.02 52.14 0 77-0.8 50.24 1 74c19.67-0.72 42.64 1.34 62-1-0.02-31.81 0.02-65.47 0-98 3.65 0.73 6.39 2.55 9 2 4.51 12.89 2.48 30.97 3 47s-1.3 35.79 1 50c17.68-0.02 38.3-0.02 56 0 3.91-22.03 1.74-56.89 1.78-78.78s-7.14-29.17-22.78-37.22m17 110h-48c0.53-21.04-1.05-49.23 0.78-69.22 1.83-20-4.68-32.19-23.78-27.78 0.03 31.49-0.02 64.81 0 97h-51v-213c11.72-0.63 25.48 0.84 37 0s24.2 0.99 34.22 1.78 16.51 0.49 23.08 2.93c6.58 2.45 11.52 4.05 15.89 10.54s8.23 9.55 9.12 17.45 3.59 17.78 2.69 27.3-1.21 18.45-3.35 24.7c-2.15 6.25-6.96 11.55-13.9 12.1-6.93 0.55-17.27 6.32-7.85 9.32 9.42 2.99 10.15 3.01 17.8 10.18 7.64 7.17 4.14 10.88 6.3 21.7 2.16 10.83 0.62 25.26 1 37s-0.29 25.11 0 37z"/>
</g>
<g fill-opacity=".02" stroke="None">
<path d="m581 3c-17.52-3.14-31.46 3.44-42.25 8.61s-19.29 13.07-23.49 25.64c-4.19 12.57-4.46 32.57-4.26 50.75s-2.72 48.97-0.93 67.93c1.8 18.95 1.64 32.19 8.23 43.77 6.59 11.57 18.47 17.89 29.4 21.59 10.92 3.69 33.91 5.9 46.05 2.51s21.49-7.62 30.66-19.05c9.18-11.43 9.31-17.2 10.81-34.53 1.51-17.32 2.25-46.69 1.78-65.22s0-44.64-2.2-58.75c-2.21-14.11-8.65-21.69-18.7-30.34-10.05-8.66-19.77-10.16-35.1-12.91m-11 32c13.71-3.6 14.88 7.97 15 21 0.13 13.03 1.82 37.3 1 52s0.89 37.75 0 52 2.05 29.99-9.75 33.4c-11.79 3.42-15.94-7.75-15.25-21.4s1.3-37.45 1-52 0.07-38.81 0-52-3.32-30.03 8-33z"/>
</g>
<g fill-opacity=".02" stroke="None">
<path d="m1714 3c-17.52-3.14-31.46 3.44-42.25 8.61-10.79 5.16-19.29 13.07-23.49 25.64-4.19 12.57-4.45 32.57-4.26 50.75s-2.72 48.97-0.93 67.93c1.8 18.95 1.64 32.19 8.23 43.77 6.59 11.57 18.47 17.89 29.4 21.59 10.92 3.69 33.91 5.9 46.05 2.51s21.49-7.62 30.66-19.05c9.18-11.43 9.31-17.2 10.81-34.53s2.25-46.69 1.78-65.22 0-44.64-2.2-58.75c-2.21-14.11-8.65-21.69-18.7-30.34-10.05-8.66-19.77-10.16-35.1-12.91m-11 32c13.71-3.6 14.88 7.97 15 21 0.13 13.03 1.82 37.3 1 52s0.89 37.75 0 52 2.05 29.99-9.75 33.4c-11.79 3.42-15.94-7.75-15.25-21.4s1.3-37.45 1-52 0.07-38.81 0-52-3.32-30.03 8-33z"/>
</g>
<g fill-opacity=".95" stroke="None">
<path d="m907 5c-18.41 2.09-38.16 0.66-57 1s-38.27-0.27-57 0-38.54-0.37-57 0-37.65-1.19-54 1c3.1 14.47-1.16 32.98 2 46 50.8-2.33 102.76-0.33 154-1-51.75 59.08-103.5 117.7-155 175 0.9 1.96 0.12 3.27 2 5 16.73-1.69 35.24-1.62 52 0 41.22-47.91 83.52-94.31 125-142 0.13 15.98-0.17 33.13 0 49s-0.33 32.47 0 48-1.18 31.59 1 45c14.47-3.1 32.97 1.16 46-2-2.09-18.41-0.65-38.16-1-57s0.27-38.27 0-57 0.37-38.55 0-57 1.19-37.65-1-54m-3 5v217h-38c-0.28-24.34 0.38-50.88 0-75s1.17-49.62-1-71c-6.7 2.39-10.79 12.08-17.25 17.75-6.47 5.67-10.35 12.12-16.98 18.02s-9.59 13.4-16.36 18.98c-6.76 5.58-8.89 12.93-15.21 18.5-6.32 5.56-11.73 12.36-16.46 18.5s-12.31 12.48-17.45 18.55c-5.14 6.08-9.68 13.36-16.05 18.95-6.36 5.58-8.61 15.08-18.24 16.75-9.64 1.66-29.44-1.24-40 0 8.32-9.01 14.38-18.14 22.39-26.75 8.02-8.62 15.61-16.62 22.74-25.17s15.15-16.86 22.06-25.33 17.16-16.85 23.4-25.5c6.24-8.66 15.98-16.31 22.66-25s15.49-17.14 22.5-25.5 18.97-17.03 17.25-26.75c-51.83 2.33-104.75 0.33-157 1v-38h217z"/>
</g>
<g fill-opacity=".01" stroke="None">
<path d="m136 220c-0.29-11.89 0.38-25.26 0-37s1.16-26.17-1-37c-2.17-10.82 1.34-14.53-6.3-21.7-7.65-7.17-8.38-7.19-17.8-10.18-9.42-3 0.91-8.77 7.85-9.32s11.75-5.85 13.9-12.1 2.45-15.18 3.35-24.7-1.8-19.4-2.69-27.3-4.75-10.96-9.12-17.45-9.31-8.09-15.89-10.54c-6.57-2.45-13.06-2.14-23.08-2.93s-22.7-2.62-34.22-1.78-25.28-0.63-37 0v213h51c-0.02-32.19 0.03-65.5 0-97 19.1-4.41 25.61 7.78 23.78 27.78-1.83 19.99-0.25 48.18-0.78 69.22h48m-71-128c-0.01-16.39 0.07-35.6 0-52 21.53-5.68 23.2 12.04 23 29s-4.04 28.6-23 23z"/>
</g>
<g fill-opacity=".02" stroke="None">
<path d="m214 8h-52c1.17 33.05-1.57 77.05 0 109s-4.64 63.14 7.43 83.23 31.45 24.36 55.57 24.77 41.91-3.66 53.87-24.08 7.46-52.87 8.13-84.92-0.5-74.97 0-108h-52c0.14 19.25-0.19 41 0 60s-0.37 40.83 0 59-0.51 40.72-0.6 56.25c-0.1 15.52-20.58 15.29-20.47-0.18 0.11-15.46 0.06-39.09 0.07-57.07s0-40.21 0-59v-59z"/>
</g>
<g fill-opacity=".02" stroke="None">
<path d="m383 8h-69v213h45c-0.66-46.13 1.33-93.87-1-139 2.93-1.48 4.12-1.55 7 0 4.87 45.63 13.8 91.99 19 139h31c5.4-47.47 13.41-94.51 18-142 2.93-1.48 4.13-1.55 7 0-2.31 46.01-0.35 94.88-1 142h45v-213c-10.33 0.01-21.78-0.01-32 0s-22.19-0.02-32 0c-9.81 0.03-4.83 12.63-7.2 18.75s-0.45 10.35-1.81 17.24c-1.35 6.89-2.7 16.26-3.32 23.34-0.63 7.07-2.38 14.95-3.32 21.98-0.94 7.02-1.02 11.92-1.35 17.69-2.93 1.48-4.13 1.55-7 0-2.72-32.84-9.65-65.66-13-99z"/>
</g>
<g fill-opacity=".02" stroke="None">
<path d="m1047 8h-91v213h51c-0.04-30.2 0.05-61.5 0-91 11.09-0.32 24.11 0.23 36 0v-37c-11.88-0.23-24.91 0.32-36 0 0.04-14.44 0.05-31.57 0-46 12.41-0.27 26.79 0.19 40 0v-39z"/>
</g>
<g fill-opacity=".02" stroke="None">
<path d="m1117 8h-52c1.18 33.05-1.57 77.05 0 109s-4.64 63.14 7.43 83.23 31.45 24.36 55.57 24.77 41.91-3.66 53.87-24.08 7.46-52.87 8.13-84.92-0.5-74.97 0-108h-52c0.14 19.25-0.19 41 0 60s-0.37 40.83 0 59-0.5 40.72-0.6 56.25c-0.1 15.52-20.58 15.29-20.47-0.18 0.11-15.46 0.06-39.09 0.07-57.07s0-40.21 0-59v-59z"/>
</g>
<g fill-opacity=".01" stroke="None">
<path d="m1326 8h-119v39c10.92-0.64 22.5 1.29 33-1 2.33 57.8 0.33 116.76 1 175h51c-0.01-57.86 0.01-116.84 0-174 10.44-0.35 22.77 0.25 34 0v-39z"/>
</g>
<g fill-opacity=".02" stroke="None">
<path d="m1396 8h-52c1.18 33.05-1.57 77.05 0 109s-4.65 63.14 7.43 83.23 31.45 24.36 55.57 24.77 41.91-3.66 53.87-24.08 7.46-52.87 8.13-84.92-0.5-74.97 0-108h-52c0.14 19.25-0.19 41 0 60s-0.37 40.83 0 59-0.51 40.72-0.6 56.25c-0.1 15.52-20.58 15.29-20.47-0.18 0.11-15.46 0.06-39.09 0.07-57.07s0-40.21 0-59v-59z"/>
</g>
<g fill-opacity=".01" stroke="None">
<path d="m1618 220c-0.29-11.89 0.38-25.26 0-37s1.16-26.17-1-37c-2.16-10.82 1.34-14.53-6.3-21.7-7.65-7.17-8.38-7.19-17.8-10.18-9.42-3 0.92-8.77 7.85-9.32 6.94-0.55 11.75-5.85 13.9-12.1 2.14-6.25 2.45-15.18 3.35-24.7s-1.8-19.4-2.69-27.3-4.75-10.96-9.12-17.45-9.31-8.09-15.89-10.54c-6.57-2.44-13.06-2.14-23.08-2.93s-22.7-2.62-34.22-1.78-25.28-0.63-37 0v213h51c-0.02-32.19 0.03-65.51 0-97 19.1-4.41 25.61 7.78 23.78 27.78-1.83 19.99-0.25 48.18-0.78 69.22h48m-71-128c-0.01-16.39 0.07-35.6 0-52 21.53-5.68 23.2 12.04 23 29s-4.04 28.6-23 23z"/>
</g>
<g fill-opacity=".02" stroke="None">
<path d="m904 10h-217v38c52.25-0.67 105.17 1.33 157-1 1.72 9.72-10.24 18.39-17.25 26.75s-15.82 16.81-22.5 25.5-16.42 16.34-22.66 25c-6.24 8.65-16.49 17.03-23.4 25.5s-14.93 16.78-22.06 25.33-14.72 16.55-22.74 25.17c-8.01 8.61-14.07 17.74-22.39 26.75 10.56-1.24 30.36 1.66 40 0 9.63-1.67 11.88-11.17 18.24-16.75 6.37-5.59 10.91-12.87 16.05-18.95 5.14-6.07 12.72-12.41 17.45-18.55s10.14-12.94 16.46-18.5c6.32-5.57 8.45-12.92 15.21-18.5 6.77-5.58 9.73-13.08 16.36-18.98s10.51-12.35 16.98-18.02c6.46-5.67 10.55-15.36 17.25-17.75 2.17 21.38 0.62 46.88 1 71s-0.28 50.66 0 75h38v-217z"/>
</g>
<g fill-opacity=".91" stroke="None">
<path d="m570 35c-11.32 2.97-8.07 19.81-8 33s-0.3 37.45 0 52-0.31 38.35-1 52 3.46 24.82 15.25 21.4c11.8-3.41 8.86-19.15 9.75-33.4s-0.82-37.3 0-52-0.87-38.97-1-52c-0.12-13.03-1.29-24.6-15-21m-2 151c-0.15-22.21-0.58-49.94 0-74s-2.58-51.14 2-71c13.26 0.18 8.99 14.97 10 28s-0.36 33.3 0 47 0.05 33.93 0 47 1.01 30.08-12 23z"/>
</g>
<g fill-opacity=".91" stroke="None">
<path d="m1703 35c-11.32 2.97-8.07 19.81-8 33s-0.3 37.45 0 52-0.31 38.35-1 52 3.46 24.82 15.25 21.4c11.8-3.41 8.86-19.15 9.75-33.4s-0.82-37.3 0-52-0.87-38.97-1-52c-0.12-13.03-1.29-24.6-15-21m-2 151c-0.15-22.21-0.58-49.94 0-74s-2.58-51.15 2-71c13.26 0.18 9 14.97 10 28s-0.36 33.3 0 47 0.05 33.93 0 47 1.01 30.08-12 23z"/>
</g>
<g fill-opacity=".95" stroke="None">
<path d="m65 93c18.96 5.6 22.8-6.04 23-23s-1.47-34.68-23-29c0.07 16.4-0.01 35.61 0 52m6-4v-43c12.75-0.75 11.12 10.22 11 21s2.56 21.91-11 22z"/>
</g>
<g fill-opacity=".95" stroke="None">
<path d="m1547 93c18.96 5.6 22.8-6.04 23-23s-1.47-34.68-23-29c0.07 16.4-0.01 35.61 0 52m6-4v-43c12.75-0.75 11.12 10.22 11 21s2.56 21.91-11 22z"/>
</g>
<g fill-opacity=".05" stroke="None">
<path d="m568 186c13.01 7.08 11.95-9.93 12-23s0.36-33.3 0-47 1.01-33.97 0-47 3.26-27.82-10-28c-4.58 19.86-1.42 46.94-2 71s-0.15 51.79 0 74z"/>
</g>
<g fill-opacity=".05" stroke="None">
<path d="m1701 186c13.01 7.08 11.95-9.93 12-23s0.36-33.3 0-47 1-33.97 0-47 3.26-27.82-10-28c-4.58 19.85-1.42 46.94-2 71s-0.15 51.79 0 74z"/>
</g>
<g fill-opacity=".04" stroke="None">
<path d="m71 89c13.56-0.09 10.88-11.22 11-22s1.75-21.75-11-21v43z"/>
</g>
<g fill-opacity=".04" stroke="None">
<path d="m1553 89c13.56-0.09 10.88-11.22 11-22s1.75-21.75-11-21v43z"/>
</g>
</svg>

HTML/CSS toggle button read/write state

Looking for a way to have a page with toggle buttons on/off. i’m making a page that will be for me to track when my dogs were/need medication. (have a magnetic whiteboard now, but trying to go with digital dashboards throughout the house.) So I created a page with toggles using html and css, very basic. problem is, if I refresh the page, or pull up the page from a different dashboard they all revert to default of off. I tried searching but everything I could find was on how to create them. I need a way to write each button state to a file so it doesn’t change on refresh.
Is this possible? maybe with javascript? asp? (never really done more than basic html/css stuff.)

Thanks

haven’t tried that much, except for creating a page with buttons and finding out it doesn’t write state anywhere. which after thinking about it was a DUH moment, because there is no output to anything. Then I tried to search, but probably didn’t use the correct verbage.

Fontawesome icon links working on all pages except the home page. I am building with React

React Frontend and Django Backend Web Portfolio

I am having an issue where my fontawesome social media icon links aren’t working on my homepage. The links all work on the additional four pages I have set up, but there is no linkage on the home page. I have included my header.js file, my home.js file, and my app.js file (note: I have removed my personalized links for this post, but they are all correct in my code).

home.js File —

import React from 'react';
import './css/style.css';
import portfolio_logo_red from './images/portfolio_logo_red.png';
import {Link} from 'react-router-dom';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faBehance, faGithub, faLinkedin } from '@fortawesome/free-brands-svg-icons';

const Header = () => {

    return (
        <div>   
        <header>
            <div className='logo'>
                <img src={portfolio_logo_red} alt="Portfolio Logo Red"/>
            </div>
            <nav>
                <ul>
                    <li className='navigation'>
                        <Link className='nav-links' to="/">Home</Link>
                    </li>
                    <li className='navigation'> 
                        <Link className='nav-links' to="/about">About</Link>
                    </li>
                    <li className='navigation'>
                        <Link className='nav-links' to="/projects">Projects</Link>
                    </li>
                    <li className='navigation'>
                        <Link className='nav-links' to="/experience">Experience</Link>
                    </li>
                    <li className='navigation'>
                        <Link className='nav-links' to="/contact">Contact</Link>
                    </li>
                </ul>
            </nav>
        </header>
        <footer id='footer-text'>    
            <div className='social-icons'>
                    <a id='social-color' href='https://www.behance.net/' target='_blank' rel='noopener noreferrer'>
                        <FontAwesomeIcon icon={faBehance} className='icon' />
                    </a>
                    <a id='social-color' href='https://www.linkedin.com/in/' target='_blank' rel='noopener noreferrer'>
                        <FontAwesomeIcon icon={faLinkedin} className='icon' />
                    </a>
                    <a id='social-color' href='https://github.com/' target='_blank' rel='noopener noreferrer'>
                        <FontAwesomeIcon icon={faGithub} className='icon' />
                    </a>
            </div>
            &copy; 2024 Amy Mummert. All Rights Reserved 
        </footer>      
        </div> 
    );
};
export default Header;

home.js File —

import React from 'react';
import { Link } from 'react-router-dom';
import './css/style.css';
import portfolio_logo_red from './images/portfolio_logo_red.png';
import Header from './header.js';

const Home = () => {
    return (
        <div>
            <Header /> 
            <div className="container">
                <div className="logo-container">
                    <img className='logo' src={portfolio_logo_red} alt="Portfolio Logo Red" />
                </div>
                <div className="content">
                    <h2 id='animated-text' className='welcome'>Welcome, my name is</h2>
                    <h1 id='animated-text' className='name'>Amy Mummert</h1>
                    <p id='animated-text' className='message'>I'm a software engineer focusing on web development.
                        I create and build fullstack applications with engaging user interfaces
                        and responsive designs.</p>
                    <p id='animated-text'><Link to="/projects"><button className='button-24-home'>Check Out My Work!</button></Link></p>
                </div>
            </div>
        </div>
    );
};

export default Home;

App.js File —

import './App.css';
import React from 'react';
import { BrowserRouter as Router, Routes, Route} from 'react-router-dom';
import Header from './components/header.js'
import Home from './components/home.js'
import About from './components/about.js'
import Projects from './components/projects.js'
import Experience from './components/experience.js'
import Contact from './components/contact.js'
import DogTrainingDemo from './components/dogtrainingdemo.js'
import './components/css/style.css';
import NoteTakingApp from './components/notetakingapp.js';
import BatonTwirlingDemo from './components/batontwirlingdemo.js';

function App() {
  return (
    
    <Router>
     <Header />
      <div>
        <Routes>
          <Route path="/about" element={<About />} />
          <Route path="/projects" element={<Projects />} />
          <Route path="/experience" element={<Experience />} />
          <Route path="/contact" element={<Contact />} />
          <Route path="/" element={<Home />} />
          <Route path="/dogtrainingdemo" element={<DogTrainingDemo />} />
          <Route path="/notetakingapp" element={<NoteTakingApp />} />
          <Route path="/batontwirlingdemo" element={<BatonTwirlingDemo />} />
        </Routes>
      </div>
    </Router>
  );
}

export default App;

What I have tried:

  • I tried messing around with the css in the firefox dev tools and didn’t find anything that might be interfering with the links on the home page.
  • I checked all of my routes and everything seems to be working as expected, but I may have missed something here.
  • I am currently using firefox, but switched to using chrome as well when I discovered this issue. Specific browsers don’t seem to fix it.

How to reconstruct the shortest path with BFS (Javascript) for Knight chess piece?

I’m currently working for a project with TOP and I’m asked to find the shortest path between 2 squares with a Knight on a 8×8 chessboard. Imagine I want to go from 0,0 to 7,7, my algo need to return me the shortest path, with all squares visited relative to this shortest path.

For this project, I’ve created a Graph class with an Adjacency List object. I’ve created an addEdge and addVertex functions and populateGraph and populateEdge functions.

populateGraph create vertexs from 00 to 77 as properties of adjacency List and populateEdges create edges for all properties following the knight moves rules in a chess game.

With this, I can create a BFS function with 2 params ( start and end ) who will give me the number of moves before reaching the end from the start.

For this, I create a queue with source as first element and create a visited Set and knightMove counter at 0.

While my queue is not empty, I take the first element of my queue, if it has been visited, it loop until a fresh element, else if this element is my end, I return my number of moves, else I increase my knightMove, put this element in my visited Set and take his childrens and push them into the queue.

To reach 0.0 to 7.7, it take me 63 moves. To move from 0.0 to 1.2 it take me one move.

I think I could once the ending node has been found, reconstruct the path by working on all the visited squares, but I don’t know how to do this or if this is a good solution.

Here is my BFS :

js
 bfs(source, destination) {
    const queue = [source];
    const result = [];
    const visited = new Set();
    let knightMoves = 0;
    while (queue.length !== 0) {
      let max = queue[0];
      for (let i = 0; i < queue.length; i += 1) {
        if (queue[i] > max) {
          max = queue[i];
        }
      }
      let current = max;

      while (visited.has(current)) {
        current = queue.shift();
      }
      console.log(visited);
      if (current === destination) {
        console.log('Ive found the position.');
        console.log(`This is number of moves before found : ${knightMoves}`);
        return;
      }
      knightMoves += 1;

      visited.add(current);

      const neighbor = this.adjacencyList[current];

      neighbor.forEach((value) => {
        if (visited.has(value)) {
          return;
        }

        queue.push(value);
      });
    }
  }

Challenge with Circular Repeat

I’m trying to solve this JavaScript test:

Given a string s and a number n, return a new string with the characters of s repeated n times consecutively in a circular manner. If the length of the new string is greater than 100, truncate it to a length of 100.

So far, I’ve tried these options, but they all fail.

function circularRepeat(s, n) {
    n = Math.min(n, 100); // Ensure n doesn't exceed 100

  let result = "";
  for (let i = 0; i < n; i++) {
    result += s[i % s.length]; // Use modulo to select characters circularly
  }
  return result;
}
function circularRepeat(s, n) {
    return n > 100 ? s.repeat(100) : s.repeat(n);
}

What’s wrong here? how can it be solved?

Unable to pass bearer token in axios.get request

I am trying to make an api call using axios , if i use the put,post or delete method then i am able to pass bearer token in the header , but no in the get method

const config = { headers: { Authorization: `Bearer ${token}` } };

this get request doesn’t work

axios.get(
        "http://localhost:3001/api/message/",
        {
          chatId: "661925ba21df3cb3dc4958be",
        },
        config
      )
      .then(async (results) => {
        console.log(results);
      })
      .catch((error) => {
        console.log(error);
      });

Bearer token is not present in get request
but this post request works

axios.post(
        "http://localhost:3001/api/message/",
        {
          chatId: "661925ba21df3cb3dc4958be",
        },
        config
      )
      .then(async (results) => {
        console.log(results);
      })
      .catch((error) => {
        console.log(error);
      });

Bearer token is present in post request

I just changed get to post and the bearer token is included in the header , what’s the issue with get method?

Use a JavaScript user-inputted variable more than only the first time/once in HTML

I’m making a game with HTML/CSS and JavaScript, and would like players to enter their name into a text input field. After they enter their name, I would like to save that name as a variable and continuously use it throughout the entire game, not just once. For clarity’s sake, I am using a separate file for all JavaScript because I like having the JavaScript separate from my HTML and would prefer not to use <script> tag – although if it will be easier to use <script> tag then I guess I’ll be fine with that.

Example of what I’d like to accomplish:

  • Player enters their name, let’s say, Abc
  • The game saves the name Abc and for the entire rest of the game, uses that user input (Abc) to talk directly to the player: “Hello, Abc.” or “Abc, that was a good choice” etc.

I first made a function in my JavaScript file, where I declared a variable that would retrieve the user input in my HTML. Another variable would be used to insert itself into the HTML, to show the player’s inputted name.

After that, I created an if-statement that would check if the player inputted anything, and if they had, the result and input would be equal to each other. I then coded the submit button for this input. This attempt only displayed the user inputted name for the first instance, inside the <h2> Your name is <span id = 'resultingInput'></span> ? </h2>. However, it was empty for the second instance I tried using the same user input, <p>Thank you, <span id = 'resultingInput'></span> . </p> In the very next section of the game, the input wasn’t shown as well. Only the very first usage of the user inputted variable displayed what the user actually inputted, the rest were just blank. This first attempt is shown below:

HTML attempt 1

<form id = 'form'>
   <input type = 'text' id = 'userInput'/>


   <button type = 'submit' id = 'submitButton'> 
      <a href = '#submit-input'> enter this name </a>
    </button> 

 </form> 

<div id = 'submit-input' class = 'event'>
   <h2> Your name is <span id = 'resultingInput'></span> ? </h2>
    
   <p>Thank you, <span id = 'resultingInput'></span> . </p> 
     
</div>

JavaScript attempt 1

$(document).ready(function() {
  function getName() {

    var input = document.getElementById('userInput').value;
    var result = document.getElementById('resultingInput');

        if (input.length > 0) {
            result.textContent = input;
        }


   }


    var submit = document.getElementById('submitButton');
    submit.addEventListener('click', getName); 

    getName();

});

Result attempt 1
Image of result of code, with words “Your name is Abc? Thank you. ,

Attempt 2 had the same exact results as Attempt 1. After this attempt, I remembered that id’s were unique, and that they couldn’t really be used twice. So, I tried to use classes instead of id’s, but going about the logic in a similar way. This second attempt is shown below. Also, instead of using “resultingInput” and “result” in this attempt, I used “player” and “playerName” in order to differentiate the two attempts. Sorry for any confusion.

HTML attempt 2

<form id = 'form'>
   <input type = 'text' id = 'userInput'/>


   <button type = 'submit' id = 'submitButton'> 
      <a href = '#submit-input'> enter this name </a>
    </button> 

 </form> 

<div id = 'submit-input' class = 'event'>
   <h2> Your name is <span class = 'player'></span> ? </h2>
    
   <p>Thank you, <span class = 'player'></span> . </p> 
     
</div>

JavaScript attempt 2

$(document).ready(function() {
  function getName() {

    var input = document.getElementById('userInput').value;
    var playerName = document.getElementsByClassName('player')[0];

        if (input.length > 0) {
            playerName.textContent = input;

        }

   }
    var submit = document.getElementById('submitButton');
    submit.addEventListener('click', getName); 

    getName();

});

Result attempt 2
Image of result of code, with words “Your name is Abc? Thank you. ,

In this second attempt, the same results happened, where only the first instance of the variable that saved the user input was shown. For my third attempt, I found another answer that would use querySelectorAll. The HTML remained the same, but for the third attempt’s JavaScript, I did as follows.

JavaScript attempt 3 (HTML stayed the same at attempt 2)

$(document).ready(function() {
  function getName() {

    var input = document.getElementById('userInput').value;
    const playerName = document.querySelectorAll('player');

    for (let i = 0; i < playerName.length; i++) {
       playerName[i].src = input;

   }

    var submit = document.getElementById('submitButton');
    submit.addEventListener('click', getName); 

    getName();

});

Result attempt 3
Image of result of code, with words “Your name is ? Thank you. ,

This was my last attempt, as I found with console.log statements that the code never even made it inside the loop, and as such, not even the first instance of the user input variable (<h2> Your name is <span class = 'player'></span> ? </h2>) was shown. I have looked into .innerHTML as well, but have also ran into problems with this as it will just display the actual HTML or show up blank, rather than show the user input.

What would be a good way to go about solving this issue, as it seems like no matter what I tried or could search up, the HTML will only display the user-inputted variable once, rather than every single time after that.

Thank you very much, and sorry for a long question.

Rendering Minified JavaScript File Manually in HTML Gives Errors

I have a React application that I’ve deployed to Netlify, and it works perfectly fine when accessed through the deployed URL. However, when I try to manually include the minified JavaScript file in an HTML file and render it outside of the deployed environment, I encounter errors. Moreover, when I use minified JS link of my application that have no routing then it shows content of site.

Like If I use this it gives error

function App() {

return (
   <ThemeProvider theme={createTheme({ palette })}>
   <RouterProvider router={router} fallbackElement={<MainLoadingScreen />} />
   </ThemeProvider>
  );
}

If I use this it not gives any error

function App() {
   return (    
     <h1>test</h1>   
  ); 
}

Here’s what I’ve tried so far:

  • I’ve verified that the path to the minified JavaScript file is correct and matches the location of the file.
  • I’ve checked for relative paths to static assets referenced in the minified bundle and ensured they resolve correctly.
  • I’ve examined any base URLs and ensured they are correctly configured in the HTML file.

Despite these efforts, I still encounter errors when trying to render the minified JavaScript file manually. For reference I added html code below.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Your React App Integration</title>
    <!-- Include your custom CSS styles if needed -->
    <!-- Include your custom CSS styles -->
    <link rel="stylesheet" href="https://demo.mysite.net/static/css/main.172882ed.css">

    <!-- <link rel="stylesheet" href="styles.css"> -->
</head>

<body>
    <!-- This is where your React app will be rendered -->
    <div id="root"></div>
    <!-- Include the React.js and ReactDOM libraries -->
    <script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react-router-dom/6.22.3/react-router-dom.production.min.js" integrity="sha512-eFKluaAyNJr8h7VL24su8w9qVFlNeLEI6nroW/ltJoh79cMIqXbHbJ+rKRZxalcTWiUPecOnSDnjVKsyAOA0xQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>

    <!-- Your React app bundle from the CDN -->
    <script src="https://demo.mysite.net/static/js/main.f61f5895.js"></script>
    <!-- Mount your React app to the specified DOM element -->
    <script>
        const rootElement = document.getElementById('root');
        console.log(rootElement)
        ReactDOM.createRoot(rootElement).render(React.createElement(App));
    </script>
</body>

</html>

Error

CSS property: display: none Cypress error – Cannot click Add buttons to add products to basket

I’m currently building a e2e regression test suit for an eCommerce website developed in Angular JS, I have written a loop and provided a condition in it, this is my code:

           const productText = $el.find('.productName').text()
           if(productText.includes('Cookie')) {
              cy.wrap(productText).get('.add-btn').contains('Add').click()
             
           }
     })```

The website UI is a table view so I'm looping through this table view by tr, and then I also provided a locator there .productName which is the product name basically and  if any of the product names on in this table contain "Cookies" word then find the Add button and click to add to basket.

Interestingly if adds the first product at index 0 from the table tr but then when it moves to the next iteration then I get this error:

"Timed out retrying after 4050ms: cy.click() failed because this element is not visible:

<span ng-if="!(!(price.Stock > 0) &amp;&amp; product.AllowBackOrders &amp;&amp; !bypassStock)" translate="" class="ng-scope">Add</span>

This element <span.ng-scope> is not visible because its parent <button.btn.btn-primary.add-btn.hide> has CSS property: display: none"

The locator is the same for all the buttons I have checked this many times, but then if I use click({force: true}), this still add only the first prodiuct to the basket and then find those products which meet the if statement but it does not click on their add button to add them as well into the basket.

Can someone help with this probably is simple but I'm just stuck here with this, here is a video I have recorded: https://vimeo.com/936771058/081f79e031?share=copy

Determining the indices of removedNodes in MutationRecord

I am working with MutationObserver API and want to correctly apply incoming MutationRecord to a copy of the tree I’m storing elsewhere. What puzzles me is removedNodes collection. When my observer is called and removedNodes is not empty, it means that the mutation has already taken place and the node has been removed from its’ parent childNodes. Therefore, in order to determine its position in the child list before the mutation happened – to reflect that in my copy of the tree – I can inspect the previousSibling and nextSibling properties of the MutationRecord.
But what if the removedNodes contains more than one element? Since the MutationRecord has only single occurrence of both previousSibling and nextSibling, the logical thing would be to think that removed nodes used to be between them. But is it what actually happens?

So, to state some single-sentences questions:

  1. is it safe to assume that if MutationRecord’s removedNodes contains more than one node, then every node listed in that collection used to be between MutationRecord’s previousSibling and nextSibling in the DOM tree before the mutation (removal) has happened?
  2. is it safe to assume that if multiple distant (i.e. not present in parent’s childNodes collection at adjacent indices) children of a specified observed node got removed, that would result in multiple MutationRecords?
  3. if 1) is true, is it safe to assume that the order of the nodes in the array is the same order they used to be placed in their parent’s childNodes?

Thanks in advance.

Shifting value from one objects array to another in javascript

I have an array of objects. These objects have a property that is also an array. I want to insert a new value into my array of objects. It has to be sequential in that I always want to add the value to the first objects array but if there is an item in the first objects array already, then I want to move it to the second to make room for the new item.

Diagram

the result I am getting is the first two objects have the newest value in the list, and the last object has the first added value. The intended result is for the first object in the array to have a list with a value of ‘item2’, the next object in the array to have a list with the value of ‘item1’ and the last object to have an empty list until I add another item.

Thank you for the help.

function addItem(arr, item) {
  let current = 0;
 
  //if first object list is empty add the item 
  if(!arr[0].list.length){
    arr[current].list.push(item);
    return
  }

  while (current < arr.length) {
    
    //check the current objects list is not empty
    if(arr[current].list.length != 0){
      //check if there is a next object in the array and it has an item in it's list
      if(arr[current + 1] && !arr[current + 1].list.length){
        //if there is a next object and it does not have an item in it's list
        //remove the current item in current list
        let move_item = arr[current].list.shift();
        //add the item to the next object in the array
        arr[current + 1].list.push(move_item);
        //add the new item to the current object in the array
        arr[current].list.push(item);   
      }
    }
    console.log(arr[current]);
    current++; 
  }
}

// Example usage
let item = 'item1';
let item2 = 'item2';
const myArr = [
  {name:'one', list:[]},
  {name:'two', list:[]},
  {name:'three', list:[]}
];
addItem(myArr, item);
addItem(myArr, item2);

React.StrictMode – Unexpected token ‘<'

I tried everything but for some reason my browser just won’t let me use StrictMode, I just started using React and I want to connect my index.js to my index.html. I checked the import statements everything is fine, I wanted to start with React so I just started with the Official React documenations, and everything is the same in my files as it is in theirs, I also installed all the packages, everything seems to be right but for some reason my browser won’t recgonize the syntax. I even tried using 4 different browsers, still nothing. Thanks for any help.

PS. This is the full error
Uncaught SyntaxError: Unexpected token ‘<‘ (at index.js:9:3)

I tried everything that I could.