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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. // this will be refactored into the api and an a filmstrip module
  2. mod_templates = window.mod_templates || $("")
  3. // reload templates
  4. function html_js_handler(rsp) {
  5. clog("html_js_handler",[...arguments])
  6. mod_templates = $(`<span>${rsp}</span>`)
  7. init_api6()
  8. }
  9. html_hooks = {
  10. create_video_tile(n){
  11. add_node(n,`#localVideoTileViewContainer`,"before")
  12. },
  13. create_vid_toptoolbar_hook(n){
  14. add_node(n,`.vid_toptoolbar_hook`,"append")
  15. },
  16. create_vid_toptoolbar_hook_after(n){
  17. add_node(n,`.vid_toptoolbar_hook`,"append")
  18. },
  19. // Top of window
  20. create_top_toolbox_hook(n){
  21. add_node(n,`.top_toolbox`,"append")
  22. },
  23. create_bottom_toolbox_hook(n){
  24. add_node(n,`.button-group-right`,"prepend")
  25. },
  26. create_new_filmstrip(n){
  27. add_node(n,`#filmstripRemoteVideos`,"prepend")
  28. },
  29. }
  30. function saftly_remove(n,remove_nodes=true){
  31. const j =$(n)
  32. $(`#localVideoTileViewContainer`).append(j.find(".local_vid"))
  33. $(`#filmstripRemoteVideosContainer`).append(j.find("#localVideoTileViewContainer"))
  34. $(`#localVideoTileViewContainer`).before(j.find(".remote_vid"))
  35. remove_nodes ? j.remove() : clog("DO NOT REMOVE")
  36. }
  37. // follow focus EventListener
  38. function ffcb(){
  39. clog("ffcb",this.value,this.checked,[this,...arguments])
  40. disp(glob_react.base_conference.setFollowMe(this.checked))
  41. var follow_focus_force=$("#follow_focus_force")[0]
  42. if (follow_focus_force.checked && !this.checked){
  43. msto.conference.force_follow = this.checked
  44. follow_focus_force.checked = this.checked
  45. }
  46. }
  47. // force follow focus EventListener
  48. function fffcb(){
  49. var follow_focus=$("#follow_focus")[0]
  50. if (!follow_focus.checked && this.checked){
  51. follow_focus.checked = this.checked
  52. ffcb.bind(follow_focus)()
  53. }
  54. msto.conference.force_follow = this.checked
  55. }
  56. // number of pseudo videos EventListener
  57. function num_pseudo(){
  58. msto.conference.repeat = this.value
  59. setTimeout(refresh_fs_send,100)
  60. }
  61. // overflow scroll EventListener
  62. function scroll_timeout_runner(){
  63. $("#follow_focus_force")[0]
  64. // scroll_send)
  65. var ov_timeout=$("#ov_timeout")[0]
  66. var ov_timeout_disable=$("#ov_timeout_disable")[0]
  67. // ov_timeout_disable
  68. if (ov_timeout_disable.checked){
  69. timeout_scroll_glob.stop = 1
  70. } else {
  71. timeout_scroll_glob.stop = 0
  72. }
  73. if (!isNaN(ov_timeout.value) && ov_timeout.value > .2){
  74. timeout_scroll_glob.timeout = Math.ceil(ov_timeout.value * 1000)
  75. msto.conference.scroll_timeout = ov_timeout.value
  76. timeout_scroll_start()
  77. }
  78. }
  79. // to
  80. function refresh_toolbars(){
  81. saftly_remove(".plugin_top.tbar")
  82. // this stuff should go in a template
  83. n = `
  84. <span class="plugin_top tbar"><span class="outline_indicator ind_1"></span><span class="outline_indicator ind_2"></span><span class="outline_indicator ind_3"></span>
  85. <div class="m xbox">ABC</div>
  86. </span>`
  87. html_hooks.create_vid_toptoolbar_hook_after(n)
  88. n = `<span class="plugin_top tbar"><span class="m follow_focus">
  89. <input type="checkbox" id="follow_focus" name="follow_focus">
  90. <label for="follow_focus">
  91. follow focus (moderator only)
  92. </label>
  93. <br>
  94. <input type="checkbox" id="follow_focus_force" name="follow_focus_force">
  95. <label for="follow_focus_force">
  96. force
  97. </label>
  98. </span>
  99. <span class="m follow_focus2">
  100. <label for="num_pseudo"># of pseudo videos</label>
  101. <input type="number" id="num_pseudo" name="num_pseudo" value=${window.msto ? msto.conference.repeat || 0 : 0} min=0>
  102. <br>
  103. <label for="ov_timeout">overflow scroll interval </label>
  104. <input type="number" id="ov_timeout" name="timeout" min=.4 step=.1 value=${window.msto ? msto.conference.scroll_timeout || 15 : 15}>
  105. <br>
  106. <input type="checkbox" id="ov_timeout_disable" name="ov_timeout_disable">
  107. <label for="ov_timeout_disable" class="inline_input">
  108. disable
  109. </label>
  110. <span class="inline_input"><button id="scroll_now" class="inline_input">scroll now</button></span>
  111. </span>
  112. </span>`
  113. // add moderator elements
  114. if (amimod()){
  115. n = $(n)
  116. n.find("input#follow_focus")[0].onchange = ffcb
  117. n.find("input#follow_focus_force")[0].onchange = fffcb
  118. n.find("input#ov_timeout")[0].onchange = scroll_timeout_runner
  119. n.find("input#ov_timeout_disable")[0].onchange = scroll_timeout_runner
  120. n.find("#scroll_now")[0].onclick = scroll_send
  121. n.find("#num_pseudo")[0].onchange = num_pseudo
  122. add_node(n,`.subject`,"prepend")
  123. }
  124. }
  125. //
  126. function init_api6(){
  127. saftly_remove(".plugin_top")
  128. // return
  129. var arr = []
  130. var n
  131. n = `<span class="plugin_top pseudo_vid small_vid "><div class="m2 xbox2">ABC</div></span>`
  132. const repeat = window.msto ? msto.conference.repeat || 0 : 0
  133. if ((!isNaN(repeat) && repeat > 0 )){
  134. html_hooks.create_video_tile(n.repeat(repeat))
  135. }
  136. refresh_toolbars()
  137. n = `<span class="plugin_top"><div class="m xbox">ABC</div></span>`
  138. html_hooks.create_bottom_toolbox_hook(n)
  139. // n = `<span class="plugin_top abs"><div class="dev_filmstrip">ABC</div></span>`
  140. // n = `<span class="plugin_top abs"><div class="dev_filmstrip">ABC</div></span>`
  141. // n= mod_templates.find(".filmstrip_template")[0].outerHTML
  142. // html_hooks.create_new_filmstrip(n)
  143. // n = `<span class="plugin_top pseudo_vid small_vid "><div class="m4 xbox3">ABC</div></span>`
  144. let nj = mod_templates.find("#vspace_filmstrip_template")
  145. if (nj.length){
  146. n= mod_templates.find("#vspace_filmstrip_template")[0].outerHTML
  147. add_node(n,`.vspace`,"append")
  148. }
  149. if (window.mod_sort){
  150. mod_sort()
  151. }
  152. dispatch_resize()
  153. }
  154. /*
  155. // example event
  156. function event_test(){
  157. tmsgx({
  158. "type":"event",
  159. "payload":{path:"z",key:"z",val:"z",etype:"xyz"},
  160. },"code")
  161. }
  162. function all_plugin_events(e){
  163. clog("all_plugin_events",[this],[...arguments])
  164. }
  165. glob_mx.event_handlers.e1 = {
  166. fn:all_plugin_events,
  167. m:{},
  168. }
  169. */
  170. function refresh_fs_send(){
  171. tmsgx({
  172. "type":"event",
  173. "payload":'{path,key,val}',
  174. etype:"refresh_fs"
  175. },"code")
  176. }
  177. function refresh_fs_proc(){
  178. init_api6()
  179. mod_sort()
  180. new_move()
  181. dispatch_resize()
  182. clog("refresh_fs_proc")
  183. }
  184. function scroll_send(){
  185. tmsgx({
  186. "type":"event",
  187. "payload":'{path,key,val}',
  188. etype:"overflow_scroll"
  189. },"code")
  190. }
  191. function scroll_proc(e){
  192. scroll_to()
  193. // clog("scroll_proc",[this,...arguments])
  194. }
  195. glob_mx.event_handlers.e2 = {
  196. fn:scroll_proc,
  197. // fn:nop,
  198. // m:{etype:"timer_start"},
  199. m:{etype:"overflow_scroll"},
  200. }
  201. glob_mx.event_handlers.e3 = {
  202. fn:refresh_fs_proc,
  203. // fn:nop,
  204. // m:{etype:"timer_start"},
  205. m:{etype:"refresh_fs"},
  206. }
  207. if (window.refresh_fs_proc){
  208. refresh_fs_proc()
  209. }