[sword-svn] r451 - trunk/webapp

scribe at crosswire.org scribe at crosswire.org
Mon Jul 23 14:03:30 MST 2018


Author: scribe
Date: 2018-07-23 14:03:30 -0700 (Mon, 23 Jul 2018)
New Revision: 451

Modified:
   trunk/webapp/simplegadget.jsp
Log:
Added new mechanism to return current verse to anyone who queries


Modified: trunk/webapp/simplegadget.jsp
===================================================================
--- trunk/webapp/simplegadget.jsp	2018-07-21 19:19:32 UTC (rev 450)
+++ trunk/webapp/simplegadget.jsp	2018-07-23 21:03:30 UTC (rev 451)
@@ -67,6 +67,7 @@
 	
 
 <script type="text/javascript">
+var lastBibCont = null;
 var tabLabel = '';
 var specialModules = {
      bo  : "SahidicBible",
@@ -227,16 +228,22 @@
 			// for some reason, offset() and position() don't take into account that we have a div above for quick lookup
 			$('#chapterContent').scrollTop(new_position.top-$('#chapterContent').offset().top + $($('#chapterContent').parent().children()[0]).height());
 		}
-		var data = { 
+		lastBibCont = { 
 			module       : swordModule,
 			indexContent : results[0],
 			content      : $('div.currentverse:last').prop('outerHTML')
 		};
-		if (gadgets.util.hasFeature('pubsub-2')) gadgets.Hub.publish("interedition.biblicalcontent.selected", data);
+		bibcont_queried_callback();
 	}, 100);
 
 }
 
+
+function bibcont_queried_callback() {
+		if (gadgets.util.hasFeature('pubsub-2')) gadgets.Hub.publish("interedition.biblicalcontent.selected", lastBibCont);
+}
+
+
 function lookup(verse) {
 	$('#tabs').tabs('option', 'active', 0);
 	result = document.getElementById('chapterContent');
@@ -392,6 +399,7 @@
 		subId = gadgets.Hub.subscribe("interedition.page.selected", page_select_callback);
 		subId = gadgets.Hub.subscribe("interedition.word.hover", word_hover_callback);
 		subId = gadgets.Hub.subscribe("interedition.word.selected", word_selected_callback);
+		subId = gadgets.Hub.subscribe("interedition.biblicalcontent.queried", bibcont_queried_callback);
 		loaded();
 	};
 }




More information about the sword-cvs mailing list