redirect.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. var loc = location.href;
  6. // Blockly files moved from /blockly to /static on 5 Dec 2012.
  7. if (loc.match('/blockly/')) {
  8. loc = loc.replace('/blockly/', '/static/');
  9. }
  10. // Maze and Turtle moved from demos to apps on 29 Dec 2012.
  11. if (loc.match(/\/demos\/(maze|turtle)\//)) {
  12. loc = loc.replace('/demos/', '/apps/');
  13. }
  14. // Vietnamese apps moved from vn to vi on 9 Jun 2012.
  15. if (loc.match('/vn.html')) {
  16. loc = loc.replace('/vn.html', '/vi.html');
  17. }
  18. if (loc.match('/code/code.html')) {
  19. // Code moved to index.html on 7 Aug 2013.
  20. loc = loc.replace('/code.html', '/index.html');
  21. } else if (loc.match('/apps/code/zh_tw.html')) {
  22. // zh-tw was changed to zh-hans on 25 Nov 2013.
  23. loc = loc.replace('/zh_tw.html', '/index.html?lang=zh-hans');
  24. } else if (loc.match('/apps/code/index.html')) {
  25. // NOP.
  26. } else if (loc.match(/\/apps\/code\/[-a-z]+\.html/)) {
  27. // Code became language-agnostic on 20 Jul 2013.
  28. loc = loc.replace(/\/([-a-z]+)\.html/, '/index.html?lang=$1');
  29. }
  30. if (loc.match('/apps/plane/plane.html')) {
  31. // Plane moved to index.html on 7 Aug 2013.
  32. loc = loc.replace('/plane.html', '/index.html');
  33. } else if (loc.match('/apps/code/plane.html')) {
  34. // NOP.
  35. } else if (loc.match(/\/apps\/plane\/[\d_]*[-a-z]+\.html/)) {
  36. // Plane became language-agnostic on 20 Jul 2013.
  37. loc = loc.replace('vn.html', 'vi.html');
  38. if (location.search) {
  39. loc = loc.replace(/\/[\d_]*([-a-z]+)\.html\?/, '/index.html?lang=$1&');
  40. } else {
  41. loc = loc.replace(/\/[\d_]*([-a-z]+)\.html/, '/index.html?lang=$1');
  42. }
  43. }
  44. if (loc.match('/apps/puzzle/')) {
  45. // Puzzle moved to Blockly Games on 15 Oct 2014.
  46. loc = 'https://blockly-games.appspot.com/puzzle';
  47. } else if (loc.match('/apps/maze/')) {
  48. // Maze moved to Blockly Games on 10 Nov 2014.
  49. loc = 'https://blockly-games.appspot.com/maze';
  50. } else if (loc.match('/apps/turtle/')) {
  51. // Turtle moved to Blockly Games on 10 Nov 2014.
  52. loc = 'https://blockly-games.appspot.com/turtle';
  53. } else if (loc.match('/apps/')) {
  54. // Remaining apps moved to demos on 20 Nov 2014.
  55. loc = loc.replace('/apps/', '/demos/');
  56. }
  57. location = loc;
  58. </script>
  59. </head>
  60. </html>