MeshCentral/views/messenger-min.handlebars

1 line
48 KiB
Handlebars

<!DOCTYPE html> <html style="height:100%"> <head> <title>MeshMessenger</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="format-detection" content="telephone=no"> <style>body{margin:0;padding:0;border:0;color:black;font-size:13px;font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;background-color:#d3d9d6;overflow-y:hidden;}#container{background-color:#fff;width:960px;min-width:960px;max-height:100vh;margin:0 auto;border-top:0;border-right:1px solid #b7b7b7;border-bottom:0;border-left:1px solid #b7b7b7;padding:0;}.fullscreen #container{width:100%;min-width:700px;min-height:0px;border-right:0px none #b7b7b7;border-left:0px none #b7b7b7;}.fulldesk #container{width:100%;min-width:700px;min-height:0px;border-right:0px none #b7b7b7;border-left:0px none #b7b7b7;position:unset;}#masthead{width:auto;margin:0;padding:0;overflow:hidden;text-align:right;background-color:#036;background-image:url(../logo.png);background-position-x:0px;background-position-y:0px;background-attachment:initial;background-repeat:no-repeat;width:960px;height:66px;}.fullscreen #masthead{width:100%;}.fulldesk #masthead{display:none;}.fulldesk #mastheadx{display:none;}.fulldesk #p11deviceNameHeader{display:none;}#masthead .title{float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px;font-size:46px;font-family:Arial,Helvetica,sans-serif;font-weight:bold;}#masthead .title2{float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px;font-size:14px;font-family:Arial,Helvetica,sans-serif;font-weight:bold;}#page_content{ }.fullscreen #page_content{position:absolute;top:66px;left:90px;right:0px;bottom:0px;}.arg_hide #page_content{left:0px;}.fulldesk #page_content{position:static;top:0;left:0;right:0;bottom:0;}#page_leftbar{height:calc(100vh - 66px);width:90px;position:absolute;z-index:1000;background:#113962;background:linear-gradient(to bottom, #104893 0%,#113962 100%);color:white;}.fullscreen #page_leftbar{display:block;}.arg_hide #page_leftbar{display:none;}.fulldesk #page_leftbar{display:none;}#topbar{ position:relative;}.fulldesk #topbar{display:none;}.topbar_td{width:100px;height:24px;cursor:pointer;}.topbar_td_end{text-align:right;height:24px;}#toggle{cursor:pointer;color:white;position:absolute;top:3px;right:6px }#MainMenuSpan, #MainSubMenu, #MeshSubMenu, #UserSubMenu, #ServerSubMenu, #UserDummyMenu{width:100%;height:22px }#MainMenuSpan{display:table;}.fullscreen #MainMenuSpan{display:none;}.fulldesk #MainMenuSpan{display:none;}#column_l{position:relative;float:left;width:930px;margin:0;padding:0 15px;background-color:#fff; min-width:unset;}.room4submenu{max-height:calc(100vh - 159px) !important;}.fullscreen #column_l{height:calc(100vh - 135px);width:calc(100% - 30px);overflow-y:auto;}.fulldesk #column_l{width:100%;height:unset;margin-left:unset;overflow-y:unset;padding:0;max-height:unset;}.fulldesk #column_l_bottomgap{display:none;}#centralTable{width:100%;}#welcomeimage{text-align:right;}@media (max-width:800px){.fullscreen #welcomeimage{display:none;}}#welcomeimage img{height:310px;width:359px;}#logincell{text-align:center;}#loginpanel, #createpanel, #resetpanel, #tokenpanel, #resettokenpanel, #resetpasswordpanel, #resetpasswordpanel{display:inline-block;margin:0;background-color:#979797;border-radius:16px;width:300px;padding:16px;text-align:center;}#passwordPolicyCallout, #rpasswordPolicyCallout{left:-10px;width:100px;position:absolute;background-color:#FFC;border-radius:5px;padding:5px;box-shadow:0px 0px 15px #666;font-size:10px;}#passWarning{padding-top:6px;}#footer{clear:both;overflow:auto;width:100%;text-align:center;background-color:#113962;padding-top:5px;padding-bottom:5px;}.fulldesk #footer{display:none;} #footer table{width:100%;border-spacing:10px;border-collapse:separate;}#footer td:first-child{text-align:left;color:white;}#footer td{padding:0px;text-align:right;color:white;} .footer1{text-align:left;float:left;padding:10px;color:white;}.footer2{padding:10px;text-align:right;color:white;}#masthead img{float:left;}#masthead p{font-size:11px;color:#fff;margin:10px 10px 0;}#footer a{color:#fff;text-decoration:underline;}#footer a:hover{color:#fff;text-decoration:none;}#dialog{z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:180px;left:calc((100% / 2) - 200px);width:400px;}#dialogHeader{width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0;}#dialogBody{margin-right:16px;margin-left:8px;}.dialogText{width:100%;max-height:260px;overflow-x:hidden;overflow-y:auto;line-height:160% }.dialogTextLog{font-size:10px }#dialog1{margin:auto;text-align:center;margin:3px;}#id_dialogMessage{padding:10px;}#dialog2, #dialog3{margin:auto;margin:3px;}#idx_dlgButtonBar{padding:10px;margin-bottom:20px;}#idx_dlgCancelButton{float:right;width:80px;margin-left:5px;}#idx_dlgOkButton{float:right;width:80px;}#idx_dlgDeleteButton{width:80px;}#ua_fileaccessquota{width:80px;text-align:right }#broadcastMessage{width:370px;height:100px;resize:none;}#idx_deskFullBtn2{float:left;font-size:large;cursor:pointer;display:none;}.fulldesk #idx_deskFullBtn2{display:block;}.fulldesk #deskFullBtn{display:none;}#p0message{margin:50px;text-align:center;}#devListToolbarViewIcons{float:right;}#devListToolbarSpan{width:100%;height:24px;background-color:#d3d9d6;vertical-align:middle;border-spacing:0 }#SearchInput{width:120px;}#devListToolbarView, #devListToolbarSort, #devListToolbarSize{float:right;}#refreshmap{margin-left:5px;} #NoMeshesPanel a{cursor:pointer;}#NoMeshesPanel table{width:100%;padding:20px }NoMeshesPanel img{height:48px;width:47px;}#xdevices{max-height:calc(100vh - 239px);overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;}#xdevicesmap{height:calc(100vh - 239px);width:100%;overflow:hidden;position:relative;}#xmapSearchResultsDlg{position:absolute;max-height:280px;left:5px;top:5px;max-width:250px;z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;}#xmapSearchResultsBck{width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0;}#xmapSearchClose{float:right;padding:5px;cursor:pointer;}.xmapItem{overflow-y:auto;width:100%;max-height:240px }.xmapItemSel1{cursor:pointer;padding:5px;background-color:#F5F5F5;}.xmapItemSel1{cursor:pointer;padding:5px;background-color:#EBEBEB;}#xmap-info-window{text-shadow:0px 0px 15px #FFF }#p2 a, #p6 a, #p10 a{cursor:pointer;}#p2AccountImage{width:150px;height:103px;margin-bottom:10px;margin-right:20px;float:right;}.p2AccountActions{width:15px;display:inline-block;}.p2AccountActions span{color:green;font-size:10px;}.newMeshBtn{background:url(../images/icon-addnew.png) no-repeat 0px 0px;height:12px;width:12px;cursor:pointer;border:none;padding-left:15px;}#p2noMeshFound, #p2ServerActionsBackup, #p2ServerActionsRestore, #p2ServerActionsVersion, #p2ServerActionsErrors, #serverStats{margin-left:40px;}.pTable{width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px;vertical-align:middle;border-spacing:0;}#p3users{max-height:calc(100vh - 243px);overflow-y:auto;}.p3usersTable{width:100%;border-spacing:0;padding:0;}.p3usersTable th{color:gray;}#p3events{height:calc(100vh - 243px);overflow-y:scroll }.p3eventsTable{width:100%;border-spacing:0;padding:0;}.p3eventsTable{width:100%;border-spacing:0;padding:0;}#p4name, #p4email, #p4pass1, #p4pass2{width:230px;}#p5filehead{width:100%;background-color:#d3d9d6;text-align:left;padding:4px;}#p5filesubhead{background-color:#E4E9E7;height:28px;}#p5rightOfButtons{float:right;margin-top:3px;}#p5filetable{width:100%;height:calc(100vh - 294px);overflow:auto;-webkit-user-select:none;position:relative;}#p5PublicShare{display:none;width:100%;overflow:auto;-webkit-user-select:none;background-color:lightsteelblue;}#bigok{width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;}#bigfail{width:256px;overflow:hidden;position:absolute;left:337px;top:20px;text-align:center;font-size:1600%;color:#AAAAAA;}.chartViewCanvas{width:80px;display:inline-block;}.chartViewText{width:160px;display:inline-block;}#serverCpuChart, #serverMemoryChart{width:60px;height:60px;}#p10BackButton, #p11BackButton{float:left }#p10html2 table{color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse;width:100%;}#p10html2 thead{background-color:#AAAAAA;font-weight:bold;}#p10html2 thead tr{background-color:#AAAAAA;font-weight:bold;}#p10html2 thead img{float:right;cursor:pointer;padding:3px;}#p10html2 .altBack{background-color:#DDD;}.pwState{display:table-cell;height:16px;}.pwsYellow{background-color:yellow;}.pwsTransparent{background-color:#00000000;}.pwsBlack{background-color:black;}.pwsBlue{background-color:blue;}.pwsBlue2{background-color:blue;}.pwsLightblue{background-color:lightblue;}.pwsBlueviolet{background-color:blueviolet;}.pwsDarkgreen{background-color:darkgreen;}.pwsLightseagreen{background-color:lightseagreen;}.pwsLightseagreen2{background-color:lightseagreen;}.p10html3right{float:right;font-size:x-small;}.p10html3left{font-size:x-small;}#MainComputerImage{border-width:0px;height:200px;width:200px;}#MainComputerState{font-size:12px;font-weight:bold;width:100%;text-align:center;}#d2groupop{float:right;width:250px;}#p12warning, #p12warning2, #p14warning, #p14warning2{max-width:100%;display:none;cursor:pointer;margin-bottom:5px;}#MainMeshImage{border-width:0px;height:200px;width:200px;float:right;}#DeskTools{position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none;}#DeskToolsRefreshButton{float:right;padding:3px;cursor:pointer;}a{color:#036;text-decoration:underline;}.i1{background:url(../images/icons50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i2{background:url(../images/icons50.png) -50px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i3{background:url(../images/icons50.png) -100px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i4{background:url(../images/icons50.png) -150px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i5{background:url(../images/icons50.png) -200px 0px;height:50px;width:50px;cursor:pointer;border:none;}.i6{background:url(../images/icons50.png) -250px 0px;height:50px;width:50px;cursor:pointer;border:none;}.j1{background:url(../images/icons16.png) 0px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j2{background:url(../images/icons16.png) -16px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j3{background:url(../images/icons16.png) -32px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j4{background:url(../images/icons16.png) -48px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j5{background:url(../images/icons16.png) -64px 0px;height:16px;width:16px;cursor:pointer;border:none;}.j6{background:url(../images/icons16.png) -80px 0px;height:16px;width:16px;cursor:pointer;border:none;}.lbbutton{width:74px;height:74px;border-radius:5px;background-color:white;margin-left:8px;margin-top:8px;position:relative;cursor:pointer;opacity:0.5;}.lbbutton:hover{opacity:1;}.lbbuttonsel{opacity:0.9;}.lbbuttonsel2{width:82px;border-radius:5px 0px 0px 5px;opacity:1;}.lb1{background:url(../images/leftbar-62.jpg) -0px 0px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px }.lb2{background:url(../images/leftbar-62.jpg) -75px 0px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px }.lb3{background:url(../images/leftbar-62.jpg) -150px 0px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px }.lb4{background:url(../images/leftbar-62.jpg) -225px 0px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px }.lb5{background:url(../images/leftbar-62.jpg) -294px 0px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px }.lb6{background:url(../images/leftbar-62.jpg) -360px 0px;height:62px;width:62px;cursor:pointer;border:none;position:absolute;top:6px;left:6px }.m0{background :url(../images/images16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.m1{background :url(../images/images16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.m2{background :url(../images/images16.png) -96px 0px;height :16px;width :16px;border:none;float:left }.m3{background :url(../images/images16.png) -112px 0px;height :16px;width :16px;border:none;float:left }.si0{background :url(../images/icons16.png) 0px 0px;height :16px;width :16px;border:none;float:left }.si1{background :url(../images/icons16.png) -16px 0px;height :16px;width :16px;border:none;float:left }.si2{background :url(../images/icons16.png) -32px 0px;height :16px;width :16px;border:none;float:left }.si3{background :url(../images/icons16.png) -48px 0px;height :16px;width :16px;border:none;float:left }.si4{background :url(../images/icons16.png) -64px 0px;height :16px;width :16px;border:none;float:left }.mi{background :url(../images/meshicon50.png) 0px 0px;height:50px;width:50px;cursor:pointer;border:none }#floatframe{position:fixed;top:200px;height:300px;z-index:200;display:none;}.style1{text-align:center;}.style2{text-align:center;background-color:#808080;font-weight:bold;}.style3{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style3x{text-align:center;color:white;background-color:#808080;font-weight:bold;}.style3x:hover{background-color:#606060;}.style3x.fullselect{background-color:#003366;}.style3x.semiselect{background-color:#606060;}.style3sel{text-align:center;color:white;background-color:#003366;font-weight:bold;}.style4{color:white;text-decoration:none;}.style5{text-align:center;background-color:#808080;font-weight:normal;}.style6{text-align:left;background-color:#D3D9D6;padding:3px;}.style7{font-size:large;background-color:#FFFFFF;width:180px;}.style9{max-width:400px;overflow:hidden;}.style10{background-color:#C9C9C9;}.style11{font-size:large;background-color:#C9C9C9;}.style14{height:100%;text-align:left;background-color:#D3D9D6;}.auto-style1{text-align:right;background-color:#D3D9D6;}.icon2{float:left;margin:7px;}.warningbox{width:auto;border-radius:8px;padding:8px;background-color:lightsalmon;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon4{background:url(../images/meshicon16.png);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.fsize{float:right;text-align:right;width:180px;}.g1{background-position:0% 0%;width:14px;height:100%;float:left; background-image:linear-gradient(to right, #ffffff 0%, #c9c9c9 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}#p3events .g1{float:none;}#p3users .g1{height:24px;float:left;}.g1s{background-image:linear-gradient(to right, #ffffff 0%, #b9b9b9 100%);}.g2{background-position:0% 0%;width:14px;height:100%;float:right; background-image:linear-gradient(to right, #c9c9c9 0%, #ffffff 100%);background-color:#c9c9c9;background-repeat:repeat;background-attachment:scroll;}#p3events .g2{float:none;}#p3users .g2{height:24px;float:right;}.g2s{background-image:linear-gradient(to right, #b9b9b9 0%, #ffffff 100%);}.h1pre{width:16px;height:100%;float:left;font-size:large;background-color:#FFFFFF;}.h1{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #ffffff 0%, #d3d9d6 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.h2end{height:100%;width:20px;float:right;background-color:#ffffff }.h2{background-position:0% 0%;width:14px;height:100%; background-image:linear-gradient(to right, #d3d9d6 0%, #ffffff 100%);background-color:#d3d9d6;background-repeat:repeat;background-attachment:scroll;}.e1{font-size:large;margin-top:4px;margin-bottom:3px;overflow:hidden;word-wrap:hyphenate;white-space:nowrap;text-overflow:ellipsis;}.e2{float:left;height:100%;background-color:#c9c9c9;}.e2s{background-color:#b9b9b9;}.bar{font-size:large;background-color:#C9C9C9;height:24px;float:left;margin-bottom:2px;}#p3users .bar{width:100%;font-size:medium;}.baricon{float:left;height:24px;width:24px;background-color:white;}.baricon div{width:16px;margin-top:4px;margin-left:2px;height:16px }.bar2{font-size:large;height:24px;float:left;margin-bottom:2px;}.bar18{font-size:large;background-color:#C9C9C9;height:18px;float:left;margin-bottom:2px;}.bar182{font-size:large;height:18px;float:left;margin-bottom:2px;}.devHeaderx{color:lightgray;}.DevSt{border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:#DDDDDD;}.contextMenu{background:#F9F9F9;box-shadow:0 0 12px rgba( 0, 0, 0, .3 );border:1px solid #ccc; display:none;position:absolute;top:0;left:0;list-style:none;margin:0;padding:5px;min-width:100px;max-width:150px;z-index:500;}.cmtext{color:#444;display:inline-block;padding-left:8px;padding-right:8px;padding-top:5px;padding-bottom:5px;text-decoration:none;width:85%;cursor:default;overflow:hidden;position:relative;}.cmtext:hover{color:#f9f9f9;background:#444;}.gray{ filter:gray; -webkit-filter:grayscale(100%) opacity(60%); }.unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.notifiyBox{position:absolute;z-index:1000;top:50px;right:26px;width:300px;text-align:left;background-color:#F0ECCD;border:4px solid #666;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-box-shadow:2px 2px 4px #888;-moz-box-shadow:2px 2px 4px #888;box-shadow:2px 2px 4px #888;max-height:200px;}.notifiyBox:before{content:' ';position:absolute;width:0;height:0;right:5px;top:-30px;border:15px solid;border-color:transparent #666 #666 transparent;}.notifiyBox:after{content:' ';position:absolute;width:0;height:0;right:7px;top:-24px;border:12px solid;border-color:transparent #F0ECCD #F0ECCD transparent;}.notification{width:100%;min-height:30px;}.notification:hover{background-color:#EFE8B6;}#notificationCount{min-width:28px;font-size:20px;border-radius:5px;background-color:lightblue;text-align:center;margin:8px;cursor:pointer;padding:4px }#deskarea3x{background:black;text-align:center;position:relative;overflow:hidden;}#DeskFocus{overflow:hidden;color:transparent;border:3px dotted rgba(255,0,0,.2);position:absolute;border-radius:5px;}#DeskParent{overflow:hidden }#Desk{overflow:hidden;width:100%;-ms-touch-action:none;margin-left:0px;}#deskToolsBar{position:absolute;padding:3px;border-radius:3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer;}#DeskToolsProcesses{overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100% }.deskToolsBar{padding:3px;}.deskToolsBar:hover{background-color:#EFE8B6;}.userTableHeader{border-bottom:1pt solid lightgray;padding-top:4px;padding-bottom:4px;}.viewSelector{width:32px;height:32px;background-color:#DDD;border-radius:3px;float:left;margin-left:5px;cursor:pointer;opacity:0.3;}.viewSelectorSel{background-color:#BBB;opacity:0.8;}.viewSelector:hover{opacity:0.5;background-color:#AAA;}.viewSelector1{margin-left:2px;margin-top:2px;background:url(../images/views.png) -0px 0px;height:28px;width:28px;}.viewSelector2{margin-left:2px;margin-top:2px;background:url(../images/views.png) -28px 0px;height:28px;width:28px;}.viewSelector3{margin-left:2px;margin-top:2px;background:url(../images/views.png) -56px 0px;height:28px;width:28px;}.viewSelector4{margin-left:2px;margin-top:2px;background:url(../images/views.png) -84px 0px;height:28px;width:28px;}.viewSelector5{margin-left:2px;margin-top:2px;background:url(../images/views.png) -112px 0px;height:28px;width:28px;}.backButtonEx{margin-left:2px;margin-top:2px;background:url(../images/views.png) -140px 0px;height:28px;width:28px;}.backButton{width:32px;height:32px;background-color:#DDD;border-radius:3px;float:left;margin-right:5px;cursor:pointer;opacity:0.3;}.backButton:hover{opacity:0.5;background-color:#AAA;}.hoverButton{opacity:0.5;width:10px;height:10px;}.hoverButton:hover{opacity:1;}.tagSpan{background-color:lightgray;padding:3px;margin-right:4px;border-radius:5px;}</style> <style>.topButton{cursor:pointer;border:none;margin:2px;margin-top:3px;float:right;border-radius:3px;height:32px;width:32px;}.topButton:hover{background-color:lightgray;}.topRedButton{cursor:pointer;border:none;margin:2px;float:right;border-radius:3px;height:32px;width:32px;}.topRedButton:hover{background-color:orangered;}.remoteBubble{background-color:#00cc99;color:black;border-radius:5px;padding:5px;float:left;margin-bottom:5px;margin-right:20px;box-shadow:3px 3px 10px gray;}.localBubble{background-color:#0099ff;color:black;border-radius:5px;padding:5px;float:right;margin-bottom:5px;margin-left:20px;box-shadow:3px 3px 10px gray;}.icon1{background:url(../images/messenger32.png) 0px 0px;background-color:gray;}.icon2{background:url(../images/messenger32.png) -32px 0px;background-color:gray;}.icon3{background:url(../images/messenger32.png) -64px 0px;background-color:gray;}.icon4{background:url(../images/messenger32.png) -96px 0px;background-color:gray;}.icon5{background:url(../images/messenger32.png) -128px 0px;background-color:gray;}.icon6{background:url(../images/messenger32.png) -160px 0px;background-color:gray;}.icon7{background:url(../images/messenger32.png) -192px 0px;background-color:gray;}.icon8{background:url(../images/messenger32.png) -224px 0px;background-color:gray;}.icon9{background:url(images/messenger32.png) -256px 0px;background-color:gray;}.icon10{background:url(../images/messenger32.png) -288px 0px;background-color:gray;}.icon11{background:url(../images/messenger32.png) -320px 0px;background-color:orange;}.fileicon{background:url(../images/messenger32.png) -96px 0px;height:32px;width:32px;}.fileiconx{background:url(../images/messenger32.png) -352px 0px;height:32px;width:32px;}.fileicontransfer{background:url(../images/messenger32.png) -288px 0px;height:32px;width:32px;}.fileicondone{background:url(../images/messenger32.png) -256px 0px;height:32px;width:32px;}</style> </head> <body style="font-family:Arial,Helvetica,sans-serif"> <div id="xtop" style="position:absolute;left:0;right:0;top:0;height:38px;background-color:#036;color:#c8c8c8;box-shadow:3px 3px 10px gray"> <div id="fileButton" class="icon4 topButton" title="Share a file" style="display:none" onclick="fileButtonClick()"></div> <div id="camButton" class="icon2 topButton" title="Activate camera & microphone" style="display:none" onclick="camButtonClick()"></div> <div id="micButton" class="icon6 topButton" title="Activate microphone" style="display:none" onclick="micButtonClick()"></div> <div id="hangupButton" class="icon11 topRedButton" title="Hang up" style="display:none" onclick="hangUpButtonClick(1)"></div> <div style="display:inline-block;width:2px"></div> <div style="padding-top:9px;padding-left:6px;font-size:20px;display:inline-block"><b>MeshMessenger<span id="xtitle"></span></b></div> </div> <div id="xmiddle" style="position:absolute;left:0;right:0;top:38px;bottom:30px"> <div style="position:absolute;left:0;right:0;top:0;bottom:0;overflow-y:scroll"> <div id="xmsg" style="position:absolute;left:0;right:0;bottom:0;padding:5px"></div> </div> </div> <div id="xbottom" style="position:absolute;left:0;right:0;bottom:0px;height:30px;background-color:#036"> <div style="position:absolute;left:5px;right:215px;bottom:4px;top:4px;background-color:aliceblue"><input id="xouttext" type="text" style="width:calc(100% - 5px)" onfocus="onUserInputFocus(1)" onblur="onUserInputFocus(0)"></div> <input type="button" id="sendButton" value="Send" style="position:absolute;right:110px;width:100px;top:4px;" onclick="xsend(event)"> <input type="button" id="clearButton" value="Clear" style="position:absolute;right:5px;width:100px;top:4px;" onclick="displayClear()"> </div> <div id="remoteVideo" style="position:absolute;right:24px;top:45px;width:320px;height:calc(240px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"> <div style="position:absolute;right:0;left:0;top:2.5px;text-align:center">Remote</div> <video id="remoteVideoCanvas" autoplay="" style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:black"></video> </div> <div id="localVideo" style="position:absolute;right:24px;top:320px;width:160px;height:calc(120px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"> <div style="position:absolute;right:0;left:0;top:2.5px;text-align:center">Local</div> <video id="localVideoCanvas" autoplay="" muted="" style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:black"></video> </div> <input id="uploadFileInput" type="file" multiple="" style="display:none"> <script>if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.lastIndexOf(a,0)===0}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(a){}}function QE(a,b){try{Q(a).disabled=!b}catch(a){}}function QV(a,b){try{QS(a).display=(b?"":"none")}catch(a){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}function QC(a){try{return Q(a).classList}catch(a){}}function inputBoxFocus(b){Q(b).focus();var a=Q(b).value;Q(b).value="";Q(b).value=a}function ReadShort(b,a){return(b.charCodeAt(a)<<8)+b.charCodeAt(a+1)}function ReadShortX(b,a){return(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ReadInt(b,a){return(b.charCodeAt(a)*16777216)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadSInt(b,a){return(b.charCodeAt(a)<<24)+(b.charCodeAt(a+1)<<16)+(b.charCodeAt(a+2)<<8)+b.charCodeAt(a+3)}function ReadIntX(b,a){return(b.charCodeAt(a+3)*16777216)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+1)<<8)+b.charCodeAt(a)}function ShortToStr(a){return String.fromCharCode((a>>8)&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,(a>>8)&255)}function IntToStr(a){return String.fromCharCode((a>>24)&255,(a>>16)&255,(a>>8)&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,(a>>8)&255,(a>>16)&255,(a>>24)&255)}function MakeToArray(a){if(!a||a==null||typeof a=="object"){return a}return[a]}function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function EscapeHtmlBreaks(a){if(typeof a=="string"){return a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;")}if(typeof a=="boolean"){return a}if(typeof a=="number"){return a}}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}function ObjectToStringEx(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="<br />"+gap(a)+"Item #"+b+": "+ObjectToStringEx(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="<br />"+gap(a)+b+" = "+ObjectToStringEx(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function ObjectToStringEx2(e,a){var d="";if(e!=0&&(!e||e==null)){return"(Null)"}if(e instanceof Array){for(var b in e){d+="\r\n"+gap2(a)+"Item #"+b+": "+ObjectToStringEx2(e[b],a+1)}}else{if(e instanceof Object){for(var b in e){d+="\r\n"+gap2(a)+b+" = "+ObjectToStringEx2(e[b],a+1)}}else{d+=EscapeHtml(e)}}return d}function gap(a){var d="";for(var b=0;b<(a*4);b++){d+="&nbsp;"}return d}function gap2(a){var d="";for(var b=0;b<(a*4);b++){d+=" "}return d}function ObjectToString(a){return ObjectToStringEx(a,0)}function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if(typeof a!="string"||a.length==0){return""}var c="",b=(""+a).match(/../g),e;while(e=b.shift()){c+=String.fromCharCode("0x"+e)}return c}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++){c+=char2hex(b.charCodeAt(a))}return c}function encode_utf8(a){return unescape(encodeURIComponent(a))}function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(c){var b=new Array(c.length);for(var d=0;d<c.length;d++){b[d]=c.charCodeAt(d)}var a=new Blob([new Uint8Array(b)]);return a}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}(function(b,a){if(typeof define==="function"&&define.amd){define([],a)}else{if(typeof exports!=="undefined"){a()}else{var c={exports:{}};a();b.FileSaver=c.exports}}})(this,function(){var a=typeof window==="object"&&window.window===window?window:typeof self==="object"&&self.self===self?self:typeof global==="object"&&global.global===global?global:void 0;function b(g,h){if(typeof h==="undefined"){h={autoBom:false}}else{if(typeof h!=="object"){console.warn("Depricated: Expected third argument to be a object");h={autoBom:!h}}}if(h.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(g.type)){return new Blob([String.fromCharCode(65279),g],{type:g.type})}return g}function e(i,g,h){var j=new XMLHttpRequest();j.open("GET",i);j.responseType="blob";j.onload=function(){f(j.response,g,h)};j.onerror=function(){console.error("could not download file")};j.send()}function d(g){var h=new XMLHttpRequest();h.open("HEAD",g,false);h.send();return h.status>=200&&h.status<=299}function c(i){try{i.dispatchEvent(new MouseEvent("click"))}catch(g){var h=document.createEvent("MouseEvents");h.initMouseEvent("click",true,true,window,0,0,0,80,20,false,false,false,false,0,null);i.dispatchEvent(h)}}var f=a.saveAs||typeof window!=="object"||window!==a?function f(){}:"download" in HTMLAnchorElement.prototype?function f(h,i,j){var k=a.URL||a.webkitURL;var g=document.createElement("a");i=i||h.name||"download";g.download=i;g.rel="noopener";if(typeof h==="string"){g.href=h;if(g.origin!==location.origin){d(g.href)?e(h,i,j):c(g,g.target="_blank")}else{c(g)}}else{g.href=k.createObjectURL(h);setTimeout(function(){k.revokeObjectURL(g.href)},40000);setTimeout(function(){c(g)},0)}}:"msSaveOrOpenBlob" in navigator?function f(h,i,j){i=i||h.name||"download";if(typeof h==="string"){if(d(h)){e(h,i,j)}else{var g=document.createElement("a");g.href=h;g.target="_blank";setTimeout(function(){c(g)})}}else{navigator.msSaveOrOpenBlob(b(h,j),i)}}:function f(g,k,l,m){m=m||open("","_blank");if(m){m.document.title=m.document.body.innerText="downloading..."}if(typeof g==="string"){return e(g,k,l)}var h=g.type==="application/octet-stream";var j=/constructor/i.test(a.HTMLElement)||a.safari;var i=/CriOS\/[\d]+/.test(navigator.userAgent);if((i||h&&j)&&typeof FileReader==="object"){var n=new FileReader();n.onloadend=function(){var q=n.result;q=i?q:q.replace(/^data:[^;]*;/,"data:attachment/file;");if(m){m.location.href=q}else{location=q}m=null};n.readAsDataURL(g)}else{var p=a.URL||a.webkitURL;var o=p.createObjectURL(g);if(m){m.location=o}else{location.href=o}m=null;setTimeout(function(){p.revokeObjectURL(o)},40000)}};a.saveAs=f.saveAs=f;if(typeof module!=="undefined"){module.exports=f}});var userInputFocus=0;var args=parseUriArgs();var socket=null;var state=0;var random=Math.random();var webrtcSessions={};var webchannel=null;var localStream=null;var remoteStream=null;var multiWebRtc=true;var userMediaSupport=0;getUserMediaSupport(function(a){userMediaSupport=a});var webrtcconfiguration="{{{webrtconfig}}}";if(webrtcconfiguration==""){webrtcconfiguration=null}else{try{webrtcconfiguration=JSON.parse(decodeURIComponent(webrtcconfiguration))}catch(ex){console.log('Invalid WebRTC config: "'+webrtcconfiguration+'".');webrtcconfiguration=null}}var fileUploads=[];var fileDownloads={};var currentFileUpload=null;var currentFileDownload=null;if(args.title){QH("xtitle"," - "+args.title);document.title=document.title+" - "+args.title}document.addEventListener("dragover",haltEvent,false);document.addEventListener("dragleave",haltEvent,false);document.addEventListener("drop",fileDrop,false);document.onkeyup=function ondockeypress(a){if(state==2){if((a.keyCode==8)&&(userInputFocus==0)){var b=Q("xouttext").value;if(b.length>0){Q("xouttext").value=b.substring(0,b.length-1)}}}if(userInputFocus==0){haltEvent(a);return false}};document.onkeypress=function ondockeypress(a){if(state==2){if(a.keyCode==13){xsend(a)}else{if((userInputFocus==0)&&(a.key.length==1)){Q("xouttext").value=Q("xouttext").value+a.key}}}if(userInputFocus==0){haltEvent(a);return false}};function onUserInputFocus(a){userInputFocus=a}function displayClear(){QH("xmsg","");cancelAllFileTransfers();fileUploads=[],fileDownloads={}}if(!FileReader.prototype.readAsBinaryString){FileReader.prototype.readAsBinaryString=function(b){var a="",d=this,c=new FileReader();c.onload=function(g){var f=new Uint8Array(c.result);for(var h=0;h<f.byteLength;h++){a+=String.fromCharCode(f[h])}d.onload({target:{result:a}})};c.readAsArrayBuffer(b)}}function getUserMediaSupport(b){try{navigator.mediaDevices.enumerateDevices().then(function(d){try{var f=0,c=0;d.forEach(function(g){if(g.kind==="audioinput"){f=1}if(g.kind==="videoinput"){c=1}});if(f==0){b(0)}b(f+c)}catch(e){}})}catch(a){}}function displayControl(a){QA("xmsg",'<div style="clear:both"><div style="color:gray;float:left;margin-bottom:2px">'+a+"</div><div></div></div>");Q("xmsg").scrollTop=Q("xmsg").scrollHeight}function displayLocalVideo(a){QV("localVideo",a);adjustVideoWindows()}function displayRemoteVideo(a){QV("remoteVideo",a);adjustVideoWindows()}function adjustVideoWindows(){var a=(QS("remoteVideo")["display"]!="none");QS("localVideo")["top"]=a?"320px":"45px"}function displayRemote(a){QA("xmsg",'<div style="clear:both"><div class="remoteBubble">'+a+"</div><div></div></div>");Q("xmsg").scrollTop=Q("xmsg").scrollHeight}function xsend(a){var b=Q("xouttext").value;if(b.length>0){Q("xouttext").value="";QA("xmsg",'<div style="clear:both"><div class="localBubble">'+b+"</div><div></div></div>");Q("xmsg").scrollTop=Q("xmsg").scrollHeight;send({action:"chat",msg:b})}}function haltEvent(a){if(a.preventDefault){a.preventDefault()}if(a.stopPropagation){a.stopPropagation()}return false}function parseUriArgs(){var a,c={},b=window.document.location.href.split(/[\?&|\=]/);b.splice(0,1);for(d in b){switch(d%2){case 0:a=decodeURIComponent(b[d]);break;case 1:c[a]=decodeURIComponent(b[d]);var d=parseInt(c[a]);if(d==c[a]){c[a]=d}break;default:break}}return c}function updateControls(){QE("sendButton",state==2);QE("clearButton",state==2);QE("xouttext",state==2);QV("fileButton",state==2);QV("camButton",webchannel&&webchannel.ok&&!localStream&&(userMediaSupport==2));QV("micButton",webchannel&&webchannel.ok&&!localStream&&(userMediaSupport>0));QV("hangupButton",webchannel&&webchannel.ok&&localStream)}function startWebRTC(a,b){if((webrtcSessions[0]!=null)&&(multiWebRtc==false)){return webrtcSessions[0]}var c=null;if(typeof RTCPeerConnection!=="undefined"){c=new RTCPeerConnection(webrtcconfiguration)}else{if(typeof webkitRTCPeerConnection!=="undefined"){c=new webkitRTCPeerConnection(webrtcconfiguration)}}if(c==null){return null}c.id=a;c.onicecandidate=function(d){try{if(d.candidate!=null){sendws({action:"webRtcIce",ice:d.candidate,id:this.id})}}catch(f){}};c.oniceconnectionstatechange=function(){if(c&&c.iceConnectionState=="failed"){c.close();if(webrtcSessions[c.id]){delete webrtcSessions[c.id]}}};c.ondatachannel=function(d){webchannel=d.channel;webchannel.onmessage=function(e){processMessage(e.data,2)};webchannel.onopen=function(){webchannel.ok=true;updateControls();sendws({action:"rtcSwitch",v:0})};webchannel.onclose=function(e){if(webchannel&&webchannel.ok){disconnect()}else{hangUpButtonClick(0)}}};c.onnegotiationneeded=function(d){if(c.holdTimer!=null){return}c.holdTimer=setTimeout(function(){c.holdTimer=null;c.createOffer(function(e){c.setLocalDescription(e,function(){sendws({action:"webRtcSdp",sdp:e,id:a})},function(){hangUpButtonClick(a)})},function(){hangUpButtonClick(a)})},20)};c.ontrack=function(d){var e=Q("remoteVideoCanvas");e.srcObject=remoteStream=d.streams[0];e.onloadedmetadata=function(f){e.play()};displayRemoteVideo(true)};if(b==true){webchannel=c.createDataChannel("DataChannel",{});webchannel.onmessage=function(d){processMessage(d.data,2)};webchannel.onopen=function(){webchannel.ok=true;updateControls();sendws({action:"rtcSwitch",v:0})};webchannel.onclose=function(d){if(webchannel&&webchannel.ok){disconnect()}else{hangUpButtonClick(0)}}}webrtcSessions[a]=c;return c}function webRtcHandleOffer(b,a){var c=webrtcSessions[b];if(c){c.setRemoteDescription(new RTCSessionDescription(a),function(){if(a.type=="offer"){c.createAnswer(function(d){c.setLocalDescription(d,function(e,f){try{sendws({action:"webRtcSdp",sdp:d,id:b})}catch(g){}},function(){hangUpButtonClick(b)})},function(){hangUpButtonClick(b)})}},function(){hangUpButtonClick(b)})}}function performWebRtcSwitch(){if(webchannel&&webchannel.ok){sendws({action:"rtcSwitch",v:1});webchannel.xoutBuffer=[]}}function disconnect(){if(state>0){displayControl("Connection closed.")}if(state>1){setTimeout(start,500)}cancelAllFileTransfers();hangUpButtonClick(0,true);hangUpButtonClick(1,true);hangUpButtonClick(2,true);if(socket!=null){socket.close();socket=null}updateControls();state=0}function send(a){if(state!=2){return}if(typeof a=="object"){a=JSON.stringify(a)}if(webchannel&&webchannel.ok){if(webchannel.xoutBuffer!=null){webchannel.xoutBuffer.push(a)}else{webchannel.send(a)}}else{if(socket!=null){try{socket.send(a)}catch(b){}}}}function sendws(a){if(state!=2){return}if(typeof a=="object"){a=JSON.stringify(a)}if(socket!=null){socket.send(a)}}function webRtcIdSwitch(a){if(a==0){return 0}return 3-a}function processMessage(a,d){if(typeof a=="string"){try{a=JSON.parse(a)}catch(b){console.log("Unable to parse",a);return}switch(a.action){case"chat":displayRemote(a.msg);break;case"random":if(random>a.random){startWebRTC(0,true)}break;case"webRtcSdp":if(!webrtcSessions[webRtcIdSwitch(a.id)]){startWebRTC(webRtcIdSwitch(a.id),false)}webRtcHandleOffer(webRtcIdSwitch(a.id),a.sdp);break;case"webRtcIce":var e=webrtcSessions[webRtcIdSwitch(a.id)];if(e){try{e.addIceCandidate(new RTCIceCandidate(a.ice))}catch(b){}}break;case"videoStop":hangUpButtonClick(webRtcIdSwitch(a.id),true);break;case"rtcSwitch":switch(a.v){case 0:performWebRtcSwitch();break;case 1:sendws({action:"rtcSwitch",v:2});break;case 2:for(var c in webchannel.xoutBuffer){webchannel.send(webchannel.xoutBuffer[c])}delete webchannel.xoutBuffer;break;default:console.log("Unknown rtcSwitch value: "+a.action);break}break;case"file":startFileDownload(a);break;case"fileUploadCancel":cancelFileTransfer(a.id);break;case"fileUploadStart":if(fileDownloads[a.id]){currentFileDownload=fileDownloads[a.id];currentFileDownload.data="";changeFileInfo(a.id,2,0);continueFileDownload(a);send({action:"fileUploadAck",id:a.id})}break;case"fileUploadEnd":if(currentFileDownload&&(currentFileDownload.id==a.id)){changeFileInfo(a.id,3,200);currentFileDownload.done=1;currentFileDownload=null;send({action:"fileUploadAck",id:a.id})}currentFileDownload=null;break;case"fileUploadAck":continueFileUpload();break;case"fileData":if(currentFileDownload&&(currentFileDownload.id==a.id)){currentFileDownload.data+=a.data;changeFileInfo(a.id,2,(currentFileDownload.data.length*200/currentFileDownload.size));send({action:"fileUploadAck",id:a.id})}break;default:console.log("Unhandled object data",a);break}}else{console.log("Unhandled data",typeof a,a)}}function fileButtonClick(){var a=Q("uploadFileInput");if(a.getAttribute("eventset")!=1){a.setAttribute("eventset","1");a.addEventListener("change",fileSelect,false)}a.value=null;a.click()}function fileSelect(){if(state!=2){return}var c=Q("uploadFileInput");if(c.files.length>10){displayControl("Limit of 10 file uploads at the same time.")}else{for(var a=0;a<c.files.length;a++){if(c.files[a].size>0){var b=new FileReader();b.onload=function(d){this.xfile.data=d.target.result;startFileUpload(this.xfile)};b.xfile=c.files[a];b.readAsBinaryString(c.files[a])}}}}function fileDrop(a){haltEvent(a);if((state!=2)||(a.dataTransfer==null)){return}if(a.dataTransfer.files.length>10){displayControl("Limit of 10 file uploads at the same time.")}else{for(var b=0;b<a.dataTransfer.files.length;b++){if(a.dataTransfer.files[b].size>0){var c=new FileReader();c.onload=function(d){this.xfile.data=d.target.result;startFileUpload(this.xfile)};c.xfile=a.dataTransfer.files[b];c.readAsBinaryString(a.dataTransfer.files[b])}}}}function startFileUpload(a){if(state!=2){return}a.id=Math.random();fileUploads.push(a);QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+a.id+'" class="localBubble" style="width:240px;cursor:pointer" onclick="cancelFileTransfer(\''+a.id+'\')"><div id="FILEUP-ICON-'+a.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+a.id+'" style="height:16px;overflow:hidden;white-space:nowrap;" title="'+a.name+'">'+a.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+a.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px">&nbsp;</div></div></div></div>');Q("xmsg").scrollTop=Q("xmsg").scrollHeight;send({action:"file",size:a.size,id:a.id,type:a.type,name:a.name});if(currentFileUpload==null){continueFileUpload()}}function startFileDownload(a){if(state!=2){return}fileDownloads[a.id]=a;QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+a.id+'" class="remoteBubble" style="width:240px;cursor:pointer" onclick="saveFileTransfer(\''+a.id+'\')"><div id="FILEUP-ICON-'+a.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+a.id+'" style="height:16px;overflow:hidden;white-space:nowrap;" title="'+a.name+'">'+a.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+a.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px">&nbsp;</div></div></div></div>');Q("xmsg").scrollTop=Q("xmsg").scrollHeight}function changeFileInfo(b,a,c,d){if(a){Q("FILEUP-ICON-"+b).classList.remove("fileicon");Q("FILEUP-ICON-"+b).classList.remove("fileiconx");Q("FILEUP-ICON-"+b).classList.remove("fileicontransfer");Q("FILEUP-ICON-"+b).classList.remove("fileicondone");Q("FILEUP-ICON-"+b).classList.add(["fileicon","fileiconx","fileicontransfer","fileicondone"][a])}if(c){QS("FILEUP-PROGRESS-"+b)["width"]=c+"px"}if(d){QS("FILEUP-PROGRESS-"+b)["background-color"]=d}}function data2blob(b){var a=new Array(b.length);for(var c=0;c<b.length;c++){a[c]=b.charCodeAt(c)}return new Blob([new Uint8Array(a)])}function saveFileTransfer(b){var a=fileDownloads[b];if(a&&a.done==1){saveAs(data2blob(a.data),a.name)}}function cancelFileTransfer(c){if((currentFileUpload!=null)&&(currentFileUpload.id==c)){currentFileUpload=null}if((currentFileDownload!=null)&&(currentFileDownload.id==c)){currentFileDownload=null}var a=false;if(fileDownloads[c]&&(fileDownloads[c].done!=1)){delete fileDownloads[c];a=true}else{for(var b in fileUploads){if(fileUploads[b].id==c){send({action:"fileUploadCancel",id:c});fileUploads.splice(b,1);a=true;break}}}if(a){changeFileInfo(c,1,200,"gray")}}function cancelAllFileTransfers(){for(var a in fileDownloads){cancelFileTransfer(fileDownloads[a].id)}for(var a in fileUploads){cancelFileTransfer(fileUploads[a].id)}}function continueFileUpload(){if(currentFileUpload==null){if(fileUploads.length==0){return}currentFileUpload=fileUploads[0];currentFileUpload.ptr=0;send({action:"fileUploadStart",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name})}else{if(currentFileUpload.size<=currentFileUpload.ptr){send({action:"fileUploadEnd",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name});changeFileInfo(currentFileUpload.id,3,200);fileUploads.splice(0,1);currentFileUpload=null;continueFileUpload()}else{var b=Math.min(4000,currentFileUpload.data.length-currentFileUpload.ptr);var a=currentFileUpload.data.substring(currentFileUpload.ptr,currentFileUpload.ptr+b);send({action:"fileData",id:currentFileUpload.id,data:a});currentFileUpload.ptr+=b;changeFileInfo(currentFileUpload.id,0,(currentFileUpload.ptr*200/currentFileUpload.size))}}}function continueFileDownload(a){send({action:"fileUploadAck",id:a.id})}function camButtonClick(){if(localStream==null){startLocalStream({video:true,audio:true})}}function micButtonClick(){if(localStream==null){startLocalStream({video:false,audio:true})}}function hangUpButtonClick(d,b){var f=Q("localVideoCanvas");var g=Q("remoteVideoCanvas");var j=webrtcSessions[(multiWebRtc==true)?d:0];if((d==0)&&(webchannel!=null)){try{webchannel.close()}catch(a){}webchannel=null}if(j){if((multiWebRtc==true)||(d==0)){j.ontrack=null;j.onremovetrack=null;j.onremovestream=null;j.onnicecandidate=null;j.oniceconnectionstatechange=null;j.onsignalingstatechange=null;j.onicegatheringstatechange=null;j.onnotificationneeded=null}if((d==1)&&localStream){var h=localStream.getTracks();for(var c in h){h[c].stop()}localStream=null}if((d==2)&&remoteStream){var h=remoteStream.getTracks();for(var c in h){h[c].stop()}remoteStream=null}if((multiWebRtc==true)||(d==0)){j.close();delete webrtcSessions[d]}}if(d==1){f.removeAttribute("src");f.removeAttribute("srcObject");if(localStream!=null){localStream=null}displayLocalVideo(false)}else{if(d==2){g.removeAttribute("src");g.removeAttribute("srcObject");displayRemoteVideo(false)}}if(b!=true){send({action:"videoStop",id:d})}updateControls()}function startLocalStream(b){var a=(multiWebRtc==true)?1:0;if(localStream!=null){return}if((multiWebRtc==true)&&(webrtcSessions[1]!=null)){return}if(navigator.mediaDevices.getUserMedia){localStream=1;updateControls();navigator.mediaDevices.getUserMedia(b).then(function(d){localStream=d;var e=localStream.getTracks();var g=startWebRTC(a);if(b.video==true){var f=Q("localVideoCanvas");f.srcObject=d;f.onloadedmetadata=function(h){f.play()};displayLocalVideo(true)}for(var c in e){g.addTrack(e[c],localStream)}},function(c){displayControl(c.message+".");hangUpButtonClick(1)})}}function start(){updateControls();if((typeof args.id=="string")&&(args.id.length>0)){var a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+args.id;if((args.auth!=null)&&(args.auth!="")){a+="&auth="+args.auth}socket=new WebSocket(a);socket.onopen=function(){state=1;displayControl("Waiting for other user...")};socket.onerror=function(b){};socket.onclose=function(){disconnect()};socket.onmessage=function(b){if((state<2)&&(typeof b.data=="string")&&(b.data=="c")){hangUpButtonClick(0,true);hangUpButtonClick(1,true);hangUpButtonClick(2,true);displayControl("Connected.");state=2;updateControls();sendws({action:"random",random:random});return}if(state==2){processMessage(b.data,1)}}}else{displayControl("Error: No connection key specified.")}}start();function onUnLoad(){for(var b=0;b<3;b++){if(webrtcSessions[b]){webrtcSessions[b].close();delete webrtcSessions[b]}}if(webchannel!=null){try{webchannel.close()}catch(a){}webchannel=null}if(socket!=null){try{socket.close()}catch(a){}socket=null}};</script></body></html>