Posts

Showing posts from July, 2009

Windows 7 WMC Streaming Radio

If you're using Windows 7 WMC (or Windows Vista VMC) and have any interest in streaming radio or local radio, then you should definitelly check out the RadioTime plugin. I've previously recommended mcShoutCast or Yougle, both of which can stream ShoutCast stations (Yougle can do more, including YouTube, MSN, etc). I've just come across RadioTime however, which blows them both out of the water.
The WMC/VMC plugin has a very nice interface that's very easy to browse and categorises stations by genre, region & favorites. It also lets you listen to local FM radio if you have a compatible FM tuner (most analog TV tuners will double as a radio tuner).
You can also go to www.radiotime.com and listen to streaming music directly straight from the browser (nothing new there, you can do the same with ShoutCast and many others). The online page also lists local radio stations which are streamed over the internet.

JavaScript Select/List Box Filter

I've recently built a simple filter for some HTML tables and SELECT list-boxes (originally covered here). The SELECT filter is very basic in functionality:Create an expanded SELECT element (size>1) somewhere on your page and give it a unique id.Create a filter textbox above or below the list-box and bind the onkeyup event to trigger a filter function.The filter function takes the value from the textbox and hides/removes any list-box elements that don't match.One method of doing this is to set the display style of individual OPTION elements withing the SELECT list-box to either 'none' or 'block'. This can be done quite easily with jQuery in only 2 lines of code, namely:
MyUtil.selectFilter = function(selectId, filter) {
$("#" + selectId).find('option').hide();
$("#" + selectId).find('option:Contains("' + filter + '")').show();
}

You would bind this to your SELECT box as follows:
<b>Filter:</b> <in…

JavaScript trap and cancel window close event

Getting straight to the point, the following JavaScript code will present users with a dialog warning whenever they try to navigate away from a page (working example here):

<html>
<head>
<script type="text/javascript">
window.onbeforeunload = function (evt) {
return "DON'T DO IT!";
}
</script>
</head>
<body>
<h3>Try to close me or navigate away...</h3>
</body>
</html>

Yes, it's that simple. Whenever the user tries to navigate away from the page in any way (refresh/back/forward) or to close the page by closing the browser tab or browser window itself, they are prompted with a dialog box asking them to confirm the action. If the user selects cancel, the page navigation or browser close event is discarded. I'll repeat that again - the browser will not close if the user presses cancel! I've tested this and it works in Firefox 3+, Google Chrome and IE8+ (not sure about IE6 or IE7).
The rea…