Last active
August 29, 2015 13:57
-
-
Save silphire/9561997 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function show_visits(url, tbody) | |
{ | |
var visit_keys = [ "id", "visitId", "visitTime", "referringVisitId", "transition" ]; | |
chrome.history.getVisits({ | |
"url": url, | |
}, function(visits) { | |
// clear previous result | |
while(tbody.firstChild) { | |
tbody.removeChild(tbody.firstChild); | |
} | |
for(var i = 0; i < visits.length; ++i) { | |
var tr = document.createElement("tr"); | |
for(var j = 0; j < visit_keys.length; ++j) { | |
var column = document.createElement("td"); | |
column.appendChild(document.createTextNode(visits[i][visit_keys[j]])); | |
tr.appendChild(column); | |
} | |
tbody.appendChild(tr); | |
} | |
}) | |
} | |
window.onload = function() { | |
var search_button = document.getElementById("search_button"); | |
search_button.addEventListener("click", function(event) { | |
var url = document.getElementById("search_url").value; | |
if(url) { | |
show_visits(url, document.getElementById("history_list")); | |
} | |
}); | |
} | |
})(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version" : 2, | |
"name" : "show history", | |
"description" : "study of chrome history", | |
"version" : "0.1", | |
"permissions" : [ | |
"history" | |
], | |
"options_page" : "options.html" | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<title>履歴一覧</title> | |
<script src="get_history.js"></script> | |
<body> | |
<form> | |
<input type="text" id="search_url"> | |
<input type="button" id="search_button" value="取得"> | |
</form> | |
<table border="1"> | |
<thead> | |
<tr> | |
<th>id</th> | |
<th>visitId</th> | |
<th>visitTime</th> | |
<th>referringVisitId</th> | |
<th>transition</th> | |
</tr> | |
</thead> | |
<tbody id="history_list"> | |
<tbody> | |
</table> | |
</body> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment