123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
-
- // this will be refactored into the api and an a filmstrip module
-
- mod_templates = window.mod_templates || $("")
-
- // reload templates
- function html_js_handler(rsp) {
- clog("html_js_handler",[...arguments])
- mod_templates = $(`<span>${rsp}</span>`)
- init_api6()
- }
-
-
-
- html_hooks = {
- create_video_tile(n){
- add_node(n,`#localVideoTileViewContainer`,"before")
- },
- create_vid_toptoolbar_hook(n){
- add_node(n,`.vid_toptoolbar_hook`,"append")
- },
- create_vid_toptoolbar_hook_after(n){
- add_node(n,`.vid_toptoolbar_hook`,"append")
- },
- // Top of window
- create_top_toolbox_hook(n){
- add_node(n,`.top_toolbox`,"append")
- },
- create_bottom_toolbox_hook(n){
- add_node(n,`.button-group-right`,"prepend")
- },
- create_new_filmstrip(n){
- add_node(n,`#filmstripRemoteVideos`,"prepend")
- },
- }
-
-
-
- function saftly_remove(n,remove_nodes=true){
- const j =$(n)
-
- $(`#localVideoTileViewContainer`).append(j.find(".local_vid"))
- $(`#filmstripRemoteVideosContainer`).append(j.find("#localVideoTileViewContainer"))
-
- $(`#localVideoTileViewContainer`).before(j.find(".remote_vid"))
- remove_nodes ? j.remove() : clog("DO NOT REMOVE")
-
-
- }
-
- // follow focus EventListener
- function ffcb(){
- clog("ffcb",this.value,this.checked,[this,...arguments])
- disp(glob_react.base_conference.setFollowMe(this.checked))
- var follow_focus_force=$("#follow_focus_force")[0]
- if (follow_focus_force.checked && !this.checked){
- msto.conference.force_follow = this.checked
- follow_focus_force.checked = this.checked
-
- }
- }
- // force follow focus EventListener
- function fffcb(){
- var follow_focus=$("#follow_focus")[0]
-
- if (!follow_focus.checked && this.checked){
-
- follow_focus.checked = this.checked
- ffcb.bind(follow_focus)()
- }
- msto.conference.force_follow = this.checked
- }
- // number of pseudo videos EventListener
- function num_pseudo(){
- msto.conference.repeat = this.value
- setTimeout(refresh_fs_send,100)
- }
- // overflow scroll EventListener
- function scroll_timeout_runner(){
- $("#follow_focus_force")[0]
- // scroll_send)
- var ov_timeout=$("#ov_timeout")[0]
- var ov_timeout_disable=$("#ov_timeout_disable")[0]
- // ov_timeout_disable
- if (ov_timeout_disable.checked){
- timeout_scroll_glob.stop = 1
- } else {
- timeout_scroll_glob.stop = 0
-
- }
- if (!isNaN(ov_timeout.value) && ov_timeout.value > .2){
- timeout_scroll_glob.timeout = Math.ceil(ov_timeout.value * 1000)
- msto.conference.scroll_timeout = ov_timeout.value
- timeout_scroll_start()
- }
- }
-
-
- // to
-
- function refresh_toolbars(){
- saftly_remove(".plugin_top.tbar")
- // this stuff should go in a template
-
- n = `
- <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>
- <div class="m xbox">ABC</div>
- </span>`
-
- html_hooks.create_vid_toptoolbar_hook_after(n)
- n = `<span class="plugin_top tbar"><span class="m follow_focus">
- <input type="checkbox" id="follow_focus" name="follow_focus">
- <label for="follow_focus">
- follow focus (moderator only)
- </label>
-
- <br>
- <input type="checkbox" id="follow_focus_force" name="follow_focus_force">
- <label for="follow_focus_force">
- force
- </label>
- </span>
- <span class="m follow_focus2">
- <label for="num_pseudo"># of pseudo videos</label>
- <input type="number" id="num_pseudo" name="num_pseudo" value=${window.msto ? msto.conference.repeat || 0 : 0} min=0>
- <br>
- <label for="ov_timeout">overflow scroll interval </label>
- <input type="number" id="ov_timeout" name="timeout" min=.4 step=.1 value=${window.msto ? msto.conference.scroll_timeout || 15 : 15}>
-
- <br>
- <input type="checkbox" id="ov_timeout_disable" name="ov_timeout_disable">
- <label for="ov_timeout_disable" class="inline_input">
- disable
- </label>
- <span class="inline_input"><button id="scroll_now" class="inline_input">scroll now</button></span>
-
- </span>
- </span>`
-
- // add moderator elements
- if (amimod()){
-
- n = $(n)
- n.find("input#follow_focus")[0].onchange = ffcb
- n.find("input#follow_focus_force")[0].onchange = fffcb
- n.find("input#ov_timeout")[0].onchange = scroll_timeout_runner
- n.find("input#ov_timeout_disable")[0].onchange = scroll_timeout_runner
- n.find("#scroll_now")[0].onclick = scroll_send
- n.find("#num_pseudo")[0].onchange = num_pseudo
-
- add_node(n,`.subject`,"prepend")
- }
- }
-
-
- //
- function init_api6(){
- saftly_remove(".plugin_top")
- // return
- var arr = []
- var n
- n = `<span class="plugin_top pseudo_vid small_vid "><div class="m2 xbox2">ABC</div></span>`
-
- const repeat = window.msto ? msto.conference.repeat || 0 : 0
- if ((!isNaN(repeat) && repeat > 0 )){
- html_hooks.create_video_tile(n.repeat(repeat))
- }
-
- refresh_toolbars()
-
- n = `<span class="plugin_top"><div class="m xbox">ABC</div></span>`
- html_hooks.create_bottom_toolbox_hook(n)
-
-
- // n = `<span class="plugin_top abs"><div class="dev_filmstrip">ABC</div></span>`
- // n = `<span class="plugin_top abs"><div class="dev_filmstrip">ABC</div></span>`
- // n= mod_templates.find(".filmstrip_template")[0].outerHTML
- // html_hooks.create_new_filmstrip(n)
- // n = `<span class="plugin_top pseudo_vid small_vid "><div class="m4 xbox3">ABC</div></span>`
-
- let nj = mod_templates.find("#vspace_filmstrip_template")
- if (nj.length){
- n= mod_templates.find("#vspace_filmstrip_template")[0].outerHTML
- add_node(n,`.vspace`,"append")
- }
-
- if (window.mod_sort){
- mod_sort()
- }
-
- dispatch_resize()
-
-
- }
-
-
-
-
-
- /*
- // example event
- function event_test(){
-
- tmsgx({
- "type":"event",
- "payload":{path:"z",key:"z",val:"z",etype:"xyz"},
- },"code")
- }
-
-
- function all_plugin_events(e){
- clog("all_plugin_events",[this],[...arguments])
- }
-
-
- glob_mx.event_handlers.e1 = {
- fn:all_plugin_events,
- m:{},
- }
- */
-
-
- function refresh_fs_send(){
-
- tmsgx({
- "type":"event",
- "payload":'{path,key,val}',
- etype:"refresh_fs"
- },"code")
- }
-
- function refresh_fs_proc(){
- init_api6()
- mod_sort()
- new_move()
-
- dispatch_resize()
- clog("refresh_fs_proc")
- }
-
- function scroll_send(){
-
- tmsgx({
- "type":"event",
- "payload":'{path,key,val}',
- etype:"overflow_scroll"
- },"code")
- }
-
-
- function scroll_proc(e){
- scroll_to()
- // clog("scroll_proc",[this,...arguments])
- }
-
-
- glob_mx.event_handlers.e2 = {
- fn:scroll_proc,
- // fn:nop,
- // m:{etype:"timer_start"},
- m:{etype:"overflow_scroll"},
- }
-
- glob_mx.event_handlers.e3 = {
- fn:refresh_fs_proc,
- // fn:nop,
- // m:{etype:"timer_start"},
- m:{etype:"refresh_fs"},
- }
-
-
-
-
- if (window.refresh_fs_proc){
- refresh_fs_proc()
-
- }
|