1 var editlink = document.createElement('a');
2 editlink.className = 'nav';
3 editlink.appendChild(document.createTextNode('Nieuw artikel'));
4 editlink.onclick = function () {
5 var today = new Date().toJSON().slice(0, 10).split('-');
6 var input = prompt('Paginatitel', '');
7 if (!input) return false;
8 var url = today[0] + '/' + today[1] + '/' + today[2] + '-' +
9 input.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
10 var title = encodeURIComponent(input.trim());
11 window.location = '/nieuws/'+url+'?edit='+title+'#edit';
14 document.getElementById('news').appendChild(editlink);