When writing JavaScript, very frequently I need to check if a given thing exists in a list of things. Every single time I need to look up the function that does that for the sort of list I’m working with. You see, there are three possible options: includes(), contains() and has() and I mix them […]
Twitter search in sidebar using Greasemonkey
Twitter’s recent redesign is great, but quite a few people missed the Twitter people search, or hoped it would add the new search.twitter.com in the sidebar. As I hadn’t done anything with Greasemonkey yet, but wanted to play around with it for some time, I decided to combine the two.
Twitter search in sidebar #
Click the link to install it using Greasemonkey: twittersearch.user.js
And this is what it looks like:
Greasemonkey #
There is one awesome thing about doing stuff with Greasemonkey: it’s easy. You’re just writing regular javascript and some comments that tell Greasemonkey the name and description, which websites to apply to (or not to apply to) and that’s it. The above script took me about an hour, including eating my dinner.
If you need to do heavier stuff and want to make use of library’s, you can do that, too. The only gotcha I really had, had to do with innerHTML (shock!) that acted a bit icky with onfocus functions and parameters in quotes. Solution: remove the quotes.
Onfocus? Not event listeners? Well, no. Greasemonkey script themselves are javascript already, so if it’s in the page, then the user has javascript on. Using an onfocus then is just much easier :)
There are a couple of websites I looked around to find info on Greasemonkey:
If there’s an annoyance with a website you use often, and you think you could fix it easily, then Greasemonkey is an excellent way to do that fast and easy. Do you have any tips for Greasemonkey?