Skip to content

Instantly share code, notes, and snippets.

@jwkblades
jwkblades / README.md
Created May 27, 2014 18:56
music.xbox.com duration calculation bookmarklet

music.xbox.com now playing duration calculator

This bookmarklet calculates the duration of your currently-loaded Now Playing tab. It does this by looking at all of their duration elements on the page, parsing them, summing them, and then breaking that up into hours, minutes, and seconds, which it adds to the top bar (secondaryMetadata).

Usage

Usage is simple. Create a bookmark with a custom URL, and add the code from duration_bookmarklet.js to it as the URL. Name the bookmark whatever you want and when you want to see your Now Playing duration, assuming you are on the Now Playing page and have the entire playlist loaded, you can click on the bookmark to have it calculated for you.

@jwkblades
jwkblades / bookmarklet.js
Created June 17, 2019 19:04
Bookmarklet to sort Google Music albums by year descending (most recent first)
javascript:(function(){var cards = Array.from(document.querySelectorAll(".lane-content > .material-card")); var sorted = cards.sort(function(a, b) {var getDate = function(ele) {return parseInt(ele.querySelector(".sub-title").innerText);}; return getDate(b) - getDate(a); }); sorted.forEach(function(e) { e.parentNode.appendChild(e); });})();