[jsword-svn] r1810 - trunk/incubator/jsword-www/jswordweb

Apache apache at www.crosswire.org
Wed Apr 23 07:11:32 MST 2008


Author: 
Date: 2008-04-23 07:11:32 -0700 (Wed, 23 Apr 2008)
New Revision: 1810

Modified:
   trunk/incubator/jsword-www/jswordweb/iBD.js
   trunk/incubator/jsword-www/jswordweb/index.html
Log:
add dict

Modified: trunk/incubator/jsword-www/jswordweb/iBD.js
===================================================================
--- trunk/incubator/jsword-www/jswordweb/iBD.js	2008-04-22 00:48:24 UTC (rev 1809)
+++ trunk/incubator/jsword-www/jswordweb/iBD.js	2008-04-23 14:11:32 UTC (rev 1810)
@@ -45,6 +45,7 @@
   // Populate the books dropdown.
   // The last argument is an asynchronous callback
   JSword.getInstalledBooks("bookCategory=Bible", loadBooks);
+  JSword.getInstalledBooks("bookCategory=Dictionary", loadDictionaries);
 
   // Constrain the display area to be within the boundary of the window.
   window.onresize = ibdResize;
@@ -76,6 +77,14 @@
   // Use "0", "0" to only show the books "initials"
   dwr.util.addOptions("books", data, "0", "0");
 }
+/**
+ * Load the list of known Dictionaries
+ */
+function loadDictionaries(data)
+{
+  dwr.util.removeAllOptions("dictionaries");
+  dwr.util.addOptions("dictionaries", data, "0", "0");
+}
 
 /**
  * Called when book data has been fetched
@@ -102,10 +111,12 @@
  */
 function pick()
 {
-  // When the book changes, take what ever is in locate and get it.
-  // If that doesn't work then try what ever is in search.
   locate() || search();
 }
+function pick_dictionary()
+{
+  locate_dictionary() || search_dictionary();
+}
 
 /**
  * Locate a passage.
@@ -122,6 +133,18 @@
   }
   return false;
 }
+function locate_dictionary()
+{
+  var dict= getDictionary();
+  var ref= getSearch();
+ /** var ref  = getPassage();*/
+  if (dict&& ref)
+  {
+    JSword.getOSISString(dict, ref, verseStart,verseLimit, loadDisplay);
+    return true;
+  }
+  return false;
+}
 
 function prev()
 {
@@ -184,6 +207,19 @@
   }
   return false;
 }
+function search_dictionary()
+{
+  var book   = getDictionary();
+  var search = getSearch();
+  if (book && search)
+  {
+    // Get the reference for the search
+    // and asynchrounously load it in to the locate box
+    JSword.search(book, search, setPassage);
+    return true;
+  }
+  return false;
+}
 
 /**
  * Get the search request.
@@ -235,6 +271,10 @@
 {
   return dwr.util.getValue("books");
 }
+function getDictionary()
+{
+  return dwr.util.getValue("dictionaries");
+}
 
 /**
  * Set the book to search or locate against
@@ -248,6 +288,15 @@
   // Allow this to be used in an anchor that ignores its href
   return false;
 }
+function setDictionary(book)
+{
+  // When ever a book is set
+  dwr.util.setValue("dictionaries", book);
+  // See if there is something we can locate or search.
+  pick_dictionary();
+  // Allow this to be used in an anchor that ignores its href
+  return false;
+}
 
 function loadDiagnostic(data)
 {

Modified: trunk/incubator/jsword-www/jswordweb/index.html
===================================================================
--- trunk/incubator/jsword-www/jswordweb/index.html	2008-04-22 00:48:24 UTC (rev 1809)
+++ trunk/incubator/jsword-www/jswordweb/index.html	2008-04-23 14:11:32 UTC (rev 1810)
@@ -18,10 +18,14 @@
     <link rel="stylesheet" type="text/css" href="iBD.css"/>
   </head>
   <body onload="init()">
-
+Bibles:
     <div id="bibleBox">
       <select id="books" onchange="pick();"></select>
     </div>
+Dictionaries:
+    <div id="dictionarybox">
+      <select id="dictionaries" onchange="pick_dictionary();"></select>
+    </div>
 
     <div id="locateBox" align="left">
       <input type="text" id="passageRequest" onkeypress="dwr.util.onReturn(event, locate)"/>




More information about the jsword-svn mailing list