Swiper – Ionic -Angular: When scrolling from last slide and then to the first one index is not reseting

Im using swiper to create a sliding array of number when user can scroll to select his weight. Swiper has [loop]="true" My problem is that once user has reached the limit in my case slider 7 and move to slider 1 the index does not restart to index 0 also if i scroll backwards from slide 1 to 7 i do not have the index updated in my case equal to 6. To have the correct index is very important bacause based on it i update the selected value.

How can I achieve the following goal/intention?

Here is my actual code :

Here is my component.html

<ion-row>
    <ion-col size="10">
      <swiper-container
        #slides
        [options]="sliderOptionsOpts"
        [modules]="swiperModules"
        (swiperslidechange)="checkRangeSlide($event)"
        [loop]="true"
        style="height: 200px"
      >
        <swiper-slide *ngFor="let option of sliderOptions">
          <span
            [ngClass]="option === sliderSelected ? 'fw-bold' : 'text-muted'"
            class="fs-1"
            >{{ option }}</span
          >
        </swiper-slide>
      </swiper-container>
    </ion-col>

Here is my component.ts

sliderOptions: number[] = [];
  sliderOptionsOpts: any;
  sliderSelected: number = 1;

  checkMinMaxRange(max: number, min: number) {
    console.log("max min", max, min);
    const dataArray = this.createArrayFromRange(1, 7);
    this.sliderOptions = dataArray;
    this.sliderOptionsOpts = {
      slidesPerView: 1,
      centeredSlides: true,
      reverseDirection: true,
      initialSlide: this.sliderOptions.indexOf(this.sliderSelected),
      loop: true,
    };
  }

  createArrayFromRange(min: number, max: number): number[] {
    const length = max - min + 1;
    return Array.from({ length }, (_, index) => index + min);
  }

  checkRangeSlide(event: any) {
    let activeIndex = event.detail[0].realIndex;
    const selectedValue = this.sliderOptions[activeIndex];
    const answerObject = {
      selectedValue: selectedValue + 1,
      activeIndex: activeIndex,
      object: event.detail[0],
    };
    console.log("ANSWER:", answerObject);
  }

Is there a way to “hide” a sprite/button so it doesn’t work at certain times?

I am working on a school project. It is a dress-up game where the user dresses up “Lucy” in three outfits. Everything works great until the dates (actual dates “Lucy” is going on).

The dates are just pictures I found on Pinterest. After each date, she would need to go back to her room to change again. However, each sprite background is just a layer and I draw layers on top of the previous one every time the user switches to a new screen.

It is really hard to explain, but every time I click on a button, another button at the same place gets clicked too. Although the second button can’t be seen, it still calls that function and works. I used code.org for this project since I couldn’t find any other website to code that has an easy-to-navigate interface.

Here you can see live preview

World.frameRate = 60;

function date1() {
  if (mousePressedOver(startingbutton)) {
    instruction.visible = true;
    instructionbutton.visible = true;
    instructionbutton3.depth = 14;
  }
  
  if (mousePressedOver(instructionbutton)) {
    showLucyRoom();
    instructionbutton.visible = false;
    instructionbutton2.depth = 10;
  }
  
  if (mousePressedOver(schoolbutton))  {
    CropTop.visible = false;
    sweat.visible = false;
    dress.visible = false;
    school.visible = true;
    school.scale = 0.6;
    instructionbutton2.visible = true;
  }
  
  if (mousePressedOver(sweatbutton))  {
    CropTop.visible = false;
    school.visible = false;
    dress.visible = false;
    sweat.visible = true;
    sweat.scale = 1;
    instructionbutton2.visible = true;
  }
  
  if (mousePressedOver(dressbutton))  {
    CropTop.visible = false;
    school.visible = false;
    sweat.visible = false;
    dress.visible = true;
    dress.scale = 1;
    instructionbutton2.visible = true;
  }
  
  if (mousePressedOver(instructionbutton2)) {
    showCafe();
  }
  
  if (mousePressedOver(instructionbutton3)) {
    showLucyRoom();
  }
}

