CINXE.COM
<html> <head> <script type="text/javascript" charset="utf-8"> const FALLBACK_URL = 'https://opensource.fb.com'; const REDIRECT_STYLE = { // Redirect completely, appending the path to the newly specified location. // This is useful for project renames or moving to a different org. FULL: 0, // Redirect to the specific location, losing path information // This is useful when you just want to capture the audience to known working page. SIMPLE: 1, // Redirect to the project's 404 page, injecting the original URL. FOUROHFOUR_DEFAULT: 2, // Redirect to the specified path, replacing ${from} with the original URL. FOUROHFOUR_CUSTOM: 3, }; const PROJECTS = { react: { location: 'https://facebook.github.io/react/', style: REDIRECT_STYLE.FOUROHFOUR_DEFAULT, }, 'react-native': { location: 'https://facebook.github.io/react-native/docs/getting-started.html', style: REDIRECT_STYLE.SIMPLE, }, origami: { location: 'http://origami.design/', style: REDIRECT_STYLE.SIMPLE, }, 'xhp-lib': { location: 'http://hhvm.github.io/xhp-lib/', style: REDIRECT_STYLE.SIMPLE, }, design: { location: 'http://facebook.design/', style: REDIRECT_STYLE.SIMPLE, }, 'react-vr': { location: 'https://facebook.github.io/react-360/', style: REDIRECT_STYLE.SIMPLE, }, 'immutable-js': { location: 'https://immutable-js.github.io/immutable-js/', style: REDIRECT_STYLE.SIMPLE, }, graphql: { location: 'https://graphql.github.io/graphql-spec/', style: REDIRECT_STYLE.SIMPLE, }, 'php-webdriver': { location: 'https://php-webdriver.github.io/php-webdriver/', style: REDIRECT_STYLE.SIMPLE, }, bistro: { style: REDIRECT_STYLE.FULL, location: 'https://facebookarchive.github.io/bistro/', }, jest: { style: REDIRECT_STYLE.FULL, location: 'https://jestjs.io/', } }; // eg "https://facebook.github.io/flux/docs/overview/" const ORIGINAL_URL = window.location.href; // eg [ "", "flux", "docs", "overview", "" ] const PATH_PARTS = window.location.pathname.split('/'); // eg "flux" const PROJECT = PATH_PARTS[1]; // eg "docs/overview/" const SUBPATH = PATH_PARTS.slice(2).join('/'); let loc = FALLBACK_URL; if (PROJECTS.hasOwnProperty(PROJECT)) { let project = PROJECTS[PROJECT]; switch (project.style) { case REDIRECT_STYLE.FULL: loc = project.location + SUBPATH; break; case REDIRECT_STYLE.SIMPLE: loc = project.location; break; case REDIRECT_STYLE.FOUROHFOUR_DEFAULT: loc = project.location + '404.html?from=' + ORIGINAL_URL; break; case REDIRECT_STYLE.FOUROHFOUR_CUSTOM: loc = project.location.replace('${from}', ORIGINAL_URL); break; default: loc = FALLBACK_URL; } } window.location.href = loc; </script> </head> <body></body> </html>