I am Not able to add components in the body of html

the website

I am trying to make a simple social network website. I am using a top navigation panel and a side navbar.
The problem I am facing is that I am not able to add any components in the blank area that you are able to see in the image.

This is my HTML body with the CSS I am using:-

//css code for sidebar
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  :root {
  --primary-color: #D96AA7;
  --secondary-color: #422C73;
  --complimentary-color: #88BFB5;
  --contrast-color: #F2E527;
  --light-color: #D2A9D9;
  }
  
  .container {
    background: #191919;
    min-height: 100vh;
    font-family: Montserrat, sans-serif;
  }
  
  nav a {
      font-size: 40px;
      color: #fff;
      text-decoration: none;
      padding: 20px;
      text-align: center;
  }
  
  nav {
      position: fixed;
      left: 0;
      z-index: 50;
      display: flex;
      justify-content: space-around;
      flex-direction: column;
      height: 100vh;
      background: var(--secondary-color);
  }
  
  section {
      position: absolute;
      top: 0;
      height: 100vh;
      width: 0;
      opacity: 0;
      transition: all ease-in .5s;
      display: flex;
      justify-content: center;
      align-items: center;
  } 
  
 
  
  /* Styles applied on trigger */
  section:target {
      opacity: 1;
      position: absolute;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 10;
  }
  
  section:target h1 {
      opacity: 0;
      animation: 2s fadeIn forwards .5s;
  }
  
  #first {
    background:var(--primary-color);
  }
  #second {
      background: var(--complimentary-color);
  }
  
  #third {
      background: var(--contrast-color);
  }
  
  #fourth {
      background: var(--light-color);
  }
  
  @keyframes fadeIn {
      100% { opacity:1 }
  }
  
  
  //css code for top navigation
  
  .topnav {
    background-color: #333;
    overflow: hidden;
  }
  
  /* Style the links inside the navigation bar */
  .topnav a {
    float: left;
    display: block;
    color: #f2f2f2;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 17px;
  }
  
  /* Change the color of links on hover */
  .topnav a:hover {
    background-color: #ddd;
    color: black;
  }
  
  /* Add an active class to highlight the current page */
  .topnav a.active {
    background-color: #04AA6D;
    color: white;
  }
  
  /* Hide the link that should open and close the topnav on small screens */
  .topnav .icon {
    display: none;
  }
  @media screen and (max-width: 600px) {
    .topnav a:not(:first-child) {display: none;}
    .topnav a.icon {
      float: right;
      display: block;
    }
  }
  
  /* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens (display the links vertically instead of horizontally) */
  @media screen and (max-width: 600px) {
    .topnav.responsive {position: relative;}
    .topnav.responsive a.icon {
      position: absolute;
      right: 0;
      top: 0;
    }
    .topnav.responsive a {
      float: none;
      display: block;
      text-align: left;
    }
  }
<body>
<style>
      a {
        text-decoration: none;
        color: white;
      }
    </style>
    
    <!--this is the top navigation bar-->
    <div class="topnav" id="myTopnav">
      <a href="/painting.jpg" class="active">Home</a>
      <a href="/dancing.png">Chit-Chat</a>
      <script>
        function myFunction() {
          var x = document.getElementById("myTopnav");
          if (x.className === "topnav") {
            x.className += " responsive";
          } else {
            x.className = "topnav";
          }
        }
      </script>
      <a href="javascript:void(0);" class="icon" onclick="myFunction()">
        <i class="fa fa-bars"></i>
      </a>
    </div>
    
    <!--this is side navbar-->
    <nav>

      <a href="#first"
        ><abbr title="PROGRAMMING"
          ><img src="assets/programming.jpg" height="100" ,width="100" /></abbr
      ></a>
      <a href="#second"
        ><abbr title="SINGING"
          ><img src="assets/singing.jpg" height="100" ,width="100" /></abbr
      ></a>
      <a href="#third"
        ><abbr title="DANCING"
          ><img src="assets/dancing.png" height="100" ,width="100" /></abbr
      ></a>
      <a href="#fourth"
        ><abbr title="PAINTING"
          ><img src="assets/painting.jpg" height="100" ,width="100" /></abbr
      ></a>
    </nav>
    
    
    <div class="container">
      <section id="first">
        <div class="outer">
          <div class="inner">
            <label><a href="/index.html">Back</a></label>
          </div>
        </div>
        
      </section>

      <section id="second">
        <div class="outer">
          <div class="inner">
            <label><a href="/index.html">Back</a></label>
          </div>
        </div>
      </section>

      <section id="third">
        <div class="outer">
          <div class="inner">
            <label><a href="/index.html">Back</a></label>
          </div>
        </div>
      </section>

      <section id="fourth">
        <div class="outer">
          <div class="inner">
            <label><a href="/index.html">Back</a></label>
          </div>
        </div>
      </section>
    </div>
    
    
    
  </body>

my side navbar opens a div with a close button for now in it as you might be able to see

