Import variable works, but separate unrelated code below the import breaks

I have two JavaScript files, and I am trying to transfer the value of a variable to the second JavaScript file, so that the state is being reflected based on changes made to the second sheet.

when I open the console in the browser, it shows that the file named import is indeed receiving the value of the file named export.

the HTML document, has a script tag at the bottom with type module, and reading from the import file.

but specifically the onclick function breaks, when “import” and “type=”module”” are added.

enter image description here

other value still works as seen in the console, it’s just onclick that appears to break.

I have tried updating VSCode, watching tutorials, looking for similar issues.

D3.js map & tooltip not populating with data from my local csv file

I am currently having an issue with a D3.js map that I built several years ago. It is a map of the US and on hover, I have a tooltip that appears with the state name, state fish, and a link to click on for the user to visit the respective Dept. of Fish and Wildlife for each state. This map is live on a website and the data is currently being pulled from a csv file that I’m hosting in a GitHub gist. The reason for me delving in to this project now is that you’ll notice from the map on the website, that some of the links to the state dept of fish and wildlife have moved their websites to another url, meaning that my links don’t work. I believe that Illinois and Indiana are a couple of them I was attempting to fix.

However, trying to edit the csv file in the github gist is somewhat difficult, so I decided I wanted to take the csv file to my local pc (for easier editing) and then upload it to my server that I host the website on. I didn’t anticipate not being able to populate the data in my D3.js map. The map that is currently active is at www.salmonegg.com.

What am I missing? It literally should work exactly like my github gist. I haven’t changed anything major, except the source of the csv file. In my research, I’m assuming I’m doing this correctly with the d3.csv() function. I’m also assuming that the path is correct in my variable csvdata.

So far, the map builds correctly, but the tooltip doesn’t load with the data. When I run the code, while logging the data to the console to see what data my d3 tooltip is receiving, some of the items return undefined. It only returns about 21 items, then it stops because of the undefined items. But when I log my stateData variable, I can see all of the items for each state loaded correctly.

I should say here as well that the code errors out, showing undefined items right away as it attempts to draw the data point on the map where I can hover and see that tooltip. On the live map on the website, you can see that on the map there’s a small blue circle with the states postal code. You should be able to hover over that and see the tooltip with the data. Of course, I’m using the data from my csv file to populate not only the data points for the tooltip, but that’s where I’m retreiving the postal code for the map.

Here’s my d3.js map code:

//div id for D3.js map is #fishWildlifeMap

function dropdownMenuData(data) {
    if (data[0] !== 'District of Columbia') {
        var tag = "<a class='dropdown-item' target='_blank' href='" + data[1] + "'>" + data[0] + "</a>";
        $('#dropdownMenu').append(tag);
    }
}

var usmap = "https://unpkg.com/us-atlas@1/us/10m.json";
var csvdata = "csvformap.csv";

d3.queue()
    .defer(d3.json, usmap)
    .defer(d3.csv, csvdata)
    .await(buildMap);


var width = 1000;
var height = 600;

