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/SegmentEditor/javascripts | |
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/SegmentEditor/javascripts')
-rw-r--r-- | plugins/SegmentEditor/javascripts/Segmentation.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/SegmentEditor/javascripts/Segmentation.js b/plugins/SegmentEditor/javascripts/Segmentation.js index 88596ea184..5dc1cf1f80 100644 --- a/plugins/SegmentEditor/javascripts/Segmentation.js +++ b/plugins/SegmentEditor/javascripts/Segmentation.js @@ -7,6 +7,16 @@ Segmentation = (function($) { + Mousetrap.bind('s', function(event) { + if (event.preventDefault) { + event.preventDefault(); + } else { + event.returnValue = false; // IE + } + $('.segmentListContainer .segmentationContainer .title').trigger('click').focus(); + }); + + function preselectFirstMetricMatch(rowNode) { var matchValue = $(rowNode).find('.metricMatchBlock option:first').attr('value'); @@ -227,7 +237,7 @@ Segmentation = (function($) { var html = self.editorTemplate.find("> .listHtml").clone(); var segment, injClass; var listHtml = '<li data-idsegment="" ' + - (self.currentSegmentStr == "" ? " class='segmentSelected' " : "") + (self.currentSegmentStr == "" ? " class='segmentSelected' tabindex='4' " : "") + ' data-definition=""><span class="segname">' + self.translations['SegmentEditor_DefaultAllVisits'] + ' ' + self.translations['General_DefaultAppended'] + '</span></li> '; @@ -276,7 +286,7 @@ Segmentation = (function($) { injClass = 'class="segmentSelected"'; } listHtml += '<li data-idsegment="'+segment.idsegment+'" data-definition="'+ (segment.definition).replace(/"/g, '"') +'" ' - +injClass+' title="'+ getSegmentTooltipEnrichedWithUsername(segment) +'"><span class="segname">'+getSegmentName(segment)+'</span>'; + +injClass+' title="'+ getSegmentTooltipEnrichedWithUsername(segment) +'"><span class="segname" tabindex="4">'+getSegmentName(segment)+'</span>'; if(self.segmentAccess == "write") { listHtml += '<span class="editSegment" title="'+ self.translations['General_Edit'].toLocaleLowerCase() +'"></span>'; } @@ -1420,7 +1430,7 @@ $(document).ready(function() { self.$element.find('a.close').click(); self.forceSegmentReload(''); - + $('.ui-dialog-content').dialog('close'); self.changeSegmentList(self.props.availableSegments); |