edit this page - page history - about editing


  1. My last.fm (jdub_dub)

Mass Track Delete

Occasionally I accidentally leave a machine running while it is playing music (e.g. through headphones), and as a result my Last.fm gets polluted with tracks. I don't know of any way in Last.fm to delete multiple tracks, so I finally got fed up and developed the following bookmarklet.

When you are on your tracks page and run the code below, it will iterate through every delete icon and click it; it will take about 50 seconds to delete most of the elements on the page.

WARNING It will delete anything that it can find, so don't run it on other pages!

You can either drag this link into your bookmarks, or you can copy and paste the code directly:

javascript:if(typeof HTMLElement!='undefined'&&!HTMLElement.prototype.click) HTMLElement.prototype.click = function(){ var evt = this.ownerDocument.createEvent('MouseEvents'); evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null); this.dispatchEvent(evt); }; var mdf=function(){ var e = document.getElementsByClassName('dismiss_icon'); if (e.length > 0) { window.setTimeout(mdf, 1000); e[0].click(); } }; mdf();

It uses code written by Jason Karl Davis to emulate element clicking (Firefox does not support arbitrary click()).

Part 2

This is an updated version of the above code. draggable link


Part 3

This works on the most recent last.fm website. Uses [jQuery] to be more straightforward.

jQuery(".chartlist-delete-button").each(function(i, e) { window.setTimeout(function() { e.click(); }, 300 * i); })

edit this page - what links to here? - page history - top
Last edited by jevon jevon 14 months ago