function buildMap(error, us, dataForStates) {

    var data = topojson.feature(us, us.objects.states).features;

    var svg = d3.select("#fishWildlifeMap").append('svg')
        .attr("viewBox", "0 0 " + width + " " + height)
        .attr("preserveAspectRatio", "xMinYMin meet")
        .attr("id", "svg-responsive");

    var color = d3.scaleSequential(d3.interpolateBlues)
        .domain([0, 100]);

    var path = d3.geoPath();

    var stateData = {};

    dataForStates.forEach(function (el, i) {
        var key = el.id < 10 ? '0' + el.id : el.id;
        stateData[key] = [el.name, el.url, el.statefish, el.code];
        dropdownMenuData(stateData[key]);
    });

    var tooltip = d3.select('body').append('div')
        .attr('class', 'tooltip')
        .data(dataForStates);

    svg.append("g")
        .attr("class", "states")
        .selectAll("path")
        .data(topojson.feature(us, us.objects.states).features)
        .enter().append("path")
        .attr("d", path)
        .style('fill', function (d, i) { return color(i * 2) })

    svg.append("path")
        .attr("class", "state-borders")
        .attr("d", path(topojson.mesh(us, us.objects.states, function (a, b) { return a !== b; })));

    svg.append('g')
        .selectAll('circle')
        .data(data)
        .enter()
        .append('circle')
        .attr("cx", function (d) {
            if (stateData[d.id][3] !== "DC") {
                if (stateData[d.id][3] === "FL") {
                    return path.centroid(d)[0] + 15;
                }
                else if (stateData[d.id][3] === "NJ" || stateData[d.id][3] === "RI" || stateData[d.id][3] === "DE") {
                    return path.centroid(d)[0] + 25;
                }
                else if (stateData[d.id][3] === "MD" || stateData[d.id][3] === "MA") {
                    return path.centroid(d)[0] + 45;
                }
                else if (stateData[d.id][3] === "LA" || stateData[d.id][3] === "HI" || stateData[d.id][3] === "RI") {
                    return path.centroid(d)[0] - 10;
                }
                else {
                    return path.centroid(d)[0];
                }
            }
        })
        .attr("cy", function (d) {
            if (stateData[d.id][3] !== "DC") {
                if (stateData[d.id][3] === "HI") {
                    return path.centroid(d)[1] + 20;
                }
                else if (stateData[d.id][3] === "MD" || stateData[d.id][3] === "RI") {
                    return path.centroid(d)[1] + 25;
                }
                else {
                    return path.centroid(d)[1] + 5;
                }
            }
        })
        .attr('r', 12)
        .style('fill', 'navy')
        .style('opacity', function (d) {
            if (stateData[d.id][3] === "DC") {
                return "0";
            }
            else {
                return ".6";
            }
        });

    svg.append("g")
        .selectAll("text")
        .data(data)
        .enter()
        .append("svg:text")
        .text(function (d) {
            if (stateData[d.id][3] !== "DC") {
                return stateData[d.id][3];
            }
        })
        .attr("x", function (d) {
            if (stateData[d.id][3] === "FL") {
                return path.centroid(d)[0] + 15;
            }
            else if (stateData[d.id][3] === "NJ" || stateData[d.id][3] === "RI" || stateData[d.id][3] === "DE") {
                return path.centroid(d)[0] + 25;
            }
            else if (stateData[d.id][3] === "MD" || stateData[d.id][3] === "MA") {
                return path.centroid(d)[0] + 45;
            }
            else if (stateData[d.id][3] === "LA" || stateData[d.id][3] === "HI" || stateData[d.id][3] === "RI") {
                return path.centroid(d)[0] - 10;
            }
            else {
                return path.centroid(d)[0];
            }
        })
        .attr("y", function (d) {
            if (stateData[d.id][3] === "HI") {
                return path.centroid(d)[1] + 22;
            }
            else if (stateData[d.id][3] === "MD" || stateData[d.id][3] === "RI") {
                return path.centroid(d)[1] + 27;
            }
            else {
                return path.centroid(d)[1] + 7;
            }
        })
        .attr("text-anchor", "middle")
        .attr('font-size', '12px')
        .attr('fill', 'white')
        .on('mouseover', function (d, i) {
            tooltip.transition()
                .duration(500)
                .style("opacity", 0);
            tooltip.transition()
                .duration(200)
                .style("opacity", 1);

            tooltip.html(function () {
                if (stateData[d.id][0] !== "District of Columbia") {
                    return "<div id='text' class='text-center'><a target='_blank' href='" + stateData[d.id][1] + "'>" + stateData[d.id][0] + "</a><br>State Fish: " + stateData[d.id][2] + "</div>";
                }
            })
                .style('left', (d3.event.pageX - 10) + 'px')
                .style('top', (d3.event.pageY - 10) + 'px')
        });

}

And the csv file here:

id,code,name,url,statefish
1,AL,Alabama,https://www.fws.gov/alabama/,Large-mouth Bass & Fighting Tarpon
2,AK,Alaska,https://www.fws.gov/alaska/,King Salmon
3,AZ,Arizona,https://www.azgfd.com/,Apache Trout
4,AR,Arkansas,https://www.agfc.com/,Not recognized
5,CA,California,https://www.wildlife.ca.gov/,Golden Trout & Garibaldi
6,CO,Colorado,https://www.fws.gov/coloradofishandwildlife/,Greenback Cutthroat Trout
7,CT,Connecticut,https://www.portal.ct.gov/DEEP/Fishing/CT-Fishing/,American Shad
8,DE,Delaware,https://dnrec.delaware.gov/fish-wildlife/,Weakfish
9,FL,Florida,http://myfwc.com/,Largemouth Bass & Atlantic Sailfish
10,GA,Georgia,http://georgiawildlife.com/,Large-mouth Bass
11,HI,Hawaii,http://dlnr.hawaii.gov/dofaw/,Reef Triggerfish
12,ID,Idaho,https://idfg.idaho.gov/,Cutthroat Trout
13,IL,Illinois,http://dnr.illinois.gov/,Bluegill
14,IN,Indiana,https://www.in.gov/dnr/fish-and-wildlife/,River Carpsucker
15,IA,Iowa,http://www.iowadnr.gov/,Channel Catfish
16,KS,Kansas,http://ksoutdoors.com/,Not recognized
17,KY,Kentucky,https://fw.ky.gov/Pages/default.aspx/,Kentucky Spotted Bass
18,LA,Louisiana,http://wlf.louisiana.gov/,White Crappie
19,ME,Maine,https://www.maine.gov/ifw/,Landlocked Atlantic Salmon
20,MD,Maryland,https://dnr.maryland.gov/wildlife/Pages/default.aspx/,Rockfish (striped Bass)
21,MA,Massachusetts,https://www.mass.gov/topics/hunting-fishing/,Cod
22,MI,Michigan,https://www.fws.gov/refuge/Michigan_WMD/,Brook Trout
23,MN,Minnesota,http://www.dnr.state.mn.us/fishwildlife/index.html/,Walleye
24,MO,Missouri,https://huntfish.mdc.mo.gov/fishing/,Channel Catfish & Paddlefish
25,MT,Montana,http://fwp.mt.gov/,Cutthroat Trout
26,NE,Nebraska,https://outdoornebraska.gov/fish/,Channel Catfish
27,NV,Nevada,https://www.fws.gov/nevada/,Lahontan Cutthroat Trout
28,NH,New Hampshire,http://www.wildlife.state.nh.us/,Brook Trout & Striped Bass
29,NJ,New Jersey,http://www.state.nj.us/dep/fgw/,Brook Trout & Striped Bass
30,NM,New Mexico,http://www.wildlife.state.nm.us/,Rio Grande Cutthroat Trout
31,NY,New York,https://dec.ny.gov/regulatory/permits-licenses/,Brook Trout & Striped Bass
32,NC,North Carolina,https://www.ncwildlife.org/Fishing/Fishing-in-North-Carolina/,Channel Bass & Southern Appalachian Brook Trout
33,ND,North Dakota,https://gf.nd.gov/,Northern Pike
34,OH,Ohio,https://www.fws.gov/midwest/Ohio/,Not recognized
35,OK,Oklahoma,https://wildlifedepartment.com/,White Bass
36,OR,Oregon,http://www.dfw.state.or.us/,Chinook Salmon
37,PA,Pennsylvania,https://www.pgc.pa.gov/Wildlife/Pages/default.aspx/,Brook Trout
38,RI,Rhode Island,https://www.dem.ri.gov/programs/fish-wildlife/,Striped Bass
39,SC,South Carolina,https://www.dnr.sc.gov/fishing.html/,Striped Bass
40,SD,South Dakota,http://gfp.sd.gov/,Walleye
41,TN,Tennessee,http://tn.gov/twra/,Largemouth Bass & Channel Catfish
42,TX,Texas,https://tpwd.texas.gov/fishboat/fish/,Guadalupe Bass
43,UT,Utah,https://wildlife.utah.gov/,Bonneville Cutthroat Trout
44,VT,Vermont,http://www.vtfishandwildlife.com/,Brook Trout & Walleye
45,VA,Virginia,http://www.dgif.virginia.gov/,Brook Trout & Striped Bass
46,WA,Washington,http://wdfw.wa.gov/,Steelhead Trout
47,WV,West Virginia,https://www.fws.gov/westvirginiafieldoffice/,West Virginia Golden Brook Trout
48,WI,Wisconsin,http://www.dnr.wi.gov/topic/wildlifehabitat/,Muskellunge
49,WY,Wyoming,https://wgfd.wyo.gov/,Cutthroat Trout
50,MS,Mississippi,http://www.mdwfp.com/,Largemouth Bass

