Jump to content

[help] Javascript in Konfabulator Widget


Recommended Posts

I am porting over GC's Sleek Tunes widget from AveDesk to Konfabulator for personal use, and I have everything, except the rating and the album art. I'm using XiDG's AlTunes as a base. AlTunes doesn't have rating in it, so I took a peek at iTunes Display's code and found this

					rawRating = telliTunes('return ((get rating of current track) as string)');

if (preferences.custom_rating.value == 0) {

if (rawRating == 0) {

rating.data = rating_shadow.data = "?????";

} else if (rawRating/20 == 1) {

rating.data = rating_shadow.data = "?????";

} else if (rawRating/20 == 2) {

rating.data = rating_shadow.data = "?????";

} else if (rawRating/20 == 3) {

rating.data = rating_shadow.data = "?????";

} else if (rawRating/20 == 4) {

rating.data = rating_shadow.data = "?????";

} else if (rawRating/20 == 5) {

rating.data = rating_shadow.data = "?????";

} else {

rating.data = rating_shadow.data = "";

}

so I modified it to show images instead:

				rawRating = telliTunes('return ((get rating of current track) as string)');

if (preferences.custom_rating.value == 0) {

if (rawRating == 0) {

rating.src = "Resources/rate0.png";

} else if (rawRating/20 == 1) {

rating.src = "Resources/rate1.png";

} else if (rawRating/20 == 2) {

rating.src = "Resources/rate2.png";

} else if (rawRating/20 == 3) {

rating.src = "Resources/rate3.png";

} else if (rawRating/20 == 4) {

rating.src = "Resources/rate4.png";

} else if (rawRating/20 == 5) {

rating.src = "Resources/rate5.png";

} else {

rating.src = "";

}

}

I added this to my kon file:

	<image src="Resources/rate0.png">

<name>rating</name>

<hOffset>76</hOffset>

<vOffset>87</vOffset>

</image>

The thing is it doesn't display my rating, just the rate0.png. Also now when I launch the widget, it shows "undefined" in the info pane for a couple of seconds, then displays the info. Help is appreciated :)

Link to comment

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...