function date2() {
  if (mousePressedOver(startingbutton)) {
    instruction.visible = true;
    instructionbutton.visible = true;
    instructionbutton3.depth = 10;
    instructionbutton4.visible = false;
  }
  
  if (mousePressedOver(instructionbutton)) {
    showLucyRoom();
    stalker.visible = true;
    stalker.depth = 6;
    instructionbutton4.visible = false;
    instructionbutton4.depth = 10;
  }
  
  if (mousePressedOver(schoolbutton))  {
    CropTop.visible = false;
    sweat.visible = false;
    dress.visible = false;
    school.visible = true;
    school.scale = 0.6;
    instructionbutton4.visible = true;
    instructionbutton4.visible = false;
  }
  
  if (mousePressedOver(sweatbutton))  {
    CropTop.visible = false;
    school.visible = false;
    dress.visible = false;
    sweat.visible = true;
    sweat.scale = 1;
    instructionbutton4.visible = true;
    instructionbutton4.visible = false;
  }
  
  if (mousePressedOver(dressbutton))  {
    CropTop.visible = false;
    school.visible = false;
    sweat.visible = false;
    dress.visible = true;
    dress.scale = 1;
    instructionbutton4.visible = true;
    instructionbutton4.visible = false;
  }
  
  if (mousePressedOver(instructionbutton4)) {
    showMuseum();
  }
  
  if (mousePressedOver(instructionbutton3)) {
    showLucyRoom();
  }
}

function showLucyRoom() {
  LucyRoom.visible = true;
  CropTop.visible = true;
  CropTop.scale = 0.6;
  schoolbutton.visible = true;
  schoolbutton.scale = 0.4;
  sweatbutton.visible = true;
  sweatbutton.scale = 0.4;
  dressbutton.visible = true;
  dressbutton.scale = 0.4;
  cafe.visible = false;
  museum.visible = false;
  instructionbutton3.visible = false;
  instructionbutton3.depth = 14;
}

function showCafe() {
  cafe.visible = true;
  cafe.scale = 2.3;
  text("This was super fun, I’d love to go with you again!", 28, 26);
  instructionbutton3.visible = true;
  instructionbutton3.depth = 14; // Ensure instructionbutton3 is on top
}

function showMuseum() {
  museum.visible = true;
  museum.scale = 2.3;
  text("This is the second date of the day!", 28, 26);
  instructionbutton3.visible = true;
  instructionbutton3.depth = 14; // Ensure instructionbutton3 is on top
}

var background = createSprite(200, 200);
background.setAnimation("StartingPage");

var startingbutton = createSprite(104, 228);
startingbutton.setAnimation("StartingPageButton");

var instruction = createSprite(200, 200);
instruction.visible = false;
instruction.setAnimation("InstructionPage");

var instructionbutton = createSprite(88, 372);
instructionbutton.visible = false;
instructionbutton.setAnimation("InstructionPageButton");

var instructionbutton2 = createSprite(240, 320);
instructionbutton2.visible = false;
instructionbutton2.setAnimation("InstructionPageButton");

var instructionbutton3 = createSprite(328, 354);
instructionbutton3.visible = false;
instructionbutton3.setAnimation("InstructionPageButton");

var instructionbutton4 = createSprite(238, 268);
instructionbutton4.visible = false;
instructionbutton4.setAnimation("InstructionPageButton");

var LucyRoom = createSprite(200, 200);
LucyRoom.visible = false;
LucyRoom.setAnimation("Lucy'sRoom.jpg");

var CropTop = createSprite(72, 220);
CropTop.visible = false;
CropTop.setAnimation("CropTop");

var school = createSprite(72, 215);
school.visible = false;
school.setAnimation("School");

var schoolbutton = createSprite(218, 138);
schoolbutton.visible = false;
schoolbutton.setAnimation("SchoolButton");

var dress = createSprite(100, 215);
dress.visible = false;
dress.setAnimation("dress");

var sweat = createSprite(72, 215);
sweat.visible = false;
sweat.setAnimation("sweatshirt");

var sweatbutton = createSprite(340, 138);
sweatbutton.visible = false;
sweatbutton.setAnimation("sweatbutton");

var dressbutton = createSprite(336, 310);
dressbutton.visible = false;
dressbutton.setAnimation("dressbutton");

var cafe = createSprite(200, 200);
cafe.visible = false;
cafe.setAnimation("cafe");

var museum = createSprite(200, 200);
museum.visible = false;
museum.setAnimation("museum");

var stalker = createSprite(117,236);
stalker.visible = false;
stalker.setAnimation("stalker");