but I don’t understand where I should put the code I want in the blank space.
if I am adding it after my side navbar code it is displaying it in a space under the blank area.

I am using the code for the side navbar from the internet, that is why i am not able to figure it out
pls help

Blockchain Service Wallet V3 API Error – Wrong captcha

I’m using Blockchain’s API (https://github.com/blockchain/service-my-wallet-v3)

I’ve begun to receive this error, when I try to create new wallet using api/v2/create ({“success”:false,”message”:”Wrong captcha“}).

Everything was working before then it just randomly started giving me this error out of nowhere. I am running node service and sending my requests to it – Service v0.26.3, Node v6.4.0

I have tried asking Blockchain for assistance multiple times over the past 2 months but have not heard back from them.

Does anyone know how to resolve this issue? They did some kind of new update not long ago and it seemed to have affected the API somehow.

Why does a single assignment to one 2d array cell fill two cells at once in Javascript?

I have this code from this leetcode question:


function digArtifacts(n: number, artifacts: number[][], dig: number[][]): number {
    
    const land: boolean[][] = new Array(n).fill(new Array(n).fill(false))
    console.log(land)
    
    dig.forEach(spot => {
        console.log(spot, spot[0], spot[1])
        land[spot[0]][spot[1]] = true
        console.log(land)
    })
    
    console.log(land)
    return 0

};

With this input

n = 2
artifacts = [[0,0,0,0],[0,1,1,1]]
dig = [[0,0],[0,1]]

With this stdout:

[ [ false, false ], [ false, false ] ]

[ 0, 0 ] 0 0

[ [ true, false ], [ true, false ] ] **but expected => [ [ true, false ], [ false, false ] ]

[ 0, 1 ] 0 1

[ [ true, true ], [ true, true ] ] **but expected [ [ true, true ], [ false, false ] ]
[ [ true, true ], [ true, true ] ] **but expected [ [ true, true ], [ false, false ] ]

Why do land[1][0] === true and land[1][1] === true when they are never accessed?

AMCharts 4 Directed Tree – Find a Node and Zoom it

I’m trying to search a node in a Force Directed Tree with Amcharts 4 using JavaScript. After I found the node, I’d like to zoom the chart on the node.

I’m trying to search the node by its name in the DOM but it’s not working as expected.

chart.zoomToDataItem(itemToFind, zoom = 1.85, true);

Unfortunatly I don’t know how to find an item, and I can’t find in the doc either. Does any one can help me ?

Thank you for your help,

Kind Regards

Is there a way to convert a youtube video ID into an embed? [closed]

So I want to have code that can convert a Youtube video ID (for example: Dr1S8DfNiKw) convert it into a youtube embed
(for example:<iframe width="560" height="315" src="https://www.youtube.com/embed/Dr1S8DfNiKw" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>)

OnClick not working properly on div with 200% of its parent height

I’m building a schedule component (image below) on React using a table, for the cells I provide the starting table cell and a length (number).

schedule component

On the cell I use style={{ height: ${100 * length}% }}, but this doesn’t work well with the OnClick prop, because it only registers mouse clicks up to 100% of the parent container (example on the gif below).

behaviour demonstration gif

Is there a way to make the OnClick prop work for the entire height of the div?

Code Sandbox:

https://codesandbox.io/s/friendly-agnesi-nm2mek?file=/pages/index.tsx

webpack, jquery and dynamic form field

I’m using webpack and jQuery in my symfony project.
I configured webpack and jquery as follows :

// webpack.common.js
const path = require('path');
var webpack = require('webpack');

module.exports = {
  entry: {
    main: "./src/default/index.js"
  },
  output: {
    filename: '[name].bundle.js',
    path: path.resolve(__dirname, 'dist'),
    clean: true,
  },
  module: {
    rules: [
      { 
        test: /datatables.net.*/, 
        use: [{
          loader: 'imports-loader',
          options: {
            additionalCode: 
              "var define = false;"
          }
        }]
      },
      {
        test: require.resolve("jquery"),
        loader: "expose-loader",
        options: {
          exposes: ["$", "jQuery"],
        },
      },
      {
        test: /.(scss)$/,
        use: [{
          // inject CSS to page
          loader: 'style-loader'
        }, {
          // translates CSS into CommonJS modules
          loader: 'css-loader'
        }, {
          // Run postcss actions
          loader: 'postcss-loader',
          options: {
            // `postcssOptions` is needed for postcss 8.x;
            // if you use postcss 7.x skip the key
            postcssOptions: {
              // postcss plugins, can be exported to postcss.config.js
              plugins: function () {
                return [
                  require('autoprefixer')
                ];
              }
            }
          }
        }, {
          // compiles Sass to CSS
          loader: 'sass-loader'
        }]
      },
      {
        test: /.css$/i,
        use: ["style-loader", "css-loader"],
      }
    ]
  },
  resolve: {
    alias: {
      jquery: "jquery/src/jquery"
    }
  },
  plugins: [
    new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery",
        "window.jQuery": "jquery"
    })
  ]
}
// index.js
import 'bootstrap';

