Skip to content

Commit

Permalink
Fix transitions between apps
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKolarik committed Oct 7, 2024
1 parent 9c73fbd commit de98b60
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/assets/js/app-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ _.onDocumentReady(() => {
state = JSON.parse(document.querySelector('#ractive-data').innerHTML.trim());
} catch (e) {}

app.router.init({ noScroll: true, state });
app.router.init({ noScroll: true, state }).watchState();

// open navbar dropdowns on hover
$(document)
Expand Down
6 changes: 5 additions & 1 deletion src/assets/js/app-globalping.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ app.router.addRoute('/sponsors', cGlobalpingSponsors);
app.router.addRoute('/credits', cGlobalpingCredits);

app.router.addRoute('/(.*)', (route) => {
let newUrl = new URL(`${route.uri.path}${route.uri.qs}${route.uri.hash}`, location.href);

if (!route?.data?.title?.toLowerCase().includes('not found')) {
throw new Error('reload');
setTimeout(() => {
location.href = newUrl.href;
});
}
});

Expand Down
6 changes: 5 additions & 1 deletion src/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ app.router.addRoute('/oss-cdn/:name', cCustomCdnOssProject);
app.router.addRoute('/documentation', cDocumentation);

app.router.addRoute('/(.*)', (route) => {
let newUrl = new URL(`${route.uri.path}${route.uri.qs}${route.uri.hash}`, location.href);

if (!route?.data?.title?.toLowerCase().includes('not found')) {
throw new Error('reload');
setTimeout(() => {
location.href = newUrl.href;
});
}
});

Expand Down

0 comments on commit de98b60

Please sign in to comment.