Interpret a css keyframe animation at one specific timepoint between two keyframes / Blend two css keyframes

I want to make a css animation editor tool using css keyframes animations.
The idea is to have a timeline to play and preview a css animation, and settle keyframes on.

The problematic is for the animation preview, i have to interpolate the style of my html element at a specific timepoint between two keyframes. It can be calculated in js for simple value ( such as top position number for example ), but in some scenario it can be tricky to interpolate some css properties in js ( for example border-radius, how to interpolate a value from “50% 20% 10% 10%” to “20% / 10%” ??? )
One idea to solve that is to play and interpret css keyframe animation only at a specific keyframe.
But it seems to be complicated to play only specific range of a css animation. I know there are the animation-range, animation-range-start and animation-range-end css properties, but these properties are still experimental and does not seems to work in my scenario.

So currently i have no idea how to solve that in the best way. The js interpolation way is doable but complex for specific scenario as explained (how to blend a css border radius style value between border-radius: 10% 30% 50% 70%; and border-radius: 10% / 50%; ?), and the css way seems to be not supporting this case.

This is what i tried with css

<head>
    <style>
        @keyframes colorAnim {
            0% {
                color: black;
            }

            50% {
                color: red;
            }

            100% {
                color: green;
            }
        }

        .animated-element-with-offset {
            animation: colorAnim 100ms infinite;
            animation-play-state: paused;
        }
    </style>
</head>

<body>
    <div class="animated-element-with-offset" id="some-element-you-want-to-animate">
        Text Color Animation frame #50: Color expected is red
    </div>

    <button onclick="interpretAndPauseAnimation(50)">Interpret and Pause Animation at 50%</button>

    <script>
        const element = document.getElementById("some-element-you-want-to-animate");
        let start, previousTimeStamp;

        let duration = 100;
        let endDuration = 49;

        let done = false;

        function step(timeStamp) {
            if (start === undefined) {
                start = timeStamp;
            }
            const elapsed = timeStamp - start;

            if (previousTimeStamp !== timeStamp) {
                if (elapsed > duration * (endDuration / 100)) {
                    done = true;
                    element.style.animationPlayState = 'paused';
                } else {
                    element.style.animationPlayState = 'running';
                }
            }

            if (elapsed < duration) {
                // Stop the animation after 2 seconds
                previousTimeStamp = timeStamp;
                if (!done) {
                    window.requestAnimationFrame(step);
                }
            }
        }

        function interpretAndPauseAnimation(keyframePercentage) {
            start = undefined;
            previousTimeStamp = undefined;
            done = false;
            window.requestAnimationFrame(step);
        }

        window.requestAnimationFrame(step);

    </script>
</body>

</html>

Copy event keep formatting

