I usually post code but this is a slightly different case. I would like to disable my registration page from being used on a mobile device. EG: icloud.com’s login is not accessible from any mobile device. So what I came to conclude is that I might need to catch the users user-agent and if its a mobile p…
Tag: javascript
How to prevent any routing before some async data (in Vuex store) has loaded?
In my application I need some data to be loaded inside the VueX store before routing starts (for example user sessions). An example of a race condition would be the following: In this situation the route guard might be executed before the user had been received from the server. Using conditional rendering did…
Regex windows path validator
I’ve tried to find a windows file path validation for Javascript, but none seemed to fulfill the requirements I wanted, so I decided to build it myself. The requirements are the following: the path should not be empty may begin with x:, x:\, , // and followed by a filename (no file extension required) f…
Ag-Grid: How to save and reload column order
Using Ag-Grid, users can drag columns to order them the way they like. I need to allow the user to save their column order (to an SQL backend) so that it becomes the default column order for them. I was trying to get the column names like this: This was an example I found for setting the header name, so
Triggering a ‘click’ event on the element ONLY without taking its padding into account
The goal is to trigger a ‘click’ event on the element ONLY when the user clicks directly on the element excluding its padding. Thus, suppose we have something like: Let’s say those list elements are aligned on the same row. So, there might be a case when the user clicks on the ‘space&#…
Upload a photo to Firebase Storage with Image URI
I am currently attempting to upload a photo to my Firebase app’s storage in my Apache Cordova app. I currently get the photo’s URI with the following code: And then am attempting to convert the image into a file and push it to my Firebase storage with the following function: I have both the file a…
jQuery search matching string and remove parent div
I’ve an HTML below: and I would like to remove the parent DIV (container) and it’s content if a child span contains a word, “this” for example. The code should search for the word “this” on all spans and delete the divs with the Id “container0” and “contai…
How do I wait for input to be filled in an html page and then print it’s value to the console in javascript?
I have a HTML page with an input field Someone enters some text into it They click a button I want to grab the value of the input field AFTER they click the button with some JS code(client-side) and then print it to the console/save it to a file. How would I go about doing this? I’ve tried looking but
JS-Plumb: (Re-)Draw a line between two elements after clicking
Edit: After trying out different hand-made solutions, I am using JSPlumb and trying to let it visually connect a clicked item from one list with a clicked item from another list (see screenshot). I built upon this Stackoverflow thread and made it work basically, however the code provided there allows multiple…
What is the simplest way to compare truthiness in this specific way?
Given the following instructions I have created a function that achieves the requirements. I feel my function is a bit too complex, though it does what it’s supposed to. The difficult part for myself was avoiding the equality operators. The only way I could think to solve this is with a bit of math and …