Add redirect support (e.g., after renames). Fixes #1023.

This commit is contained in:
Bart Kamphorst
2019-10-05 13:32:28 +02:00
parent 8fe4c614db
commit 8f104ec09c
3 changed files with 30 additions and 9 deletions
@@ -102,6 +102,12 @@ function preparePage () {
}
}
function flashNotice(type, notice) {
// accepted types: info, success, warn, error
html = '<p><div class="flash flash-' + type +'"><button class="flash-close js-flash-close" type="button" onclick="parentNode.remove()"><%=rocticon('x')%></button>' + notice + '</div></p>';
$('#wiki-content h1').before(html);
}
// ua
$(document).ready(function() {
// for deleting the current page
@@ -148,6 +154,11 @@ $(document).ready(function() {
}
}
if (match = new RegExp(/\?redirected\_from=([^?]*)/).exec(window.location.href)) {
notice = "The page you requested was renamed or moved. You've been successfully redirected to its new location.";
flashNotice('success', notice);
}
if ($('#minibutton-upload-page').length) {
new ClipboardJS('#ClipboardJSlink');
$('#minibutton-upload-page').parent().removeClass('jaws');