This question is related to this question: Get source of pasted text

How do I keep formatting of copied HTML content in the copy event?
This is what my function looks like now but document?.getSelection()?.toString() removes all formatting.

document.addEventListener('copy', function(e: any) {
  e.clipboardData.setData('text/html', document?.getSelection()?.toString());
  e.preventDefault();
});

browser back button after logout in springboot

when click logout it will redirect to login page but when i click twice browser back button im getting redirected to dashboard . this happen when i click twice only
below is my securityconfig code


@Configuration
@EnableWebSecurity
public class  SecurityConfig{

    private BCryptPasswordEncoder bCryptPasswordEncoder;

    @Bean
    public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception{
        httpSecurity
        .authorizeHttpRequests(auth->{
          auth.requestMatchers("/login").permitAll()
                  .requestMatchers("/errorpage").permitAll()
                  .requestMatchers("/dashboard").permitAll()
                  .requestMatchers("/createadmin").permitAll()
                  .requestMatchers("/employee/**").hasAnyAuthority("Admin","Manager")
                  .requestMatchers("/module/**").hasAnyAuthority("Admin","Manager")
                  .requestMatchers("/user").hasAnyAuthority("Admin","Manager")
                  .requestMatchers("/designation/**").hasAnyAuthority("Admin","Manager")
                  .requestMatchers("/privilege").hasAnyAuthority("Admin")
                  .requestMatchers("/salesdrug").hasAnyAuthority("Admin","Manager")
                  .requestMatchers("/purchasedrug").hasAnyAuthority("Admin","Manager")
                  .requestMatchers("/category").hasAnyAuthority("Admin","Manager")
                  .requestMatchers("/resources/**").permitAll()

                  .anyRequest().authenticated();
        })
          .formLogin(login->{
                  login.loginPage("/login")
                       .defaultSuccessUrl("/dashboard" , true)
                          .failureUrl("/login?error=usernamepassworderror")
                          .usernameParameter("username")
                          .passwordParameter("password");
          })
            .logout(logout->{
                    logout
                            .clearAuthentication(true) // Clear credentials
                            .invalidateHttpSession(true) // Invalidate session
                            .logoutUrl("/logout")
                            .logoutSuccessUrl("/login")
                            .deleteCookies("JSESSIONID");




            })
                .exceptionHandling(exception->{
                    exception.accessDeniedPage("/errorpage");
                })
                .csrf(csrf->{
                    csrf.disable();
                });
        return httpSecurity.build();
    }

    @Bean
    public BCryptPasswordEncoder bCryptPasswordEncoder(){
        bCryptPasswordEncoder=new BCryptPasswordEncoder();
        return bCryptPasswordEncoder;
    }

}

an this is my javascript code to get user confirmation


const logoutconfirm=()=>{
    Swal.fire({
        title: "Are you sure to logout",

        icon: "warning",
        showCancelButton: true,
        confirmButtonColor: "#3085d6",
        cancelButtonColor: "#d33",
        confirmButtonText: "Confirm"
    }).then((result) => {
        if (result.isConfirmed) {
            // window.location.href = "http://localhost:8080/logout";
            const form = document.createElement("form");
            form.method = "POST";
            form.action = "/logout";
            document.body.appendChild(form);
            form.submit();
        }
        else{
            Swal.fire({
                icon: "error",
                title: "Action Aborted"


            });
        }
    });
}


what is the reason for that happening and i coudnt find a solution for this in internet

Import less file styling as a function for React frontend causiing curl command issues in Docker

I am wondering if anyone has had experience with this and can help out.

I have a React app that uses less files for styling, but imports them in the following manner:

import { b() } from 'awesomeStyles.less;`

And then it uses it in a className like so:

<div className={b()}></div>

I have never seen anything like this.

Well, recently I built a Docker image, ran the frontend React project but when I try to curl an endpoint I get an error like this:

react-i18next:: i18n.languages were undefined or empty undefined
TypeError: (0, Page.b) is not a function

I got a similar error elsewhere in the application where it said:

TypeError: (0, Spinner.b) is not a function

I have no idea whats going on and I tried various troubleshooting steps. I ended up ripping out the whole b() import and className usage for Spinner, but now its happening for the Page component and I suspect will keep happening for everywhere in the app that uses that b() as a way to import and use LESS files.

Any ideas how to resolve this?

Can’t resolve addition of 14 precision decimal number in Javascript [duplicate]

I am stuck in a problem while dealing with large precision decimal numbers.
I basically have a number and I want to increase/decrease it by 1e-14 by user’s prompt. But, I am stuck in the below mentioned two problems.

Prob.1

let val  = 1116.44599303135891;
let e = 1; 
let precision = 0;
while (Math.round(val * e) / e !== val) {
    console.log(Math.round(val*e)/e);
    e *= 10;
    precision++;
}
console.log(precision);

Here, I get precision = 12. But, the correct answer should have been 14.

Prob.2

65.85365853658558 + 1e-14 = 65.85365853658560

But, the correct answer should be 65.85365853658559.

I am unable to figure it out as to why this is happening.

I know that the JS uses floating point numbers which are essentially 64 bits numbers. Can someone help me relate this information with the issue I have?

Switching form submission in HTML/Java – Can’t get to work correctly

I’m switching out my forms from Act-On (marketing automation program) to our new provider Salesforce Account Engagement (the old Pardot). I have this custom form code on my site (because it’s formatted to look nice and fit with the style of the page), and I’ve switched out where the form points to, but I cannot figure out what keeps throwing the error. I know this line is a problem because it points to Act-On, but I’m not sure what to replace it with? Any direction or help would be greatly appreciated!

Line that still causes trouble and points to Act-On:
action=”//marketing.activatems.com/acton/forms/userSubmit.jsp” method=”POST” data-validate-blur=””

New Account Engagement form:
https://marketing.activatems.com/l/1051772/2024-01-25/32cy

Full custom form code:

  <div id="aoform-972bcff8-8a57-4e68-93b2-201404027738" style="visibility: visible;"><form id="ao-form-972bcff8-8a57-4e68-93b2-201404027738" class="ao-form " style="font-size: medium; background-image: none; background-repeat: no-repeat; background-size: auto; background-position: center center;" action="//marketing.activatems.com/acton/forms/userSubmit.jsp” method="POST" data-validate-blur="" action="https://marketing.activatems.com/l/1051772/2024-01-25/32cy">
    <div id="row-" class="ao-row" style="padding: 0px;">
    <div id="column-" class="ao-column ao-column-12 tablet-ao-column-1 mobile-ao-column-1" style="padding: 0px;">
    <div class="ao-column-inner" style="background-color: transparent; padding: 0px; border-radius: 0px; border: 0px inherit inherit;">
    <div class="ao-block-wrapper" style="padding-bottom: 0px;">
    <div id="block-b1500593854378" class="ao-richtext-block"></div>
    </div>
    <div class="ao-block-wrapper" style="padding-bottom: 0px;">
    <div id="block-b1500593861435" class="ao-input-block ao-left"><label class="ao-form-label" for="b1500593861435">First Name</label>
    <input id="b1500593861435" class="ao-form-field ao-left" tabindex="1" name="First Name" type="text" value="" placeholder="First Name " data-type="text" data-error-message="" data-validator="" />
    <span class="ao-form-error-message"> </span></div>
    </div>
    <div class="ao-block-wrapper" style="padding-bottom: 0px;">
    <div id="block-b1500593906844" class="ao-input-block ao-left"><label class="ao-form-label" for="b1500593906844">
Last Name
    </label>
    <input id="b1500593906844" class="ao-form-field ao-left" tabindex="2" name="Last Name" type="text" value="" placeholder="Last Name " data-type="text" data-error-message="" data-validator="" />
    <span class="ao-form-error-message"> </span></div>
    </div>
    <div class="ao-block-wrapper" style="padding-bottom: 0px;">
    <div id="block-b1500593933107" class="ao-input-block ao-left"><label class="ao-form-label" for="b1500593933107"><label class="ao-form-label" for="b1500593933107">
Email Address</label></label><input id="b1500593933107" class="ao-form-field ao-left" tabindex="3" name="Email Address" type="text" value="" placeholder="Email Address " data-type="text" data-error-message="email|Invalid email address" data-validator="email" />
    <span class="ao-form-error-message"> </span></div>
    </div>
    <div class="ao-block-wrapper" style="padding-bottom: 0px;">
    <div id="block-b1500593950294" class="ao-textarea-block ao-left"><label class="ao-form-label" for="b1500593950294">
Your Message
    </label>
    <textarea id="b1500593950294" class="ao-form-field ao-left" tabindex="4" name="Message" placeholder="Type your message here! " data-error-message="" data-validator=""></textarea>
    <span class="ao-form-error-message"> </span></div>
    </div>
    <div class="ao-block-wrapper">
    <div id="block-b1500594013372" class="ao-submit-block">
    <div style="text-align: center;"><button class="ao-form-submit width50percent" tabindex="5"        type="submit">Send</button></div>
    </div>
    </div>
    </div>
    </div>
    </div>
    <input name="ao_form_neg_cap" type="hidden" value="" />
    <input id="ao_bot" name="ao_bot" type="hidden" value="nope" />
    <input name="ao_a" type="hidden" value="5855" />
    <input name="ao_f" type="hidden" value="972bcff8-8a57-4e68-93b2-201404027738" />
    <input name="ao_d" type="hidden" value="972bcff8-8a57-4e68-93b2-201404027738:d-0001" />
    <input name="ao_jstzo" type="hidden" value="" />
    <input name="ao_refurl" type="hidden" value="https://www.activatems.com/" />
    <input name="ao_cuid" type="hidden" value="" />
    <input name="ao_srcid" type="hidden" value="" />
    <input name="ao_nc" type="hidden" value="" />
    <input name="ao_pf" type="hidden" value="0" />
    <input name="ao_camp" type="hidden" value="" />
    <input name="ao_campid" type="hidden" value="" />
    <input name="ao_refemail" type="hidden" value="" />
    <input name="ao_iframe" type="hidden" value="" />
    <input name="ao_gatedpage" type="hidden" value="" />
    <input name="ao_gatedasset" type="hidden" value="" />

    </form></div>

