[sword-svn] r195 - in trunk: . WEB-INF/lib

scribe at crosswire.org scribe at crosswire.org
Fri Mar 11 05:32:04 MST 2005


Author: scribe
Date: 2005-03-11 05:32:03 -0700 (Fri, 11 Mar 2005)
New Revision: 195

Added:
   trunk/WEB-INF/lib/gnu-regexp-1.1.3.jar
   trunk/fetchdata.jsp
Modified:
   trunk/swordweb.js
Log:
Made js word lookups on demand load


Added: trunk/WEB-INF/lib/gnu-regexp-1.1.3.jar
===================================================================
(Binary files differ)


Property changes on: trunk/WEB-INF/lib/gnu-regexp-1.1.3.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/fetchdata.jsp
===================================================================
--- trunk/fetchdata.jsp	2005-03-10 13:23:56 UTC (rev 194)
+++ trunk/fetchdata.jsp	2005-03-11 12:32:03 UTC (rev 195)
@@ -0,0 +1,22 @@
+<%@ page
+    language="java"
+    contentType="text/html;charset=utf-8"
+%>
+
+<%@ page import="org.crosswire.sword.orb.*" %>
+
+<%
+	SWMgr mgr = SwordOrb.getSWMgrInstance(session);
+	SWModule book = null;
+	String key = request.getParameter("key");
+	String modName = request.getParameter("mod");
+	if (modName != null) {
+		book = mgr.getModuleByName(modName);
+	}
+	if ((key != null) && (book != null)) {
+		book.setKeyText(key);
+%>
+		<%= new String(book.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
+<%
+	}
+%>

Modified: trunk/swordweb.js
===================================================================
--- trunk/swordweb.js	2005-03-10 13:23:56 UTC (rev 194)
+++ trunk/swordweb.js	2005-03-11 12:32:03 UTC (rev 195)
@@ -13,6 +13,59 @@
 var refwindow;
 var stevec = 0;
 
+
+var xmlhttp=false;
+/*@cc_on @*/
+/*@if (@_jscript_version >= 5)
+// JScript gives us Conditional compilation, we can cope with old IE versions.
+// and security blocked creation of the objects.
+ try {
+  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (e) {
+  try {
+   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+  } catch (E) {
+   xmlhttp = false;
+  }
+ }
+ at end @*/
+if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
+  xmlhttp = new XMLHttpRequest();
+}
+
+var lastword = "";
+
+function p(mod, key, wordnum, extratext) {
+
+	/* check for aliases */
+	if (mod == "G") mod = "StrongsGreek";
+	if (mod == "H") mod = "StrongsHebrew";
+
+	xmlhttp.open("GET", "fetchdata.jsp?mod="+mod+"&key="+key,true);
+	xmlhttp.onreadystatechange=function() {
+		if (xmlhttp.readyState==4) {
+			b=document.getElementById("onlywlayer");
+			if (b==null) {
+				b=document.createElement("div");
+				b.id="onlywlayer";
+				b.className="word-layer";
+				document.body.appendChild(b);
+				b.style.visibility = "hidden";
+			}
+			b.innerHTML=xmlhttp.responseText + "<br/>"+extratext;
+			if ((wordnum == lastword) && (b.style.visibility == "visible")) {
+				showhide("onlywlayer", "hidden");
+			}
+			else {
+				showhide("onlywlayer", "visible");
+			}
+			lastword = wordnum;
+		}
+	}
+	xmlhttp.send(null)
+}
+
+
 function openref(url) {
 		stevec++;
 		var ime = "okno" + stevec;
@@ -175,7 +228,7 @@
   var graphic1 = 'opomba.gif';
   var graphic2 = 'opomba2.gif';
 
-  showhide(layer,image,graphic1,graphic2);
+  showhide(layer);
 }
 
 
@@ -183,11 +236,11 @@
   var graphic1 = 'ref.gif';
   var graphic2 = 'ref2.gif';
 
-  showhide(layer,image,graphic1,graphic2);
+  showhide(layer);
 }
 
 
-function showhide (layer,image,graphic1,graphic2){
+function showhide (layer, vis) {
 //	if(document.layers || document.all || navigator.userAgent.indexOf("Mozilla/5")!=-1)
 //	alert ("stanje od " + num + ": " + document.all[num].style.visibility + ", kaj= " + kaj);
 
@@ -205,14 +258,12 @@
 		cx = 5;
 		cy = cy + 20;
 	}
-	if (l.style.visibility == "visible"){
-		l.style.visibility = "hidden";
-	}
-	else{
+
+	if (vis == "visible") {
 		l.style.left = "" + cx + "px";
 		l.style.top = "" + cy + "px";
-		l.style.visibility = "visible";
 	}
+	l.style.visibility = vis;
 }
 
 
@@ -231,3 +282,4 @@
 		alert('Žal!\nNepoznan brkljalnik...\n.');
 }
 
+



More information about the sword-cvs mailing list