may i get complete website code for my BCA department? [closed]

need for website with HOME,COURSES,EVENTS,CONTACT,FACULTY,ABOUT

A RESPONSIVE WEBSITE FOR MY TASK COMPLETON IN COLLEGE Certainly! Here’s a description you can use for your Stack Overflow post:


Title: Responsive Website Development for College Task – HTML, CSS, JavaScript

Description:

Hello Stack Overflow community,

I am currently working on a college task that involves developing a responsive website, and I would greatly appreciate your insights and assistance. The project aims to showcase my skills in web development using fundamental technologies such as HTML, CSS, and JavaScript.

Project Structure:

  • The project is organized into a clean folder structure with separate directories for HTML, CSS, JavaScript, and images.
  • The main HTML file (index.html) includes sections for the header, navigation, main content, and footer, providing a structured layout.

Technologies Used:

  • HTML: The backbone of the website’s structure and content.
  • CSS: Styles are organized in an external stylesheet (styles/style.css), ensuring a clean separation of concerns and easy maintenance.
  • JavaScript: The script.js file is included for potential interactive features or dynamic content.

Responsive Design:

  • The website is designed to be responsive, adapting seamlessly to various screen sizes and devices. This is achieved through a combination of flexible layouts and media queries in the CSS.

Customization:

  • Users can easily customize the content in index.html, modify styles in styles/style.css to match their design preferences, and add interactive features using JavaScript in scripts/script.js.

Testing and Deployment:

  • Local testing is recommended by opening the index.html file in a web browser. It is essential to ensure the website looks good on different devices by resizing the browser window.
  • Once satisfied, users can deploy the website to their preferred web hosting service.

I welcome any feedback, suggestions, or improvements you may have regarding the project structure, code organization, or any additional features that could enhance the overall functionality and aesthetics of the website.

Thank you in advance for your valuable input!


Feel free to adjust the description based on any specific details or features of your project that you’d like to highlight.

Why is my CodeHS setTimeout function running inconsistently?

I am trying to play this looping audio file at a certain time within my code on the CodeHS coding platform in javascript:

setTimeout(() => {
        println("Tails");
        var TAILS = new Audio("link");
        TAILS.play();
        TAILS.loop = true;
        println("Tails 2");
    }, delay);

link and delay are placeholders.

I have been running tests and found that this code works correctly 100% of the time with 4900 ms of delay and lower, but becomes inconsistent greater than that, with 10000 ms never running and 5000 ms working around 1 in 4 times. However, “tails” and “tails 2” both print when the delay is finished every time, no matter the delay. Why is this?

This was originally called as part of a local function mainWait() that did some of the calculations for me, but removing this code from that function didn’t fix the issue. I also tried extracting the code inside the first parameter of setTimeout() from a function tailsStart(), but that also didn’t work.

How to hide a section of a form and make appear when clicked something like load more in a php form?

I have a php form about 100 input fields.
Initially a visitor needs to fill the 1st 10 fields.
Only if he needs, he should full 11 to 30. And then 31 to 60 and so on.

What i need to do is
Show the form with 1st 10 Inputs and the Submit Button.
And hide the 2nd part and 3rd part … in the same form.
If he needs the 2nd part, click on the “load more” just above the submit button and load the 2nd part in the same page. And so on. (Click to appear)

Is there a way to do that in a php form like that?

<form method="post" action="form.php">

Name1: <input type="text" name="name1">
Name2: <input type="text" name="name2">
Name3: <input type="text" name="name3">

----- Load more1 start-----
Name4: <input type="text" name="name4">
Name5: <input type="text" name="name5">
Name6: <input type="text" name="name6">
----- Load more1 end-----

----- Load more2 start-----
Name7: <input type="text" name="name7">
Name8: <input type="text" name="name8">
Name9: <input type="text" name="name9">
Name10: <input type="text" name="name10">
----- Load more2 end-----

<input type="submit" name="submit" value="Submit">

Swimming across the river [closed]

I’m trying to figure out this problem below, I don’t really need an algorithm on how to do it, but I’m struggling to understand on how to get the answer, may someone explain to me what I have to do?

