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.

virtual_inline_script.call_demo.html 7.5KB

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