-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
27 lines (27 loc) · 1.38 KB
/
popup.js
File metadata and controls
27 lines (27 loc) · 1.38 KB
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
document.addEventListener('DOMContentLoaded', function () {
chrome.storage.sync.get(['h_bookmarks'], function(items) {
let bookmarks = JSON.parse(items.h_bookmarks).bookmarks;
document.getElementById("option_btn").addEventListener("click", function () {
chrome.tabs.create({ url: "options.html" });
});
let prepare_content = "";
for (i in bookmarks) {
let image_src = "https://t.nhentai.net/galleries/" + bookmarks[i].media_id + "/cover." + (bookmarks[i].cover_type === "p" ? "png" : "jpg");
prepare_content += '<tr id="content_data_'+bookmarks[i].id+'" class="clicker">' +
' <td>' +
' <center>['+bookmarks[i].id+']</center><img class="cover" src="'+image_src+'">' +
' </td>' +
' <td>' +
' <img class="delete_btn" alt="Delete '+bookmarks[i].id+'" src="times.png">' +
' '+bookmarks[i].title_jp+' <br>' + bookmarks[i].title_en +
' </td>' +
'</tr>'
}
document.getElementById("content").innerHTML = prepare_content;
for (i in bookmarks) {
document.getElementById("content_data_" + bookmarks[i].id).addEventListener("click", function () {
window.open("https://nhentai.net/g/"+ bookmarks[i].id, "_blank");
});
}
});
}, false);