How to display wallpaper website home page with infinite scroll of wallpapers without lag

I made a wallpaper website and I want to do an infinite scroll page that displays wallpapers as scroll down. I have done lazy loading and it helps but still it lags because the wallpapers are of very high quality. Is there a way to display the wallpapers on lower quality on that page?

I have done lazy loading and it helps but still it lags because the wallpapers are of very high quality. Is there a way to display the wallpapers on lower quality on that page?

need ruler javascript plugin [closed]

need to make like this image in javascript pure enter image description here

need ruler javascript plugin ………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………….

Receiving inaccurate commit and pull request count from GitHub’s API

I’m currently building a service that retrieves my GitHub profile’s relevant metrics. I’ve successfully managed to get stargazer, watcher and fork count across all my repositories, but I’m struggling to do it for both pull request and commit count.

I am using octokit/[email protected]‘s paginate method to handle pagination.

When retrieving the pull request count:

  private async _getPullRequestsCount() {
    const pullRequests = await this._octokit.paginate(
      this._octokit.search.issuesAndPullRequests,
      {
        q: `author:${this._username} type:pr`,
        per_page: 100,
      }
    );

    return pullRequests.length;
  }

it returns 155.

When fetching the number of commits:

  private async _getCommitsCount() {
    const commits = await this._octokit.paginate(this._octokit.search.commits, {
      q: `author:${this._username}`,
      per_page: 100,
    });

    return commits.length;
  }

it returns 758.

However when using the GitHub website’s search function, I get different results, of 351 PRs and 2k commits:

GitHub website's search result

I’m also using both the throttling and retry plugins for octokit to make sure it’s not unexpectedly hitting any rate limits.

Unbale to pass correct value to api in react frontend

Hi I am facing a problem passing correct value to my api call.
if i were to send query = “were” i am only able to send “e” only the last word I type

This the input tag in which i ought to type search query

                     <input
                        type="text"
                          onChange={(e) => handleInputChange(e)}
                          placeholder="Search..."
                          className="input input-sm input-bordered input-secondary "
                          style={{
                            color: "white",
                            "::placeholder": { color: "white" },
                          }}
                        />

and here is the logic for catching the value and sending an api call

  const [search, setSearch] = useState({});

  function handleInputChange(e) {
    // Get the input value
    const searchValue = e.target.value;
    const val = { _q: searchValue };
    setSearch(val);
  }

  const fetchSuggestions = async (query) => {
    try {
      // Replace this URL with your actual API endpoint for fetching suggestions
      const response = await fetchProductsByFilters(query);
      const data = response.data.products;
    } catch (error) {
      console.error("Error fetching suggestions:", error);
    }
  };

  useEffect(() => {
    fetchSuggestions(search);
    console.log(search);
  }, [search]);

the console.log in the above useEffect hook provide the correct query for e.g – {_q: ‘were’}, Consider my api calling

export function fetchProductsByFilters(
  filter,
  sort,
  pagination,
  admin,
  search
) {
  // filter = {"category":["smartphone","laptops"]}
  // sort = {_sort:"price",_order="desc"}
  // pagination = {_page:1,_limit=10}
  // search = {_q:"searchQuery"}

  let queryString = "";
  for (let key in filter) {
    const categoryValues = filter[key];
    if (categoryValues.length) {
      const lastCategoryValue = categoryValues[categoryValues.length - 1];
      queryString += `${key}=${lastCategoryValue}&`;
    }
  }
  for (let key in search) {
    queryString += `${key}=${search[key]}&`;
  }
  for (let key in sort) {
    queryString += `${key}=${sort[key]}&`;
  }
  for (let key in pagination) {
    queryString += `${key}=${pagination[key]}&`;
  }
  if (admin) {
    queryString += `admin=true`;
  }

  console.log(queryString);

  return new Promise(async (resolve) => {
    //TODO: we will not hard-code server URL here
    console.log(queryString, 2);
    const response = await fetch(
      "http://localhost:8080/products?" + queryString
    );
    const data = await response.json();
    const totalItems = await response.headers.get("X-Total-Count");
    resolve({ data: { products: data, totalItems: +totalItems } });
  });
}

In this the query string from the console.log(queryString) I get is _q=e , only the last letter, I type not the full word. Why is that can you help identify the root cause and modify the code

implement the navigation menu into the webpage

The Complete Code of The Webpage(HTML, CSS, JS)

<!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>SXCB Homepage</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <header>
        <nav>
            <div class="container">
                <a href="https://en.wikipedia.org/wiki/St._Xavier%27s_College,_Burdwan"><img src="./logo.png" class="logo" alt=""></a>
                <div class="hamburger-menu">
                    <div class="bar"></div>
                </div>
            </div>
        </nav>

        <h1 class="big-title translate" data-speed="0.1">St. Xavier's College, Burdwan</h1>
        <img src="./Grass.png" class="grass translate" data-speed="-0.2" alt="">
        <img src="./Building.png" class="building translate" data-speed="0.3" alt="">
        <img src="./Sky.png" class="sky translate" data-speed="0.5" alt="">
    </header>

    <section>
        <div class="shadow"></div>

        <div class="container">
            <div class="content opacity">
                <h3 class="title">
                    About Us
                    <div class="border"></div>
                </h3>
                <p class="text">St. Xavier’s College, Burdwan is an educational endeavour of Jesuits of Calcutta Province of the Society of Jesus. It is a second college of Jesuits of Calcutta beside St. Xavier’s College Kolkata. The College was inaugurated on 11th July 2014 by Bishop Cyperian Monis, in the presence of Rev. Fr. Jeyaraj Veluswamy, S J Provincial superior of Calcutta Jesuits.</p>
            </div>

            <div class="imgContainer opacity">
                <img src="./download.jpg" alt="">
            </div>
        </div>
    </section>
    
    <script src="script.js"></script>
