function myFunction() { window.open("http://player.radioplus.org.uk", "_blank", "toolbar=no,scrollbars=no,resizable=yes,width=450,height=800"); }
$(document).ready(function() { // Function to update text and image based on custom time and day conditions function updateContentBasedOnTimeAndDay() { var currentDate = new Date(); var hours = currentDate.getHours(); var minutes = currentDate.getMinutes(); var day = currentDate.getDay(); // 0: Sunday, 6: Saturday
var text = ""; var imageSrc = "";
// Custom condition for a specific time on a specific day
// Monday
if (day === 1 && hours >= 7 && hours < 10) {
text = "The Radio Plus Breakfast Show with Macca";
imageSrc = "images/monday-morning.jpg";
}
else if (day === 1 && hours >= 10 && hours < 13) {
text = "Radio Plus Daytime";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 1 && hours >= 13 && hours < 14) {
text = "The Radio Plus Recharge";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 1 && hours >= 14 && hours < 18) {
text = "The Afternoon Show with Paul Wheeler";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 1 && hours >= 18 && hours < 19) {
text = "The City Hit List";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 1 && hours >= 19 && hours < 24) {
text = "Radio Plus’s Greatest Hits";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 1 && hours >= 1 && hours < 7) {
text = "Radio Plus’s Greatest Hits";
imageSrc = "images/friday-evening.jpg";
}
// Tuesday
else if (day === 2 && hours >= 7 && hours < 10) {
text = "The Radio Plus Breakfast Show with Macca";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 2 && hours >= 10 && hours < 13) {
text = "Radio Plus Daytime";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 2 && hours >= 13 && hours < 14) {
text = "The Radio Plus Recharge";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 2 && hours >= 14 && hours < 18) {
text = "The Afternoon Show with Paul Wheeler";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 2 && hours >= 18 && hours < 19) {
text = "The City Hit List";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 2 && hours >= 19 && hours < 10) {
text = "The Mixtape with Rich & Jess";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 2 && hours >= 19 && hours < 22) {
text = "The Mixtape with Rich & Jess";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 2 && hours >= 22 && hours < 24) {
text = "Radio Plus’s Greatest Hits";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 2 && hours >= 1 && hours < 7) {
text = "Radio Plus’s Greatest Hits";
imageSrc = "images/friday-evening.jpg";
}
// Wednesday
else if (day === 3 && hours >= 7 && hours < 10) {
text = "The Radio Plus Breakfast Show with Macca";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 3 && hours >= 10 && hours < 13) {
text = "Radio Plus Daytime";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 3 && hours >= 13 && hours < 14) {
text = "The Radio Plus Recharge";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 3 && hours >= 14 && hours < 18) {
text = "The Afternoon Show with Paul Wheeler";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 3 && hours >= 18 && hours < 19) {
text = "The City Hit List";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 3 && hours >= 19 && hours < 22) {
text = "The PM Music Café with Freddie & Charlie";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 3 && hours >= 22 && hours < 24) {
text = "Radio Plus’s Greatest Hits ";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 3 && hours >= 1 && hours < 7) {
text = "Radio Plus’s Greatest Hits ";
imageSrc = "images/friday-evening.jpg";
}
// Thursday
else if (day === 4 && hours >= 7 && hours < 10) {
text = "The Radio Plus Breakfast Show with Macca";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 4 && hours >= 10 && hours < 13) {
text = "Radio Plus Daytime";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 4 && hours >= 13 && hours < 14) {
text = "The Radio Plus Recharge";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 4 && hours >= 14 && hours < 18) {
text = "The Afternoon Show with Paul Wheeler";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 4 && hours >= 18 && hours < 19) {
text = "The City Hit List";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 4 && hours >= 19 && hours < 22) {
text = "The New Music Show with Emily Brett";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 4 && hours >= 22 && hours < 24) {
text = "Radio Plus’s Greatest Hits ";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 4 && hours >= 1 && hours < 7) {
text = "Radio Plus’s Greatest Hits ";
imageSrc = "images/friday-evening.jpg";
}
// Friday
else if (day === 5 && hours >= 7 && hours < 10) {
text = "The Radio Plus Breakfast Show with Macca";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 5 && hours >= 10 && hours < 13) {
text = "Radio Plus Daytime";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 5 && hours >= 13 && hours < 14) {
text = "The Radio Plus Recharge";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 5 && hours >= 14 && hours < 18) {
text = "The Afternoon Show with Paul Wheeler";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 5 && hours >= 18 && hours < 19) {
text = "The City Hit List";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 5 && hours >= 19 && hours < 21) {
text = "Weekend Anthems";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 5 && hours >= 21 && hours < 24) {
text = "Radio Plus’s Greatest Hits ";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 5 && hours >= 1 && hours < 7) {
text = "Radio Plus’s Greatest Hits ";
imageSrc = "images/friday-evening.jpg";
}
// Saturday
else if (day === 6 && hours >= 7 && hours < 10) {
text = "The Saturday Breakfast Show with Sam Ingrams";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 6 && hours >= 10 && hours < 12) {
text = "The Film and Arts Show with Lee Greenough";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 6 && hours >= 12 && hours < 14) {
text = "Radio Plus Hits";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 6 && hours >= 14 && hours < 18) {
text = "The Radio Plus Sports Show with Paul Wheeler and Matt Broomfield";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 6 && hours >= 18 && hours < 24) {
text = "Radio Plus’s Greatest Hits";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 6 && hours >= 1 && hours < 7) {
text = "Radio Plus’s Greatest Hits";
imageSrc = "images/friday-evening.jpg";
}
// Sunday
else if (day === 0 && hours >= 7 && hours < 10) {
text = "The Sunday Breakfast Show";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 0 && hours >= 10 && hours < 11) {
text = "The Sunday Service with David Stone";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 0 && hours >= 11 && hours < 24) {
text = "Radio Plus’s Greatest Hits";
imageSrc = "images/friday-evening.jpg";
}
else if (day === 0 && hours >= 1 && hours < 7) {
text = "Radio Plus’s Greatest Hits";
imageSrc = "images/friday-evening.jpg";
}
// else if (day === 5 && hours >= 18 && hours < 19) { // Friday at 5:00 PM
// text = "It's Friday evening! The weekend is here!";
// imageSrc = "images/friday-evening.jpg";
// }
// else if (day === 0 && hours >= 10 && hours < 12) { // Sunday between 10:00 AM and 12:00 PM
// text = "Good Sunday morning! Relax and enjoy the day!";
// imageSrc = "images/sunday-morning.jpg";
// } else if (day === 3 && hours === 15 && minutes === 30) { // Wednesday at 3:30 PM
// text = "It's Wednesday afternoon, halfway through the week!";
// imageSrc = "images/wednesday-afternoon.jpg";
// }
// else {
// // Default time-based message (morning, afternoon, evening)
// if (hours >= 6 && hours < 12) {
// text = "Good Morning!";
// imageSrc = "images/morning.jpg";
// } else if (hours >= 12 && hours < 18) {
// text = "Good Afternoon!";
// imageSrc = "images/afternoon.jpg";
// } else if (hours >= 18 && hours < 22) {
// text = "Good Evening!";
// imageSrc = "images/evening.jpg";
// } else {
// text = "Good Night!";
// imageSrc = "images/night.jpg";
// }
// }
// Update the content of the h1 tag and the image source
$('#dynamicText').text(text);
$('#dynamicImage').attr('src', imageSrc);
}
// Call the function initially when the page loads
updateContentBasedOnTimeAndDay();
// Update the content every minute to check for any custom conditions
setInterval(updateContentBasedOnTimeAndDay, 60000); // Update every minute
});
