index.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <link rel="stylesheet" href="<%=public_path%>/js/honeySwitch/honeySwitch.css">
  2. <script src="<%=public_path%>/js/honeySwitch/honeySwitch.js"></script>
  3. <div class="main-content">
  4. <!-- top bar start -->
  5. <div style="height: 61px;">
  6. <img style="margin-top: 15px; margin-left: 40px;" src="<%=public_path%>/img/make-your-life-better.png">
  7. <a href="/page/anchor.html" target="_blank" style="color: #ffffff; margin-top: 15px;" class="SPB-btn">Start Public Broadcast</a>
  8. <div style="float: right; margin-top: 20px; margin-right: 10px; font-weight: 700; color: #ffffff;">
  9. <!--<div style="float: left;" id="OngoingHangOut"></div>-->
  10. <div style="float: left;">
  11. <span class="switch-off" id="auto_push" themecolor="#4DD865" style="zoom:0.7;box-sizing: content-box;"></span>
  12. </div>
  13. <span style="float: left; margin-top: 4px; margin-left: 8px;">Auto Invitation</span>
  14. </div>
  15. <!--<div id="hangoutList" style="float: right; margin-top: 20px; margin-right: 40px;"></div>-->
  16. </div>
  17. <!-- top bar end -->
  18. <!-- content start -->
  19. <iframe src="<%=url%>" width="100%" height="1500px;" scrolling="no" id="live" onload="reinitIframe('live', 600);" frameborder="0"></iframe>
  20. <div id="app"></div>
  21. <!-- content end -->
  22. </div>
  23. <!-- footer content end -->
  24. <div style="width: 1240px; margin: 0px auto;">
  25. <footer>
  26. <ul>
  27. <li><a id="HOME" href="javascript:;" data-href="/broadcast/home">HOME</a></li>|
  28. <li><a id="Bookings" href="javascript:;" data-href="/broadcast/scheduledLive">Broadcast Bookings</a></li>|
  29. <li><a id="Invites" href="javascript:;" data-href="/broadcast/instant/incoming">Instant Broadcast Invites</a></li>|
  30. <li><a id="Messages" href="javascript:;" data-href="/broadcast/directMessages">Private Messages</a></li>|
  31. <li><a id="Terms" href="javascript:;" data-href="/broadcast/terms/termsOne">Terms and Policies</a></li>
  32. </ul>
  33. <div>Copyright © 1998-2018 All Rights Reserved.<br>
  34. Best viewed with Chrome version 59 and above.</div>
  35. </footer>
  36. </div>
  37. <div id="popups" class="popups" style="display: none;">
  38. <div style="margin-top: 60px; text-align: center;">
  39. Are you sure to start public broadcast?
  40. </div>
  41. <div style="margin-top: 28px;">
  42. <div style="float: left; margin-left: 148px;">
  43. <span class="switch-off" id="popups_auto_push" themecolor="#4DD865" style="zoom:0.7;"></span>
  44. </div>
  45. <span style="float: left; margin-top: 4px; margin-left: 8px;">Auto Invitation</span>
  46. <div class="clear"></div>
  47. </div>
  48. <div style="margin-top: 28px;">
  49. <a class="popups-no close_popups" href="javascript:;" >NO</a>
  50. <a class="popups-yes close_popups" href="/page/anchor.html" target="_blank" >YES</a>
  51. </div>
  52. </div>
  53. <!-- footer content end -->
  54. <script>
  55. $(function(){
  56. var autoPush = '<%=autoPush%>';
  57. if(autoPush == 1){
  58. honeySwitch.showOn("#auto_push");
  59. // honeySwitch.showOn("#popups_auto_push");
  60. }
  61. //自动邀请开关
  62. switchEvent("#auto_push",function(){
  63. $.post('/broadcast/setAutoPush',{status:1},function(){});
  64. // honeySwitch.showOn("#popups_auto_push");
  65. },function(){
  66. $.post('/broadcast/setAutoPush',{status:0},function(){});
  67. // honeySwitch.showOff("#popups_auto_push");
  68. });
  69. //弹窗自动邀请开关
  70. // switchEvent("#popups_auto_push",function(){
  71. // $.post('/broadcast/setAutoPush',{status:1},function(){});
  72. // honeySwitch.showOn("#auto_push");
  73. // },function(){
  74. // $.post('/broadcast/setAutoPush',{status:0},function(){});
  75. // honeySwitch.showOff("#auto_push");
  76. // });
  77. //
  78. //底部连接
  79. $('#HOME,#Bookings,#Invites,#Messages,#Terms').click(function(){
  80. var text = $(this).attr('data-href');
  81. $('#live').attr('src',text);
  82. })
  83. $.ajaxSetup({
  84. cache: true,
  85. });
  86. window.onload = function (){
  87. $.get('/page/chat.html?'+new Date().getTime(),{}, function(res){
  88. var str=res.replace(/[\r\n]/g, "");
  89. var source = {};
  90. source.style=str.match(/<style.*?<\/style>/g);
  91. source.link=str.match(/<link.*?>/g);
  92. source.script=str.match(/<script.*?<\/script>/g);
  93. var script = '';
  94. for(var key in source){
  95. if(Object.prototype.toString.call(source[key]) == '[object Array]'){
  96. source[key].forEach(function(value){
  97. script += value;
  98. })
  99. }
  100. }
  101. $('body').append(script);
  102. },"text")
  103. }
  104. function getToken(){
  105. $.get('/broadcast/v1/getToken',{},function(res){})
  106. }
  107. setInterval(getToken, 600 * 1000);//10分钟获取一次token
  108. })
  109. //iframe自适应子页面的高度
  110. function reinitIframe(iframeId, minHeight) {
  111. var browserVersion = window.navigator.userAgent.toUpperCase();
  112. var isOpera = browserVersion.indexOf("OPERA") > -1 ? true : false;
  113. var isFireFox = browserVersion.indexOf("FIREFOX") > -1 ? true : false;
  114. var isChrome = browserVersion.indexOf("CHROME") > -1 ? true : false;
  115. var isSafari = browserVersion.indexOf("SAFARI") > -1 ? true : false;
  116. var isIE = (!!window.ActiveXObject || "ActiveXObject" in window);
  117. var isIE9More = (! -[1, ] == false);
  118. try {
  119. var iframe = document.getElementById(iframeId);
  120. var bHeight = 0;
  121. if (isChrome == false && isSafari == false)
  122. bHeight = iframe.contentWindow.document.body.scrollHeight;
  123. var dHeight = 0;
  124. if (isFireFox == true)
  125. dHeight = iframe.contentWindow.document.documentElement.offsetHeight + 2;
  126. else if (isChrome == true)
  127. dHeight = iframe.contentWindow.document.documentElement.offsetHeight
  128. else if (isIE == false && isOpera == false) {
  129. dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
  130. }
  131. else if (isIE == true && isIE9More) {//ie9+
  132. var heightDeviation = bHeight - eval("window.IE9MoreRealHeight" + iframeId);
  133. if (heightDeviation == 0) {
  134. bHeight += 3;
  135. } else if (heightDeviation != 3) {
  136. eval("window.IE9MoreRealHeight" + iframeId + "=" + bHeight);
  137. bHeight += 3;
  138. }
  139. }
  140. else//ie[6-8]
  141. bHeight += 3;
  142. var height = Math.max(bHeight, dHeight);
  143. if (height < minHeight) height = minHeight;
  144. iframe.style.height = height + "px";
  145. } catch (ex) { }
  146. }
  147. </script>