diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2010-11-07 19:45:54 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2010-11-07 19:45:54 -0500 |
commit | 9f1d478364393531d79945cd98ffdfe8c5ea18cc (patch) | |
tree | dd5517b86c04b309a9d0aef572304ed2de182f60 /coverage/htmlfiles/coverage_html.js | |
parent | 5d1f2dd20c32e77c7b95262715b81f9d9b157984 (diff) | |
download | python-coveragepy-9f1d478364393531d79945cd98ffdfe8c5ea18cc.tar.gz |
Hotkeys for the HTML report.
Diffstat (limited to 'coverage/htmlfiles/coverage_html.js')
-rw-r--r-- | coverage/htmlfiles/coverage_html.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/coverage/htmlfiles/coverage_html.js b/coverage/htmlfiles/coverage_html.js index f9ba3cf..a351925 100644 --- a/coverage/htmlfiles/coverage_html.js +++ b/coverage/htmlfiles/coverage_html.js @@ -2,6 +2,20 @@ coverage = {}; +// Find all the elements with shortkey_* class, and use them to assign a shotrtcut key. +coverage.assign_shortkeys = function() { + $("*[class*='shortkey_']").each(function(i, e) { + console.log(i, e); + $.each($(e).attr("class").split(" "), function(i, c) { + if (/^shortkey_/.test(c)) { + $(document).bind('keydown', c.substr(9), function() { + $(e).click(); + }); + } + }); + }); +} + // Loaded on index.html coverage.index_ready = function($) { // Look for a cookie containing previous sort settings: @@ -59,6 +73,8 @@ coverage.index_ready = function($) { headers: headers }); + coverage.assign_shortkeys(); + // Watch for page unload events so we can save the final sort settings: $(window).unload(function() { document.cookie = cookie_name + "=" + sort_list.toString() + "; path=/" @@ -73,6 +89,8 @@ coverage.pyfile_ready = function($) { if (frag.length > 2 && frag[1] == 'n') { $(frag).addClass('highlight'); } + + coverage.assign_shortkeys(); } coverage.toggle_lines = function(btn, cls) { |