Commits

J. Ryan Stinnett committed 14edba9

Added focusing for full text search input on main page

Comments (0)

Files changed (3)

bazaarvoice-customizations

 # HG changeset patch
 # User J. Ryan Stinnett <jryans@gmail.com>
-# Date 1295076996 21600
+# Date 1295227115 21600
 # Node ID a0baf2a260b3a7d8c496cd32e7b323a571462f52
-# Parent 166c1e6b7de93c1dcceed74b5351164465832e9d
+# Parent 16b49499630cb910716ea53394c3304b920510e5
 Bazaarvoice-specific customizations
 
 diff --git a/src/org/opensolaris/opengrok/search/Results.java b/src/org/opensolaris/opengrok/search/Results.java
 diff --git a/web/index.jsp b/web/index.jsp
 --- a/web/index.jsp
 +++ b/web/index.jsp
-@@ -33,16 +33,22 @@
+@@ -33,22 +33,28 @@
  String path = null;
  String sort = null;
  RuntimeEnvironment environment = RuntimeEnvironment.getInstance();
 -<div id="bar">
 -<%@ include file="menu.jspf" %>
 -</div>
+-<script type="text/javascript">
+-    <%-- Focus the full search input --%>
+-    $(document).ready(function() {
+-        $('#q').focus();
+-    });
+-</script>
 -<div id="results" style="font-size:100%">
 -<%@ include file="index_body.html" %>
 -</div>
 +                </form>
 +            </div>
 +        </div>
-+        
++
 +        <div id="content">
 +            <div id="contentMenu">
 +                <h1>Inspector Gadget search</h1>
 +                <%@ include file="menu.jspf" %>