</body>
</html>

Css

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body{
    font-family: 'Poppins', sans-serif;
}

.container{
    max-width: 70rem;
    padding: 1.5rem 2rem;
    margin: 0 auto;
}

header{
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: transparent;
    display: flex;
    backdrop-filter: blur(10px);
}

header:after{
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    background-color: rgba(0, 0, 0, 0.05);
    z-index: 25;
    background: transparent;
    display: flex;
    backdrop-filter: blur(2px);
}

.grass{
    position: absolute;
    bottom: -238px;
    width: 1500px;
    right: 0;
    z-index: 19;
}

.building{
    position: absolute;
    width: 1500px;
    bottom: 10px;
    right: 0;
    z-index: 17;
}

.sky{
    position: absolute;
    width: 1500px;
    bottom: 250px;
    right: -40px;
}

nav{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem 0;
    z-index: 30;
    background: linear-gradient(to bottom, rgba( 0, 0, 0, 0.05), transparent)
    
}

nav .container{
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo{
    position: relative;
    height: 80px;
    width: 80px;
    overflow: hidden;
    transition: all ease 1s;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.795));
}
.logo:hover{
    scale: 1.2;
}

.hamburger-menu{
    width: 1.55rem;
    height: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    filter: drop-shadow(0 2px 30px rgba(0, 0, 0, 0.795));
}

.bar{
    position: relative;
    width: 1.2rem; 
    height: 3px;
    background-color: #fff;
    border-radius: 2px;
}

.bar:before, .bar:after{
    content: '';
    position: absolute;
    width: 1.55rem;
    height: 3px;
    right: 0;
    background-color: #fff;
    border-radius: 2px;
}

.bar:before{
    transform: translateY(-8px);
}

.bar:after{
    transform: translateY(8px);
}

.big-title{
    position: absolute;
    z-index: 30;
    line-height: 4rem;
    top: calc(50% - 2rem);
    width: 100%;
    text-align: center;
    font-size: 3rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 2px 4px 15px rgba(0, 0, 0, 0.76);
}

section{
    width: 100%;
    background-color: #151515;
    position: relative;
}

