text scrambler / unscrambler on hover html javascript

I am trying to make it so that when i hover my div it does a “hacker” effect on the text inside and transitions it from just random letters into an actual word, then once i stop hovering, it does the same effect. either back to the “random” pre-written letters, or if possible actually random letters

This is the Code i currently have, the first 2 lines are to check if the element is on the current webpage as its apart of a multi web-page code.

let pxScreen1 = document.getElementsByClassName("screen1");

if ( pxScreen1 !== null ) {

  const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

  let interval = null;

  const screen = document.querySelector(".screen1"),
        name = document.querySelector(".name1");

  screen.onmouseenter = event => {  
    let iteration = 0;
    
    clearInterval(interval);
    
    interval = setInterval(() => {
      name.innerText = name.innerText
        .split("")
        .map((letter, index) => {
          if(index < iteration) {
            return name.dataset.value[index];
          }
        
          return letters[Math.floor(Math.random() * 26)]
        })
        .join("");
      
      if(iteration >= name.dataset.value.length){ 
        clearInterval(interval);
      }
      
      iteration += 1 / 3;
    }, 40);
  }
}

I want to make the normal sized browser Links to become a mobile size menu drop box?

import React from "react";
import { Link } from "react-router-dom";

function Header(){
    return(
        <>
         <h1 className="title">Ability Meals</h1>
        <nav style={{margin:10}}>
            <Link to="/" style={{ padding: 5 }}>Home</Link>
            <Link to="protein" style={{ padding: 5 }}>Protein</Link>
            <Link to="recipe" style={{ padding: 5 }}>Recipe</Link>
            <Link to="random" style={{ padding: 5 }}>Random</Link>

        </nav>
        </>
    )
};

export default Header;

Indexing nested JSON array

I have the following JSON example with an array under "results" that contains two objects. It can include hundreds of objects under the "results" array with the same keys and different values.

I do not have access to change this JSON file.

