From 514963d836ba78fb09d1c574cf2ea479433e668a Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Tue, 3 Apr 2007 14:27:21 +0000 Subject: [PATCH] Annoying flickering of facets (after clicking) removed. --- js/pz2.js | 27 +++++++++++++++++++-------- www/masterkey/css/styles.css | 1 - www/masterkey/js/client.js | 21 +++++++++------------ 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/js/pz2.js b/js/pz2.js index 9d1e294..ff5ca24 100644 --- a/js/pz2.js +++ b/js/pz2.js @@ -1,5 +1,5 @@ /* -** $Id: pz2.js,v 1.4 2007-03-28 15:20:53 jakub Exp $ +** $Id: pz2.js,v 1.5 2007-04-03 14:27:21 jakub Exp $ ** pz2.js - pazpar2's javascript client library. */ @@ -71,13 +71,18 @@ var pz2 = function(paramArray) { //timers __myself.statTime = paramArray.stattime || 2000; __myself.statTimer = null; - __myself.termTime = paramArray.termtime || 2000; + __myself.termTime = paramArray.termtime || 1000; __myself.termTimer = null; - __myself.showTime = paramArray.showtime || 2000; + __myself.showTime = paramArray.showtime || 1000; __myself.showTimer = null; __myself.bytargetTime = paramArray.bytargettime || 1000; __myself.bytargetTimer = null; + //useful? + __myself.dumpFactor = 500; + __myself.showCounter = 0; + __myself.termCounter = 0; + // active clients, updated by stat and show // might be an issue since bytarget will poll accordingly __myself.activeClients = 1; @@ -141,7 +146,10 @@ pz2.prototype = { clearTimeout(__myself.showTimer); clearTimeout(__myself.termTimer); clearTimeout(__myself.bytargetTimer); - + + __myself.showCounter = 0; + __myself.termCounter = 0; + if( !__myself.initStatusOK ) return; @@ -165,8 +173,8 @@ pz2.prototype = { if ( __myself.statCallback ) __myself.statTimer = setTimeout("__myself.stat()", __myself.statTime / 2); if ( __myself.termlistCallback ) - __myself.termlist(); - //__myself.termTimer = setTimeout("__myself.termlist()", __myself.termTime / 2); + //__myself.termlist(); + __myself.termTimer = setTimeout("__myself.termlist()", __myself.termTime / 2); if ( __myself.bytargetCallback ) __myself.bytargetTimer = setTimeout("__myself.bytarget()", __myself.bytargetTime / 2); } @@ -257,8 +265,9 @@ pz2.prototype = { } } __myself.showCallback(show); + __myself.showCounter++; if (activeClients > 0) - __myself.showTimer = setTimeout("__myself.show()", __myself.showTime); + __myself.showTimer = setTimeout("__myself.show()", (__myself.showTime + __myself.showCounter*__myself.dumpFactor)); } else // if it gets here the http return code was 200 (pz2 errors are 417) @@ -345,9 +354,11 @@ pz2.prototype = { termList[listName][j] = term; } } + __myself.termlistCallback(termList); + __myself.termCounter++; if (termList["activeclients"] > 0) - __myself.termTimer = setTimeout("__myself.termlist()", __myself.termTime); + __myself.termTimer = setTimeout("__myself.termlist()", (__myself.termTime + __myself.termCounter*__myself.dumpFactor)); } else // if it gets here the http return code was 200 (pz2 errors are 417) diff --git a/www/masterkey/css/styles.css b/www/masterkey/css/styles.css index ac0612c..65a540e 100755 --- a/www/masterkey/css/styles.css +++ b/www/masterkey/css/styles.css @@ -316,7 +316,6 @@ background-color: #f6f6f9; padding-left: 0px; padding-right: 0px; margin-bottom: 10px; -height: 28px; width: inherit; line-height: 28px; } diff --git a/www/masterkey/js/client.js b/www/masterkey/js/client.js index 6a8683d..6999a6e 100644 --- a/www/masterkey/js/client.js +++ b/www/masterkey/js/client.js @@ -1,5 +1,5 @@ /* -** $Id: client.js,v 1.10 2007-04-02 15:50:27 jakub Exp $ +** $Id: client.js,v 1.11 2007-04-03 14:27:21 jakub Exp $ ** MasterKey - pazpar2's javascript client . */ @@ -15,12 +15,8 @@ var my_paz = new pz2( { "onshow": my_onshow, /* some state variable */ var currentSort = 'relevance'; var currentResultsPerPage = 20; -/*var currentQuery = null; -var currentQueryArr = new Array();*/ var currentPage = 0; var curQuery = new pzQuery(); -/*var currentFilter = undefined;*/ -/*var currentFilterName = null;*/ var currentDetailedId = null; var currentDetailedData = null; @@ -131,10 +127,10 @@ function my_onstat(data){} */ function my_onterm(data) { - var termLists = $("#termlists"); - if(termStartup) { + var termLists = $("#termlists"); + for(var key in data){ if (key == "activeclients") continue; @@ -187,7 +183,7 @@ function my_onterm(data) if (key == "activeclients") continue; var listEntries = $('#term_'+key).children('.termEntries'); - listEntries.empty() + if( data[key].length ) listEntries.empty(); for(var i = 0; i < data[key].length; i++){ if (key == "xtargets"){ @@ -230,6 +226,7 @@ function fireSearch() $('div.showing').empty().text('No records to show.'); $('div.pages').empty().html(' '); $('div.records').empty(); + currentDetailedId = null; if( !curQuery.totalLength() ) return false; my_paz.search(curQuery.toCCL(), currentResultsPerPage, currentSort, curQuery.getFilterString() ); @@ -320,10 +317,10 @@ function loadFormFieldsFromQuery() { switch( curQuery.getTermFieldByIdx(i) ) { - case "au": document.search.author.value += curQuery.getTermValueByIdx(i) + ';'; break; - case "ti": document.search.title.value += curQuery.getTermValueByIdx(i) + ';'; break; - case "date": document.search.date.value += curQuery.getTermValueByIdx(i) + ';'; break; - case "su": document.search.subject.value += curQuery.getTermValueByIdx(i) + ';'; break; + case "au": document.search.author.value += curQuery.getTermValueByIdx(i) + '; '; break; + case "ti": document.search.title.value += curQuery.getTermValueByIdx(i) + '; '; break; + case "date": document.search.date.value += curQuery.getTermValueByIdx(i) + '; '; break; + case "su": document.search.subject.value += curQuery.getTermValueByIdx(i) + '; '; break; } } } -- 1.7.10.4