function draw() {
  date1();
  date2();
  drawSprites();
}

I’ve tried using .visible, but that only changes whether the user can see it or not. It doesn’t actually stop the button from responding.

Next.js with Router DOM

I want to take the result of the code in navigation but it seems to return an horrible error: Unhandled Runtime Error

Error: You cannot render a <Router> inside another <Router>. You
should never have more than one in your app.

"use client";
import React from 'react';
import { BrowserRouter, Route, Routes } from "react-router-dom";
import Main from '@/components/main/Main';
import Sidebar from "@/components/sidebar/Sidebar";
import { Blog } from "@/pages/blog/Blog";

export default function Home() {
  return (
    <BrowserRouter>
      <Sidebar />
      <Main>
        <Routes>
          <Route path="/" element={<Home />} />
          <Route path="/blog/[id]" element={<Blog />} />
        </Routes>
      </Main>
    </BrowserRouter>
  )
}

I tried to take the result but i can’t please help me

What do my errors mean and how can i fix them?

Im following a course on yt from JavaScript Mastery(https://www.youtube.com/watch?v=0fYi8SGA20k&list=LL&index=3&t=1085s)
Its around 53 minutes in the vid
Im at the point where he starts working with the 3D model but i cant see the model anywhere in my page.

import { motion } from 'framer-motion';
import { styles } from '../styles';
import { ComputersCanvas } from './canvas';

const Hero = () => {
  return (
    <section className="relative w-full h-screen mx-auto">
      <div className={`${styles.paddingX} absolute inset-0 top-[120px] 
      max-w-7xl mx-auto flex flex-row items-start gap-5`}>
        <div className="flex flex-col justify-center items-center mt-5">
        <div className="w-5 h-5 rounded-full bg-[#9762fb]" />
        <div className="w-1 sm:h-80 h-40 bg-[#9762fb]" />
        </div>
        <div>
          <h1 className={`${styles.heroHeadText} text-white`}>Hallo, Ik ben <span className="text-[#9762fb]">Justin</span></h1>
          <p className={`${styles.heroSubText} mt-2 text-white-100`}>
          Ik ben een gepassioneerde <span className="text-[#9762fb]">Software<br/> Development</span> Student
          </p>
        </div>
      </div>
      <ComputersCanvas />

      <div className='absolute xs:bottom-10 bottom-32 w-full flex justify-center items-center'>
        <a href='#about'>
          <div className='w-[35px] h-[64px] rounded-3xl border-4 border-secondary flex justify-center items-start p-2'>
            <motion.div
              animate={{
                y: [0, 24, 0],
              }}
              transition={{
                duration: 1.5,
                repeat: Infinity,
                repeatType: "loop",
              }}
              className='w-3 h-3 rounded-full bg-secondary mb-1'
            />
          </div>
        </a>
      </div>
    </section>
  )
}

export default Hero

Its about the ComputerCanvas

import { Suspense, useEffect, useState} from 'react';
import { Canvas } from '@react-three/fiber';
import { OrbitControls, Preload, useGLTF } from '@react-three/drei';
import CanvasLoader from '../Loader';



 const Computers = () => {
  const computer = useGLTF('./desktop_pc/scene.gltf')
  return (
    <mesh>
      <hemisphereLight intensity={0.15} groundColor="black"/>
      <pointLight intensity={1} />
      <primitive 
        object={computer.scene}
      />
    </mesh>
    
    
  )
}

const ComputersCanvas = () => {
  return(
    <Canvas
    frameLoop="demand"
    shadows
    camera={{ position: [20, 3, 5], fov: 25 }}
    gl={{preserveDrawingBuffer: true }}
    >
      <Suspense fallback={<CanvasLoader />}>
        <OrbitControls 
          enableZoom={false} 
          maxPolarAngle={Math.PI / 2}
          minPolarAngle={Math.PI / 2}
        />
        <Computers />
      </Suspense>

      <Preload all />
    </Canvas>
  )
}

export default Computers;

and this is the index.js

import EarthCanvas from "./Earth";
import BallCanvas from "./Ball";
import ComputersCanvas from "./Computers";
import StarsCanvas from "./Stars";

export { EarthCanvas, BallCanvas, ComputersCanvas, StarsCanvas };

and im getting the errors in the console
error from console
(all the failed to reload errors are gone)
more errors from the console
Ive done everything the same in the yt vid and its not working for me but in the yt vid it does.

I expected a 3Dmodel but i dont know if its not loading in or the paths are wrong.
Ive even tried to recode the whole part of the vid but it still doesnt work

Zoom Web SDK – “Invalid apiKey/sdkKey and/or signature”

I want to show a meeting in my Next.js App and I have a problem, Im getting this error:
“INVALID_OPERATION” – “Invalid apiKey/sdkKey and/or signature” Error.
Im doing every step by the docs and dont understand where I felt.

I took the ZOOM_CLIENT_ID and ZOOM_CLIENT_SECRET from the marketplaces:
https://marketplace.zoom.us/develop/applications/myid

my server code that generate the signature:

import { NextApiRequest, NextApiResponse } from “next”;
import { KJUR, hextob64 } from ‘jsrsasign’;

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { meetingNumber = “”, role = “0” } = req.query;
const apiKey = process.env.ZOOM_CLIENT_ID;
const apiSecret = process.env.ZOOM_CLIENT_SECRET;
console.log(apiKey, apiSecret, meetingNumber, role);
if (!apiKey || !apiSecret || !meetingNumber) {
return res.status(400).json({ error: “Missing required parameters” });
}

try {
const result = generateSignature(apiKey, apiSecret, meetingNumber, role);
res.status(200).json({ result, sdkKey: apiKey });
} catch (error) {
console.error(“Error generating signature:”, error);
res.status(500).json({ error: “Internal server error” });
}
}

function generateSignature(key: any, secret: any, meetingNumber: any, role: any) {
const iat = Math.round(new Date().getTime() / 1000) - 30
const exp = iat + 60 * 60 * 2
const oHeader = { alg: ‘HS256’, typ: ‘JWT’ }

const oPayload = {
sdkKey: key,
appKey: key,
mn: meetingNumber,
role: role,
iat: iat,
exp: exp,
tokenExp: exp
}

const sHeader = JSON.stringify(oHeader)
const sPayload = JSON.stringify(oPayload)
const sdkJWT = KJUR.jws.JWS.sign(‘HS256’, sHeader, sPayload, secret)
return sdkJWT;
}

the zoom meeting component:
// components/ZoomMeeting.tsx
import React, { useState } from “react”;
import ZoomMtgEmbedded from “@zoom/meetingsdk/embedded”;

interface ZoomMeetingProps {
meetingNumber?: string;
userName?: string;
}

const ZoomMeeting: React.FC = ({
meetingNumber = “88434450302”,
userName = “React User”,
}) => {
const [client] = useState(() => ZoomMtgEmbedded.createClient());

const getSignature = async (
e: React.MouseEvent<HTMLButtonElement, MouseEvent>,
) => {
e.preventDefault();
try {
const response = await fetch(
/api/getZoomJwt?meetingNumber=${meetingNumber},
);
const { signature, sdkKey } = await response.json();
startMeeting(signature, sdkKey);
} catch (error) {
console.error(“Error getting JWT for Zoom”, error);
}
};

const startMeeting = (signature: string, sdkKey:string) => {
let meetingSDKElement = document.getElementById(“meetingSDKElement”);
if (!meetingSDKElement) return;

client
  .init({
    zoomAppRoot: meetingSDKElement,
    language: "en-US",
  })
  .then(() => {
    client
      .join({
        signature,
        meetingNumber,
        userName,
        password: "eGXsGO15II6lWJSd3fEQKywwE8q9Ng.1",
        sdkKey,
        success: (success: any) => {
          console.log(success)
        },
        error: (error: any) => {
          console.log(error)
        }
      })
  })
  .catch((error) =>
    console.error("Error initializing the meeting:", error),
  );
};

return (

<div
id=“meetingSDKElement”
style={{ width: “100%”, height: “500px” }}
>

Join Meeting

);
};
export default ZoomMeeting;

Please help me

To join the zoom meeting

Creating image distortion effect in React/JS

So i came across this cool website which has image distortion while u are moving your mouse.
https://asper-film.webflow.io/

Now since im using react for my project, i found this “react-curtains” which is similar.
https://github.com/martinlaxenaire/react-curtains
On their github page theres demo example which is pretty close to what i want to archive like its on asper website.
Codesandbox link of example is https://codesandbox.io/p/sandbox/react-curtains-flowmap-0hn2t?file=%2Fsrc%2Fstyles.css .

