選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

inline_script.js 6.1KB

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