EVOLUTION-MANAGER
Edit File: room.min.js
(function(){var a;a=jQuery;a.widget("ui.dialogExtend",{version:"2.0.4",modes:{},options:{closable:!0,dblclick:!1,titlebar:!1,icons:{close:"ui-icon-closethick",restore:"ui-icon-newwin"},load:null,beforeRestore:null,restore:null},_create:function(){this._state="normal";a(this.element[0]).data("ui-dialog")||a.error("jQuery.dialogExtend Error : Only jQuery UI Dialog element is accepted");this._verifyOptions();this._initStyles();this._initButtons();this._initTitleBar();this._setState("normal");this._on("load", function(a){return console.log("test",a)});return this._trigger("load")},_setState:function(c){a(this.element[0]).removeClass("ui-dialog-"+this._state).addClass("ui-dialog-"+c);return this._state=c},_verifyOptions:function(){var c,e;!this.options.dblclick||this.options.dblclick in this.modes||(a.error("jQuery.dialogExtend Error : Invalid \x3cdblclick\x3e value '"+this.options.dblclick+"'"),this.options.dblclick=!1);this.options.titlebar&&"none"!==(e=this.options.titlebar)&&"transparent"!==e&&(a.error("jQuery.dialogExtend Error : Invalid \x3ctitlebar\x3e value '"+ this.options.titlebar+"'"),this.options.titlebar=!1);e=[];for(c in this.modes)this["_verifyOptions_"+c]?e.push(this["_verifyOptions_"+c]()):e.push(void 0);return e},_initStyles:function(){var c,e;a(".dialog-extend-css").length||a('\x3cstyle class\x3d"dialog-extend-css" type\x3d"text/css"\x3e.ui-dialog .ui-dialog-titlebar-buttonpane\x3ea { float: right; }.ui-dialog .ui-dialog-titlebar-restore { width: 19px; height: 18px; }.ui-dialog .ui-dialog-titlebar-restore span { display: block; margin: 1px; }.ui-dialog .ui-dialog-titlebar-restore:hover,.ui-dialog .ui-dialog-titlebar-restore:focus { padding: 0; }.ui-dialog .ui-dialog-titlebar ::selection { background-color: transparent; }\x3c/style\x3e').appendTo("body"); e=[];for(c in this.modes)e.push(this["_initStyles_"+c]());return e},_initButtons:function(){var c,e,f,k,g=this;f=a(this.element[0]).dialog("widget").find(".ui-dialog-titlebar");c=a('\x3cdiv class\x3d"ui-dialog-titlebar-buttonpane"\x3e\x3c/div\x3e').appendTo(f);c.css({position:"absolute",top:"50%",right:"0.3em","margin-top":"-10px",height:"18px"});f.find(".ui-dialog-titlebar-close").css({position:"relative","float":"right",top:"auto",right:"auto",margin:0}).find(".ui-icon").removeClass("ui-icon-closethick").addClass(this.options.icons.close).end().appendTo(c).end(); c.append('\x3ca class\x3d"ui-dialog-titlebar-restore ui-corner-all ui-state-default" href\x3d"#"\x3e\x3cspan class\x3d"ui-icon '+this.options.icons.restore+'" title\x3d"restore"\x3erestore\x3c/span\x3e\x3c/a\x3e').find(".ui-dialog-titlebar-restore").attr("role","button").mouseover(function(){return a(this).addClass("ui-state-hover")}).mouseout(function(){return a(this).removeClass("ui-state-hover")}).focus(function(){return a(this).addClass("ui-state-focus")}).blur(function(){return a(this).removeClass("ui-state-focus")}).end().find(".ui-dialog-titlebar-close").toggle(this.options.closable).end().find(".ui-dialog-titlebar-restore").hide().click(function(a){a.preventDefault(); return g.restore()}).end();k=this.modes;for(e in k)c=k[e],this._initModuleButton(e,c);return f.dblclick(function(a){if(g.options.dblclick)return"normal"!==g._state?g.restore():g[g.options.dblclick]()}).select(function(){return!1})},_initModuleButton:function(c,e){var f=this;return a(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-buttonpane").append('\x3ca class\x3d"ui-dialog-titlebar-'+c+' ui-corner-all ui-state-default" href\x3d"#" title\x3d"'+c+'"\x3e\x3cspan class\x3d"ui-icon '+this.options.icons[c]+ '"\x3e'+c+"\x3c/span\x3e\x3c/a\x3e").find(".ui-dialog-titlebar-"+c).attr("role","button").mouseover(function(){return a(this).addClass("ui-state-hover")}).mouseout(function(){return a(this).removeClass("ui-state-hover")}).focus(function(){return a(this).addClass("ui-state-focus")}).blur(function(){return a(this).removeClass("ui-state-focus")}).end().find(".ui-dialog-titlebar-"+c).toggle(this.options[e.option]).click(function(a){a.preventDefault();return f[c]()}).end()},_initTitleBar:function(){var c; switch(this.options.titlebar){case !1:return 0;case "none":return a(this.element[0]).dialog("option","draggable")&&(c=a("\x3cdiv /\x3e").addClass("ui-dialog-draggable-handle").css("cursor","move").height(5),a(this.element[0]).dialog("widget").prepend(c).draggable("option","handle",c)),a(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").find(".ui-dialog-title").html("\x26nbsp;").end().css({"background-color":"transparent","background-image":"none",border:0,position:"absolute",right:0,top:0, "z-index":9999}).end();case "transparent":return a(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").css({"background-color":"transparent","background-image":"none",border:0});default:return a.error("jQuery.dialogExtend Error : Invalid \x3ctitlebar\x3e value '"+this.options.titlebar+"'")}},state:function(){return this._state},restore:function(){this._trigger("beforeRestore");this._restore();this._toggleButtons();return this._trigger("restore")},_restore:function(){if("normal"!==this._state)return this["_restore_"+ this._state](),this._setState("normal"),a(this.element[0]).dialog("widget").focus()},_saveSnapshot:function(){if("normal"===this._state)return this.original_config_resizable=a(this.element[0]).dialog("option","resizable"),this.original_config_draggable=a(this.element[0]).dialog("option","draggable"),this.original_size_height=a(this.element[0]).dialog("widget").outerHeight(),this.original_size_width=a(this.element[0]).dialog("option","width"),this.original_size_maxHeight=a(this.element[0]).dialog("option", "maxHeight"),this.original_position_mode=a(this.element[0]).dialog("widget").css("position"),this.original_position_left=a(this.element[0]).dialog("widget").offset().left-a("body").scrollLeft(),this.original_position_top=a(this.element[0]).dialog("widget").offset().top-a("body").scrollTop(),this.original_titlebar_wrap=a(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").css("white-space")},_loadSnapshot:function(){return{config:{resizable:this.original_config_resizable,draggable:this.original_config_draggable}, size:{height:this.original_size_height,width:this.original_size_width,maxHeight:this.original_size_maxHeight},position:{mode:this.original_position_mode,left:this.original_position_left,top:this.original_position_top},titlebar:{wrap:this.original_titlebar_wrap}}},_toggleButtons:function(c){var e,f,k,g;f=c||this._state;a(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-restore").toggle("normal"!==f).css({right:"1.4em"}).end();k=this.modes;for(e in k)c=k[e],a(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-"+ e).toggle(f!==c.state&&this.options[c.option]);k=this.modes;g=[];for(e in k)c=k[e],c.state===f?g.push(a(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-restore").insertAfter(a(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-"+e)).end()):g.push(void 0);return g}})}).call(this); (function(){var a;a=jQuery;a.extend(!0,a.ui.dialogExtend.prototype,{modes:{collapse:{option:"collapsable",state:"collapsed"}},options:{collapsable:!1,icons:{collapse:"ui-icon-triangle-1-s"},beforeCollapse:null,collapse:null},collapse:function(){var c,e;c=a(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").height()+2;this._trigger("beforeCollapse");"normal"!==this._state&&this._restore();this._saveSnapshot();e=a(this.element[0]).dialog("widget").position();a(this.element[0]).dialog("option", {resizable:!1,height:c,maxHeight:c,position:[e.left-a(document).scrollLeft(),e.top-a(document).scrollTop()]}).on("dialogclose",this._collapse_restore).dialog("widget").find(".ui-dialog-buttonpane:visible").hide().end().find(".ui-dialog-titlebar").css("white-space","nowrap").end().find(".ui-dialog-content");this._setState("collapsed");this._toggleButtons();return this._trigger("collapse")},_restore_collapsed:function(){var c;c=this._loadSnapshot();return a(this.element[0]).show().dialog("widget").find(".ui-dialog-buttonpane:hidden").show().end().find(".ui-dialog-titlebar").css("white-space", c.titlebar.wrap).end().find(".ui-dialog-content").dialog("option",{resizable:c.config.resizable,height:c.size.height,maxHeight:c.size.maxHeight}).off("dialogclose",this._collapse_restore)},_initStyles_collapse:function(){if(!a(".dialog-extend-collapse-css").length)return a('\x3cstyle class\x3d"dialog-extend-collapse-css" type\x3d"text/css"\x3e.ui-dialog .ui-dialog-titlebar-collapse { width: 19px; height: 18px; }.ui-dialog .ui-dialog-titlebar-collapse span { display: block; margin: 1px; }.ui-dialog .ui-dialog-titlebar-collapse:hover,.ui-dialog .ui-dialog-titlebar-collapse:focus { padding: 0; }\x3c/style\x3e').appendTo("body")}, _collapse_restore:function(){return a(this).dialogExtend("restore")}})}).call(this); var WB_AREA_SEL=".room.wb.area",WBA_WB_SEL=".room.wb.area .ui-tabs-panel.ui-corner-bottom.ui-widget-content:visible",VID_SEL=".video.user-video",VideoUtil=function(){function a(a){a=$(a);var b=a.offset();return{left:b.left,top:b.top,right:b.left+a.width(),bottom:b.top+a.height()}}function c(){var a=$(WB_AREA_SEL);return 0<a.find(".wb-area .tabs .ui-tabs-panel").length?$(WBA_WB_SEL):a}function e(a,b,e){if(Room.getOptions().interview)return{left:0,top:0};var h=c(),g=h.offset(),q=g.left,f=g.top,k=g.left+ h.width(),h=g.top+h.height(),g={_left:q,_top:f,right:q+b,bottom:f+e,get left(){return this._left},set left(a){this._left=a;this.right=a+b},get top(){return this._top},set top(a){this._top=a;this.bottom=a+e}},n=h,t;do{t=!0;for(var m=0;m<a.length;++m){var d=a[m],n=Math.min(n,d.bottom);g.left<d.right&&g.right>d.left&&g.top<d.bottom&&g.bottom>d.top&&(g.left=d.right+20,t=!1);g.right>=k&&(g.left=q,g.top=Math.max(n,g.top)+10,t=!1);if(g.bottom>=h){g.top=f;t=!0;break}}}while(!t);return{left:g.left,top:g.top}} function f(a,b){!a||1>a.length||a.hasClass("disabled")||0>b||a.addClass("ui-state-highlight",2E3,function(){a.removeClass("ui-state-highlight",2E3,function(){f(a,--b)})})}var k={getVid:function(a){return"video"+a},isSharing:function(a){return"sharing"===a.type&&a.screenActivities.includes("sharing")},isRecording:function(a){return"sharing"===a.type&&a.screenActivities.includes("recording")&&!a.screenActivities.includes("sharing")},hasAudio:function(a){return a.activities.includes("broadcastA")},hasVideo:function(a){return a.activities.includes("broadcastV")}, getRects:function(c,b){var g=[];c=$(c);for(var h=0;h<c.length;++h)b!==$(c[h]).attr("aria-describedby")&&g.push(a(c[h]));return g}};k.getPos=e;k.container=c;k.arrange=function(){for(var c=[],b=$(VID_SEL),q=0;q<b.length;++q){var h=$(b[q]);h.css(e(c,h.width(),h.height()));c.push(a(h))}};k.askPermission=function(a){var b=$("#ask-permission");void 0===b.dialog("instance")?b.data("callbacks",[]).dialog({appendTo:".room.holder .room.box",autoOpen:!0,buttons:[{text:b.data("btn-ok"),click:function(){for(;0< b.data("callbacks").length;)b.data("callbacks").pop()();$(this).dialog("close")}}]}):b.dialog("isOpen")||b.dialog("open");b.data("callbacks").push(a)};k.highlight=f;return k}(),Video=function(){var a,c;function e(){return w.height()+2+(u.is(":visible")?u.height():0)}function f(a,b){b+=e();g(a,b);return b}function k(a,b){try{p[0].vidResize(Math.floor(a),Math.floor(b))}catch(F){}}function g(a,b){l.dialog("option","width",a).dialog("option","height",b);b-=e();q(a,b);Room.getOptions().interview&&l.dialog("widget").css(VideoUtil.getPos()); k(a,b)}function b(){var a=l.parents(".pod,.pod-big"),b=a.width(),a=a.height();g(b,a)}function q(a,b){v.width(a).height(b);p.attr("width",a).attr("height",b)}function h(a){u.is(":visible")&&(a?(u.find(".off").hide(),u.find(".on").show(),u.addClass("ui-state-highlight"),w.addClass("ui-state-highlight")):(u.find(".off").show(),u.find(".on").hide(),u.removeClass("ui-state-highlight"),w.removeClass("ui-state-highlight")))}function z(a){D.text(a);var b=x.find(".ui-icon");0<a&&b.hasClass("ui-icon-volume-off")? (b.toggleClass("ui-icon-volume-off ui-icon-volume-on"),x.removeClass("ui-state-error"),h(!0)):0===a&&b.hasClass("ui-icon-volume-on")&&(b.toggleClass("ui-icon-volume-on ui-icon-volume-off"),x.addClass("ui-state-error"),h(!1));"function"===typeof p[0].setVolume&&p[0].setVolume(a)}function B(a){y&&(a?(a=y.slider("option","value"),0<a&&(C=a),y.slider("option","value",0),z(0)):(y.slider("option","value",C),z(C)))}function r(a,b,c){if(c.interview){var h=$(".pod-area"),w=UUID.generate();c="#"+w;h.append($('\x3cdiv class\x3d"pod"\x3e\x3c/div\x3e').attr("id", w));WbArea.updateAreaClass()}else c=".room.box";$(c).append(OmUtil.tmpl("#user-video",a).attr("title",b).attr("data-client-uid",d.type+d.cuid).data(m));return c}function A(a,b){if(b.interview)a.dialog("option","draggable",!1),a.dialog("option","resizable",!1),a.dialogExtend({closable:!1,collapsable:!1,dblclick:!1}),$(".pod-area").sortable("refresh");else{a.dialog("option","draggable",!0);a.dialog("option","resizable",!0);a.on("dialogresizestop",function(a,b){a=b.size.width-2;b=b.size.height-w.height()- 4-(u.is(":visible")?u.height():0);q(a,b);k(a,b)});if(VideoUtil.isSharing(d))a.on("dialogclose",function(){VideoManager.close(d.uid,!0)});a.dialogExtend({icons:{collapse:"ui-icon-minus"},closable:VideoUtil.isSharing(d),collapsable:!0,dblclick:"collapse"})}}function n(){var a=VideoUtil.getVid(d.uid);p&&p.remove();var b=Room.getOptions();d.self?(b.cam=d.cam,b.mic=d.mic,b.mode="broadcast"):b.mode="play";b.av=d.activities.join();b.rights=b.rights.join();b.width=d.width;b.height=d.height;b.sid=d.sid;b.uid= d.uid;b.cuid=d.cuid;b.userId=d.user.id;b.pictureUri=d.user.pictureUri;b.broadcastId=d.broadcastId;b.type=d.type;delete b.keycode;p=initSwf(v,"main.swf",a+"-swf",b);p.attr("width",v.width()).attr("height",v.height())}function t(a){if("function"===typeof p[0].refresh){a=a||{};Room.getOptions().interview||isNaN(a.width)||f(a.width,a.height);try{p[0].refresh(a)}catch(E){}}}var m={},d,l,v,w,u,p,x,y,D,C=50;m.update=function(a){var b=Room.getOptions();d.screenActivities=a.screenActivities;d.activities=a.activities; d.user.firstName=a.user.firstName;d.user.lastName=a.user.lastName;d.user.displayName=a.user.displayName;var c=VideoUtil.hasAudio(d);h(c);c?x.show():(x.hide(),l.parent().find(".dropdown-menu.video.volume").hide());b.interview&&d.pod!==a.pod&&(d.pod=a.pod,l.dialog("option","appendTo",".pod.pod-"+d.pod));a=d.user.displayName;l.dialog("option","title",a).parent().find(".ui-dialog-titlebar").attr("title",a);"function"===typeof p[0].update&&p[0].update(d)};m.refresh=t;m.mute=B;m.isMuted=function(){return 0=== y.slider("option","value")};m.init=function(b,g){d=b;a=d.width;c=d.height;var e=VideoUtil.getVid(d.uid),q=d.user.displayName;b=d.self?Math.max(300,d.width):d.width;var f=d.self?Math.max(200,d.height):d.height,p=Room.getOptions(),k=r(e,q,p);l=$("#"+e);l.dialog({classes:{"ui-dialog":"ui-corner-all video user-video"+(p.showMicStatus?" mic-status":""),"ui-dialog-titlebar":"ui-corner-all"+(p.showMicStatus?" ui-state-highlight":"")},width:b,minWidth:40,minHeight:50,autoOpen:!0,modal:!1,appendTo:k});A(l, p);w=l.parent().find(".ui-dialog-titlebar").attr("title",q);u=l.find(".footer");if(!VideoUtil.isSharing(d)){l.parent().find(".ui-dialog-titlebar-buttonpane").append($("#video-volume-btn").children().clone()).append($("#video-refresh-btn").children().clone());var m=l.parent().find(".dropdown-menu.video.volume");y=l.parent().find(".slider");x=l.parent().find(".ui-dialog-titlebar-volume").on("mouseenter",function(a){a.stopImmediatePropagation();m.toggle()}).click(function(a){a.stopImmediatePropagation(); a=$(this).find(".ui-icon").hasClass("ui-icon-volume-off");roomAction("mute",JSON.stringify({uid:d.cuid,mute:!a}));B(!a);m.hide();return!1}).dblclick(function(a){a.stopImmediatePropagation();return!1});l.parent().find(".ui-dialog-titlebar-refresh").click(function(a){a.stopImmediatePropagation();t();return!1}).dblclick(function(a){a.stopImmediatePropagation();return!1});m.on("mouseleave",function(){$(this).hide()});D=l.parent().find(".slider .handle");y.slider({orientation:"vertical",range:"min",min:0, max:100,value:C,create:function(){D.text($(this).slider("value"))},slide:function(a,b){z(b.value)}});e=VideoUtil.hasAudio(d);h(e);e||x.hide()}v=l.find(".video");v.width(b).height(f);n();l.dialog("widget").css(g)};m.securityMode=function(){Room.getOptions().interview?(g(Math.max(300,p.attr("width")),Math.max(200,p.attr("height"))),l.parent().parent().addClass("secure")):l.dialog("option","position",{my:"center",at:"center",of:VideoUtil.container()})};m.swfLoaded=function(){if(Room.getOptions().interview)l.parent().parent().removeClass("secure"), b();else{var w=f(a,c);l.dialog("widget").css(VideoUtil.getPos(VideoUtil.getRects(VID_SEL,VideoUtil.getVid(d.uid)),d.width,w))}};m.client=function(){return d};m.setRights=function(a){"function"===typeof p[0].setRights&&p[0].setRights(a)};m.cleanup=function(){"function"===typeof p[0].cleanup&&p[0].cleanup()};m.resizePod=b;m.reinitSwf=n;return m},VideoManager=function(){function a(a,c){try{if(!(c instanceof Blob)){var b=jQuery.parseJSON(c);if(b&&"mic"===b.type)switch(b.id){case "activity":var g=b.uid, q=b.active,f=$("#user"+g+" .audio-activity.ui-icon"),k=e(g).parent();q?(f.addClass("speaking"),k.addClass("user-speaks")):(f.removeClass("speaking"),k.removeClass("user-speaks"));onBroadcast(b)}}}catch(n){}}function c(a){void 0!==a.dialog("instance")&&a.dialog("destroy");a.parents(".pod").remove();a.remove();WbArea.updateAreaClass()}function e(a){return $(VID_SEL+' div[data-client-uid\x3d"room'+a+'"]')}var f={},k,g=!1;f.init=function(){Wicket.Event.subscribe("/websocket/message",a);VideoSettings.init(Room.getOptions()); k=$(".room.box").find(".icon.shared.ui-button");g=!0};f.update=function(a){if(g){for(var b=0;b<a.streams.length;++b){var h=JSON.parse(JSON.stringify(a)),e=a.streams[b];delete h.streams;$.extend(h,e);if(!(h.self&&VideoUtil.isSharing(h)||VideoUtil.isRecording(h))){var f=VideoUtil.getVid(h.uid),e=VideoUtil.hasAudio(h)||VideoUtil.hasVideo(h),f=$("#"+f);e&&1!==f.length&&h.self?Video().init(h,VideoUtil.getPos(VideoUtil.getRects(VID_SEL),h.width,h.height+25)):e&&1===f.length?f.data().update(h):e||1!==f.length|| c(f)}}if(a.uid===Room.getOptions().uid)for(Room.setRights(a.rights),b=$(VID_SEL+" .ui-dialog-content"),h=0;h<b.length;++h)$(b[h]).data().setRights(a.rights);0===a.streams.length&&(a=$("#"+VideoUtil.getVid(a.uid)),1===a.length&&c(a))}};f.play=function(a){g&&(VideoUtil.isSharing(a)?(VideoUtil.highlight(k.attr("title",k.data("user")+" "+a.user.firstName+" "+a.user.lastName+" "+k.data("text")).data("uid",a.uid).show(),10),k.tooltip().off("click").click(function(){var b=$("#"+VideoUtil.getVid(a.uid)); 1!==b.length?Video().init(a,VideoUtil.container().offset()):b.dialog("open")})):"sharing"!==a.type&&Video().init(a,VideoUtil.getPos(VideoUtil.getRects(VID_SEL),a.width,a.height+25)))};f.close=function(a,e){var b=VideoUtil.getVid(a),b=$("#"+b);1===b.length&&c(b);e||a!==k.data("uid")||k.off("click").hide()};f.securityMode=function(a){$("#"+VideoUtil.getVid(a)).data().securityMode()};f.swfLoaded=function(a){$("#"+VideoUtil.getVid(a)).data().swfLoaded()};f.refresh=function(a,c){a=e(a);0<a.length&&a.data().refresh(c)}; f.mute=function(a,c){a=e(a);0<a.length&&a.data().mute(c)};f.clickMuteOthers=function(a){var b=VideoSettings.load();if(!1!==b.video.confirmMuteOthers){var c=$("#muteothers-confirm");c.dialog({buttons:[{text:c.data("btn-ok"),click:function(){b.video.confirmMuteOthers=!$("#muteothers-confirm-dont-show").prop("checked");VideoSettings.save();roomAction("muteOthers",a);$(this).dialog("close")}},{text:c.data("btn-cancel"),click:function(){$(this).dialog("close")}}]})}};f.muteOthers=function(a){for(var b= $(VID_SEL+" .ui-dialog-content"),c=0;c<b.length;++c){var e=$(b[c]);e.data().mute("room"+a!==e.data("client-uid"))}};f.micActivity=function(a){OmUtil.sendMessage({area:"room",type:"mic",id:"activity",active:a})};f.destroy=function(){Wicket.Event.unsubscribe("/websocket/message",a)};return f}(),Room=function(){function a(){var a=$("#video"+Room.getOptions().uid);return 0<a.length&&(a=a.data(),VideoUtil.hasAudio(a.client()))?a:null}function c(a){var b=$(a.target);if(!0!==a.target.isContentEditable&& !b.is("textarea, input:not([readonly]):not([type\x3dradio]):not([type\x3dcheckbox])"))switch(a.which){case 8:return a.preventDefault(),a.stopImmediatePropagation(),!1}}function e(a,b){var c=OmUtil.getKeyCode(b);return a.alt===b.altKey&&a.ctrl===b.ctrlKey&&a.shift===b.shiftKey&&a.code.toUpperCase()===(c?c.toUpperCase():"")}function f(b){if(e(n.keycode.arrange,b))VideoUtil.arrange();else if(e(n.keycode.muteothers,b))null!==a()&&VideoManager.clickMuteOthers(Room.getOptions().uid);else if(e(n.keycode.mute, b)){var c=a();null!==c&&c.mute(!c.isMuted())}else e(n.keycode.quickpoll,b)&&quickPollAction("open");27===b.which&&$("#wb-rename-menu").hide()}function k(a){1===a.which&&$("#wb-rename-menu").hide()}function g(){var a=window.innerWidth,b=window.innerHeight;void 0===d&&(d=$(".room.sidebar"));var c=void 0===d?0:d.width()+parseInt(d.css(A)),a=a-c-8,e=v&&v.is(":visible")?v.height():0,b=b-t-3,g=b-5,f=d.find(".tabs"),h=$("ul",f).height(),k=$(".room.holder"),l=$(".file.list",f);d.height(b-e);f.height(g-e); $(".user.list",f).height(g-h-e-$(".user.header",f).height()-5);$(".trees",l).height(g-h-e-$(".trash-toolbar",l).height()-$(".footer",l).height()-5);255<c?k.addClass("big").removeClass("small"):k.removeClass("big").addClass("small");Chat.setHeight(b);"undefined"!==typeof WbArea&&(e=m.width(),WbArea.resize(c+5,e+5,a-e,b))}function b(){n&&n.reloadUrl?window.location.href=n.reloadUrl:window.location.reload()}function q(){z();$(".room.holder").remove();$("#chatPanel").remove();var a=$("#disconnected-dlg"); a.dialog({modal:!0,close:b,buttons:[{text:a.data("reload"),icons:{primary:"ui-icon-refresh"},click:function(){$(this).dialog("close")}}]})}function h(){d.resizable({handles:Settings.isRtl?"w":"e",stop:function(){g()}})}function z(){$(window).off("resize.openmeetings");Wicket.Event.unsubscribe("/websocket/closed",q);Wicket.Event.unsubscribe("/websocket/error",q);"undefined"!==typeof WbArea&&(WbArea.destroy(),window.WbArea=void 0);"undefined"!==typeof VideoSettings&&VideoSettings.close();"object"=== typeof VideoManager&&VideoManager.destroy();var a=$("#quick-confirmation");a.dialog("instance")&&a.dialog("destroy");$(".ui-dialog.user-video").remove();$(window).off("keyup.openmeetings");$(window).off("keydown.openmeetings");$(document).off("click",k);d=void 0}function B(){var a=$("#quick-vote .close");1===a.length&&(a.off(),n.rights.includes("superModerator")||n.rights.includes("moderator")||n.rights.includes("presenter")?a.show().click(function(){var a=$("#quick-confirmation");a.dialog({resizable:!1, height:"auto",width:400,modal:!0,buttons:[{text:a.data("btn-ok"),click:function(){quickPollAction("close");$(this).dialog("close")}},{text:a.data("btn-cancel"),click:function(){$(this).dialog("close")}}]})}):a.hide())}var r={},A=Settings.isRtl?"right":"left",n,t,m,d,l,v;r.init=function(a){n=a;window.WbArea=n.interview?InterviewWbArea():DrawWbArea();a=$(".room.box .room.menu");m=$("#chatPanel");v=$("#activities");d=$(".room.sidebar").css(A,"0px");l=d.find(".btn-dock").button({icon:"ui-icon icon-undock", showLabel:!1}).click(function(){var a=parseInt(d.css(A));0>a&&d.removeClass("closed");l.button("option","disabled",!0);var b={};b[A]=0>a?"0px":-d.width()+45+"px";d.animate(b,1500,function(){l.button("option","disabled",!1).button("option","icon","ui-icon "+(0>a?"icon-undock":"icon-dock"));0>a?(l.attr("title",l.data("ttl-undock")),h()):(l.attr("title",l.data("ttl-dock")),d.addClass("closed").resizable("destroy"));g()})});l.addClass(Settings.isRtl?"align-left":"align-right").attr("title",l.data("ttl-undock")).button("option", "label",l.data("ttl-undock")).button("refresh");t=0===a.length?0:a.height();VideoManager.init();"undefined"!==typeof Activities&&Activities.init();d.on("remove",function(){$(".ui-dialog.user-video .ui-dialog-content").each(function(){$(this).data().cleanup();$(this).remove()})})};r.getMenuHeight=function(){return t};r.getOptions=function(){return"object"===typeof n?JSON.parse(JSON.stringify(n)):{}};r.setRights=function(a){n.rights=a;B()};r.setSize=g;r.load=function(){void 0!==d&&(d.ready(function(){g()}), h());$(window).on("resize.openmeetings",g);Wicket.Event.subscribe("/websocket/closed",q);Wicket.Event.subscribe("/websocket/error",q);$(window).on("keydown.openmeetings",c);$(window).on("keyup.openmeetings",f);$(document).click(k)};r.unload=z;r.showClipboard=function(a){var b=$("#clipboard-dialog");b.find("p .text").text(a);b.dialog({resizable:!1,height:"auto",width:400,modal:!0,buttons:[{text:b.data("btn-ok"),click:function(){$(this).dialog("close")}}]})};r.quickPoll=function(a){if(a.started){var b= $("#quick-vote");if(0===b.length){var c=$(".room.wb.area"),b=OmUtil.tmpl("#quick-vote-template","quick-vote");c.append(b)}c=b.find(".control.pro");con=b.find(".control.con");a.voted?(c.removeClass("clickable").off(),con.removeClass("clickable").off()):(c.addClass("clickable").off().click(function(){quickPollAction("vote",!0)}),con.addClass("clickable").off().click(function(){quickPollAction("vote",!1)}));c.find(".badge").text(a.pros);con.find(".badge").text(a.cons);B()}else a=$("#quick-vote"),1=== a.length&&a.remove();OmUtil.tmpl("#quick-vote-template","quick-vote")};return r}();function startPrivateChat(a){Chat.addTab("chatTab-u"+a.parent().parent().data("userid"),a.parent().parent().find(".user.name").text());Chat.open();$("#chatMessage .wysiwyg-editor").click()}function sipBtnClick(){var a=$(".sip-number");a.val(a.val()+$(this).data("value"))}function sipBtnEraseClick(){var a=$(".sip-number"),c=a.val();c&&a.val(c.substring(0,c.length-1))} function sipGetKey(a){var c=-1;47<a.keyCode&&58>a.keyCode&&(c=a.keyCode-48);95<a.keyCode&&106>a.keyCode&&(c=a.keyCode-96);return c}function sipKeyDown(a){a=sipGetKey(a);0<a&&$("#sip-dialer-btn-"+a).addClass("ui-state-active")}function sipKeyUp(a){a=sipGetKey(a);0<a&&$("#sip-dialer-btn-"+a).removeClass("ui-state-active")}function typingActivity(a,c){a=$("#user"+a+" .typing-activity.ui-icon");c?a.addClass("typing"):a.removeClass("typing")};