Your IP : 18.190.25.139
(function(t){if(t.BX.desktop)return;var e=t.BX;e.desktop=function(){this.apiReady=typeof BXDesktopSystem!="undefined"||typeof BXDesktopWindow!="undefined";this.clientVersion=0;this.disableLogin=false;this.autorun=null;this.focusTimeout=null;this.lastSetIcon=null;this.showNotifyId={};this.popupConfirm=null;this.htmlWrapperHead=null;this.tryCheckConnect={};this.topmostWindow=null;this.topmostWindowTimeout=null;this.content=null;this.contentFullWindow=true;this.contentBodyWindow=false;this.contentMenu=null;this.contentAvatar=null;this.contentTab=null;this.contentTabContent=null;this.currentTab="";this.currentTabTarget="";this.lastTab="";this.lastTabTarget="";this.path={};this.path.mainUserOptions="/desktop_app/options.ajax.php";this.path.pathToAjax="/desktop_app/im.ajax.php";this.tabItems={};this.tabRedrawTimeout=null;this.userInfo={id:0,name:"",gender:"M",avatar:"",profile:""};this.syncStatus=null;this.syncPauseBlock=false;this.inited=false;this.sizeInited=false;this.width=914;this.height=454;this.initWidth=914;this.initHeight=454;this.minWidth=515;this.minHeight=384;this.timeoutDelayOfLogout=null;this.addCustomEvent("bxImLogoutInit",e.delegate(function(t,e){this.onCustomEventForTab(TAB_CP,"bxImLogoutStart",[]);this.logout(t,e,true)},this));e.bind(t,"keydown",e.delegate(function(t){if(t.keyCode==82&&(t.ctrlKey==true||t.metaKey==true)){if(t.shiftKey==true&&typeof BXIM!="undefined"){BXIM.setLocalConfig("global_msz_v2",false);e.desktop.apiReady=false;console.log("NOTICE: User use /windowReload + /clearWindowSize")}else{console.log("NOTICE: User use /windowReload")}this.windowReload()}else if(t.keyCode==68&&(t.ctrlKey==true||t.metaKey==true)&&t.shiftKey==true){this.openDeveloperTools();console.log("NOTICE: User use /openDeveloperTools")}else if(t.keyCode==76&&(t.ctrlKey==true||t.metaKey==true)&&t.shiftKey==true){this.openLogsFolder();console.log("NOTICE: User use /openLogsFolder")}},this))};e.desktop.prototype.init=function(o){o=o||{};if(this.inited){return true}this.inited=true;this.context=o.context||"DESKTOP";this.design=o.design||"DESKTOP";if(this.context=="FULLSCREEN"||this.context=="PAGE"||this.context=="DIALOG"||this.context=="LINES"){if(this.context=="FULLSCREEN"||this.context=="PAGE"){this.contentBodyWindow=true}this.content=e("workarea-content");if(!this.content){this.content=e.create("div");document.body.insertBefore(this.content,document.body.firstChild)}if(this.context=="LINES"||this.context=="DIALOG"){this.contentFullWindow=false}else{if(this.content.offsetWidth<this.minWidth)e.style(this.content,"width",this.minWidth+"px")}}else{this.content=e.create("div");document.body.insertBefore(this.content,document.body.firstChild)}if(this.ready()&&!this.enableInVersion(29)){e.PULL.tryConnectSet(null,false);this.notSupported();this.apiReady=false;this.disableLogin=true;return false}this.setWindowResizable(true);this.setWindowMinSize({Width:this.minWidth,Height:this.minHeight});if(this.ready()){console.log(e.message("BXD_DEFAULT_TITLE").replace("#VERSION#",this.getApiVersion(true)));e.debugEnable(true)}if(!e.browser.IsMac()&&document.head)document.head.insertBefore(e.create("style",{attrs:{type:"text/css"},html:"@font-face { font-family: 'helvetica neue'; src: local('Arial'); } @font-face { font-family: 'Helvetica'; src: local('Arial'); }"}),document.head.firstChild);if(this.ready()){e.ready(function(){e.addClass(document.body,"bx-desktop")})}else{e.ready(function(){e.addClass(document.body,"im-desktop-content")})}e.desktop.addTab({id:"exit",title:e.message("BXD_LOGOUT"),order:1100,target:false,events:{open:e.delegate(function(){this.logout(false,"exit_tab")},this)}});e.addCustomEvent("onPullRevisionUp",function(t,o){e.PULL.closeConfirm();console.log("NOTICE: Window reload, becouse PULL REVISION UP ("+o+" -> "+t+")");location.reload()});e.addCustomEvent("onPullError",e.delegate(function(t,o){if(t=="AUTHORIZE_ERROR"){this.setIconStatus("offline");this.login(function(){console.log("DESKTOP LOGIN: success after PullError");e.PULL.setPrivateVar("_pullTryConnect",true);e.PULL.updateState("13",true)})}else if(t=="RECONNECT"){this.setIconStatus("offline")}},this));e.addCustomEvent("onImError",e.delegate(function(t,o){if(t=="AUTHORIZE_ERROR"||t=="SEND_ERROR"&&o=="AUTHORIZE_ERROR"){this.setIconStatus("offline");this.login(e.delegate(function(){this.setIconStatus("online");var t="DESKTOP LOGIN: success after ImError";console.log(t);if(typeof BXIM!="undefined"){e.desktop.log("phone."+BXIM.userEmail+".log",t);BXIM.messenger.connectionStatus("online",false)}},this))}else if(t=="CONNECT_ERROR"){this.setIconStatus("offline")}},this));if(this.ready()){e.userOptions.setAjaxPath(this.path.mainUserOptions);e.addCustomEvent("onPullStatus",e.delegate(function(t){if(t=="offline")this.setIconStatus("offline");else this.setIconStatus(BXIM&&BXIM.settings?BXIM.settings.status:"online")},this));e.bind(t,"online",e.delegate(function(){this.setIconStatus(BXIM&&BXIM.settings?BXIM.settings.status:"online")},this));e.bind(t,"offline",e.delegate(function(){this.setIconStatus("offline")},this));this.addCustomEvent("BXWakeAction",e.delegate(function(){this.setIconStatus(BXIM&&BXIM.settings?BXIM.settings.status:"online")},this));this.addCustomEvent("BXSleepAction",e.delegate(function(){this.setIconStatus("offline")},this));this.addCustomEvent("BXExitApplication",e.delegate(function(){this.preventShutdown();this.logout(true,"exit_event")},this))}e.bind(t,"resize",e.delegate(function(){this.adjustSize()},this));this.addCustomEvent("BXChangeTab",e.delegate(function(t){this.changeTab(t)},this));this.addCustomEvent("BXTrayConstructMenu",e.delegate(function(){this.onCustomEvent("main","BXTrayMenu",[]);setTimeout(function(){e.desktop.finalizeTrayMenu()})},this));this.addCustomEvent("BXFileStorageSyncPauseChanged",e.delegate(this.onSyncStatusChanged,this));e.onCustomEvent(t,"onDesktopInit",[this]);e.desktop.onCustomEvent("onDesktopInit",[this])};e.desktop.prototype.notSupported=function(){this.setWindowMinSize({Width:864,Height:493});this.setWindowSize({Width:864,Height:493});this.setWindowResizable(false);this.setWindowTitle(e.message("BXD_DEFAULT_TITLE").replace("#VERSION#",this.getApiVersion(true)));var o=e.create("div",{props:{className:"bx-desktop-update-box"},children:[e.create("div",{props:{className:"bx-desktop-update-box-text"},html:e.message("BXD_NEED_UPDATE")}),e.create("div",{props:{className:"bx-desktop-update-box-btn"},events:{click:e.delegate(function(){this.checkUpdate(true)},this)},html:e.message("BXD_NEED_UPDATE_BTN")})]});e.ready(function(){document.body.innerHTML="";document.body.appendChild(o);e.onCustomEvent(t,"onDesktopOutdated",[this])})};e.desktop.prototype.getCurrentUrl=function(){return document.location.protocol+"//"+document.location.hostname+(document.location.port==""?"":":"+document.location.port)};e.desktop.prototype.ready=function(){return this.apiReady};e.desktop.prototype.diskReady=function(){return this.apiReady&&typeof BXFileStorage!="undefined"};e.desktop.prototype.login=function(t){if(this.disableLogin){console.log("DESKTOP LOGIN: command was disabled");return false}var o="DESKTOP LOGIN: try to login";console.log(o);if(typeof BXIM!="undefined"){e.desktop.log("phone."+BXIM.userEmail+".log",o)}if(!this.ready()){this.windowReload();return false}var n={};if(typeof t=="function"){n.success=e.delegate(function(o){if(typeof o=="string"){e.message({bitrix_sessid:o})}t(o);this.onCustomEvent("main","BXLoginSuccess",[o])},this)}else{n.success=e.delegate(this.loginSuccessCallback,this)}BXDesktopSystem.Login(n);return true};e.desktop.prototype.loginSuccessCallback=function(t){if(typeof t=="string"){e.message({bitrix_sessid:t})}if(!this.ready())return false;this.windowReload();return true};e.desktop.prototype.showLoginForm=function(){BXDesktopSystem.Logout(1,"login_form")};e.desktop.prototype.windowReload=function(){location.reload()};e.desktop.prototype.logout=function(t,o,n){if(typeof BXDesktopSystem=="undefined"||typeof BXDesktopWindow=="undefined"){location.href="/?logout=yes";return true}if(false&&!n&&this.getContextWindow()===TAB_CP&&this.getNetworkAuthorizeStatus()){this.timeoutDelayOfLogout=setTimeout(e.delegate(function(){this.logout(t,o,true)},this),2e3);this.onCustomEventForTab(TAB_B24NET,"bxImLogoutInit",[t,o]);this.addCustomEvent("bxImLogoutStart",e.delegate(function(){clearTimeout(this.timeoutDelayOfLogout)},this));this.addCustomEvent("bxImLogoutEnd",e.delegate(function(t,e){this.logout(t,e,true)},this));return false}t=t==true;this.apiReady=false;e.ajax({url:this.path.pathToAjax+"?DESKTOP_LOGOUT",method:"POST",dataType:"json",timeout:30,data:{IM_DESKTOP_LOGOUT:"Y",sessid:e.bitrix_sessid()},onsuccess:e.delegate(function(){if(o)console.log("Logout reason: "+o);if(false&&this.getContextWindow()===TAB_B24NET){this.onCustomEventForTab(TAB_CP,"bxImLogoutEnd",[t,o])}if(t)BXDesktopSystem.Shutdown();else BXDesktopSystem.Logout(2)},this),onfailure:e.delegate(function(){if(o)console.log("Logout reason (fail): "+o);if(false&&this.getContextWindow()===TAB_B24NET){this.onCustomEventForTab(TAB_CP,"bxImLogoutEnd",[t,o])}if(t)BXDesktopSystem.Shutdown();else BXDesktopSystem.Logout(3)},this)});return true};e.desktop.prototype.checkUpdate=function(t){if(typeof BXDesktopSystem=="undefined")return false;t=typeof t!="boolean"?false:t;if(!t&&this.enableInVersion(16))BXDesktopSystem.ExecuteCommand("update.check",{NotifyNoUpdates:true,ShowNotifications:true});else this.browse(e.browser.IsMac()?"http://dl.bitrix24.com/b24/bitrix24_desktop.dmg":"http://dl.bitrix24.com/b24/bitrix24_desktop.exe","desktopApp");return true};e.desktop.prototype.getApiVersion=function(t){if(typeof BXDesktopSystem=="undefined")return 0;if(!this.clientVersion)this.clientVersion=BXDesktopSystem.GetProperty("versionParts");return t?this.clientVersion.join("."):this.clientVersion[3]};e.desktop.prototype.enableInVersion=function(t){if(typeof BXDesktopSystem=="undefined")return false;return this.getApiVersion()>=parseInt(t)};e.desktop.prototype.addCustomEvent=function(e,o){if(!this.ready())return false;t.addEventListener(e,function(e){var n=[];for(var s in e.detail)n.push(e.detail[s]);o.apply(t,n)});return true};e.desktop.prototype.onCustomEvent=function(t,e,o){if(!this.ready())return false;if(arguments.length==2){o=e;e=t;t="all"}else if(arguments.length<2){return false}var n={};for(var s=0;s<o.length;s++)n[s]=o[s];if(t=="all"){var i=opener?opener:top;for(var s=0;s<i.BXWindows.length;s++){if(i.BXWindows[s]&&i.BXWindows[s].name!=""&&i.BXWindows[s].BXDesktopWindow&&i.BXWindows[s].BXDesktopWindow.DispatchCustomEvent)i.BXWindows[s].BXDesktopWindow.DispatchCustomEvent(e,n)}i.BXDesktopWindow.DispatchCustomEvent(e,n)}else{if(t=this.findWindow(t))t.DispatchCustomEvent(e,n)}return true};e.desktop.prototype.onCustomEventForTab=function(t,e,o){if(!this.enableInVersion(35))return true;return true};e.desktop.prototype.findWindow=function(t){if(!this.ready())return null;if(typeof t=="undefined")t="main";var e=opener?opener:top;if(t=="main"){return e.BXDesktopWindow}else{for(var o=0;o<e.BXWindows.length;o++){if(e.BXWindows[o].name===t)return e.BXWindows[o].BXDesktopWindow}}return null};e.desktop.prototype.windowIsFocused=function(){if(!this.ready())return false;return BXDesktopWindow.GetProperty("isForeground")};e.desktop.prototype.setIconStatus=function(t){if(!this.ready())return false;if(this.lastSetIcon==t)return false;this.lastSetIcon=t;BXDesktopSystem.SetIconStatus(t);return true};e.desktop.prototype.setIconBadge=function(t,e){if(!this.ready())return false;e=e===true;BXDesktopSystem.SetIconBadge(t+"",e);return true};e.desktop.prototype.setIconTooltip=function(t){if(!this.ready())return false;return BXDesktopSystem.ExecuteCommand("tooltip.change",t)};e.desktop.prototype.setWindowResizable=function(t){if(!this.ready())return false;BXDesktopWindow.SetProperty("resizable",t!==false);return false};e.desktop.prototype.setWindowClosable=function(t){if(!this.ready())return false;BXDesktopWindow.SetProperty("closable",t!==false);return false};e.desktop.prototype.flashIcon=function(t){if(!this.ready())return false;BXDesktopSystem.FlashIcon(t==true);return true};e.desktop.prototype.checkInternetConnection=function(t,o,n,s){if(typeof t!="function"){t=function(){if(typeof BXIM!="undefined"){BXIM.messenger.connectionStatus("online",false)}}}if(typeof o!="function")o=function(){};if(typeof n!="number")n=1;if(!s&&n>1)s=+new Date;if(typeof BXIM!="undefined"){BXIM.messenger.connectionStatus("connecting")}e.ajax({url:"//www.bitrixsoft.com/200.ok."+ +new Date,method:"GET",dataType:"html",skipAuthCheck:true,skipBxHeader:true,timeout:1,onsuccess:function(i){if(i=="OK"){console.log("Checking internet connection... success!");delete e.desktop.tryCheckConnect[s];t()}else{if(typeof BXIM!="undefined"){BXIM.messenger.connectionStatus("offline")}console.log("Checking internet connection... failure!");if(n==1){delete e.desktop.tryCheckConnect[s];o()}else{if(typeof BXIM!="undefined"){BXIM.messenger.connectionStatus("connecting")}clearTimeout(e.desktop.tryCheckConnect[s]);e.desktop.tryCheckConnect[s]=setTimeout(function(){e.desktop.checkInternetConnection(t,o,n-1,s)},5e3)}}},onfailure:function(){console.log("Checking internet connection... failure!");if(n==1){delete e.desktop.tryCheckConnect[s];o()}else{clearTimeout(e.desktop.tryCheckConnect[s]);e.desktop.tryCheckConnect[s]=setTimeout(function(){e.desktop.checkInternetConnection(t,o,n-1,s)},5e3)}}});return true};e.desktop.prototype.getWorkArea=function(){if(!this.ready())return false;var t=BXDesktopSystem.GetWorkArea();return{top:t[0],left:t[1],right:t[2],bottom:t[3]}};e.desktop.prototype.showNotification=function(t,e,o){if(!this.ready()||e=="")return false;if(this.showNotifyId[t])return false;this.showNotifyId[t]=true;BXDesktopSystem.ExecuteCommand("notification.show.html",this.getHtmlPage(e,o,"desktop-notify-popup"));return true};e.desktop.prototype.adjustSize=function(o,n){var s=0;var i=0;if(this.contentBodyWindow){if(this.context=="FULLSCREEN"){i=Math.max(t.innerHeight-(document.body.offsetHeight-e.desktop.content.offsetHeight),this.initHeight)}else{i=Math.max(t.innerHeight-e.pos(e.desktop.content).top-20,this.initHeight)}s=e.desktop.content.offsetWidth}else if(this.contentFullWindow){s=t.innerWidth;i=t.innerHeight}else{try{e.style(document.body,"height",t.innerHeight+"px")}catch(r){setTimeout(function(){e.desktop.adjustSize(o,n)},500)}s=Math.max(this.content.offsetWidth,this.minWidth);i=Math.max(this.content.offsetHeight,this.minHeight)}if((!o||!n)&&(i<this.minHeight||s<this.minWidth)){if(this.ready())BXDesktopWindow.SetProperty("clientSize",{Width:this.width,Height:this.height});return false}this.width=o?o:s;this.height=n?n:i;e.style(this.contentMenu,"height",this.height+"px");e.style(this.contentTabContent,"height",this.height+"px");return true};e.desktop.prototype.resize=function(){if(!this.ready())return false;BXDesktopWindow.SetProperty("clientSize",{Width:document.body.offsetWidth,Height:document.body.offsetHeight});return true};e.desktop.prototype.syncPause=function(o,n){if(!this.diskReady())return false;if(n){this.syncPauseBlock=o}if(!this.syncPauseBlock||this.syncPauseBlock&&n){this.syncStatus=!o;BXFileStorage.SyncPause(!this.syncStatus);e.onCustomEvent(t,"onDesktopSyncPause",[this.syncStatus])}return true};e.desktop.prototype.onSyncStatusChanged=function(t){this.syncPause(t,true)};e.desktop.prototype.getSyncStatus=function(){return this.syncStatus};e.desktop.prototype.windowCommand=function(o,n){if(!this.ready())return false;if(arguments.length==1){n=o;o=t}if(n=="show"&&o==t){e.desktop.setActiveWindow()}try{if(n=="show"||n=="hide"||n=="freeze"||n=="unfreeze"){o.BXDesktopWindow.ExecuteCommand(n)}else if(n=="close"){o.BXDesktopWindow.ExecuteCommand("close")}}catch(s){console.log("ExecuteCommand Error",n,o,s);console.trace()}return true};e.desktop.prototype.openTopmostWindow=function(t,e,o){if(!this.ready())return false;this.closeTopmostWindow();this.topmostWindow=BXDesktopSystem.ExecuteCommand("topmost.show.html",this.getHtmlPage(t,e,o));return true};e.desktop.prototype.closeTopmostWindow=function(){if(this.topmostWindow){this.windowCommand(this.topmostWindow,"close");this.topmostWindow=null}return true};e.desktop.prototype.getHtmlPage=function(t,o,n){if(!this.ready())return;t=t||"";o=o||"";n=n||"";if(this.htmlWrapperHead==null)this.htmlWrapperHead=document.head.outerHTML.replace(/BX\.PULL\.start\([^)]*\);/g,"");if(t!=""&&e.type.isDomNode(t))t=t.outerHTML;if(o!=""&&e.type.isDomNode(o))o=o.outerHTML;if(o!="")o='<script type="text/javascript">BX.ready(function(){'+o+"});</script>";return"<!DOCTYPE html><html>"+this.htmlWrapperHead+'<body class="im-desktop im-desktop-popup '+n+'">'+t+o+"</body></html>"};e.desktop.prototype.openDeveloperTools=function(){if(typeof BXDesktopWindow=="undefined")return false;BXDesktopWindow.OpenDeveloperTools();return true};e.desktop.prototype.openLogsFolder=function(){if(!this.ready())return false;BXDesktopSystem.OpenLogsFolder();return true};e.desktop.prototype.browse=function(t){if(typeof BXDesktopSystem=="undefined")return false;BXDesktopSystem.ExecuteCommand("browse",t);return true};e.desktop.prototype.autorunStatus=function(t){if(!this.ready())return false;if(typeof t!="boolean"){if(this.autorun==null)this.autorun=BXDesktopSystem.GetProperty("autostart")}else{this.autorun=t;BXDesktopSystem.SetProperty("autostart",this.autorun)}return this.autorun};e.desktop.prototype.diskAttachStatus=function(){if(!this.ready())return false;return BitrixDisk?BitrixDisk.enabled:false};e.desktop.prototype.clipboardSelected=function(o,n){n=n||false;var s="";var i=0;var r=0;if(typeof o=="object"&&(o.tagName=="TEXTAREA"||o.tagName=="INPUT")){i=o.selectionStart;r=o.selectionEnd;s=o.value.substring(i,r);if(n){if(s&&s.indexOf(" ")>-1){s=""}else{var a=o.value.substr(0,i).search(/([-'`~!@#$%^&*()_|+=?;:'",.<>\{\}\[\]\\\/\x20])(?!.*[-'`~!@#$%^&*()_|+=?;:'",.<>\{\}\[\]\\\/\x20])/)+1;var d=o.value.substr(a).search(/[-'`~!@#$%^&*()_|+=?;:'",.<>\{\}\[\]\\\/\x20]/);d=d>0?d:o.value.length;s=o.value.substr(a,d);i=a;r=a+d}}}else{if(!n&&t.getSelection().toString().length>0){var u=t.getSelection().getRangeAt(0).cloneContents();var p=document.createElement("div");p.appendChild(u);s=p.innerHTML}}if(s.length>0){s=e.util.htmlspecialcharsback(s);s=s.split(" ").join(" ");s=s.replace(/<img.*?data-code="([^"]*)".*?>/gi,"$1");s=s.replace(/ /gi," ").replace(/©/,"(c)");s=s.replace(/<div class=\"bx-messenger-hr\"><\/div>/gi,"\n");s=s.replace(/<span class=\"bx-messenger-clear\"><\/span>/gi,"\n");s=s.replace(/<s>([^"]*)<\/s>/gi,"");s=s.replace(/<(\/*)([buis]+)>/gi,"[$1$2]");s=s.replace(/<a.*?href="([^"]*)".*?>.*?<\/a>/gi,"$1");s=s.replace(/------------------------------------------------------(.*?)------------------------------------------------------/gim,"["+e.message("BXD_QUOTE_BLOCK")+"]");s=s.replace("<br />","\n").replace(/<\/?[^>]+>/gi,"")}return{text:s,selectionStart:i,selectionEnd:r}};e.desktop.prototype.clipboardCopy=function(t,o){if(!this.ready())return false;document.execCommand(o==true?"cut":"copy");var n=e.create("textarea",{style:{position:"absolute",opacity:0,top:-1e3,left:-1e3}});document.body.insertBefore(n,document.body.firstChild);n.focus();document.execCommand("paste");var s=n.value;if(typeof t=="function"){var i=t(n.value);if(typeof i!="undefined")s=n.value=i;n.selectionStart=0;document.execCommand("copy")}e.remove(n);return s};e.desktop.prototype.clipboardCut=function(){return this.clipboardCopy(null,true)};e.desktop.prototype.clipboardPaste=function(){if(!this.ready())return false;document.execCommand("paste");return true};e.desktop.prototype.clipboardDelete=function(){if(!this.ready())return false;document.execCommand("delete");return true};e.desktop.prototype.clipboardUndo=function(){if(!this.ready())return false;document.execCommand("undo");return true};e.desktop.prototype.clipboardRedo=function(){if(!this.ready())return false;document.execCommand("redo");return true};e.desktop.prototype.clipboardReplaceText=function(t,e,o,n){if(!this.ready())return false;t.focus();t.selectionStart=e;t.selectionEnd=o;if(o-e<n.length){o=e+n.length}document.execCommand("insertText",false,n);t.selectionStart=o;t.selectionEnd=o;return true};e.desktop.prototype.selectAll=function(t){if(!this.ready())return false;t.selectionStart=0;return true};e.desktop.prototype.getLocalConfig=function(t,e){e=typeof e=="undefined"?null:e;if(!this.ready())return e;var o=BXDesktopSystem.QuerySettings(t,e+"");if(typeof o=="string"&&o.length>0){try{o=JSON.parse(o)}catch(n){o=e}}return o};e.desktop.prototype.setLocalConfig=function(t,e){if(!this.ready())return false;if(typeof e=="object")e=JSON.stringify(e);else if(typeof e=="boolean")e=e?"true":"false";else if(typeof e=="undefined")e="";else if(typeof e!="string")e=e+"";BXDesktopSystem.StoreSettings(t,e);return true};e.desktop.prototype.removeLocalConfig=function(t){if(!this.ready())return false;BXDesktopSystem.StoreSettings(t,null);return true};e.desktop.prototype.openConfirm=function(t,o,n){if(this.popupConfirm!=null)this.popupConfirm.destroy();if(typeof t=="object")t='<div class="bx-desktop-confirm-title">'+t.title+"</div>"+t.message;n=n!==false;if(typeof o=="undefined"||typeof o=="object"&&o.length<=0){o=[new e.PopupWindowButton({text:e.message("BXD_CONFIRM_CLOSE"),className:"popup-window-button-decline",events:{click:function(t){this.popupWindow.close();e.PreventDefault(t)}}})]}this.popupConfirm=new e.PopupWindow("bx-desktop-confirm",null,{zIndex:200,autoHide:o===false,buttons:o,closeByEsc:o===false,overlay:n,events:{onPopupClose:function(){this.destroy()},onPopupDestroy:e.delegate(function(){this.popupConfirm=null},this)},content:e.create("div",{props:{className:o===false?" bx-desktop-confirm-without-buttons":"bx-desktop-confirm"},html:t})});this.popupConfirm.show();e.bind(this.popupConfirm.popupContainer,"click",e.PreventDefault);e.bind(this.popupConfirm.contentContainer,"click",e.PreventDefault);e.bind(this.popupConfirm.overlay.element,"click",e.PreventDefault);return true};e.desktop.prototype.log=function(t,e){if(!this.ready())return false;BXDesktopSystem.Log(t,e);return true};e.desktop.prototype.createWindow=function(t,e){BXDesktopSystem.GetWindow(t,e)};e.desktop.prototype.getWindowTitle=function(t){if(!this.ready())return false;BXDesktopWindow.GetProperty("title");return true};e.desktop.prototype.setWindowTitle=function(t){if(!this.ready())return false;if(typeof t=="undefined")return false;t=e.util.trim(t);if(t.length<=0)return false;BXDesktopWindow.SetProperty("title",t);return true};e.desktop.prototype.setWindowPosition=function(t){if(!this.ready())return false;BXDesktopWindow.SetProperty("position",t);return true};e.desktop.prototype.setWindowSize=function(t){if(!this.ready())return false;BXDesktopWindow.SetProperty("clientSize",t);if(t.Width&&t.Height)this.adjustSize(t.Width,t.Height);return true};e.desktop.prototype.setWindowMinSize=function(t){if(!this.ready())return false;if(!t.Width||!t.Height)return false;this.minWidth=t.Width;this.minHeight=t.Height;BXDesktopWindow.SetProperty("minClientSize",t);return true};e.desktop.prototype.addTrayMenuItem=function(t){if(!this.ready())return false;BXDesktopWindow.AddTrayMenuItem(t);return true};e.desktop.prototype.finalizeTrayMenu=function(){if(!this.ready())return false;BXDesktopWindow.EndTrayMenuItem();return true};e.desktop.prototype.preventShutdown=function(){if(!this.ready())return false;BXDesktopSystem.PreventShutdown();return true};e.desktop.prototype.diskReportStorageNotification=function(t,e){if(!this.ready())return false;BXDesktopSystem.ReportStorageNotification(t,e);return true};e.desktop.prototype.diskOpenFolder=function(){if(!this.ready())return false;BXFileStorage.OpenFolder();return true};e.desktop.prototype.addSeparator=function(t){t.type="separator";t.id="sep"+ +new Date;this.tabItems[t.id]=t;this.drawTabs()};e.desktop.prototype.addTab=function(t){if(!t||!t.id||!t.title)return false;if(!t.order)t.order=500;t.hide=t.hide?true:false;if(parseInt(t.badge)>0){t.badge=parseInt(t.badge)}else{t.badge=0}if(!t.initContent||!e.type.isDomNode(t.initContent))t.initContent=null;if(!t.events)t.events={};if(typeof t.target=="undefined")t.target=t.id;if(!t.events.open)t.events.open=function(){};if(!t.events.close)t.events.close=function(){};if(!t.events.init)t.events.init=function(){};t.type="item";this.tabItems[t.id]=t;this.drawTabs()};e.desktop.prototype.drawTabs=function(t){if(!t){clearTimeout(this.tabRedrawTimeout);this.tabRedrawTimeout=setTimeout(e.delegate(function(){this.drawTabs(true)},this),100);return true}if(!this.contentTabContent){if(!this.drawAppearance())return false}this.contentTab.innerHTML="";var o=e.util.objectSort(this.tabItems,"order","asc");for(var n=0;n<o.length;n++){this.drawTab(o[n])}e.onCustomEvent(this,"OnDesktopTabsInit");if(this.currentTab==""){if(o[0].id=="exit"){if(typeof o[1]!="undefined"){this.changeTab(o[1].id)}}else{this.changeTab(o[0].id)}}this.updateTabBadge();return true};e.desktop.prototype.drawTab=function(t){if(t.type=="separator"){this.contentTab.appendChild(e.create("div",{attrs:{"data-id":t.id,id:"bx-desktop-sep-"+t.id},props:{className:"bx-desktop-separator"}}))}else{this.contentTab.appendChild(e.create("div",{attrs:{"data-id":t.id,id:"bx-desktop-tab-"+t.id,title:t.title},props:{className:"bx-desktop-tab bx-desktop-tab-"+t.id+(this.currentTab==t.id?" bx-desktop-tab-active":"")+(t.hide?" bx-desktop-tab-hide":"")},children:[e.create("span",{props:{className:"bx-desktop-tab-counter"},html:t.badge>0?'<span class="bx-desktop-tab-counter-digit">'+(t.badge>50?"50+":t.badge)+"</span>":""}),e.create("div",{props:{className:"bx-desktop-tab-icon bx-desktop-tab-icon-"+t.id}})]}));if(!e("bx-desktop-tab-content-"+t.id)&&t.id==t.target){this.contentTabContent.appendChild(e.create("div",{attrs:{"data-id":t.id,id:"bx-desktop-tab-content-"+t.id},props:{className:"bx-desktop-tab-content bx-desktop-tab-content-"+t.id+(this.currentTab==t.id?" bx-desktop-tab-content-active":"")},children:t.initContent?[t.initContent]:[]}));t.events.init()}}return true};e.desktop.prototype.drawAppearance=function(){if(!this.content)return false;this.content.innerHTML="";this.content.appendChild(this.contentBox=e.create("div",{props:{className:"bx-desktop-appearance"},style:{minHeight:this.minHeight+"px"},children:[this.contentMenu=e.create("div",{props:{className:"bx-desktop-appearance-menu"},children:[this.contentAvatar=e.create("div",{props:{className:"bx-desktop-appearance-avatar"}}),this.contentTab=e.create("div",{props:{className:"bx-desktop-appearance-tab"}})]}),this.contentTabContent=e.create("div",{props:{className:"bx-desktop-appearance-content"}})]}));e.bindDelegate(this.contentTab,"click",{className:"bx-desktop-tab"},e.delegate(function(t){this.changeTab(t,false);e.PreventDefault(t)},this));this.adjustSize();return true};e.desktop.prototype.changeTab=function(t,o){o=typeof o=="undefined"?true:o;if(typeof t=="object"){if(!e.proxy_context){return false}t=e.proxy_context.getAttribute("data-id")}if(!o&&this.currentTab==t){t=this.lastTab}if(!this.tabItems[t])return false;if(this.tabItems[t].target){var n=false;if(!o||this.currentTab!=t){this.lastTab=this.currentTab;this.lastTabTarget=this.currentTabTarget;this.currentTab=this.tabItems[t].id;this.currentTabTarget=this.tabItems[t].target;n=true}if(e("bx-desktop-tab-"+this.lastTab))e.removeClass(e("bx-desktop-tab-"+this.lastTab),"bx-desktop-tab-active");if(e("bx-desktop-tab-"+t))e.addClass(e("bx-desktop-tab-"+t),"bx-desktop-tab-active");if(e("bx-desktop-tab-content-"+this.lastTab)){e.removeClass(e("bx-desktop-tab-content-"+this.lastTab),"bx-desktop-tab-content-active")}else if(e("bx-desktop-tab-content-"+this.lastTabTarget)){e.removeClass(e("bx-desktop-tab-content-"+this.lastTabTarget),"bx-desktop-tab-content-active")}if(e("bx-desktop-tab-content-"+this.currentTab)){e.addClass(e("bx-desktop-tab-content-"+this.currentTab),"bx-desktop-tab-content-active")}else if(e("bx-desktop-tab-content-"+this.currentTabTarget)){e.addClass(e("bx-desktop-tab-content-"+this.currentTabTarget),"bx-desktop-tab-content-active")}if(n){if(this.tabItems[this.lastTab]){this.tabItems[this.lastTab].events.close()}if(this.tabItems[this.currentTab]){e.onCustomEvent(this,"OnDesktopTabChange",[this.currentTab,this.lastTab]);this.tabItems[this.currentTab].events.open()}}}else{this.tabItems[t].events.open()}return true};e.desktop.prototype.closeTab=function(t){t=t||this.getCurrentTab();if(!this.tabItems[t]||this.getCurrentTab()!=t)return false;if(this.tabItems[t].target!=this.currentTabTarget){this.changeTab(t,false)}else{if(e("bx-desktop-tab-"+this.currentTab))e.removeClass(e("bx-desktop-tab-"+this.currentTab),"bx-desktop-tab-active");if(e("bx-desktop-tab-"+this.lastTab))e.addClass(e("bx-desktop-tab-"+this.lastTab),"bx-desktop-tab-active");var o=this.lastTab;this.lastTab=this.currentTab;this.currentTab=o}};e.desktop.prototype.setTabBadge=function(t,o){if(!this.tabItems[t])return false;o=parseInt(o);this.tabItems[t].badge=o>0?o:0;if(o>50)o="50+";if(e("bx-desktop-tab-"+t)){var n=e.findChild(e("bx-desktop-tab-"+t),{className:"bx-desktop-tab-counter"},true);if(n)n.innerHTML=o?'<span class="bx-desktop-tab-counter-digit">'+o+"</span>":""}this.updateTabBadge()};e.desktop.prototype.updateTabBadge=function(){if(!this.ready())return false;var t=0;for(var e in this.tabItems){if(this.tabItems[e].badge)t+=this.tabItems[e].badge}if(t<=0)t="";else if(t>50)t="50+";BXDesktopSystem.SetTabBadge(this.getContextWindow(),t+"")};e.desktop.prototype.setTabContent=function(t,o){if(!this.tabItems[t])return false;if(e("bx-desktop-tab-content-"+t)){if(e.type.isDomNode(o)){e("bx-desktop-tab-content-"+t).innerHTML="";e("bx-desktop-tab-content-"+t).appendChild(o)}else{e("bx-desktop-tab-content-"+t).innerHTML=o}}else{this.tabItems[t].initContent=o}return true};e.desktop.prototype.getCurrentTab=function(){return this.currentTab};e.desktop.prototype.getCurrentTabTarget=function(){return this.currentTabTarget};e.desktop.prototype.isActiveWindow=function(){if(!this.ready())return false;return BXDesktopSystem.IsActiveTab()};e.desktop.prototype.getActiveWindow=function(){if(!this.ready())return 1;return BXDesktopSystem.ActiveTab()};e.desktop.prototype.getNetworkAuthorizeStatus=function(){if(!this.enableInVersion(35))return true;return true};e.desktop.prototype.getContextWindow=function(){if(!this.ready())return 1;if(this.isActiveWindow()){return this.getActiveWindow()}else{if(this.getActiveWindow()==TAB_CP){return TAB_B24NET}else{return TAB_CP}}};e.desktop.prototype.setActiveWindow=function(t){if(!this.ready())return false;if(typeof t!="undefined"){if(t==TAB_B24NET||t==TAB_CP){BXDesktopSystem.SetActiveTabI(t)}}else{BXDesktopSystem.SetActiveTab()}};e.desktop.prototype.setUserInfo=function(t){if(!this.userInfo){if(!t||!t.id||!t.name)return false}if(t){if(!t.gender)t.gender="M";if(!t.avatar||!t.profile)t.avatar="";this.userInfo=t}if(!this.contentAvatar){if(!this.drawAppearance())return false}var o={};if(this.userInfo.onclick){o.click=function(t){e.desktop.userInfo.onclick();return e.PreventDefault(t)}}this.contentAvatar.innerHTML="";this.contentAvatar.appendChild(e.create("a",{attrs:{href:this.userInfo.profile,title:e.util.htmlspecialcharsback(this.userInfo.name),target:"_blank"},props:{className:"bx-desktop-avatar"},events:o,children:[e.create("img",{attrs:{src:this.userInfo.avatar,style:e.MessengerCommon.isBlankAvatar(this.userInfo.avatar)?"background-color: "+this.userInfo.color:""},props:{className:"bx-desktop-avatar-img bx-desktop-avatar-img-default"}})]}));return true};e.desktop.prototype.updateUserInfo=function(t){for(var e in t){this.userInfo[e]=t[e]}return this.setUserInfo(this.userInfo)};e.desktop.prototype.getUserInfo=function(){return this.userInfo};e.desktop=new e.desktop})(window);
//# sourceMappingURL=desktop.map.js