[sword-svn] r411 - trunk/webapp

scribe at crosswire.org scribe at crosswire.org
Tue Sep 24 04:13:45 MST 2013


Author: scribe
Date: 2013-09-24 04:13:45 -0700 (Tue, 24 Sep 2013)
New Revision: 411

Modified:
   trunk/webapp/simplegadget.jsp
Log:
updated to add word spans to current verse if they don't exist


Modified: trunk/webapp/simplegadget.jsp
===================================================================
--- trunk/webapp/simplegadget.jsp	2013-09-23 22:43:05 UTC (rev 410)
+++ trunk/webapp/simplegadget.jsp	2013-09-24 11:13:45 UTC (rev 411)
@@ -38,6 +38,7 @@
      <EnumValue value="200" display_value="Short"/>
      <EnumValue value="300" display_value="Medium"/>
      <EnumValue value="400" display_value="Tall"/>
+     <EnumValue value="600" display_value="Very Tall"/>
      <EnumValue value="-1" display_value="Dynamic"/>
 </UserPref>
 
@@ -147,6 +148,20 @@
 
 }
 
+
+function addSpansIfNecessary() {
+	if ($('.currentverse').find('span').length < 2) {
+		var text = $('.currentverse:last').html();
+		var words = text.split(' ');
+		text = '';
+		for (var i = 0; i < words.length; ++i) {
+			text += '<span>'+words[i]+'</span> ';
+		}
+		$('.currentverse:last').html(text);
+	}
+}
+
+
 function lookup_callback(o) {
 	var results = o.text.split('%%%');
 	clearExpandFillPageClients();
@@ -154,6 +169,8 @@
 	$('#verseRef').val(results[0]);
 	$('#chapterContent').html(results[1]);
 
+	addSpansIfNecessary();
+
 	if (gadgets.util.hasFeature('dynamic-height') && preferredHeight == -1) gadgets.window.adjustHeight();
 	setTimeout(function() {
 		if (gadgets.util.hasFeature('dynamic-height') && preferredHeight == -1) gadgets.window.adjustHeight();
@@ -164,7 +181,12 @@
 			// 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 = { 
+			module  : swordModule,
+			key     : results[0]
+		};
 		if (gadgets.util.hasFeature('pubsub-2')) gadgets.Hub.publish("interedition.biblicalcontent.selected", results[0]);
+		if (gadgets.util.hasFeature('pubsub-2')) gadgets.Hub.publish("interedition.biblicalcontent.selectedEx", data);
 	}, 100);
 
 }
@@ -264,7 +286,7 @@
 		fromMod : swordModule
 	};
 	lastWordData = data;
-	$('.currentverse').find('span').removeClass('currentSelectedWord');
+	$('span').removeClass('currentSelectedWord');
 	$(findWordSpan(word)).addClass('currentSelectedWord');
 	if (gadgets.util.hasFeature('pubsub-2')) gadgets.Hub.publish("interedition.word.selected", data);
 }




More information about the sword-cvs mailing list