Any way to keep VideoJS DOM element showing on source change?

is there any way to always keep videoJS (version 7) showing up on changing the media source (player.src)?
Currently, when I change the source, I notice a very small flap … And I don’t know how to fix this behavior. The player basically disappears for a very short time when changing the source (about ~200 ms) and then it shows again …

Thanks in advance

How to get PrimaryID value of a data when clicking on a link value in the Datatable

I am using ASP.NET Core 6 MVC C#. I have a table like this:

   <div class="card-body">
        <table class="table display table-bordered" id="DATATABLE"></table>         
   </div>

I have a Student class with StudID (int – PrimaryID), Name (string), Class (int) properties. And the table is shown like this.

         [stud](https://i.stack.imgur.com/DDfWh.png)

In the above pic, the Class value 9 is a hyperlink and 100 is the PrimaryID of that row.

I am looking for a way to get the PrimaryID when clicking on 9.

What I have tried is as shown below.

     $("#DATATABLE").DataTable({
         serverSide: true,
         filter: true,
         searchDelay: 1000,
         scrollY: StaticData.TABLE_HEIGHT + 'px',
         lengthMenu: StaticData.TABLE_PAGE_SIZE,            
         scrollCollapse: true,
         ajax: {
          url: '/STUD_MANAGEMENT/LoadStudents',
          type: 'GET',
          datatype: 'json',
          headers: { 'RequestVerificationToken': 'your json token' },                
          dataSrc: (json) => {
          json = json.data;              
          return json;
         }
         },
         columnDefs: [{ className: "dt-center", targets: [3], width: '2%', }],
         columns: [
         { data: 'STUD_ID', title: 'Stud ID', autoWidth: false, visible : false },
         { data: 'NAME', title: 'Name', autoWidth: true },
         { data: "CLASS", title: 'Class', autoWidth: true,
                 "render": function(data, type, row, meta){
                 if(type === 'display')
                 {
                    data = '<a href="' + data + '" onclick = "clickLink()">' + data + '</a>';
                 }
                     return data;
                }
            }           
        ],
     });


      function clickLink() {
        alert('studid is ??? ');
        }

Entering & Existing Transitions with React Native Reanimated

I have a pretty basic component which is just a banner that shows at the top of a form. I have configured some entering and existing transitions that work as needed. They look good for my use case so no issue there.

However, I am stuck on how to make the sibling components not collapse as the banner is “exiting”.

My parent component is something like this:

Form.tsx

<View>
  <FeedbackBanner ... showBanner={showBanner} />
  
  ... other components
</View>

When I trigger the banner to hide by setting showBanner to false, the exiting transition below runs but the layout immediately shifts and the animation for existing is now behind the “other components”. What is the best way to ensure the entering / existing transitions are not hidden by the other components during a layout shift etc.? Just starting to learn using react-native-reanimated and can’t seem to figure out the best way in this use case.

FeedbackBanner.tsx

import { Pressable, View } from 'react-native';
import Typography from '../Typography';
import SVG from '@/assets/svg';
import Animated, {
  Easing,
  LinearTransition,
  SlideInLeft,
  SlideOutRight
} from 'react-native-reanimated';

type Props = {
  title: string;
  description: string;
  onClosePress?: () => void;
  showBanner?: boolean;
};

const FeedbackBanner = ({ title, description, showBanner, onClosePress }: Props) => {
  if (!showBanner) return null;
  return (
    <Animated.View
      className="flex flex-row overflow-hidden rounded border border-Feedback-Error bg-Neutral-White dark:bg-Neutral-White"
      key={'feedback-banner'}
      exiting={SlideOutRight.duration(500).easing(Easing.ease)}
      entering={SlideInLeft.duration(500).easing(Easing.ease)}
    >
      <View className="h-[100%] w-[8px] bg-Feedback-Error dark:bg-Feedback-Error"></View>
      <View className="flex-1 flex-row justify-between gap-1 px-4 py-3">
        <View className="flex flex-col">
          <Typography font="inter-semiBold">{title}</Typography>
          <Typography className="!color-Neutral-Grey-80 dark:!color-Neutral-Grey-80">
            {description}
          </Typography>
        </View>

        <Pressable onPress={onClosePress}>
          <View>
            <SVG.Close
              className="fill-Neutral-Grey-90 dark:fill-Neutral-Grey-90"
              height={24}
              width={24}
            />
          </View>
        </Pressable>
      </View>
    </Animated.View>
  );
};

export default FeedbackBanner;

Why am I getting this error? Module not found: Error: Can’t resolve ‘./logo.svg’

I am starting out with a fresh react app. As long as I want to build a new application, it is necessary to have some files deleted such as logo.svg.

I have deleted the logo.svg file and also deleted the “import logo from ‘./logo.svg’;” in App.js.

Anyway, I am getting the following error message: “Module not found: Error: Can’t resolve ‘./logo.svg'”[enter image description here](https://i.stack.imgur.com/BNk10.png)

I have deleted the icon.svg file and also deleted the “import logo from ‘./logo.svg’;” in App.js. I was expecting to get a blank page in order to start with my new application.

Why is my vue application update route but not router-view

I’m having a hard time understanding why my router-view is not being updated in root template of App.vue while route is being correctly changed.

Here is my router, it correctly navigates to /:user page and updates view accordingly but when i try to navigate from MainUserView navbar to UserProfile it changes route to /some_user/profile but do not render new view.

import {createRouter, createWebHistory} from "vue-router"

import MainView from "@/views/MainView.vue";
import UserProfile from "@/views/Profile.vue";
import MainUserView from "@/views/MainUserView.vue";

const routes = [
    {
        path: "/",
        name: "home",
        component: MainView
    },
    {
        path: "/:user",
        name: "User View",
        component: MainUserView,
        children: [
            {
                path: "profile",
                name: "User profile view",
                component: UserProfile
            }
        ]
    },
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes,
});


