-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive_list.js
59 lines (43 loc) · 1.44 KB
/
archive_list.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var DEBUG=true;
$(document).ready( function()
{
chrome.storage.sync.get( null, function (items)
{
$(".list").html("");
$(".list").append("<table></table>")
console.log('created table');
var i=0;
for (var k in items)
{
var id,href,title;
text = items[k]['text'];
title = items[k]['title'];
href= items[k]['href'];
var tableentry = $(".list > table");
// if(text)
// tableentry.append("<tr><td><a target='_blank' href='" + href + "' >" + title: +text+"</a></td><td><a href='#'><img src='delete.png' alt='DELETE' id='picture' /></a></td></tr>");
// else
tableentry.append("<tr class='footer'><td ><a target='_blank' href='" + href + "' >"+title+"<div style='color:black'>"+text+"</div></a></td><td><a href='#'><img src='delete.png' alt='DELETE' id='picture' /></a></td></tr>");
tableentry.append("</hr>");
i++;
}
if(i==0)
{
$(".list").html("");
$(".list").append("<div class='default'>Archive list is empty!</div>");
}
$('.list').on('click', 'img' ,function(event)
{
var delRow=$(this).parent().parent().parent().eq(0);
var url=delRow.children("td").eq(0).find("a").attr("href");
chrome.storage.sync.remove(url);
delRow.remove();
});
});
$("#clr").click(function(){
chrome.storage.sync.clear();
$(".list").html("");
$(".list").append("<div class='default'>Archive list is empty!</div>")
updateList();
});
});