-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpopup.js
35 lines (25 loc) · 876 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
34
35
document.addEventListener('DOMContentLoaded', function () {
populate_list();
});
function populate_list() {
var lastLinks = chrome.extension.getBackgroundPage().getLast();
var input = document.getElementById("list");
lastLinks.forEach( function ( tab ){
var item = document.createElement("div");
item.className = "tab";
link = document.createElement("a");
link.href = tab.url;
link.target = "_blank";
var img = document.createElement("div");
img.setAttribute("style", "height:16; width: 16; background-image: url(chrome://favicon/"+link.protocol+"//"+link.hostname + ");");
img.className = "favicon"
link.innerText = tab.title;
var host = document.createElement("div");
host.innerText = link.hostname;
host.className = "host";
item.appendChild(img);
item.appendChild(link);
item.appendChild(host);
input.appendChild(item);
});
}