Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fix ConfigPortal jumps to iframe focus add focus parameter to yacysearch.html too

reger4ff018c9e425
diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html
index d3e1987af..754ae2593 100644
--- a/htroot/yacysearch.html
+++ b/htroot/yacysearch.html
@@ -60,7 +60,7 @@
</script>
<style type="text/css">.twitter-typeahead {margin: 0px;padding: 0px;top:2px;}</style> <!-- fix for input window -->
</head>
-<body id="yacysearch" onLoad="document.searchform.query.focus();">
+<body id="yacysearch" #(focus)#::onLoad="document.searchform.query.focus();"#(/focus)#>
#(topmenu)#
#%env/templates/embeddedheader.template%#
@@ -92,7 +92,7 @@ Use the RSS search result format to add static searches to your RSS reader, if y
<form class="search small" name="searchform" action="" method="get" accept-charset="UTF-8" style="position:fixed;top:8px;z-index:1052;max-width:500px;">
<div class="input-group">
- <input type="text" class="form-control searchinput typeahead" size="40" maxlength="200" placeholder="#[promoteSearchPageGreeting]#" name="query" value="#[former]#" autofocus="autofocus" onFocus="this.select()" id="search" onclick="document.getElementById('Enter').innerHTML = 'search'"/>
+ <input type="text" class="form-control searchinput typeahead" size="40" maxlength="200" placeholder="#[promoteSearchPageGreeting]#" name="query" value="#[former]#" #(focus)#::autofocus="autofocus"#(/focus)# onFocus="this.select()" id="search" onclick="document.getElementById('Enter').innerHTML = 'search'"/>
<div class="input-group-btn">
<button id="Enter" class="btn btn-default" type="submit">search</button>
</div>
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 23be97c30..de9b32f98 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -118,7 +118,7 @@ public class yacysearch {
if (authenticated && sb.getThread(SwitchboardConstants.CRAWLJOB_LOCAL_CRAWL).getJobCount() > 0) {
sb.index.fulltext().commit(true);
}
-
+ final boolean focus = (post == null) ? true : post.get("focus", "1").equals("1");
// get query
final String originalquerystring = (post == null) ? "" : post.get("query", post.get("search", "")).trim();
String querystring = originalquerystring.replace('+', ' ').trim();
@@ -867,7 +867,7 @@ public class yacysearch {
prop.put("depth", "0");
}
-
+ prop.put("focus", focus ? 1 : 0); // focus search field
prop.put("searchagain", global ? "1" : "0");
prop.putHTML("former", originalquerystring.replaceAll(Segment.catchallString, "*"));
prop.put("count", itemsPerPage);