Now i also found out there`s library called Three.js, but that seems way to complicated for me…

So anyone had knowledge for somehow archive effect that is like on on site above?

Not sure how to make my function call properly [duplicate]

I am attempting to call a function from the program, however it only calls if inside a button tag I’m trying to get it to call automatically when the page runs, or call it from inside another function, but it doesn’t seem to work.
contents of function not important (I think)

<head>
<script>
const x = Number(prompt("enter number"))
function createGridCells() {
        var y = document.getElementsByTagName("p2")[0];
        square = "<div class="grid-item"></div>"
        wall = "<div class="grid-space"></div>"
        let z = ((square + wall))
        a = z.repeat(x-1)
        b = a + square
        c = wall.repeat(x*2 - 1)
        d = b + c
        e = d.repeat(x-1)
        f = e + d
        g = f + square
        y.outerHTML = f
    }
function createGridSize() {
        pixelNum = "45px 5px "
        columnsAndRows = pixelNum.repeat(x-1)
        declaration = document.styleSheets[0].cssRules[0].style;
        setProp = declaration.setProperty("grid-template-columns", columnsAndRows + "45px");
        declarationTwo = document.styleSheets[0].cssRules[0].style;
        setPropTwo = declarationTwo.setProperty("grid-template-rows", columnsAndRows + "45px");
}
function runMaze(){
            var randomInt = Math.floor(Math.random() * 4);
            if (randomInt == 1 ){
                moveRight()
            }
            if (randomInt == 2){
                moveLeft()
            }
            if (randomInt == 3){
                moveUp()
            }
            if (randomInt == 4){
                moveDown()
            }
        
    
</script>
</head>
<body>
<script>
createGridCells()
createGridSize()



</script>
<button onclick="createGridCells()">cells</button>
<button onclick="createGridSize()">size</button>
<div class="grid-container">
<p2></p2>
</div>
</body>

react-native-calendars onEventPress returning undefined

I have created TimelineList using react-native-calendars and I’am trying to get onEventPress to work, but it keeps returning undefined.

I defined the function that handles the click like this:

    handleEventPress: TimelineProps["onEventPress"] = (event: Event) => {
        console.log(event);
    };

I then binded the function to the props like so:

    private timelineProps: Partial<TimelineProps> = {
        format24h: true,
        overlapEventsSpacing: 8,
        rightEdgeSpacing: 4,
        renderEvent: this.renderEvent,

        onBackgroundLongPress: this.handleBackgroundLongPress,
        onEventPress: this.handleEventPress,
    };

and they are then used in my component like so:

<TimelineList events={this.state.events} timelineProps={this.timelineProps} showNowIndicator scrollToNow />

Check all checkboxes on DataTables pages

I have the following DataTable, and I need to check / uncheck all checkboxes on all pages. How do I make this happen? Also, just the checkboxes and not the entire row.

enter image description here

I cannot use fnGetNodes, because it is deprecated.

 var table = new DataTable('#example', {
                responsive: true,
                "lengthMenu": [20, 40, 60, 80, 100],
                "pageLength": 10
            }); 

Full HTML :



<!doctype html>
<html lang="en">
  <head>
    <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>
    <script type="text/javascript" language="javascript" src="//cdn.datatables.net/2.0.2/js/dataTables.min.js"></script>
    <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/2.0.2/css/dataTables.dataTables.min.css">    
  </head>
<body>
    <table id="example" class="display" style="width:100%">
        <thead>
            <tr>

                <th><input type="checkbox" name='all' id="checkAll"> All</th>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="1"></td>
                <td>Tiger Nixon</td>
                <td>System Architect</td>
                <td>Edinburgh</td>
                <td>61</td>
                <td>2011-04-25</td>
                <td>$320,800</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="2"></td>
                <td>Garrett Winters</td>
                <td>Accountant</td>
                <td>Tokyo</td>
                <td>63</td>
                <td>2011-07-25</td>
                <td>$170,750</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="3" checked></td>
                <td>Ashton Cox</td>
                <td>Junior Technical Author</td>
                <td>San Francisco</td>
                <td>66</td>
                <td>2009-01-12</td>
                <td>$86,000</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="4"></td>
                <td>Cedric Kelly</td>
                <td>Senior Javascript Developer</td>
                <td>Edinburgh</td>
                <td>22</td>
                <td>2012-03-29</td>
                <td>$433,060</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="5"></td>
                <td>Airi Satou</td>
                <td>Accountant</td>
                <td>Tokyo</td>
                <td>33</td>
                <td>2008-11-28</td>
                <td>$162,700</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="6"></td>
                <td>Brielle Williamson</td>
                <td>Integration Specialist</td>
                <td>New York</td>
                <td>61</td>
                <td>2012-12-02</td>
                <td>$372,000</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="7"></td>
                <td>Herrod Chandler</td>
                <td>Sales Assistant</td>
                <td>San Francisco</td>
                <td>59</td>
                <td>2012-08-06</td>
                <td>$137,500</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="8"></td>
                <td>Rhona Davidson</td>
                <td>Integration Specialist</td>
                <td>Tokyo</td>
                <td>55</td>
                <td>2010-10-14</td>
                <td>$327,900</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="9"></td>
                <td>Colleen Hurst</td>
                <td>Javascript Developer</td>
                <td>San Francisco</td>
                <td>39</td>
                <td>2009-09-15</td>
                <td>$205,500</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="10"></td>
                <td>Sonya Frost</td>
                <td>Software Engineer</td>
                <td>Edinburgh</td>
                <td>23</td>
                <td>2008-12-13</td>
                <td>$103,600</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="11"></td>
                <td>Jena Gaines</td>
                <td>Office Manager</td>
                <td>London</td>
                <td>30</td>
                <td>2008-12-19</td>
                <td>$90,560</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="12"></td>
                <td>Quinn Flynn</td>
                <td>Support Lead</td>
                <td>Edinburgh</td>
                <td>22</td>
                <td>2013-03-03</td>
                <td>$342,000</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="13"></td>
                <td>Charde Marshall</td>
                <td>Regional Director</td>
                <td>San Francisco</td>
                <td>36</td>
                <td>2008-10-16</td>
                <td>$470,600</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="14"></td>
                <td>Haley Kennedy</td>
                <td>Senior Marketing Designer</td>
                <td>London</td>
                <td>43</td>
                <td>2012-12-18</td>
                <td>$313,500</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="15"></td>
                <td>Tatyana Fitzpatrick</td>
                <td>Regional Director</td>
                <td>London</td>
                <td>19</td>
                <td>2010-03-17</td>
                <td>$385,750</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="16"></td>
                <td>Michael Silva</td>
                <td>Marketing Designer</td>
                <td>London</td>
                <td>66</td>
                <td>2012-11-27</td>
                <td>$198,500</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="17"></td>
                <td>Paul Byrd</td>
                <td>Chief Financial Officer (CFO)</td>
                <td>New York</td>
                <td>64</td>
                <td>2010-06-09</td>
                <td>$725,000</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="18"></td>
                <td>Gloria Little</td>
                <td>Systems Administrator</td>
                <td>New York</td>
                <td>59</td>
                <td>2009-04-10</td>
                <td>$237,500</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="19"></td>
                <td>Bradley Greer</td>
                <td>Software Engineer</td>
                <td>London</td>
                <td>41</td>
                <td>2012-10-13</td>
                <td>$132,000</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="20"></td>
                <td>Dai Rios</td>
                <td>Personnel Lead</td>
                <td>Edinburgh</td>
                <td>35</td>
                <td>2012-09-26</td>
                <td>$217,500</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="21"></td>
                <td>Jenette Caldwell</td>
                <td>Development Lead</td>
                <td>New York</td>
                <td>30</td>
                <td>2011-09-03</td>
                <td>$345,000</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="22"></td>
                <td>Yuri Berry</td>
                <td>Chief Marketing Officer (CMO)</td>
                <td>New York</td>
                <td>40</td>
                <td>2009-06-25</td>
                <td>$675,000</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="23"></td>
                <td>Caesar Vance</td>
                <td>Pre-Sales Support</td>
                <td>New York</td>
                <td>21</td>
                <td>2011-12-12</td>
                <td>$106,450</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="24" checked></td>
                <td>Doris Wilder</td>
                <td>Sales Assistant</td>
                <td>Sydney</td>
                <td>23</td>
                <td>2010-09-20</td>
                <td>$85,600</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="25"></td>
                <td>Angelica Ramos</td>
                <td>Chief Executive Officer (CEO)</td>
                <td>London</td>
                <td>47</td>
                <td>2009-10-09</td>
                <td>$1,200,000</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="26"></td>
                <td>Gavin Joyce</td>
                <td>Developer</td>
                <td>Edinburgh</td>
                <td>42</td>
                <td>2010-12-22</td>
                <td>$92,575</td>
            </tr>
            <tr>
                <td><input type="checkbox" name="employeeID" class="select-employee" value="27"></td>
                <td>Jennifer Chang</td>
                <td>Regional Director</td>
                <td>Singapore</td>
                <td>28</td>
                <td>2010-11-14</td>
                <td>$357,650</td>
            </tr>
        </tbody>
    </table>
    <br/>
   

    <script language="javascript" type="text/javascript"> 
        $(document).ready(function(){
            
            var table = new DataTable('#example', {
                responsive: true,
                "lengthMenu": [20, 40, 60, 80, 100],
                "pageLength": 10
            }); 

                             
           // check / uncheck all somehow? 
        });
    </script>
</body>
</html>

JSON.stringify(data) me devuelve ‘{‘ [closed]

Tengo el siguiente fragmento de codigo:

const data = JSON.stringify({
         email: "[email protected]",
         password: "1234567890"
      })

Cuando miro data tengo '{' como resultado.

Probe con ” “, con ‘ ‘, probé de todo. Obviamente la consulta fetch o axios que quiero hacer se rompe. Pero sin llegar a eso ya me llama la atención que pase ésto. Nunca me pasó. Lo estoy probando en el inspector hermes de una app en react-native corriendo en un dispositivo físico. La verdad que ya no se como intentarlo.

Use external file js in robot-framework

I have a file js in my project

export function myFunction(parametro) {
  return "This is result  " + param;
}

and my file .robot

*** Settings ***
Library    SeleniumLibrary

*** Test Cases ***
Carregar Funções JavaScript
    Open Browser    https://google.com    Firefox
    Execute JavaScript    var script = document.createElement('script');
    ...    script.src = '/external-libs/robot-shared-function/index.js';
    ...    document.head.appendChild(script);

Usar Função JavaScript
    ${resultado}=    Execute JavaScript    return minhaFuncaoGlobal('algumParâmetro');
    Log    ${resultado}

But in results I have :

Usar Função JavaScript                                                | FAIL |
JavascriptException: Message: ReferenceError: myFunction is not defined
------------------------------------------------------------------------------
Teste-Lib                                                             | FAIL |
2 tests, 1 passed, 1 failed

I would like know how to use external function of file js

How can I get scrolling event to register?

I’m trying to program a webpage animation where a user can have the choice of clicking & dragging or simply scrolling using the mouse wheel to view a vertical stack of images. Click & drag works fine, however the scrolling input doesn’t work as desired. When I attempt to scroll though the pictures, input doesn’t seem to register. When I click & drag first, and then scroll, the scroll feature works.

Html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>CoolEffect</title>
</head>
<body>
    <div id = "image-track" data-mouse-down-at = "0" data-prev-percentage = "0">
        <img class="image" src="assets/photo-1542051841857-5f90071e7989.jpeg" draggable="false">
        <img class="image" src="assets/photo-1533050487297-09b450131914.jpeg" draggable="false">
        <img class="image" src="assets/photo-1564284369929-026ba231f89b.jpeg" draggable="false">
        <img class="image" src="assets/photo-1528360983277-13d401cdc186.jpeg" draggable="false">
        <img class="image" src="assets/photo-1492571350019-22de08371fd3.jpeg" draggable="false">
        <img class="image" src="assets/photo-1532884928231-ef40895eb654.jpeg" draggable="false">
        <img class="image" src="assets/photo-1540959733332-eab4deabeeaf.jpeg" draggable="false">
    </div>
    <script src="script.js"></script>
</body>
</html>

CSS

body{
    height: 100vh;
    width: 100vw;
    background-color: black;
    margin: 0rem;
    overflow: hidden;
}

#image-track > .image {
    width: 150vmin;
    height: 50vmin;
    object-fit: cover;
    object-position: 100% 0%;
}

#image-track {
    display: flex;
    flex-direction: column;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

JavaScript

const track = document.getElementById("image-track");

window.onmousedown = e => {
    track.dataset.mouseDownAt = e.clientY;
}

window.onmouseup = () => {
    track.dataset.mouseDownAt = "0";
    track.dataset.prevPercentage = track.dataset.percentage;
}

window.onmousemove = e => {
    if(track.dataset.mouseDownAt === "0") return;

    const mouseDelta = parseFloat(track.dataset.mouseDownAt) - e.clientY,
    maxDelta = window.innerHeight;

    let percentage = (mouseDelta / maxDelta) * -100,
    nextPercentage = parseFloat(track.dataset.prevPercentage) + percentage;

    nextPercentage = Math.max(-100, Math.min(0, nextPercentage));

    track.dataset.percentage = nextPercentage;

    track.animate(
        {transform :`translate(-50%, ${nextPercentage}%)`}, 
        {duration: 1200, fill: "forwards"});

    for(const image of track.getElementsByClassName("image")){
        image.animate(
            {objectPosition : `50% ${nextPercentage + 100}%`}, 
            {duration: 1200, fill: "forwards"});
    }
} 

window.addEventListener("wheel", e => {

    e.preventDefault();
    
    const deltaY = e.deltaY;
    const maxDelta = window.innerHeight;
    
    let percentage = (deltaY / maxDelta) * -100,
        nextPercentage = parseFloat(track.dataset.percentage) + percentage;
    
    nextPercentage = Math.max(-100, Math.min(0, nextPercentage));
    
    track.dataset.percentage = nextPercentage;
    
    track.animate(
        { transform: `translate(-50%, ${nextPercentage}%)` },
        { duration: 1200, fill: "forwards" }
    );
    
    for (const image of track.getElementsByClassName("image")) {
        image.animate(
            { objectPosition: `50% ${nextPercentage + 100}%` },
            { duration: 1200, fill: "forwards" }
        );
    }
    scrollStartY = e.pageY;
});

What I expected to happen was regardless of previous input, the user can scroll or click & drag to view the images. Without clicking and dragging first, the user is unable to do so. I first thought the issue lied in the default scrolling behaviour of the page, so I added to e.preventDefault() to negate this. This however wasn’t the issue. Any suggestions as to what could be causing the issue?

Javascript that displays different page every hour needs to open in new window

I have javascript on my page which opens a different page every hour of the day. This example uses a text link in the code. It opens in the same window it is displayed on. Works fine except I need it to open the click result in a new window. I’d like to keep it really simple code wise. I’d also like to use graphics as the link instead of text.

Any suggestions?

RightNow = new Date();
document.write("<a href='" + RightNow.getHours() 
  + ".html'>NON PASSKEY ENTRANCE</a>")

I’ve tried numerous ways trying to put a target in the code, and I’ll either break it where it will not show on the page at all or it still opens in the parent. Tried calling it as a function too without success.

Is there a better way other than this.$forceUpdate() to update elements?

I am using vueJS to handle a function which reloads my element.

We have our HTML elements here, a dropdown list to display the option

<el-select v-model="row.display_name_uuid">
  <el-option v-for="(item, i) in displayNameList" 
           :key="i" :value="item.uuid" 
           :label="item.display_name">
   </el-option>
</el-select>

Then we have our method here list is our array data and DisplayNameList contains the dropdown list’s select options

getExclusiceUuid (data, val) {
              this.refreshDisplayNameList() // refresh the newly added data

                this.list.forEach((item, index) => { //loop until key paired 
                    if (item.key == data.key) {
                        let obj = JSON.parse(JSON.stringify(item))

                        this.list.splice(index, 1)//we try to remove it first         

                        this.displayNameList = [...this.displayNameList]
            
                        this.list = [...this.list]
                        
                        this.$forceUpdate()

                        obj.display_name_uuid = val

                        this.list.splice(index, 0, obj) //then we add it back here to try to force update

                        this.$forceUpdate()
                    }
                })
            },

After we update the Display Name List content we would also like to update the contain within the select box, but it doesn’t seem like it updates normally even we confirm the function runs after his.refreshDisplayNameList(), the select element doesn’t seem to refresh even we use this.list.splice(index, 1) remove it and recreate.

and
enter image description here