Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

Commit

Permalink
fix endTime issue in chrome.history.search
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Oct 4, 2016
1 parent dcd3658 commit 68db4ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
10 changes: 7 additions & 3 deletions assets/js/details.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
function showHistory(histories) {
function showHistory(histories, start, end) {
var details = $("#details");
histories = _.sortBy(histories, "lastVisitTime");
for(var i=0; i<histories.length; i++) {
if(histories[i].lastVisitTime < start || histories[i].lastVisitTime > end) {
continue;
}
var title = histories[i].title || histories[i].url;
var row = [
`<tr>`,
Expand All @@ -19,13 +22,14 @@ $(function () {
$("#currentDay").html(currentDay);
var start = moment(currentDay, SHOW_FORMAT);
var end = moment(currentDay, SHOW_FORMAT).add('1', 'day');
console.log(start.format(SHOW_FORMAT_SEC), end.format(SHOW_FORMAT_SEC))
// Even if set endTime, there are still some items beyond endTime. bug ??
// so filter again in showHistory
chrome.history.search({
text: "",
startTime: start.valueOf(),
endTime: end.valueOf(),
maxResults: MAX_RESULTS
}, (histories) => {
showHistory(histories);
showHistory(histories, start.valueOf(), end.valueOf());
});
})
6 changes: 3 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Advanced history",
"version": "1.2",
"name": "Advanced History",
"version": "1.3",
"description": "Get a better sense of browsing history",
"homepage_url": "https://github.com/jiacai2050/better-history",
"browser_action": {
Expand All @@ -11,7 +11,7 @@
"64": "assets/img/64.png",
"128": "assets/img/128.png"
},
"default_title": "Better History"
"default_title": "Advanced History"
},
"icons": {
"16": "assets/img/16.png",
Expand Down
5 changes: 3 additions & 2 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

cd $(cd `dirname $0`; pwd)

ZIP_FILE="/tmp/advanced-history.zip"
set -x
ZIP_FILE="${HOME}/Desktop/advanced-history.zip"
if [[ -f $ZIP_FILE ]];then
rm $ZIP_FILE
fi
zip -x *.DS_Store -x *.md -x *sh -r $ZIP_FILE * > /tmp/lll
zip -x *.DS_Store -r $ZIP_FILE manifest.json background.js assets

0 comments on commit 68db4ee

Please sign in to comment.