A simple, lightweight jQuery plugin to display a user's recently scrobbled tracks on Last.fm.
JavaScript CSS
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
build
demo
src
.DS_Store
LICENSE.md
README.md
bower.json
tunez.jquery.json

README.md

Tunez

A simple, lightweight jQuery plugin used to display songs recently scrobbled by a Last.fm user.

A Last.fm API key is required for this plugin. Click here to aquire one.

See a demo

Instructions

Include jQuery and the plugin in the head or footer of your page.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<script src="/js/plugins/tunez.js"></script>

Create an element with a class or ID that will display the recently scrobbled songs.

<div id="tunez"></div>

Initialize the plugin targeting the class, ID or element.

$('#tunez').tunez();

The plugin will replace the element with an ordered or unordered list with each scrobbled track and each detail will be wrapped in a span for you to style it however you wish.

Example Ouput:

<ol>

    <li>
        <img src="http://last.fm" alt="ALbum Title" class="artwork">
        <span class="details">
            <span class="title"><a href="http://last.fm" target="_blank">Song Title</a></span>
            <span class="album">(Album Title)</span>
            <span class="artist"><a href="http://last.fm" target="_blank">Artist</a></span>
        </span>
    </li>

</ol>

Options

  1. key: "api key"
    A string that defines your Last.fm API key (default: null).
  2. username: "username"
    A string that defines the user's Last.fm username (default: null).
  3. limit: integer
    An integer that indicates the amount of scrobbled songs to display (default: 5).
  4. ordered: boolean
    A boolean value that indicates whether or not the list of songs should be ordered (default: true).
  5. href: true / false
    A boolean that indicates whether or not the song and artist should be links (default: true).
  6. album: true / false
    A boolean that indicates whether or not you want the album name shown (default: true).
  7. artwork: boolean
    A boolean to indicate whether or not the album artwork is displayed (default: true).
  8. success: function
    A callback function that runs after the data has been retrieved (default: function()).
  9. error: function
    A callback function that runs if there was an error retrieving the data (default: function()).
Example:
$(function() {

    $('#tunez').tunez({
        key: '1e2fbabb102c1fa0760379b9ef6f9ecc',
        username: 'michaelynch',
        limit: 10,
        ordered: false,
        href: false,
        album: false,
        artwork: false,
        success: function() {
            console.log('Rock and roll.')
        },
        error: function() {
            console.log('Without music, this is a mistake.');
        }
    });

});