mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-01-08 10:38:50 +01:00
Auto-generated commit
This commit is contained in:
parent
935c0c6a1b
commit
ea5b627e7e
18 changed files with 304 additions and 14 deletions
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/**
|
||||
*
|
||||
* ____ _ ___ _ _ _ _ ___ ___ ____ ____ ____ ____ ____ ___ ____
|
||||
|
|
@ -18,14 +19,23 @@
|
|||
*
|
||||
*/
|
||||
|
||||
;(function(l, projectPages) {
|
||||
;(function(l) {
|
||||
|
||||
var repo = projectPages ? '/' + l.pathname.split('/')[1] : '';
|
||||
var redirectPath;
|
||||
["/ngx-admin"].forEach(function (path) {
|
||||
if (l.pathname.indexOf(path) === 0) {
|
||||
redirectPath = path;
|
||||
}
|
||||
});
|
||||
|
||||
/* redirect all 404 trafic to index.html */
|
||||
if (!redirectPath) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* redirect all 404 traffic to index.html */
|
||||
function redirect() {
|
||||
l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + repo + '/?' +
|
||||
(l.pathname ? 'p=' + l.pathname.replace(/&/g, '~and~').replace(repo, '') : '') +
|
||||
l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + redirectPath + '/?' +
|
||||
(l.pathname ? 'p=' + l.pathname.replace(/&/g, '~and~').replace(redirectPath, '') : '') +
|
||||
(l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
|
||||
(l.hash))
|
||||
}
|
||||
|
|
@ -40,7 +50,7 @@
|
|||
});
|
||||
if (q.p !== undefined) {
|
||||
window.history.replaceState(null, null,
|
||||
repo + (q.p || '') +
|
||||
redirectPath + (q.p || '') +
|
||||
(q.q ? ('?' + q.q) : '') +
|
||||
l.hash
|
||||
)
|
||||
|
|
@ -51,4 +61,4 @@
|
|||
/* if current document is 404 page page, redirect to index.html otherwise resolve */
|
||||
document.title === '404' ? redirect() : resolve()
|
||||
|
||||
}(window.location, window.projectPages || true ));
|
||||
}(window.location));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue