Perfect for Media PPs that the user is unable to or does not want to add images to specific episodes. Must wrap in element checker bc this pp builds itself after dom, so must fire after that.
This also maps your items in a Json, and randomly selects one.
ie http://cloud.madebyspeak.com/fcc5a9 http://cloud.madebyspeak.com/45f9b3
<script>
function checkForItem(elementName) {
if ($('.series-list li a img').length >= 1) {
clearInterval(elementChecker);
$(".no-image").each(function() {
var theImages = {{ List.Items | Map: "FieldValues" | Map: "Image" | Json }},
rando = theImages[ Math.floor(Math.random() * theImages.length)];
$(this).attr("src", rando);
})
}
}
var elementChecker = setInterval(function() { checkForItem(".series-list li a img"); }, 500);
</script>