export default router;

Here is my App.vue

<template>
  <div id="wrapper">
    <MainView v-if="!user || user !== 'lukasz' && user !== 'karolina'"/>

    <navbar v-if="user"></navbar>
    <section class="section">
      <router-view/>
    </section>
  </div>

</template>

<script>
import MainView from './views/MainView.vue'
import Navbar from "@/components/Navbar.vue";

export default {
  name: 'App',
  data(){
    return {

    }
  },
  computed: {
    user() {
      return this.$store.state.user;
    }
  },
  components: {
    Navbar,
    MainView,
  },
  beforeCreate() {
    this.$store.dispatch("initializeUser");
  },
  created(){
     console.log("DUPA2")
  }
}
</script>

And navbar template from which I’m routing to UserProfile

<template>
  <div class="wrapper">
    <nav class="navbar " :class="{'is-danger': user === 'karolina', 'is-info' : user === 'lukasz'}">
      <div class="navbar-brand">
        <router-link to="/" class="navbar-item" @click="clearUser">
          <strong>Choose again</strong>
        </router-link>
        <a class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbar-menu">
          <span aria-hidden="true"></span>
          <span aria-hidden="true"></span>
          <span aria-hidden="true"></span>
        </a>
      </div>
      <div class="navbar-menu" id="navbar-menu">
        <div class="navbar-end">
          <router-link to="/send-message" class="navbar-item"
          >Send message
          </router-link
          >
          <!-- <router-link :to="{name: 'User View', params: {user: 'lukasz'}}"> -->
          <router-link :to="{name: 'User profile view', params: {user: user}}" class="navbar-item"
          >Your Profile
          </router-link
          >
        </div>
      </div>
    </nav>
  </div>
</template>

<script>
export default {
  name: "NavbarComponent",
  props: {
  },
  methods: {
    clearUser() {
      this.$store.commit("clearUser");
    }
  },
  computed:{
    user() {
      return this.$store.state.user;
    }
  }
}
</script>

I tried to move navbar from App.vue to maybe MainUserView but it did not help. Also displaying just router-view inside App.vue do not help so i assume the problem lays in different place.

Thanks for any help!

use my calculator data as variables in chart

I have a calculator built in Jquery, I would like to pass these numbers to my chart js program and have the chart dynamically adjust as new results show in the calculations,

how would I do this with my code bellow ?

**
Calculator (jquery)
**

 jQuery(function($){
    // Function that formats a raw price amount
    function formatPrice( rawPrice ) {
        return rawPrice.toLocaleString("en-US", {
            style: "currency",
            currency: "USD"
        });
    }

    $('form#roi').on('click', '.calculate-roi', function() {
        const cost_by_industry = parseInt($("#cost_by_ind").val()),
            cost_by_employee_count = parseInt($("#cost_by_employee_c").val()),
            no_empoyees = parseInt($("#no_emp").val()),
            month_invest = parseInt($("#month_inv").val()),
            expected_a_grow = 0.05,
            aas = 120000,
            fpr = 0.75,
            avr = 0.75,
            //managed risk year 1
            mr_result1 = ((0.3 * (cost_by_industry + cost_by_employee_count)) / 2) * 0.2,
            //managed risk year 2
            mr_result2 = mr_result1 * (1 + expected_a_grow),
            //managed risk year 3
            mr_result3 = mr_result2 * (1 + expected_a_grow),
            //managed risk total
            mr_results_total = mr_result1 + mr_result2 + mr_result3,
            //Empower Analysts year 1
            ea_result1 = (no_empoyees / 2000) * aas,
            //Empower Analysts year 2
            ea_result2 = ea_result1 * (1 + expected_a_grow),
            //Empower Analysts year 3
            ea_result3 = ea_result2 * (1 + expected_a_grow),
            //Empower Analysts total
            ea_results_total = ea_result1 + ea_result2 + ea_result3,
            //TP year 1
            tp1_results = month_invest * (1 - fpr) * 3 * 2 * (aas / 2080) * 12,
            //fp year 1
            fp1_results = month_invest * fpr * 3 * 1 * (aas / 2080) * 12,
            //TP year 2
            tp2_results = month_invest * (1 - avr) * (1 - fpr) * 3 * 1 * (aas / 2080) * 12,
            //fp year 2
            fp2_results = month_invest * (1 - avr) * fpr * 3 * 0.5 * (aas / 2080) * 12,
            //reduce aleart vol year 1
            rav_results_1 = tp2_results + fp2_results + tp1_results + fp1_results,
            //reduce aleart vol year 2
            rav_results_2 = rav_results_1 * (1 + expected_a_grow),
            //reduce aleart vol year 3
            rav_results_3 = rav_results_2 * (1 + expected_a_grow),
            //reduce aleart vol total
            rav_results_total = rav_results_1 + rav_results_2 + rav_results_3;

        $("#output").show();
        $(".manage_risk_1").text(formatPrice(mr_result1));
        $(".manage_risk_2").text(formatPrice(mr_result2));
        $(".manage_risk_3").text(formatPrice(mr_result3));
        $(".results_total").text(formatPrice(mr_results_total));
        $(".emp_results_1").text(formatPrice(ea_result1));
        $(".emp_results_2").text(formatPrice(ea_result2));
        $(".emp_results_3").text(formatPrice(ea_result3));
        $(".emp_results_total").text(formatPrice(ea_results_total));
        // $(".tp1_results").text(tp1_results);
        // $(".tp2_results").text(tp2_results);
        // $(".fp1_results").text(fp1_results);
        // $(".fp2_results").text(fp2_results);
        $(".rav_results_1").text(formatPrice(rav_results_1));
        $(".rav_results_2").text(formatPrice(rav_results_2));
        $(".rav_results_3").text(formatPrice(rav_results_3));
        $(".rav_results_total").text(formatPrice(rav_results_total));
    });
});

Chart JS

const data = {
  labels: [
    'Red',
    'Blue',
    'Yellow'
  ],
  datasets: [{
    label: 'My First Dataset',
    data: [300, 50, 100],
    backgroundColor: [
      'rgb(255, 99, 132)',
      'rgb(54, 162, 235)',
      'rgb(255, 205, 86)'
    ],
    hoverOffset: 4
  }]
};

Chart.pluginService.register({
  beforeDraw: function(chart) {
    var width = chart.chart.width,
        height = chart.chart.height,
        ctx = chart.chart.ctx;

    ctx.restore();
    var fontSize = (height / 114).toFixed(2);
    ctx.font = fontSize + "em sans-serif";
    ctx.textBaseline = "middle";

    var text = "75%",
        textX = Math.round((width - ctx.measureText(text).width) / 2),
        textY = height / 2;

    ctx.fillText(text, textX, textY);
    ctx.save();
  }
});

var chart = new Chart(document.getElementById('myChart'), {
  type: 'doughnut',
  data: data,
  options: {
    responsive: true,
    legend: {
      display: true
    }
  }
});

How do I change the image size of randomized images without using a CSS page?

For the website for my webcomic, I’m trying to make it so that everytime you visit/refresh the website the image changes to be a different character. I spent hours trying to get this code on my website to work so the image changes on refresh, and i almost got it, however the images are way too big for the page and I cant figure out how to resize them. I tried to edit the images themselves but this is only a temporary solution as they are blurry and low quality, which is an issue because this is meant to be a website showcasing my artwork, and I don’t want my art to end up blurry, especially since this is on the first page you visit. I don’t like to use a separate CSS file for my page, as they confuse me and I like to have everything in one html file, though if there really is no other way then I’m willing to forego it.

Here’s what I have for my html:

table style="width: 81%; margin-left: calc(9%); margin-right: calc(10%);"><tbody><tr><img id="furFag"/>
</td>

<script langauge = javascript>

function getRandomImage() {

var images = ['/assets/those_guys/1.png', '/assets/those_guys/2.png', '/assets/those_guys/3.png', '/assets/those_guys/4.png'];
var image = images[Math.floor(Math.random()*images.length)];
 
return image;

}
 
function displayRandomImage() {

var htmlImage = document.getElementById("furFag");
htmlImage.src = getRandomImage();

}
displayRandomImage();


var images = ['/assets/those_guys/2.png', '/assets/those_guys/3.png', '/assets/those_guys/4.png'];

var htmlImage = document.getElementById("furFag");


</script>

If anyone is able to help it’d be much appreciated!! Thank you :3

Shopify Infinite scroll using Ajaxinate stops working after applying the filters

    {% if template contains 'collection' %}
<script>
  document.addEventListener("DOMContentLoaded", function() {
    var endlessScroll = new Ajaxinate({
      container: '#product-grid',
      pagination: '#Huratips-Pagination',
      loadingText: `<div class="loading" style="text-transform: uppercase; padding-bottom: 40px; padding-top: 40px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center;">
              <span style="height: 30px; width: 30px; background-repeat: no-repeat; background-size: contain; display: inline-block; background-image: url(https://cdn.shopify.com/s/files/1/0691/4221/6959/files/loader-black.svg?v=1712406692);"></span>
              <span>Loading more products</span>
            </div>`
    });
  });
</script>
{% endif %}

I have written this code for infinite scrolling on my shopify store, but this code stops working after applying the sorting or filter, May be i think it’s due to when we apply the sorting or filtering in shopify it reloads the content under the class .product-grid-container and replace the whole html that’s why #product-grid and it’s content comes as new, due to this it stops working after applying sorting or filtering, is there any way to handle this situation?

enter image description here

in this picture i have shown that reloads whole content under .product-grid-container .collection, i am using spotlight theme in shopify.

thanks in advance for the help.. 🙂

How should i start to learn JS? [closed]

I’ve been wanting to learn javascript, i’ve noticed the existence of yt tutorials and all that stuff. however,i feel it like a very complex language. So ive been wondering if there are books or courses you can recommend for me to learn this thing.
Thank you

( If there is a yt series that cover all the basics with examples let me know )

How to capture the onButton click event in google chat app?

I am trying to develop a google chat app where we ask a question to a user.. (“How are you?”) and then we have a dropdown with values (“Good”,”Okay”)

and a Submit button.

When I click on submit button. I want to capture what option the user has clicked along with the question.

I see that when clicking the chat app triggers an interaction event but where and how should I capture it?

Can I capture using App script? Please help me.

I tried using this code “

`
const { google } = require('googleapis');
const key = require('./cred.json'); // Replace with secure credential retrieval
const spaceId = "SpaceID"; // Replace with your Google Chat Space ID
const appScriptURL = "https://script.google.com/macros/s/ScriptID/exec"; // Replace with your Apps Script Web App URL

// Set up JWT client
const jwtClient = new google.auth.JWT(
  key.client_email,
  null,
  key.private_key,
  ['https://www.googleapis.com/auth/chat.bot']
);

// Authorize the client
jwtClient.authorize((err, tokens) => {
  if (err) {
    console.error('Authorization failed:', err);
    return;
  }

  // Initialize Google Chat API
  const chat = google.chat({
    version: 'v1',
    auth: jwtClient
  });

  // Function to encode form data as query parameters
  function encodeFormData(data) {
    return Object.keys(data)
      .map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key]))
      .join('&');
  }

  // Send the specified card message
  const message = {
    parent: 'spaces/' + spaceId,
    requestBody: {
      cardsV2: [
        {
          cardId: 'unique-card-id',
          card: {
            header: {
              title: "A question has been assigned!",
              imageUrl: "https://developers.google.com/chat/images/quickstart-app-avatar.png",
            },
            sections: [
              {
                collapsible: false,
                uncollapsibleWidgetsCount: 1,
                widgets: [
                  {
                    decoratedText: {
                      text: "How are you feeling today?"
                    }
                  },
                  {
                    selectionInput: {
                      name: "Answer",
                      label: "Answer",
                      type: "DROPDOWN",
                      items: [
                        {
                          text: "Good",
                          value: "good"
                        },
                        {
                          text: "Normal",
                          value: "normal"
                        }
                      ]
                    }
                  },
                  {
                    buttonList: {
                      buttons: [
                        {
                          text: "Submit",
                          onClick: {
                            
                             
                              openLink: {
                                url: appScriptURL + "?" + encodeFormData({
                                  formData: JSON.stringify({
                                    question: "How are you feeling today?",
                                    // Add more data as needed
                                  })
                                })
                              }
                         
                          },
                          disabled: false
                        }
                      ]
                    }
                  }
                ]
              }
            ]
          }
        }
      ]
    }
  };

  chat.spaces.messages.create(message, (err, res) => {
    if (err) {
      console.error('Error sending message:', err);
      return
    }
    console.log('Message sent:', res.data);
  });
});`