section .container{
    padding: 3rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

section img{
    width: 100%;
}

section .container > *{
    margin: 2rem;
}

.content{
    color: #fff;
    transform: translateY(-50px);
}

.imgContainer{
    transform: translateY(50px);
}

.title{
    font-weight: 600;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    position: relative;
}

.border{
    position: absolute;
    width: 0%;
    height: 3px;
    background-color: #fff;
    bottom: 0;
    left: 0;
}

.shadow{
    position: absolute;
    bottom: 100%;
    height: 300px;
    width: 100%;
    left: 0;
    z-index: 20;
    background: linear-gradient(to top, #151515, transparent);
}

.opacity{
    opacity: 0;
}

@media (max-width: 850px){
    section .container{
        grid-template-columns: 1fr;
    }
}

@media(max-width: 600px){
    .big-title{
        font-size: 3rem
    }

    .text{
        font-size: .8rem;
    }

    .title{
        font-size: 1.2rem;
    }
}

js

const translate = document.querySelectorAll(".translate");
const big_title = document.querySelector(".big-title");
const header = document.querySelector("header");
const shadow = document.querySelector(".shadow");
const content = document.querySelector(".content");
const section = document.querySelector("section");
const image_container = document.querySelector(".imgContainer");
const opacity = document.querySelectorAll(".opacity");
const border = document.querySelector(".border");

let header_height = header.offsetHeight;
let section_height = section.offsetHeight;

window.addEventListener('scroll', () => {
    let scroll = window.pageYOffset;
    let sectionY = section.getBoundingClientRect();
    
    translate.forEach(element => {
        let speed = element.dataset.speed;
        element.style.transform = `translateY(${scroll * speed}px)`;
    });

    opacity.forEach(element => {
        element.style.opacity = scroll / (sectionY.top + section_height);
    })

    big_title.style.opacity = - scroll / (header_height / 2) + 1;
    shadow.style.height = `${scroll * 0.5 + 300}px`;

    content.style.transform = `translateY(${scroll / (section_height + sectionY.top) * 50 - 50}px)`;
    image_container.style.transform = `translateY(${scroll / (section_height + sectionY.top) * -50 + 50}px)`;

    border.style.width = `${scroll / (sectionY.top + section_height) * 30}%`;
})


The Complete Code of the full screen overlay responsive navigation menu(html, css)

<!DOCTYPE html>
<html lang="en" class="no-js">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <title>Fullscreen Overlay Responsive Navigation Menu Using GSAP</title>
        <link rel="stylesheet" type="text/css" href="styles.css" />
        <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/TweenMax.min.js"></script>
    </head>

    <body>
        <div class="menu-open">menu</div>
        <div class="nav-container">
            <div class="menu-close">close</div>
            <div class="socials">
                <span>facebook</span>
                <span>instagram</span>
            </div>
            <nav class="menu">
                <div class="menu__item">
                    <a class="menu__item-link">Home</a>
                    <img class="menu__item-img" src="menu-img-one.jpg" />
                    <div class="marquee">
                        <div class="marquee__inner">
                            <span>Home - Home - Home - Home - Home - Home - Home</span>
                        </div>
                    </div>
                </div>
                <div class="menu__item">
                    <a class="menu__item-link">Showcase</a>
                    <img class="menu__item-img" src="menu-img-two.jpg" />
                    <div class="marquee">
                        <div class="marquee__inner">
                            <span
                                >Showcase - Showcase - Showcase - Showcase - Showcase - Showcase
                                - Showcase</span
                            >
                        </div>
                    </div>
                </div>
                <div class="menu__item">
                    <a class="menu__item-link">About</a>
                    <img class="menu__item-img" src="menu-img-three.jpg" />
                    <div class="marquee">
                        <div class="marquee__inner">
                            <span>About - About - About - About - About - About - About</span>
                        </div>
                    </div>
                </div>
                <div class="menu__item">
                    <a class="menu__item-link">Contact</a>
                    <img class="menu__item-img" src="menu-img-four.jpg" />
                    <div class="marquee">
                        <div class="marquee__inner">
                            <span
                                >Contact - Contact - Contact - Contact - Contact - Contact -
                                Contact</span
                            >
                        </div>
                    </div>
                </div>
            </nav>
        </div>
        <script>
            var t1 = new TimelineMax({ paused: true });

            t1.to(".nav-container", 1, {
                left: 0,
                ease: Expo.easeInOut,
            });

            t1.staggerFrom(
                ".menu > div",
                0.8,
                { y: 100, opacity: 0, ease: Expo.easeOut },
                "0.1",
                "-=0.4"
            );

            t1.staggerFrom(
                ".socials",
                0.8,
                { y: 100, opacity: 0, ease: Expo.easeOut },
                "0.4",
                "-=0.6"
            );

            t1.reverse();
            $(document).on("click", ".menu-open", function () {
                t1.reversed(!t1.reversed());
            });
            $(document).on("click", ".menu-close", function () {
                t1.reversed(!t1.reversed());
            });
        </script>
    </body>
</html>

css

* {
    font-family: "Neue Montreal";
    font-weight: 400;
}

body {
    margin: 0;
    background: #161616;
}

.menu-open {
    color: #fff;
}

.menu-open,
.menu-close {
    position: absolute;
    top: 0;
    right: 0;
    padding: 40px;
    font-size: 20px;
    cursor: pointer;
}

.socials {
    position: absolute;
    bottom: 0;
    left: 0;
    margin: 40px 100px;
}

.socials span {
    text-transform: uppercase;
    margin: 0 20px;
    letter-spacing: 0px;
}

.nav-container {
    position: fixed;
    left: -100%;
    width: 100%;
    height: 100vh;
    background: #fff;
}

.menu__item {
    position: relative;
    padding: 0 6vw;
}

.menu__item-link {
    display: inline-block;
    cursor: pointer;
    position: relative;
    transition: opacity 0.4s;
}

.menu__item-link::before {
    all: initial;
    counter-increment: menu;
    position: absolute;
    bottom: 60%;
    left: 0;
    pointer-events: none;
}

.menu__item-link:hover {
    transition-duration: 0.1s;
    opacity: 0;
}

.menu__item-img {
    z-index: 2;
    pointer-events: none;
    position: absolute;
    height: 12vh;
    max-height: 600px;
    opacity: 0;
    left: 8%;
    top: 10%;
    transform: scale(0);
}

.menu__item-link:hover + .menu__item-img {
    opacity: 1;
    transform: scale(1);
    transition: all 0.4s;
}

.menu {
    padding: 10vh 0 25vh;
    --offset: 20vw;
    --move-initial: calc(-25% + var(--offset));
    --move-final: calc(-50% + var(--offset));
    font-size: 7vw;
}

.marquee {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    color: rgb(214, 214, 214);
    pointer-events: none;
}

.marquee__inner {
    width: fit-content;
    display: flex;
    position: relative;
    opacity: 0;
    transition: all 0.1s;
    transform: translateX(60px);
}

.menu__item-link:hover ~ .marquee .marquee__inner {
    opacity: 1;
    transform: translateX(0px);
    transition-duration: 0.4s;
}

.menu__item-link,
.marquee span {
    white-space: nowrap;
    font-size: 7vw;
    padding: 0 1vw;
    line-height: 1.15;
}

.marquee span {
    font-style: italic;
}

I want to implement the navigation menu program into the hamburger menu. I tried several ways but it’s not givig the desired output. The menu bar isn’t even fuctioning. Please help me with this, I’m trying to solve this problem for last 3 days.