This is a WEB APP not a native app. Please no Objective-C NS commands. So I need to detect ‘pinch’ events on iOS. Problem is every plugin or method I see for doing gestures or multi-touch events, is (usually) with jQuery and is a whole additional pluggin for every gesture under the sun. My applica…
Author: admin@master
JavaScript fileWatcher
I am developing a web application (intranet) and it is mandatory to watch a specific folder, for example c:docs, for inserted files. I would like to do that through JavaScript in order to detect each time the client inserts file into specific directory. Answer You can build your own application using django. …
Javascript event that runs before page changes
Is there such a thing? I know that I can hook my function on the click event of all links, but there are other situations where a page is changed, like refresh or when a different script changes the window.location In the end, I did it by sending a string trough postMessage from the unload event, like this: i…
How to detect radio button deselect event?
Is there an easy way to attach a “deselect” event on a radio button? It seems that the change event only fires when the button is selected. HTML JavaScript jsFiddle Answer Why don’t you simply create a custom event like, lets say, deselect and let it trigger on all the members of the click…
Reverse of JSON.stringify?
I’m stringyfing an object like {‘foo’: ‘bar’} How can I turn the string back to an object? Answer You need to JSON.parse() your valid JSON string.
Fast way to get the min/max values among properties of object
I have an object in javascript like this: Is there a fast way to get the minimum and maximum value among the properties without having to loop through them all? because the object I have is huge and I need to get the min/max value every two seconds. (The values of the object keeps changing). Answer There̵…
How to set up CKEditor for multiple instances with different heights?
I’d like to have multiple instances of CKEditor based on the same config settings, but with different heights. I tried setting up config with the default height, setting up the 1st instance, then overriding the height & setting up the 2nd instance: …but I get two CKEditor instances that both h…
Why is process.env.NODE_ENV undefined?
I’m trying to follow a tutorial on NodeJS. I don’t think I missed anything but whenever I call the process.env.NODE_ENV the only value I get back is undefined. According to my research the default value should be development. How is this value dynamically set and where is it set initially? Answer …
Drawing at cursor position on canvas with JavaScript
I am trying to draw over a canvas by clicking and dragging the mouse. My problem is that, apart from the fact that the line has a very poor quality (I want a more pronounced border) it only respects the mouse position when this is at 0,0. As I move the mouse to the lower corner, the line increments its
Wait until setInterval() is done
I would like to add a small dice-rolling effect to my Javascript code. I think a good way is to use the setInterval() method. My idea was the following code (just for testing): Now I would like to wait for the setInterval until it is done. So I added a setTimeout. This code works quite okay. But in my main