1
- {% extends "right -aside.html" %}
1
+ {% extends "left -aside.html" %}
2
2
3
3
{% import "macros/command.html" as commands %}
4
4
12
12
{% set commands_entries = [] %}
13
13
<!-- command search box -->
14
14
< div class ="search-container ">
15
+ < label > Search Commands:</ label >
15
16
< input type ="text " id ="search-box " placeholder ="Search commands... " onkeyup ="searchCommands() " />
16
17
</ div >
17
18
19
+ <!-- No results message -->
20
+ < div id ="no-results-message " class ="no-results-message " style ="display: none; ">
21
+ < span > </></ span >
22
+ < h4 > We couldn't find any results matching your search</ h4 >
23
+ < p > Check your spelling or try different keywords</ p >
24
+ </ div >
25
+
18
26
{% for page in section.pages %}
19
27
{% for json_path in [
20
28
commands::command_json_path(slug=page.slug),
44
52
45
53
{% for command_group_name, command_group in grouped %}
46
54
< div class ="command-group ">
47
- {% set command_group_description_name = command_group_name | replace(from="_", to="-") %}
48
- < h2 id ="{{command_group_description_name}} "> {{ group_descriptions[command_group_description_name].display }}</ h2 >
49
- < div class ="command-group-meta ">
50
- < p > < small > {{ group_descriptions[command_group_description_name].description }}</ small > </ p >
51
- < hr />
52
- </ div >
53
- {% for entry in command_group | sort(attribute="0") %}
54
- < div class ="command-entry "> < code > < a href ="{{ entry[1] }} "> {{ entry[0] }}</ a > </ code > {{entry[2]}}</ div >
55
- {% endfor %}
56
- < div class ="command-group-meta ">
57
- < small > < a href ="#top "> Back to top</ a > </ small >
58
- </ div >
55
+ {% set command_group_description_name = command_group_name | replace(from="_", to="-") %}
56
+ < h2 id ="{{command_group_description_name}} "> {{ group_descriptions[command_group_description_name].display }}
57
+ < span > {{ group_descriptions[command_group_description_name].description }}</ span >
58
+ </ h2 >
59
+ {% for entry in command_group | sort(attribute="0") %}
60
+ < div class ="command-entry "> < code > < a href ="{{ entry[1] }} "> {{ entry[0] }}</ a > </ code > {{entry[2]}}</ div >
61
+ {% endfor %}
62
+ < div class ="command-group-meta ">
63
+ < small > < a href ="#top "> Back to top</ a > </ small >
64
+ </ div >
59
65
</ div >
60
66
{% endfor %}
61
67
62
68
< script >
63
69
function searchCommands ( ) {
64
70
var input = document . getElementById ( "search-box" ) . value . toLowerCase ( ) ;
65
71
var groups = document . querySelectorAll ( ".command-group" ) ;
72
+ var noResultsMessage = document . getElementById ( "no-results-message" ) ;
73
+ var totalVisible = 0 ;
66
74
67
75
groups . forEach ( function ( group ) {
68
76
var items = group . querySelectorAll ( ".command-entry" ) ;
@@ -72,12 +80,16 @@ <h2 id="{{command_group_description_name}}">{{ group_descriptions[command_group_
72
80
if ( text . includes ( input ) ) {
73
81
item . style . display = "" ;
74
82
found = true ;
83
+ totalVisible ++ ;
75
84
} else {
76
85
item . style . display = "none" ;
77
86
}
78
87
} ) ;
79
88
group . style . display = found ? "" : "none" ;
80
89
} ) ;
90
+
91
+ // Show/hide no results message based on search results
92
+ noResultsMessage . style . display = totalVisible === 0 ? "block" : "none" ;
81
93
}
82
94
</ script >
83
95
@@ -86,34 +98,6 @@ <h2 id="{{command_group_description_name}}">{{ group_descriptions[command_group_
86
98
document . getElementById ( "search-box" ) . focus ( ) ;
87
99
} ) ;
88
100
</ script >
89
-
90
- < style >
91
- .search-container {
92
- margin : 20px 0 ;
93
- text-align : center;
94
- }
95
-
96
- # search-box {
97
- width : 60% ;
98
- padding : 10px ;
99
- font-size : 16px ;
100
- border : 2px solid # ddd ;
101
- border-radius : 4px ;
102
- box-shadow : 0 0 5px rgba (0 , 0 , 0 , 0.1 );
103
- transition : border-color 0.3s ease, box-shadow 0.3s ease;
104
- }
105
-
106
- # search-box : focus {
107
- border-color : # 007bff ;
108
- box-shadow : 0 0 5px rgba (0 , 123 , 255 , 0.5 );
109
- }
110
-
111
- # search-box ::placeholder {
112
- color : # aaa ;
113
- font-style : italic;
114
- }
115
- </ style >
116
-
117
101
{% endblock main_content %}
118
102
119
103
{% block related_content %}
@@ -138,5 +122,7 @@ <h2>Alphabetical Command List</h2>
138
122
139
123
140
124
{% block subhead_content %}
141
- < h1 class ="page-title "> Documentation: Command Reference</ h1 >
125
+ < div class ="styled-title ">
126
+ < h1 > Documentation: Command Reference</ h1 >
127
+ </ div >
142
128
{% endblock subhead_content %}
0 commit comments