File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
opengrok-indexer/src/main/java/org/opengrok/indexer/web
opengrok-web/src/main/webapp/js Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ public String toHtml() {
126
126
SCRIPTS .put ("jquery-tablesorter" , new FileScript ("js/jquery-tablesorter-2.26.6.min.js" , 12 ));
127
127
SCRIPTS .put ("tablesorter-parsers" , new FileScript ("js/tablesorter-parsers-0.0.1.js" , 13 ));
128
128
SCRIPTS .put ("searchable-option-list" , new FileScript ("js/searchable-option-list-2.0.5.min.js" , 14 ));
129
- SCRIPTS .put ("utils" , new FileScript ("js/utils-0.0.23 .js" , 15 ));
129
+ SCRIPTS .put ("utils" , new FileScript ("js/utils-0.0.24 .js" , 15 ));
130
130
SCRIPTS .put ("repos" , new FileScript ("js/repos-0.0.1.js" , 20 ));
131
131
SCRIPTS .put ("diff" , new FileScript ("js/diff-0.0.3.js" , 20 ));
132
132
SCRIPTS .put ("jquery-caret" , new FileScript ("js/jquery.caret-1.5.2.min.js" , 25 ));
Original file line number Diff line number Diff line change @@ -1716,6 +1716,11 @@ function pageReadyMast() {
1716
1716
}
1717
1717
1718
1718
function domReadyMenu ( minisearch ) {
1719
+ if ( getCookie ( 'OpenGrokSuggester.enabled' ) === 'false' ) {
1720
+ console . log ( 'Suggester disabled by a cookie' ) ;
1721
+ return ;
1722
+ }
1723
+
1719
1724
$ . ajax ( {
1720
1725
// cannot use "/api/v1/configuration/suggester" because of security
1721
1726
url : window . contextPath + "/api/v1/suggest/config" ,
@@ -2326,3 +2331,24 @@ function escapeHtml(string) { // taken from https://stackoverflow.com/questions/
2326
2331
return htmlEscapeMap [ s ] ;
2327
2332
} ) ;
2328
2333
}
2334
+
2335
+ /**
2336
+ * Taken from https://www.w3schools.com/js/js_cookies.asp .
2337
+ * @param cname cookie name to retrieve
2338
+ * @returns {string } cookie value
2339
+ */
2340
+ function getCookie ( cname ) {
2341
+ var name = cname + "=" ;
2342
+ var decodedCookie = decodeURIComponent ( document . cookie ) ;
2343
+ var ca = decodedCookie . split ( ';' ) ;
2344
+ for ( var i = 0 ; i < ca . length ; i ++ ) {
2345
+ var c = ca [ i ] ;
2346
+ while ( c . charAt ( 0 ) == ' ' ) {
2347
+ c = c . substring ( 1 ) ;
2348
+ }
2349
+ if ( c . indexOf ( name ) == 0 ) {
2350
+ return c . substring ( name . length , c . length ) ;
2351
+ }
2352
+ }
2353
+ return "" ;
2354
+ }
You can’t perform that action at this time.
0 commit comments