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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. glob_mx.hook_cb.RemoteVideoMenu = glob_mx.hook_cb.RemoteVideoMenu || {}
  2. glob_mx.qxi_cb.SET_OVERFLOW_MENU_VISIBLE = glob_mx.qxi_cb.SET_OVERFLOW_MENU_VISIBLE || {}
  3. function rvm_to(a){
  4. clog("rvm_to RemoteVideoMenu...",a, $(".popover"))
  5. // popup_item
  6. var n
  7. var svg,icon_template
  8. var jmod_templates_ui_msg = $(mod_templates_ui_msg)
  9. n = jmod_templates_ui_msg.find(".popup_item_req")
  10. n.find(".av_io").click(evnt_av_io)
  11. $(".popupmenu").prepend(n)
  12. }
  13. glob_mx.hook_cb.RemoteVideoMenu.fn = function(o,a2){
  14. if (!window.iammod){return}
  15. if ($(".popover").length){
  16. return
  17. }
  18. clog("RemoteVideoMenu...", $(".popover"),o,a2)
  19. setTimeout(rvm_to,0,"A")
  20. // setTimeout(rvm_to,100,"B")
  21. }
  22. // RemoteVideoMenu
  23. // glob_mx.qxi_test
  24. // qxi_cb
  25. function somv_to(a){
  26. var n
  27. // $(".overflow-menu").prepend("<hr>")
  28. if ( !amimod() || 0){
  29. return
  30. }
  31. // clog("rvm_to RemoteVideoMenu...",a, $(".popover"))
  32. var svg,icon_template
  33. var jmod_templates_ui_msg = $(mod_templates_ui_msg)
  34. n = jmod_templates_ui_msg.find(".ovmu_av")
  35. // n.find(".popup_body").prepend(svg)
  36. // n.find(".popup_body").prepend(svg)
  37. // ji_mic_off
  38. // ji_vid_off
  39. // icon_template = $(jmod_templates_ui_msg.find(".settings-button-container")[0].outerHTML)
  40. // icon_template.find(".jitsi-icon").append(svg)
  41. svg = $(`<span>${glob_mx.svg["camera-disabled.svg"]}</span>`).find("svg").addClass("icon_svg")
  42. clog("svg...",svg,svg[0].width)
  43. // svg[0].width =24
  44. // svg[0].height =24
  45. svg[0].setAttribute("width",20)
  46. svg[0].setAttribute("height",20)
  47. n.find(".jitsi-icon.ji_vid_off").append(svg)
  48. // n.find(".ji2_vid_off").append(svg)
  49. svg = $(`<span>${glob_mx.svg["mic-disabled.svg"]}</span>`).find("svg").addClass("icon_svg")
  50. svg[0].setAttribute("width",20)
  51. svg[0].setAttribute("height",20)
  52. n.find(".jitsi-icon.ji_mic_off").append(svg)
  53. svg = $(`<span>${glob_mx.svg["microphone.svg"]}</span>`).find("svg").addClass("icon_svg")
  54. svg[0].setAttribute("width",20)
  55. svg[0].setAttribute("height",20)
  56. n.find(".jitsi-icon.ji_mic_on").append(svg)
  57. svg = $(`<span>${glob_mx.svg["camera.svg"]}</span>`).find("svg").addClass("icon_svg")
  58. clog("svg...",svg,svg[0].width)
  59. // svg[0].width =24
  60. // svg[0].height =24
  61. svg[0].setAttribute("width",20)
  62. svg[0].setAttribute("height",20)
  63. n.find(".jitsi-icon.ji_vid_on").append(svg)
  64. // n.find(".popup_icons").append(icon_template)
  65. n.find(".av_io").click(evnt_av_io)
  66. $(".toolbox-content .overflow-menu").prepend(n)
  67. if ( amimod() || 0){
  68. n = jmod_templates_ui_msg.find(".ovmu_ff")
  69. set_ovmu_ff3(n)
  70. set_ovmu_ff(n)
  71. // set_ovmu_ff2(n)
  72. $(".toolbox-content .overflow-menu").prepend(n)
  73. order_menu()
  74. }
  75. // refresh_overflow_menu()
  76. // setTimeout(refresh_overflow_menu_only,300)
  77. // disp(glob_react.toolbox.setToolbarHovered(!!1))
  78. // refresh_overflow_menu_only()
  79. // $(".overflow-menu").append(n)
  80. }
  81. function order_menu(){
  82. var ovfm = $(".toolbox-content .overflow-menu")
  83. $(`[aria-label="Toggle settings"]`).before($(".ovmu_av"))
  84. // $(`[aria-label="Toggle settings"]`).before("<hr>")
  85. $(".ovmu_av:first").before("<hr>")
  86. $(".ovmu_ff:last").after("<hr>")
  87. // $(".ovmu_spot").after("<hr>")
  88. // $(".ovmu_spot").before("<hr>")
  89. // $("..overflow-menu").before("<hr>")
  90. // $(".overflow-menu").prepend("<hr>")
  91. $(".spot_focus")[0].checked = msto.conference.force_follow
  92. // ovfm.append($(".ovmu_spot"))
  93. }
  94. function ovmu_change(event){
  95. var local = get_local().id
  96. if (local != msto.conference.ff.ff_mod){
  97. // return
  98. }
  99. var type,ivar,name,target
  100. target = event.target
  101. ivar = target.dataset.ivar
  102. type = target.type
  103. name = target.name
  104. var ff = msto.conference.ff
  105. // clog("")
  106. clog("ovmu_change",{that:this,data:event.target.dataset,event,args:[...arguments]},{type,ivar,name,target})
  107. // return
  108. if (type == "number"){
  109. ff["number"][ivar] = target.value
  110. } else if (type == "checkbox") {
  111. ff["checkbox"][ivar] = target.checked
  112. // target.checked = ff["checkbox"][ivar] || 0
  113. } else if (type == "radio") {
  114. // ff[""]
  115. ff["radio"][name] = ivar
  116. // if (ff["radio"][name] == ivar) { target.checked = 1 }
  117. // v.checked = ff["radio"][name] || 0
  118. }
  119. if (ivar == "ff_timeout"){
  120. try {
  121. glob_mx.timeout.ff_ti.o.timeout = ff["number"][ivar]
  122. } catch (err){}
  123. }
  124. }
  125. tomflag=1
  126. function set_ovmu_dflts(n){
  127. var i,k,v,j
  128. var type,ivar,name
  129. var ff = msto.conference.ff
  130. var local = get_local()
  131. clog("set_ovmu_dflts...",$(n),n)
  132. for (v of $(n)){
  133. ivar = v.dataset.ivar
  134. type = v.type
  135. name = v.name
  136. if (type == "number"){
  137. v.value = ff["number"][ivar] || 0
  138. } else if (type == "checkbox") {
  139. v.checked = ff["checkbox"][ivar] || 0
  140. } else if (type == "radio") {
  141. // ff[""]
  142. if (ff["radio"][name] == ivar) {
  143. v.checked = 1
  144. }
  145. // v.checked = ff["radio"][name] || 0
  146. } else if (v.classList.contains("ff_mod")){
  147. if (v.tagName == "SPAN"){
  148. // $(n).find("span.ff_mod").text(msto.conference.ff.ff_mod || "zzz")
  149. $(v).text(msto.conference.ff.ff_mod == local.id ? "LOCAL " + local.id : msto.conference.ff.ff_mod )
  150. } else if (v.tagName == "BUTTON") {
  151. $(v).click(ff_mod_button_cb)
  152. // $(v).clock()
  153. }
  154. }
  155. clog("set_ovmu_dflts",{type,ivar,name})
  156. }
  157. // $(n).filter("span.ff_mod").text("z")
  158. }
  159. function ff_ti(){
  160. // clog("ff_ti")
  161. var ff_algo = msto.conference.ff.radio.ff_algo
  162. if (ff_algo=="ff_none"){
  163. return
  164. }
  165. if (ff_algo == "ff_rand"){
  166. test_focus()
  167. } else if (ff_algo == "ff_ordered"){
  168. ordered_focus()
  169. }
  170. }
  171. function ff_mod_button_cb(event){
  172. return
  173. var part,ff_mod_id
  174. ff_mod_id = $("span.ff_mod").text()
  175. part = get_local()
  176. // if (part.id == ff_mod_id){
  177. if (part.id == msto.conference.ff.ff_mod){
  178. msto.conference.ff.ff_mod = null
  179. $("span.ff_mod").text(msto.conference.ff.ff_mod)
  180. // $(".id_sideToolbarContainer").removeClass("not_local_ff_mod")
  181. $(".id_sideToolbarContainer").addClass("not_local_ff_mod")
  182. } else {
  183. msto.conference.ff.ff_mod = part.id
  184. $("span.ff_mod").text("LOCAL " + msto.conference.ff.ff_mod)
  185. $(".id_sideToolbarContainer").removeClass("not_local_ff_mod")
  186. new Timeout_cls({
  187. name:"ff_ti",
  188. timeout:msto.conference.ff.number.ff_timeout,
  189. fn:ff_ti,
  190. "zzz":"da"
  191. })
  192. // $(".not_local_ff_mod")
  193. // if (local == msto.conference.ff.ff_mod){
  194. // } else {
  195. // }
  196. // clog()
  197. glob_mx.timeout.ff_ti.run()
  198. // glob_mx
  199. }
  200. req_ff_send({ff_mod:msto.conference.ff.ff_mod})
  201. }
  202. function req_ff_send(o){
  203. tmsgx({
  204. "type":"event",
  205. // z:
  206. "payload":o,
  207. etype:"req_ff"
  208. },"code")
  209. }
  210. // req_av_send({act:"av_off","to":"all"})
  211. // req_av_send({to:"all",act:"force_vid_on"})
  212. //
  213. function ff_evnt(o){
  214. return
  215. var ff_mod = o.parsed.payload.ff_mod
  216. if (ff_mod != get_local().id){
  217. delete glob_mx.timeout.ff_ti
  218. // $(".id_sideToolbarContainer").removeClass("not_local_ff_mod")
  219. $(".id_sideToolbarContainer").addClass("not_local_ff_mod")
  220. }
  221. // if (msto.conference.ff.ff_mod)
  222. clog("ff_evnt",msto.conference.ff.ff_mod,get_local().id,{that:this,o,args:[...arguments]})
  223. }
  224. glob_mx.event_handlers.ff = {
  225. fn:ff_evnt,
  226. // fn:nop,
  227. // m:{etype:"timer_start"},
  228. m:{etype:"req_ff"},
  229. }
  230. function spot_focus_cb(event){
  231. clog("spot_focus_cb",{that:this,event},event.target,event.target.checked)
  232. if (event.target.checked){
  233. $("input#follow_focus").click()
  234. } else {
  235. $("input#follow_focus_force").click()
  236. }
  237. }
  238. function ffcb2(){
  239. clog("ffcb",this.value,this.checked,[this,...arguments])
  240. disp(glob_react.base_conference.setFollowMe(this.checked))
  241. msto.conference.follow_focus = this.checked
  242. var follow_focus_force=$("#follow_focus_force")[0]
  243. if (follow_focus_force.checked && !this.checked){
  244. msto.conference.force_follow = this.checked
  245. follow_focus_force.checked = this.checked
  246. }
  247. }
  248. // force follow focus EventListener
  249. function fffcb2(){
  250. var follow_focus=$("#follow_focus")[0]
  251. if (!follow_focus.checked && this.checked){
  252. follow_focus.checked = this.checked
  253. msto.conference.follow_focus = this.checked
  254. ffcb.bind(follow_focus)()
  255. }
  256. msto.conference.force_follow = this.checked
  257. }
  258. function enable_spotlight(){
  259. msto.conference.follow_focus = true
  260. msto.conference.force_follow = true
  261. disp(glob_react.base_conference.setFollowMe(true))
  262. }
  263. function disable_spotlight(){
  264. msto.conference.follow_focus = false
  265. msto.conference.force_follow = false
  266. disp(glob_react.base_conference.setFollowMe(false))
  267. }
  268. function toggle_spotlight(event){
  269. var bool
  270. if (this.tagName == "INPUT"){
  271. bool = this.checked
  272. } else {
  273. bool = !msto.conference.force_follow
  274. }
  275. clog("toggle_spotlight",{that:this,event,bool,checked:this.checked,tagName:this.tagName})
  276. msto.conference.follow_focus = bool
  277. msto.conference.force_follow = bool
  278. disp(glob_react.base_conference.setFollowMe(bool))
  279. bool ? start_ff_ti() :remove_ff_ti()
  280. }
  281. function start_ff_ti(){
  282. new Timeout_cls({
  283. name:"ff_ti",
  284. timeout:msto.conference.ff.number.ff_timeout,
  285. fn:ff_ti,
  286. "zzz":"da"
  287. })
  288. // $(".not_local_ff_mod")
  289. // if (local == msto.conference.ff.ff_mod){
  290. // } else {
  291. // }
  292. // clog()
  293. glob_mx.timeout.ff_ti.run()
  294. }
  295. function remove_ff_ti(){
  296. delete glob_mx.timeout.ff_ti
  297. }
  298. function set_ovmu_ff3(n){
  299. msto.conference.ff ? 0 : msto.conference.ff = {
  300. number:{
  301. ff_timeout:5,
  302. },
  303. radio:{
  304. ff_algo:"ff_none",
  305. },
  306. checkbox:{},
  307. ff_mod:null,
  308. // ff_ordered:0,
  309. // ff_rand:0,
  310. }
  311. clog("set_ovmu_ff3.",jc(msto.conference.ff),jc(msto.conference))
  312. set_ovmu_dflts($(n).find(".ff_inp"))
  313. var local = get_local().id
  314. if (local == msto.conference.ff.ff_mod){
  315. // $(".id_sideToolbarContainer").removeClass("not_local_ff_mod")
  316. } else {
  317. // $(".id_sideToolbarContainer").addClass("not_local_ff_mod")
  318. }
  319. $(n).find(".spot_focus").off("change")
  320. // $(n).find(".spot_focus").change(spot_focus_cb)
  321. $(n).find(".spot_focus").change(toggle_spotlight)
  322. // clog("set_ovmu_ff2",n)
  323. // $("#sideToolbarContainer").change(ovmu_change)
  324. // $(".id_sideToolbarContainer").change()
  325. $(".id_sideToolbarContainer").off("change")
  326. $(".id_sideToolbarContainer").change(ovmu_change)
  327. }
  328. function set_ovmu_ff2(n){
  329. clog("set_ovmu_ff2",n)
  330. n.change(ovmu_change)
  331. }
  332. function set_ovmu_ff(n){
  333. msto.conference.rotate_index = msto.conference.rotate_index || 0
  334. n = $(n)
  335. try {
  336. n.find("#num_pseudo")[0].onchange = num_pseudo
  337. n.find("input#ov_timeout")[0].value=window.msto ? msto.conference.scroll_timeout || 15 : 15
  338. n.find("#num_pseudo")[0].value= window.msto ? msto.conference.repeat || 0 : 0
  339. // n.find("#scroll_now")[0].onclick = scroll_send
  340. n.find("#scroll_now")[0].onclick = timeout_scroll_start_now
  341. n.find("input#ov_timeout")[0].onchange = scroll_timeout_runner
  342. n.find("input#ov_timeout_disable")[0].onchange = scroll_timeout_runner
  343. n.find("input#follow_focus")[0].onchange = ffcb
  344. n.find("input#follow_focus_force")[0].onchange = fffcb
  345. } catch(err){}
  346. // clog("zz",n.find("input#ov_timeout")[0].value))
  347. // value=${window.msto ? msto.conference.scroll_timeout || 15 : 15}
  348. // value=${window.msto ? msto.conference.repeat || 0 : 0} num p
  349. try_set_state(n)
  350. }
  351. // function
  352. glob_mx.qxi_cb["SET_OVERFLOW_MENU_VISIBLE"].fn = function (o,a2){
  353. if (!window.iammod){return}
  354. // somv_to()
  355. // setTimeout(somv_to,0,"A")
  356. // somv_to("A")
  357. clog("SET_OVERFLOW_MENU_VISIBLE.",o,$(".overflow-menu"))
  358. /*
  359. // ovmu_item
  360. var jmod_templates_ui_msg = $(mod_templates_ui_msg)
  361. n = jmod_templates_ui_msg.find(".ovmu_item")
  362. // n.find(".popup_body").prepend(svg)
  363. // n.find(".popup_body").prepend(svg)
  364. $(".overflow-menu").append(n)
  365. */
  366. }
  367. // qxi_cb
  368. /*
  369. av_io_on
  370. av_io_off
  371. av_io_mic
  372. av_io_vid
  373. av_io_av
  374. av_io_all
  375. av_io_single
  376. */
  377. function evnt_av_io(a,a2,a3){
  378. var o = {
  379. act:""
  380. }
  381. // if
  382. var n,j,i,k
  383. var av_io_on,av_type,av_all_single,av_all
  384. // var av_all,av_single
  385. j = $(this)
  386. av_io_on = j.hasClass("av_io_on")
  387. av_all = j.hasClass("av_io_all")
  388. if (j.hasClass("av_io_mic")){
  389. av_type = "mic"
  390. // av_type = "av"
  391. } else if (j.hasClass("av_io_vid")){
  392. av_type = "vid"
  393. } else if (j.hasClass("av_io_av")){
  394. av_type = "av"
  395. }
  396. o.act += av_type + "_"
  397. if (av_io_on){
  398. o.act += "on"
  399. } else {
  400. o.act += "off"
  401. }
  402. if (av_all){
  403. o.to = "all"
  404. } else {
  405. // participant_07b5a03f
  406. j.parents(".small_vid")[0]
  407. o.to = j.parents(".small_vid")[0].id.split("_").pop()
  408. }
  409. req_av_send(o)
  410. clog("evnt_av_io,,,,",o,{av_io_on,av_type,av_all,vid:j.parents(".small_vid")})
  411. clog("evnt_av_io",a,a2,a3,this)
  412. }
  413. function refresh_overflow_menu(){
  414. toggle_overflow_menu()
  415. setTimeout(toggle_overflow_menu,100)
  416. dispatch_evnt(1)
  417. setTimeout(dispatch_evnt(),50)
  418. }
  419. function refresh_overflow_menu_only(){
  420. toggle_overflow_menu()
  421. setTimeout(toggle_overflow_menu,100)
  422. // dispatch_evnt(1)
  423. // setTimeout(dispatch_evnt(),50)
  424. }
  425. console.log("R1",$("#sharedVideoIFrame")[0].contentWindow)
  426. // dispatch_evnt()
  427. // refresh_overflow_menu()
  428. // toggle_overflow_menu()