<title>Sommar & Vinter i P1</title>
.replace(/\x26/g, '&')
.replace(/\x3c/g, '<')
.replace(/\x3e/g, '>')
.replace(/\x22/g, '"');
function tag(attr, content) {
var html = '<' + this, end = this == 'img' ? '' : '</'+ this +'>';
if (typeof attr == 'string') {
html += ' ' + q(key) + '="'+ q(String(attr[key])) +'"';
return html +'>'+ (content == null ? '' : content) + end;
['a', 'audio', 'div', 'img', 'h2', 'h4'].forEach(function(name) {
window[name] = function() { return tag.apply(name, arguments); };
var date = ep.when.replace(' klockan ', ', ');
var time = ep.minutes + ' min';
var link = { href: ep.url, title: ep.person };
if (text.indexOf(ep.person) === 0)
text = text.slice(ep.person.length).replace(/^[\s.]+/, '');
if (ep.person == false) delete link.title;
var attr = { class: 'episode', 'data-name': ep.title };
if (!(new RegExp(q.name || '', 'i')).test(ep.title))
attr.style = 'display: none';
h2(a(link, q(ep.title))),
img({ src: ep.img, title: text, width: 292, height: 164 }),
h4( q(date) + ' ('+ q(time) +')'),
audio({ src: ep.mp3, controls: true, preload: 'none' }),
window.onkeyup = function(e) {
if (e.target.nodeName !== 'INPUT') return;
var id = e.target.id, by = id && id.replace(/^by-/, '');
var val = e.target.value, match = new RegExp(val, 'i');
function show(x) { x.style.display = ''; }
function hide(x) { x.style.display = 'none'; }
[].slice.call(document.querySelectorAll(sel)).forEach(fn);
each('.episode', function(ep) {
ep.style.display = match.test(ep.dataset[by]) ? '' : 'none';
(s||location.search).replace(/\+/g, '%20').split('&').forEach(function(k, t) {
if (t = /^\??([^=]*)=(.*)/.exec(k))
try { data[decodeURIComponent(t[1])] = decodeURIComponent(t[2]); }
body.loaded .loading { display: none; }
audio { display: block; width: 300px; }
a { text-decoration: none; }
<tbody><tr><th width="10%">Pratare:</th><td><input class="filter" id="by-name"></td></tr>
var field = document.querySelector('#by-name');
window.onkeyup({ target: field });
try { !document.body.classList.contains('loaded') && fetch('sommar-vinter.json')
document.body.innerHTML += json.list.map(show).join('\n\n');
document.body.className += ' loaded';
console.log('parsing failed', ex);
document.body.innerHTML = 'Sorry; you need a modern browser like Chrome Canary, supporting the fetch api';
<h1 class="loading">Loading; please wait</h1>