Commit e3d52800 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

feat: remove the redirection from the history

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