Whenever the number of results for quicksearch reach 10, an entry is added to the quicksearch to show that more results exist and allow user to clic and go to the Search page
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
// Select next result on "Down"\r
case 40:\r
if(currentIndex < currentTable.find("tr").length - 1) {\r
// Select next result on "Down"\r
case 40:\r
if(currentIndex < currentTable.find("tr").length - 1) {\r
+ if($(currentTable.find("tr")[currentIndex + 1]).hasClass("overflow")) {\r
+ break;\r
+ }\r
$(currentTable.find("tr")[currentIndex]).removeClass("activeSearchResult");\r
currentIndex++;\r
$(currentTable.find("tr")[currentIndex]).addClass("activeSearchResult");\r
$(currentTable.find("tr")[currentIndex]).removeClass("activeSearchResult");\r
currentIndex++;\r
$(currentTable.find("tr")[currentIndex]).addClass("activeSearchResult");\r
if($("#search").val().length == 0)\r
return false\r
\r
if($("#search").val().length == 0)\r
return false\r
\r
- window.location = "full-index.html#q=" + $("#search").val();\r
- if(window.location.href.indexOf("full-index.html") > -1) {\r
+ window.location = "search.html#q=" + $("#search").val();\r
+ if(window.location.href.indexOf("search.html") > -1) {\r
location.reload();\r
} \r
return false;\r
location.reload();\r
} \r
return false;\r
\r
var index = 0;\r
var regexp = new RegExp("^" + query, "i");\r
\r
var index = 0;\r
var regexp = new RegExp("^" + query, "i");\r
for(var entry in entries) {\r
for(var entry in entries) {\r
- if(index > 10) {\r
- break;\r
- }\r
var result = entry.match(regexp);\r
if(result != null) {\r
for(var i = 0; i < entries[entry].length; i++) {\r
if(index > 10) {\r
var result = entry.match(regexp);\r
if(result != null) {\r
for(var i = 0; i < entries[entry].length; i++) {\r
if(index > 10) {\r
break;\r
}\r
currentTable.append(\r
break;\r
}\r
currentTable.append(\r
+ if(overflow > 0) {\r
+ currentTable.append(\r
+ $("<tr class='overflow'>")\r
+ .append(\r
+ $("<td colspan='2'>")\r
+ .append(\r
+ $("<a href='#' title='Show all results' data-query='"+ query +"'>" + overflow + " more results for '" + query + "'</a>")\r
+ .click(function() {\r
+ window.location = "search.html#q=" + $(this).attr("data-query");\r
+ if(window.location.href.indexOf("search.html") > -1) {\r
+ location.reload();\r
+ }\r
+ })\r
+ )\r
+ )\r
+ );\r
+ }\r
\r
// Initialize table properties\r
currentTable.attr("id", "searchTable");\r
\r
// Initialize table properties\r
currentTable.attr("id", "searchTable");\r
text-align: right;\r
}\r
\r
text-align: right;\r
}\r
\r
+#searchTable tr.overflow td {\r
+ text-align: center;\r
+ background-color: #E0E0E0;\r
+}\r
+\r
textarea {\r
margin: 10px;\r
font-family: monospace;\r
textarea {\r
margin: 10px;\r
font-family: monospace;\r