Problem with code 1: Client is not defined

Etant nouveau dans le domaine informatique, je souhaite créer un bot de divertissement et de modération mais je rencontre plusieurs problèmes :

Process exited with code 1
Uncaught ReferenceError ReferenceError: client is not defined

Here are my lines of code:

const { Client } = require("discord.js");
const bot = new Client({ intents: ["Guilds"] });
console.log("Connexion au bot...");
bot.login("MY TOKEN")
    .then(() => console.log("Connecté au bot !"))
    .catch((error) => console.log("Impossible de se connecter au bot - " + error));

bot.on("ready", async () => {

    await bot.application.commands.set([
        {
            name: "ping",
            description: "Pong!"
        }
    ]);

    console.log("Le bot est prêt !");
});

bot.on("interactionCreate", (interaction) => {

    if (!interaction.isCommand()) return;

    if (interaction.commandName === "ping")
        interaction.reply("Pong!");

    if (interaction.commandName === "maj")
        interaction.reply("Pour connaître les derniers mises à jours du bot, merci de 
vous référencer à Xinfeng");
});

client.on("messageCreate", message => {
if(message.author.bot) return;

    //+help
 if (message.content === prefix + "help"){
    const embed = new Discord.EmbedBuilder()
        .setColor("#ffcc00")
        .setTitle("**__Les commandes du bot__**")
        .setURL("https://discord.js.org/")
        .setDescription("Vous trouverez toutes les commandes dont vous pouvez faire 
usage")
        .addFields(
            { name: '**__+commandes:__**', value: 'Affiche la liste des commandes' },
            { name: '**__+description:__**', value: 'Affiche la description du bot' },
            { name: '**__+info:__**', value: 'Affiche les informations du bot' },
            { name: '**__Support Developpement:__**', value: 
'https://discord.gg/H9mSXeAm8C' }
       
        );
        
    message.channel.send({ embeds: });

}
  //+description
  if (message.content === prefix + "description"){
    const embed = new Discord.EmbedBuilder()
        .setColor("#ffcc00")
        .setTitle("**__Description du bot__**")
        .setURL("https://discord.js.org/")
        .setDescription("Je suis Athéna, une déesse grec de l'artisanat et de la 
stratégie guerrière. Je m'occupe de la modération, jeux et de trackage d’information ");

    message.channel.send({ embeds: });

}


    console.log(message);
    if(message.content === "Salut"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "salut"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "Coucou"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "coucou"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "Hey"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "Heyyy"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "Hello"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "Hello tlm"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "hello"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "hello tlm"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "Hoyaa"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "Hey tlm"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "slt tlm"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "Slt tlm"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "hey"){
        message.reply("Bonjour jeune aventurier");
    }
    if(message.content === "Bonjour"){
        message.reply("Bonjour jeune aventurier");
    }
    else if(message.content === "help"){
        message.channel.send("**__les commandes du bot ATHENA sont__**n - +help: Il 
permettra de configurer et de mieux comprendre les commandes")
    }
    else if(message.content === "description"){
        message.channel.send("**__Pour connaître la description du bot ATHENA 
sont__**n - +description: Il permettra de connaître l'histoire et la naîssance du 
bot")
    }
    else if(message.content === "mention"){
        message.reply("Mention d'un utilisateur : <@" + message.author.id + "> n 
Mention d'un salon : <#" + message.channel.id + ">");
    }

});

I would like to know if we can resolve this problem, thank you

How to add Delete button to a calculator

Working on advanced calculator with JavaScript but the delete function is not working

Input = to string().slice(0, - 1) 

it was supposed to delete one value, but it just turned the entired input to a string and totally made my input invalid

Send document using Telegram bot API Javascript

Executing the following code return this error “Bad Request: there is no document in the request”

const FILE_PATH = path.join(__dirname, "test.txt");
  const document = fs.readFileSync(FILE_PATH);
  const fileBuffer = Buffer.from(document, "binary");
  const formData = new FormData();
  formData.append("chat_id", CHAT_ID);
  formData.append("document", fileBuffer, {
    filename: "test.txt",
  });
  formData.append("caption", "Document title or description here");
  const telegram_sendmessage = await fetch(
    `https://api.telegram.org/${BOT_TOKEN}/sendDocument`,
    {
      method: "POST",
      headers: {
        accept: "application/json",
      },
      body: formData,
    }
  );

  const response = await telegram_sendmessage.json();
  console.log(response);

i expect sending this document text or excel or zip file from my server to telegram bot chat

How to make multiple animations trigger in sequence on the same element using JavaScript?

I’m new to JavaScript, and working on a startup application. I’m trying to write code that will cause an animation to execute multiple times (in sequence) on the same text element, with the text changing between animations. The text change and second animation should not occur until the first animation is complete, and so on.

With the code that I’ve written, the text changes a few times over the course of a single animation, then hangs indefinitely. I’m assuming it’s an issue with the async/await or the animationend listener… does anyone with more experience (basically everyone, haha) have a direction to point me in? I’d appreciate any input!

Here’s example HTML with my JS code:

UPDATE: Added a executable Stack Snippet.

async function initAnim() {
    await setDialogue("First text");
    await setDialogue("Second text");
    await setDialogue("Third text");
    await setDialogue("Fourth text");
    await setDialogue("Fifth text");
}

async function setDialogue(text) {
    const dialogueEl = document.querySelector(".dialogue");
    dialogueEl.textContent = text;
    dialogueEl.classList.add("dialogueEnter");
    await waitforAnimation(dialogueEl);
    dialogueEl.classList.remove("dialogueEnter");
}

function waitforAnimation(element) {
    return new Promise(resolve => {
        function handleAnimationEnd() {
            element.removeEventListener('animationend', handleAnimationEnd);
            resolve();
        }

        element.addEventListener('animationend', handleAnimationEnd);
    });
}
.dialogueEnter {
    animation: tilt-n-move-shaking 0.25s forwards,
        text-pulse 0.6s forwards;
}

@keyframes tilt-n-move-shaking {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(10px, 10px) rotate(10deg); }
    50% { transform: translate(0, 0) rotate(0eg); }
    75% { transform: translate(-10px, 10px) rotate(-10deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
  }

@keyframes text-pulse {
    0% { font-size: 1em }
    75% { font-size: 2em }
    100% { font-size: 1.6em }
}
<div>
  <h1 class="dialogue" onclick="initAnim()">Click me</h1>
</div>

VSCode does not recognize workspace import event though esbuild does

I have a few projects that use workspaces, and in some VSCode recognizes imports from them fine, and in some just refuses. I have not found errors in logs or could pinpoint the reason.

I tried finding workarounds by using tsconfig, and path aliases looked like a good candidate. Unfortunately any example I could find was dealing with aliases inside the project.

Javascript – thing.length not working – Uncaught TypeError

I found a function that counts immediate children of an element. However, whenever I run it, the console says “Uncaught TypeError: Cannot read properties of undefined (reading ‘length’)”. I am also coding this in VS code, and the error doesn’t pop up in the code editor. I have to go to the tab, ctrl+i, and look in the console.
I have no idea what is happening (it should work fine), but here is my function:

function countChildElements(parent) {
  var children = parent.childNodes, cnt = 0;
  for (var i = 0, len = children.length; i < len; i++) { // Error occurs on this line
    if (children[i].nodeType === 1) {
      cnt++;
    }
  }
  return(cnt);
}

Anyone know why this is happening?
PS. I can’t use the .length thing anywhere. It always makes that same error thing.

How to clean the html pages opened in a session?

A consult please, I have done a login page which open the application page and from this page I can go to other pages, I started a session, when I clear the session and back to login page stayed in the history the last page opened from application page, clicking in the arrow forward I can go to such page, it is wrong!, how could I delete such last page?, my goal, when I finish the session is to delete the history of the last page opened from the application page.

I thank you in advance for your help.

I am beginner programming Html, I dont have ideas to resolve this problem.

How do I post new data directly into a nested array in my json data file?

I tried setting the endpoint of the POST request to ‘http://localhost:3001/profiles/:id/logs’ but I got this error: Failed to load resource: the server responded with a status of 404 (Not Found).

I have attached App.js file (containing all my routes), PetPage.js file (add/display logs specific to profile id), and db.json file (outlining the structure of my data).

App.js ,

PetPage.js ,

db.json

Also below is my AddPet.js file which successfully posts a new pet and its data:

    const [formData, setFormData] = useState({
        name: '',
        age: '',
        gender: '',
        breed: '',
        condition: '',
        vetName: '',
        vetNumber: ''
    });

    const handleChange = (e) => {
        const { name, value } = e.target;
        setFormData({
            ...formData,
            [name]: value
        });
    }
  


   const handleAddPet = (e) => {
    e.preventDefault();
    
    const lastProfile = profiles[profiles.length - 1];
    const newPetId = lastProfile ? lastProfile.id + 1 : 1; // Generate a new ID

    const newPetData = {
        id: newPetId, // Generate a new ID for the new pet
        name: formData.name,
        age: formData.age,
        gender: formData.gender,
        breed: formData.breed,
        condition: formData.condition,
        vetName: formData.vetName,
        vetNumber: formData.vetNumber,
        logs: [] // Empty logs for the new pet
    };

    fetch(`http://localhost:3001/profiles`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(newPetData)
    })
    .then(response => {
        if (!response.ok) {
            throw new Error('Failed to add pet');
        }
        return response.json();
    })
      .then(newPetData => {
        updateProfiles(newPetData)
        setFormData({
            name: '',
            age: '',
            breed: '',
            condition: '',
            gender: '',
            vetName: '',
            vetNumber: ''
        });
        alert('Pet added successfully!');
    })
    .catch(error => {
        console.error(error);
        alert('Failed to add pet');
    });
}

Here is my latest attempt:

import React, { useState } from 'react';
import { useParams, useHistory } from 'react-router-dom';

function AddLog({ profiles, updateProfiles }) {
  const [formData, setFormData] = useState({
    date: '',
    foodIntake: '',
    waterIntake: '',
    weight: '',
    notes: ''
  });

  const { id } = useParams();
  const history = useHistory();
  const profile = profiles.find(profile => profile.id === parseInt(id));

  if (!profile) {
    history.push('/');
    return null;
  }

  const handleChange = (e) => {
    const { name, value } = e.target;
    setFormData({ ...formData, [name]: value });
  };

  const handleAddLog = (e) => {
    e.preventDefault();

    const newLogData = {
      date: formData.date,
      foodIntake: parseInt(formData.foodIntake),
      waterIntake: parseInt(formData.waterIntake),
      weight: parseFloat(formData.weight),
      notes: formData.notes
    };

    fetch(`http://localhost:3001/profiles/${id}/logs`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(newLogData)
    })
    .then(response => {
      if (!response.ok) {
        throw new Error('Error adding log');
      }
      return response.json();
    })
    .then(data => {
      updateProfiles(data);
      setFormData({
        date: '',
        foodIntake: '',
        waterIntake: '',
        weight: '',
        notes: ''
      });
      history.push(`/profiles/${id}`);
    })
    .catch(error => {
      console.error('Error adding log:', error);
    });
  };

  return (
    <div>
      <h2>Add Log</h2>
      <form onSubmit={handleAddLog}>
        <label>Date:</label>
        <input type="date" name="date" value={formData.date} onChange={handleChange} required />
        <label>Food Intake:</label>
        <input type="number" name="foodIntake" value={formData.foodIntake} onChange={handleChange} required />
        <label>Water Intake:</label>
        <input type="number" name="waterIntake" value={formData.waterIntake} onChange={handleChange} required />
        <label>Weight:</label>
        <input type="number" name="weight" value={formData.weight} onChange={handleChange} required />
        <label>Notes:</label>
        <textarea name="notes" value={formData.notes} onChange={handleChange} required />
        <button type="submit">Add Log</button>
      </form>
    </div>
  );
}

export default AddLog;

Please message me if you need any more context surrounding my issue! 🙂

Eventlistener not working when mouse entering ID within svg file

I have created a simple code to mess around and learn with SVG files and eventlisteners.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SVG Mouse Pointer Change</title>
<style>
    #svg5 {
        width: 50%; /* Adjust the width as needed */
        height: auto; /* Maintain aspect ratio */
    }
</style>
<script>
    window.onload = function() {
        var svgObject = document.getElementById('svg5');
        svgObject.addEventListener('load', function() {
            var svgDocument = svgObject.contentDocument;
            var rect = svgDocument.getElementById('rect237');

          // Function to change mouse pointer to crosshair
            function changeCursorToCrosshair() {
                console.log("Mouse entered rect237");
                document.body.style.cursor = 'crosshair';
            }

            // Function to change mouse pointer to default
            function changeCursorToDefault() {
                console.log("Mouse left rect237");
                document.body.style.cursor = 'default';
            }

            // Add event listener for mouse enter
            rect.addEventListener('mouseenter', function() {
                console.log("Mouse entered rect237");
                changeCursorToCrosshair();
            });

            // Add event listener for mouse leave
            rect.addEventListener('mouseleave', function() {
                console.log("Mouse left rect237");
                changeCursorToDefault();
            });

        });
    };
</script>
</head>
<body>

<object id="svg5" type="image/svg+xml" data="./img/simple_pitch.svg"></object>

</body>
</html>

However when testing the code nothing occurs. I have added some console logs but nothing is shown. I hope someone can let me know what I’m missing.

Thanks

Error trying to predict in tensorflow js and react

i have an error when i try to predict with a lstm model in react with tensorflow js. The propuse of the react project is to translate sign languague and i use mediapipe holistic to detect keypoints of the face, hands and pose. To extract the keypoint i create a function that use the module “@d4c/numjs” to generate a Ndarray. With that i generate an array that allows me to count frames and predict, but when i try to predict this error appears:

ERROR
Error when checking model : the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see 1 Tensor(s), but instead got 0 Tensors(s**).

ValueError@http://localhost:3000/static/js/bundle.js:126537:5
checkInputData@http://localhost:3000/static/js/bundle.js:124254:13
predict@http://localhost:3000/static/js/bundle.js:124844:19
predict@http://localhost:3000/static/js/bundle.js:138492:23
onResults@http://localhost:3000/static/js/bundle.js:152:27
./node_modules/@mediapipe/holistic/holistic.js/</Vd/onResults/a.I<@http://localhost:3000/static/js/bundle.js:7788:15

I dont know if the problem is that i use the module “@d4c/numjs” for the project or if i missing a reshape of some sort. The summary of the model is this:


Layer (type) Input Shape Output shape Param #
========================================================================================== l
lstm_input (InputLayer) [[null,15,1662]] [null,15,1662] 0


lstm (LSTM) [[null,15,1662]] [null,15,64] 442112


lstm_1 (LSTM) [[null,15,64]] [null,15,128] 98816


lstm_2 (LSTM) [[null,15,128]] [null,128] 131584


dense (Dense) [[null,128]] [null,64] 8256


dense_1 (Dense) [[null,64]] [null,64] 4160


dense_2 (Dense) [[null,64]] [null,32] 2080


dense_3 (Dense) [[null,32]] [null,32] 1056


dense_4 (Dense) [[null,32]] [null,4] 132
========================================================================================== l
Total params: 688196
Trainable params: 688196
Non-trainable params: 0


The error occurs in this particular lines:

 kp_sequence.push(extractKeyPoints(results));

    if (kp_sequence.length > 15 && thereHand(results)) {
      count_frame++;
    } else {
        if (count_frame >= 5) {
             const kpArray = nj.stack(kp_sequence.slice(-15)).reshape([1, 15, -1]);
             const res = model.predict(kpArray).tolist()[0];

            if (res.indexOf(Math.max(...res)) > 0.7) {
              console.log("prediciendo");
              const sent = actions[res.indexOf(Math.max(...res))];
              sentence.unshift(sent);
              [sentence, repe_sent] = formatSentences(sent, sentence, repe_sent);
              } 
            count_frame = 0;
            kp_sequence = [];
        }
    }

I post the full code bellow, hope you can help me with this one, im new in javascript.Thanks¡¡

import * as tf from '@tensorflow/tfjs';
import './App.css';
import React, {useEffect, useRef} from 'react';
import Webcam from "react-webcam";
import * as cam from "@mediapipe/camera_utils";
import {FACEMESH_TESSELATION,HAND_CONNECTIONS,POSE_CONNECTIONS, Holistic} from '@mediapipe/holistic';
import './App.css';
import nj from "@d4c/numjs";  
import { log } from '@d4c/numjs/build/main/lib';

function App() {
  let model = undefined;
  var count_frame=0;
  var repe_sent=1;
  var kp_sequence=[];
  var sentence = [];

  const webcamRef = useRef(null);
  const canvasRef = useRef(null);
  const connect = window.drawConnectors;
  var camera = null;

  async function loadModel(){

    model = await tf.loadLayersModel('url');
    model.summary();
  }
  loadModel();


function formatSentences(sent, sentence, repe_sent) {
    if (sentence.length > 1) {
        if (sentence[1].includes(sent)) {
          repe_sent++;
            sentence.shift();
            sentence[0] = `${sent} (x${repe_sent})`;
        } else {
          repe_sent = 1;
        }
    }
    return [sentence, repe_sent];
}


  function thereHand(results) {
    return !!results.leftHandLandmarks || !!results.rightHandLandmarks;
}

  function extractKeyPoints(results) {
    let pose = [];

    if (results.poseLandmarks) {
        pose = nj.array(results.poseLandmarks.map(res => [res.x, res.y, res.z, res.visibility])).flatten().tolist();
    } else {
        pose = nj.zeros(33 * 4).tolist();
    }

    let face = [];
    if (results.faceLandmarks) {
        face = nj.array(results.faceLandmarks.map(res => [res.x, res.y, res.z])).flatten().tolist();
    } else {
        face = nj.zeros(468 * 3).tolist();
    }

    let lh = [];
    if (results.leftHandLandmarks) {
        lh = nj.array(results.leftHandLandmarks.map(res => [res.x, res.y, res.z])).flatten().tolist();
    } else {
        lh = nj.zeros(21 * 3).tolist();
    }

    let rh = [];
    if (results.rightHandLandmarks) {
        rh = nj.array(results.rightHandLandmarks.map(res => [res.x, res.y, res.z])).flatten().tolist();
    } else {
        rh = nj.zeros(21 * 3).tolist();
    }
   

    return nj.concatenate([face,pose, lh, rh]);
}

  function onResults(results){
 
    var actions = ['como estas','gusto en verte','hola','tanto tiempo'];

    const videoWidth = webcamRef.current.video.videoWidth;
    const videoHeight = webcamRef.current.video.videoHeight;

    // Set canvas width
    canvasRef.current.width = videoWidth;
    canvasRef.current.height = videoHeight;

    const canvasElement = canvasRef.current;
    const canvasCtx = canvasElement.getContext("2d");

    canvasCtx.save();
    canvasCtx.clearRect(0, 0, canvasElement.width, canvasElement.height);
    canvasCtx.drawImage(results.image, 0, 0,
                        canvasElement.width, canvasElement.height);
  
    canvasCtx.globalCompositeOperation = 'source-over';
    connect(canvasCtx, results.poseLandmarks, POSE_CONNECTIONS,
                   {color: '#00FF00', lineWidth: 4});
    connect(canvasCtx, results.poseLandmarks,
                  {color: '#FF0000', lineWidth: 2});
    connect(canvasCtx, results.faceLandmarks,FACEMESH_TESSELATION,
                   {color: '#C0C0C070', lineWidth: 1});
    connect(canvasCtx, results.leftHandLandmarks, HAND_CONNECTIONS,
                   {color: '#CC0000', lineWidth: 5});
    connect(canvasCtx, results.leftHandLandmarks,
                  {color: '#00FF00', lineWidth: 2});
    connect(canvasCtx, results.rightHandLandmarks, HAND_CONNECTIONS,
                   {color: '#00CC00', lineWidth: 5});
    connect(canvasCtx, results.rightHandLandmarks,
                  {color: '#FF0000', lineWidth: 2});
    canvasCtx.restore();

    kp_sequence.push(extractKeyPoints(results));

    if (kp_sequence.length > 15 && thereHand(results)) {
      count_frame++;
    } else {
        if (count_frame >= 5) {
             const kpArray = nj.stack(kp_sequence.slice(-15)).reshape([1, 15, -1]);
             const res = model.predict(kpArray).tolist()[0];

            if (res.indexOf(Math.max(...res)) > 0.7) {
              console.log("prediciendo");
              const sent = actions[res.indexOf(Math.max(...res))];
              sentence.unshift(sent);
              [sentence, repe_sent] = formatSentences(sent, sentence, repe_sent);
              } 

            count_frame = 0;
            kp_sequence = [];
        }
    }

  }



  useEffect(()=>{
    const holistic = new Holistic({
      locateFile: (file) => {
      return `https://cdn.jsdelivr.net/npm/@mediapipe/holistic/${file}`;
    }
  })

  holistic.setOptions({
    modelComplexity: 0,
    smoothLandmarks: true,
    enableSegmentation: true,
    smoothSegmentation: true,
    refineFaceLandmarks: false,
    minDetectionConfidence: 0.5,
    minTrackingConfidence: 0.5
  })
holistic.onResults(onResults);

if(typeof webcamRef.current!=="undefined" && webcamRef.current!==null){
    camera = new cam.Camera(webcamRef.current.video,{
      onFrame:async()=>{
        await holistic.send({image:webcamRef.current.video})
      },
      width:640,
      height:480
    });
    camera.start() 
}
})
return (
    <div className="App">
        <Webcam 
        ref={webcamRef}
          style= {{
            position:'absolute',
            marginRight:'auto',
            marginLeft:'auto',
            left:0,
            right:0,
            textAlign:'center',
            zIndex:9,
            width:640,
            height:480,
          }}
        />
        <canvas 
        ref={canvasRef}
          style= {{
            position:'absolute',
            marginRight:'auto',
            marginLeft:'auto',
            left:0,
            right:0,
            textAlign:'center',
            zIndex:9,
            width:640,
            height:480,
          }}>

        </canvas>
    </div>
  );
}
export default App;

Is there a way to use a user input variable into a specific parameter in an fetch API function?

I want to use the const value as a variable that can be slotted into the API url, specifically in the ingr= section. I don’t know how to make a user input interface in this case, and also I’m not sure how to use the body within the fetch function to specify where in the url that I want to slot in the user input variable. Please advise.

const value = "1 apple"

fetch('https://edamam-edamam-nutrition-analysis.p.rapidapi.com/api/nutrition-data?ingr=&nutrition-type=cooking', {
    "method": 'GET',
    "body": JSON.stringify({ search: value }),
    "headers": {
        'X-RapidAPI-Key': 'c4fd150a50msh880d519af0bfe67p156134jsn6aa2bf154889',
        'X-RapidAPI-Host': 'edamam-edamam-nutrition-analysis.p.rapidapi.com'
    }
})

.then(response => response.json())
.then(response => {

    console.log(response);
})
 .catch(error => {
    console.error(error);
});

I want the expected API to look something like this (the key and id aren’t important)

https://api.edamam.com/api/nutrition-data?app_id=d785be51&app_key=63b177d15cdfdcfab6b686540fd8e8cd&ingr=1 banana&type=public

Deployed by firebased website cannot see css file

Everything works when I’m using LiveServer in vscode. After deploying, website is working (html and json files) but without css file.

Here is link to my website: https://sklep-z-diy-kosmetykami.web.app/

  1. style.css is located with index.html in the same, public folder.

  2. I tried to find solution in DevTools and i found out that is has 404 error, even if (in my opinion) path is correct and i can clearly see style.css in that place.

  3. I also tried my website on incognito mode and its still not working.

como posso desabilitar qualquer clique do teclado em JAVASCRIPT [closed]

Olá !! Me chamo Weslley.

Estou escrevendo um jogo em JAVASCRIPT para aprimoramento técnico e quando o personagem “morre” ele trava na tela e o usuário precisa atualizar para começar o game novamente, POREM, mesmo morto o usuário consegue se mexer, preciso de algum código que cancele cliques no teclado e force o usuário a recarregar a página.

Estou pesquisando quando ao disable do keydown, mas não consegui formular em código de um modo que funciona, tipo
keydown = disabled;
??

JavaScript not working despite being valid in 2 validators [closed]

I posted a question earlier about adding an image URL for a background image as well as a background position and was directed to try using a js object rather than an array. This is the code I am trying to use but it just doesn’t. Trying various variations with no success.

var imgCount = 15;
var dir = "wp-content/themes/Stoq/home-images/";
var randomCount = Math.round(Math.random() * (imgCount - 1)) + 1;
var images = Object.create();
images[1] = { file: "1.jpeg", bkg: "center" };
images[2] = { file: "2.jpeg", bkg: "center" };
images[3] = { file: "3.jpeg", bkg: "center" };
images[4] = { file: "4.jpeg", bkg: "center" };
images[5] = { file: "5.jpeg", bkg: "center" };
images[6] = { file: "6.jpeg", bkg: "center" };
images[7] = { file: "7.jpeg", bkg: "center" };
images[8] = { file: "8.jpeg", bkg: "center" };
images[9] = { file: "9.jpeg", bkg: "center" };
images[10] = { file: "10.jpeg", bkg: "center" };
images[11] = { file: "11.jpeg", bkg: "bottom center" };
images[12] = { file: "12.jpeg", bkg: "center" };
images[13] = { file: "13.jpeg", bkg: "center" };
images[14] = { file: "14.jpeg", bkg: "center" };
images[15] = { file: "15.jpeg", bkg: "center" };
document.getElementById("random-bkg-img").style.background = "url(" + dir + images[randomCount].file + ")" + " images[randomCount].bkg ";

I have searched for examples and ran JavaScript through validators which don’t show any errors. I’m not very good as js so reaching the limit of my abilities here