1 if (typeof(
Cu) ==
"undefined")
2 var
Cu = Components.utils;
4 Cu.import(
"resource://app/jsmodules/SBDataRemoteUtils.jsm");
7 dump(
'last.fm faceplate debug: '+m+
'\n');
16 sbLastFmFaceplate.stationChanged();
20 sbLastFmFaceplate.requestChanged();
23 sbLastFmFaceplate.init =
24 function sbLastFmFaceplate_init() {
25 var stationIcon = document.getElementById(
"lastfm-station-icon");
26 stationIcon.style.visibility =
"collapse";
27 this.stationPref =
Application.prefs.get(
'songbird.lastfm.radio.station');
28 this.stationPref.events.addListener(
'change',
30 this.requestPref =
Application.prefs.get(
'songbird.lastfm.radio.requesting');
31 this.requestPref.events.addListener(
'change',
34 this._service = Components.classes[
'@songbirdnest.com/lastfm;1']
35 .getService().wrappedJSObject
37 if (this._service.station_name &&
this._service.station_name !=
'') {
38 Application.prefs.setValue(
'songbird.lastfm.radio.station',
39 this._service.station_name);
42 this._remotePreviousDisabled =
44 this._remoteNextDisabled =
46 this._remoteShuffleDisabled =
48 this._remoteRepeatDisabled =
53 sbLastFmFaceplate.fini =
54 function sbLastFmFaceplate_fini() {
55 this.stationPref.events.removeListener(
'change',
57 this.stationPref =
null;
58 this.requestPref.events.removeListener(
'change',
60 this.requestPref =
null;
61 Application.prefs.setValue(
'songbird.lastfm.radio.station',
'');
62 Application.prefs.setValue(
'songbird.lastfm.radio.requesting',
"0");
64 if(this._remotePreviousDisabled) {
65 this._remotePreviousDisabled.unbind();
66 this._remotePreviousDisabled =
null;
68 if(this._remoteNextDisabled) {
69 this._remoteNextDisabled.unbind();
70 this._remoteNextDisabled =
null;
72 if(this._remoteShuffleDisabled) {
73 this._remoteShuffleDisabled.unbind();
74 this._remoteShuffleDisabled =
null;
76 if(this._remoteRepeatDisabled) {
77 this._remoteRepeatDisabled.unbind();
78 this._remoteRepeatDisabled =
null;
82 sbLastFmFaceplate.stationChanged =
83 function sbLastFmFaceplate_stationChanged() {
84 LFFPD(
'stationChanged');
85 var stationIcon = document.getElementById(
"lastfm-station-icon");
86 if (this.stationPref.value ==
'') {
88 stationIcon.style.visibility =
"collapse";
91 this._remotePreviousDisabled.boolValue =
true;
92 this._remoteShuffleDisabled.boolValue =
true;
93 this._remoteRepeatDisabled.boolValue =
true;
96 stationIcon.style.visibility =
"visible";
101 sbLastFmFaceplate.requestChanged =
102 function sbLastFmFaceplate_requestChanged() {
103 LFFPD(
'requestChanged');
104 if (this.requestPref.value ==
"1") {
106 this._remoteNextDisabled.boolValue =
true;
109 this._remoteNextDisabled.boolValue =
false;
113 window.addEventListener(
'load',
function () { sbLastFmFaceplate.init() ;},
false);
114 window.addEventListener(
'unload',
function () { sbLastFmFaceplate.fini() ;},
false);
function sbLastFmFaceplate_stationPref_change()
function sbLastFmFaceplate_requestPref_change()