I don’t know how to capture an event and send some where.

nodeJS – why is promise not resolving?

Using nodeJS, I am trying to read the contents of a .txt file. I’m able to see the contents via ‘console.log’, but when I ‘return data’ the output is ‘Promise {}’.

import fs from 'node:fs/promises';

console.log(getContents('someFile.txt'));

async function getContents(textFile){
    
    try{
        const data = await fs.readFile(textFile, 'utf8');
        return data;
    } catch (error) {
        console.log(error);
    }

}

I keep getting “Uncaught TypeError: d3.create is not a function” when I imported locally installed D3js

Note: I have checked related issues on stackoverflow but none was helpful

I am building a library and I am using D3 in the library as a dependency and I want to use and install D3 locally into the library, and I also want to bundle the minimal version of D3 together with the app, but my issue is I keep getting Uncaught TypeError: d3.create is not a function error when I tried to import the create method and other methods into my project, I downloaded the d3.js and d3.min.js UMD modules and I also tried to install it via npm into a different directory outside of the project and copy the d3 folder into the project and include it from the newly copied d3 directory I still got the same error,

and when I installed it directly into the with npm i and I imported it into my project I got “Uncaught TypeError: The specifier “d3” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.” error

I don’t know what else to do again, I could dynamically load into the DOM through the CDN with the script tag but I want my library to be able to be loaded and used when users are not connected to the internet in development

The project environment is in typescript

Please how do I fix this error and what I’m I doing wrong, I’ve been on it for over 6 hours now

please don’t downvote me I’ve actually searched other related issues and their solutions were not helpful to me, I’ve also tried using AIs, ChatGPT and Gemini, still couldn’t resolve the issue, please

Why is the style of on the page not updating?

I’m making a project in Django. ran into a problem. I have div containers with dynamic IDs. I load the ID from the database and automatically upload it to HTML.
Here is an example of dynamic IDs for container divs:

    <div id="replyLikesDiv">
                <img id="replyReviewsImg" src="{% static 'images/icons8-reply-arrow-50.png' %}">
                <div id="replyReviewsDiv">Ответить</div>

                <img class='likesReviewsImg' id="likesReviewsImg{{ REVIEWS_IDS }}" onclick="likesReviewsImgClick(this)" src="{% static 'images/icons8-facebook-like-50.png' %}">

                <div  class='likesReviewsDiv' id="likesReviewsDiv{{ REVIEWS_IDS }}" onclick="likesReviewsDivClick(this)">...</div></div>

<div class="likeAuthorizationDiv" id='likeAuthorizationDiv{{ REVIEWS_IDS }}'>

                <div id="likeAuthorizationMessage">Пожалуйста, авторизуйтесь, чтобы продолжить.</div>  
 
        <div  id="sendReviewBtnDiv2">
            <div id="sendReviewBtn2"">Закрыть</div>

            </div>
            </div>

REVIEWS_IDS is automatically loaded from the database and inserted using the Jinja template engine. REVIEWS_IDS is an integer value 1,2,3,4… and does not repeat, so all ids are unique.

By design, when you click id=”likesReviewsDiv{{ REVIEWS_IDS }}”, the likesReviewsDivClick() function is called. It looks like this:

function likesReviewsDivClick(el){
    var id = el.id;
    id = Number(id.replace(/[^0-9]/g, ''));
    id = 'likeAuthorizationDiv' + id;
    var element = document.getElementById(id);
    element.style.visibility = 'hidden';

    alert(element.style.visibility);
}

In the function I read the ID and substitute it in likeAuthorizationDiv. Then I get the element I need in the function and try to change its style to hidden. The style changes in the alert, but not on the page. What can be wrong?

I tried to change the style in many ways, but never figured out how to do it. As I understand it, the problem is in the DOM.

HTML Input search field with button form field

I have a input search field with a button and would like for that to interact with my html page when a query is typed a song that the user has typed out in on the page search field have it play a song after the button has been clicked. I was thinking for the audio control player to be highlighted and played. what code should I use to do this