Swimming across the river

The river route is represented by the n*m ​​matrix.

The river starts at the point (0, 0) and has a natural tendency to flow
down and to the right.

There are some obstacles on the river route. Empty cells are represented by ‘.’ It is
the obstacle is represented by ‘#’.

You are swimming in the river.
Moving in the direction of the river flow, i.e. towards the
right or down, there is no need to waste energy. However, when moving against the flow of the river, i.e. towards the
left or up, 1 unit of energy is required.

The goal is to currently be at the given starting coordinates and reach the ending coordinates with the minimum expense
of energy possible.

It is guaranteed that there are no obstacles in the initial and final coordinates.

Determine the minimum possible energy required to reach the destination or determine if it is impossible to reach the destination
destiny.

Return -1 if it is impossible to reach the destination.

Consider, for example, n = 4, m = 5, and the river is portrayed by:

.....
...#.
..#.#
.....

Also, start coordinates = (2, 3), end coordinates = (1,4) (0-based indexing)

From point (2, 3), go down one unit, that is, to point (3, 3), consuming 0 units of energy.

Then, move 2 units to the left, that is, to the point (3, 1), consuming 2 units of energy.

Then, move 3 units upwards, that is, to the point (0, 1), consuming 3 units of energy.

Then, move 3 units to the right, that is, to the point (0, 4), consuming 0 units of energy.

Then, move 1 unit down, that is, to the point (1,4, 1), consuming 0 units of energy.
Thus, 5 units of energy will be used in total.

It can be shown that the answer cannot be less than 5. Therefore, the answer is 5.

Function Description

Complete the minimumEnergy function in the editor below. The function must return an integer representing the
Minimum energy required.

The minimumEnergy function has the following parameters:
river: an array of strings of length n and each string having a length m, representing the path of the river.

initial_x: an integer, representing the initial x coordinate.

intitial_y: an integer, representing the initial y coordinate.

final_x: an integer, representing the final x coordinate.

final_y: an integer, representing the final y coordinate.

Limitations
• 1 ≤ n ≤ 1500
• 1 ≤ m ≤ 1500
• 0 ≤ initial_x, final_x ≤ n
• 0 ≤ initial_y, final_y ≤ m

▼ Custom Test Input Format

The first line contains an integer, n, which denotes the number of lines on river.

Each line i of the subsequent lines n (where 0 <i<n) contains a string (of length m) describing river[i].

The next line contains an integer, initial_x, which denotes the initial x coordinate.

The next line contains an integer, initial_y, which denotes the initial y-coordinate.

The next line contains an integer, final_x, which denotes the final x coordinate.

The last line contains an integer, final_y, which denotes the final y coordinate.

Finding the correct positions for nodes when dragging an SVG element after zooming/panning in javascript

I am making a script that plots directed graphs using SVG from some input that is of the form

let data = {
  'A': {
    'children': ['B', 'C'],
    'parents': [],
    'coords': {
      'x': 10,
      'y': 10
    }
  },
  'B': {
    'children': ['C'],
    'parents': ['A'],
    'coords': {
      'x': 30,
      'y': 10
    }
  },
  'C': {
    'children': [],
    'parents': ['A', 'B'],
    'coords': {
      'x': 20,
      'y': 20
    }
  }
}

It creates paths between parent and child nodes by using a cubic bezier curve. The idea is to be able to construct a visualization for the graph based on the ‘coords’ properties of each node, then allowing the user to move the nodes around in real time by dragging and dropping them.

I got this implemented just fine until I added in the ability to pan and zoom. Now, if the image is panned and or zoomed, when I go to update the positions of elements to the cursor position they get put in the wrong location. Here are my dragging functions that I currently have to update positions

function startDrag(evt) {
    if (evt.target.classList.contains('draggable')) {
      selectedElement = evt.target;

      // we need to store the IDs of paths connecting to the nodes so that we can update their positions accordingly
      // Their IDs are stored as `${parent_key}_to_${child_key}`, e.g., #A_to_I
      path_ids = [];
      let node_key = selectedElement.getAttributeNS(null, 'id');
      for (let child_key of data[node_key]['children']) {
        path_ids.push(`${node_key}_to_${child_key}`);
      }
      for (let parent_key of data[node_key]['parents']) {
        path_ids.push(`${parent_key}_to_${node_key}`);
      }
    }
  }
  
  function drag(evt) {
    if (selectedElement) {
      evt.preventDefault();
      
      // we need zoom/pan information to reposition dragged nodes correctly
      ///////////////////////////////////////////////////
      // Potentially use some of this data to calculate correct positions ???
      let matrix = document.getElementById('scene').getAttributeNS(null, 'transform');
      let m = matrix.slice(7, matrix.length-1).split(' ');
      let zoomFactor = m[0];
      let panX = m[4];
      let panY = m[5];

      let svgBBox = svg.getBBox();
      ///////////////////////////////////////////////////

      // move the node itself
      selectedElement.setAttributeNS(null, 'cx', evt.clientX);
      selectedElement.setAttributeNS(null, 'cy', evt.clientY);
      
      // now for each path connected to the node, we need to update either the first vertex of the cubic bezier curve, or the final vertex
      // if id is ${clicked_node}_to_${other} then we change the first point, if it is ${other}_to_${clicked_node} then the last node
      let clicked_node = selectedElement.getAttributeNS(null, 'id');
      for (let path_id of path_ids) {
        let path = document.getElementById(path_id);
        let bez_d = path.getAttributeNS(null, 'd');
        let bez_split = bez_d.split(' ');
        if (path_id[0] === clicked_node) {
          let new_d = `M ${evt.clientX} ${evt.clientY} C ${evt.clientX},${evt.clientY}`;
          new_d += ` ${bez_split[5]} ${bez_split[6]}`;
          path.setAttributeNS(null, 'd', new_d);
        } else if (path_id[path_id.length - 1] === clicked_node) {
          let new_d = `M ${bez_split[1]} ${bez_split[2]} C ${bez_split[4]} ${bez_split[5]}`;
          new_d += ` ${evt.clientX},${evt.clientY}`;
          path.setAttributeNS(null, 'd', new_d);
        }
      }
    }
  }
  
  function endDrag(evt) {
    selectedElement = null;
    path_ids = [];
  }

As you can see in the drag() function, I am able to grab bbox data from the svg itself after panning/zooming, and I am able to get the transform matrix for the <g> element that houses all of my draggable nodes. I assume that the correct positions could be calculated with this information, but I am at a loss as to how.

See https://jsfiddle.net/quamjxg7/ for the full code.

Plainly put: How do I account for panning and zooming when updating the positions of draggable SVG elements?

How do I type an array of CallableFunction’s that might be async?

I have this code:

export const provide = async (callables: CallableFunction[]) => {
    for (const callable of callables) {
        await callable()
    }
}

A callable may or may not be async.

I’ve tried typing it like this:

export const provide = async (callables: CallableFunction[] | Promise<CallableFunction>[]) => {
    for (const callable of callables) {
        await callable()
    }
}

But vscode gives me the error:

This expression is not callable.
No constituent of type ‘CallableFunction | Promise’ is callable.

How do I type an array of CallableFunction’s that may or may not be async?

Exception: Unexpected error while getting the method or property batchUpdate on object Apiary.sheets.spreadsheets.values. Using SheetsAPI

I’ve been using this code for months now and I never have any issues with it. I haven’t even touched or edited my code.

I am using the Sheets API

Now all of a sudden I’ve been getting this error.enter image description here

Here is my code

function dateChanger() {

      var a1Notations = ['G5:G27', 'AC5:AC27', 'AR5:AR27', 'BG5:BG27']; 

      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var sheetName = ss.getActiveSheet().getName();
      var ssId = ss.getId();
      var ranges = a1Notations.map(e => `'${sheetName}'!${e}`);
      var { valueRanges } = Sheets.Spreadsheets.Values.batchGet(ssId, { ranges, valueRenderOption: "UNFORMATTED_VALUE" });
      var data = valueRanges.map(({ values }, i) => {
      var values = values.map(([v]) => {
        var unixTime = (v - 25569) * 86400 * 1000; // Ref: https://stackoverflow.com/a/6154953
        var temp = new Date(unixTime);
        temp = new Date(unixTime + (temp.getTimezoneOffset() * 60 * 1000)); // Added
        temp.setMonth(temp.getMonth() + 1);
        var serialNumber = ((temp.getTime() - (temp.getTimezoneOffset() * 60 * 1000)) / 1000 / 86400) + 25569; // Modified Ref: https://stackoverflow.com/a/6154953
        return [serialNumber];
      });
      return { range: ranges[i], values };
    });
      Sheets.Spreadsheets.Values.batchUpdate({ data, "valueInputOption": "USER_ENTERED" }, ssId);
    }

How can I override a css variable by code?

How can I override a css variable from dev console (or injected script of extension)

For example for google.com search page lets say I want to change rhs-width variable.

I can clearly see it defined like this:

.srp {
    --rhs-width: 372px;
}

My attempts so far:

var r = document.querySelector(':root');
var rs = getComputedStyle(r);
rs.getPropertyValue('--rhs-width')

rs don’t seen to have it.

I tried var r = document.querySelector('.srp'); as well but result is same.

Rails 7.1.2 + StimulusJS: Issue with Stimulus controller action after triggering a custom event on window

I am working on a Rails 7.1.2 application with Ruby 3.2.2 and facing an intermittent problem with Google Maps loading. The map sometimes loads in Firefox, but rarely in Brave. There seems to be an issue with a Stimulus controller action not consistently firing, although the event listener for the action seems to execute.

First, following some outdated guides, I started adding this script to my app/javascript/application.js

window.dispatchMapsEvent = function(...args) {
  const event = new CustomEvent("google-maps-callback", { detail: args });
  window.dispatchEvent(event);
}

window.addEventListener("google-maps-callback", function(event) {
  console.log("Google Maps API loaded");
})

and this to the head of my app/views/layouts/application.html.erb:

<%= javascript_include_tag "https://maps.googleapis.com/maps/api/js?key=#{Rails.application.credentials.google.api_key}&libraries=places&callback=dispatchMapsEvent",
                            defer: true,
                            async: true,
                            "data-turbolinks-eval": false
%>

Within this code, I got this error in my browser console:

Uncaught (in promise) InvalidValueError: dispatchMapsEvent is not a function

Although most of the guides I followed suggested this should work, I assumed the error was because the dispatchMapsEvent function was not yet loaded by the time the callback was executed, which is why I pulled the code out of the application.js and passed it to a script within the layout:

<script>
  window.dispatchMapsEvent = function(...args) {
    const event = new CustomEvent("google-maps-callback", { detail: args });
    window.dispatchEvent(event);
  }

  window.addEventListener("google-maps-callback", function(event) {
    console.log("Google Maps API loaded");
  })
</script>

<%= javascript_include_tag "https://maps.googleapis.com/maps/api/js?key=#{Rails.application.credentials.google.api_key}&libraries=places&callback=dispatchMapsEvent",
                            defer: true,
                            async: true,
                            "data-turbolinks-eval": false
%>

This seemed to fix the mentioned error, as the console.log ran correctly.

Secondly, I have configured a StimulusJS controller as follows:

views/folder/_some_partial.html.erb

<div  
    class="form-group"
    data-controller="localizators"
    data-action="google-maps-callback@window->localizators#initMap"
    data-localizators-current-location-value="<%= current_location %>"
  >

and then a
app/javascript/controllers/localizators_controller.js:

import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  connect() {
    console.log('localizators controller connected');
  }

  initMap() {
    console.log('map init');
  }
}

The message ‘localizators controller connected appears always’, but the ‘map init’ never in Brave Browser, and sometimes in Firefox (I don’t know how the browser is realted)

Just to give further information, I’m in my development environment, and is the same if I use bin/dev or rails s.