{
  "results": [
    {
      "title": "Information Collection Requests; Direct Loan Servicing-Regular; and Servicing Minor Program Loans",
      "type": "Notice",
      "abstract": "In accordance with the Paperwork Reduction Act (PRA) requirement, the Farm Service Agency (FSA) is requesting comments from all interested individuals and organizations on a revision of two currently approved information collection requests, Direct Loan Servicing--Regular and Servicing Minor Program Loans, respectively. In the Direct Loan Servicing--Regular, the information is used to determine borrower compliance with loan agreements, assist the borrower in achieving business goals, and regular servicing of the loan account such as graduation, subordination, partial release, use of proceeds, and consent. In Servicing Minor Program Loans, the information collected is used to perform routine and special servicing actions for loans authorized and serviced under FSA's Minor Loan Program.",
      "document_number": "2023-05464",
      "html_url": "https://www.federalregister.gov/documents/2023/03/17/2023-05464/information-collection-requests-direct-loan-servicing-regular-and-servicing-minor-program-loans",
      "pdf_url": "https://www.govinfo.gov/content/pkg/FR-2023-03-17/pdf/2023-05464.pdf",
      "public_inspection_pdf_url": "https://public-inspection.federalregister.gov/2023-05464.pdf?1678970722",
      "publication_date": "2023-03-17",
      "agencies": [
        {
          "raw_name": "DEPARTMENT OF AGRICULTURE",
          "name": "Agriculture Department",
          "id": 12,
          "url": "https://www.federalregister.gov/agencies/agriculture-department",
          "json_url": "https://www.federalregister.gov/api/v1/agencies/12",
          "parent_id": null,
          "slug": "agriculture-department"
        },
        {
          "raw_name": "Farm Service Agency",
          "name": "Farm Service Agency",
          "id": 157,
          "url": "https://www.federalregister.gov/agencies/farm-service-agency",
          "json_url": "https://www.federalregister.gov/api/v1/agencies/157",
          "parent_id": 12,
          "slug": "farm-service-agency"
        }
      ],
      "excerpts": "In accordance with the Paperwork Reduction Act (PRA) requirement, the Farm Service Agency (FSA) is requesting comments from all interested individuals and organizations on a revision of two currently approved information collection requests, Direct..."
    },
    {
      "title": "Notice of Funding Opportunity for the Socially Disadvantaged Groups Grant for Fiscal Year 2023",
      "type": "Notice",
      "abstract": "This notice announces that the Rural Business-Cooperative Service (RBCS, Agency), a Rural Development (RD) agency of the United States Department of Agriculture (USDA), invites applications for grants under the Socially Disadvantaged Groups Grant (SDGG) program for Fiscal Year (FY) 2023. This notice is being issued to allow applicants sufficient time to leverage financing, prepare and submit their applications, and give the Agency time to process applications within FY 2023. A total of $3,000,000 in grant funding will be available for FY 2023. Successful applications will be selected by the Agency for funding and subsequently awarded to the extent that funding may ultimately be made available through appropriations. All applicants are responsible for any expenses incurred in developing and submitting their applications.",
      "document_number": "2023-05441",
      "html_url": "https://www.federalregister.gov/documents/2023/03/17/2023-05441/notice-of-funding-opportunity-for-the-socially-disadvantaged-groups-grant-for-fiscal-year-2023",
      "pdf_url": "https://www.govinfo.gov/content/pkg/FR-2023-03-17/pdf/2023-05441.pdf",
      "public_inspection_pdf_url": "https://public-inspection.federalregister.gov/2023-05441.pdf?1678970718",
      "publication_date": "2023-03-17",
      "agencies": [
        {
          "raw_name": "DEPARTMENT OF AGRICULTURE",
          "name": "Agriculture Department",
          "id": 12,
          "url": "https://www.federalregister.gov/agencies/agriculture-department",
          "json_url": "https://www.federalregister.gov/api/v1/agencies/12",
          "parent_id": null,
          "slug": "agriculture-department"
        },
        {
          "raw_name": "Rural Business-Cooperative Service",
          "name": "Rural Business-Cooperative Service",
          "id": 456,
          "url": "https://www.federalregister.gov/agencies/rural-business-cooperative-service",
          "json_url": "https://www.federalregister.gov/api/v1/agencies/456",
          "parent_id": 12,
          "slug": "rural-business-cooperative-service"
        }
      ],
      "excerpts": "This notice announces that the Rural Business-Cooperative Service (RBCS, Agency), a Rural Development (RD) agency of the United States Department of Agriculture (USDA), invites applications for grants under the Socially Disadvantaged Groups Grant..."
    }
  ]
}

I have the following code to get and display the values I need from each key in the array, as so:

const xmlhttp = new XMLHttpRequest();
xmlhttp.onload = function() {
  const myArr = JSON.parse(this.responseText);

  let text = "";
  for (let i in myArr.results) {
    text += "<div class='fed-reg-container'><h2 class='title'>" + myArr.results[i].title + "</h2><p>" + myArr.results[i].type + "</p><p>" + myArr.results[i].agencies[0].raw_name + " Document # " + myArr.results[i].document_number + "</p><p>Posted on: " + myArr.results[i].publication_date + "</p><p>" + myArr.results[i].abstract + "</p><a class='fed-reg-button' href='" + myArr.results[i].html_url + "'>Read More</a></div>";
  }
  text += "";
  document.getElementById("demo").innerHTML = text;
};
xmlhttp.open(
  "GET",
  "https://www.federalregister.gov/api/v1/documents.json?conditions%5Bagencies%5D%5B%5D=agriculture-department&conditions%5Bagencies%5D%5B%5D=federal-highway-administration&conditions%5Bagencies%5D%5B%5D=fish-and-wildlife-service&conditions%5Bagencies%5D%5B%5D=forest-service&conditions%5Bagencies%5D%5B%5D=interior-department&conditions%5Bagencies%5D%5B%5D=international-boundary-and-water-commission-united-states-and-mexico&conditions%5Bagencies%5D%5B%5D=land-management-bureau&conditions%5Bagencies%5D%5B%5D=national-highway-traffic-safety-administration&conditions%5Bagencies%5D%5B%5D=national-park-service&conditions%5Bagencies%5D%5B%5D=reclamation-bureau&conditions%5Bagencies%5D%5B%5D=environmental-protection-agency&conditions%5Bagencies%5D%5B%5D=council-on-environmental-quality&conditions%5Bagencies%5D%5B%5D=safety-and-environmental-enforcement-bureau&conditions%5Bagencies%5D%5B%5D=environment-office-energy-department&conditions%5Bcomment_date%5D%5Bgte%5D=05%2F01%2F2023&conditions%5Bcomment_date%5D%5Blte%5D=01%2F01%2F2050&conditions%5Bterm%5D=arizona&conditions%5Btype%5D%5B%5D=RULE&conditions%5Btype%5D%5B%5D=PRORULE&conditions%5Btype%5D%5B%5D=NOTICE",
  true
);
xmlhttp.send();
.fed-reg-container {
  background-color: black;
  color: white;
  padding: 20px;
  margin: 20px 0;
}

