{ //{{{ Lastfm if(!window.Lastfm) { var Lastfm = { //{{{ Constants RES_TRACK: 9, RES_ARTIST: 6, RES_BASE: 0, //}}} //{{{ Variables resources: new Array(), //}}} //{{{ Classes //{{{ Resource superclass Resource: { Resource: function(_restype, anchor, placebutton, icon) { this.icon = this.icon ? this.icon : (icon ? icon : false); this._restype= _restype; this.anchor= anchor; this.href= typeof(this.anchor)=='object' ? this.anchor.href : this.anchor; this.index= Lastfm.resources.length; this.linkcount = 0; this.track= ''; this.placebutton = placebutton; //{{{ private functions this.placeInfoBox = function () { var swfaddress = 'http://imagegen.last.fm/flashpreviews/6/'; var session = '';//document.location.href.match(/^http:\/\/(imagegen|test|www|beta|)\.last.fm\//) && getCookie ? getCookie('Session') : ''; swfaddress = swfaddress+this.swf+'?url='+escape(this.href)+'&index='+this.index+'&session='+session+'&self='+escape(document.location.href); this.swfCode = ''; var code = '
'; if(!this.placebutton) { document.write(code); } else { Lastfm.Insertion.before(code, this.button); } //get the div we just inserted. this.infoBox = document.getElementById('LastfmResourceInfoBox'+this.index); this.infoBox.style.position = 'absolute'; } this.placeButton = function () { var icon= this.icon ? this.icon : 'http://playground.audioscrobbler.com/steve/extlinks/new/icon.php?url='+this.href; var button = ''; this.linkcount++; if(typeof this.anchor == 'object') { Lastfm.Insertion.before(button, this.anchor); } else { document.write(button); } //get the div we just inserted. this.button = document.getElementById('LastfmResourceButton'+this.index); if(this.postPlace) this.postPlace(); } //}}} if(this.placebutton) this.placeButton(); this.placeInfoBox(); //{{{ public functions this.finish = function() { this.isStarted = false; if(this._finish) { this.finish = this._finish; this._finish = false; } this.finished(); this.onend(); } this.close = function() { this.closed(); this.isStarted = false; this.onend(); } this.stop = function() { this.isStarted = false; //reset finish so that it doesn't go to the next song. this.stopped(); this.onend(); } this.start = function(e) { if(!this.startedBefore) { this.init(); } for(var i=0; i