https://software.codidact.com/categories/38/tags/3300.rssNew Posts Tagged 'javascript' - Software DevelopmentSoftware Development - Codidact2024-01-26T16:00:06Zhttps://software.codidact.com/posts/290645How to Select From Multiple images to display main product image.abhishek27suvarnahttps://software.codidact.com/users/773732024-01-26T06:58:12Z2024-01-26T16:00:06Z<p>Below are the links to code for my project.<br>
<a href="https://drive.google.com/file/d/1D0knOWuofJdJGav7wUFHXEvs4xMkuaFY/view?usp=drive_link">HTML</a><br>
<a href="https://drive.google.com/...https://software.codidact.com/posts/290096How to programmatically click through a list of elements if one has to wait for a click to load a set of predefined new elements?torarittehttps://software.codidact.com/users/658732023-10-24T13:44:44Z2024-01-09T18:09:08Z<p>I would like to download the old-time radio show <a href="https://www.otrr.org/OTRRLibrary/otrrlibrary.html?idp=4919">I Love a Mystery</a> from the OTRR website. I figured out how to construct t...https://software.codidact.com/posts/290165How can I get a value as a node:stream from the Nest.js cache-manager?gdfelthttps://software.codidact.com/users/682382023-11-03T22:50:14Z2023-11-05T06:36:05Z<h1>Question</h1>
<p><strong>How can I read data from a NestJS Redis Cache as a stream?</strong></p>
<p>I'm using <a href="https://nestjs.com">Nest.js</a> and its <a href="https://www.npmjs.com/p...https://software.codidact.com/posts/289992How do I register the Chart.js Zoom plugin?CavanWrighthttps://software.codidact.com/users/653062023-10-12T20:27:31Z2023-11-01T08:16:26Z<p>I am attempting to use the <code>chartjs-zoom-plugin</code> v2.0.1 with Chart.js v4.4.0. I have the plugin as the file <code>chartjs-plugin-zoom-2.0.1.min.js</code>, and I have imported it into...https://software.codidact.com/posts/290124Axios error bad requestAyeshSoulhttps://software.codidact.com/users/668912023-10-26T06:47:07Z2023-10-30T18:58:27Z<p>I'm trying to use this code with Axios:</p>
<pre><code>import "./feed.css";
import Post from "../post/Post";
import Share from "../share/Share";
import { useState, useEffect } from "react";
...https://software.codidact.com/posts/290010How do I share a type between a client and server, but make a specific field optional for one and required for the other?Emilyhttps://software.codidact.com/users/617042023-10-14T00:48:25Z2023-10-14T00:50:45Z<p>Let's say I have a client/server application with a data structure on the server side:</p>
<pre><code class="language-typescript">type User = {
name: string;
superSecretGovernmentIdNumber...https://software.codidact.com/posts/289887Determine which script is slowing the page down in Firefoxmatthewsnyderhttps://software.codidact.com/users/613082023-10-04T01:16:26Z2023-10-12T17:53:48Z<p>A page is very slow and laggy in Firefox. I am certain it's one of the many Javascripts slowing it down.</p>
<p>Out of curiosity, I'd like to figure out which script is creating the heaviest lo...https://software.codidact.com/posts/289980How do I get the min/max axis values in Chart.js?CavanWrighthttps://software.codidact.com/users/653062023-10-12T15:09:35Z2023-10-12T16:05:25Z<p>I'd like to get the minimum and maximum values of the axes on a Chart.js 4.4.0 plot. When the plot is created, these values must be calculated somewhere. However, reading through the <a href="...https://software.codidact.com/posts/289896How do I install Chart.js as a file?CavanWrighthttps://software.codidact.com/users/653062023-10-04T18:06:32Z2023-10-04T20:01:48Z<p>I'm trying to replace Flot.js with Chart.js. In my application, Flot.js is included as a normal JavaScript file, like so:</p>
<pre><code><script language="javascript" type="text/javascript"...https://software.codidact.com/posts/289275JavaScript redirect is getting "hijacked" and it is not onbeforeunload event.Vanity Slug ❤️https://software.codidact.com/users/609902023-08-07T13:39:08Z2023-10-02T16:30:24Z<p>My redirect in javascript somehow gets "hijacked" and I don't understand how.</p>
<p>Previous developer (who is no longer working with the company) on page load initialized <code>onbeforeunload...https://software.codidact.com/posts/289584How to implement automatic text-to-link conversion in TypeScript?ShadowsRangerhttps://software.codidact.com/users/580872023-09-05T11:46:21Z2023-09-06T12:47:34Z<p>I'm trying to create an automatic text-to-link conversion feature in a TypeScript application. The desired workflow is:</p>
<ol>
<li>Copy a URL to the clipboard</li>
<li>Select some text</li>...https://software.codidact.com/posts/289027Redux Toolkit Issue with Managing Statesboudagga.ma94https://software.codidact.com/users/644442023-07-20T10:31:58Z2023-07-20T10:31:58Z<p>I am all new with using Redux Toolkit, I followed the official documentation to setup the <strong>store</strong>:</p>
<pre><code>// store.ts
import { configureStore, ThunkAction, Action, combi...https://software.codidact.com/posts/289022What can be used in react-native instead of an html label tag to achieve the same result?andrehttps://software.codidact.com/users/644172023-07-19T12:41:50Z2023-07-19T15:19:03Z<p>I wanna make a form in React native.<br>
A field in this form in (non-native) React would be like this:</p>
<pre><code><div>
<label htmlFor="lastName">Last Name:</label>
...https://software.codidact.com/posts/285917When using the compare function in Array.prototype.sort, how to avoid an element to be processed more than once?hkotsubohttps://software.codidact.com/users/530782022-02-10T19:17:29Z2023-07-03T16:44:36Z<p>When using the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort"><code>Array.prototype.sort</code> method</a>, we can pass a compare function ...https://software.codidact.com/posts/288780Problems with Google Apps Script API JavaScript "How to... Execute function"Wickethttps://software.codidact.com/users/609772023-06-28T23:17:04Z2023-06-29T15:00:04Z<p>As this is the first question about Google Apps Script, here is a very brief description: it is a platform that helps people easily get programmatic access to Google apps data like Gmail message...https://software.codidact.com/posts/288764Possible drawbacks for having duplicate local sources of the project tracking the same Git remoteAlexeihttps://software.codidact.com/users/531772023-06-28T15:46:54Z2023-06-28T21:59:38Z<h2>Context</h2>
<p>I have started working on an Angular upgrade for a medium-sized project (from v. 10 to v. 15) and this is a rather long activity that is interrupted by other changes that need ...https://software.codidact.com/posts/288152Are there other reasons why useEffect might not be defined apart from not importing it?Brianhttps://software.codidact.com/users/607132023-05-24T06:22:50Z2023-05-27T05:11:07Z<p>I am creating a button that once clicked will change from off to on with react and i am also creating a responsive clock through useEffect.</p>
<p>Yet the code still return that useEffect is un...https://software.codidact.com/posts/288041Vanilla JS Functions Reviewfaustyhttps://software.codidact.com/users/596672023-04-13T17:57:30Z2023-04-24T02:52:43Z<p>I wanted to create a simple static website that would use JS to randomly rotate through a quotes.json file I maintain. My JavaScript experience is more limited as it's not what I do at work, so ...https://software.codidact.com/posts/288042Ignore NPM Modules Digital Ocean App Platformfaustyhttps://software.codidact.com/users/596672023-04-13T18:40:50Z2023-04-14T17:13:31Z<p>There may be a better way to manage website's with JavaScript deployments. I added jest to my repo simply to execute tests when I make PRs as part of a GitHub action. This requires a package-loc...https://software.codidact.com/posts/287970CSS grid with expanding cellsberriehttps://software.codidact.com/users/592332023-03-21T10:32:16Z2023-03-30T14:41:12Z<h3>Goal</h3>
<p>Our goal is to create a kind of table, using HTML/CSS/JS, with cells that expand when you click on them. If you click on a header, the whole row or column will expand.</p>
<p>Thi...https://software.codidact.com/posts/287856Adding elements to wrapper after calling wrap doesn't workMoshihttps://software.codidact.com/users/531962023-02-07T07:46:25Z2023-03-17T13:57:20Z<p>I'm trying to do some DOM manipulation in jQuery, but am having issues with creating wrapper elements. For some reason, prepending to the wrapper doesn't work after I call <code>wrap</code>.</p>...https://software.codidact.com/posts/287940How to use ReactNative SDK with flexible sync using a code first approachScriptastrophehttps://software.codidact.com/users/591922023-03-08T00:19:49Z2023-03-17T13:56:52Z<p>I am working on a React Native app using Realm, Atlas Flexible Sync, and MongoDB, and I'm super confused about how subscriptions work. I'm coming from a .NET SQL background, so I'm completely ne...https://software.codidact.com/posts/287682queryselector for all does not select the specified css selectoryAnshhttps://software.codidact.com/users/586712023-01-10T14:59:48Z2023-01-11T08:50:01Z<p>I tried using query selector but it does not work
heres my HTML code:</p>
<pre><code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>...https://software.codidact.com/posts/287512Replit particles push instead of being backgroundObviousPlayshttps://software.codidact.com/users/579762022-11-30T17:48:31Z2022-11-30T21:08:42Z<p>I am working on a replit
<a href="https://AppropriateMessyRoutes.ozabramo.repl.co">https://AppropriateMessyRoutes.ozabramo.repl.co</a>
and I am trying to implement
<a href="https://github.com...https://software.codidact.com/posts/287443How should I deploy my Full Stack Angular Application (MEAN Stack) project on free hosting website?mrsilenttradeguyhttps://software.codidact.com/users/579232022-11-22T15:47:04Z2022-11-22T20:16:25Z<p>How should I deploy my Full Stack Angular Application (MEAN Stack) project on free hosting website?</p>
<p><a href="https://www.github.com/adityaxrawal/ecommerce-app">Github</a></p>
<p>I have ...https://software.codidact.com/posts/287335highlight.js 3rd party plugin error: Cannot read properties of undefinedRazetimehttps://software.codidact.com/users/533102022-11-02T04:27:26Z2022-11-02T04:31:03Z<p><strong>Highlight.js version:</strong> 11.6.0</p>
<p><strong>Node version:</strong> v18.12.0</p>
<p><strong>npm version:</strong> 8.19.12</p>
<p>When I provide a plugin with the following cod...https://software.codidact.com/posts/278695Setting the authentication token in an Angular application for generated API clientsAlexeihttps://software.codidact.com/users/531772020-10-21T12:27:08Z2022-07-11T15:32:17Z<p>This is <a href="https://codereview.stackexchange.com/questions/230159/setting-the-token-for-api-client-generated-instances-in-an-angular-application">a post of mine</a> from <a href="https://co...https://software.codidact.com/posts/286406What is [{options}] in JavaScript?deleted user#2022-05-07T15:14:03Z2022-05-09T11:30:20Z<p>I am trying to understand this code:</p>
<pre><code class="language-javascript">const iframes = iFrameResize( [{options}], [css selector] || [iframe] );
</code></pre>
<p>The code can be found...https://software.codidact.com/posts/286335Does a for...of loop must contain a variable without assignment sign, and why?deleted user#2022-04-27T13:51:52Z2022-05-03T21:18:38Z<p>The following code pattern reflects <a href="https://software.codidact.com/posts/286304/286317#answer-286317">this answer</a>.</p>
<p>This code contains a <code>for...of</code> loop:</p>
<pre>...https://software.codidact.com/posts/286349How this recursive treewalker works?deleted user#2022-04-28T19:58:30Z2022-05-02T14:32:23Z<p>Credit for <a href="https://software.codidact.com/users/53280">User:Meriton</a> for developing the following code (<a href="https://software.codidact.com/posts/286304/286317#answer-286317">first...https://software.codidact.com/posts/286372Explaining the result of an arithmetic expression in JavaScriptdeleted user#2022-04-30T20:20:36Z2022-05-01T17:11:46Z<p>I misunderstand why the following code outputs -1 in console.</p>
<pre><code class="language-javascript">x = 42;
x = (x == 42) * -1 + (x != 42) * x;
</code></pre>
<blockquote>
<p>-1</p>
</...https://software.codidact.com/posts/286306Is there a JavaScript command to remove all CSS pseudo-elements whatsoever in a document?deleted user#2022-04-23T21:24:55Z2022-05-01T17:05:40Z<p>In a dense DOM tree created by a content management system which I didn't create and don't know much about there might be pseudo elements hiding in various places.</p>
<p>To ensure that, I want...https://software.codidact.com/posts/286353How to make this treewalker code having a regular for loop or a forEach() method?deleted user#2022-04-29T10:36:40Z2022-04-30T05:17:13Z<p>Credit for <a href="https://software.codidact.com/users/53280">User:Meriton</a> for developing the following code (<a href="https://software.codidact.com/posts/286304/286317#answer-286317">first...https://software.codidact.com/posts/286345Recursion without a procedure ("function") in JavaScriptdeleted user#2022-04-28T13:51:07Z2022-04-29T06:11:09Z<p>Credit for <a href="https://software.codidact.com/users/53280">User:Meriton</a> for developing the following code (<a href="https://software.codidact.com/posts/286304/286317#answer-286317">first...https://software.codidact.com/posts/286333What are the types of DOM nodes?deleted user#2022-04-27T13:01:10Z2022-04-27T17:04:03Z<p>If I am not mistaken any DOM "tree" node is actually a "branch", which would be an HTML element or perhaps a CSS pseudo-element, of course.</p>
<p>If that's true what are the different node typ...https://software.codidact.com/posts/286304Delete all occurrences of a character in a webpage with vanilla JavaScriptdeleted user#2022-04-23T18:43:29Z2022-04-27T13:06:44Z<p>Primarily for learning, I would like to try to delete a specific character (letter or number or special character), wherever it is in a webpage, with vanilla JavaScript.</p>
<p>The webpage won'...https://software.codidact.com/posts/286298How to access the visual editor from JavaScript in MediaWiki?deleted user#2022-04-22T17:53:54Z2022-04-22T22:10:54Z<p>In MediaWiki 1.36.1 with Skin:Timeless, the following JavaScript code doesn't work. I get in browser console:</p>
<blockquote>
<p>Your skin is incompatible with VisualEditor.<br> See <a href="...https://software.codidact.com/posts/286291TypeScript is unable to infer the correct type for a mapped tupleMoshihttps://software.codidact.com/users/531962022-04-22T04:19:59Z2022-04-22T20:16:39Z<p>I was playing around with <a href="https://www.typescriptlang.org/docs/handbook/2/mapped-types.html">mapped tuples</a> and came across an interesting case where TypeScript cannot infer the types...https://software.codidact.com/posts/286279MediaWiki JavaScript way to view the history of a pagedeleted user#2022-04-21T17:46:40Z2022-04-21T21:50:16Z<p>I wish to view the revision-history-webpage of a webpage in <strong>MediaWiki</strong> without the conventional button to do so (I've disabled that button for aesthetic reasons).</p>
<p>Please ...https://software.codidact.com/posts/286265Why does a keydown event is listened only once?deleted user#2022-04-20T21:41:53Z2022-04-20T21:41:53Z<p>The following code (credit for user:hkotsubo) moves the user to another page if Alt+Shift+E are pressed together.</p>
<pre><code class="language-javascript">window.addEventListener('DOMContentL...https://software.codidact.com/posts/286256Move to the edit webpage of a webpage via the keyboard with vanilla JavaScriptdeleted user#2022-04-19T21:17:51Z2022-04-20T21:15:00Z<p>The webpage <a href="http://example.com">example.com</a> has an edit webpage (from which one can edit <code>example.com</code> itself).</p>
<pre><code>example.com/index.php?title=עמוד_ראשי&...https://software.codidact.com/posts/286219How to uncollapse an entire link tree with JavaScript?deleted user#2022-04-10T10:20:42Z2022-04-13T10:58:14Z<p><a href="https://www.mediawiki.org/wiki/Special:CategoryTree?target=Category%3AConfigure&mode=all&namespaces=">This data tree</a> is comprised of clickable buttons and I want to expose a...https://software.codidact.com/posts/286210In angular-imask how do I get the IMask class?nelson777https://software.codidact.com/users/540362022-04-09T11:17:22Z2022-04-11T20:46:38Z<p>Using Angular-IMask, I'm programatically updating the field that has IMask. So I'm getting the error:</p>
<p>"Element value was changed outside of mask. Syncronize mask using mask.updateValue()...https://software.codidact.com/posts/286216How to uncollapse the first and second tiers of a link tree in JavaScript?deleted user#2022-04-09T18:44:48Z2022-04-11T12:27:19Z<p>I wish to display the first and second branches of a link tree with JavaScript.</p>
<p>I want to show these branches <strong>in a single action</strong>, instead of clicking each <em>vertical a...https://software.codidact.com/posts/286125Tackling net::ERR_NAME_NOT_RESOLVED and timeout error on browser object creation when using Puppeteersbirlhttps://software.codidact.com/users/564532022-03-18T23:26:36Z2022-03-19T06:04:54Z<p>Used to work with PhantomJS. Want to upgrade to Puppeteer. Started with some code:</p>
<pre><code>"use strict";
const puppeteer = require("puppeteer");
const capture = async () => {
le...https://software.codidact.com/posts/286092Why does pushing to one array affect all the arrays in my two-dimensional array?Moshihttps://software.codidact.com/users/531962022-03-11T05:24:32Z2022-03-11T05:32:42Z<p>I was trying to initialize a simple two dimensional array as follows:</p>
<pre><code class="language-javascript">const arrays = Array(3).fill([]);
</code></pre>
<p>However, when I tried to pu...https://software.codidact.com/posts/285844Detecting if a user has stopped interacting with a web view for a certain timeAlexeihttps://software.codidact.com/users/531772022-02-06T14:29:30Z2022-02-10T18:25:18Z<p>I am interested in finding out all the aspects I need to cover in order to correctly assess if a user has stopped interacting with a web page. So far, I found the following:</p>
<ul>
<li><stro...https://software.codidact.com/posts/285620A keydown event succeeds for an English letter but not for an Hebrew one, sharing the same keydeleted user#2022-01-17T22:48:30Z2022-01-18T07:28:42Z<p>I am trying to listen to the event in which the keyboard key containing the Hebrew final-letter <code>ך</code> is pressed.</p>
<p>This key stands for both the English letter <code>L</code> and ...https://software.codidact.com/posts/285472Manipulate a web browser to hide a certain HTML element in a certain website by a single actiondeleted user#2022-01-05T10:13:13Z2022-01-12T01:50:25Z<p>Before I publish a new webpage in my website (in the content management system itself), I zoom in from say 100% zooming to 500% zooming and then re-read it, as a nice way to check for typos.</p>...https://software.codidact.com/posts/285500How to deeply clone an array in Angular / TypeScript?Alexeihttps://software.codidact.com/users/531772022-01-07T14:56:11Z2022-01-07T18:30:23Z<p>I have an array that I need to clone in Angular / Typescript. That is, any change done on an element from the cloned array should not affect the content of the initial array.</p>
<p>How can I a...