diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/src/templates/index.html | 10 | ||||
| -rw-r--r-- | docs/src/templates/js/docs.js | 15 |
2 files changed, 23 insertions, 2 deletions
diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html index eec2e5a2..3b75207e 100644 --- a/docs/src/templates/index.html +++ b/docs/src/templates/index.html @@ -173,8 +173,14 @@ <li class="divider-vertical"></li> </ul> <form class="navbar-search pull-right" ng-submit="submit()"> - <input type="text" name="as_q" class="search-query" placeholder="Search" ng-change="search(q)" ng-model="q" autocomplete="off"> - <input type="hidden" name="as_sitesearch" value="angularjs.org"> + <input type="text" + name="as_q" + class="search-query" + placeholder="Search" + ng-change="search(q)" + ng-model="q" + docs-search-input + autocomplete="off" /> </form> <div ng-show="hasResults" class="search-results"> <a href="" ng-click="hideResults()" class="search-close"> diff --git a/docs/src/templates/js/docs.js b/docs/src/templates/js/docs.js index 2350e698..63ad31f4 100644 --- a/docs/src/templates/js/docs.js +++ b/docs/src/templates/js/docs.js @@ -138,6 +138,21 @@ docsApp.directive.focused = function($timeout) { }; }; +docsApp.directive.docsSearchInput = function() { + return function(scope, element, attrs) { + var ESCAPE_KEY_KEYCODE = 27; + element.bind('keydown', function(event) { + if(event.keyCode == ESCAPE_KEY_KEYCODE) { + event.stopPropagation(); + event.preventDefault(); + scope.$apply(function() { + scope.hideResults(); + }); + } + }); + }; +}; + docsApp.directive.code = function() { return { restrict:'E', terminal: true }; |