As you can see, there are two problems that I don’t know if they are related.

The code I had to put as a JS script since with the recommended configuration it didn’t seem to be loading and the Stimulus controller action was firing only sometimes, even though the event in @window seemed to be firing every time.

Thank you very much in advance for any help you can give me.

onSucess returns undefined for metadata param when inside Vue view but not inside component

I have a vue component that is for Plaid Link that calls a function/action in my Vuex store named onSuccess that should call my backend API to exchange the public token for an access token and send some data about the link to the backend. However it seems like the metadata param is coming back as undefined when console.log() inside my Vuex store but if I do it inside the component itself I have no issues.

Vuex code

onSuccess({ commit }, public_token, metadata) {
        console.log(public_token, metadata)
        commit('SET_PUBLIC_TOKEN', public_token);
        return new Promise((resolve, reject) => {
            Vue.axios.post('/plaid/exchange_public_token', {
                public_token,
            })
            .then(() => {
                resolve();
            })
            .catch((error) => {
                reject(error);
            });
        })
    },

Code inside my view script section

computed: {
            ...mapState({
                plaid: state => state.plaid
            })
        }, 
        
        methods: {
            ...mapActions({
                onLoad: 'onLoad',
                onExit: 'onExit',
                onEvent: 'onEvent',
                onSuccess: 'onSuccess',
            }),
            
        },

        mounted() {
            this.onLoad();
        },

Code inside my view template section

 <PlaidLink
                clientName="Plaid App"
                env="sandbox"
                :link_token="plaid.link_token"
                :products="['auth','transactions']"
                :onLoad='onLoad'
                :onSuccess='onSuccess'
                :onExit='onExit'
                :onEvent='onEvent'
                >

Code inside my component that is for plaid.create with other helper functions removed

this.linkHandler = this.plaid.create({
            clientName: this.clientName,
            env: this.env,
            isWebview: this.isWebview,
            key: this.public_key,
            product: this.products,
            receivedRedirectUri: this.receivedRedirectUri,
            token: this.link_token,
            webhook: this.webhook,
            onLoad: function() {
              // Optional, called when Link loads
              self.onLoad()
            },
            onSuccess: function(public_token, metadata) {
              // Send the public_token to your app server.
              // The metadata object contains info about the institution the
              // user selected and the account ID or IDs, if the
              // Select Account view is enabled.
              /* eslint-disable no-console */
              console.log(metadata)
              self.onSuccess(public_token, metadata)
            },
            onExit: function(err, metadata) {
              // Storing this information can be helpful for support.
              self.onExit(err, metadata)
            },
            onEvent: function(eventName, metadata) {
              self.onEvent(eventName, metadata)
            }
          });

express authentication cookie fields are undefined in getauth method

I have react client working on 3000 and express on 5000 when logging in, cookie fields are set with no problem but when trying to get isauth it shows as undefined.

//login log message of cookie

login successful
session isAuth set to true
Session {
cookie: {
path: ‘/’,
_expires: 2024-01-21T04:01:13.874Z,
originalMaxAge: 7200000,
httpOnly: true,
secure: false
},
isAuth: true,
username: {
_id: new ObjectId(’65ac7ae2bfdff2c762de42b8′),
username: ‘asd’,
password: ‘$2a$12$1SJgC2sxqQosb.bI5PH4QO7Jrv9uFKulhGeAON89rjt08tqbxyjG.’,
__v: 0
}
}

// isauth request

checking if user is authenticated
Session {
cookie: {
path: ‘/’,
_expires: 2024-01-21T04:01:17.393Z,
originalMaxAge: 7200000,
httpOnly: true,
secure: false
}
}

source code:

//app.js

