Skip to content

Instantly share code, notes, and snippets.

@Kalli
Created September 20, 2013 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kalli/6637015 to your computer and use it in GitHub Desktop.
Save Kalli/6637015 to your computer and use it in GitHub Desktop.
Javascript bookmarklet for getting release information of a Discogs (http://www.discogs.com) release page, for easy copy/pasting to a spreadsheet or the like. Use a bookmarklet maker like the Bookmarlet Crunchinator (http://ted.mielczarek.org/code/mozilla/bookmarklet.html) to create a bookmarklet version
var artist = $('.profile h1 span').first().text().replace(/\n/g,"").replace(/\s\s+/g,"");
var release = $('.profile h1 span').last().text().replace(/\n/g,"").replace(/\s\s+/g,"");
var label = $('.profile .content').first().text().replace(/\n/g,"").replace(/\s\s+/g,"");
var releasedate= $('.profile .content:eq(3)').text().replace(/\n/g,"").replace(/\s\s+/g,"");
var style = $('.profile .content:eq(5)').text().replace(/\n/g,"").replace(/\s\s+/g,"");
// if releasedate has full date, get just the year;
if(releasedate.length>4){;
releasedate = releasedate.slice(-4);
};
var url = document.location.toString();
document.write(artist+"\t"+release+"\t"+label+"\t"+releasedate+"\t"+style+"\t=HYPERLINK(\""+url+"\",\"Discogs Link\")");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment