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.html 8.1KB

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