-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwkembed.js
38 lines (34 loc) · 1.04 KB
/
wkembed.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function WKEmbedUI(options) {
var self=this;
this.container = options.container;
this.raToken = options.raToken;
this.refType = "";
this.devid = "";
this.extlink = options.extlink;
var setDeviceReferenceType = function(options) {
if ('publicid' in options === true) {
self.refType = 'publicid';
self.devid= options.publicid;
} else if ('serial' in options === true) {
self.refType = 'serial';
self.devid= options.serial;
}
};
var prepareFrame = function() {
var ifrm = document.createElement("iframe");
params=self.refType+"="+self.devid;
params+="&ratoken="+self.raToken;
params+="&wmode=embed";
if (self.extlink) {
params+="&extlink=disabled";
}
ifrm.setAttribute("src", "https://device.webkeyapp.com/?"+params);
ifrm.style.width = "100%";
ifrm.style.height = "100%";
ifrm.style.minWidth = "400px"
ifrm.style.minHeight = "600px";
document.getElementById(self.container).appendChild(ifrm);
};
setDeviceReferenceType(options);
prepareFrame();
}