-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
42 lines (37 loc) · 1.33 KB
/
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
36
37
38
39
40
41
42
document.addEventListener('DOMContentLoaded', function() {
document.getElementById("heading").style.display="none";
document.getElementById('note').value = localStorage['note'];
}, false);
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('note').addEventListener('keydown', saveNote);
});
function saveNote () {
var note = document.getElementById('note').value;
localStorage['note'] = note;
}
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('searchbutton').addEventListener('click', swapper);
});
function swapper(){
document.getElementById("heading").style.display="inline";
var c = document.getElementById("search").value;
var a = new Array();
chrome.history.search({
'text': c, // Return every history item....
'startTime': 1000000000, // that was accessed less than one week ago.
'maxResults': 100 // Optionally state a limit
},
function(historyItems) {
for (var i = 0; i < historyItems.length; ++i){
var date = (historyItems[i].lastVisitTime)+"";
var d = new Date(parseInt(date, 10));
var ds = d.toString('MM/dd/yy HH:mm:ss');
a.push(historyItems[i].url+" "+" Last Visited:- "+ds);
}
for (var j=0; j<a.length; ++j){
var z = document.createElement("P");
z.innerText = a[j];
document.body.appendChild(z);
}
})
}