Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: pkg/dartdoc/lib/src/client/dropdown.dart

Issue 11045019: Change find-as-you-type shortcuts to Ctrl+3 and S. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/dartdoc/lib/src/client/client-static.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 List libraryList; 5 List libraryList;
6 InputElement searchInput; 6 InputElement searchInput;
7 DivElement dropdown; 7 DivElement dropdown;
8 8
9 /** 9 /**
10 * Update the search drop down based on the current search text. 10 * Update the search drop down based on the current search text.
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 /** Used to prevent hiding the drop down when it is clicked. */ 315 /** Used to prevent hiding the drop down when it is clicked. */
316 bool hideDropDownSuspend = false; 316 bool hideDropDownSuspend = false;
317 317
318 /** Hide the search drop down unless suspended. */ 318 /** Hide the search drop down unless suspended. */
319 void hideDropDown() { 319 void hideDropDown() {
320 if (hideDropDownSuspend) return; 320 if (hideDropDownSuspend) return;
321 321
322 dropdown.style.visibility = 'hidden'; 322 dropdown.style.visibility = 'hidden';
323 } 323 }
324 324
325 /** Activate search on Ctrl+F and F3. */ 325 /** Activate search on Ctrl+3 and S. */
326 void shortcutHandler(KeyboardEvent event) { 326 void shortcutHandler(KeyboardEvent event) {
327 if (event.keyCode == 0x46/*F*/ && event.ctrlKey || 327 if (event.keyCode == 0x33/* 3 */ && event.ctrlKey ||
328 event.keyIdentifier == KeyName.F3) { 328 event.keyCode == 0x53/* S */) {
329 searchInput.focus(); 329 searchInput.focus();
330 event.preventDefault(); 330 event.preventDefault();
331 } 331 }
332 } 332 }
333 333
334 /**
335 * Setup window shortcuts.
336 */
337 void setupShortcuts() {
338 window.on.keyDown.add(shortcutHandler);
339 }
340
334 /** Setup search hooks. */ 341 /** Setup search hooks. */
335 void setupSearch(var libraries) { 342 void setupSearch(var libraries) {
336 libraryList = libraries; 343 libraryList = libraries;
337 searchInput = query('#q'); 344 searchInput = query('#q');
338 dropdown = query('#drop-down'); 345 dropdown = query('#drop-down');
339 346
340 searchInput.on.keyDown.add(handleUpDown); 347 searchInput.on.keyDown.add(handleUpDown);
341 searchInput.on.keyUp.add(updateDropDown); 348 searchInput.on.keyUp.add(updateDropDown);
342 searchInput.on.change.add(updateDropDown); 349 searchInput.on.change.add(updateDropDown);
343 searchInput.on.reset.add(updateDropDown); 350 searchInput.on.reset.add(updateDropDown);
344 searchInput.on.focus.add((event) => showDropDown()); 351 searchInput.on.focus.add((event) => showDropDown());
345 searchInput.on.blur.add((event) => hideDropDown()); 352 searchInput.on.blur.add((event) => hideDropDown());
346 window.on.keyDown.add(shortcutHandler);
347 } 353 }
OLDNEW
« no previous file with comments | « pkg/dartdoc/lib/src/client/client-static.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698