-
Notifications
You must be signed in to change notification settings - Fork 7
/
popup.js
33 lines (25 loc) · 873 Bytes
/
popup.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
document.addEventListener('DOMContentLoaded', function () {
var popupWindow;
var browser = chrome;
chrome.storage.sync.get(null, function (items) {
var width = 400;
if (typeof items.windowWidth == "number") {
width = items.windowWidth;
}
browser.windows.getCurrent(function (win) {
browser.tabs.query({windowId: win.id, active: true}, function (tabs) {
var tab = tabs[0];
chrome.windows.create({
'url': browser.runtime.getURL("app.html") + "?" + win.id,
'type': 'popup',
'focused': true,
'width': width,
'height': (win.height - 10),
'left': window.screenLeft,
'top': (window.screenTop - 70)
});
window.close(); // close the Chrome extension pop-up
});
});
});
}, false);