import logo from './logo.svg';
import './App.css';
import { BrowserRouter, Routes, Route } from "react-router-dom";
import Login from './pages/Login';
import Home from './pages/Home';
import Register from './pages/Register';
import Dashboard from './pages/Dashboard';
import { useState,useEffect } from "react";
import { Navigate } from "react-router";
function App() {

  const [isauth, setIsauth] = useState(false);
  useEffect(() => {
      
    const getAuth = async () => {
      try {
          const response = await fetch('http://localhost:5000/isauth', {
              method: 'GET',
              withCredentials: true,
              credentials: 'include',
          });
  
          console.log(response);  
        
          const parseRes = await response.json();
          console.log(parseRes);
          parseRes === true ? setIsauth(true) : setIsauth(false);
      } catch (err) {
          console.error(err.message);
      }
  };
      getAuth();
  }, []);


  return (
    <BrowserRouter>
      <Routes>
        <Route path='/Login' element={<Login />} />
        <Route path='/Home' element={<Home />} />
        <Route path='/Register' element={<Register />} />
        <Route
            path="/Dashboard"
            element={isauth ? <Dashboard isauth={isauth} /> : <Navigate to="/Login" />}
          />
      </Routes>
    </BrowserRouter>
  );
}

export default App;

//server.js


const express = require('express');
const app = express();
const port = 5000;
const mongoose = require('mongoose');
const cors = require('cors');
const session = require('express-session');
const passport = require('passport');
const MongoDBStore = require('connect-mongodb-session')(session);
const MongoDBSession = require('connect-mongodb-session')(session);
const UserModel = require('./models/User');
const mongoURI = "mongodb+srv://@cluster0.ql90ztk.mongodb.net/?retryWrites=true&w=majority";
const bcrypt = require('bcryptjs');

mongoose.connect(mongoURI, {

  })
    .then(() => console.log("Connected to db"))
    .catch((err) => console.error("Error connecting to database:", err));
  
const store = new MongoDBSession({
    uri: mongoURI,
    collection: 'mySessions',
    });

app.use(
    session({
        secret: 'secret',
        resave: false,
        saveUninitialized: false,
        store: store,
        cookie: {
            maxAge: 1000 * 60 * 60 * 2,
            secure: false,
            httpOnly: true,
        },
    })
);
app.use(express.json());
app.use(cors({
  origin: 'http://localhost:3000',
  credentials: true,
  methods: 'GET, POST, PUT, DELETE' ,
  allowedHeaders: 'Content-Type, Authorization',
}));

app.set("view engine", "ejs");
app.use(express.urlencoded({ extended: true }));
app.use(passport.initialize());
app.use(passport.session());

app.post("/login", async (req, res) => {
    console.log("attempting to login");
    const { username, password } = req.body;

    const user = await UserModel.findOne({ username });
    console.log(user);
    if (!user) {
        console.log("user not found");
        return res.status(401).json({ message: "User not found" });
    }

    const isMatch = await bcrypt.compare(password, user.password);
    if (!isMatch) {
        console.log("incorrect password");
        return res.status(401).json({ message: "Incorrect password" });
    }

    req.session.isAuth = true;
    req.session.username = user;
    console.log("login successful");
    console.log("session isAuth set to true");
    console.log(req.session);

    res.json({ message: "Login successful" });
});

app.get("/isauth", (req, res) => {
    console.log("Request Headers:", req.headers);
    console.log("checking if user is authenticated");
    console.log(req.session);
    console.log(req.session.isAuth);
    if (req.session.isAuth) {
        res.send(true);
    } else {
        res.send(false);
    }
});

app.listen(port, () => {
    console.log(`Server started on port ${port}`);
});

I have been stuck here for some time now, what am I missing?

I have react client working on 3000 and express on 5000 when logging in, cookie fields are set with no problem but when trying to get isauth it shows as undefined.

How to emulate browser console data on a webpage using stack snippet console?

I am trying to emulate a browser console inside a web page. I tried using StackOverflow’s own stack snippet console but struggled to make it work.

Here’s the link to StackOverflow code:
https://github.com/gh-canon/stack-snippet-console

The closest example I could find was this:
Display browser console in HTML page

However, the above still does not help. I am looking for a basic example, something like:

HTML:

<script src="https://gh-canon.github.io/stack-snippet-console/console.min.js"></script>
<button id="btn-run">Run</button>
<div id="console-panel"><div> <!-- The console content should render here --> 

