Advertisement
Guest User

Untitled

a guest
May 19th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Zendesk</title>
  6. <script type="text/javascript">// setup redirect so that redirect triggers
  7. setupRedirect();
  8. /**
  9. * Redirect (Segment is temporarily disabled so we have zero tracking)
  10. */
  11. function setupRedirect() {
  12. var redirectFunc = function() {
  13. window.location = getDestinationUrl();
  14. };
  15. redirectFunc();
  16. }
  17. /**
  18. * Returns the destination of the redirect. Drip email URLs are expected to
  19. * be of the form ?subdomain={$1}&path=${$2} or ?path={$1}&subdomain={$1}
  20. * For example: ?subdomain=zobu&path=agent/discovery
  21. *
  22. * @returns {string}
  23. */
  24. function getDestinationUrl() {
  25. var href = window.location.href;
  26. var query = href.slice(href.indexOf('?') + 1).replace(/%2f/ig, '/');
  27. var params = {};
  28. var paramStrs = query.split('&');
  29. var i, kv;
  30. for (i = 0; i < paramStrs.length; i++) {
  31. kv = paramStrs[i].split('=', 2);
  32. params[kv[0]] = kv[1];
  33. }
  34. function remainingParamsString() {
  35. return Object.keys(params).filter(function(k) {
  36. return ['subdomain', 'path'].indexOf(k) < 0;
  37. }).map(function(k) {
  38. return k + '=' + params[k];
  39. }).join('&');
  40. }
  41. if (params.subdomain) {
  42. params.subdomain = params.subdomain.replace(/[^A-Za-z0-9-]/g, '');
  43. }
  44. if (params.path) {
  45. params.path = params.path.replace(/[^A-Za-z0-9-/_]/g, '');
  46. }
  47. if (params.subdomain && params.path) {
  48. return 'https://' + params.subdomain + '.zendesk.com/' + params.path + '?' + remainingParamsString();
  49. } else {
  50. return 'https://' + window.location.host;
  51. }
  52. }</script>
  53. </head>
  54. <body></body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement