diff options
author | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-01-22 07:32:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-22 07:32:29 +0300 |
commit | 233142407b3f1d8e2cb8234f6235b3900264419c (patch) | |
tree | 7555cd4e6ba5c687ab57cdac57f40344c1941f59 /plugins/CoreHome/javascripts/calendar.js | |
parent | 111d605c31a7d530bb1082881799a3ad828be8ed (diff) |
Added new keyboard shortcuts (#11252)
* Added new keyboard shortcuts
s for selector
d for calendar
w for site selector
from https://github.com/piwik/piwik/pull/11235
by @CheweyZ
Re-created PR without the conflict on the submodule
* Fix the angular JS test?
* Make site selector search field navigable with keyboard
Diffstat (limited to 'plugins/CoreHome/javascripts/calendar.js')
-rw-r--r-- | plugins/CoreHome/javascripts/calendar.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/CoreHome/javascripts/calendar.js b/plugins/CoreHome/javascripts/calendar.js index a413c9ad5a..fdf58f2cf0 100644 --- a/plugins/CoreHome/javascripts/calendar.js +++ b/plugins/CoreHome/javascripts/calendar.js @@ -100,7 +100,7 @@ var parts = dateStr.split(','); dateStr = parts[0]; } - + var splitDate = dateStr.split('-'); currentYear = splitDate[0]; currentMonth = splitDate[1] - 1; @@ -215,6 +215,7 @@ } }); + } else { // Let broadcast do its job: // It will replace date value to both search query and hash and load the new page. @@ -514,7 +515,7 @@ // Apply date range button will reload the page with the selected range $('#calendarApply') - .on('click', function () { + .on("click", function() { var $selectedPeriod = $('#periodMore [name=period]:checked'); if (!$selectedPeriod.is('#period_id_range')) { @@ -697,4 +698,13 @@ initTopControls(); }); + Mousetrap.bind('d', function(event) { + if (event.preventDefault) { + event.preventDefault(); + } else { + event.returnValue = false; // IE + } + $('#periodString .title').trigger('click').focus(); + }); + }(jQuery)); |