import './scss/app.scss';

import '@fortawesome/fontawesome-free/js/fontawesome';
import '@fortawesome/fontawesome-free/js/solid';
import '@fortawesome/fontawesome-free/js/regular';
import '@fortawesome/fontawesome-free/js/brands';

require('select2');

require('jquery-ui/ui/widgets/datepicker');
require('jquery-ui/ui/i18n/datepicker-fr.js')

import 'datatables.net';
import dt from 'datatables.net-bs5';

import 'datatables.net-bs5/css/dataTables.bootstrap5.min.css';

dt(window, $);

My project needs to load external javascript script (old style) so I need to access $ outside of webpack. This scripts use Select2 plugin for initialize autocompletion on select form element.

So far so good.

I’m facing a problem when I want to add dynamically a field that use jQuery select2 Plugin (after page loading).

When I do this (adding new select2 field in my form) and initialize select field with select2 :

if ( "undefined" !== typeof jQuery ) {
    (function($, window, document) {
        $(function() {
           $('.select2-element').select2(config);
        });
    }(window.jQuery, window, document));
}

The result is : “Select2 is not defined.”

First test

When I do :

if ( "undefined" !== typeof jQuery ) {
    (function($, window, document) {
        $(function() {
           console.info($.fn);
        });
    }(window.jQuery, window, document));
}

The result shows me that select2 is in the $.fn list ($.fn.select2). But the same code invoked after page loading show me that select2 is not in the list.

Second test

When I do on page loading :

if ( "undefined" !== typeof jQuery ) {
    (function($, window, document) {
        $(function() {
           console.info(jQuery);
           console.info($);
        });
    }(window.jQuery, window, document));
}

The return of console.info(jQuery) is not the same as console.info($). In the first I don’t have select2 in jQuery.fn but it is present in $.fn .

I identified that the $ object used after page loading is same as jQuery object above not $ object above.

Thanks for your help.

File System Access API + WebWorker + Recording Webm video and audio sample

Is there a sample that can encode a ReadableStream transferred to a worker into a webm format with audio and stream it to the file system using the new File System Acccess API? I was able to use one of the samples which has a modified webm-writer2.js file and achieve everything video related on a worker, but I am stuck on finding an encoder and muxer that can do both audio and video streams in the worker using the new WebCodecs API.

This example has a workaround for audio, but it relies on AudioContext which can only be used on the main thread. This can become problematic and cause interruptions on the main loop as it needs to constantly read chunks from an event.
https://github.com/xiph/opus/issues/221

My goal is to record a video/audio stream, transfer the MediaStream entirely off the main thread for processing and stream, mux it all into a single webm container, and save it to the file system without any memory limits. Does anyone have a working solution that can build off that sample and include audio?

Here’s some references:

webm-writer2.js (video only so far)
https://github.com/w3c/webcodecs/tree/main/samples/capture-to-file

Audio encoding problem?
https://github.com/xiph/opus/issues/221

Transferring media stream to worker via track processor
https://github.com/w3c/webcodecs/issues/43

Best way to use same variables on Object Destructuring in JavaScript

I have these two custom react hooks using as below passing the same variables in object destructuring.

const {data, loading, error} = useFetch(url);
const {data, loading, error} = usePostForm(url);

of course, this won’t work because it’s using the same variables.
what’s the best way to change this codes? without changing original custom hooks

Only way I can do is as below codes; but my problem is there is no way to know what are the objects/data are returning from custom hooks.

const fetch1 = useFetch(url)
const fetch2 = usePostForm(url)

fetch1.data fetch1.error fetch1.loading
fetch2.data fetch2.error fetch2.loading

Anyone has better idea ? please let me know

How to get particular element with a className?

I am using target.getElementsByClassName('numerical')) to get the list of elements with classname of numerical . I want to further filter only th from the list. How can i do that?

0: th.ant-table-cell.numerical
1: th.ant-table-cell.numerical
2: td.ant-table-cell.numerical
3: td.ant-table-cell.numerical

How to make soft triangle in CSS?

I want to create a soft triangle like here:

enter image description here

But what I get is:

span {
  display:inline-block;
  padding:50px;
  position:relative;
  background: linear-gradient(135deg, transparent 15px , #ff4369 20px, #ff4369 50%, white 51%),radial-gradient(circle at 20px 20px, #ff4369 20px, transparent 22px);
}
span+span {padding:75px;}
span:last-of-type {padding:28px;}
span:before {
  display:block;
  content:'padding';
  white-space:nowrap;
  position:absolute;
  transform:rotate(-45deg);
  top:calc(50% - 1.2em);
  left:0;
}
span + span:before {content:'instead background-clip';}
span:last-of-type:before {content:'56px'}
<span></span>
<span></span>
<span></span>

Or on: https://codepen.io/gc-nomade/pen/wjgBQL

Have somebody some idea how to make it?