@@ -61,7 +61,15 @@ $(function(){
61
61
62
62
return 0 ;
63
63
}
64
- $ . each ( items . sort ( sortBy ) , function ( index , item ) {
64
+ var sortedItems = items . sort ( sortBy ) ;
65
+ var keywords = $ ( "#query" ) . val ( ) ;
66
+ sortedItems . push ( {
67
+ category : 'Site Search' ,
68
+ label : "Search the entire site for " + keywords ,
69
+ value : keywords ,
70
+ url : siteSearchUrl ( keywords )
71
+ } ) ;
72
+ $ . each ( sortedItems , function ( index , item ) {
65
73
var li ;
66
74
if ( item . category != currentCategory ) {
67
75
ul . append ( "<li class='ui-autocomplete-category'>" + item . category + "</li>" ) ;
@@ -79,8 +87,7 @@ $(function(){
79
87
if ( ! ui . content . length ) {
80
88
$ ( '#search' ) . addClass ( 'not-found' )
81
89
. find ( '#try-web-search' ) . attr (
82
- 'href' , 'https://www.google.com/search?q=site%3Adocs.perl6.org+'
83
- + encodeURIComponent ( $ ( "#query" ) . val ( ) )
90
+ 'href' , siteSearchUrl ( $ ( "#query" ) . val ( ) )
84
91
) ;
85
92
}
86
93
else {
@@ -194,6 +201,10 @@ $.extend( $.ui.autocomplete, {
194
201
}
195
202
} ) ;
196
203
204
+ function siteSearchUrl ( keywords ) {
205
+ return 'https://www.google.com/search?q=site%3Adocs.perl6.org+' + encodeURIComponent ( keywords ) ;
206
+ }
207
+
197
208
/*
198
209
* Courtesy https://siderite.blogspot.com/2014/11/super-fast-and-accurate-string-distance.html
199
210
*/
0 commit comments