26 lines
867 B
JavaScript
26 lines
867 B
JavaScript
function movePage() {
|
|
const current = window.location.pathname;
|
|
const target = prompt('Move this page to (absolute path):', current);
|
|
if (target === null) return;
|
|
const clean = target.trim();
|
|
if (!clean || !clean.startsWith('/')) {
|
|
alert('Move target must be an absolute path starting with /');
|
|
return;
|
|
}
|
|
const form = document.createElement('form');
|
|
form.method = 'POST';
|
|
form.action = current + '?move=' + encodeURIComponent(clean);
|
|
document.body.appendChild(form);
|
|
form.submit();
|
|
}
|
|
|
|
function deletePage() {
|
|
const current = window.location.pathname;
|
|
if (!confirm('Delete ' + current + ' and everything inside it?')) return;
|
|
const form = document.createElement('form');
|
|
form.method = 'POST';
|
|
form.action = current + '?delete=1';
|
|
document.body.appendChild(form);
|
|
form.submit();
|
|
}
|