Everything, Everything

2021: January
2020: J F M A M J J A S O N D
2019: J F M A M J J A S O N D
2018: J F M A M J J A S O N D
2017: J F M A M J J A S O N D
2016: J F M A M J J A S O N D
2015: J F M A M J J A S O N D
2014: J F M A M J J A S O N D
2013: J F M A M J J A S O N D
2012: J F M A M J J A S O N D
2011: J F M A M J J A S O N D
2010: J F M A M J J A S O N D
2009: J F M A M J J A S O N D
2008: J F M A M J J A S O N D
2007: J F M A M J J A S O N D
2006: J F M A M J J A S O N D
2005: J F M A M J J A S O N D
2004: J F M A M J J A S O N D
Flattery
Thursday 19th April, 2007 10:24 Comments: 2
They say that imitation is the sincerest form of flattery. I was looking at the various new radio gadgets at gallery.live.com to see if there were any cool features that I should consider for my gadget. I came across one simple looking gadget that apparently lets you control the volume using the scrollwheel. Excellent, as that way you can control the volume on the themes that don't have volume control graphics! So I looked at the code and what did I see?

I saw some stylesheet information for an "#onNowImage". It could have been a coincidence, as although I had used that on my gadget, with the same case, it's not exactly proof. But then I looked further down and came across my div with an id of "gadgetFooter". I then looked at the JavaScript code to see how the volume control works and came across:

function SettingsClosed()
{

var currentSetting = new String(System.Gadget.Settings.read("stationPicker"));
var wasPlaying = 0;

if(controlImage.src == "images/btnStop.gif"){
wasPlaying = 1;
}

if (mediaPlayer.url != (currentSetting.split("|")[0]))
{

// station has changed, so change the URL

if (currentSetting != "")
{

onNowImage.src = "http://radio.akado.ru/ai/radio." + currentSetting.split("|")[1] + "/logo.gif";


mediaPlayer.url = currentSetting.split("|")[0];
if(wasPlaying)
{
mediaPlayer.controls.play();
}
}

}

}


The wasPlaying variable is definitely my creation. I'm pretty sure the "// station has changed, so change the URL" comment is one of mine too, but from an older version (I now keep track of the stations against the stationTracker). Still, I don't particularly mind (everyone else seems to copy off each other), and hopefully it'll stop the author from complaining if I decide to use his wheelmouse volume control code (EDIT: although I've seen it elsewhere, so perhaps it was written by another person). I'll probably have to rewrite it to fit in with the rest of my code. Most of the other gadgets don't permanently store anything other than the current radio station or background image, mine stores the volume too, which is why it can be a bit sluggish at changing volume (no one else appears to save the volume setting after any adjustments). Microsoft's Sidebar gets a bit sluggish when you make it write to the registry.
Avatar Yamahito - Thursday 19th April, 2007 11:04
I thought this was going to be about your UPS not holding charge...
Avatar Robert - Thursday 19th April, 2007 13:22
Nah, it seems to be coping for now. It failed a self test I ran, as I figured it'd been a year so it might be worth testing, but passed the second time. I'm not entirely sure when I bought it, but it's been on constantly ever since. It's a nice pun though, might use it when I do give up on the UPS and buy something newer and better (the current one moaned a little bit when I had two systems under full load connected to it, as there was only 4 minutes of backup time left).
© Robert Nicholls 2002-2021
The views and opinions expressed on this site do not represent the views of my employer.
HTML5 / CSS3