-
Notifications
You must be signed in to change notification settings - Fork 0
/
bg.js
43 lines (30 loc) · 1.04 KB
/
bg.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
$( document ).ready(function() {
for (var i = 0; i < localStorage.length; i++){
$('#liste').append("<li class='list-group-item list-group-item-danger' style='width: 420px;''>"+localStorage.getItem(localStorage.key(i))+" <span class='badge'><a id="+localStorage.key(i)+" class='silBtn'>Sil X</a></span></li>");
}
$('#h1Liste').append(" ("+ localStorage.length +")");
$( "#eklebtn" ).click(function() {
var engelli = $("#engelli").val();
if (localStorage.getItem(engelli) != null) {
alert("Eklenmiş!");
location.reload();
return;
}
localStorage.setItem(engelli, engelli);
chrome.storage.local.set({[engelli]:[engelli]});
location.reload();
});
$(".silBtn").click(function() {
var item = this.id;
localStorage.removeItem(item);
chrome.storage.local.remove(item, function() {});
location.reload();
});
$("#silHepsiBtn").click(function() {
if (confirm('Hepsini sil?')) {
localStorage.clear();
chrome.storage.local.clear();
location.reload();
}
});
});