Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
R3
howto-cards
Commits
e3d52800
Commit
e3d52800
authored
Feb 19, 2020
by
Jacek Lebioda
Browse files
feat: remove the redirection from the history
parent
bd664439
Changes
1
Show whitespace changes
Inline
Side-by-side
.ci/.autoRedirect
View file @
e3d52800
...
...
@@ -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
)
;
}
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment