| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /////////////////////////////////////////////////////////////////////////////// | 5 /////////////////////////////////////////////////////////////////////////////// |
| 6 // Helper functions | 6 // Helper functions |
| 7 function $(o) {return document.getElementById(o);} | 7 function $(o) {return document.getElementById(o);} |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Sets the display style of a node. | 10 * Sets the display style of a node. |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 } | 568 } |
| 569 | 569 |
| 570 function clearAll() { | 570 function clearAll() { |
| 571 fifo_results.length = 0; | 571 fifo_results.length = 0; |
| 572 downloads.clear(); | 572 downloads.clear(); |
| 573 downloads.setSearchText(''); | 573 downloads.setSearchText(''); |
| 574 chrome.send('clearAll', []); | 574 chrome.send('clearAll', []); |
| 575 return false; | 575 return false; |
| 576 } | 576 } |
| 577 | 577 |
| 578 function openDownloadsFolder() { |
| 579 chrome.send('openDownloadsFolder'); |
| 580 return false; |
| 581 } |
| 582 |
| 578 /////////////////////////////////////////////////////////////////////////////// | 583 /////////////////////////////////////////////////////////////////////////////// |
| 579 // Chrome callbacks: | 584 // Chrome callbacks: |
| 580 /** | 585 /** |
| 581 * Our history system calls this function with results from searches or when | 586 * Our history system calls this function with results from searches or when |
| 582 * downloads are added or removed. | 587 * downloads are added or removed. |
| 583 */ | 588 */ |
| 584 function downloadsList(results) { | 589 function downloadsList(results) { |
| 585 if (resultsTimeout) | 590 if (resultsTimeout) |
| 586 clearTimeout(resultsTimeout); | 591 clearTimeout(resultsTimeout); |
| 587 fifo_results.length = 0; | 592 fifo_results.length = 0; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 615 if (Date.now() - start > 50) { | 620 if (Date.now() - start > 50) { |
| 616 clearTimeout(resultsTimeout); | 621 clearTimeout(resultsTimeout); |
| 617 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); | 622 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); |
| 618 break; | 623 break; |
| 619 } | 624 } |
| 620 } | 625 } |
| 621 } | 626 } |
| 622 | 627 |
| 623 // Add handlers to HTML elements. | 628 // Add handlers to HTML elements. |
| 624 document.body.onload = load; | 629 document.body.onload = load; |
| 630 |
| 625 var clearAllLink = $('clear-all'); | 631 var clearAllLink = $('clear-all'); |
| 626 clearAllLink.onclick = function () { clearAll(''); }; | 632 clearAllLink.onclick = function () { clearAll(''); }; |
| 627 clearAllLink.oncontextmenu = function() { return false; }; | 633 clearAllLink.oncontextmenu = function() { return false; }; |
| 628 | 634 |
| 635 var openDownloadsFolderLink = $('open-downloads-folder'); |
| 636 openDownloadsFolderLink.onclick = openDownloadsFolder; |
| 637 openDownloadsFolderLink.oncontextmenu = function() { return false; }; |
| 638 |
| 629 $('search-link').onclick = function () { | 639 $('search-link').onclick = function () { |
| 630 setSearch(''); | 640 setSearch(''); |
| 631 return false; | 641 return false; |
| 632 }; | 642 }; |
| 633 $('search-form').onsubmit = function () { | 643 $('search-form').onsubmit = function () { |
| 634 setSearch(this.term.value); | 644 setSearch(this.term.value); |
| 635 return false; | 645 return false; |
| 636 }; | 646 }; |
| 637 | |
| OLD | NEW |