Skip to main content

Posts

Showing posts with the label Active questions tagged javascript - Stack Overflow

I want to remap my mouse side btns to keyboards btns using Tampermonkey Javascript

// ==UserScript== // @name Mouse Button Remapper // @namespace http://tampermonkey.net/ // @version 0.1 // @description Remap mouse side buttons to keyboard buttons // @author You // @match *://*/* // @grant none // ==/UserScript== (function() { 'use strict'; // Map mouse button IDs to keyboard key codes const buttonMappings = { 3: 'P', // Change this to the desired key code 4: 'O' // Change this to the desired key code // Add more mappings as needed }; // Add event listener for mouse button press window.addEventListener('mousedown', function(event) { const buttonId = event.button; if (buttonMappings[buttonId]) { // Simulate keydown event for the mapped key const keyEvent = new KeyboardEvent('keydown', {'key': buttonMappings[buttonId]}); document.dispatchEvent(keyEvent); } }); // Add

Hero slider with wide image and animations on it to work with mobile

I'm working on side project and the client want from me to create hero for full screen and should be scrollable horizontally, you can click on the image and swipe from left to right and from right to left. So from beginning, I have a huge image 5000px x 2000px and eg. on full hd monitor I need to show the image center and user can swipe in horizontal to see the rest of the content. Should be responsive also for the mobile that height of the hero will be always 100vh and width of that image will calculate proportionally. here is the video how it should look like: https://drive.google.com/file/d/14V0CEuWvapHBxI5ZQ1tc33IiYMDWZJdZ/view?usp=sharing also is another challenge, that animations should be in this slider, got sequence from Designer to animate, and I need to put that animation in absolute position, for example fire animation. there is a figma to play with desktop version: https://www.figma.com/proto/87RAbQap8Yeekp0oEsHnti/Dogin-Hood-Prototype?page-id=314%3A163&type=d

javascript not showing right message at right momernt

wrote a code to handlhandle the type of messatge i should get, I am looping over the table's all trs and finding the conditions to match Here are my conditions: if all rows have data-mode="success" and data-pure="yes", it means the code is correct and its a success: if any row has data-mode='success" and data-pure="no", it means, it is a warning, if any row has data-mode="error", it means its an error and the message is danger I have the following code but it is always returning me 1, if there is a third condition, function checkTableData() { var allTables = $('#tableBody'); var highestValue = -1; for (var i = 0; i < allTables.length; i++) { var table = allTables[i]; var trs = $(table).find('tr'); for (var j = 0; j < trs.length; j++) { var tr = trs[j]; var d

Programmatically generating box UVW maps

I'm need to programmatically generate box UVW maps in 3D-models, similar to how UVW Map -> Box works in 3ds Max. Example with default UV Example with box UV, what I'm after I've tried javascript-based solutions such as this or this , but it seems to give various results depending on if the mesh/geometry is merged or if it already has any built in UV. Or it has different directions . Applying box UV-map via Blender or 3ds Max to the same 3D-model always gives perfect results though. Best case scenario would be a command line tool, similar to how gltf-pipeline works: generate-box-map -i model.gltf -type box -size 50 I've found tools/projects such as PyMeshLab , Meshmatic , or running a Blender instance and attempting to do it via python, but I couldn't find a solution. Perhaps there's a native/easier way of doing this? Via Active questions tagged javascript - Stack Overflow https://ift.tt/dhNjQMu

How can I create dynamically HTML pages for each data?

I need to create html pages for multiple datas. I searched, then I found this document.getElementById("div-1").appendChild(container); datas.forEach(function (data) { var rptContainer = document.querySelector('.container').cloneNode(true); rptContainer .querySelector('.customer-no').textContent = data.customerNo; rptContainer .querySelector('.customer-name').textContent =data.customerName; document.getElementById("div-1").appendChild(rptContainer); }); It creates pages according to the number of data, but all the pages contain the information of the most recent data. How can I create pages according to each data (customer)? Via Active questions tagged javascript - Stack Overflow https://ift.tt/dhNjQMu

popup displays and dissapears immediately after button is clicked

I want to make a popup for my project so I decided to follow a w3schools tutorial but I'm running into a problem. When I click the button to show the modal it appears and immediately disappears. var btn = document.getElementById("btn"); btn.onclick = function() { modal.style.display = "block"; } window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } } <div class="modal" id="myModal"> <div class="container"> <div class="input-container"> <h1>Search Product</h1> <input type="text" name="search" id="search" placeholder="Search"> <div class="results-container"> <table aria-label=""> <thead> <tr> <th id="number">No.</th> <th id="prod

I'm getting this weird red color texts in my react code

I'm getting this weird red color text in my vscode, the code runs on my localhost(local machine), and also "npm run build" works. But when I try to host it on Vercel it doesn't work. enter image description here . This is my code enter image description here . The weird text appears everywhere in my code, I don't understand whats happening. enter image description here I'm trying to host my code that's working on my local machine on vercel and its not working Via Active questions tagged javascript - Stack Overflow https://ift.tt/dhNjQMu

Ajax from DataTable is not working in .net 6

I dont get any errors in the console. And the breakpoint in the method of the controller is never called. (sorry for my bad english). The problem is that the method is never called from the ajax. Please help. Html: <!-- Modal --> <div id="modal-inclusion" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h2 class="modal-title text-center" id="exampleModalCenterTitle">Solicitar inclusión</h2> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="mod

Unblurring a blurred image when a specific object is under it [closed]

I wonder, does anyone know any way (or workaround) to reveal a blurred image when a specific object (not zone) is encountered in a website ? I know that I could just throw in a png of the unblurred pixels, but the issue here is that I want it to be animated, so a simple png would give a wrong illusion and animating it frame-by-frame by hand to make it a gif or apng would probably take really long if I want it to be smooth. If anyone knows how the ressources to make such a clever code or knows how to automate the process that I gave below, please let me know. Example here, with glow added for readability : Please know that this is just an example, I'm aware that this does not look that appealing right off the bat Source : https://commons.wikimedia.org/wiki/File:Image_created_with_a_mobile_phone.png , font is "Rubik" Via Active questions tagged javascript - Stack Overflow https://ift.tt/bKe6CYR

How to fetch Options from API for Select when it is opened (onOpen event) in material UI

I am using Material UI Select in my Project. Since i have lots of dropdowns with lots of options,i want to populate them only if they are opened by user. On triggering the onOpen event,A call will be made and options will be fetched. Only problem is that i cannot fetch the name of Dropdown from event object passed in onOpen event. The event is MouseDown. Which does not contain that information. How to solve that??? Is there any other event i can use?? Is this the standard way of doing this? Here is the code.. onOpen Handle function const handleSelectOpen = (event,a) => { console.log(event.target.name ) //returns undefined fetchData([reqDimName], filtersFormatted).then((data) => { }); }; Select Component. <Select name={label.split('.')[1]} label={ filterDimensions[e]?.meta?.current?.[ `${filterDimensions[e].

Azure Maps label text that scales with the zoom level

Is it possible to create a text label that stays the same relative size compared to the map when zooming in or out? Reading the docs and looking at the symbol layer sample , it seems that this is not possible and that the label will always have the same absolute size (appearing larger when zooming out), but I'm curious whether it is possible to achieve this somehow, using some sort of undocumented feature. If not, is it possible to request this feature somewhere; or is this out of scope? Via Active questions tagged javascript - Stack Overflow https://ift.tt/y70lZDR

Apify Flipkart scraper Not scrape data properly

I use apify (Flipkart scraper) website to scrape data from flipkart but scrape data only for mobile categories, i want to get all categories products details. If there is a solution let me know... Thanks I tried some meathod but it's not work Via Active questions tagged javascript - Stack Overflow https://ift.tt/gTKvAbZ

Sending an array from the javascript to the laravel controller

Im trying to send an array from my javascript to my laravel controller but when I dd() I get null. Javascript : $('#submmit').click(function() { $.ajax({ method: 'POST', url: '/Calendar/store', contentType: 'json', data: JSON.stringify(partconValues), success: function(response) { console.log(response); }, error: function(error) { console.error('Error sending partconValues to the controller:', error); } }); }) Controller : public function store(Request $request) { Log::info('Request data:', $request->all()); $partconValues = json_decode($request->getContent()); $process = \App\Models\Process::find($request->input('partcon_id')); $part = \App\Models\ProductPart::find($request->input('part_id'));

Does Javascript have a way to parse numeric strings accounting for different global character sets?

Is there a way to validate/parse strings into integers when the characters used may use numeral character sets other than the standard Western 0-9? Background: My Javascript application prompts users for integer input (their age), but some users answer using non-Western numerals due to their keyboard settings. Currently, those don't pass validation, but I'd like to accept and parse all valid integer responses, regardless of what numeral character set is used. Desired behavior: "12" => 12 // English/Western "১৬" => 16 // Assamese "२४" => 24 // Hindi Is there a way to do this consistently without hardcoding all possible numeral sets explicitly? Via Active questions tagged javascript - Stack Overflow https://ift.tt/euaPzdn

ExtJs - grid.column.Column - how to take it out and use it somewhere else

I need to extract these column lists from Ext.grid.column.Column together with the checkboxes and the entire mechanism for the button above the table. I would not like to create the entire mechanism from scratch, but just use the available option. Is it possible? This: Via Active questions tagged javascript - Stack Overflow https://ift.tt/MV1o0qt

Fiori Controller.js Changes not Reflecting without Modifying Component-Preload.js

I have a Fiori app that I need to customize in VS Code. The change is to be made in the Detail.controller.js file. I noticed that the changes I made in the Detail.controller.js file did not reflect until I made those exact changes in the Component-preload.js file. Interestingly, I haven't encountered a similar situation with View files. Can someone shed light on why this behavior seems specific to Controller files? Does this imply that for code changes in Controller files, updating only the Component-preload.js file is necessary? TIA, Ruzna Via Active questions tagged javascript - Stack Overflow https://ift.tt/MV1o0qt

fetch graphql query from external server

i'm trying to fetch some leetcode stats using leetcode's graphql schema. when i enter the query in the browser, it gives me a response, but it's not responding to me when i use axios. here's the query i enter in the browser: https://leetcode.com/graphql?query=query { questionSubmissionList( offset: 0, limit: 20, questionSlug: "two-sum" ) { lastKey hasNext submissions { id title titleSlug status statusDisplay lang langName runtime timestamp url isPending memory } } } and here's what i have in my code: let url = `https://leetcode.com/graphql`; const fetchSubmissionList = async (questionSlug) => { let query = ` query questionSubmissionList( offset: 0, limit: 20, questionSlug: $questionSlug ) { lastKey hasNext submissi

415 (Unsupported Media Type) error in dot net core web API

I am using dot net core Web API. I have a controller HomeController.cs using Microsoft.AspNetCore.Mvc; using WebAPI.Models; namespace WebAPI.Controllers { [ApiController] [Route("[controller]")] public class HomeController : Controller { [HttpPost] public IActionResult Index(User user) { return Ok(user); } } } The model user is as follows namespace WebAPI.Models { public class User { public string username { get; set; } public string password { get; set; } } } When I run the following jquery code from the front end I get an error 415 (Unsupported Media Type) $.ajax({ type: "POST", url: "https://localhost:7137/Home", data: { username: "username" , password: "password"}, success: function(data){console.log(data)}, dataType: "application/json" }); I am not getting what mistake I am doing. Via Active questions