Client-side filter: hide bare NG non-graduate research-note markers
Add Aviary (Milken) click-to-play interview embeds
Line 664: Line 664:
ev.preventDefault();
ev.preventDefault();
playSoundCloud($slot, trackId, title);
playSoundCloud($slot, trackId, title);
});
});
}());
(function buildAviaryEmbeds() {
var AV_MEDIA = /^[0-9]{4,12}$/;
function playAviary($slot, mediaId, title) {
var src = 'https://milken.aviaryplatform.com/embed/media/' +
encodeURIComponent(mediaId) +
'?embed=true&media_player=true';
var $iframe = $('<iframe class="aviary-embed-frame" allowfullscreen allow="autoplay; encrypted-media; fullscreen; picture-in-picture"></iframe>')
.attr({
src: src,
title: title || 'Aviary media',
loading: 'lazy'
});
$slot.empty().append($iframe).addClass('aviary-embed-playing');
}
$('.mw-parser-output .aviary-embed[data-aviary-media]').each(function () {
var $slot = $(this);
if ($slot.data('rbAviaryEmbed')) {
return;
}
var mediaId = String($slot.attr('data-aviary-media') || '');
if (!AV_MEDIA.test(mediaId)) {
return;
}
$slot.data('rbAviaryEmbed', 1);
var title = String($slot.attr('data-title') || 'Aviary media');
var $fallback = $slot.find('.aviary-embed-fallback').first();
var $btn = $('<button type="button" class="aviary-embed-play"></button>')
.attr('aria-label', 'Play ' + title)
.append($('<span class="aviary-embed-play-icon" aria-hidden="true"></span>'))
.append($('<span class="aviary-embed-play-text"></span>').text('Play audio'));
var $poster = $('<div class="aviary-embed-poster"></div>').append($btn);
if ($fallback.length) {
$fallback.before($poster);
$fallback.hide();
} else {
$slot.prepend($poster);
}
$poster.on('click', function (ev) {
ev.preventDefault();
playAviary($slot, mediaId, title);
});
});
});
});