Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

virtual_inline_script.html 7.5KB

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