Skip to content

Neil-Smithline/UserScripts

Repository files navigation

UserScript? What’s A UserScript?

If you don’t know what userscripts are, you can read about Greasemonkey. I happen to prefer the Scriptish add-on over Greasemonkey but the GM wiki page seems to be the best description I have found about userscripts. (If you have a better reference, I’d love a pointer.)

My UserScripts Online

Many of my userscripts can be found on my UserScripts.org profile page.

Google Opt-Out

Google is (in)famous for its web tracking via its Google Adwords online advertising network, as well as tracking users on their site, and other means. Google provides a semi-effective opt-out mechanism. Google’s opt-out page recommends installing a browser extension. It provides versions of this add-on for most popular browser. The browser extension for Firefox is 73K bytes.[5]

While 73K bytes is not a ridiculous amount of memory, apparently only a single line of [[JavaScript] is required:

_ga_user_prefs = false;

Browser extensions are also known to cause memory leaks.[3][4] This UserScript implements the Google opt-out mechanism in under 700 bytes; most of which is required UserScript metadata. That’s less than 10% of the Firefox add-on.

Some browsers (eg: [[Chrome]) run UserScripts directly. Other browsers require extensions to utilize UserScripts. For example, Firefox requires Scriptish, GreaseMonkey, or a similar extension. These extensions tend to be large. I would say that, for browsers that require an extension to run a UserScript, it only makes sense to use this UserScript if you already have an extension to run UserScripts installed in your browser.

As mentioned previously, Google’s opt-out mechanism is only semi-effective and can be beaten by individual web pages. This UserScript is no better than Google’s semi-effective opt-out extension.

Timely Google Search

By default, a Google search returns all results dating to the beginning of time (at least internet time). I find that for over 99% of my searches[1] I either only care about information from the past year or that there are enough new or updated postings in the past year that I don’t need to search further back.

As a quick example, as of the time of writing this (13 April 2012), a Google search for Google map help returns 836 million hits for the past year compared to 1.2 billion hits for all time.

While the nearly one third reduction in total search hits likely doesn’t matter much to me as I probably will never look at most of them, limiting the search to the past year eliminates links to old articles such as this one. That 2006 blog article is the 11^th hit on my all time search, YMMV[2]. Personally, I am infuriated when I find that I have wasted my time reading some long-outdated article.

The Timely Google Search Year userscript defaults all Google searches the past year. If you want to search all of eternity, you can simply hit the Any time link on the left side of the Google results and you’ll have your unrestricted search.

AMO: Up Top Version Info

AMO is the site that provides discovery, download, and installation of add-ons for Firefox and other Mozilla applications. When searching on AMO, it cleverly restricts add-ons to those that match the version of Firefox that you are using.

But since Mozilla changed their release schedule to release a new version every 6-weeks, add-ons have had a hard time staying current. So every 6-weeks, every add-on becomes outdated and must go through Mozilla’s AMO update process to be considered safe to work with the newest version of Firefox. Mozilla’s cautious approach to declaring add-ons compatible with new releases helps to ensure that Firefox is a stable application.

But some users (eg: me!) are willing to run an add-on that was considered compatible with a previous version of Firefox but not the version the user is currently running. But this must be done with care. The risk of installing an incompatible add-on grows with each release.

For example, if you are running Firefox version 13, you may be comfortable installing any add-on that was compatible with Firefox version 12 and willing to risk installing your favorite add-ons that were compatible with Firefox version 11 or even 10.

Also, as a general rule, you never, and I mean never ever, want to install an add-on that isn’t compatible with a Firefox version of 4 or more.

Unfortunately, the default AMO layout has the version information at the bottom of an add-on’s page and hidden until you click on the Version Information box.

The AMO: Up Top Version Info userscript copies the most relevant parts of the version information and puts it right on the top of the page next to the Install button.

The script tries to style the up top version information to flow naturally with the existing page. It puts the version information in a box that can be themed for different colors (for now you must edit the script to change themes - sorry).

The box is also dynamically sized so that it can handle Install buttons of different width. For example, at the time of writing this (13 April 2012), the My Homepage add-on has a wider Continue to Download button in place of an Install button. The dynamic sizing also allows for buttons of different widths that will occur in non-English pages.

Footnotes

[5] I only state the size of the Firefox extension because its size is easily accessible (it states its size on installation). I have not taken the effort to determine the size of the extensions for other browsers.

[3] Mozilla’s memory leak prevention page.

[4] Generic JavaScript pgae on preventing memory leaks.

[1] Yes. I’ve checked Google’s history of my searches to know that 99% is an accurate number.

[2] Google has optimized their search engine for speed over accuraty. This optimization can lead to getting slightly different results on the same search.

Releases

No releases published

Packages

No packages published