Add transition animation when Bootstrap flex element is moved by creation of sibling

I have a simple HTML & Bootstrap element initiation as follows:

        <div class="container-fluid d-flex g-0 gap-3" id="map-div">
            <div class="row-fluid d-flex g-0 justify-content-around" id="map-row">
                <div class="d-flex g-0" id="map-col">
                    <svg id="map-svg"></svg>
                </div>
            </div>
        </div>

enter image description here

In my JavaScript, under certain conditions I add a sibling to the map-col as follows:

legend = d3.select("#map-row").insert("div")
    .attr("id", "legend-col")
    .attr("class", "g-0 fade-in shadow lh-sm")
    .style("height", "80%")
    .style("align-self", "center")

enter image description here

Is there a simple way (maybe with Bootstrap tags?) to animate the map-col transition to its new location without explicit specification, akin to "data-mdb-animation": "slide-left"?

React Bootstrap unasigned xml variable?

Hi I have 2 questions: First, in React bootstrap there is often used Xml like variable, but it has no value:

            <Bs.Modal
            show={this.state.isVisible}
            // onHide={this.props.onHide}
            scrollable={true}
            size="lg"
            aria-labelledby="contained-modal-title-vcenter"
            centered></Bs.Modal>

        

In this case its last attribute centered and I would like to ask how is this “undefined” variable called. And second question is, how to make this variable switchable, like {isCenteredtype && center}

Javascript Slideshow Image Container

So here is my code. I so far have the slide show worker with said given images.

The problem I am having is Containing + Stretching the images to fit inside of my container div. 🙂

Here is the code:

All help is welcome~! Thanks. ^^

var slideIndex = 0;
showSlides();

function showSlides() {
  var i;
  var slides = document.getElementsByClassName("mySlides");
  for (i = 0; i < slides.length; i++) {
    slides[i].style.display = "none";
  }
  slideIndex++;
  if (slideIndex > slides.length) {slideIndex = 1}
  slides[slideIndex-1].style.display = "block";
  setTimeout(showSlides, 2000); // Change image every 2 seconds
}
.imgContainer {
    padding-top: 80px;
    background-color: rgba(0, 0, 0, 0.603);
    width: 100%;
    height: 575px;
}

.img1 {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover; 
}
<div class="imgContainer" alt="imgContainer">
<img class="mySlides" src="/Users/stevenjeffers/Documents/GitHub/III/images/1.jpg" alt="imgj1">
<img class="mySlides" src="/Users/stevenjeffers/Documents/GitHub/III/images/2.jpg" alt="imgj1">
<img class="mySlides" src="/Users/stevenjeffers/Documents/GitHub/III/images/3.jpg" alt="imgj1">

</div>

Why my collector.on(‘collect’) event not working

client.on('messageCreate', message => {
    if(message.channel.id !== '928409019402575992') return;
    if(message.attachments.size == 0) return message.delete();
    const tik = client.emojis.cache.get('929061990721261650');
    const more = client.emojis.cache.get('929062097764110386');
    const carpi = client.emojis.cache.get('929062036468539493');
    const emojis = [
        tik,
        more,
        carpi
    ];
    message.react(tik);
    message.react(more);
    message.react(carpi);
    const filter = (r,  user) => {
        return !user.bot;
    }
    const collector = message.createReactionCollector(filter, {});
    collector.on('collect', (reaction, user) => {
        console.log(reaction);
        if(emojis.includes(reaction.emoji)){
            if(reaction.message.guild.members.cache.get(user).roles.has('909372241119162368')){
                if(reaction.emoji == tik){
                    reaction.message.member.roles.add('928409184037396520');
                } else if(reacion.emoji == more){
                    reaction.message.channel.send({ content: `${reaction.message.author} eksik bilgiler içeriyor attığın fotoğraf!` });
                } else if(reacion.emoji == carpi){
                    reaction.message.member.roles.remove('928409184037396520');
                }
            }
        }
    })
});

This is my code with discord.js@v13 it works fine to collector part but collector.on(‘collect’) event is never calling like you can see I add a console.log part to event’s start and its not triggering when I react can anyone help?(also there was a problem on normal code part so I write my code as snippet here)

On off loop system on javascript [duplicate]

Hi guys my function is not working..

function onoff() {
  if(a != true){
    var a = true
    alert("System is on")
  } else if(a == true) {
    var a = false
    alert("System is off")
  }
}

And this is the html

<button type="button" id="demo" onclick="onoff()">Click Me!</button>

I couldnt figure it out how can i do it.
Thx for your helping <33

Chrome extension for sending messages on twitch

I started to learn chrome extensions, I wanna make an extension with a list of phrases to send in twitch chat.

I have no intention of using the twitch api.

The first message is sent as it should, but the next ones nothing happens.

There’s a log that shows that messages arrive on the page, I don’t know what I’m doing wrong.

This is what I have:

manifest.json

{
    "manifest_version": 2,
    "name": "Default Messages",
    "version": "0.1",
    "offline_enabled": true,
    "background": {
      "persistent": false,
      "scripts": ["background.js"]
    },
    "content_scripts": [{
      "matches": ["*://*.twitch.tv/*"],
      "js": ["content.js"]
    }],
    "page_action": {
      "default_title": "Default messages",
      "default_popup": "popup.html"
    }
  }

background.js

chrome.runtime.onMessage.addListener((msg, sender) => {
  if (msg.from === "twitch" && msg.subject === "chat") {
    chrome.pageAction.show(sender.tab.id);
  }
});

content.js

chrome.runtime.sendMessage({
  from: "twitch",
  subject: "chat",
});

