Week calendar needs to save data based on option (of month and week) selected

I have a weekly calendar that is 7 todo lists. When you input data, the data stays the same when a new option is selected (of option “month” and “week”), though the date does update (from “Sunday 1/1 to Saturday 4/1 for ex.) I want the LI’s to remain on the particular dates they were entered on and I’m not sure how to approach this.

A snippet of the HTML:

<div class="sub-section">
    <h2>Month: 
        <select name="month" id="select-month">
            <option value="January">January</option>
            <option value="February">February</option>
            <option value="March">March</option>
            <option value="April">April</option>
            <option value="May">May</option>
            <option value="June">June</option>
            <option value="July">July</option>
            <option value="August">August</option>
            <option value="September">September</option>
            <option value="October">October</option>
            <option value="November">November</option>
            <option value="December">December</option>
        </select>
    </h2>

    <h2>Week:
        <select name="week" id="select-week">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
        </select>
    </h2>
</div><!-- sub-section -->

<div class="move-center">
    <div class="week-group">

        <div class="day scrollable" id="monday">
            <div class="span"><h3 class="day-title">Monday</h3></div>
            <input type="text" class="input">
            <button>
                <img src="/Images/plus.png" id="add-button">
            </button>
            <ul class="list"></ul>
        </div>

and this is the Javascript I have tried to use to get the data to save across each individual day per option selected:

const plannerData = {};

function saveData() {
const month = document.getElementById('select-month').value;
const week = document.getElementById('select-week').value;

if (plannerData[month] && plannerData[month][week]) {
plannerData[month][week] = {};
}

 const days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];
 const dayData = {};

for (const day of days) {
 const listItems = document.querySelectorAll(`#${day} ul.list li`);
 dayData[day] = Array.from(listItems).map(item => item.textContent);
}

if (!plannerData[month]) {
 plannerData[month] = {};
}
plannerData[month][week] = dayData;

console.log(plannerData);
}

document.getElementById('select-month').addEventListener('change', saveData);

document.getElementById('select-week').addEventListener('change', saveData);

I’m still new to javascript so if it’s staring me in the face I’m so sorry lol
Thank you very much for any suggestions

problems with library vue-sweetalert in my project, not load the styles

I have the next problem.
I’m using vue-sweetalert in my project (electron-vue)
So I import the library in main.js but is not load the styles:
enter image description here

I have this in my main, I have another directory to import the library vue-sweetalert
enter image description here
enter image description here

have someone happened the same problem? Help me please.

  • I need help I not have time

adding java snake game to my html website

I build a snake game in java,
Also im in the middle of building portfolio website to myself (html css and js).
There is a way to make the snake game run in the website (the frame will we on the website),
or open by itself (the frame will popUp like in the IDE)?
I can add the snake game code if needed..
its just a frame class with a panel on it, and everything is paint on the panel with calsses for the snake parts the apple and etc..

Thank you very much for the help 🙂

Problems with the function that determines when to start translation transitions

This question of mine derives from the lack of an openly exact or better approach than the others.
I have a single page html site and I want to implement a scroll reveal without using external libraries. In the case of top-to-bottom transitions, for example, the IntersectionObserver fires based on the position of the element moved for the transition and not based on its final position. This causes the animation to start as soon as the translated object enters the viewport and not when it actually scrolls to its final height. I need to figure out what approach to use for my function that detects when to initiate transitions.

My javascript now:

var elementiDaOsservare = document.querySelectorAll('.osservato');
var callback = function(items) {
    items.forEach((item) => {
        var position = item.target.getBoundingClientRect();
        if (item.isIntersecting) {
            item.target.classList.add("mostrato");
        } else if (position.top > 0) { // rimuove la classe mostrato solo se l'item si trova nella parte non visibile superiore dello schermo
            item.target.classList.remove("mostrato");
        }
    });
}
var observer = new IntersectionObserver(callback, {threshold: 0.3});
elementiDaOsservare.forEach((element) => {
    observer.observe(element);
});

JavaScript blacklisted word error of typescript with no module

My Code Is This

my code

Im to dumb to paste my code here
This is my code on pastebin
Sry for this

Thanks when any person edit my code correctly thank your
Really then i are beginner in javascript and not got with this ok

const client = new Discord.Client();
const config = require('../config.json');
const ds = require('discord.js');
const bot = new ds.Client();
 
 
 //blackliste
let Blacklist = ['blacklist', 'foo']
 
//delte messages
module.exports = class invite {
  function userInfo(message) {
  for(let word of Blacklist){
    if(message.content.toLowerCase().includes(word)){
      message.delete()
      message.author.send(`Hello ${client.user} do not say this words!`)
      break;
      }
  }
}
 
}

Billing software due bill solve issue

How can i solve due bill ??

table-design

output

