Optimizing the Amazon rating histogram table

Amazon recently updated their website to show only the percentage of ratings behind each rating bar. While this usually comes in quite handy, it is counterproductive when there is only a small number of ratings. So I wrote a Greasemonkey script, which brings back the absolute number of ratings behind each bar and moves the percentage directly onto it. While working on this, I noticed that there is a very tiny little tooltip triangle right behind the average rating. It says that the shown average rating is not the arithmetic one, but instead a score that has been adjusted based on certain parameters (e. g. age, helpfulness, verified purchases) by Amazon. The first thought is obvious: “Sneaky Amazon. Nice trick to increase the ratings and drive sales.”. Turns out the shown average ratings are often lower than the arithmetic average. At least for the couple of samples I took. Could also be an approach to control sales by systematically devaluing certain products. Who knows… At least interesting enough to put it as a follow up project on the “maybe next winter” list. Still, there remains a bland taste and a strong feeling that Amazon ratings keep on becoming less and less trustworthy.

Note: Amazon keeps changing its markup quite often. The script might already have stopped working at the time you are reading this.

DOWNLOAD

 

Redirect multi-page news articles to a single page view using Greasemonkey

A lot of news websites split their articles into multiple pages. In theory this drives page impressions and thus ad revenue. In practice it is just annoying. The Greasemonkey script below automagically redirects you to a news article’s full page (in this case on zeit.de). It uses a MutiationObserver to wait for the pager UI element. The script kicks in once it appears – no need to wait until their page (or ads?!) have been fully loaded. 🙂

You can easily modify it:

1. Include all pages that might contain a multi-page article
2. Exclude all pages that might lead to a loop (especially the target site) or that will not contain a pager element (MutiationObserver can easily add a couple of milliseconds of loading time on complex pages)
3. Change the class name of the pager element to the one used by your site
4. Change the target location to the one you want to be redirect to

 

Ready-to-install scripts for:

golem.de
heise.de
zeit.de

Disable autoplay on Youtube’s new 2017 material design release

I happened to receive Youtube’s new 2017 desktop material design when I was watching videos the other day. All in all a great redesign which closes the gap to their other channels. You can force the new design by running the command below in your Firefox’s console’s command line (press [CMD] + [SHIFT] + [K]). Reload the page when done.

Unfortunately, the Firefox Greasemonkey script I used to disable Youtube’s autoplay feature does not work with their new site. Just removing the autoplay toggle’s node from the DOM does not do the trick anymore. My investigations brought to light that the f5 property of the PREF cookie is used to toggle the autoplay feature under the hood. f5=30000 is the default value to disable autoplay and f5=20000 the default to enable it. So I built a new Greasemonkey script which reads the existing PREF cookie, looks for the f5-property and sets it accordingly (or adds it if not present). At the same time all existing values are preserved. Additionally, the autonav_disable cookie is set. It was the first thing I found during my investigations which made me think “easy….”. Anyways, it turned out this cookie is not used to control autoplay. Not sure what it does, but I set it just to play safe. Finally a MutationObserver is used to wait for the autoplay toggle and remove it once it is loaded. DOMContentLoaded did not help as it seems like the node is added afterwards. To install the script, first get Greasemonkey for Firefox here . Once Greasemonkey is installed, click here to install the Userscript or paste the code below into your own script. Force reload Youtube by pressing [CMD] + [F5] after successfully installing the script.

Bonus: To hide Youtube’s cookie consent bar, uncomment the first occurrence of setCookieConsentHideCookie(); in the script.