Skip to content

Commit

Permalink
500ms delay to wait search finish when open a url
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Mar 16, 2012
1 parent 2d14586 commit 6135639
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/background/scripts/modules/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ var Tab = (function() {
Post(tab, { action: "Dialog.draw", urls: return_urls, keyword: keyword });
} else {
chrome.bookmarks.search(keyword, function(bookmarks) {
// Search start from 20 days ago
chrome.history.search({text: keyword, maxResults: 30, startTime: (new Date().getTime() - 1000 * 60 * 60 * 24 * 20)}, function(historys) {
// Search start from 10 days ago
chrome.history.search({text: keyword, maxResults: 30, startTime: (new Date().getTime() - 1000 * 60 * 60 * 24 * 10)}, function(historys) {
Post(tab, { action: "Dialog.draw", urls: return_urls.concat(bookmarks.concat(historys)), keyword: keyword });
});
});
Expand Down
10 changes: 7 additions & 3 deletions src/frontend/modules/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ var Dialog = (function() {
openCurrent();
}
if (key == '<Up>') prev();
if (key == '<S-Tab>') prev(10);
if (key == '<Down>') next();
if (key == '<S-Tab>') prev(10);
if (key == '<Tab>') next(10);

KeyEvent.stopPropagation(e);
Expand Down Expand Up @@ -220,11 +220,15 @@ var Dialog = (function() {
if (!keep_open) { stop(); }
}

function open(/*Boolean*/ keep_open) {
setTimeout(openCurrent, 500, keep_open);
}

return {
start : start,
draw : draw,
openCurrent : openCurrent ,
openCurrentNewTab : function() { openCurrent(true) },
openCurrent : open,
openCurrentNewTab : function() { open(true) },
stop : stop
};
})();

0 comments on commit 6135639

Please sign in to comment.