From 4ce21f0c9016e38161688a2f9a79035537f0fe08 Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 4 Oct 2010 17:16:59 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6@18155 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/skin/default/js/result_common.js | 5 ++++- Open-ILS/web/opac/skin/default/js/sidebar_extras.js | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/opac/skin/default/js/result_common.js b/Open-ILS/web/opac/skin/default/js/result_common.js index f93d7f64ed..bea7bc9b0f 100644 --- a/Open-ILS/web/opac/skin/default/js/result_common.js +++ b/Open-ILS/web/opac/skin/default/js/result_common.js @@ -7,6 +7,7 @@ var googleBooksLink = true; var resultFetchAllRecords = false; var resultCompiledSearch = null; +var allRecordsReceivedAndProcessed = false; /* set up the event handlers */ if( findCurrentPage() == MRESULT || findCurrentPage() == RRESULT ) { @@ -15,7 +16,7 @@ if( findCurrentPage() == MRESULT || findCurrentPage() == RRESULT ) { 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 resultBuildFormatIcons( row, rec, is_mr ) { } function fetchGoogleBooksLink () { + if (allRecordsReceivedAndProcessed) { return; } + if (isbnList && googleBooksLink) { var scriptElement = document.createElement("script"); scriptElement.setAttribute("id", "jsonScript"); diff --git a/Open-ILS/web/opac/skin/default/js/sidebar_extras.js b/Open-ILS/web/opac/skin/default/js/sidebar_extras.js index cb35d886d3..0f268b96e9 100644 --- a/Open-ILS/web/opac/skin/default/js/sidebar_extras.js +++ b/Open-ILS/web/opac/skin/default/js/sidebar_extras.js @@ -6,6 +6,8 @@ var authorCache = {}; 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 resultBuildCaches(records) { 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 resultDrawSubjects() { } function resultDrawAuthors() { + if (allRecordsReceivedAndProcessed) { return; } + var auths = new Array(); for( var s in authorCache ) auths.push(s); @@ -45,6 +50,8 @@ function resultDrawAuthors() { } function resultDrawSeries() { + if (allRecordsReceivedAndProcessed) { return; } + var sers = new Array(); for( var s in seriesCache ) sers.push(s); resultDrawSidebarTrees( -- 2.11.0