Skip to content
Snippets Groups Projects
Commit e3d52800 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

feat: remove the redirection from the history

parent bd664439
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,10 @@
}
}
function RedirectTo(newLocation) {
document.location.replace(newLocation);
}
// Pick the shortcut link destination from URL, like: `category:subcategory:card-name`
var sub = GetShortcutDestination();
......@@ -43,13 +47,13 @@
var internalCardURL = internalPortalURL + '/stable/internal/cards/' + sub;
UrlExists(internalCardURL, function(status){
if (status == 200) { // The sub-card is internal, and is accessible
window.location.href = internalCardURL;
RedirectTo(internalCardURL);
} else {
UrlExists(internalPortalURL + '/stable/external/cards/' + sub, function(status){
if (status == 200) { // if sub-card is internal in the external directory and exists
window.location.href = internalPortalURL + '/stable/external/cards/' + sub;
RedirectTo(internalPortalURL + '/stable/external/cards/' + sub);
} else {
window.location.href = internalPortalURL + '/stable/404.html';
RedirectTo(internalPortalURL + '/stable/404.html');
}
});
}
......@@ -60,9 +64,9 @@
var internalPortal404URL = internalPortalURL + '/stable/404.html';
UrlExists(internalPortalIndexURL, function(status){
if (status == 200) { // if page is accessible
window.location.href = internalPortalIndexURL;
RedirectTo(internalPortalIndexURL);
} else {
window.location.href = internalPortal404URL;
RedirectTo(internalPortal404URL);
}
});
}
......@@ -75,9 +79,9 @@
var externalPortal404URL = externalPortalURL + '/stable/404.html';
UrlExists(externalPortalURL + '/stable/' + sub, function(status){
if (status == 200) { // if sub-card is internal and exists
window.location.href = externalPortalCardURL;
RedirectTo(externalPortalCardURL);
} else {
window.location.href = externalPortal404URL;
RedirectTo(externalPortal404URL);
}
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment