From f9974faf768b96c49882068301802ddc63185ab8 Mon Sep 17 00:00:00 2001 From: laurentheirendt <laurent.heirendt@uni.lu> Date: Tue, 20 Jul 2021 09:08:15 +0200 Subject: [PATCH] remove autoredirect --- .ci/.autoRedirect | 96 ----------------------------------------------- 1 file changed, 96 deletions(-) delete mode 100644 .ci/.autoRedirect diff --git a/.ci/.autoRedirect b/.ci/.autoRedirect deleted file mode 100644 index aaab5cbe..00000000 --- a/.ci/.autoRedirect +++ /dev/null @@ -1,96 +0,0 @@ -<html> - <head> - <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> - <script type="text/javascript"> - function UrlExists(url, cb){ - jQuery.ajax({ - url: url, - dataType: 'text', - type: 'GET', - cache: false, - complete: function(xhr){ - if(typeof cb === 'function') - cb.apply(this, [xhr.status]); - } - }); - } - - function GetShortcutDestination() { - var s = window.location.href; - var pathArray = s.split('?'); - - // Cut the query if it exists - if (pathArray.length > 1) { - return pathArray[1]; - } else { - return ''; - } - } - - function RedirectTo(newLocation) { - document.location.replace(newLocation); - } - - // Pick the shortcut link destination from URL, like: `category:subcategory:card-name` - var sub = GetShortcutDestination(); - - // Define URLs - var internalPortalURL = 'https://r3-core.pages.uni.lu/howto-cards-internal'; - var externalPortalURL = 'https://r3.pages.uni.lu/howto-cards'; - - // First, check whether internal pages are accessible... - var internalIndexURL = internalPortalURL + '/index.html'; - UrlExists(internalIndexURL, function(status){ - if(status === 200){ - // If the internal pages are accessible, try to redirect into correct page - if (sub.length > 0) { - var internalCardURL = internalPortalURL + '/stable/internal/cards/' + sub; - UrlExists(internalCardURL, function(status){ - if (status == 200) { // The sub-card is internal, and is accessible - 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 - RedirectTo(internalPortalURL + '/stable/external/cards/' + sub); - } else { - RedirectTo(internalPortalURL + '/stable/404.html'); - } - }); - } - }); - } else { - // The user did not request specific card, redirect him just to the stable index - var internalPortalIndexURL = internalPortalURL + '/stable'; - var internalPortal404URL = internalPortalURL + '/stable/404.html'; - UrlExists(internalPortalIndexURL, function(status){ - if (status == 200) { // if page is accessible - RedirectTo(internalPortalIndexURL); - } else { - RedirectTo(internalPortal404URL); - } - }); - } - } else { - // The internal pages are not accessible, therefore the user is redirected into correct external page - if (sub.length > 0) { - sub = 'external/cards/' + sub; - } - var externalPortalCardURL = externalPortalURL + '/stable/' + sub; - var externalPortal404URL = externalPortalURL + '/stable/404.html'; - UrlExists(externalPortalURL + '/stable/' + sub, function(status){ - if (status == 200) { // if sub-card is internal and exists - RedirectTo(externalPortalCardURL); - } else { - RedirectTo(externalPortal404URL); - } - }); - } - }); - </script> - </head> - <body> - <p> - Please follow to <a href="https://r3.pages.uni.lu/howto-cards/stable">https://r3.pages.uni.lu/howto-cards/stable</a>! - </p> - </body> -</html> -- GitLab