.title {
  color: #fcb900;
}

.fed-reg-button {
  background-color: #fcb900;
  color: black;
  padding: 10px;
  display: block;
  max-width: 100px;
  text-align: center;
  font-weight: 600;
  text-decoration: none;
}
<!DOCTYPE html>
<html>

<body>
  <p id="demo"></p>

</body>

</html>

Everything works great except one thing.

As you can see, my json has a nested array under "agencies" with multiple objects.

I’m trying to use indexing to grab each value under the raw_name of each object.

If I use + myArr.results[i].agencies[0].raw_name it works for a single object. Could be [0] or [1].

When I try to grab the second value like + myArr.results[i].agencies[0].raw_name + " - " + myArr.results[i].agencies[1].raw_name, it breaks the whole code. I get nothing in return. Just a white page.

Any idea what I’m doing wrong?

Thanks!

Why value of a variable won’t make it to the function?

I’m facing rather strange behaviour from this block of code:

minimal example:

let childID;
let x = 2;

function printIt(childID) {
  console.log(childID); // prints out "undefined" ????
}

setInterval(() => {
  console.log(childID); // prints out 10 when x changes to 2;
  if (x === 1) {
    clearInterval();
    printIt(childID);
  } else if (x === 2) {
    childID = 10;
    x = 1;
  }

}, 2000);

Can someone explain ?

Uncaught DiscordjsError TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role

I got this error: Uncaught DiscordjsError TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role.

I’m trying to get the bot’s ticket function to work, but whenever I click on the emoji to create a ticket, an error message saying ” Uncaught DiscordjsError TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role.” pops up…

This is my code:

'use strict';

const Role = require('./Role');
const { TypeError } = require('../errors');
const Permissions = require('../util/Permissions');
const Util = require('../util/Util');

/**
 * Represents a permission overwrite for a role or member in a guild channel.
 */
class PermissionOverwrites {
  constructor(guildChannel, data) {
    /**
     * The GuildChannel this overwrite is for
     * @name PermissionOverwrites#channel
     * @type {GuildChannel}
     * @readonly
     */
    Object.defineProperty(this, 'channel', { value: guildChannel });

    if (data) this._patch(data);
  }

  _patch(data) {
    /**
     * The ID of this overwrite, either a user ID or a role ID
     * @type {Snowflake}
     */
    this.id = data.id;

    /**
     * The type of a permission overwrite. It can be one of:
     * * member
     * * role
     * @typedef {string} OverwriteType
     */

    /**
     * The type of this overwrite
     * @type {OverwriteType}
     */
    this.type = data.type;

    /**
     * The permissions that are denied for the user or role.
     * @type {Readonly<Permissions>}
     */
    this.deny = new Permissions(data.deny).freeze();

    /**
     * The permissions that are allowed for the user or role.
     * @type {Readonly<Permissions>}
     */
    this.allow = new Permissions(data.allow).freeze();
  }

  /**
   * Updates this permissionOverwrites.
   * @param {PermissionOverwriteOptions} options The options for the update
   * @param {string} [reason] Reason for creating/editing this overwrite
   * @returns {Promise<PermissionOverwrites>}
   * @example
   * // Update permission overwrites
   * permissionOverwrites.update({
   *   SEND_MESSAGES: false
   * })
   *   .then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
   *   .catch(console.error);
   */
  update(options, reason) {
    const { allow, deny } = this.constructor.resolveOverwriteOptions(options, this);

    return this.channel.client.api
      .channels(this.channel.id)
      .permissions[this.id].put({
        data: { id: this.id, type: this.type, allow: allow.bitfield, deny: deny.bitfield },
        reason,
      })
      .then(() => this);
  }

  /**
   * Deletes this Permission Overwrite.
   * @param {string} [reason] Reason for deleting this overwrite
   * @returns {Promise<PermissionOverwrites>}
   */
  delete(reason) {
    return this.channel.client.api.channels[this.channel.id].permissions[this.id].delete({ reason }).then(() => this);
  }

  toJSON() {
    return Util.flatten(this);
  }

  /**
   * An object mapping permission flags to `true` (enabled), `null` (unset) or `false` (disabled).
   * ```js
   * {
   *  'SEND_MESSAGES': true,
   *  'EMBED_LINKS': null,
   *  'ATTACH_FILES': false,
   * }
   * ```
   * @typedef {Object} PermissionOverwriteOptions
   */

  /**
   * @typedef {object} ResolvedOverwriteOptions
   * @property {Permissions} allow The allowed permissions
   * @property {Permissions} deny The denied permissions
   */

  /**
   * Resolves bitfield permissions overwrites from an object.
   * @param {PermissionOverwriteOptions} options The options for the update
   * @param {Object} initialPermissions The initial permissions
   * @param {PermissionResolvable} initialPermissions.allow Initial allowed permissions
   * @param {PermissionResolvable} initialPermissions.deny Initial denied permissions
   * @returns {ResolvedOverwriteOptions}
   */
  static resolveOverwriteOptions(options, { allow, deny } = {}) {
    allow = new Permissions(allow);
    deny = new Permissions(deny);

    for (const [perm, value] of Object.entries(options)) {
      if (value === true) {
        allow.add(Permissions.FLAGS[perm]);
        deny.remove(Permissions.FLAGS[perm]);
      } else if (value === false) {
        allow.remove(Permissions.FLAGS[perm]);
        deny.add(Permissions.FLAGS[perm]);
      } else if (value === null) {
        allow.remove(Permissions.FLAGS[perm]);
        deny.remove(Permissions.FLAGS[perm]);
      }
    }

    return { allow, deny };
  }

  /**
   * The raw data for a permission overwrite
   * @typedef {Object} RawOverwriteData
   * @property {Snowflake} id The id of the overwrite
   * @property {number} allow The permissions to allow
   * @property {number} deny The permissions to deny
   * @property {OverwriteType} type The type of this OverwriteData
   */

  /**
   * Data that can be resolved into {@link RawOverwriteData}
   * @typedef {PermissionOverwrites|OverwriteData} OverwriteResolvable
   */

  /**
   * Data that can be used for a permission overwrite
   * @typedef {Object} OverwriteData
   * @property {GuildMemberResolvable|RoleResolvable} id Member or role this overwrite is for
   * @property {PermissionResolvable} [allow] The permissions to allow
   * @property {PermissionResolvable} [deny] The permissions to deny
   * @property {OverwriteType} [type] The type of this OverwriteData
   */

  /**
   * Resolves an overwrite into {@link RawOverwriteData}.
   * @param {OverwriteResolvable} overwrite The overwrite-like data to resolve
   * @param {Guild} guild The guild to resolve from
   * @returns {RawOverwriteData}
   */
  static resolve(overwrite, guild) {
    if (overwrite instanceof this) return overwrite.toJSON();
    if (typeof overwrite.id === 'string' && ['role', 'member'].includes(overwrite.type)) {
      return { ...overwrite, allow: Permissions.resolve(overwrite.allow), deny: Permissions.resolve(overwrite.deny) };
    }

    const userOrRole = guild.roles.resolve(overwrite.id) || guild.client.users.resolve(overwrite.id);
    if (!userOrRole) throw new TypeError('INVALID_TYPE', 'parameter', 'User nor a Role');
    const type = userOrRole instanceof Role ? 'role' : 'member';

    return {
      id: userOrRole.id,
      type,
      allow: Permissions.resolve(overwrite.allow),
      deny: Permissions.resolve(overwrite.deny),
    };
  }
}

module.exports = PermissionOverwrites;

I admit to being lost and not knowing how to solve this problem… Can you help me?

cypress mochawesome report cucumber issue

I’m currently integrating cypress mochawesome report with using cucumber but when the index.html file is generated with the test cases, if a click on any test, all I see is JS code, not the cucumber steps executed. Please help me, I’m currently using the version 3.4.0 of cypress mochawesome reporter. Here are my configs of my cypress project:

Cypress.config.js





const { defineConfig } = require("cypress");
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild");


