123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
-
- window.ifn_obj = window.ifn_obj || { init_conf_join:[],iammod:[] }
-
- function get_mod(participants){
- if (!participants){
- participants = get_participants()
- }
- var k,v
- for (v of participants){
- if (v.role == "moderator"){
- clog("cui_mod_cd",[v],v.corner_data)
- return v
- }
- }
- }
- function get_participants(){
- return APP.store.getState()["features/base/participants"]
- }
- function get_local(participants){
- if (!participants){
- participants = get_participants()
- }
- var k,v
- for (v of participants){
- if (v.local){
- return v
- }
- }
- return APP.store.getState()["features/base/participants"]
- }
- function amimod() {
- try {
- return get_local().role == "moderator"
- } catch (e) {
- console.error("AM I MOD ERR: is evrything inited?",e)
- // clog("AM I MOD ERR: is evrything inited?",e)
- }
- }
-
-
-
- function Someone_Left_Handler(o){
- delete msto.participants[o.action.participant.id]
- }
-
-
- // reflow all your filmstrips
- function Someone_Left_or_Joined_Handler(o){
- try {
- APP.store.dispatch(window.glob_react.video_layout.setTileView(false))
- APP.store.dispatch(window.glob_react.rf_filmstrip.setFilmstripVisible(false))
- if (! $("#vspace_filmstrip_template").length){
- init_api6()
- }
- refresh_toolbars()
- mod_sort()
- new_move()
- dispatch_resize()
- } catch(err) {
- console.error("Someone_Left_or_Joined_Handler err:", err)
- }
- }
-
-
-
-
-
- // dispay moderator toolbar if you become moderator
- window.iammod = window.iammod || false
- function amimodnow(){
- var iammod = amimod()
- window.iammod = iammod
- if (iammod){
- run_ifn_cbs("iammod")
- refresh_toolbars()
- }
- }
-
-
-
-
- // run init callbacks after CONFERENCE_JOINED
- function cji(){
- if (window.init_m){
- // setTimeout(window.init_m())
- }
- if (ifn_obj && ifn_obj.init_conf_join){
- var k,v
- for ([k,v] of Object.entries(ifn_obj.init_conf_join)){
- v()
- }
- }
- }
- function run_ifn_cbs(cb_name,args){
- if (ifn_obj && ifn_obj[cb_name]){
- var k,v
- for ([k,v] of Object.entries(ifn_obj[cb_name])){
- v()
- }
- } else {}
- }
-
-
- // safe to remove
- function stv(o,ta){
- clog(o,ta)
- }
-
- function SET_TOOLBOX_info(o,that){
- // clog("SET_TOOLBOX_info",o,that)
- clog("ti",o.action.type,o.action)
-
- }
-
- function share_vid_info(o,that,m = true){
- clog("svi",m,o.action.type,o)
-
- }
- qxi_match = {
- share_vid:{
- startsWith:"",
- includes:"SHARE",
- endsWith:"",
- // arr:["SET_TOOLBAR_HOVERED"],
- // arr:[],
- // arr_or:["PARTICIPANT_UPDATED","SET_LOADABLE_AVATAR_URL"],
- arr_or:["PARTICIPANT_JOINED","PARTICIPANT_LEFT"],
- },
- }
-
- // 2m_req.js?c=023?v=39:163 QXI PARTICIPANT_UPDATED
- // 2m_req.js?c=023?v=39:163 QXI SET_LOADABLE_AVATAR_URL
- function qxi_jnk_match(o,that,m,fn){
- var flag = "~"
- var flag0 = 0
- var rf = []
- rf.push(flag0)
- m.startsWith ? flag0 =!o.action.type.startsWith(m.startsWith) || flag0 : 0
- rf.push(flag0)
- m.includes ? flag0 = !o.action.type.includes(m.includes) || flag0 : 0
- rf.push(flag0)
- m.endsWith ? flag0 = !o.action.type.endsWith(m.endsWith) || flag0 : 0
- rf.push(flag0)
- m.arr ? flag0 = !m.arr.includes(o.action.type) || flag0 : 0
- m.arr_or ? flag0 = !m.arr_or.includes(o.action.type) && flag0 : 0
- rf.push(flag0)
- if (!flag0){
- fn(o,that)
- } else {
- // fn(o,that,!!0)
- }
- // clog("qxi_jnk_match",o.action.type,flag0,rf,m)
-
- }
-
- // this is called with setTimeout so we can throw errors without wrecking everything
- function dev_middleware_listner(o) {
- if (!o.action.type){
- return
- }
- // /*
- if (o.action.type != "ENDPOINT_MESSAGE_RECEIVED"){
- // CONFERENCE_JOINED
- // if (o.action.type.startsWith("SET_TOOLBOX_" || o.action.type == "TOGGLE_TOOLBOX_VISIBLE")){
- // SET_TOOLBOX_info(o,this)
- // }
- // if ()
- // qxi_jnk_match(o,this,qxi_match.share_vid,share_vid_info)
- // clog("QXI",o.action.type)
- }
- // */
-
-
-
- switch(o.action.type){
- case "PARTICIPANT_UPDATED":
- window.iammod ? 0 : amimodnow()
-
- break;
- case "PARTICIPANT_LEFT":
- setTimeout(Someone_Left_Handler,1,o)
- // setTimeout(Someone_Left_Handler,1000,o)
- case "PARTICIPANT_JOINED":
- setTimeout(Someone_Left_or_Joined_Handler,1,o)
- // setTimeout(Someone_Left_or_Joined_Handler,300,o)
- break;
- // case "SET_TILE_VIEW":
- // stv(o,[this,arguments])
- break;
- case "CONFERENCE_JOINED":
- setTimeout(cji,1)
- break;
-
- }
- }
-
- // SET_TOOLBOX_ENABLED
- // SET_TOOLBOX_
|