Copy and paste this code following the instructions below, or you can put it togheter.
But if you put it all together you have to use jQuery before the first <script>
.
Remember put a valid Lastfm API key!
<script src="http://code.jquery.com/jquery-git2.min.js"></script>
Select a node with jQuery and apply this function: .lastSongs(username, apikey [, timeoutTime, styleSrc]);
username
: is your Lastfm username, or the user you want to show in the widgetapikey
: is your api key from LastfmtimeoutTime
: (Not required) set time in milliseconds for every update of informationstyleSrc
: (Not required) if you have the style file in other path or with other name, set its path here (only absolute paths)An example of this constructor can be: $('.lastfm').lastSongs('melchor629', '1largeapikey...');
This function returns an object. This object is used to manipulate some aspects of the widget, with API functions.
Something you should know: All this functions return the same object, allowing chaning functions like this:
$('.lastfm').lastSongs('melchor629', '1largeapikey...').setTimeout(60).setWidth(240).colorDeFondo(100, 234, 100, 0.8).applyStyle();
Changes the time to update information.
time
: Time in secondsSame as above function, buy in milliseconds
time
: Time in millisecondsChanges the width of the widget. Useful for change the size smaller for blogs with widget panels smaller than 300px.
width
: New width. Append ‘px’ at the end, if it’s a string.When some changes are done to the style of the widget, you should call this function to apply the changes. This function doesn’t affect the width.
Changes, internally, the background color of the widget. To apply the changes use .applyStyle()
r
: Red component of a rgb(a) color. Valid range [0, 255]g
: Green component of a rgb(a) color. Valid range [0, 255]b
: Blue component of a rgb(a) color. Valid range [0, 255]a
: Alpha of a rgba color. Valid range [0, 1], float numbers are validChanges, internally, the header color text of the widget. To apply the changes use .applyStyle()
r
: Red component of a rgb(a) color. Valid range [0, 255]g
: Green component of a rgb(a) color. Valid range [0, 255]b
: Blue component of a rgb(a) color. Valid range [0, 255]Changes, internally, the song title text color of the widget. To apply the changes use .applyStyle()
r
: Red component of a rgb(a) color. Valid range [0, 255]g
: Green component of a rgb(a) color. Valid range [0, 255]b
: Blue component of a rgb(a) color. Valid range [0, 255]Changes, internally, the song artist text color of the widget. To apply the changes use .applyStyle()
r
: Red component of a rgb(a) color. Valid range [0, 255]g
: Green component of a rgb(a) color. Valid range [0, 255]b
: Blue component of a rgb(a) color. Valid range [0, 255]Changes, internally, the song album text color of the widget. To apply the changes use .applyStyle()
r
: Red component of a rgb(a) color. Valid range [0, 255]g
: Green component of a rgb(a) color. Valid range [0, 255]b
: Blue component of a rgb(a) color. Valid range [0, 255]Changes, internally, the background of one of the song list color of the widget. To apply the changes use .applyStyle()
r
: Red component of a rgb(a) color. Valid range [0, 255]g
: Green component of a rgb(a) color. Valid range [0, 255]b
: Blue component of a rgb(a) color. Valid range [0, 255]