-var editlink = document.createElement('a');
-editlink.className = 'nav';
-editlink.appendChild(document.createTextNode('Nieuw artikel'));
-editlink.onclick = function () {
- var today = new Date().toJSON().slice(0, 10).split('-');
- var input = prompt('Paginalink (beknopte titel)', '');
- if (!input) return false;
- var url = today[0] + '/' + today[1] + '-' + today[2] + '-' +
- input.toLowerCase().replace(/[^a-z0-9]+/g, '-').trim();
- var title = encodeURIComponent(input.trim());
- window.location = window.location.pathname+'/'+url+'?edit='+title+'#edit';
- return false;
-};
-document.getElementById('news').appendChild(editlink);
+document.addEventListener('DOMContentLoaded', () => {
+ var overview = document.getElementById('news');
+ if (overview) {
+ var editlink = document.createElement('a');
+ editlink.className = 'nav';
+ editlink.appendChild(document.createTextNode('Nieuw artikel'));
+ editlink.onclick = function () {
+ var today = new Date().toJSON().slice(0, 10).split('-');
+ var input = prompt('Paginalink (beknopte titel)', '');
+ if (!input) return false;
+ var url = today[0] + '/' + today[1] + '-' + today[2] + '-' +
+ input.toLowerCase().replace(/[^a-z0-9]+/g, '-').trim();
+ var title = encodeURIComponent(input.trim());
+ window.location = window.location.pathname+'/'+url+'?edit='+title+'#edit';
+ return false;
+ };
+ overview.appendChild(editlink);
+ }
+});
$replyform = $Page == 'melding' && !empty($User);
@list ($year, $page) = explode('/', trim($Args, '/'));
+if (!empty($User['admin'])) {
+ print '<script src="/nieuws/edit.js"></script>'."\n";
+}
+
if ($page and !is_numeric($page)) {
$edit = !empty($User['admin']) ? htmlspecialchars(@$_GET['edit']) : NULL;
$article = new ArchiveArticle("$Page$Args.html");
print placeholder_include('nieuws', [$match]);
return 1;
}
-
-if (!empty($User['admin'])) {
- print '<script src="/nieuws/edit.js"></script>'."\n";
-}