-
Notifications
You must be signed in to change notification settings - Fork 5
/
updateList.js
37 lines (34 loc) · 1.01 KB
/
updateList.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
var DEBUG=true;
$(document).ready( function()
{
chrome.storage.sync.get( null, function (items)
{
$(".lst").html("");
$(".lst").append("<table></table>")
var i=0;
for (var k in items)
{
var id,href,title;
id = items[k]['id'];
title = items[k]['title'];
href= items[k]['href'];
var tableentry = $(".lst > table");
tableentry.append("<tr><td><a target='_blank' href='" + href + "' >" + id+ "</a></td><td><a target='_blank' href='" + href + "' >" + title+ "</a></td><td><a href='#'><img src='delete.png' alt='DELETE' id='picture' /></a></td></tr>");
i++;
}
if(i==0)
{
$(".lst").html("");
$(".lst").append("Nothing to show :( <br>\
Open a problem page and click on CodeLater to add it \
to the list.")
}
$('.lst').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();
});
});
});