[open-ils-commits] r18156 - branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Oct 4 13:31:49 EDT 2010


Author: phasefx
Date: 2010-10-04 13:31:45 -0400 (Mon, 04 Oct 2010)
New Revision: 18156

Modified:
   branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/result_common.js
   branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/sidebar_extras.js
Log:
prevent repeat renderings of opac sidebar (relevant subjects, authors, etc.) in Firefox.  What's happening is that the rresultHandleMods is not firing immediately with each record retrieve, and so we get a flurry at the end where resultPageIsDone() returns true for all of them, triggering the allRecordsReceived event more than once.  So now at the end of the first allRecordsReceived event chain, we set a global variable, and have these render functions check to see if it has been set.

Modified: branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/result_common.js
===================================================================
--- branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/result_common.js	2010-10-04 17:16:59 UTC (rev 18155)
+++ branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/result_common.js	2010-10-04 17:31:45 UTC (rev 18156)
@@ -7,6 +7,7 @@
 
 var resultFetchAllRecords = false;
 var resultCompiledSearch = null;
+var allRecordsReceivedAndProcessed = false;
 
 /* set up the event handlers */
 if( findCurrentPage() == MRESULT || findCurrentPage() == RRESULT ) {
@@ -15,7 +16,7 @@
 	G.evt.result.copyCountsReceived.push(resultDisplayCopyCounts);
 	G.evt.result.allRecordsReceived.push(resultBuildCaches, resultDrawSubjects, 
       resultDrawAuthors, resultDrawSeries, function(){unHideMe($('result_info_2'))},
-	  fetchGoogleBooksLink);
+	  fetchGoogleBooksLink, function() { allRecordsReceivedAndProcessed = true; });
 
 	attachEvt('result','lowHits',resultLowHits);
 	attachEvt('result','zeroHits',resultZeroHits);
@@ -599,6 +600,8 @@
 }
 
 function fetchGoogleBooksLink () {
+    if (allRecordsReceivedAndProcessed) { return; }
+
     if (isbnList && googleBooksLink) {
         var scriptElement = document.createElement("script");
         scriptElement.setAttribute("id", "jsonScript");

Modified: branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/sidebar_extras.js
===================================================================
--- branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/sidebar_extras.js	2010-10-04 17:16:59 UTC (rev 18155)
+++ branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/sidebar_extras.js	2010-10-04 17:31:45 UTC (rev 18156)
@@ -6,6 +6,8 @@
 var seriesCache = {};
 
 function resultBuildCaches(records) {
+    if (allRecordsReceivedAndProcessed) { return; }
+
 	for( var r in records ) {
 		var rec = records[r];
 		for( var s in rec.subject() ) 
@@ -17,6 +19,7 @@
 
 function resultSortSubjects(a, b) { return -(a.count - b.count); } /* sort in reverse */
 function resultDrawSubjects() {
+    if (allRecordsReceivedAndProcessed) { return; }
 
 	var subjs = [];
 	for( var s in subjectCache )
@@ -34,6 +37,8 @@
 }
 
 function resultDrawAuthors() {
+    if (allRecordsReceivedAndProcessed) { return; }
+
 	var auths = new Array();
 	for( var s in authorCache ) auths.push(s);
 
@@ -45,6 +50,8 @@
 }
 
 function resultDrawSeries() {
+    if (allRecordsReceivedAndProcessed) { return; }
+
 	var sers = new Array();
 	for( var s in seriesCache ) sers.push(s);
 	resultDrawSidebarTrees( 



More information about the open-ils-commits mailing list