You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

inline_script_eapi_mod.js 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // <script>
  2. // IE11 and earlier can be identified via their user agent and be
  3. // redirected to a page that is known to have no newer js syntax.
  4. if (window.navigator.userAgent.match(/(MSIE|Trident)/)) {
  5. var roomName = encodeURIComponent(window.location.pathname);
  6. window.location.href = "static/recommendedBrowsers.html" + "?room=" + roomName;
  7. }
  8. window.indexLoadedTime = window.performance.now();
  9. console.log("(TIME) index.html loaded:\t", indexLoadedTime);
  10. // XXX the code below listeners for errors and displays an error message
  11. // in the document body when any of the required files fails to load.
  12. // The intention is to prevent from displaying broken page.
  13. var criticalFiles = [
  14. // "config.js",
  15. "fqdn_conf.js",
  16. "utils.js",
  17. "do_external_connect.js",
  18. "iconf.js",
  19. // "interface_config.js",
  20. "logging_config.js",
  21. "lib-jitsi-meet.min.js",
  22. "app.bundle.min.js",
  23. "all.css"
  24. ];
  25. var loadErrHandler = function(e) {
  26. var target = e.target;
  27. // Error on <script> and <link>(CSS)
  28. // <script> will have .src and <link> .href
  29. var fileRef = (target.src ? target.src : target.href);
  30. if (("SCRIPT" === target.tagName || "LINK" === target.tagName)
  31. && criticalFiles.some(
  32. function(file) { return fileRef.indexOf(file) !== -1 })) {
  33. window.onload = function() {
  34. // The whole complex part below implements page reloads with
  35. // "exponential backoff". The retry attempt is passes as
  36. // "rCounter" query parameter
  37. var href = window.location.href;
  38. var retryMatch = href.match(/.+(\?|&)rCounter=(\d+)/);
  39. var retryCountStr = retryMatch ? retryMatch[2] : "0";
  40. var retryCount = Number.parseInt(retryCountStr);
  41. if (retryMatch == null) {
  42. var separator = href.indexOf("?") === -1 ? "?" : "&";
  43. var hashIdx = href.indexOf("#");
  44. if (hashIdx === -1) {
  45. href += separator + "rCounter=1";
  46. } else {
  47. var hashPart = href.substr(hashIdx);
  48. href = href.substr(0, hashIdx)
  49. + separator + "rCounter=1" + hashPart;
  50. }
  51. } else {
  52. var separator = retryMatch[1];
  53. href = href.replace(
  54. /(\?|&)rCounter=(\d+)/,
  55. separator + "rCounter=" + (retryCount + 1));
  56. }
  57. var delay = Math.pow(2, retryCount) * 2000;
  58. if (isNaN(delay) || delay < 2000 || delay > 60000)
  59. delay = 10000;
  60. var showMoreText = "show more";
  61. var showLessText = "show less";
  62. document.body.innerHTML
  63. = "<div style='"
  64. + "position: absolute;top: 50%;left: 50%;"
  65. + "text-align: center;"
  66. + "font-size: medium;"
  67. + "font-weight: 400;"
  68. + "transform: translate(-50%, -50%)'>"
  69. + "Uh oh! We couldn't fully download everything we needed :("
  70. + "<br/> "
  71. + "We will try again shortly. In the mean time, check for problems with your Internet connection!"
  72. + "<br/><br/> "
  73. + "<div id='moreInfo' style='"
  74. + "display: none;'>" + "Missing " + fileRef
  75. + "<br/><br/></div>"
  76. + "<a id='showMore' style='"
  77. + "text-decoration: underline;"
  78. + "font-size:small;"
  79. + "cursor: pointer'>" + showMoreText + "</a>"
  80. + "&nbsp;&nbsp;&nbsp;"
  81. + "<a id ='reloadLink' style='"
  82. + "text-decoration: underline;"
  83. + "font-size:small;"
  84. + "'>reload now</a>"
  85. + "</div>";
  86. var reloadLink = document.getElementById('reloadLink');
  87. reloadLink.setAttribute('href', href);
  88. var showMoreElem = document.getElementById("showMore");
  89. showMoreElem.addEventListener('click', function () {
  90. var moreInfoElem
  91. = document.getElementById("moreInfo");
  92. if (showMoreElem.innerHTML === showMoreText) {
  93. moreInfoElem.setAttribute(
  94. "style",
  95. "display: block;"
  96. + "color:#FF991F;"
  97. + "font-size:small;"
  98. + "user-select:text;");
  99. showMoreElem.innerHTML = showLessText;
  100. }
  101. else {
  102. moreInfoElem.setAttribute(
  103. "style", "display: none;");
  104. showMoreElem.innerHTML = showMoreText;
  105. }
  106. });
  107. window.setTimeout(
  108. function () { window.location.replace(href); }, delay);
  109. // Call extra handler if defined.
  110. if (typeof postLoadErrorHandler === "function") {
  111. postLoadErrorHandler(fileRef);
  112. }
  113. };
  114. window.removeEventListener(
  115. 'error', loadErrHandler, true /* capture phase */);
  116. }
  117. };
  118. window.addEventListener(
  119. 'error', loadErrHandler, true /* capture phase type of listener */);
  120. // </script>