Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 9

!function(n){function e(){return{showSoftKeys:!0,pinTitleBar:!0,alwaysOnTop:!

1,bitrate:0,resolution:0,decoder:0,displaySettings:s[0],dimDisplay:!1}}function
t(n){return n?(n.friendlyName&&!n.friendlyName.length&&delete
n.friendlyName,n):null}function i(n){window.chrome&&window.chrome.storage?
chrome.storage.local.get("device-settings",function(e){n(e["device-settings"]||
{})}):n({})}function o(n,o){n||(n="web");var r=e();"inkwire"==n&&(r.pinTitleBar=!
1,r.showSoftKeys=!1),i(function(e){o(t(e[n]||r))})}function r(n){$("#new-display-
name").prop("value",n.friendlyName||null),$("#softkeys-check").prop("checked",!!
n.showSoftKeys).change(),$("#pin-title-check").prop("checked",!!
n.pinTitleBar).change(),$("#always-on-top-check").prop("checked",!!
n.alwaysOnTop).change(),$("#bitrate").prop("selectedIndex",n.bitrate||0),$
("#decoder").prop("selectedIndex",n.decoder||0),$
("#resolution").prop("selectedIndex",n.resolution||0);var
e=n.displaySettings&&n.displaySettings.name,t=0;for(var i in s){if(s[i].name==e)
{t=i;break}}$("#display-settings").prop("selectedIndex",t),$("#dim-
display").prop("checked",!!n.dimDisplay),$("#auto-audio").prop("checked",!!
n.autoAudio)}window.IS_RELEASE=!0,function(){var n,e;try{e=!navigator}catch(n){e=!
0}if(e)n=global;else{n=window,window.exports=window,window.chrome||
(window.chrome={});var t={"node-
fetch":window.fetch,wrtc:window},i=window.require;window.require=function(n)
{if(n.startsWith("."))return window;var e=t[n];return e||(i?
i.apply(null,arguments):window)}}n.isNode=function(){return e}}();var
s=[{name:"Default Settings",size:"reset",density:"reset"},{name:"Resizable
(96dpi)",size:"reset",density:"96",freeSize:!0},{name:"Resizable
(144dpi)",size:"reset",density:"144",freeSize:!0},{name:"1080p
(96dpi)",size:"1920x1080",density:"96"},{name:"4K
(144dpi)",size:"3840x2160",density:"144"},{name:"Galaxy
Nexus",size:"720x1280",density:"320"},{name:"Nexus
4",size:"768x1280",density:"320"},{name:"Nexus 5",size:"1080x1920",density:"480"},
{name:"Nexus 6",size:"1440x2560",density:"560"},{name:"Nexus
6p",size:"1440x2560",density:"560"},{name:"Nexus 7
(2012)",size:"800x1280",density:"213"},{name:"Nexus 7
(2013)",size:"1200x1920",density:"320"},{name:"Nexus
9",size:"1536x2048",density:"320"}];function c(n){for(var
e=n.toString(16);e.length<4;)e="0"+e;return e}function a(n)
{return"ArrayBuffer"==n.constructor.name&&(n=new
Uint8Array(n)),e=String.fromCharCode.apply(null,n),decodeURIComponent(escape(e));va
r e}function u(n,e,t){var i=(n=unescape(encodeURIComponent(n))).length;t&&i++,e||
(e=new ArrayBuffer(i));var o=new Uint8Array(e);t&&(o[n.length]=0);for(var
r=0,s=n.length;r<s;r++)o[r]=n.charCodeAt(r);return e}var
l="\n".charCodeAt(0);function f(n,e){var t="";n.onClose=function()
{e(t)},n.read(function e(i){t+=a(i),n.read(e)})}function h(n,e,t)
{"Object"==e.constructor.name&&(e=JSON.stringify(e)),n.write(u(e),t)}Uint8Array.pro
totype.sliceArrayBuffer=function(){return
this.buffer.slice(this.byteOffset,this.byteOffset+this.byteLength)},Number.prototyp
e.pad=function(n){for(var e=String(this);e.length<(n||2);)e="0"+e;return e};(new
Date).getTime();String.prototype.startsWith||
Object.defineProperty(String.prototype,"startsWith",{enumerable:!1,configurable:!
1,writable:!1,value:function(n,e){return e=e||
0,this.lastIndexOf(n,e)===e}}),Object.fromArray=function(n){var e={};for(var t in
n){var i=n[t];e[i]=i}return e};try{$.ajaxTransport("+binary",function(n,e,t)
{if(window.FormData&&(n.dataType&&"binary"==n.dataType||
n.data&&(window.ArrayBuffer&&n.data instanceof ArrayBuffer||window.Blob&&n.data
instanceof Blob)))return{send:function(e,t){var i=new
XMLHttpRequest,o=n.url,r=n.type,s=n.async||!0,c=n.responseType||"blob",a=n.data||
null,u=n.username||null,l=n.password||null;for(var f in
i.addEventListener("load",function(){var
e={};e[n.dataType]=i.response,t(i.status,i.statusText,e,i.getAllResponseHeaders())}
),i.addEventListener("error",function()
{t(i.status,i.statusText,null,i.getAllResponseHeaders())}),i.open(r,o,s,u,l),e)i.se
tRequestHeader(f,e[f]);i.responseType=c,i.send(a)},abort:function()
{t.abort()}}})}catch(n){}function d(n){var
e=document.createElement("textarea");e.style.position="fixed",e.style.top=0,e.style
.left=0,e.style.width="2em",e.style.height="2em",e.style.padding=0,e.style.border="
none",e.style.outline="none",e.style.boxShadow="none",e.style.background="transpare
nt",e.value=n,document.body.appendChild(e),e.select();try{document.execCommand("cop
y")}catch(n){console.log("Oops, unable to copy")}document.body.removeChild(e)}var
v,m=(v={},function(n,e){if(v[n])e(v[n]);else{var t=new
XMLHttpRequest;t.open("GET",n,!0),t.responseType="blob",t.onload=function(t)
{e(v[n]=window.URL.createObjectURL(this.response))},t.send()}});function y()
{}function w(n,e){if(!window.chrome||!window.chrome.identity)return
console.error("no auth token implemented"),void
process.nextTick(e);chrome.identity.getAuthToken({interactive:n,scopes:
["https://www.googleapis.com/auth/userinfo.profile","https://www.googleapis.com/aut
h/userinfo.email","https://www.googleapis.com/auth/chromewebstore.readonly"]},funct
ion(n){n||console.error("unable to get
authToken",chrome.runtime.lastError),e(n)})}function b(n){var e,t=$
("#notificationModal"),i=t.find("#modal-ok"),o=t.find("#modal-
cancel");i.unbind("click"),o.unbind("click"),t.unbind("hidden.bs.modal"),n.cancelBu
tton=n.cancelButton||"Cancel",n.okButton=n.okButton||"OK",n.title=n.title||
chrome.runtime.getManifest().name,n.body=n.body||"",n.hideCancel?
o.hide():o.show(),i.text(n.okButton),o.text(n.cancelButton),t.find("#modal-
title").text(n.title),t.find("#modal-body").html(n.body),i.click(function(){e=!
0,n.ok&&n.ok()||$
("#notificationModal").modal("hide")}),n.cancel&&(t.on("hidden.bs.modal",function()
{e||n.cancel()}),o.click(n.cancel)),$
("#notificationModal").modal(),n.duration&&setTimeout(function(){$
("#notificationModal").modal("hide")},n.duration)}function g(n,e)
{b({title:n,body:e,duration:8e3,hideCancel:!0})}function p(n){var e;n?($
("#whitelist-count").show(),e=function(e){$("#whitelist-count
a").text(e).click(function(e){chrome.app.window.create("whitelist.html",
{id:"whitelist",innerBounds:
{width:768,height:512,minWidth:768,minHeight:512}},function(e)
{e.onClosed.addListener(function()
{p(n)})})})},chrome.storage.local.get(["whitelist","serverMode"],function(n){var
t;1!=n.serverMode?2!=n.serverMode?
(t=n.whitelist&&"Array"==n.whitelist.constructor.name?n.whitelist.length:0,e(t+"
user(s) can access this server.")):e("Your Vysor Enterprise users can access this
server."):e("Any user can access this server.")}),$("#vysor-share-server-
status").show(),$("#vysor-share-server-status").html('Vysor is sharing your
devices: <a href="#">'+n+"</a>"),$("#vysor-share-server-status a").click(function()
{d(n),g("Copied "+chrome.runtime.getManifest().name+" Share Server URL to
clipboard.",n)})):($("#vysor-share-server-status").hide(),$("#whitelist-
count").hide())}function k(n){return $('.vysor-device[name="'+n+'"]')}function
S(n,e){var t=k(n);t&&t.find(".friendly-name").text(e)}!function(){var n=function*()
{}();n.constructor.prototype.async=function(){var e=this,t=e.next();if(!t.done){var
i,o,r=new Promise(function(n,e){i=n,o=e});return a(),r}function s(){t=e.throw(new
Error(arguments)),a()}function c(){var n=arguments[0];t=e.next(n),a()}function a(r)
{var a,u;if(t.done)i(t.value);else if(t.value)if(t.value.constructor!
=Promise)if(t.value.constructor!=n.constructor){if(t.value==Error)a=!
0,t=e.next(s);else{if(t.value!=y)throw new Error("Unexpected yield value for
callback. Only Error and Success allowed.");u=!0,t=e.next(c)}if(!t.value)throw new
Error("Double yield callbacks must explicitly define both Error and
Success");if(t.value==Error&&a)throw new Error("Error callback already
defined");if(t.value==y&&u)throw new Error("Success callback already
defined");if(t.value!=Error&&t.value!=y)throw new Error("Unexpected yield value for
callback. Only Error and Success allowed.");try{t=a?e.next(c):e.next(s)}catch(n)
{o(n)}}else t.value.async().then(c).catch(s);else t.value.then(c).catch(s);else
t=e.next(c)}}}(),isNode()||(window.isElectron=function(){return-1!
=navigator.userAgent.indexOf("Electron")},isElectron()||
(window.sharedGlobals=window)),function(){if(!isNode()){var
n="";if(window.IS_RELEASE)
{console.log,console.error,console.warn,console.info;function e(e){return
function(){e.apply(console,arguments),function(e){try{for(var t in
e)e[t]&&e[t].constructor!=String&&(e[t]=JSON.stringify(e[t]));n+=e.join(" ")
+"\n"}catch(n){}}
(Array.prototype.slice.call(arguments))}}console.error=e(console.error),console.log
=e(console.log),console.warn=e(console.warn),console.info=e(console.info)}sharedGlo
bals.getConsoleLog=function(e){e(n)},window.gistConsoleLog=function(n,e)
{chrome.runtime.getBackgroundPage(function(i){t(i).then(function(e)
{n["background.txt"]=e;var i=chrome.app.window.getAll().map(function(e){return
t(e.contentWindow).then(function(t){n["window-"+e.id+".txt"]=t})});return
Promise.all(i)}).then(function(){var
t={description:chrome.runtime.getManifest().name+" console log",public:!
1,files:n};fetch("https://vysor.io/gist",
{method:"POST",body:JSON.stringify(t)}).then(function(n){n.json().then(function(n)
{e(n.html_url)})})})})}}function t(n){return new Promise(function(e,t)
{n.getConsoleLog?n.getConsoleLog(function(n){e({content:n&&n.length?n:"log is
empty"})}):e("getConsoleLog not found")})}}
(),n.str2ab=u,n.ab2str=a,n.readString=f,n.readLine=function(n,e){var t=[];!function
i(){n.read(function(o){for(var r=0;r<o.byteLength;r++)if(o[r]==l){var
s=o.subarray(0,r);t.push(s);var c="";for(var u in t)c+=a(u=t[u]);var
f=o.subarray(r+1);return n.unshift(f),void e(c)}t.push(o),i()})}
()},n.writeString=h,function(){try{var e=require("buffer").Buffer}catch(n)
{}function t(n,e)
{if(n.socketId)this.socketId=n.socketId,t.readers[this.socketId]=this;else
if(chrome&&chrome.sockets)chrome.sockets.tcp.create(function(i)
{this.socketId=i.socketId,chrome.sockets.tcp.connect(this.socketId,n.host,n.port,fu
nction(n){n?(chrome.runtime.lastError,this.destroy(),
e(null)):(t.readers[i.socketId]=this,e(this))}.bind(this))}.bind(this));else{var
i;n.ns?(this.ns=n.ns,i=!0):(this.ns=new
require("net").Socket(),this.ns.connect({port:n.port,host:n.host},function(){i=!
0,e(this)}.bind(this))),this.ns.on("close",function(){this.destroy(),i||
e(null)}.bind(this)),this.ns.on("data",function(n)
{this.dataReceived(n)}.bind(this))}}function i()
{}chrome&&chrome.sockets&&(chrome.sockets.tcp.onReceive.addListener(function(n){var
e=t.readers[n.socketId];null!=e&&e.dataReceived(new
Uint8Array(n.data))}),chrome.sockets.tcp.onReceiveError.addListener(function(n){var
e=t.readers[n.socketId];null!
=e&&(e.destroy(),e.dataReceived(null))}),chrome.sockets.tcpServer.onAccept.addListe
ner(function(n){chrome.sockets.tcp.setPaused(n.clientSocketId,!1);var
e=i.listeners[n.socketId];null!=e&&e(new
t({socketId:n.clientSocketId}))})),t.readers={},t.connect=function(n,e){return new
t(n,e)},t.pump=function(n,e,t){if(!n||!e)return console.error("Socket.pump called
with null socket",n,e),void t();var i=function(){n.read(o)}.bind(n),o=function(n)
{var t=n.buffer;(n.byteOffset||n.length!
=t.byteLength)&&(t=t.slice(n.byteOffset,n.byteOffset+n.length)),e.write(t,i)}.bind(
e);n.read(o),n.onClose=t},t.stream=function(n,e,i){t.pump(n,e,function()
{if(e&&e.destroy(),i){var n=i;i=null,n()}}),t.pump(e,n,function()
{if(n&&n.destroy(),i){var e=i;i=null,e()}})},t.eat=function(n){!function e()
{n.read(e)}()},t.prototype.read=function(){if(this.pendingCallback)throw new
Error("double callback");if(!this.closed||this.pending){var
n=0;"Number"==arguments[n].constructor.name?this.pendingLength=arguments[n+
+]:this.pendingLength=0;a=arguments[n];if(this.pending&&!this.paused)
{if(this.pendingLength){if(this.pendingLength>this.buffered())return
void(this.pendingCallback=a)}else this.pendingLength=this.buffered();for(var
e,t=0;t<this.pendingLength;){var i=this.pending.shift();this.bufferedLength-
=i.length,this.pending.length||delete this.pending;var
o=i,r=Math.min(o.byteLength,this.pendingLength-t);if(r!=o.byteLength){var
s=o.subarray(0,r),c=o.subarray(r);this.unshift(c),o=s}e||
o.byteLength==this.pendingLength||(e=new Uint8Array(this.pendingLength)),e?
e.set(o,t):e=o,t+=o.byteLength}a(e)}else this.pendingCallback=a}else{var a;
(a=this.onClose)&&(delete this.onClose,a())}},t.prototype.write=function(n,t)
{if(this.pendingWrite)if(this.bufferWrites){null!=t&&console.error("using callbacks
in buffered mode?");var i=this.pendingWrite;this.pendingWrite=function()
{i&&i(),this.write(n,t)}.bind(this)}else console.error("write is already in
progress!");if(null==t&&(this.bufferWrites||console.error("write callback is
null?"),t=function()
{}),this.pendingWrite=t,chrome&&chrome.sockets)chrome.sockets.tcp.send(this.socketI
d,n,function(e){chrome.runtime.lastError,e&&!e.resultCode?e.bytesSent<n.byteLength?
this.write(n.slice(e.bytesSent),t):(delete this.pendingWrite,t()):delete
this.pendingWrite}.bind(this));else{if(!this.ns)return;if(!n.byteLength)return void
process.nextTick(function(){delete
this.pendingWrite,t()}.bind(this));this.ns.write(e.from(n),function(){delete
this.pendingWrite,t()}.bind(this))}},t.prototype.destroy=function(n,e)
{chrome&&chrome.sockets?chrome.sockets.tcp.close(this.socketId,function()
{chrome.runtime.lastError}):
(this.dataReceived(null),this.ns&&(this.ns.destroy(),delete
this.ns))},t.prototype.unshift=function(n){0!=n.byteLength&&(this.pending?
this.pending.unshift(n):this.pending=[n],this.bufferedLength||
(this.bufferedLength=0),this.bufferedLength+=n.length)},t.prototype.dataReceived=fu
nction(n)
{if(n&&(n.asUint8Array&&(n=n.asUint8Array()),n.constructor==ArrayBuffer&&(n=new
Uint8Array(n))),n&&n.length){var e=new Uint8Array(n);this.pending?
this.pending.push(e):this.pending=[e]}if(null==n?this.closed=!0:
(this.bufferedLength||(this.bufferedLength=0),this.bufferedLength+=n.length),!
this.paused&&this.pending&&this.pending.length){var t=this.pendingLength;
(i=this.pendingCallback)&&(delete this.pendingCallback,this.read(t,i))}else{var
i=this.onClose;this.closed&&i&&(delete
this.onClose,i())}},t.prototype.buffered=function(){return
this.bufferedLength},t.prototype.pause=function(){this.paused||(this.paused=!
0,this.onPause())},t.prototype.resume=function(){this.paused&&(this.paused=!
1,this.onResume())},t.prototype.onResume=function()
{chrome.sockets.tcp.setPaused(this.socketId,!1,function()
{})},t.prototype.onPause=function(){chrome.sockets.tcp.setPaused(this.socketId,!
0,function()
{})},i.listeners={},i.prototype.__proto__=t.prototype,i.prototype.destroy=function(
){chrome&&chrome.sockets?chrome.sockets.tcpServer.close(this.socketId,function()
{chrome.runtime.lastError}):this.ns&&(this.ns.close(),delete
this.ns)},i.prototype.listen=function(n,e,o){var r,s;"Number"==n.constructor.name?
(r=n,s="0.0.0.0"):(s=n.address,r=n.port),chrome&&chrome.sockets?
chrome.sockets.tcpServer.create(function(n)
{this.socketId=n.socketId,i.listeners[this.socketId]=e,chrome.sockets.tcpServer.lis
ten(n.socketId,s,r,function(n){if(chrome.runtime.lastError,n)return
this.destroy(),void(o&&o(n));chrome.sockets.tcpServer.getInfo(this.socketId,functio
n(e)
{this.localAddress=e.localAddress,this.localPort=e.localPort,o&&o(n)}.bind(this))}.
bind(this))}.bind(this)):(this.ns=require("net").createServer(function(n){e(new
t({ns:n}))}.bind(this)),this.ns.on("close",function()
{this.destroy()}.bind(this)),this.ns.on("error",function(n)
{o&&o(n)}.bind(this)),this.ns.on("listening",function(){var
n=this.ns.address();this.localAddress=n.address,this.localPort=n.port,o&&o()}.bind(
this)),this.ns.listen({port:r,host:s}))},n.Socket=t,n.Server=i}(),function(){var
n={};function e(){}n.sendHostCommand=function(n,e)
{Socket.connect({host:"127.0.0.1",port:5037},function(t){if(t){var
i=n;n=c(n.length)+n,t.read(4,function(n){var o=a(n);if("OKAY"!=o)return
console.error("error in response to adb host command",i,o),t.destroy(),void
e();t.read(4,function(n){var i=a(n);0!=(n=parseInt(i,16))&&"OKAY"!=i?
t.read(n,function(n){e(t,n)}):e(t,new ArrayBuffer(0))})}),t.write(u(n),function()
{})}else e()})},n.devices=function(e){var t={};function i(n){var
e=n,i=(n=n.replace("\t"," ")).indexOf(" ");if(-1!=i){var
o,r=n.substring(0,i);for(n=n.substring(i).trim();o!=n;)o=n,n=n.replace(" ","
");var s={},c=n.indexOf(" ");-1==c&&(c=n.length);var
a,u=n.substring(0,c);for(n=n.substring(c+1);n.length&&-1!=(i=n.indexOf(":"));){var
l,f=n.substring(0,i),h=n.substring(i+1),d=h.indexOf(" "),v=h.indexOf(":");if(-
1==d||-1==v)l=h,n="";else for(;-1!
=d&&d<v;)l=h.substring(0,d),n=h.substring(d+1),d=h.indexOf("
",d+1);s[f]=l}a=s.model?s.model.replace("_","
"):r,t[r]={serialno:r,name:a,status:u,properties:e}}}n.sendHostCommand("host:device
s-l",function(n,o){if(n){n.destroy(),o=a(o),console.log("ADB devices:",o);var
r=(o=o.trim()).split("\n");for(var s in r)i(s=r[s]);console.log("parsed ADB
devices:",t),e(t)}else e()})},n.killServer=function(e)
{n.sendHostCommand("host:kill-server",function(n,t){n?
(n.destroy(),t=a(t),e&&e()):e()})},n.sendClientCommand=function(n,e){var
t=n.command,i=n.serialno;Socket.connect({host:"127.0.0.1",port:5037},function(n)
{if(n){n.read(4,function(i){if("OKAY"!=a(i))return n.destroy(),void e(null);var
o=t;o=c(o.length)+o,n.read(4,function(t){if("OKAY"!=a(t))return n.destroy(),void
e(null);e(n)}),n.write(u(o),function(){})});var o="host:transport:"+i;o=c(o.length)
+o,n.write(u(o),function(){})}else e()})},n.shell=function(e,t){var
i=e.command;e.serialno;n.getOrCreateSockFactory(e).newSocket("shell:"+i,function(n)
{n?f(n,function(n){t(n)}):t()})},n.forward=function(e,t){var i="host-
serial:"+e.serialno+":forward:"+e.from+";"+e.to;n.sendHostCommand(i,function(n,e)
{n&&n.destroy(),t(n,e)})},n.reverse=function(e,t){var
i="reverse:forward:"+e.from+";"+e.to;n.sendClientCommand({serialno:e.serialno,comma
nd:i},function(n,e){n?f(n,t):t()})},e.MKID=function(n,e,t,i){return
n.charCodeAt(0)|e.charCodeAt(0)<<8|t.charCodeAt(0)<<16|
i.charCodeAt(0)<<24},e.ID_RECV=e.MKID("R","E","C","V"),e.ID_SEND=e.MKID("S","E","N"
,"D"),e.ID_DONE=e.MKID("D","O","N","E"),e.ID_DATA=e.MKID("D","A","T","A"),e.DATA_MA
X=65536,n.pull=function(t,i){var
o,r=t.file,s=(t.serialno,t.fileEntry),c=t.socket;c||(c={write:function(n,e){o?
(o.onwriteend=e,o.write(new Blob([n]))):s.createWriter(function(t)
{o=t,c.write(n,e)})}});var a=new DummySocket;Socket.pump(a,c,function()
{i(s)}),n.getOrCreateSockFactory(t).newSocket("sync:",function(n){if(n){var t=new
ArrayBuffer(8),o=new DataView(t);o.setUint32(0,e.ID_RECV,!
0),o.setUint32(4,r.length,!0),n.write(t,function(){n.write(u(r),function()
{s()})})}else i();function s(){n.read(8,function(t){var o=new
DataView(t.buffer,t.byteOffset,t.byteLength),r=o.getUint32(0,!0);r!=e.ID_DATA?
(n.destroy(),r!=e.ID_DONE?i():a.dataReceived(null)):function(e)
{n.read(e,function(n){a.dataReceived(n),s()})}(o.getUint32(4,!
0))})}})},n.createSocketFactory=function(e){return{newSocket:function(t,i)
{n.sendClientCommand({serialno:e,command:t},i)}}},n.getOrCreateSockFactory=function
(e){return e.socketFactory||n.createSocketFactory(e.serialno)},n.push=function(t,i)
{var
o=t.file,r=(t.serialno,t.socket);n.getOrCreateSockFactory(t).newSocket("sync:",func
tion(n){if(n){var t=new ArrayBuffer(8),s=new
DataView(t),c=o+",0644";s.setUint32(0,e.ID_SEND,!0),s.setUint32(4,c.length,!
0),n.write(t,function(){n.write(u(c),function(){function t(){r.read(function(i)
{if(i.byteLength>e.DATA_MAX){var
o=i.subarray(e.DATA_MAX);i=i.subarray(0,e.DATA_MAX),r.unshift(o)}!function(i){var
o=new ArrayBuffer(8),r=new DataView(o);r.setUint32(0,e.ID_DATA,!
0),r.setUint32(4,i.byteLength,!0),n.write(o,function(){var e=i.buffer;
(i.byteOffset||i.length!
=e.byteLength)&&(e=e.slice(i.byteOffset,i.byteOffset+i.byteLength)),n.write(e,funct
ion(){t()})})}(i)})}r.onClose=function(){var t=new ArrayBuffer(8),o=new
DataView(t);o.setUint32(0,e.ID_DONE,!0),o.setUint32(4,0,!0),n.write(t,function()
{n.read(8,function(){i()})})},t()})})}else i()})},window.Adb=n}(),function()
{function n(){chrome.usb.getUserSelectedDevices({multiple:!0,filters:
[{interfaceClass:255,interfaceSubclass:66,interfaceProtocol:1}]},function(n
){$.each(n,function(n,e){var
t=e.vendorId.toString(16)+":"+e.productId.toString(16);tracker.sendEvent("select-
device",t),adbServer.refreshDevice(e,function(n){if(n)tracker.sendEvent("connect-
device",n.properties["ro.product.name"],e.vendorId.toString(16)+":"+e.productId.toS
tring(16),t);else{var
i=chrome.runtime.getManifest().name;chrome.notifications.create("reload",
{type:"basic",iconUrl:"/icon.png",title:i,message:"An error occurred while
connecting to the Android device. Restarting the Vysor app, or disconnecting and
reconnecting the Android may resolve this issue.",buttons:
[{title:"Reload"}]})}})})})}function c(){w(!1,function(n){n?($("#login-
container").hide(),chrome.identity.getProfileUserInfo(function(n){if(n){if($
("#login-info").show(),$("#login-email").text(n.email),$("#account-
management").unbind("click"),!_lm._md||!_lm._md.managementUrl)return $("#account-
management").text("Retrieve License."),$("#account-management-
info").text("Unlicensed. Already purchased?"),void $("#account-
management").click(function(){_lm.refresh(function(e){e||b({hideCancel:!0,body:"No
license found for account "+n.email+'. If this message was in error, please click
Support for more help.<br/><br/>Wrong account? <a
href="https://support.vysor.io/support/licensing/multiple/" target="_blank">Read
this</a>.'})},!0)});$("#account-management-info").text(""),$("#account-
management").show(),$("#account-management").text(_lm._md.managementText),$
("#account-management").attr("href",_lm._md.managementUrl)}})):$("#login-
container").show()})}function u(){c(),_lm._il&&($("#purchase").hide(),$("#vysor-
version").text("Vysor Pro Version "+chrome.runtime.getManifest().version),$
(".navbar-brand").text("Vysor Pro"))}function l(n,e,t){return function(){if(!
_lm._il)return b({title:"Vysor Pro",body:"The "+n+" feature is only avaiable to
Vysor Pro users.",okButton:"Upgrade",ok:function()
{_lm.startPurchase()}}),void(t&&t.apply(this,arguments));e.apply(this,arguments)}}f
unction f(n,c){var
a=chrome.app.window.get(n);if(a&&a.contentWindow.showSettings)return
a.contentWindow.showSettings(),void a.show();o(n,function(o){var a=$("#settings-
ok"),u=$("#settings-cancel"),f=$("#settings-defaults"),h=$("#new-display-
name");function d(){$("#settings-modal").modal("hide");var e=$
(h).prop("value");o.friendlyName=e,S(n,o.friendlyName||c),function(n,e,o)
{t(e),window.chrome&&window.chrome.storage&&n&&-1==n.indexOf("127.0.0.1")?
i(function(t){t[n]=e,chrome.storage.local.set({"device-settings":t},o)}):o&&o()}
(n,o)}h.prop("value",o.friendlyName),h.prop("placeholder",c),f.unbind("click"),a.un
bind("click"),u.unbind("click"),$(h).unbind("focus"),$(h).unbind("keypress"),$
(h).bind("keypress",function(n){if(13==n.which)return d(),!
1}),a.click(d),f.click(function(){r(o=e())});var v=c||friendlyName;$("#settings-
title").text(v+" Settings"),$("#softkeys-check").unbind("change"),$("#pin-title-
check").unbind("change"),$("#always-on-top-check").unbind("change"),$
("#bitrate").unbind("change"),$("#resolution").unbind("change"),r(o),$("#softkeys-
check").change(function(){o.showSoftKeys=this.checked}),$("#pin-title-
check").change(function(){o.pinTitleBar=this.checked}),$("#always-on-top-
check").change(l("Always On Top",function(){o.alwaysOnTop=this.checked},function()
{this.checked=!1})),$("#bitrate").change(l("Image Quality",function()
{o.bitrate=this.selectedIndex},function(){this.selectedIndex=0})),$
("#resolution").change(l("Image Quality",function()
{o.resolution=this.selectedIndex},function(){this.selectedIndex=0})),$
("#decoder").change(l("Image Quality",function()
{o.decoder=this.selectedIndex},function(){this.selectedIndex=0})),$("#display-
settings").change(l("Display Settings",function(){var
n=s[this.selectedIndex];o.displaySettings=n},function(){this.selectedIndex=0})),$
("#dim-display").change(l("Dim Dislay",function()
{o.dimDisplay=this.checked},function(){this.checked=!1})),$("#settings-
modal").modal()})}chrome.identity.onSignInChanged.addListener(function()
{c()}),sharedGlobals._rl=u,$(document).ready(function(){-
1==navigator.platform.toLowerCase().indexOf("win")&&$("#windows").hide(),$("#vysor-
keyboard-check").change(function()
{chrome.storage.local.set({keyboard:this.checked}),updateKeyboard(this.checked)}),c
hrome.storage.local.get("keyboard",function(n){$("#vysor-keyboard-
check").prop("checked",n.keyboard)}),$("#customize-vysor").click(l("Customize
Vysor",function(){chrome.app.window.create("customize.html",
{id:"customize",innerBounds:
{width:768,height:512,minWidth:768,minHeight:512}},function(n)
{n.onClosed.addListener(function(){})})})),$("#bugreport").click(function()
{b({title:"Bug Report",body:"Creating bug report. Please
wait...",okButton:"Cancel",hideCancel:!0,ok:function(){!0}}),gistConsoleLog({"adb-
devices.json":{content:JSON.stringify(h,null,2)}},function(n){!function e()
{b({cancelButton:"OK",okButton:"Copy Bug Report",ok:function(){$
("#notificationModal").modal("hide"),d(n),setTimeout(e,500)},title:"Bug
Report",body:'Here is the <a href="'+n+'" target="_blank">link to your bug
report</a>.<br/>Please copy the bug report link and email <a
href="mailto:support@clockworkmod.com" target="_blank">support@clockworkmod.com</a>
with a description of your issue.'})}()})}),$("#logging-in").hide(),$("#login-
info").hide(),$("#login-container").hide(),$("#connect-android").click(n),$
("#vysor-version").text("Vysor Version "+chrome.runtime.getManifest().version),$
("#reload-vysor").click(function(){chrome.runtime.reload()}),isElectron()?($
("#desktop-app").hide(),$("#reset-vysor").click(function(){b({title:"Reset
Vysor",body:"Resetting Vysor will log out the current user and clear all Vysor
settings.",okButton:"Reset",ok:function(){chrome.runtime.reset()}})})):$("#reset-
vysor").hide(),$("#share-all-check").change(function()
{chrome.storage.local.remove("lastDeviceFarmRegistrationId"),chrome.storage.local.s
et({"share-all-devices":this.checked}),this.checked?startDeviceFarm(!
0,function(n,e){if(e)return g("Vysor Share Server",e),void $("#share-all-
check").prop("checked",!1);p(n),g("Copied "+chrome.runtime.getManifest().name+"
Share Server URL to
clipboard.",n),d(n)}):stopDeviceFarm()}),chrome.storage.local.get("connect-
automatically",function(n){var e;e=!1===n["connect-automatically"]?2:!
0===n["connect-automatically"]?0:n["connect-automatically"]||1,$("#connect-
automatically-select").prop("selectedIndex",e)}),$("#connect-automatically-
select").change(function(){chrome.storage.local.set({"connect-
automatically":this.selectedIndex})}),$("#connect-android").hide(),$
(".purchase").click(function()
{_lm.startPurchase()}),chrome.storage.local.get("lastConnectAddress",function(n)
{n.lastConnectAddress&&($("#connect-address")[0].value=n.lastConnectAddress)}),$
("#connect-ok").click(function(){$("#connectModal").modal("hide");var n=$
("#connect-address")
[0].value;chrome.storage.local.set({lastConnectAddress:n}),Adb.sendHostCommand("hos
t:disconnect:"+n,function(e,t)
{e&&e.destroy(),Adb.sendHostCommand("host:connect:"+n,function(n,e)
{n&&console.log("adb connect
result",a(e))})})}),chrome.storage.local.get("survey0",function(n){n.survey0&&$
("#survey").hide()}),$("#survey").click(function()
{chrome.storage.local.set({survey0:!0}),$("#survey").hide()}),$("#connect-
cancel").click(function(){$("#connectModal").modal("hide")}),$("#connect-
network").click(function(){$("#connectModal").modal()}),$
("#login").click(function(){$("#login-line").hide(),$("#logging-in").show(),w(!
0,function(n){if(!n)return g(null,"Error retrieving auth token:
"+chrome.runtime.lastError),$("#login-line").show(),void $("#logging-in").hide();$
("#logging-in").hide(),c()})}),function(){for(var n in s){var e=s[n],t=new Option;$
(t).html(e.name),$("#display-settings").append(t)}}(),u(),function n()
{chrome.storage.local.get(["vysorUsage"],function(n){var e=n.vysorUsage;e||
(e=0);var t=e/36e5;t=Math.round(2*t)/2,console.log("hours used",t),$
("#used").html("You've used Vysor for "+t+" hours.<br/>An advertisement will be
shown every 15 minutes while viewing an Android.<br/><br/>Purchase Vysor Pro to
remove ads and unlock all features.")}),setTimeout(n,36e5)}
(),window.tracker&&tracker.sendAppView("list")});var
h={},v={},y={};chrome.notifications.onButtonClicked.addListener(function(n,e)
{"never-start-automatically"==n?$("#connect-automatically-
select").prop("selectedIndex",2):n.startsWith("never-start-
automatically-")&&1==e&&$("#connect-automatically-
select").prop("selectedIndex",2)}),sharedGlobals.refreshList=function(n,e,t,i,r,s,c
,a,u,w,p){h=n,v=r,y=i,$("#share-all-
check").prop("checked",a),Object.keys(n).length||!w?$("#not-found").hide():$("#not-
found").show(),isElectron()||u&&!w?($("#connect-android").hide(),$("#no-
devices").show()):($("#connect-android").show(),$("#no-devices").hide()),u?($
("#adb-server-status").show(),w?$("#adb-server-status").text("Using built-in Vysor
ADB."):$("#adb-server-status").text("Using Android SDK ADB binary.")):-1!
=navigator.userAgent.indexOf("Windows NT 10")&&null==p?($("#adb-server-
status").show(),$("#adb-server-status").html("Windows 10 users MUST download the
latest <a href='https://adb.clockworkmod.com' target='_blank'> Universal ADB
Drivers</a>")):($("#adb-server-status").show(),$("#adb-server-status").text("ADB
not running. Click Find Devices to get started."));var
k=Object.keys(n),A=Object.keys(y);if($.each($(".vysor-device"),function(e,t){var
i;n[t.name]||($.each(A,function(n,e){var o=y[e];o.devices&&o.devices[t.name]&&(i=!
0)}),i||$(t).remove())}),k.length)$("#no-vysor-devices").remove(),$("#choose-
header").show(),$(k).each(function(t,i){if(!e[i]||!e[i].farm){var
r=n[i],a=r.name,u=$("#devices").find('.vysor-device[name="'+i+'"]');if(!u.length)
{(u=$('<a class="list-group-item vysor-device"><button type="button" class="btn
btn-sm device-settings btn-default"><i class="fa fa-gear" title="Device
Settings"></i></button><button type="button" class="btn btn-sm wireless btn-
default"><i class="fa fa-wifi" title="Go Wireless"></i></button><button
type="button" class="btn btn-sm share btn-default">Share</button><button
type="button" class="btn btn-sm btn-success">View</button><img class="avatar img-
rounded"></img><h5 class="list-group-item-heading friendly-name"></h5><p
class="list-group-item-text serialno"></p></a>'))[0].name=i;var y=u.find(".share");
(p=u.find("img")).click(function(n){n.stopPropagation();var
e=v[i].userInfo;m(e.picture,function(n){g("Vysor Share","Device in use by
"+e.name)})}),u.find(".wireless").click(l("Go Wireless",function(n)
{n.stopPropagation(),startWireless(i)},function(n){n.stopPropagation()})),e[i]?($
(y).removeClass("btn-default").addClass("btn-
danger"),y.text("Disconnect"),y.click(function(n)
{n.stopPropagation(),disconnectSharedDevice(i)})):($(y).removeClass("btn-
danger").addClass("btn-default"),y.click(l("Vysor Share",function(n)
{n.stopPropagation(),toggleShare(i,function(n,e){if(e)g("Vysor
Share",e);else{d(n),chrome.runtime.getManifest().name,g("Vysor Share","Copied Vysor
Share URL to clipboard");var
t=c[i];t&&closeWindow(t),closeWindow(i)}})},function(n){n.stopPropagation()}))),$
(u).find(".device-settings").click(function(n)
{n.stopPropagation(),f(i,a)}),u.click(function(){var
n=h[i];if("unauthorized"==n.status)g(null,'Check your Android device and accept the
"Allow USB Debugging" prompt. You may need to disconnect and reconnect your Android
for the dialog to show.');else if("offline"==n.status)g(null,"Your Android USB
connection is offline. Please try rebooting your Android.");else{function e()
{tracker.sendEvent("click-device",a);var
n=c[i];n&&closeWindow(n),openWindow(i)}if(v[i])return void b({title:"Android In
Use",body:"This Android is currently shared. Do you want to end the share
session?",okButton:"Unshare and View",ok:function(){var
n=c[i];n&&unshareDevice(n),unshareDevice(i),e()}});e()}}),-1!=i.indexOf(":")?
u.find(".wireless").hide():u.find(".wireless").show(),u.find(".serialno").text("Ser
ial: "+i),$("#devices").append(u)}o(i,function(n){var e=n.friendlyName||
a;"unauthorized"==r.status&&(e="Unauthorized"),"offline"==r.status&&(e="Offline"),S
(i,e)});var w=s[i];w&&n[w]?u.hide():u.show(),y=u.find(".share");var
p=u.find("img");if(v[i]&&v[i].userInfo&&v[i].userInfo.picture){var
k=v[i].userInfo;p.attr("alt","Device in use by "+k.name),m(k.picture,function(n)
{p.attr("src",n)}),p.show()}else p.hide();e[i]||(v[i]?
y.text("Unshare"):y.text("Share"))}});else{var D=$("#devices").find("#no-vysor-
devices");D.length||(D=$('<a id="no-vysor-devices"
href="https://support.vysor.io/support/technical/notfound/" target="_blank"><div
class="alert alert-danger">No devices found. Make sure Android USB Debugging is
enabled.</div></a>'),$("#devices").append(D)),u&&!w||($("#choose-
header").hide(),D.hide())}$.each($(".vysor-farm"),function(n,e){y[e.name]||$
(e).remove()}),$(A).each(function(n,e){var
i=l;"117634581230601031713"==e&&(i=function(n,e){return e});var
r=y[e];if(r.devices){var s=Object.keys(r.devices);if(s.length){var c=$("#farms-
list").find("#farm-list-"+e);if(!c.length){var a=$("<h5 class='list-header vysor-
farm'>"+r.info.name+"'s Shared Devices <button class='btn btn-danger btn-xs'
style='float: right;' type='button'>Disconnect</button></h5>");a[0].name=e,$
("#farms-list").append(a),a.find("button").click(function()
{destroyDeviceFarmConnection(e)}),(c=$("<div class='vysor-farm list-
group'></div>"))[0].name=e,c.attr("id","farm-list-"+e),$("#farms-list").append(c)}$
(s).each(function(n,s){var a,u=r.devices[s].name;a=r.gcmConn.gcmConns[s]?"Serial:
"+r.gcmConn.gcmConns[s].serialno:"Remote Serial: "+s;var l=$("#farms-
list").find('.vysor-device[name="'+s+'"]');if(!l.length){function h(n){var
i=y[e];if(i.sharedDevices&&i.sharedDevices[s]&&i.sharedDevices[s].userInfo)
{if(i.sharedDevices[s].userInfo.id==t.id)return void n();b({title:"Android In
Use",body:"This Android is currently in use by "+i.sharedDevices[s].userInfo.name+"
("+i.sharedDevices[s].userInfo.email+"). Do you want to boot them
off?",okButton:"Connect Anyways",ok:n})}else n()}(l=$('<a class="list-group-item
vysor-device"><button type="button" class="btn btn-sm device-settings btn-
default"><i class="fa fa-gear" title="Device Settings"></i></button><button
type="button" class="btn btn-sm connect"></button><button type="button" class="btn
btn-sm btn-success">View</button><img class="avatar img-rounded"></img><h5
class="list-group-item-heading friendly-name"></h5><p class="list-group-item-text
serialno"></p></a>'))[0].name=s,l.find(".device-settings").click(function(n)
{n.stopPropagation(),f(s,u)}),l.find(".connect").click(i("Vysor Share",function(n)
{var t=y[e];n.stopPropagation();var i=t.gcmConn.gcmConns[s];i?
(closeWindow(i.serialno),i.destroy(),l.find(".connect").text("Connect")):h(function
(){l.find(".connect").text("Disconnect"),createDeviceFarmConnection(e,s,function(n)
{quietSerial(n)})})},function(n){n.stopPropagation()})),l.click(i("Vysor
Share",function(n){var t=y[e];h(function(){var n=t.gcmConn.gcmConns[s];n?
openWindow(n.serialno):
(l.find(".connect").text("Connect"),openWindow(s),createDeviceFarmConnection(e,s,fu
nction(n){openWindow(n)}))})},function(n){n.stopPropagation()})),
(d=l.find("img")).click(function(n){n.stopPropagation(),g("Vysor Share","Device in
use by "+y[e].sharedDevices[s].userInfo.name)}),o(s,function(n)
{n.friendlyName,S(s,n.friendlyName||
u)}),l.find(".serialno").text(a),c.append(l)}var
d=l.find("img");if(r.sharedDevices&&r.sharedDevices[s]&&r.sharedDevices[s].userInfo
){var v=r.sharedDevices[s].userInfo;d.attr("alt","Device in use by
"+v.name),m(v.picture,function(n){d.attr("src",n)}),d.show()}else
d.hide();r.gcmConn.gcmConns[s]?
l.find(".connect").text("Disconnect").removeClass("btn-default").addClass("btn-
danger"):l.find(".connect").text("Connect").removeClass("btn-
danger").addClass("btn-default")})}}})}}
(),sharedGlobals.showModal=b,sharedGlobals.shortModal=g,sharedGlobals.updateVysorSh
areServer=p,sharedGlobals.findDeviceElement=k,sharedGlobals.updateDeviceName=S}
("undefined"==typeof window?window={}:window);

You might also like