chrome.runtime.onMessage.addListener((msg, sender, response) => {
  if (msg.from === "defaultMessages" && msg.subject === "newMessage") {
    console.log(msg);
    let input = document.querySelectorAll("textarea")[0];
    let buttons = document.querySelectorAll("button");
    input.textContent = msg.content;
    input.dispatchEvent(new Event("input", { bubbles: true }));

    buttons.forEach((button) => {
      if (button?.dataset?.aTarget == "chat-send-button") {
        button.dispatchEvent(new Event("click", { bubbles: true }));
      }
    });

    response({
      from: "twitch",
      subject: "messageSent",
      id: msg.id,
    });
  }
});

popup.js

window.addEventListener("DOMContentLoaded", () => {
  let tab_id = undefined;
  chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
    tab_id = tabs[0].id;
  });

  document.querySelectorAll("button").forEach((button) => {
    button.addEventListener("click", function (e) {
      if (!e.target.disabled) {
        let content = e.target.textContent;
        let id = e.target.id;
        chrome.tabs.sendMessage(
          tab_id,
          {
            from: "defaultMessages",
            subject: "newMessage",
            content,
            id,
          },
          (resp) => {
            document.getElementById(resp.id).disabled = true;
          }
        );
      }
    });
  });
});

popup.html

<!DOCTYPE html>
<html lang="en">
   <head>
      <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
      <script type="text/javascript" src="./popup.js"></script>
   </head>
   <body>
      <div class="container">
         <div class="card mt-1" style="width: 15rem;">
            <div class="card-body">
               <div class="btn-group-vertical">
                  <button type="button" class="btn btn-outline-primary" id="hello">Hello</button>
                  <button type="button" class="btn btn-outline-primary" id="hi">Hi</button>
                  <button type="button" class="btn btn-outline-primary" id="how">How are you doing?</button>
               </div>
            </div>
         </div>
      </div>
   </body>
</html>

Modify contents of ckeditor with css

I am writing a text editing tool and utilizing CKEditor as my text editor. I want to know how to modify idividual words and sentences that is contained in the editor’s text area. For example highlighting words that are misspelt. How would I go about doing this?

Shopify non – embedded apps

I want to make Shopify non – embedded apps, I have installed the pre-built code which Shopify provides to build an embedded app. In the server.js file, after the user installs our app, it gets the access Token successfully. In order to make an API request to graphql server, it requires the access token to the headers. I am struggling with this point, I don’t know how to get that access token from the backend and make API calls on the frontend, I want to use Apollo Client to show query data on the frontend, but I don’t know how to use that accessToken after the merchants install the app, it has generated it in the server.js file, which is the backend. Are there any tutorials or docs on what I am trying to achieve.

Unable to convert class-based Linked List to function-based Linked List

Okay so I’m learning Data Structures where my tutorial is following class-based approach. So now I am trying to convert it to functions as I want to practice Linked Lists on Leetcode and Leetcode follows the functional approach. Can anybody help me with the conversion? I need only one method to be converted and I’ll be able to do the rest of them.

Here’s the class-based approach:

class Node {
    constructor( val ) {
        this.val = val;
        this.next = null;
    }
}

class SinglyLinkedList {
    constructor () {
        this.head = null;
        this.tail = null;
        this.length = 0;
    }

    push( val ) {
        const newNode = new Node( val );

        if ( !this.head ) {
            this.head = newNode;
            this.tail = this.head;
        } else {
            this.tail.next = newNode;
            this.tail = newNode;
        }
        this.length++
        return this;
    }

}

const list = new SinglyLinkedList();

list.push( 'HELLO' );
list.push( 'WORLD' );

Here’s what I tried so far to achieve function-based approach:

function Node( val ) {
  this.val = val;
  this.next = null;
}

let head = null;
let tail = null;
let length = 0;

const SinglyLinkedListFunc = function() {
    const newNode = new Node( 'HELLO' );
};

SinglyLinkedListFunc()

This is what I could achieve so far. And I’m stuck with it and I don’t know what to do next. Someone please help

How to gray out unused C++ variables in VSCode?

VSCode grays out unused variables/imports in JS and TS files.

I use VSCode for writing C++ code also and I have the C/C++ extension installed too.
I want VSCode to also gray out unused C++ variables in my code and maybe also show a warning (if possible), which isn’t the case at present in VSCode.

Does anyone know how can I achieve this in VSCode?

Problem with react Route (rendering a blank page

I am trying to render Register Component using Route, but instead it renders a blank page (the div tag with id=”root” is emty

this is what i did:
-This is the Register component File containing Register component

-This is the App component without using react Route
App component without React Route

-This is what it looks like in the browser:
component on the after being rendered

but then after using react Route in the App component:
App component using React route

it became like this in the web page:
The Register and the Header and the Footer components are gone

Webpacker can’t find script

I have a .html.erb file and I’m trying to import a .js file to it by doing this at the start of the .html.erb:

<%= javascript_pack_tag 'script' %>

I already installed the webpacker in my rails project, the script.js is in ./javascript/packs directory and I still keep getting this error:

Webpacker can’t find script in
/home/mateus/Desktop/zNote/public/packs/manifest.json. Possible
causes:

  1. You want to set webpacker.yml value of compile to true for your environment unless you are using the webpack -w or the
    webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker’s config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest. Your manifest contains: { }

My manifest file seems to be ok and also the webpacker.yml, I checked both but I still didn’t figure out how to solve this error. If I comment just this line <%= javascript_pack_tag 'script' %> the page loads without any errors and shows the HTML, but I need the javascript on it!