Skip to content
Advertisement

Open Gmail on mailto: action

How to force web-browser to navigate to Gmail and create (if logged in) new letter with filled in field ‘To’ on click on mailto:SomeMail@blabla.example? Answer There’s a Greasemonkey script. The compose URL is: https://mail.google.com/mail/?view=cm&fs=1&to=email@domain.example

How do I create bit array in Javascript?

What is the best way of implementing a bit array in JavaScript? Answer Here’s one I whipped up: UPDATE – something about this class had been bothering me all day – it wasn’t size based – creating a BitArray with N slots/bits was a two step operation – instantiate, resize. Updated the class to be size based with an optional

Changing the order of the Object keys….

This is a sample object which i am getting from back end, now i want to change the order of the object. I don’t want to sort by name or size… i just want to manually change the order… Answer if you want to manually reorder. simply create new object and assign values using old object.

Sending Javascript Object to PHP via Ajax

I’m learning Ajax by failure and have hit a wall: I have an array (if it matters, the array is storing number id’s based on what checkboxes the user checks) that is written in Javascript. I have a function that is called when the user clicks the ‘save’ button. The function is as follows: My question is: What can I

javascript focus() not working on Firefox and IE?

I’m trying to appear a form and focus it, for some reason it only works on Chrome. How can I make it work across browsers? You can see it not working in here: http://jsfiddle.net/CCxrp/1/ What can I do to make it work? Thanks Answer You just need to swap the order of things: The divs have to be in the

Is it possible to chain setTimeout functions in JavaScript?

Is it possible to chain setTimout functions to ensure they run after one another? Answer Three separate approaches listed here: Manually nest setTimeout() callbacks. Use a chainable timer object. Wrap setTimeout() in a promise and chain promises. Manually Nest setTimeout callbacks Of course. When the first one fires, just set the next one. Chainable Timer Object You can also make

In javascript how can I dynamically get a nested property of an object

If I want ‘foo’ vs ‘bee’ I can just do arr[variable] – that’s easy, and the function does that. But what if I want to get arr.bar.baz AKA arr[bar][baz]? What can I pass to the getter function that will let me do that, (and of course also let me get non-nested properties using the same function). I tried getter(‘bar.baz’) and

How to convert a bookmarklet into a Greasemonkey userscript?

Is there a easy way to do this. And is there anything that needs to be changed due to differences in how it is ran? Answer The easiest way to do this: Run the bookmarklet code through a URL decoder. so that javascript:alert%20(‘Hi%20Boss!’)%3B, for example, becomes: javascript:alert (‘Hi Boss!’); Strip the leading javascript: off.   Result: alert (‘Hi Boss!’); Add

Advertisement