Uh oh!
There was an error while loading. Please reload this page.
forked from barbushin/javascript-errors-notifier
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.js
More file actions
Latest commit
54 lines (49 loc) · 972 Bytes
/
Copy pathcommon.js
File metadata and controls
54 lines (49 loc) · 972 Bytes
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
varrequest=parseUrl(window.location.href);
varisIFrame=window.top!=window;
functionparseUrl(url){
varparams={};
varquery=/\?(.*)/.exec(url);
if(query){
varkvPairs=query[1].split('&');
for(variinkvPairs){
varkv=kvPairs[i].split('=');
params[decodeURIComponent(kv[0])]=decodeURIComponent(kv[1]);
}
if(params.tabId){
params.tabId=+params.tabId;
}
}
returnparams;
}
functionsendMessage(data){
data._fromJEN=true;
if(isIFrame){
window.top.postMessage(data,'*');
}
elseif(request.tabId){
chrome.tabs.sendMessage(request.tabId,data);
}
}
functionautoSize(){
if(isIFrame){
sendMessage({
_resize: true,
width: document.body.scrollWidth+10,
height: document.body.scrollHeight+15
},'*');
}
}
functionclosePopup(clear){
sendMessage({
_closePopup: true
});
if(clear){
sendMessage({
_clear: true
});
}
if(!isIFrame){
window.close();
}
}
window.onload=autoSize;