extension/content.js
// Find podcast URL, title and date
Find podcast URL, title and date
Find podcast URL title and date
function CheckAndDisplayLatestPodcast()
{
	if(window.location.href.indexOf('/series/friendcast/') > 0)
	{	
		var podcastLink = $('.archivetitle a')[1];
		var podcastDate = $('.archivedate')[0].innerHTML;
		var podcastUrl = podcastLink.href;
		var podcastTitle = podcastLink.text;
		PopulatePodcastPlayer(podcastUrl, podcastTitle, podcastDate);
	}
	else
	{
		$.ajax({
			'url':'/series/friendcast/',
			'dataType':'html',
			'success': function(data, status)
			{
				var archiveItemIndex = data.indexOf('<li class="archiveitem">');
				var archiveItemEnd = data.indexOf('</li>', archiveItemIndex) + 6;
				var archiveDivContent = $(data.substring(archiveItemIndex, archiveItemEnd));
				var podcastLink = archiveDivContent.find('a')[3];
				var podcastDate = archiveDivContent.find('.archivedate')[0].innerHTML;
				var podcastUrl = podcastLink.href;
				var podcastTitle = podcastLink.text;
				PopulatePodcastPlayer(podcastUrl, podcastTitle, podcastDate);				
			}
		});
	}	
}
function CheckAndDisplayLatestPodcast ( ) { if ( window . location . href . indexOf ( '/series/friendcast/' ) > 0 ) { var podcastLink = $ ( '.archivetitle a' ) [ 1 ] ; var podcastDate = $ ( '.archivedate' ) [ 0 ] . innerHTML ; var podcastUrl = podcastLink . href ; var podcastTitle = podcastLink . text ; PopulatePodcastPlayer ( podcastUrl , podcastTitle , podcastDate ) ; } else { $ . ajax ( { 'url' : '/series/friendcast/' , 'dataType' : 'html' , 'success' : function ( data , status ) { var archiveItemIndex = data . indexOf ( '<li class="archiveitem">' ) ; var archiveItemEnd = data . indexOf ( '</li>' , archiveItemIndex ) + 6 ; var archiveDivContent = $ ( data . substring ( archiveItemIndex , archiveItemEnd ) ) ; var podcastLink = archiveDivContent . find ( 'a' ) [ 3 ] ; var podcastDate = archiveDivContent . find ( '.archivedate' ) [ 0 ] . innerHTML ; var podcastUrl = podcastLink . href ; var podcastTitle = podcastLink . text ; PopulatePodcastPlayer ( podcastUrl , podcastTitle , podcastDate ) ; } } ) ; } }
Find podcast URL, title and date
Find podcast URL title and date
//you're on the series page, find the latest item in the list. // Request the series page to get latest episode // parse returned data to get the relevant elements // turn archive items and children into dom objects to make searching easier.