Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Modifying to make it more like the app
var $activeEpisodes = $(".episodecell");
var episodesReversedElements = $activeEpisodes.toArray().reverse();
var lastPodcastName;
episodesReversedElements.forEach(function (elem) {
var $activeEpisode = $(elem);
var podcastName = $activeEpisode.find(".titlestack div:first-child").text();
var podcastImgSrc = $activeEpisode.find(".art").attr("src");
if (podcastName !== lastPodcastName) {
makeActivePodcastCell(podcastName, podcastImgSrc);
lastPodcastName = podcastName;
function makeActivePodcastCell (podcastName, imgSrc) {
var $episodeCell = $activeEpisodes.first();
var $cell = $episodeCell.clone();
$cell.find(".art").attr("src", imgSrc);
$cell.on("click", function (event) {
replaceWithEpisodes($cell, podcastName);
function replaceWithEpisodes ($elem, podcastName) {
var episodesWithPodcastName = episodesReversedElements.filter(function (elem) {
return $(elem).find(".titlestack div:first-child").text() === podcastName;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.