++                <script type="text/javascript">
++                    <%-- Focus the full search input --%>
++                    $(document).ready(function() {
++                        $('#q').focus();
++                    });
++                </script>
 +            </div>
 +            <div id="contentBody">
 +                <%@ include file="index_body.html" %>
  <% if (!isDir) { %>
  <script type="text/javascript">/* <![CDATA[ */
  function lntoggle() {
-@@ -54,19 +62,15 @@
- function get_sym_list_contents()
+@@ -55,10 +63,10 @@
  {
      var contents = "";
--
+ 
 -    //contents += "<input id=\"input_highlight\" name=\"input_highlight\" class=\"q\"/>";
 -    //contents += "&nbsp;&nbsp;";
 -    //contents += "<b><a href=\"#\" onclick=\"javascript:add_highlight();return false;\" title=\"Add highlight\">Highlight</a></b><br>";
 +    //contents += "<button class=\"primary\" onclick=\"javascript:add_highlight();return false;\" title=\"Highlight references (macro/function/class definitions)\">Highlight</button>";
 +    contents += "<ul class=\"list-definitions list-definitions-master\" id=\"list-definitions-master-id\">"
  
+     // Symbol list is only defined when definitions were accessible (i.e. for the latest revision of a file)
+     if (!$.isFunction(window.get_sym_list)) {
+@@ -67,11 +75,8 @@
+ 
      var symbol_classes = get_sym_list();
      for (var i = 0; i < symbol_classes.length; i++) {
 -        if (i > 0) {
  
          var class_name = symbol_class[1];
  
-@@ -76,11 +80,14 @@
+@@ -81,11 +86,14 @@
              var symbol = symbols[j][0];
              var line = symbols[j][1];
              contents +=
      return contents;
  }
  
-@@ -92,7 +99,7 @@
+@@ -97,7 +105,7 @@
  }
  
  // Initial value
  document.sym_div_height_max = 480;
  document.sym_div_top = 100;
  document.sym_div_left_margin = 40;
-@@ -100,7 +107,7 @@
+@@ -105,7 +113,7 @@
  
  function get_sym_div_left()
  {
      return document.sym_div_left;
  }
  
-@@ -129,10 +136,10 @@
+@@ -134,10 +142,10 @@
      if (document.sym_div == null)
      {
          document.sym_div = document.createElement("div");
          document.sym_div.style.width = get_sym_div_width() + "px";
          document.sym_div.style.height = get_sym_div_height() + "px";
          document.sym_div.style.top = get_sym_div_top() + "px";
-@@ -142,12 +149,16 @@
+@@ -147,12 +155,16 @@
  
          document.body.appendChild(document.sym_div);
          document.sym_div_shown = 1;
              document.sym_div_shown = 0;
          }
          else
-@@ -156,7 +167,7 @@
+@@ -161,7 +173,7 @@
              document.sym_div.style.width = get_sym_div_width() + "px";
              document.sym_div.style.top = get_sym_div_top() + "px";
              document.sym_div.style.left = get_sym_div_left() + "px";
              document.sym_div_shown = 1;
          }
      }
-@@ -197,11 +208,13 @@
+@@ -202,11 +214,13 @@
  function HighlightKeyword(keyword)
  {
      var high_colors=[
  
      var pattern = "a:contains('" + keyword + "')";
      $(pattern).css({
-@@ -339,7 +352,7 @@
+@@ -344,7 +358,7 @@
  
                          if (br != null) {
                            int len = 0;
                            while((len = br.read(buf)) > 0) {
                                out.write(buf, 0, len);
                            }
-@@ -384,7 +397,7 @@
+@@ -389,7 +403,7 @@
                          if (g == Genre.DATA || g == Genre.XREFABLE || g == null) {
  		            %><div id="src">Binary file [Click <a href="<%=context%>/raw<%=path%>?r=<%=rev%>">here</a> to download] </div><%
                          } else {
                              if (g == Genre.PLAIN) {
                                  // We don't have any way to get definitions
                                  // for old revisions currently.
-@@ -484,7 +497,7 @@
+@@ -489,7 +503,7 @@
              }
          }
      }
 -        <td align="left" valign="middle">
 -            <br/><form action="search" id="sbox">
 -                <table cellpadding="2" border="0" cellspacing="0">
--                    <tr><td align="right"> Full&nbsp;Search </td><td><input tabindex="1" class="q" name="q" size="45" style="width: 300px" value="<%=Util.formQuoteEscape(q)%>"/></td>
+-                    <tr><td align="right"> Full&nbsp;Search </td><td><input tabindex="1" class="q" id="q" name="q" size="45" style="width: 300px" value="<%=Util.formQuoteEscape(q)%>"/></td>
 - <% if (hasProjects) { %>
 -                        <td rowspan="5" style="border-left:gray;border-left-width:thin;border-left-color:gray">
 -                            <!--<td align="right" valign="top"> -->
 +                        </option><%
                      }%>
 -                    </tr>
--                    <tr><td align="right"> Definition </td><td><input class="q" tabindex="2" name="defs" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(defs)%>"/></td></tr>
--                    <tr><td align="right"> Symbol </td><td><input class="q" tabindex="3" name="refs" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(refs)%>"/></td></tr>
--                    <tr><td align="right"> File&nbsp;Path </td><td><input class="q" tabindex="4" name="path" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(path)%>"/></td></tr>
--                    <tr><td align="right"> History </td><td><input class="q" tabindex="5" name="hist" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(hist)%>"/></td></tr>
+-                    <tr><td align="right"> Definition </td><td><input class="q" tabindex="2" id="defs" name="defs" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(defs)%>"/></td></tr>
+-                    <tr><td align="right"> Symbol </td><td><input class="q" tabindex="3" id="refs" name="refs" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(refs)%>"/></td></tr>
+-                    <tr><td align="right"> File&nbsp;Path </td><td><input class="q" tabindex="4" id="path" name="path" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(path)%>"/></td></tr>
+-                    <tr><td align="right"> History </td><td><input class="q" tabindex="5" id="hist" name="hist" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(hist)%>"/></td></tr>
 -<%-- TODO  Bug 11749
 -                    <% if (hasProjects) { %>
 -                    <tr><td align="right"> Project(s) </td><td>
+# HG changeset patch
+# Parent 0c6d9413e32f2bbed39d1d6b43344e6d62c72621
+# User J. Ryan Stinnett <jryans@gmail.com>
+# Date 1295226006 21600
+
+Focus the full text search input
+
+diff --git a/web/index.jsp b/web/index.jsp
+--- a/web/index.jsp
++++ b/web/index.jsp
+@@ -42,6 +42,12 @@
+ <div id="bar">
+ <%@ include file="menu.jspf" %>
+ </div>
++<script type="text/javascript">
++    <%-- Focus the full search input --%>
++    $(document).ready(function() {
++        $('#q').focus();
++    });
++</script>
+ <div id="results" style="font-size:100%">
+ <%@ include file="index_body.html" %>
+ </div>
+diff --git a/web/menu.jspf b/web/menu.jspf
+--- a/web/menu.jspf
++++ b/web/menu.jspf
+@@ -95,7 +95,7 @@
+         <td align="left" valign="middle">
+             <br/><form action="search" id="sbox">
+                 <table cellpadding="2" border="0" cellspacing="0">
+-                    <tr><td align="right"> Full&nbsp;Search </td><td><input tabindex="1" class="q" name="q" size="45" style="width: 300px" value="<%=Util.formQuoteEscape(q)%>"/></td>
++                    <tr><td align="right"> Full&nbsp;Search </td><td><input tabindex="1" class="q" id="q" name="q" size="45" style="width: 300px" value="<%=Util.formQuoteEscape(q)%>"/></td>
+  <% if (hasProjects) { %>
+                         <td rowspan="5" style="border-left:gray;border-left-width:thin;border-left-color:gray">
+                             <!--<td align="right" valign="top"> -->
+@@ -129,10 +129,10 @@
+                             </table></td><%
+                     }%>
+                     </tr>
+-                    <tr><td align="right"> Definition </td><td><input class="q" tabindex="2" name="defs" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(defs)%>"/></td></tr>
+-                    <tr><td align="right"> Symbol </td><td><input class="q" tabindex="3" name="refs" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(refs)%>"/></td></tr>
+-                    <tr><td align="right"> File&nbsp;Path </td><td><input class="q" tabindex="4" name="path" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(path)%>"/></td></tr>
+-                    <tr><td align="right"> History </td><td><input class="q" tabindex="5" name="hist" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(hist)%>"/></td></tr>
++                    <tr><td align="right"> Definition </td><td><input class="q" tabindex="2" id="defs" name="defs" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(defs)%>"/></td></tr>
++                    <tr><td align="right"> Symbol </td><td><input class="q" tabindex="3" id="refs" name="refs" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(refs)%>"/></td></tr>
++                    <tr><td align="right"> File&nbsp;Path </td><td><input class="q" tabindex="4" id="path" name="path" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(path)%>"/></td></tr>
++                    <tr><td align="right"> History </td><td><input class="q" tabindex="5" id="hist" name="hist" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(hist)%>"/></td></tr>
+ <%-- TODO  Bug 11749
+                     <% if (hasProjects) { %>
+                     <tr><td align="right"> Project(s) </td><td>
 tabular-xref
 xref-line-highlight
 check-js-symbol-list
+focus-full-text
 bazaarvoice-customizations