in xookiEdit.js [220:249]
xooki.action.remove = function () {
if (confirm(t("The current page will be removed from the table of content, and deleted on file system.\nNote that all children will be removed from the table of content too, but not from the file system!\nAre you sure you want to delete the current page?"))) {
// the page to which we'll be redirected...
var nextPage;
var index = xooki.page.meta.index;
var parent = xooki.page.meta.parent;
if (index > 0) {
// ... will be the previous sibling if there is one ...
nextPage = parent.children[index - 1];
} else if (parent.children.length > 1) {
// ... or the next sibling if there is one ...
nextPage = parent.children[index + 1];
} else if (parent != xooki.toc) {
// ... or the parent if the parent is not the toc root ...
nextPage = parent;
} else {
// ... otherwise it s a problem
xooki.error(t("Cannot delete the sole page!"));
return;
}
parent.children.splice(index, 1); // remove node from toc
xooki.toc.save();
xooki.io.removeFile(xooki.io.getLocalPath(window.location.toString()));
window.location = pu(nextPage.id);
}
}