module.exports = defineConfig({
  reporter: 'cypress-mochawesome-reporter', 
  e2e: {
    setupNodeEvents(on, config) {
      require('cypress-mochawesome-reporter/plugin')(on)






And here a screenshot of the issue in the index.html test cases
[var _a2, _b, _c, _d, _e;
const { remainingSteps, testCaseStartedId } = retrieveInternalSpecProperties();
if (context.messagesEnabled) {
  taskTestCaseStarted({
    id: testCaseStartedId,
    testCaseId,
    attempt: attempt++,
    timestamp: (0, messages_1.createTimestamp)()
  });
}
window.testState = {
  gherkinDocument,
  pickles,
  pickle
};
for (const step of steps) {
  if (step.hook) {
    const hook = step.hook;
    cy.then(() => {
      delete window.testState.pickleStep;
      const start = (0, messages_1.createTimestamp)();
      if (context.messagesEnabled) {
        taskTestStepStarted({
          testStepId: hook.id,
          testCaseStartedId,
          timestamp: start
        });
      }
      return cy.wrap(start, { log: false });
    }).then((start) => {
      (0, cypress_1.runStepWithLogGroup)({
        fn: () => registry2.runHook(this, hook),
        keyword: hook.keyword,
        text: hook.tags
      });



  [1]: https://i.stack.imgur.com/I0V08.png

Error: Missing audio recording permissions when using Expo and expo-av

I am developing an app using Expo and I’m encountering an issue with audio recording permissions. When I try to start recording by clicking a button in my app, I receive the following error message in the console:

LOG  Requesting permissions..
LOG  Starting recording..
ERROR  Failed to start recording [Error: Missing audio recording permissions.]

No dialog appears to ask for microphone permission, i also modified the startRecording function on line where it asks for permission, i added .then and .catch but it directly goes to catch statement, meaning the permission is automatically getting denied

I have tried the following steps to resolve the issue:

Added the necessary microphone permission to my app.json file by including the expo-av plugin with the “microphonePermission” configuration.

Verified that the microphone permission is correctly set to “Allow Anonimia to access your microphone.” in the app.json file.

Updated the plugins section in app.json to remove the microphonePermission key with a value of false in the expo-image-picker plugin configuration.

Rebuilt the development client and ensured that I am using the latest version of the expo-cli and expo sdk.

Despite these attempts, the error persists, and I am unable to start recording audio in my app. I would greatly appreciate any insights or guidance on how to resolve this issue. Thank you in advance for your help.

REST api call POST return data response from a function into another variable in Javascript

I have the following code that does a POST to an api. I put it in a function and it works and gives me a response of all the data received back for confirmation. But now I want to return the data back from the function to do something else. As seen below, I put a return in the function but it doesn’t actually return anything from the function. What could be wrong?

const https = require('https');
xxx = postNode('Hello world 9999', 'nothing here', '356', '3');
console.log(xxx);

function postNode (title, body, parent, page) {
  
  ...BUNCH OF CODE HERE...
    
  const request = https.request(options, (response) => {
    let data = '';

    response.on('data', (chunk) => {
      data += chunk;
    });

    response.on('end', () => {
      console.log('Response:', data);  <-- This works!
      return data;  <--- This Doesn't work...
    });
  });

  request.on('error', (error) => {
    console.error('Error:', error);
  });

  request.write(postData);
  request.end();

}

Confused by this advanced curried function, how is it working?

I’ve been learning about currying functions and I understood the basic examples I read up on, however I’d really like to understand this example that was given of an advanced function but I’m finding it confusing, if anyone can help break it down that would be great, I understand curry takes in a function and then this function’s arguments are gathered into an array with ...args but I’m not sure about the logic after or how it’s working.

const curry = (fn) => {
  return curried = (...args) => {
    if (fn.length !== args.length) {
      return curried.bind(null, ...args)
    }
    return fn(...args);
  };
}
const totalNum = (x, y, z) => {
  return x + y + z
}
const curriedTotal = curry(totalNum);
console.log(curriedTotal(10)(20)(30));

javascript getting boolean propertie is undefined into a JSON stringified object why?

with the following piece of code, i am not able to get a boolean property of object

var objBizarre =
  '{"LastName":"LastName2","FirstName":"FirstName2","Email":"[email protected]","PhoneNumber":"0606060605","BirthDate":"2023-01-10T13:46:23.337Z","WheelCharAccessible":true}';
var obj = JSON.parse(objBizarre);

console.log('elements list');
for (var elem in obj) {
  console.log(elem + '-' + typeof elem + ' - ' + obj[elem]);
}

console.log('LastName');
console.log('value #1a lastname meth1: ' + obj.LastName);
console.log('value #1b lastname meth2: ' + obj['LastName']);
console.log('WheelChairAccessible');
console.log('value #2a WheelChairAccessible: ' + obj.WheelChairAccessible); //undefined displayed
console.log('value #2b WheelChairAccessible: ' + obj['WheelChairAccessible']);//undefined displayed

I get ‘undefined’ when I try to display the value of the ‘WheelChairAccessible’ propertie of my object
it is very strange because when I use a loop which dsiplay all elements, it is OK

any advice ?

How can we put attribute value in v-if using vuejs?

How can we put attribute value in v-if using vuejs ?

<template v-for="cat0 in categoreis" :key="cat0.id"> 
<i v-if="cat0.id==[parentId]"  class="fas float-left fa-plus"></i>
<li v-if="cat1.parent !== null && cat1.parent == cat0.id" class="child-cat-mobile" :parentId="[cat1.parent]">

I am looking for syntax
so that it can be like this code
I use the parentId attribute in v-if

<li v-if="cat1.parent !== null && cat1.parent == cat0.id" class="child-cat-mobile" :parentId="[cat1.parent]">

v-if="cat0.id==[parentId]"

How do you track phone click links on GA4 alone?

I have been searching for a way to track phone click links on GA4 WITHOUT the use of Google Tag Manager and have not been able to find any information. I know it’s possible because otherwise how would 3rd party and GTM be able to track them

Any guidance would be helpful.

No success in adding Leaflet.markercluster-1.4.1 to a Leaflet Map

I had a fully working map with over 800 markers displayed and needed to cluster the markers. The code is quite long to retrieve the marker data and so I did not include it.

Should Lealfet.markercluster work with the latest Leaflet versions?

I upgraded to using Leaflet 1.9.3. I also use JQuery v2.2. I have no other software added. I expected the software to provide clusters and not crash the page with error 500.