JavaScript:

document.getElementById("btn-run").addEventListener("click", runConsole);

function runConsole() {
   // process here
}

Any help?

Iframes loading error, remote puppeter cdp

I have a very strange error.

I sent a code below, I will explain what is happening, I am trying to load a Cloudflare iframe for captcha, it is not possible to use puppeteer stealth because they detect it, it is not possible to customize user-agents, so what did I choose to do , open an instance of chromium and make puppeteer connect to it, but we have a detail, when I make the connections the iframe is no longer detectable, it simply doesn’t detect it for some reason, but something curious that I discovered, when I open the Dev Tools seems to work, but remember, in normal puppteer it goes without me opening Dev Tools but it doesn’t authenticate because it is considered a Bot, so my question is, why only when I open Dev Tools does it detect the iFrame? Is there an error in the library for this to occur?

NOTE: I tried the flag that automatically opens Dev Tools but Cloudflare detects this too.

var chromeLauncher = await import('chrome-launcher');
    var chromePath = chromium.path;
    const chromeFlags = ['--no-sandbox', '--disable-web-security'];

    var chrome = await chromeLauncher.launch({
        chromePath,
        chromeFlags
    });


    var cdpSession = await CDP({port: chrome.port});

    const {Network, Page, Runtime} = cdpSession;

    await Runtime.enable();
    await Network.enable();
    await Page.enable();
    await Network.setCacheDisabled({ cacheDisabled: true });

    var data = await axios.get('http://127.0.0.1:' + chrome.port + '/json/version').then(response => {
        response = response.data
        console.log(response.webSocketDebuggerUrl);
        return {
            browserWSEndpoint: response.webSocketDebuggerUrl,
            agent: response['User-Agent']
        }
    }).catch(err => {
        throw new Error(err.message)
    })

    const browser = await puppeteer.connect({
        targetFilter: (target) => !!target.url(),
        browserWSEndpoint: data.browserWSEndpoint,
    });
    const pages = await browser.pages();
    const page = pages[0];
    await page.setUserAgent(data.agent);
    await page.setViewport({
        width: 1920,
        height: 1080,
    });

I tried using stealth, I tried using the default puppeter, I tried using other stealths, I tried letting Dev Tools open automatically in the tabs, but Cloudflare detects this.

How to get value of checkbox true or false on java script submit function?

I work on asp.net MVC web application my issue can’t get value of checkbox on submit function java script .

if I select checkbox Yes then value true on submit function .

if I select checkbox No then value false on submit function .

if i not select Yes or No then value will be false

I call java script submit function when click on button approve to submit value of checkbox .

my code

     <td style="width: 50%; font-weight: bold; padding-top: 10px;">
     @Html.Label("Did you try to retain the staff?", htmlAttributes: new { @class = "control-label col-md-5" })
     <div class="col-md-7">
         <input type="checkbox" id="RetainStuffTrue" name="RetainStuff" value="true" class="retaindtuff-checkbox" @(Model.RetainStuff == true ? "checked" : "") />
         Yes
         &nbsp;&nbsp;
         <input type="checkbox" id="RetainStuffFalse" name="RetainStuff" value="false" class="retaindtuff-checkbox" @(Model.RetainStuff == false ? "checked" : "") />
         No
     </div>
 </td>
  <a id="approveControlsId" onclick="submit();" class="btn btn-primary" style="min-width: 100px;margin-top:5px;"><i class="glyphicon glyphicon-ok"></i> Approve </a>

public class ResignationRequester
{
public bool? RetainStuff {get;set;}
}

so in jQuery what I write here to get value checked or selected

$('.retaindtuff-checkbox').on('change', function () {
    // what I write here 
});

And on submit function java script how to get value of checkbox if yes then true or No then
false

function submit() {
    var ResignationRequester = new Object();
   ResignationRequester.RetainStuff =????
  // how to pass value of retainstuff here 
}

Updated post

I must select checkbox Yes or No

but not accept to make both checked

if i leave yes or no without checked then RetainStuff will be null

Must be Yes or No checked