[sword-svn] r271 - trunk/webapp
scribe at www.crosswire.org
scribe at www.crosswire.org
Wed Aug 1 10:33:46 MST 2007
Author: scribe
Date: 2007-08-01 10:33:45 -0700 (Wed, 01 Aug 2007)
New Revision: 271
Modified:
trunk/webapp/swordweb.js
trunk/webapp/wordsearchresults.jsp
Log:
added the ability to color multiple words
Modified: trunk/webapp/swordweb.js
===================================================================
--- trunk/webapp/swordweb.js 2007-05-25 19:06:16 UTC (rev 270)
+++ trunk/webapp/swordweb.js 2007-08-01 17:33:45 UTC (rev 271)
@@ -148,12 +148,15 @@
}
}
-function colorLemmas(wordnum, key, morph) {
+function colorLemmas(wordnum, key, morph, augment) {
+ if (augment != true) {
+ for (i = 0; i < curspans.length; i++) {
+ curspans[i].className='';
+ }
+ curspans.length = 0;
+ }
+
spans = document.getElementsByTagName('span');
- for (i = 0; i < curspans.length; i++) {
- curspans[i].className='';
- }
- curspans.length = 0;
for (i = 0; i < spans.length; i++) {
ocf = spans[i].getAttribute('onclick');
if (ocf) {
Modified: trunk/webapp/wordsearchresults.jsp
===================================================================
--- trunk/webapp/wordsearchresults.jsp 2007-05-25 19:06:16 UTC (rev 270)
+++ trunk/webapp/wordsearchresults.jsp 2007-08-01 17:33:45 UTC (rev 271)
@@ -1,7 +1,7 @@
<%@ include file="init.jsp" %>
<%
- String colorKey = request.getParameter("colorKey");
+ String colorKeys[] = request.getParameterValues("colorKey");
String colorMorph = request.getParameter("colorMorph");
String resetModule = request.getParameter("mod");
String lastModType = (String) session.getAttribute("lastModType");
@@ -53,12 +53,18 @@
<tiles:put name="pintro" type="string" >
<div>
<%
- if (colorKey != null) {
+ if (colorKeys != null) {
%>
<script type="text/javascript" language="JavaScript">
<!--
function onPageLoad() {
- colorLemmas('x','<%=colorKey%>','<%=colorMorph%>');
+<%
+ for (int k = 0; k < colorKeys.length; k++) {
+%>
+ colorLemmas('x','<%=colorKeys[k]%>','<%=colorMorph%>', true);
+<%
+ }
+%>
}
// -->
</script>
@@ -176,21 +182,29 @@
<%
}
}
+ String linkOptions = "";
+ if (colorKeys != null) {
+ for (int k = 0; k < colorKeys.length; k++) {
+ linkOptions += "colorKey=" + colorKeys[k] + "&"; // we always force a final param to let this & be ok
+ }
+ }
+ linkOptions += "colorMorph=" + colorMorph;
+
for (int i = navStart; i < navEnd; ++i) {
if (i == (resultStart.intValue() / resultLimit.intValue())) {
%>
<li><%= i+1 %></li>
- <% }
+ <% }
else {
%>
- <li><a href="wordsearchresults.jsp?start=<%= i * resultLimit.intValue() %>&colorKey=<%=colorKey%>&colorMorph=<%=colorMorph%>" title="page <%= i+1 %> (<%= results[i * resultLimit.intValue()].key %>) of search results"><%= i+1 %></a></li>
+ <li><a href="wordsearchresults.jsp?start=<%= i * resultLimit.intValue() %>&<%= linkOptions %>" title="page <%= i+1 %> (<%= results[i * resultLimit.intValue()].key %>) of search results"><%= i+1 %></a></li>
<%
}
}
int lastPage = (results.length / resultLimit.intValue()) + ((results.length % resultLimit.intValue()) > 0 ? 1 : 0) -1;
if (navEnd < lastPage) {
%>
- <li> [...] <a href="wordsearchresults.jsp?start=<%= lastPage*resultLimit.intValue() %>&colorKey=<%=colorKey%>&colorMorph=<%=colorMorph%>" title="Last page (<%= results[lastPage].key %>) of search results"><%= lastPage+1 %></a></li>
+ <li> [...] <a href="wordsearchresults.jsp?start=<%= lastPage*resultLimit.intValue() %>&<%= linkOptions %>" title="Last page (<%= results[lastPage].key %>) of search results"><%= lastPage+1 %></a></li>
<%
}
%>
More information about the sword-cvs
mailing list