i have a table there are 5 month of client data, i want to show running month data and addition of a single client bill show in due bill column,
i can show only running month of all client data. but i want to the sum of all bills due for 1 user in the last month will be shown in the due bill column

what is the query code for it ??

I want to create a billing software use PHP & MySQL

Convert existing mocha tests to livedoc mocha

I’ve been able to integrate livedoc-mocha into an existing repo from the steps here: Add livedoc-mocha to existing project

Now the issue I am having is converting the tests to use the livedoc-mocha format. For example, the deposit-pool-tests.js file looks like this:

export default function() {
contract('RocketDepositPool', async (accounts) => {

    // Accounts
    const [
        owner,
        node,
        trustedNode,
        staker,
        random,
    ] = accounts;

    // Setup
    before(async () => {
        // Register node
        await registerNode({from: node});

        // Register trusted node
        await registerNode({from: trustedNode});
        await setNodeTrusted(trustedNode, 'saas_1', '[email protected]', owner);
    });

    //
    // Deposit
    //

    it(printTitle('staker', 'can make a deposit'), async () => {
        // Deposit
        await deposit({
            from: staker,
            value: '10'.ether,
        });

        // Get current rETH exchange rate
        let exchangeRate1 = await getRethExchangeRate();

        // Update network ETH total to 130% to alter rETH exchange rate
        let totalBalance = '13'.ether;
        let rethSupply = await getRethTotalSupply();
        await submitBalances(1, totalBalance, 0, rethSupply, {from: trustedNode});

        // Get & check updated rETH exchange rate
        let exchangeRate2 = await getRethExchangeRate();
        assertBN.notEqual(exchangeRate1, exchangeRate2, 'rETH exchange rate has not changed');

        // Deposit again with updated rETH exchange rate
        await deposit({
            from: staker,
            value: '10'.ether,
        });
    });

My attempt of doing this with livedoc-mocha looks like this:

feature(`Deposit Pool Tests`, () => {
background(`Background steps`, () => {
    given(`Account setup`, async () => {
        contract('RocketDepositPool', async (accounts) => {
                // Accounts
                const [
                    owner,
                    node,
                    trustedNode,
                    staker,
                    random,
                ] = accounts;

            // Register node
            await registerNode({from: node});

            // Register trusted node
            await registerNode({from: trustedNode});
            await setNodeTrusted(trustedNode, 'saas_1', '[email protected]', owner);
        });
    });
});

    scenario("Staker Can Make a Deposit", () => {
        given("Staker deposits 10 Ether", async () => {
            // Deposit
            await deposit({
                from: staker,
                value: '10'.ether,
            });
        });
    });
});

This generates the following results:

Feature: Deposit Pool Tests
Background: Background steps
  √ Given Account setup (624ms)
Scenario: Staker Can Make a Deposit
  1) Given Staker deposits 10 Ether


  1 passing (644ms)
  1 failing

  1) Feature: Deposit Pool Tests
       Scenario: Staker Can Make a Deposit
       Given Staker deposits 10 Ether:
     ReferenceError: staker is not defined

I can’t figure out how to wrap the whole feature file in the contract and run the setup steps only once. Background is supposed to run once for each scenario which isn’t exactly the behavior I want.

I want to use Javascript to fill in a form in an iframe. Is that even allowed? Both sites are on the same TLD [duplicate]

I want to fill in this form https://www.zwilling.com/uk/newsletter-subscription/newsletter-subscription.html using Javascript (e.g., document.getElementById('firstname').value='Alice'😉

The iframe is on the same TLD, but a different subdomain (cloud.mailing.zwilling.com).

Is this even allowed? If yes, how do I target the iframe from the outer document?

There are a lot of questions about this on SE but they typically concerns extensions or situations where the outer document and the iframe are on completely different domains.

Why am I getting styled is not a function when building my component library with Rollup?

I have an internal component library that is using React, styled-components, framer-motion, Rollup and Storybook. I have a NextJS website that consumes the library and when I try to use it I am getting the following error:

TypeError: styled is not a function

Bellow is the code from the built library which the error points to.

var React = require('react');
var styled = require('styled-components');
var framerMotion = require('framer-motion');

const ButtonElm = styled(framerMotion.motion.button)`
    padding: ${props => props.padding};
    border-radius: ${props => props.theme.radii.default};
    font-size: ${props => props.fontSize};
    ${props => (props.bold ? "font-weight: bold" : null)};
    text-align: center;
    cursor: pointer;
    width: auto;
    display: inline-block;
    text-decoration: none;
`;

I am not sure how to address this bug at all and while I have tried some ways of changing the build configuration, nothing has worked so far. I am not sure what exactly is causing the issue.

Thank you for your help in advance.

How to convert srt file to vtt then append video

Video files generally work on vtt files So I want it to convert the file to vtt first, then put it dynamic into video I have two different files One of them converts VTT files to video but not able to receive srt file It can accept both files at the same time, via the input file The second converts the srt file to vtt but does not convert it to video

first, my code appended vtt file to the video I went to convert srt to vtt after that append it to the video.

<lablel>Subtitles: <input id="subtitlet" type="file"></lablel>

<video id="video" src="123.mp4" controls>
    <track id="subtitles" kind="subtitles" label="English captions" srclang="en" default>
</video>
<script>
const $ = document.querySelector.bind(document);

$('#subtitlet').addEventListener('change', () => {
  // approach 1
  $('#subtitles').src = URL.createObjectURL($('#subtitlet').files[0]);

  // approach 2
  let track = document.createElement('track');
  track.src = URL.createObjectURL($('#subtitlet').files[0]);

  $('#video').appendChild(track);
});
</script>

second convert srt to vtt but not append to video I went append to video in this link

convert srt to vtt after appending to video HTML

Adding dynamic inputs to a symbol in an animate html5 document

Am trying to add an input to a symbol in an html5 file using adobe animate, but the inputs is not seen on stage but I can see it when i console log Here is the script;

var symbolInstance = this.pos;

var inputElement = document.createElement("input");
inputElement.type = "text";

var domElement = new createjs.DOMElement(inputElement);
symbolInstance.addChild(domElement);

Am expecting to see the input on stage

How can I control single and double quotes in string transfers from PHP to Javascript?

I’m trying to copy strings that have escaped single and double quotes from PHP to Javascript.
When I get the string having escaped quotes on the server into Javascript the escape back slashes are gone.

Ultimately I’m trying to transfer JSON from the server to the client javascript.
The string values in the JSON may have single or double quotes.
I have to use single quotes to denote the string literal on the client because JSON is full of double quotes. That means all single quotes in the string must be escaped.


<?php 
$s = "this's a test";
echo $s;
?>
<html><body><script>
    console.log('<?= $s?>'); //displays: this's a test
</script></body></html>

Animation React Portal

Good days. This is the problem: on my NextJS project, there is a full-screen menu made using React Portal, which opens in the form of a slide bar that exits from the right side of the screen. I needed to make an animation of the appearance and disappearance of this screen. I decided not to use libraries like CSSTransition, I used the @keyframes animation on css. Everything turned out fine with the animation of the appearance of the screen. But there is a problem with his disappearance. This exit screen is closed in three ways – by pressing the Escape key, by pressing one of the menu items on this screen, and by pressing the button that previously served to open this screen. It is the animation that does not work when the screen is closed by pressing the button. You can see it on the website https://next-site-ivory-six.vercel.app /. Burger button in the upper right corner.

Since Portal simply deletes the created content when the state changes to false, it is almost impossible to animate it without libraries. But I decided to animate not just the modal block itself, but its internal container, and start the animation at the moment of clicking on the menu, escape or button, and close the modal block itself with some delay, which I created using setTimeout.

const [endAnimation, setEndAnimation] = useState(false);

    const checkIfClickedEsc = e => {
        if ( e.code === "Escape" ) {
            setEndAnimation(true);
            setTimeout(() => {
                onClose()
            }, 100)
        }
    }

    const handleCloseClick = () => {
        setEndAnimation(true);
        setTimeout(() => {
            onClose();
        }, 100)
    };

Here is a code that simply changes the state to the opposite (toggle) when clicked.

    const handleClick = () => {
        setShowSlideScreen(!showSlideScreen);
    };

Perhaps the problem is that I incorrectly distributed two useState hooks (with showing and hiding the modal block and with the start of the animation) by files (only three files are involved in this case), maybe I just don’t understand what and where yet, since I recently started studying React.

Below I give the full code of my three components – Header, which integrates the button, slideScreen, which contains the code of the modal block and Nav, which contains the menu located inside the slideScreen. Please help anyone who can. Thanks

//header.js
import React, { useState, useEffect } from "react";
import Link from "next/link";
import ThemeToggle from "@/components/themeSwitcher";
import SlideScreen from "@/components/global/slideScreen";
import styles from "@/styles/header.module.css"

export default function Header() {

    const headerInnerClasses = [styles.headerInner, "wrapper"].join(" ")

    const [showSlideScreen, setShowSlideScreen] = useState(false);

    const handleClick = () => {
        setShowSlideScreen(!showSlideScreen);
    };

    const menuBtnClasses = [showSlideScreen ? `${styles.menuBtnActive} ${styles.menuBtn}` : `${styles.menuBtn}`, "mainBtn"].join(" ")

    useEffect(() => {
        document.body.className = showSlideScreen ? "isSlideActive" : "";
    });

    return (
        <header className={styles.header}>
            <div className={headerInnerClasses}>
                <Link className={styles.headerLogo} href='/'>
                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 160"><path d="M10 20 0 29.9v-5.5L5 20zM28 20 0 46.9v-5.5L22 20zM40 27 0 64.9v-5.5L40 21zM40 44 0 81.9v-5.5L40 38zM40 61 0 98.9v-5.5L40 55zM40 78 0 115.9v-5.5L40 72zM40 95 0 132.9v-5.5L40 89zM40 112 0 149.9v-5.5L40 106zM40 129 7 160H1l39-37zM40 146l-15 14h-6l21-20zM40 160h-3l3-3z" fill="#494949"/><path d="M128 107.7 69.7 73.9l58.3-34V0L0 73.9 88 126v34h40z" fill="#f65f59"/></svg>
                </Link>

                <div className={styles.headerActions}>
                    <ThemeToggle/>
                    <button className={menuBtnClasses} onClick={handleClick}>
                        <div className={styles.burger}></div>
                    </button>
                </div>
            </div>
            {showSlideScreen &&
                <SlideScreen
                    onClose={() => setShowSlideScreen(false)}
                    showSlideScreen={showSlideScreen}
                />}
        </header>
    )
}

//slideScreen.js
import React, { useEffect, useState, useRef } from "react";
import ReactDOM from "react-dom";
import styles from "@/styles/slideScreen.module.css"
import Nav from "@/components/nav";

//import { CSSTransition } from "react-transition-group";



const SlideScreen = ({onClose}) => {

    const [isBrowser, setIsBrowser] = useState(false);

    const [endAnimation, setEndAnimation] = useState(false);

    const checkIfClickedEsc = e => {
        if ( e.code === "Escape" ) {
            setEndAnimation(true);
            setTimeout(() => {
                onClose()
            }, 100)
        }
    }

    const handleCloseClick = () => {
        setEndAnimation(true);
        setTimeout(() => {
            onClose();
        }, 100)
    };

    useEffect(() => {
        setIsBrowser(true);
        document.addEventListener("keydown", checkIfClickedEsc)
        return () => {
            document.removeEventListener("keydown", checkIfClickedEsc)
        }

    }, []);

    const inScreenClasses = [endAnimation ?  `${styles.inScreen} ${styles.close}`  : `${styles.inScreen}`, "dotsBg"].join(" ")

    const slideScreenContent = (
        <div className={styles.slideScreen}>
            <div className={inScreenClasses}>
                <div className="wrapper">
                    <Nav handleCloseClick={handleCloseClick} />
                </div>
            </div>
        </div>
    )

    if (isBrowser) {
        return ReactDOM.createPortal(
            slideScreenContent,
            document.getElementById("modal-root")
        )
    } else {
        return null;
    }

}

export default SlideScreen;


//nav.js
import React, { useState } from "react";
import Link from "next/link";
import {useRouter} from "next/router";

import styles from "@/styles/header.module.css"

const Nav = ({handleCloseClick}) => {
    const router = useRouter();
    const routes = ['Blog', 'Work', 'Contact'];
    const routesRu = ['Блог', 'Работы', 'Контакты'];

    return (
        <nav className={styles.headerNav}>
            <ul className={styles.headerMenu}>
                {routes.map((route, i) => {
                    return (
                        <li key={route} className={`${router.pathname === `/${route.toLowerCase()}`}`}>
                            <Link
                                href={`/${route.toLowerCase()}`}
                                onClick={handleCloseClick}
                                >{routesRu[i]}</Link>
                        </li>
                    )
                })}
            </ul>
        </nav>
    )

}

export default Nav

How to use airbnb style guide with NextJS?

I would like to use the airbnb style guide with my NextJS 13.4.9 project. When creating an NextJS app, one is asked about enable ESlint. I imagine saying “yes” to this is the recommended way. This allows one to npm run lint or npx next lint.

This simple guide explains how to install airbnb style guide, but it gives conflict with the latest version of NextJS. See below.

According to the NextJS doc on ESLint, eslint-config-next includes

  • eslint-plugin-react
  • eslint-plugin-react-hooks
  • eslint-plugin-next

So it would be temping to uninstall the eslint-config-next package, and then install these packages myself to get versions that don’t conflict.

Question

If I do this, will I then lose some NextJS specific linting?

Or what is the recommended way to add airbnb style guide to the next lint?

$ npm install -D eslint-config-airbnb 

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint-plugin-react-hooks
npm ERR!   eslint-plugin-react-hooks@"5.0.0-canary-7118f5dd7-20230705" from [email protected]
npm ERR!   node_modules/eslint-config-next
npm ERR!     eslint-config-next@"13.4.9" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev eslint-config-airbnb@"*" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint-plugin-react-hooks
npm ERR!   peer eslint-plugin-react-hooks@"^4.3.0" from [email protected]
npm ERR!   node_modules/eslint-config-airbnb
npm ERR!     dev eslint-config-airbnb@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.