-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
40 lines (34 loc) · 1.12 KB
/
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
34
35
36
37
38
39
40
function copyTabs(e) {
chrome.runtime.sendMessage({
from: 'popup',
subject: 'saveTabsList'
});
window.close();
}
function loadTabs(e) {
document.getElementById("menu").style.display = "none";
document.getElementById("urls").style.display = "block";
var width = document.getElementById("urls").offsetWidth;
var height = document.getElementById("urls").offsetHeight;
document.body.style.width = '' + width + 'px';
document.body.style.height = '' + height + 'px';
var input = document.getElementById('urls-str');
input.focus();
input.select();
}
function doLoading(e) {
var text = document.getElementById("urls-str").value;
var strs = text.split(/\r?\n/);
strs.forEach(function(str) {
str = str.trim();
if (str && !str.startsWith("#")) {
chrome.tabs.create({ url: str });
}
});
window.close();
}
document.addEventListener('DOMContentLoaded', function () {
document.getElementById("copy").addEventListener('click', copyTabs);
document.getElementById("load").addEventListener('click', loadTabs);
document.getElementById("do-load").addEventListener('click', doLoading);
});